This repository was archived by the owner on Oct 11, 2025. It is now read-only.
Commit ae75929
[MLIR][Python] Expose the insertion point of pattern rewriter (#161001)
In [#160520](llvm/llvm-project#160520), we
discussed the current limitations of PDL rewriting in Python (see [this
comment](llvm/llvm-project#160520 (comment))).
At the moment, we cannot create new operations in PDL native (python)
rewrite functions because the `PatternRewriter` APIs are not exposed.
This PR introduces bindings to retrieve the insertion point of the
`PatternRewriter`, enabling users to create new operations within Python
rewrite functions. With this capability, more complex rewrites e.g. with
branching and loops that involve op creations become possible.
---------
Co-authored-by: Maksim Levental <[email protected]>1 parent a374b25 commit ae75929
File tree
5 files changed
+65
-3
lines changed- mlir
- include/mlir-c
- lib
- Bindings/Python
- CAPI/Transforms
5 files changed
+65
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
310 | 316 | | |
311 | 317 | | |
312 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
313 | 327 | | |
314 | 328 | | |
315 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
2049 | 2052 | | |
2050 | 2053 | | |
2051 | 2054 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
| 844 | + | |
| 845 | + | |
844 | 846 | | |
845 | 847 | | |
846 | 848 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
29 | 53 | | |
30 | 54 | | |
31 | 55 | | |
| |||
84 | 108 | | |
85 | 109 | | |
86 | 110 | | |
87 | | - | |
| 111 | + | |
| 112 | + | |
88 | 113 | | |
89 | 114 | | |
90 | 115 | | |
| |||
98 | 123 | | |
99 | 124 | | |
100 | 125 | | |
101 | | - | |
| 126 | + | |
| 127 | + | |
102 | 128 | | |
103 | 129 | | |
104 | 130 | | |
| |||
143 | 169 | | |
144 | 170 | | |
145 | 171 | | |
146 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
147 | 175 | | |
148 | 176 | | |
149 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
73 | 84 | | |
74 | 85 | | |
75 | 86 | | |
| |||
317 | 328 | | |
318 | 329 | | |
319 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
320 | 335 | | |
321 | 336 | | |
322 | 337 | | |
| |||
0 commit comments