[Mlir-commits] [mlir] [mlir] [linalg] fix failure on specializing matmul with permuted loops (PR #184294)

Renato Golin llvmlistbot at llvm.org
Thu Mar 5 06:03:57 PST 2026


================
@@ -299,11 +297,37 @@ static FailureOr<LinalgOp> specializeLinalgContractions(RewriterBase &rewriter,
     return rewriter.notifyMatchFailure(
         genericOp, "contains invalid cast ops for the named matmul op");
 
-  /// Codegen the different matmul variants.
+  // Build indexing maps for the named op in its canonical dimension ordering
+  auto *ctx = genericOp.getContext();
+  unsigned numLoopDims = numOfBatchDims + 3;
+  unsigned mIdx = numOfBatchDims;
+  unsigned nIdx = mIdx + 1;
+  unsigned kIdx = mIdx + 2;
+
+  auto makeMap = [&](IndexMatchResult match, unsigned rowIdx, unsigned colIdx) {
----------------
rengolin wrote:

Perhaps add a TODO line here to mention broadcast support.

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


More information about the Mlir-commits mailing list