Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

CoTinker
Copy link
Contributor

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.

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 explicite float.
@llvmbot
Copy link
Member

llvmbot commented Feb 13, 2025

@llvm/pr-subscribers-mlir-spirv

@llvm/pr-subscribers-mlir

Author: Longsheng Mou (CoTinker)

Changes

Actually the spirv.Constant dense&lt;[2, 3]&gt; : vector&lt;2xf32&gt; will cause a error:

error: unexpected decimal integer literal for a floating point value
    %cst = spirv.Constant dense&lt;[2, 3]&gt; : vector&lt;2xf32&gt;
                                 ^

The value should be an explicit float.


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

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td (+1-1)
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>>
     ```
 

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@CoTinker
Copy link
Contributor Author

Thanks for your review.

@CoTinker CoTinker merged commit 6fb1d40 into llvm:main Feb 13, 2025
11 checks passed
@CoTinker CoTinker deleted the spirv_constant branch February 13, 2025 11:57
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
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.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants