Repository navigation
Commit 1dbb8e7
authored
Don't drop a permute that an earlier region already bypassed (#24067)
"Arm backend: Map linear rows to conv2d width" (9a81281) makes
DecomposeLinearPass emit permutes around the 1x1 conv. In a gated MLP
(`u * v`, where `v` also goes through a transpose), this lets
RemovePermutesAroundElementwiseOps plan two regions that share one
permute:
- Region A treats the v-branch transpose as an incoming permute and
bypasses it, so `mul` reads the transpose's producer directly.
- Region B was planned before A was applied. It treats the same
transpose as its outgoing permute, removes its own start permute and
changes that producer's layout.
`_subgraph_edges_are_current` only checked that the outgoing permute was
still wired to its producer. A bypassed permute stays wired even though
nothing uses it, so B was applied too. `mul` was left with mismatched
operands (`[1,144,14] * [1,14,144]`), and
PropagateViewCopyPermuteDownPass failed.
The fix records the permutes each applied region bypasses. A later
region whose outgoing (or rewritten) permute is in that set is skipped.
Test plan:
- New unit test `test_permute_bypassed_by_one_region_is_kept_by_another`
passes. With the check disabled it fails with the same broadcast
RuntimeError.
- A gated-MLP model lowered through TosaPipelineINT failed with the same
error before the fix and passes after.
Internal mirror: D126717094.1 parent 3e77093 commit 1dbb8e7
2 files changed
Lines changed: 47 additions & 1 deletion
File tree
- backends/transforms
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
417 | 418 | | |
418 | 419 | | |
419 | 420 | | |
| 421 | + | |
420 | 422 | | |
421 | 423 | | |
422 | 424 | | |
| |||
829 | 831 | | |
830 | 832 | | |
831 | 833 | | |
| 834 | + | |
832 | 835 | | |
833 | 836 | | |
834 | 837 | | |
| |||
897 | 900 | | |
898 | 901 | | |
899 | 902 | | |
900 | | - | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
901 | 910 | | |
902 | 911 | | |
903 | 912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2500 | 2500 | | |
2501 | 2501 | | |
2502 | 2502 | | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
2503 | 2540 | | |
2504 | 2541 | | |
2505 | 2542 | | |
| |||
0 commit comments