|
1 | | -//===- XeGPULayoutPropagate.cpp - XeGPU Layout Propagation ------*- C++ -*-===// |
| 1 | +//===- XeGPUPropagateLayout.cpp - XeGPU Layout Propagation ------*- C++ -*-===// |
2 | 2 | // |
3 | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | 4 | // See https://llvm.org/LICENSE.txt for license information. |
|
38 | 38 |
|
39 | 39 | namespace mlir { |
40 | 40 | namespace xegpu { |
41 | | -#define GEN_PASS_DEF_XEGPULAYOUTPROPAGATE |
| 41 | +#define GEN_PASS_DEF_XEGPUPROPAGATELAYOUT |
42 | 42 | #include "mlir/Dialect/XeGPU/Transforms/Passes.h.inc" |
43 | 43 | } // namespace xegpu |
44 | 44 | } // namespace mlir |
@@ -622,8 +622,7 @@ LayoutInfo RunLayoutInfoPropagation::getLayoutInfo(Value val) { |
622 | 622 | } |
623 | 623 |
|
624 | 624 | // Print the analysis result for debugging purposes. |
625 | | -[[maybe_unused]] void |
626 | | -RunLayoutInfoPropagation::printAnalysisResult(llvm::raw_ostream &os) { |
| 625 | +void RunLayoutInfoPropagation::printAnalysisResult(llvm::raw_ostream &os) { |
627 | 626 | auto printFunctionResult = [&](FunctionOpInterface funcOp) { |
628 | 627 | os << "function: " << funcOp.getName() << ":\n"; |
629 | 628 | // Function arguments |
@@ -828,15 +827,25 @@ static LogicalResult updateFunctionOpInterface(mlir::OpBuilder &builder, |
828 | 827 | } |
829 | 828 |
|
830 | 829 | namespace { |
831 | | -struct XeGPULayoutPropagatePass final |
832 | | - : public xegpu::impl::XeGPULayoutPropagateBase<XeGPULayoutPropagatePass> { |
| 830 | +struct XeGPUPropagateLayoutPass final |
| 831 | + : public xegpu::impl::XeGPUPropagateLayoutBase<XeGPUPropagateLayoutPass> { |
| 832 | + XeGPUPropagateLayoutPass() = default; |
| 833 | + XeGPUPropagateLayoutPass(const XeGPUPropagateLayoutPass &other) = default; |
| 834 | + XeGPUPropagateLayoutPass(xegpu::XeGPUPropagateLayoutOptions options) |
| 835 | + : XeGPUPropagateLayoutBase(options) {} |
833 | 836 | void runOnOperation() override; |
834 | 837 | }; |
835 | 838 |
|
836 | 839 | } // namespace |
837 | 840 |
|
838 | | -void XeGPULayoutPropagatePass::runOnOperation() { |
| 841 | +void XeGPUPropagateLayoutPass::runOnOperation() { |
839 | 842 | auto &analysis = getAnalysis<RunLayoutInfoPropagation>(); |
| 843 | + // Print the analysis result and exit. (for debugging purposes) |
| 844 | + if (printOnly) { |
| 845 | + auto &os = llvm::outs(); |
| 846 | + analysis.printAnalysisResult(os); |
| 847 | + return; |
| 848 | + } |
840 | 849 | // Helper to convert LayoutInfo to xegpu::LayoutAttr. |
841 | 850 | auto getXeGPULayoutForValue = [&](Value val) -> xegpu::LayoutAttr { |
842 | 851 | LayoutInfo layout = analysis.getLayoutInfo(val); |
|
0 commit comments