Repository navigation
Commit f807a6e
Namespace immutable constants per method in
Summary:
Pull Request resolved: pytorch#23891
Exported methods can reuse a constant name with different immutable tensors, causing `to_native` to reject the combined program. Namespace every immutable constant as `<method>/<key>`, including single-method programs, and update its graph references, including quantization metadata and nested graphs. Identical tensors still deduplicate when saving the `.ptn`.
Keys mutated by any method retain their original names throughout the program, preserving shared state for readers and writers. Reject differing values for shared mutable keys and collisions between final names.
Authored with assistance from OpenAI Codex.
Differential Revision: D125294428to_native (pytorch#23891)1 parent 19f8894 commit f807a6e
4 files changed
Lines changed: 247 additions & 41 deletions
File tree
- backends/native/serialization
- exir/native
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
31 | 29 | | |
32 | 30 | | |
33 | 31 | | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
1487 | 1486 | | |
1488 | 1487 | | |
1489 | 1488 | | |
1490 | | - | |
1491 | | - | |
| 1489 | + | |
| 1490 | + | |
1492 | 1491 | | |
1493 | 1492 | | |
1494 | 1493 | | |
1495 | 1494 | | |
1496 | 1495 | | |
1497 | 1496 | | |
1498 | 1497 | | |
1499 | | - | |
1500 | 1498 | | |
1501 | | - | |
| 1499 | + | |
1502 | 1500 | | |
1503 | 1501 | | |
1504 | 1502 | | |
1505 | 1503 | | |
1506 | | - | |
| 1504 | + | |
1507 | 1505 | | |
1508 | | - | |
| 1506 | + | |
1509 | 1507 | | |
1510 | 1508 | | |
1511 | 1509 | | |
1512 | | - | |
| 1510 | + | |
1513 | 1511 | | |
1514 | 1512 | | |
1515 | 1513 | | |
1516 | 1514 | | |
1517 | | - | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
1521 | | - | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
1522 | 1520 | | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
1523 | 1531 | | |
1524 | 1532 | | |
1525 | 1533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
| |||
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
| 38 | + | |
40 | 39 | | |
41 | 40 | | |
42 | 41 | | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 257 | + | |
264 | 258 | | |
265 | 259 | | |
266 | 260 | | |
| |||
363 | 357 | | |
364 | 358 | | |
365 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
366 | 364 | | |
367 | 365 | | |
368 | 366 | | |
| |||
378 | 376 | | |
379 | 377 | | |
380 | 378 | | |
381 | | - | |
382 | | - | |
383 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
384 | 382 | | |
385 | 383 | | |
386 | 384 | | |
| |||
437 | 435 | | |
438 | 436 | | |
439 | 437 | | |
440 | | - | |
441 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
442 | 460 | | |
443 | | - | |
| 461 | + | |
444 | 462 | | |
445 | 463 | | |
446 | | - | |
| 464 | + | |
447 | 465 | | |
448 | 466 | | |
449 | 467 | | |
0 commit comments