[clang] [llvm] [SPIR-V] DRAFT: Shader built-ins - no spec change (PR #116393)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 15 12:34:07 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list