[Mlir-commits] [mlir] [mlir][spirv] Update assembly format for Image operand types (PR #130758)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Mar 11 05:02:24 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-spirv

Author: Igor Wodiany (IgWod-IMG)

<details>
<summary>Changes</summary>

In the example below it is not clear that `(f32)` relates to `%arg2` and not to `vector<2xf32>`. This change makes it more clear by separating `(f32)` from `vector<...>`.

```mlir
%0 = spirv.ImageSampleImplicitLod %arg0, %arg1 ["Lod"](%arg2) :
  !spirv.sampled_image<...>, vector<2xf32>(f32) -> vector<4xf32>
```

---
Full diff: https://github.com/llvm/llvm-project/pull/130758.diff


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td (+2-2) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td
index a4fe29536e60a..2c5714800493f 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td
@@ -115,7 +115,7 @@ def SPIRV_ImageDrefGatherOp : SPIRV_Op<"ImageDrefGather",
 
   let assemblyFormat = [{
     $sampled_image `,` $coordinate `,` $dref custom<ImageOperands>($image_operands) ( `(` $operand_arguments^ `)` )? attr-dict 
-    `:` type($sampled_image) `,` type($coordinate) `,` type($dref) ( `(` type($operand_arguments)^ `)` )?
+    `:` type($sampled_image) `,` type($coordinate) `,` type($dref) ` ` ( `(` type($operand_arguments)^ `)` )?
     `->` type($result) 
   }];
 
@@ -227,7 +227,7 @@ def SPIRV_ImageWriteOp : SPIRV_Op<"ImageWrite",
 
   let assemblyFormat = [{
     $image `,` $coordinate `,` $texel custom<ImageOperands>($image_operands) ( `(` $operand_arguments^ `)`)? attr-dict
-    `:` type($image) `,` type($coordinate) `,` type($texel) ( `(` type($operand_arguments)^ `)`)?
+    `:` type($image) `,` type($coordinate) `,` type($texel) ` ` ( `(` type($operand_arguments)^ `)`)?
   }];
 }
 

``````````

</details>


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


More information about the Mlir-commits mailing list