File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
openmp/runtime/src/include Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 99#ifndef __OMPX_H
1010#define __OMPX_H
1111
12- #ifdef __AMDGCN_WAVEFRONT_SIZE
13- #define __WARP_SIZE __AMDGCN_WAVEFRONT_SIZE
14- #else
15- #define __WARP_SIZE 32
12+ #if (defined(__NVPTX__) || defined(__AMDGPU__))
13+ #include <gpuintrin.h>
14+ #define __OMPX_TARGET_IS_GPU
1615#endif
1716
1817typedef unsigned long uint64_t;
18+ typedef unsigned int uint32_t;
19+
20+ static inline uint32_t __warpSize(void) {
21+ #ifdef __OMPX_TARGET_IS_GPU
22+ return __gpu_num_lanes();
23+ #else
24+ __builtin_trap();
25+ #endif
26+ }
1927
2028#ifdef __cplusplus
2129extern "C" {
@@ -212,7 +220,7 @@ static inline uint64_t ballot_sync(uint64_t mask, int pred) {
212220///{
213221#define _TGT_KERNEL_LANGUAGE_SHFL_DOWN_SYNC(TYPE, TY) \
214222 static inline TYPE shfl_down_sync(uint64_t mask, TYPE var, unsigned delta, \
215- int width = __WARP_SIZE) { \
223+ int width = __warpSize()) { \
216224 return ompx_shfl_down_sync_##TY(mask, var, delta, width); \
217225 }
218226
You can’t perform that action at this time.
0 commit comments