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

Igor Wodiany llvmlistbot at llvm.org
Tue Mar 11 05:01:47 PDT 2025


https://github.com/IgWod-IMG created https://github.com/llvm/llvm-project/pull/130758

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>
```

>From cb3ae1c3c25158b42564ee0de2ae8784d02c9be6 Mon Sep 17 00:00:00 2001
From: Igor Wodiany <igor.wodiany at imgtec.com>
Date: Tue, 11 Mar 2025 11:42:27 +0000
Subject: [PATCH] [mlir][spirv] Update assembly format for Image operand types

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>
```
---
 mlir/include/mlir/Dialect/SPIRV/IR/SPIRVImageOps.td | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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)^ `)`)?
   }];
 }
 



More information about the Mlir-commits mailing list