[Mlir-commits] [mlir] [mlir][vector] Disallow pure reduction dims in vector.contract (PR #237709)
Renato Golin
llvmlistbot at llvm.org
Sun Nov 1 04:11:52 PST 2026
================
@@ -1140,6 +1140,25 @@ static LogicalResult verifyOutputShape(
return success();
}
+// Find a pure reduction dims, i.e. a reduction dim that is only
+// present in only one of the inputs.
+std::optional<int64_t> getPureReductionDim(vector::ContractionOp *contract) {
+ auto maps = contract->getIndexingMapsArray();
+ AffineMap lhsMap = maps[0];
+ AffineMap rhsMap = maps[1];
+
+ for (auto [dim, attr] : llvm::enumerate(contract->getIteratorTypes())) {
+ auto iteratorType = cast<vector::IteratorTypeAttr>(attr).getValue();
+ if (iteratorType != vector::IteratorType::reduction)
----------------
rengolin wrote:
nit, this could be a single `if`
https://github.com/llvm/llvm-project/pull/237709
More information about the Mlir-commits
mailing list