[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:17:01 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:

Once this is merged I will open up a PR for that branch.

https://github.com/llvm/llvm-project/pull/112757


More information about the cfe-commits mailing list