[Mlir-commits] [mlir] [mlir][NVVM] Add support for barrier0 operation with predicate (PR #167036)

Durgadoss R llvmlistbot at llvm.org
Sun Nov 9 10:10:06 PST 2025


================
@@ -291,6 +291,18 @@ static unsigned getUnidirectionalFenceProxyID(NVVM::ProxyKind fromProxy,
   llvm_unreachable("Unsupported proxy kinds");
 }
 
+static unsigned getBarrier0IntrinsicID(NVVM::Barrier0Pred pred) {
+  switch (pred) {
+  case NVVM::Barrier0Pred::AND:
+    return llvm::Intrinsic::nvvm_barrier0_and;
+  case NVVM::Barrier0Pred::OR:
+    return llvm::Intrinsic::nvvm_barrier0_or;
+  case NVVM::Barrier0Pred::POPC:
+    return llvm::Intrinsic::nvvm_barrier0_popc;
----------------
durga4github wrote:

ok, I now see why you chose "Barrier0" in the name of the Op ;-)

I checked the backend and there are no intrinsics for the generic variants (unlike the `barrier sync/arrive` family, where the intrinsics exist and `nvvm.barrier` Op lowers to those).

So, for now, let us try adding into the `nvvm.barrier` Op with a verifier constraint that bar-ID should be 0 if it is a reduction-operation.

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


More information about the Mlir-commits mailing list