[all-commits] [llvm/llvm-project] 6edc1f: [mlir][llvm dialect] Verify element type of nested...
James Newling via All-commits
all-commits at lists.llvm.org
Mon Jul 21 05:40:24 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6edc1faf3b9238a231f1aca10d447be8ab826816
https://github.com/llvm/llvm-project/commit/6edc1faf3b9238a231f1aca10d447be8ab826816
Author: James Newling <james.newling at gmail.com>
Date: 2025-07-21 (Mon, 21 Jul 2025)
Changed paths:
M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
M mlir/test/Dialect/LLVMIR/invalid.mlir
M mlir/test/Target/LLVMIR/llvmir-invalid.mlir
Log Message:
-----------
[mlir][llvm dialect] Verify element type of nested types (#148975)
Before this PR, this was valid
```
%0 = llvm.mlir.constant(dense<[1, 2]> : vector<2xi32>) : vector<2xf32>
```
but this was not:
```
%0 = llvm.mlir.constant(1 : i32) : f32
```
because only scalar types were checked for compatibility, not the element types of nested types. Another additional check that this PR adds is to verify the float semantics. Before this PR,
```
%cst = llvm.mlir.constant(1.0 : bf16) : f16
```
was considered valid (because bf16 and f16 both have 16 bits), but with this PR it is not considered valid. This PR also moves all tests on the verifier of the llvm constant op into a single file. To summarize the state after this PR.
Invalid:
```mlir
%0 = llvm.mlir.constant(dense<[128, 1024]> : vector<2xi32>) :
vector<2xf32>
%0 = llvm.mlir.constant(dense<[128., 1024.]> : vector<2xbf16>) :
vector<2xf16>
```
Valid:
```mlir
%0 = llvm.mlir.constant(dense<[128., 1024.]> : vector<2xf32>) :
vector<2xi32>
%0 = llvm.mlir.constant(dense<[128, 1024]> : vector<2xi64>) :
vector<2xi8>
```
and identical valid/invalid cases for the scalar cases.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list