Skip to content

Commit 53f094a

Browse files
committed
add numba-mlir example
1 parent 32104b2 commit 53f094a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

docs/rfcs/PipelineComposition.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,57 @@ Passes inside pipeline can set this attribute to indicate they want compilatin f
8383
After current pipeline is finished, runtime will check if module object have attribute set and if it does, jump to the selected pipeline and clear the attribute.
8484

8585
Setting attribute to the value, which wasnt in `jumpTargets` for the current pipeline will result in error and abort the compilation flow.
86+
87+
88+
### Pipeline examples
89+
90+
Here is some examples where non-trivial pipeline dependencies are needed.
91+
92+
#### Numba-mlir
93+
94+
```
95+
frontend
96+
|
97+
V
98+
cfg-to-scf
99+
/ ^
100+
/ \
101+
V \
102+
python-to-std |
103+
\ /
104+
\ /
105+
V /
106+
numpy-to-linalg
107+
|
108+
V
109+
bufferization
110+
|
111+
V
112+
optimization
113+
/ \
114+
/ \
115+
V \
116+
lower-to-gpu |
117+
\ /
118+
\ /
119+
V V
120+
lower-to-llvm
121+
```
122+
In this pipeline we are lowering scalar python ops in `python-to-std` stage and
123+
numpy ops in `numpy-to-linalg` and we may need to jump backwards to `cfg-to-scf`/`python-to-std`
124+
multiple times to lower generated `linalg.generic` body, which are represented as
125+
normal python function in our numpy->linalg conversion.
126+
127+
Pipeline description for this will looks like (pseudocode):
128+
```
129+
# pipeline format:
130+
# name: [predecessors], [successors], [jumps]
131+
frontend: [], [], []
132+
cfg-to-scf: [frontend], [optimization], []
133+
python-to-std: [cfg-to-scf], [optimization], []
134+
numpy-to-linalg: [python-to-std], [bufferization, optimization], [cfg-to-scf]
135+
bufferization: [], [optimization], []
136+
optimization: [], [], []
137+
lower-to-gpu: [optimization], [lower-to-llvm], []
138+
lower-to-llvm: [optimization], [], []
139+
```

0 commit comments

Comments
 (0)