[Mlir-commits] [mlir] [mlir][vector] Use notifyMatchFailure instead of assert in VectorLinearize (PR #93590)

Chao Chen llvmlistbot at llvm.org
Fri Jun 7 08:50:31 PDT 2024


================
@@ -336,9 +342,10 @@ struct LinearizeVectorExtract final
   matchAndRewrite(vector::ExtractOp extractOp, OpAdaptor adaptor,
                   ConversionPatternRewriter &rewriter) const override {
     Type dstTy = getTypeConverter()->convertType(extractOp.getType());
-    assert(!(extractOp.getVector().getType().isScalable() ||
-             cast<VectorType>(dstTy).isScalable()) &&
-           "scalable vectors are not supported.");
+    if (extractOp.getVector().getType().isScalable() ||
+        cast<VectorType>(dstTy).isScalable())
----------------
chencha3 wrote:

Actually the `dstTy` here is not always a vector type. It could be a scalar type too. 
e.g., `vector.extract %1 [0, 0]: f32 from vector<1024x1024xf32>`. So, cast<VectorType>(dstTy) may cause the crash. 

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


More information about the Mlir-commits mailing list