[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
Fri Jun 13 06:16: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;
+
+static inline uint32_t __warpSize(void) {
+  #ifdef __OMPX_TARGET_IS_GPU
+    return __gpu_num_lanes();
+  #else
+    __builtin_trap();
+  #endif
----------------
shiltian wrote:

```suggestion
#ifdef __OMPX_TARGET_IS_GPU
  return __gpu_num_lanes();
#else
  __builtin_trap();
#endif
```

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


More information about the Openmp-commits mailing list