================
@@ -379,6 +380,18 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> 
&B,
                                               const ParmVarDecl &D,
                                               llvm::Type *Ty) {
   assert(D.hasAttrs() && "Entry parameter missing annotation attribute!");
+
+  if (D.hasAttr<HLSLSV_GroupIDAttr>()) {
+    if (getArch() == llvm::Triple::spirv) {
+      llvm::Type *Ty = CGM.getTypes().ConvertTypeForMem(D.getType());
+      llvm::Function *IntrinsicID =
+          CGM.getIntrinsic(Intrinsic::spv_load_builtin, {Ty});
+      return B.CreateCall(IntrinsicID, {B.getInt32(/* WorkgroupID */ 26)});
+    } else
+      // FIXME: getIntrinsic(getGroupIDIntrinsic())
+      return nullptr;
+  }
----------------
s-perron wrote:

Could something be added to `CommonSPIRTargetCodeGenInfo` and the DXIL 
equivalent? That way the spir-v specific ids will be hidden in a spirv specific 
class.

https://github.com/llvm/llvm-project/pull/116393
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to