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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Feb 14 07:27:18 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();
----------------
ziereis wrote:

The checks are a bit stricter then only a projected permutation here, but that is intentional. The generic that ends up here can have the following maps for the non-batched case:

A: (m,k) or (k,m)
B: (k,n) or (n,k)
C:(m,n) or (n,m)

And it would be a valid matmul + index_maps for every combination thereof. 

Same applies for the batched case but there its restricted that batch dim always stays the first dimension and the rest can be permuted. 

However im not quite sure what the error would be here? 


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


More information about the Mlir-commits mailing list