From 0c784e02363164115a13d81bb03d01b879c2f653 Mon Sep 17 00:00:00 2001 From: Ryan Spring Date: Fri, 20 Dec 2024 15:25:01 -0800 Subject: [PATCH] make blocksync compatible with warp specialization --- csrc/codegen.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/csrc/codegen.cpp b/csrc/codegen.cpp index 34abf9f8058..c7972951f4f 100644 --- a/csrc/codegen.cpp +++ b/csrc/codegen.cpp @@ -3325,10 +3325,16 @@ class CudaKernelGenerator : private kir::ConstIrVisitor { // Use a custom synchronization method if enabled if (getNvFuserEnv("USE_BLOCK_SYNC_ATOMIC")) { indent() << "block_sync::sync();\n"; - } else if (isAligned()) { - indent() << "__syncthreads();\n"; } else { - indent() << "__barrier_sync(0);\n"; + ArgumentBuilder sync_call_template_parms; + sync_call_template_parms.arg(isAligned()); + + ArgumentBuilder sync_call_args; + sync_call_args.arg(genComputeBlockDim()); + + auto sync_call = + genCall("block_sync::sync", sync_call_template_parms, sync_call_args); + indent() << sync_call << ";\n"; } }