[Mlir-commits] [mlir] [MLIR][Linalg] Scalable Vectorization of Reduction (PR #97788)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Fri Jul 12 07:37:28 PDT 2024
================
@@ -1947,13 +1956,30 @@ vectorizeScalableVectorPrecondition(Operation *op,
if (inputVectorSizes.empty())
return success();
+ auto linalgOp = dyn_cast<LinalgOp>(op);
+ if (linalgOp && isLinalgReduction(linalgOp)) {
+ LDBG("Checking reduce op dims for scalable vectorization\n");
+ auto iteratorTypes = linalgOp.getIteratorTypesArray();
+ assert(iteratorTypes.size() == inputScalableVecDims.size() &&
+ "Number of iterator types and input scalable dims mismatch");
----------------
banach-space wrote:
Very good point, but the iteration space should first and foremost match `inputVectorSizes` - that's unrelated to scalable vectors and should be verified by ` vectorizeLinalgOpPrecondition(`. In fact, it already is, see:
https://github.com/llvm/llvm-project/blob/6479a5a438a9545dd8f449be96d4024d0a08beba/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp#L378-L381
and
https://github.com/llvm/llvm-project/blob/6479a5a438a9545dd8f449be96d4024d0a08beba/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp#L1821-L1824
:)
Now, once we know that that condition holds, we only need to verify that `inputVectorSizes` matches `inputVectorSizes`.
https://github.com/llvm/llvm-project/pull/97788
More information about the Mlir-commits
mailing list