[Mlir-commits] [mlir] [mlir][VectorToLLVM] Add support for unrolling and lowering multi-dim… (PR #160405)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Tue Sep 30 23:57:56 PDT 2025
================
@@ -431,27 +431,51 @@ vector::unrollVectorValue(TypedValue<VectorType> vector,
}
LogicalResult vector::unrollVectorOp(Operation *op, PatternRewriter &rewriter,
- vector::UnrollVectorOpFn unrollFn) {
- assert(op->getNumResults() == 1 && "expected single result");
- assert(isa<VectorType>(op->getResult(0).getType()) && "expected vector type");
- VectorType resultTy = cast<VectorType>(op->getResult(0).getType());
- if (resultTy.getRank() < 2)
+ vector::UnrollVectorOpFn unrollFn,
+ VectorType vectorTy) {
+ // If vector type is not provided, get it from the result
+ if (!vectorTy) {
+ if (op->getNumResults() != 1)
+ return rewriter.notifyMatchFailure(
+ op, "expected single result when vector type not provided");
+
+ vectorTy = dyn_cast<VectorType>(op->getResult(0).getType());
+ if (!vectorTy)
+ return rewriter.notifyMatchFailure(op, "expected vector type");
+ }
----------------
ftynse wrote:
I may have misspoken, but the main point is to prefer assertions in code to verbiage in documentation.
https://github.com/llvm/llvm-project/pull/160405
More information about the Mlir-commits
mailing list