[Mlir-commits] [mlir] [mlir][spirv] Verify vector types when parsing (PR #180430)
Igor Wodiany
llvmlistbot at llvm.org
Mon Feb 9 03:11:23 PST 2026
================
@@ -186,12 +186,23 @@ static Type parseAndVerifyType(SPIRVDialect const &dialect,
parser.emitError(typeLoc, "only 1-D vector allowed but found ") << t;
return Type();
}
+ if (t.getNumElements() < 2) {
+ parser.emitError(typeLoc, "SPIR-V does not allow one-element vectors");
+ return Type();
+ }
if (t.getNumElements() > 4) {
----------------
IgWod-IMG wrote:
I know this is not part of the change, but this seems to be inconsistent with our ODS definition that also allows vectors of size 8 and 16: https://github.com/llvm/llvm-project/blob/1d61ac2d41d9c77d02af4ac149d83b52eb782704/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td#L4278
Sizes of 8 and 16 are only allowed with `Vector16` capability and I don’t know it what context this `parseAndVerifyType` function is used, so maybe it has something to do with that.
https://github.com/llvm/llvm-project/pull/180430
More information about the Mlir-commits
mailing list