diff options
author | nicebert <110385235+nicebert@users.noreply.github.com> | 2025-06-13 16:46:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-13 10:46:36 -0400 |
commit | cf6ae065a042aae6324b28e99628c40bc53be0b7 (patch) | |
tree | 95e8ea7541c721b96f9fc351dac5cf6b43ff5b1b | |
parent | 9670e09d0eac596fba6bf03ef1a6f3229dddee46 (diff) | |
download | llvm-cf6ae065a042aae6324b28e99628c40bc53be0b7.zip llvm-cf6ae065a042aae6324b28e99628c40bc53be0b7.tar.gz llvm-cf6ae065a042aae6324b28e99628c40bc53be0b7.tar.bz2 |
[OpenMP] Remove declaration and usage of __AMDGCN_WAVEFRONT_SIZE (#143761)
Removes usage of __AMDGCN_WAVEFRONT_SIZE as compile time constant.
---------
Co-authored-by: Shilei Tian <i@tianshilei.me>
-rw-r--r-- | openmp/runtime/src/include/ompx.h.var | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/openmp/runtime/src/include/ompx.h.var b/openmp/runtime/src/include/ompx.h.var index 623f0b9..6884745 100644 --- a/openmp/runtime/src/include/ompx.h.var +++ b/openmp/runtime/src/include/ompx.h.var @@ -9,13 +9,21 @@ #ifndef __OMPX_H #define __OMPX_H -#ifdef __AMDGCN_WAVEFRONT_SIZE -#define __WARP_SIZE __AMDGCN_WAVEFRONT_SIZE -#else -#define __WARP_SIZE 32 +#if (defined(__NVPTX__) || defined(__AMDGPU__)) +#include <gpuintrin.h> +#define __OMPX_TARGET_IS_GPU #endif typedef unsigned long uint64_t; +typedef unsigned int uint32_t; + +static inline uint32_t __warpSize(void) { +#ifdef __OMPX_TARGET_IS_GPU + return __gpu_num_lanes(); +#else + __builtin_trap(); +#endif +} #ifdef __cplusplus extern "C" { @@ -212,7 +220,7 @@ static inline uint64_t ballot_sync(uint64_t mask, int pred) { ///{ #define _TGT_KERNEL_LANGUAGE_SHFL_DOWN_SYNC(TYPE, TY) \ static inline TYPE shfl_down_sync(uint64_t mask, TYPE var, unsigned delta, \ - int width = __WARP_SIZE) { \ + int width = __warpSize()) { \ return ompx_shfl_down_sync_##TY(mask, var, delta, width); \ } |