[clang] [llvm] [SPIR-V] DRAFT: Shader built-ins - no spec change (PR #116393)
Nathan Gauër via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 04:24:35 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;
+ }
----------------
Keenuts wrote:
Yes, this can clearly be refactorized in a real implementation. Just wanted to keep it simple for the draft.
https://github.com/llvm/llvm-project/pull/116393
More information about the llvm-commits
mailing list