-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(kernel): 实现 slice 的重整和 cuda kernel 调用
Signed-off-by: YdrMaster <[email protected]>
- Loading branch information
Showing
7 changed files
with
146 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef KERNEL_CUDA_SLICE_CUH | ||
#define KERNEL_CUDA_SLICE_CUH | ||
|
||
#include "threads_distributer.cuh" | ||
|
||
namespace refactor::kernel::cuda { | ||
|
||
struct DimInfo { | ||
unsigned int countStride, sizeStart; | ||
int sizeStride; | ||
}; | ||
|
||
void launchSlice( | ||
KernelLaunchParameters const &, | ||
void const *src, DimInfo const *dims, void *output, | ||
unsigned int blockSize); | ||
|
||
}// namespace refactor::kernel::cuda | ||
|
||
#endif// KERNEL_CUDA_SLICE_CUH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "kernel/cuda/slice.cuh" | ||
#include <cstdint> | ||
|
||
namespace refactor::kernel::cuda { | ||
|
||
__global__ static void sliceKernel( | ||
unsigned long long n, | ||
uint8_t const *src, DimInfo const *dims, uint8_t *output, | ||
unsigned int blockSize) { | ||
} | ||
|
||
void launchSlice( | ||
KernelLaunchParameters const ¶ms, | ||
void const *src, DimInfo const *dims, void *output, | ||
unsigned int blockSize) { | ||
sliceKernel<<< | ||
params.gridSize, | ||
params.blockSize, | ||
params.dynamicSharedBytes, | ||
reinterpret_cast<cudaStream_t>(params.stream)>>>( | ||
params.n, | ||
reinterpret_cast<uint8_t const *>(src), | ||
dims, | ||
reinterpret_cast<uint8_t *>(output), | ||
blockSize); | ||
} | ||
|
||
}// namespace refactor::kernel::cuda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters