Commit 75007d8
Do not rename external func decls during --inline-nested-modules (#2244)
**Context:**
One of the first steps in the compilation pipeline is
`--inline-nested-modules`. This pass lifts the per-qnode module up into
the global module of the qjit.
Because (usually) the symbol table of a module is isolated from above,
multiple modules in parallel may contain the same names inside.
Therefore when inlining child modules into the global module, we need to
rename them to unique names.
However, there's a small problem. Each qnode module has their own
specific transform sequence, so the quantum passes (applied during
`--apply-transform-sequence`) have to be resolved before
`--inline-nested-module`. If a pass generates a function declaration to
an external API (e.g. runtime functions), that name must not be altered.
**Description of the Change:**
Do not perform renaming on external function declarations from within
the qnode modules during `--inline-nested-modules`.
Only inline the first occurrence of such func decls from the qnode
modules into the global qjit module.
**Benefits:**
Quantum passes that generate calls to other APIs can work.
The flipside is also true! API developers do not have to maintain
multiple aliases for their API functions (e.g. gridsynth pass #2140 )
[sc-105020]
---------
Co-authored-by: Joseph Lee <[email protected]>1 parent 15be710 commit 75007d8
File tree
4 files changed
+106
-7
lines changed- doc/releases
- mlir
- lib/Catalyst/Transforms
- test/Catalyst
4 files changed
+106
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
266 | 273 | | |
267 | 274 | | |
268 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
187 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
193 | 197 | | |
| 198 | + | |
194 | 199 | | |
195 | 200 | | |
196 | 201 | | |
| |||
228 | 233 | | |
229 | 234 | | |
230 | 235 | | |
231 | | - | |
| 236 | + | |
232 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
233 | 251 | | |
234 | 252 | | |
235 | 253 | | |
| |||
249 | 267 | | |
250 | 268 | | |
251 | 269 | | |
252 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
253 | 287 | | |
254 | 288 | | |
255 | 289 | | |
| |||
261 | 295 | | |
262 | 296 | | |
263 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
264 | 323 | | |
265 | 324 | | |
266 | 325 | | |
| |||
360 | 419 | | |
361 | 420 | | |
362 | 421 | | |
| 422 | + | |
363 | 423 | | |
364 | 424 | | |
365 | 425 | | |
| |||
426 | 486 | | |
427 | 487 | | |
428 | 488 | | |
429 | | - | |
| 489 | + | |
| 490 | + | |
430 | 491 | | |
431 | 492 | | |
432 | 493 | | |
433 | 494 | | |
434 | 495 | | |
435 | 496 | | |
436 | 497 | | |
437 | | - | |
| 498 | + | |
438 | 499 | | |
439 | 500 | | |
440 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments