[Mlir-commits] [mlir] [mlir][SPIRV] update SPIRV Atomic Ops to assemblyFormat (PR #76323)

Jakub Kuderski llvmlistbot at llvm.org
Thu Dec 28 13:05:55 PST 2023


================
@@ -243,26 +266,30 @@ def SPIRV_AtomicExchangeOp : SPIRV_Op<"AtomicExchange", []> {
     #### Example:
 
     ```mlir
-    %0 = spirv.AtomicExchange "Workgroup" "Acquire" %pointer, %value,
+    %0 = spirv.AtomicExchange <Workgroup> <Acquire> %pointer, %value,
                             : !spirv.ptr<i32, WorkGroup>
     ```
   }];
 
-  let arguments = (ins
-    SPIRV_AnyPtr:$pointer,
-    SPIRV_ScopeAttr:$memory_scope,
-    SPIRV_MemorySemanticsAttr:$semantics,
-    SPIRV_Numerical:$value
-  );
+  let arguments = (ins SPIRV_AnyPtr
+                   : $pointer, SPIRV_ScopeAttr
+                   : $memory_scope, SPIRV_MemorySemanticsAttr
+                   : $semantics, SPIRV_Numerical
+                   : $value);
+
+  let results = (outs SPIRV_Numerical : $result);
 
-  let results = (outs
-    SPIRV_Numerical:$result
-  );
+  let assemblyFormat = [{
+    $memory_scope $semantics operands attr-dict `:` type($pointer)
+  }];
 }
 
 // -----
 
-def SPIRV_EXTAtomicFAddOp : SPIRV_ExtVendorOp<"AtomicFAdd", []> {
+def SPIRV_EXTAtomicFAddOp : SPIRV_ExtVendorOp<"AtomicFAdd", [
+  PointeeTypeMatchTrait<"pointer", "result">,
+  PointeeTypeMatchTrait<"pointer", "value">,
----------------
kuhar wrote:

also here

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


More information about the Mlir-commits mailing list