[clang] [CIR][AMDGPU] Add support for AMDGCN workgroup_size builtins (PR #231156)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 07:50:37 PDT 2026


================
@@ -138,3 +138,24 @@ __device__ unsigned test_grid_size_z() {
 // OGCG: [[P:%.*]] = call{{.*}} ptr addrspace(4) @llvm.amdgcn.dispatch.ptr()
 // OGCG: [[GEP:%.*]] = getelementptr i8, ptr addrspace(4) [[P]], i32 20
 // OGCG: load i32, ptr addrspace(4) [[GEP]], align 4, !range !{{.*}}, !invariant.load
+
+__device__ unsigned test_workgroup_size_x() {
+  return __builtin_amdgcn_workgroup_size_x();
----------------
steffenlarsen wrote:

Similar to #230798, it would be good to check all sizes for the sake of coverage.

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


More information about the cfe-commits mailing list