[Mlir-commits] [mlir] [mlir][arith] Refine the verifier for arith.constant (PR #86178)

Jakub Kuderski llvmlistbot at llvm.org
Fri Mar 22 08:26:52 PDT 2024


================
@@ -190,6 +190,14 @@ LogicalResult arith::ConstantOp::verify() {
     return emitOpError(
         "value must be an integer, float, or elements attribute");
   }
+
+  // Intializing scalable vectors with elements attribute is not supported
+  // unless it's a vector splot.
+  auto vecType = dyn_cast<VectorType>(type);
+  auto val = dyn_cast<DenseElementsAttr>(getValue());
+  if ((vecType && val) && vecType.isScalable() && !val.isSplat())
----------------
kuhar wrote:

> In general, we've been discussing how to better represent "scalable" vectors in MLIR for a while now. There was also a long discussion on "dynamic" vector type too:

What I suggested above is just a convenience type that doesn't affect the hierarchy in any way, similar to `spirv::ScalarType`.

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


More information about the Mlir-commits mailing list