[Openmp-commits] [openmp] [OpenMP] Remove declaration and usage of __AMDGCN_WAVEFRONT_SIZE (PR #143761)

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 12 08:21:53 PDT 2025


================
@@ -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;
+
+inline uint32_t gpu_num_lanes(void) {
+  #ifdef OMPX_TARGET_IS_GPU
+    return __gpu_num_lanes();
+  #else
+    return 1;
----------------
shiltian wrote:

Honestly it doesn't really matter what the value would be for non-GPU targets, since this entire OMPX stuff would not work on non-GPU at all. To make it even safer, I'd put a `__builtin_trap` here.

https://github.com/llvm/llvm-project/pull/143761


More information about the Openmp-commits mailing list