[Mlir-commits] [mlir] [MLIR][Linalg] Fix crash in packMatmulGreedily on non-matmul ops (PR #218947)
Chibuoyim Ogbonna
llvmlistbot at llvm.org
Mon Sep 14 02:11:08 PDT 2026
================
@@ -806,7 +806,9 @@ linalg::packMatmulGreedily(RewriterBase &rewriter, LinalgOp linalgOp,
// 1. Infer dims that are important for matmul.
FailureOr<ContractionDimensions> maybeDimensions =
inferContractionDims(linalgOp);
- if (failed(maybeDimensions)) {
+ // The inferred m/n/k may be empty when the op is not actually matmul-like.
+ if (failed(maybeDimensions) || maybeDimensions->m.empty() ||
+ maybeDimensions->n.empty() || maybeDimensions->k.empty()) {
----------------
bruteforceboy wrote:
oh, I did try to go through `inferContractionDims ` but it seems this was intentionally allowed in [2ae37be4b433](https://github.com/llvm/llvm-project/commit/2ae37be4b433632e46209aa04fcc857675783f81) and it is valid to have an empty dimension in some cases. But that isn't the case for `packMatmulGreedily`, since it needs all dimensions.
https://github.com/llvm/llvm-project/pull/218947
More information about the Mlir-commits
mailing list