[Mlir-commits] [mlir] [mlir][linalg] fix specialization of transposed matmul variants (PR #181387)

Renato Golin llvmlistbot at llvm.org
Fri Feb 13 13:21:12 PST 2026


================
@@ -147,9 +147,15 @@ static LinalgOp replaceWithMatmulVariant(RewriterBase &rewriter, GenericOp op,
     castAttrVec = {rewriter.getNamedAttr(
         "cast", TypeFnAttr::get(rewriter.getContext(), *castTy))};
 
+  ArrayAttr indexingMaps = op.getIndexingMaps();
+
   LinalgOp namedOp = rewriter.replaceOpWithNewOp<NamedOpTy>(
       op, ValueRange{op.getDpsInputs()[0], op.getDpsInputs()[1]},
       ValueRange{op.getDpsInits()[0]}, castAttrVec);
+
+  // Set the original generic's maps to preserve transposed operand semantics.
+  namedOp->setAttr("indexing_maps", indexingMaps);
----------------
rengolin wrote:

IIRC, we do have code that checks that the affine maps are projected permutations, right?

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


More information about the Mlir-commits mailing list