Repository navigation
Commit 38d7ad0
authored
Pool immutable integer constants during EXIR emission (pytorch#22915)
### Summary
Repeated literal operator arguments allocate separate EValue slots, and
integer lists also duplicate persistent boxed-list storage. Pool
read-only integer literals and lists made entirely from literal integers
within each execution plan, using the argument schema to exclude out and
aliased values.
Preserve existing abstract values, method inputs and outputs, symbolic
values, and opaque delegate arguments. Construct references with their
final pooled IDs during emission so no serialization-time remapping is
needed.
Add tests for type distinctions, signed 64-bit limits, list references,
mutation and aliasing boundaries, plan scope, and repeated control flow.
Update the keyword-argument test to follow instruction argument IDs.
### Test plan
Validation: 78 emitter tests and 14 subtests passed, with two existing
skips. All four trained MLPerf Tiny models produced exact before/after
outputs on 67,029 Cortex-M55 FVP validation inputs. Operator calls and
planned memory were unchanged, and independent re-exports were
byte-identical. DS-CNN persistent method metadata decreased from 8,008
to 5,056 measured bytes.
Authored with OpenAI Codex.1 parent 3ffd297 commit 38d7ad0
4 files changed
Lines changed: 331 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
| 153 | + | |
| 154 | + | |
153 | 155 | | |
154 | 156 | | |
155 | 157 | | |
| |||
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
273 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
274 | 278 | | |
275 | 279 | | |
276 | 280 | | |
| |||
286 | 290 | | |
287 | 291 | | |
288 | 292 | | |
289 | | - | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
295 | 299 | | |
296 | 300 | | |
297 | 301 | | |
298 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
299 | 309 | | |
300 | 310 | | |
301 | 311 | | |
| |||
308 | 318 | | |
309 | 319 | | |
310 | 320 | | |
311 | | - | |
| 321 | + | |
312 | 322 | | |
313 | 323 | | |
314 | 324 | | |
| |||
541 | 551 | | |
542 | 552 | | |
543 | 553 | | |
| 554 | + | |
| 555 | + | |
544 | 556 | | |
545 | 557 | | |
546 | 558 | | |
| |||
564 | 576 | | |
565 | 577 | | |
566 | 578 | | |
| 579 | + | |
567 | 580 | | |
568 | 581 | | |
569 | 582 | | |
| |||
1353 | 1366 | | |
1354 | 1367 | | |
1355 | 1368 | | |
1356 | | - | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1357 | 1374 | | |
1358 | 1375 | | |
1359 | 1376 | | |
1360 | 1377 | | |
1361 | 1378 | | |
1362 | | - | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
1363 | 1400 | | |
1364 | 1401 | | |
1365 | 1402 | | |
| |||
1537 | 1574 | | |
1538 | 1575 | | |
1539 | 1576 | | |
1540 | | - | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
1541 | 1584 | | |
1542 | 1585 | | |
1543 | 1586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
431 | | - | |
432 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
433 | 435 | | |
434 | 436 | | |
435 | 437 | | |
| |||
0 commit comments