[Mlir-commits] [mlir] [mlir][spirv] Add definition for selected sample operations (PR #129558)

Igor Wodiany llvmlistbot at llvm.org
Mon Mar 10 03:59:09 PDT 2025


================
@@ -115,7 +121,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:

Yes, it's purely aesthetic. In #128552 I moved types of operands to the end of the operation, however in this PR I realised not having a space may be a bit confusing. For example:

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

To me, without the space `vector<2xf32>(f32)` looks like those two are linked, but the intention is what `f32` is the type of `%arg2`, which space makes a bit more clear: `vector<2xf32> (f32)`. But maybe there is a better way to print type of image operands. I'm open to suggestions.

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


More information about the Mlir-commits mailing list