[PATCH] D133983: [HLSL] Add SV_DispatchThreadID
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 21 06:46:07 PDT 2022
aaron.ballman added a comment.
There are no tests for applying this to a global variable, so those should be added.
================
Comment at: clang/include/clang/Basic/AttrDocs.td:6596-6598
+The ``SV_DispatchThreadID`` semantic, when applied to an input parameter, specifies a
+data binding to map global thread offset within the Dispatch call(per dimension of the group) to the specified parameter.
+This attribute is only supported in compute shaders.
----------------
It doesn't specify what happens when applied to a global variable.
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:113
+static Value *buildVectorInput(IRBuilder<> &B, Function *F, llvm::Type *Ty) {
+ if (FixedVectorType *VT = dyn_cast<FixedVectorType>(Ty)) {
+ Value *Result = PoisonValue::get(Ty);
----------------
================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:120-121
+ return Result;
+ } else
+ return B.CreateCall(F, {B.getInt32(0)});
+}
----------------
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:6925
+ }
+
+ D->addAttr(::new (S.Context) HLSLSV_DispatchThreadIDAttr(S.Context, AL));
----------------
Are there other restrictions we need to care about, like what the type of the parameter/global is, etc?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133983/new/
https://reviews.llvm.org/D133983
More information about the cfe-commits
mailing list