Skip to content

Commit cefda88

Browse files
authored
Optimization pass for fusing XeGPU load_nd with vector transpose. (#845)
1 parent 20b96a5 commit cefda88

File tree

8 files changed

+843
-0
lines changed

8 files changed

+843
-0
lines changed

include/imex/Transforms/Passes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define IMEX_TRANSFORMS_PASSES_H_
1616

1717
#include "mlir/Pass/Pass.h"
18+
#include <memory>
1819

1920
namespace imex {
2021
//===----------------------------------------------------------------------===//
@@ -31,6 +32,7 @@ std::unique_ptr<mlir::Pass> createRemoveTemporariesPass();
3132
std::unique_ptr<mlir::Pass> createVectorLinearizePass();
3233
std::unique_ptr<mlir::Pass> createPropagatePackedLayoutPass();
3334
std::unique_ptr<mlir::Pass> createRemoveSingleElemVectorPass();
35+
std::unique_ptr<mlir::Pass> createOptimizeTransposePass();
3436
std::unique_ptr<mlir::Pass> createVnniTransformationPass();
3537

3638
#define GEN_PASS_DECL

include/imex/Transforms/Passes.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,18 @@ def VnniTransformation : Pass<"imex-xegpu-apply-vnni-transformation"> {
155155
];
156156
}
157157

158+
def OptimizeTranspose : Pass<"imex-xegpu-optimize-transpose"> {
159+
let summary = "Eliminate in-register vector transpose by fusing with load.";
160+
let constructor = "imex::createOptimizeTransposePass()";
161+
let dependentDialects = [
162+
"::mlir::xegpu::XeGPUDialect"
163+
];
164+
let options = [
165+
Option<"device", "device", "std::string",
166+
/*default=*/"\"pvc\"",
167+
"gpu platform architecture where these ops are running">
168+
];
169+
}
170+
158171

159172
#endif // _IMEX_TRANSFORMS_PASSES_TD_INCLUDED_

lib/Transforms/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ add_mlir_library(IMEXTransforms
1111
SetSPIRVCapabilities.cpp
1212
VectorLinearize.cpp
1313
VnniTransformation.cpp
14+
OptimizeTranspose.cpp
1415

1516
ADDITIONAL_HEADER_DIRS
1617
${PROJECT_SOURCE_DIR}/imex/Transforms

0 commit comments

Comments
 (0)