[clang] [llvm] [HLSL][SPIR-V] implement SV_GroupID semantic lowering (PR #121521)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 09:36:46 PST 2025


================
@@ -2881,6 +2881,14 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
     // translated to a `LocalInvocationId` builtin variable
     return loadVec3BuiltinInputID(SPIRV::BuiltIn::LocalInvocationId, ResVReg,
                                   ResType, I);
+  case Intrinsic::spv_group_id:
+    // The HLSL SV_GroupId semantic is lowered to
+    // llvm.spv.group.id intrinsic in LLVM IR for SPIR-V backend.
+    //
+    // In SPIR-V backend, llvm.spv.group.id is now translated to a `WorkgroupId`
+    // builtin variable
+    return loadVec3BuiltinInputID(SPIRV::BuiltIn::WorkgroupId, ResVReg, ResType,
+                                  I);
----------------
farzonl wrote:

The formatting looks off.

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


More information about the llvm-commits mailing list