Skip to content

Commit d804bd9

Browse files
wlei-llvmmeta-codesync[bot]
authored andcommitted
[AutoWS] Rename PipelineGraph → ScheduleGraph in code (#1285)
Summary: Pull Request resolved: #1285 Mechanical rename of all Pipeline* types to Schedule* per TL feedback: - ModuloPipelineIR.h → ModuloScheduleGraph.h - ModuloPipelineIR.cpp → ModuloScheduleGraph.cpp - PipelineGraph → ScheduleGraph - PipelineLoop → ScheduleLoop - PipelineNode → ScheduleNode - PipelineEdge → ScheduleEdge - PipelineBuffer → ScheduleBuffer - modulo.pipeline → modulo.schedule (dump output) - Updated CMakeLists.txt source reference - BUCK needs buckify to update the generated source list Authored with Claude. Reviewed By: htyu Differential Revision: D101295776 fbshipit-source-id: 842252f40ffbb6d84bbf64950c42b92b58ccbc25
1 parent 0273208 commit d804bd9

3 files changed

Lines changed: 35 additions & 35 deletions

File tree

third_party/nvidia/hopper/lib/Transforms/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ add_triton_library(NVHopperTransforms
2323
ModuloScheduling/ModuloReservationTable.cpp
2424
ModuloScheduling/ModuloSchedulePass.cpp
2525
ModuloScheduling/ModuloWSPartitionPass.cpp
26-
ModuloScheduling/ModuloPipelineIR.cpp
26+
ModuloScheduling/ModuloScheduleGraph.cpp
2727
ModuloScheduling/ModuloBufferAllocPass.cpp
2828
ModuloScheduling/ModuloExpandPass.cpp
2929
ModuloScheduling/ModuloLowerPass.cpp

third_party/nvidia/hopper/lib/Transforms/ModuloScheduling/ModuloPipelineIR.cpp renamed to third_party/nvidia/hopper/lib/Transforms/ModuloScheduling/ModuloScheduleGraph.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
22

3-
#include "ModuloPipelineIR.h"
3+
#include "ModuloScheduleGraph.h"
44

55
#include "llvm/ADT/DenseSet.h"
66
#include "llvm/Support/Debug.h"
@@ -27,7 +27,7 @@ static void dumpIndent(llvm::raw_ostream &os, unsigned depth) {
2727
os << " ";
2828
}
2929

30-
static void dumpNodeOneLine(const PipelineNode &node, llvm::raw_ostream &os,
30+
static void dumpNodeOneLine(const ScheduleNode &node, llvm::raw_ostream &os,
3131
unsigned depth) {
3232
dumpIndent(os, depth);
3333
if (node.op && node.op->getNumResults() > 0)
@@ -70,7 +70,7 @@ static void dumpNodeOneLine(const PipelineNode &node, llvm::raw_ostream &os,
7070
os << "}\n";
7171
}
7272

73-
static void dumpPort(const PipelineLoop::MemPort &port, llvm::raw_ostream &os) {
73+
static void dumpPort(const ScheduleLoop::MemPort &port, llvm::raw_ostream &os) {
7474
if (!port.op) {
7575
if (port.bufferId != UINT_MAX)
7676
os << "buf" << port.bufferId;
@@ -86,10 +86,10 @@ static void dumpPort(const PipelineLoop::MemPort &port, llvm::raw_ostream &os) {
8686
}
8787
}
8888

89-
static void dumpLoop(const PipelineGraph &graph, const PipelineLoop &loop,
89+
static void dumpLoop(const ScheduleGraph &graph, const ScheduleLoop &loop,
9090
llvm::raw_ostream &os, unsigned depth) {
9191
dumpIndent(os, depth);
92-
os << "modulo.pipeline @loop" << loop.id << " {\n";
92+
os << "modulo.schedule @loop" << loop.id << " {\n";
9393
unsigned inner = depth + 1;
9494

9595
// Schedule parameters
@@ -220,7 +220,7 @@ static void dumpLoop(const PipelineGraph &graph, const PipelineLoop &loop,
220220
os << "}\n";
221221
}
222222

223-
void PipelineGraph::dump() const {
223+
void ScheduleGraph::dump() const {
224224
llvm::DenseSet<unsigned> childIds;
225225
for (const auto &loop : loops)
226226
for (const auto &node : loop.nodes)

third_party/nvidia/hopper/lib/Transforms/ModuloScheduling/ModuloPipelineIR.h renamed to third_party/nvidia/hopper/lib/Transforms/ModuloScheduling/ModuloScheduleGraph.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
22
//
3-
// ModuloPipeline IR — abstract representation of a modulo-scheduled
3+
// ModuloScheduleGraph — abstract representation of a modulo-scheduled
44
// loop nest with multi-buffered memory, pipeline stages, and optional
55
// warp specialization.
66
//
7-
// The IR is a side data structure (not MLIR ops). It references MLIR
7+
// The graph is a side data structure (not MLIR ops). It references MLIR
88
// Operations but adds scheduling metadata (cycles, stages, buffers,
99
// edges) that drive the lowering passes.
1010
//
1111
// Transformation phases:
12-
// Phase 0: SCHEDULE — DDG + Rau's → populate PipelineNode cycle/stage
13-
// Phase 1: BUFFERS — stage diffs → populate PipelineBuffer count
12+
// Phase 0: SCHEDULE — DDG + Rau's → populate ScheduleNode cycle/stage
13+
// Phase 1: BUFFERS — stage diffs → populate ScheduleBuffer count
1414
// Phase 1.5: WS — utilization → assign warp_group per stage
1515
// Phase 2: EXPAND — bottom-up prologue/kernel/epilogue per loop
1616
// Phase 3: LOWER — replace MLIR ops with async copies + barriers
1717

18-
#ifndef TRITON_NVIDIA_HOPPER_MODULO_PIPELINE_IR_H
19-
#define TRITON_NVIDIA_HOPPER_MODULO_PIPELINE_IR_H
18+
#ifndef TRITON_NVIDIA_HOPPER_MODULO_SCHEDULE_GRAPH_H
19+
#define TRITON_NVIDIA_HOPPER_MODULO_SCHEDULE_GRAPH_H
2020

2121
#include "LatencyModel.h"
2222

@@ -37,7 +37,7 @@ enum class MemoryKind { SMEM, TMEM, Register, BARRIER };
3737

3838
/// A multi-buffered memory allocation.
3939
/// Represents SMEM or TMEM that needs multiple copies for pipelining.
40-
struct PipelineBuffer {
40+
struct ScheduleBuffer {
4141
unsigned id{};
4242
MemoryKind kind{MemoryKind::SMEM};
4343
llvm::SmallVector<int64_t, 4> shape; // e.g., {128, 64}
@@ -66,7 +66,7 @@ struct PipelineBuffer {
6666
// ============================================================================
6767

6868
/// A node in the pipeline graph. Wraps an MLIR Operation with scheduling info.
69-
struct PipelineNode {
69+
struct ScheduleNode {
7070
unsigned id{};
7171
Operation *op{nullptr};
7272

@@ -78,11 +78,11 @@ struct PipelineNode {
7878
int selfLatency{0}; // cycles this op occupies its pipeline
7979

8080
// Super-node: if this node represents a child pipeline (inner loop)
81-
unsigned childPipelineId{UINT_MAX}; // index into PipelineGraph::pipelines
81+
unsigned childPipelineId{UINT_MAX}; // index into ScheduleGraph::pipelines
8282
int prologueLatency{0}; // cycles before TC starts in child
8383

8484
// Buffer references
85-
unsigned producesBuffer{UINT_MAX}; // index into PipelineLoop::buffers
85+
unsigned producesBuffer{UINT_MAX}; // index into ScheduleLoop::buffers
8686
llvm::SmallVector<unsigned, 2> consumesBuffers; // indices into buffers
8787

8888
// Warp specialization (from Phase 1.5)
@@ -98,7 +98,7 @@ struct PipelineNode {
9898
// Pipeline edge — producer-consumer dependency
9999
// ============================================================================
100100

101-
struct PipelineEdge {
101+
struct ScheduleEdge {
102102
unsigned srcId{};
103103
unsigned dstId{};
104104
int latency{};
@@ -112,7 +112,7 @@ struct PipelineEdge {
112112
/// A pipelined loop with its schedule, nodes, edges, and buffers.
113113
/// Analogous to a function: has inputs (consumed from outer scope),
114114
/// outputs (produced for outer scope), and a body (nodes + edges).
115-
struct PipelineLoop {
115+
struct ScheduleLoop {
116116
unsigned id{};
117117
scf::ForOp forOp;
118118

@@ -125,15 +125,15 @@ struct PipelineLoop {
125125
false}; // true if tripCount is estimated, not constant
126126

127127
// Body (kernel loop steady state)
128-
llvm::SmallVector<PipelineNode, 16> nodes;
129-
llvm::SmallVector<PipelineEdge, 16> edges;
128+
llvm::SmallVector<ScheduleNode, 16> nodes;
129+
llvm::SmallVector<ScheduleEdge, 16> edges;
130130

131131
// Expanded structure (populated after expansion, empty before)
132132
// Prologue: ops cloned before the loop (stage 0 of first iterations)
133133
// Epilogue: ops cloned after the loop (drain of last stage)
134-
llvm::SmallVector<PipelineNode, 8> prologueNodes;
135-
llvm::SmallVector<PipelineNode, 8> epilogueNodes;
136-
bool isExpanded{false}; // true after expandPipelineGraph
134+
llvm::SmallVector<ScheduleNode, 8> prologueNodes;
135+
llvm::SmallVector<ScheduleNode, 8> epilogueNodes;
136+
bool isExpanded{false}; // true after expandScheduleGraph
137137

138138
// Memory interface (inputs/outputs crossing loop boundary)
139139
// These drive multi-buffering at the parent level.
@@ -151,18 +151,18 @@ struct PipelineLoop {
151151
llvm::SmallVector<MemPort, 4> outputs; // produced for outer scope
152152

153153
// Multi-buffered allocations within this loop
154-
llvm::SmallVector<PipelineBuffer, 4> buffers;
154+
llvm::SmallVector<ScheduleBuffer, 4> buffers;
155155

156156
// Lookup
157157
llvm::DenseMap<Operation *, unsigned> opToNodeId;
158158

159159
// Helpers
160-
const PipelineNode &getNode(unsigned id) const {
160+
const ScheduleNode &getNode(unsigned id) const {
161161
assert(id < nodes.size() && "node id out of range");
162162
return nodes[id];
163163
}
164164
/// Find the node for an MLIR op, or nullptr if not in this loop.
165-
const PipelineNode *findNode(Operation *op) const {
165+
const ScheduleNode *findNode(Operation *op) const {
166166
auto it = opToNodeId.find(op);
167167
if (it == opToNodeId.end())
168168
return nullptr;
@@ -171,8 +171,8 @@ struct PipelineLoop {
171171
int numStages() const { return maxStage + 1; }
172172

173173
/// Get all nodes in a given stage.
174-
llvm::SmallVector<const PipelineNode *> getNodesInStage(int stage) const {
175-
llvm::SmallVector<const PipelineNode *> result;
174+
llvm::SmallVector<const ScheduleNode *> getNodesInStage(int stage) const {
175+
llvm::SmallVector<const ScheduleNode *> result;
176176
for (const auto &n : nodes)
177177
if (n.stage == stage)
178178
result.push_back(&n);
@@ -186,24 +186,24 @@ struct PipelineLoop {
186186

187187
/// The complete pipeline graph for a kernel. Contains all pipelined loops
188188
/// (potentially nested) and their relationships.
189-
struct PipelineGraph {
190-
llvm::SmallVector<PipelineLoop, 4> loops;
189+
struct ScheduleGraph {
190+
llvm::SmallVector<ScheduleLoop, 4> loops;
191191

192192
/// Add a new loop and return its id.
193193
unsigned addLoop(scf::ForOp forOp) {
194194
unsigned id = loops.size();
195-
PipelineLoop loop;
195+
ScheduleLoop loop;
196196
loop.id = id;
197197
loop.forOp = forOp;
198198
loops.push_back(std::move(loop));
199199
return id;
200200
}
201201

202-
PipelineLoop &getLoop(unsigned id) {
202+
ScheduleLoop &getLoop(unsigned id) {
203203
assert(id < loops.size() && "loop id out of range");
204204
return loops[id];
205205
}
206-
const PipelineLoop &getLoop(unsigned id) const {
206+
const ScheduleLoop &getLoop(unsigned id) const {
207207
assert(id < loops.size() && "loop id out of range");
208208
return loops[id];
209209
}
@@ -258,4 +258,4 @@ struct PipelineGraph {
258258

259259
} // namespace mlir::triton::gpu
260260

261-
#endif // TRITON_NVIDIA_HOPPER_MODULO_PIPELINE_IR_H
261+
#endif // TRITON_NVIDIA_HOPPER_MODULO_SCHEDULE_GRAPH_H

0 commit comments

Comments
 (0)