[PATCH] D131203: [HLSL] Initial codegen for SV_GroupIndex
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 18 10:16:25 PDT 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:94
llvm::Function *F, const FunctionDecl *FD) {
- if (HLSLShaderAttr *ShaderAttr = FD->getAttr<HLSLShaderAttr>()) {
- const StringRef ShaderAttrKindStr = "dx.shader";
- F->addFnAttr(ShaderAttrKindStr,
- ShaderAttr->ConvertShaderTypeToStr(ShaderAttr->getType()));
+ HLSLShaderAttr *ShaderAttr = FD->getAttr<HLSLShaderAttr>();
+ assert(ShaderAttr && "All entry functions must have a HLSLShaderAttr");
----------------
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:107-108
+ CGM.getIntrinsic(Intrinsic::dx_flattened_thread_id_in_group);
+ CallInst *CI = B.CreateCall(FunctionCallee(DxGroupIndex));
+ return CI;
+ }
----------------
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:122-141
+ // Copy function attributes over, we have no argument or return attributes
+ // that can be valid on the real entry
+ AttributeList NewAttrs = AttributeList::get(Ctx, AttributeList::FunctionIndex,
+ Fn->getAttributes().getFnAttrs());
+ EntryFn->setAttributes(NewAttrs);
+ setHLSLEntryAttributes(EntryFn, FD);
+
----------------
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:135
+ llvm::SmallVector<Value *> Args;
+ for (const auto Param : FD->parameters()) {
+ Args.push_back(emitInputSemantic(B, *Param));
----------------
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.h:55
- void setHLSLFunctionAttributes(llvm::Function *, const FunctionDecl *);
+ void setHLSLEntryAttributes(llvm::Function *, const FunctionDecl *);
+
----------------
These parameters should have names so people don't think the parameters aren't used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131203/new/
https://reviews.llvm.org/D131203
More information about the cfe-commits
mailing list