[Mlir-commits] [mlir] [MLIR][NVVM] Add support for match.sync Op (PR #130718)

Durgadoss R llvmlistbot at llvm.org
Tue Mar 11 03:08:14 PDT 2025


================
@@ -2583,6 +2583,52 @@ def NVVM_MapaOp: NVVM_Op<"mapa",
   let assemblyFormat = "$a`,` $b attr-dict `:` type($a) `->` type($res)";
 }
 
+//===----------------------------------------------------------------------===//
+// NVVM match.sync Op
+//===----------------------------------------------------------------------===//
+
+def MatchSyncKindAny : I32EnumAttrCase<"any", 0>;
+def MatchSyncKindAll : I32EnumAttrCase<"all", 1>;
+
+def MatchSyncKind : I32EnumAttr<"MatchSyncKind", "NVVM match sync kind",
+  [MatchSyncKindAny, MatchSyncKindAll]> {
+  let genSpecializedAttr = 0;
+  let cppNamespace = "::mlir::NVVM";
+}
+
+def MatchSyncKindAttr : EnumAttr<NVVM_Dialect, MatchSyncKind, "match_sync_kind">;
+
+def NVVM_MatchSyncOp : NVVM_Op<"match.sync">,
+  Results<(outs LLVM_Type:$res)>,
+  Arguments<(ins I32:$thread_mask,
+                 AnyTypeOf<[I32, I64]>:$val,
+                 MatchSyncKindAttr:$kind)> {
+  let summary = "NVVM Dialect Op for match.sync";
+  let description = [{
+    The `match.sync` op performs broadcast and compare of operand `val` across 
+    all non-exited threads in `thread_mask` and returns a mask depending on the 
+    kind and an optional predicate.
+
+    The matching operation kinds are:
+    - `any`: Returns mask of non-exited threads in the `thread_mask` that have 
+    same value of operand `val`.
+    - `all`: Returns mask corresponding to non-exited threads in the 
----------------
durga4github wrote:

Split this into separate sentences for clarity.

Returns mask and a predicate.
The mask corresponds to <...>

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


More information about the Mlir-commits mailing list