[Mlir-commits] [mlir] 6fb1d40 - [mlir][spirv] Update example of `spirv.Constant`(NFC) (#127030)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Feb 13 03:57:01 PST 2025


Author: Longsheng Mou
Date: 2025-02-13T19:56:57+08:00
New Revision: 6fb1d40992ac3aff84dfe7616ea7776e1c26ba99

URL: https://github.com/llvm/llvm-project/commit/6fb1d40992ac3aff84dfe7616ea7776e1c26ba99
DIFF: https://github.com/llvm/llvm-project/commit/6fb1d40992ac3aff84dfe7616ea7776e1c26ba99.diff

LOG: [mlir][spirv] Update example of `spirv.Constant`(NFC) (#127030)

Actually the `spirv.Constant dense<[2, 3]> : vector<2xf32>` will cause a
error:
```
error: unexpected decimal integer literal for a floating point value
    %cst = spirv.Constant dense<[2, 3]> : vector<2xf32>
                                 ^
```
The value should be an explicit float.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
index fbf750d643031..c5a85f881b35e 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
@@ -101,7 +101,7 @@ def SPIRV_ConstantOp : SPIRV_Op<"Constant",
 
     ```mlir
     %0 = spirv.Constant true
-    %1 = spirv.Constant dense<[2, 3]> : vector<2xf32>
+    %1 = spirv.Constant dense<[2.0, 3.0]> : vector<2xf32>
     %2 = spirv.Constant [dense<3.0> : vector<2xf32>] : !spirv.array<1xvector<2xf32>>
     ```
 


        


More information about the Mlir-commits mailing list