[clang] [Headers] Create stub spirvintrin.h (PR #131164)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 12:07:13 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff c9d7f707c101896294d2f4ccbf26329894295dc9 1dbc0b25e69879a8799a03027e257ea68e1d596f --extensions c,h -- clang/lib/Headers/spirvintrin.h clang/lib/Headers/amdgpuintrin.h clang/lib/Headers/gpuintrin.h clang/test/Headers/gpuintrin.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Headers/gpuintrin.h b/clang/lib/Headers/gpuintrin.h
index c4fa30983a..a04966de99 100644
--- a/clang/lib/Headers/gpuintrin.h
+++ b/clang/lib/Headers/gpuintrin.h
@@ -56,21 +56,19 @@ __gpu_match_all_u64_impl(uint64_t __lane_mask, uint64_t __x);
 _Pragma("omp end declare variant");
 _Pragma("omp end declare target");
 
-
-
 #if defined(__NVPTX__)
-  #include <nvptxintrin.h>
+#include <nvptxintrin.h>
 #elif defined(__AMDGPU__)
-  #if defined(__SPIRV64__)
-    // the spirv64-amd-amdhsa triple claims to be amdgpu and spirv
-    #include <spirvintrin.h>
-  #else
-    #include <amdgpuintrin.h>
-  #endif
+#if defined(__SPIRV64__)
+// the spirv64-amd-amdhsa triple claims to be amdgpu and spirv
+#include <spirvintrin.h>
+#else
+#include <amdgpuintrin.h>
+#endif
 #elif defined(__SPIRV64__)
-  #include <spirvintrin.h>
+#include <spirvintrin.h>
 #elif !defined(_OPENMP)
-  #error "This header is only meant to be used on GPU architectures."
+#error "This header is only meant to be used on GPU architectures."
 #endif
 
 _Pragma("omp begin declare target device_type(nohost)");
diff --git a/clang/lib/Headers/spirvintrin.h b/clang/lib/Headers/spirvintrin.h
index ae63b24304..9cd4d3fe26 100644
--- a/clang/lib/Headers/spirvintrin.h
+++ b/clang/lib/Headers/spirvintrin.h
@@ -37,12 +37,11 @@
 #define __gpu_kernel
 
 // Returns the number of workgroups in the 'x' dimension of the grid.
-_DEFAULT_FN_ATTRS uint32_t __gpu_num_blocks_x(void)
-{
+_DEFAULT_FN_ATTRS uint32_t __gpu_num_blocks_x(void) {
 #if defined(__AMDGPU__)
   return __builtin_amdgcn_grid_size_x() / __builtin_amdgcn_workgroup_size_x();
 #else
-  #error "Not yet implemented"
+#error "Not yet implemented"
 #endif
 }
 

``````````

</details>


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


More information about the cfe-commits mailing list