Skip to content

Commit e8ce1fa

Browse files
committed
subgraphs, some clarifications
1 parent db7750b commit e8ce1fa

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

docs/rfcs/PipelineComposition.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,21 @@ This API also allows a dynamic control flow between pipelines in graph, controll
2929
```C++
3030
class PipelineGraph {
3131
public:
32-
void registerPipeline(
32+
LogicalResult registerPipeline(
3333
StringRef name,
3434
ArrayRef<StringRef> predecessors,
3535
ArrayRef<StringRef> successors,
3636
ArrayRef<StringRef> jumpTargets,
37-
std::function<void(OpPassManager &)> populateFunc);
37+
std::function<void(OpPassManager &)> populateFunc,
38+
raw_ostream &errorStream);
39+
40+
LogicalResult registerPipeline(
41+
StringRef name,
42+
ArrayRef<StringRef> predecessors,
43+
ArrayRef<StringRef> successors,
44+
ArrayRef<StringRef> jumpTargets,
45+
std::function<void(PipelineGraph &)> populateFunc,
46+
raw_ostream &errorStream);
3847

3948
FailureOr<PipelineSchedule> createPipelineSchedule(raw_ostream &errorStream) const;
4049
};
@@ -47,17 +56,20 @@ User is adding pipelines into graph via `registerPipeline` function, each pipeli
4756
* `jumpTargets` - List of the names of pipelines to which we can dynamically jump after current pipeline.
4857
* `populateFunc` - Callback to populate pipeline with passes.
4958
59+
User can either register linear sequence of passes via `OpPassManager` variant or a subgraph via `PipelineGraph`.
60+
Registered subgraphs are isolated from the current graph and always executed as single entity (i.e. control flow can't jump into or from the middle of subgraph).
61+
5062
After user populated the graph object they must call `createPipelineSchedule` method to compile the resulted graph into runnable schedule.
5163
`createPipelineSchedule` will build a DAG from pipelines dependencies provided by user, and will try to get linear execution order to satify these dependencies.
5264
53-
If two pipelines doesn't have direct and indirect dependencies, order in which they will be executed is not specified, but stable.
65+
If two pipelines doesn't have direct and indirect dependencies, order in which they will be executed is not specified.
5466
5567
Implicit cycles in graph are not allowed and will result in `createPipelineSchedule` returning error. But cycles via `jumpTargets` are allowed (see later).
5668
5769
Empty pipelines (i.e. pipelines without passes, when `populateFunc` does nothing) are allowed and sometimes desirable.
5870
5971
One usecase is using empty pipelines as anchors for other pipelines. Let's say use wants to split hist entire compiler pipeline into 3 stages: `high`, `middle` and `low`.
60-
They can create a two empty pipelines `high-to-middle` and `midlle-to-low` with appropriate dependencies and the use those as anchors to specify at which compiler stage insert stages which do actual work.
72+
They can create a two empty pipelines `high-to-middle` and `middle-to-low` with appropriate dependencies and the use those as anchors to specify at which compiler stage insert stages which do actual work.
6173
6274
### PipelineSchedule
6375
```C++
@@ -66,7 +78,9 @@ public:
6678
LogicalResult run(Operation *op);
6779
};
6880
```
69-
`PipelineSchedule` object encapsulates compiled pipeline graph. Main method is `LogicalResult run(Operation *op);` which follows existing MLIR `PassManager::run`.
81+
`PipelineSchedule` object encapsulates compiled pipeline graph.
82+
Main method is `LogicalResult run(Operation *op);` which follows existing MLIR `PassManager::run` semantics.
83+
`run` will execute
7084

7185
### Dynamic pipeline control flow
7286

0 commit comments

Comments
 (0)