Skip to content

Commit c031abd

Browse files
committed
membar decoupling
1 parent 8b6a9d2 commit c031abd

File tree

5 files changed

+48
-27
lines changed

5 files changed

+48
-27
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
#include "triton/Analysis/iluvatar_AxisInfo.h"
2+
#include "triton/Analysis/iluvatar_Membar.h"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef ILUVATAR_TRITON_ANALYSIS_MEMBAR_H
2+
#define ILUVATAR_TRITON_ANALYSIS_MEMBAR_H
3+
4+
#define FLAGTREE_SPEC_BlockInfo_Function
5+
6+
#endif // ILUVATAR_TRITON_ANALYSIS_MEMBAR_H

third_party/iluvatar/backend/flagtree_backend_specialization/lib/Analysis/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_triton_library(FlagTree_iluvatar_TritonAnalysis
22
AxisInfo.cpp
3+
Membar.cpp
34

45
DEPENDS
56
TritonTableGen
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "triton/Analysis/Membar.h"
2+
3+
namespace mlir {
4+
5+
// type: 0 all | 1 del W from other R |2 del R from other W
6+
void BlockInfo::erase(BlockInfo &other, int type) {
7+
if (type == 0) {
8+
for (auto &sri : other.syncReadIntervals)
9+
syncReadIntervals.erase(sri);
10+
for (auto &swi : other.syncWriteIntervals)
11+
syncWriteIntervals.erase(swi);
12+
} else if (type == 1) {
13+
for (auto &sri : other.syncReadIntervals)
14+
syncWriteIntervals.erase(sri);
15+
} else if (type == 2) {
16+
for (auto &swi : other.syncWriteIntervals)
17+
syncReadIntervals.erase(swi);
18+
}
19+
}
20+
21+
// for debug
22+
void BlockInfo::printIntervals() {
23+
if (syncReadIntervals.size() > 0 || syncWriteIntervals.size() > 0) {
24+
std::cout << " syncReadIntervals";
25+
for (auto &lhs : syncReadIntervals)
26+
std::cout << " [" << lhs.start() << ", " << lhs.end() << "] ";
27+
std::cout << "" << std::endl;
28+
std::cout << " syncWriteIntervals";
29+
for (auto &lhs : syncWriteIntervals)
30+
std::cout << " [" << lhs.start() << ", " << lhs.end() << "] ";
31+
std::cout << "" << std::endl;
32+
}
33+
}
34+
35+
}

third_party/iluvatar/include/triton/Analysis/Membar.h

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <set>
88

9+
#include "triton/../../backend/flagtree_backend_specialization/include/flagtree_spec.h"
10+
911
namespace mlir {
1012

1113
class OpBuilder;
@@ -43,36 +45,12 @@ struct BlockInfo {
4345
syncWriteIntervals.clear();
4446
}
4547

46-
#ifdef __ILUVATAR__
48+
#ifdef FLAGTREE_SPEC_BlockInfo_Function
4749
// type: 0 all | 1 del W from other R |2 del R from other W
48-
void erase(BlockInfo &other, int type = 0) {
49-
if (type == 0) {
50-
for (auto &sri : other.syncReadIntervals)
51-
syncReadIntervals.erase(sri);
52-
for (auto &swi : other.syncWriteIntervals)
53-
syncWriteIntervals.erase(swi);
54-
} else if (type == 1) {
55-
for (auto &sri : other.syncReadIntervals)
56-
syncWriteIntervals.erase(sri);
57-
} else if (type == 2) {
58-
for (auto &swi : other.syncWriteIntervals)
59-
syncReadIntervals.erase(swi);
60-
}
61-
}
50+
void erase(BlockInfo &other, int type = 0);
6251

6352
// for debug
64-
void printIntervals() {
65-
if (syncReadIntervals.size() > 0 || syncWriteIntervals.size() > 0) {
66-
std::cout << " syncReadIntervals";
67-
for (auto &lhs : syncReadIntervals)
68-
std::cout << " [" << lhs.start() << ", " << lhs.end() << "] ";
69-
std::cout << "" << std::endl;
70-
std::cout << " syncWriteIntervals";
71-
for (auto &lhs : syncWriteIntervals)
72-
std::cout << " [" << lhs.start() << ", " << lhs.end() << "] ";
73-
std::cout << "" << std::endl;
74-
}
75-
}
53+
void printIntervals();
7654
#endif
7755

7856
/// Compares two BlockInfo objects.

0 commit comments

Comments
 (0)