[Mlir-commits] [mlir] [mlir][spirv] Update assembly format for Image operand types (PR #130758)
Igor Wodiany
llvmlistbot at llvm.org
Thu Mar 13 04:59:44 PDT 2025
================
@@ -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)^ `)` )?
----------------
IgWod-IMG wrote:
Before I update the patch. Is this the format we're after (using an example):
```mlir
%0 = spirv.Op %1, %2 ["IOp1 | IOp2"] %3, %4, %5 : !spirv.sampled_image<...>, vector<2xf32>, f32, f32, f32 -> vector<4xf32>
```
Also, an example form an actual shader:
```mlir
%6 = spirv.ImageSampleExplicitLod %3, %4 ["Lod"] %5 : !spirv.sampled_image<!spirv.image<f32, Dim2D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>, vector<2xf32>, f32 -> vector<4xf32>
```
It drops parens after the image operands and keeps image operands as they were. Then it lists all the types with commas.
I think it works quite well and it's clear to read.
Also, do we want to merge #129558 first and I'll fix everything here or merge this PR first, and I'll update the other PR?
https://github.com/llvm/llvm-project/pull/130758
More information about the Mlir-commits
mailing list