[clang] [HLSL][SPIRV] Add convergence tokens to entry point wrapper (PR #112757)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 11:15:52 PDT 2024
================
@@ -469,14 +480,21 @@ void CGHLSLRuntime::generateGlobalCtorDtorCalls() {
for (auto &F : M.functions()) {
if (!F.hasFnAttribute("hlsl.shader"))
continue;
- IRBuilder<> B(&F.getEntryBlock(), F.getEntryBlock().begin());
+ auto* Token = getConvergenceToken(F.getEntryBlock());
+ Instruction* IP = Token ? Token : &*F.getEntryBlock().begin();
+ IRBuilder<> B(IP);
+ std::vector<OperandBundleDef> OB;
+ if (Token) {
+ llvm::Value *bundleArgs[] = {Token};
+ OB.emplace_back("convergencectrl", bundleArgs);
+ }
----------------
s-perron wrote:
I cannot test this code yet. Any path that I know of that would exercise this code will fail because we cannot translate HLSL types to SPIR-V types yet.
However, I do have an initial implementation for that in https://github.com/s-perron/llvm-project/tree/spirv_hlsl_type which showes this works.
https://github.com/llvm/llvm-project/pull/112757
More information about the cfe-commits
mailing list