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

Javed Absar llvmlistbot at llvm.org
Sat Feb 14 06:03:06 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);
----------------
javedabsar1 wrote:

Yes, it checked up front here - https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp#L213


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


More information about the Mlir-commits mailing list