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

Andrzej Warzyński llvmlistbot at llvm.org
Fri Mar 22 07:01:19 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())
----------------
banach-space wrote:

Interesting idea - I've not thought about it, no. Thanks for the suggestion! Though `isa<ScalableVectorType>(...)` would be longer than `vecType.isScalable()` 🤷🏻 

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:
* https://discourse.llvm.org/t/rfc-dynamic-vector-semantics-for-the-mlir-vector-dialect

I know that @dcaballe has been working on an updated class hierarchy for vectors. IIRC, that's not at the top of the priority list ATM, but it would be good to revisit it soon 😅 

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


More information about the Mlir-commits mailing list