[Mlir-commits] [mlir] [mlir][linalg] Add pass to transpose A matrix of matmul op (PR #89075)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Apr 18 02:29:56 PDT 2024


================
@@ -141,4 +141,13 @@ def LinalgDetensorizePass : InterfacePass<"linalg-detensorize", "FunctionOpInter
   ];
 }
 
+def LinalgMatmulToMatmulTransposeAPass
+    : Pass<"linalg-matmul-to-matmul-transpose-a"> {
+  let summary = "Converts `linalg.matmul` to `linalg.matmul_transpose_a`.";
+  let dependentDialects = ["linalg::LinalgDialect"];
+  let description = [{
+    Transposes the A matrix of a `linalg.matmul` for contiguous access.
----------------
banach-space wrote:

[nit] It's more like "Replace linalg.matmul with `linalg.transpose` + `linalg.matmul_transpose_a`" :)

Also:
>  for contiguous access

This is a fairly low-level concept that might be irrelevant in the case of "linalg on tensors". And even for "linalg on memrefs", it might not matter for some hardware. It's obviously very beneficial for CPUs :) 

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


More information about the Mlir-commits mailing list