diff options
| author | Joseph Huber <huberjn@outlook.com> | 2024-11-25 07:38:28 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-25 07:38:28 -0600 |
| commit | 506ca19dc9d6a9f0ad47b82e71525743bbe8cf85 (patch) | |
| tree | 2cff996869d74b9f99fa2bcf28da6a780cdd4b80 /offload/DeviceRTL/src/Mapping.cpp | |
| parent | 52755ac2531529369f1f29b9d0b29645f304f389 (diff) | |
[OpenMP] Remove use of '__AMDGCN_WAVEFRONT_SIZE' (#113156)
Summary:
This is going to be deprecated in
https://github.com/llvm/llvm-project/pull/112849. This patch ports it to
use the builtin instead. This isn't a compile constant, so it could
slightly negatively affect codegen. There really should be an IR pass to
turn it into a constant if the function has known attributes.
Using the builtin is correct when we just do it for knowing the size
like we do here. Obviously guarding w32/w64 code with this check would
be broken.
Diffstat (limited to 'offload/DeviceRTL/src/Mapping.cpp')
| -rw-r--r-- | offload/DeviceRTL/src/Mapping.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/offload/DeviceRTL/src/Mapping.cpp b/offload/DeviceRTL/src/Mapping.cpp index 3aefcff68e19..881bd12f0340 100644 --- a/offload/DeviceRTL/src/Mapping.cpp +++ b/offload/DeviceRTL/src/Mapping.cpp @@ -25,7 +25,6 @@ namespace ompx { namespace impl { // Forward declarations defined to be defined for AMDGCN and NVPTX. -const llvm::omp::GV &getGridValue(); LaneMaskTy activemask(); LaneMaskTy lanemaskLT(); LaneMaskTy lanemaskGT(); @@ -37,15 +36,14 @@ uint32_t getBlockIdInKernel(int32_t Dim); uint32_t getNumberOfBlocksInKernel(int32_t Dim); uint32_t getWarpIdInBlock(); uint32_t getNumberOfWarpsInBlock(); +uint32_t getWarpSize(); /// AMDGCN Implementation /// ///{ #pragma omp begin declare variant match(device = {arch(amdgcn)}) -const llvm::omp::GV &getGridValue() { - return llvm::omp::getAMDGPUGridValues<__AMDGCN_WAVEFRONT_SIZE>(); -} +uint32_t getWarpSize() { return __builtin_amdgcn_wavefrontsize(); } uint32_t getNumberOfThreadsInBlock(int32_t Dim) { switch (Dim) { @@ -152,7 +150,7 @@ uint32_t getNumberOfThreadsInBlock(int32_t Dim) { UNREACHABLE("Dim outside range!"); } -const llvm::omp::GV &getGridValue() { return llvm::omp::NVPTXGridValues; } +uint32_t getWarpSize() { return __nvvm_read_ptx_sreg_warpsize(); } LaneMaskTy activemask() { return __nvvm_activemask(); } @@ -219,8 +217,6 @@ uint32_t getNumberOfWarpsInBlock() { #pragma omp end declare variant ///} -uint32_t getWarpSize() { return getGridValue().GV_Warp_Size; } - } // namespace impl } // namespace ompx |
