Skip to content

Commit 6984c70

Browse files
committed
BubbleUpOperationPass
1 parent d554322 commit 6984c70

11 files changed

Lines changed: 78 additions & 14 deletions

File tree

include/triton-shared/TritonToUnstructureIncubated/BubbleUpOperation.h renamed to include/triton-shared/BubbleUpOperation/BubbleUpOperation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
#include "mlir/IR/PatternMatch.h"
2929

3030
#define GEN_PASS_DECL_BUBBLEUPOPERATION
31-
#include "triton-shared/TritonToUnstructureIncubated/Passes.h.inc"
31+
#include "triton-shared/BubbleUpOperation/Passes.h.inc"
3232

3333
#define GEN_PASS_DEF_BUBBLEUPOPERATION
34-
#include "triton-shared/TritonToUnstructureIncubated/Passes.h.inc"
34+
#include "triton-shared/BubbleUpOperation/Passes.h.inc"
3535

3636
namespace mlir {
3737
namespace triton {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set(LLVM_TARGET_DEFINITIONS Passes.td)
2+
mlir_tablegen(Passes.h.inc -gen-pass-decls --name BubbleUpOperation)
3+
add_public_tablegen_target(BubbleUpOperationConversionPassIncGen)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*/
22+
23+
#ifndef TRITON_ADAPTER_TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES_H
24+
#define TRITON_ADAPTER_TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES_H
25+
26+
#include "BubbleUpOperation.h"
27+
28+
namespace mlir {
29+
namespace triton {
30+
31+
#define GEN_PASS_REGISTRATION
32+
#include "triton-shared/TritonToUnstructureIncubated/Passes.h.inc"
33+
34+
} // namespace triton
35+
} // namespace mlir
36+
37+
#endif // TRITON_ADAPTER_TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES_H
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES
2+
#define TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES
3+
4+
include "mlir/Pass/PassBase.td"
5+
6+
def BubbleUpOperation : Pass<"bubble-up-operation", "mlir::ModuleOp"> {
7+
let summary = "Apply bubble up operation optimization";
8+
let constructor = "triton::createBubbleUpOperationPass()";
9+
let options = [
10+
Option<"enableAggressiveMode", "enable-aggressive-mode", "bool", "true",
11+
"Enable aggressive bubble up operation.">,
12+
];
13+
}
14+
15+
#endif // TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES

include/triton-shared/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ add_subdirectory(DiscreteMaskAccessConversion)
99
add_subdirectory(TritonToUnstructureIncubated)
1010
#add_subdirectory(Dialect)
1111
add_subdirectory(TritonLinearize)
12+
add_subdirectory(BubbleUpOperation)

include/triton-shared/TritonToUnstructureIncubated/Passes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#ifndef TRITON_ADAPTER_TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES_H
2424
#define TRITON_ADAPTER_TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES_H
2525

26-
#include "BubbleUpOperation.h"
2726
#include "UnstructureConversionPass.h"
2827

2928
namespace mlir {

include/triton-shared/TritonToUnstructureIncubated/Passes.td

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,4 @@ def TritonToUnstructureIncubated : Pass<"triton-to-unstructure-incubated", "mlir
1212
];
1313
}
1414

15-
def BubbleUpOperation : Pass<"bubble-up-operation", "mlir::ModuleOp"> {
16-
let summary = "Apply bubble up operation optimization";
17-
let constructor = "triton::createBubbleUpOperationPass()";
18-
let options = [
19-
Option<"enableAggressiveMode", "enable-aggressive-mode", "bool", "true",
20-
"Enable aggressive bubble up operation.">,
21-
];
22-
}
23-
2415
#endif // TRITON_TO_UNSTRUCTURE_CONVERSION_PASSES

lib/TritonToUnstructureIncubated/BubbleUpOperation.cpp renamed to lib/BubbleUpOperation/BubbleUpOperation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* THE SOFTWARE.
2121
*/
2222

23-
#include "triton-shared/TritonToUnstructureIncubated/BubbleUpOperation.h"
23+
#include "triton-shared/BubbleUpOperation/BubbleUpOperation.h"
2424
#include "triton-shared/UtilsIncubated/Utils.h"
2525

2626
#include "mlir/Pass/PassManager.h"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
add_triton_library(BubbleUpOperation
2+
BubbleUpOperation.cpp
3+
4+
DEPENDS
5+
BubbleUpOperationConversionPassIncGen
6+
7+
LINK_LIBS PUBLIC
8+
MLIRArithDialect
9+
MLIRDialectUtils
10+
MLIRIR
11+
MLIRPass
12+
MLIRTensorDialect
13+
MLIRTransforms
14+
MLIRSupport
15+
TritonIR
16+
TritonAnalysis
17+
MLIRSCFTransforms
18+
)

lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ add_subdirectory(TritonToUnstructureIncubated)
1414
#add_subdirectory(Dialect)
1515
add_subdirectory(TritonLinearize)
1616
add_subdirectory(UtilsIncubated)
17+
add_subdirectory(BubbleUpOperation)
1718

0 commit comments

Comments
 (0)