[MUSA][8/N] Port CUDA kernels that are compatible with MUSA (#17946)
Signed-off-by: yafeng.li <yafeng.li@mthreads.com> Co-authored-by: Alex Nails <alex.nails@radixark.ai>
This commit is contained in:
@@ -7,11 +7,18 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef USE_MUSA
|
||||
__forceinline__ __device__ int get_lane_id() {
|
||||
int lane_id;
|
||||
asm("mov.s32 %0, %laneid;" : "=r"(lane_id));
|
||||
return lane_id;
|
||||
}
|
||||
#else
|
||||
constexpr int WarpSize = 32;
|
||||
__forceinline__ __device__ int get_lane_id() {
|
||||
return threadIdx.x % WarpSize;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ceil_div(int a, int b) {
|
||||
return (a + b - 1) / b;
|
||||
|
||||
Reference in New Issue
Block a user