You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bdb489e
Browse filesBrowse the repository at this point in the historyBrowse files
Reland unused exported constant cleanup after Cortex-M lowering
### Summary
Cortex-M layout conversion leaves original tensor buffers in the exported program. Reland pytorch#22862 to lift new constants and remove unused placeholders and storage after lowering. This restores the exact eight-file patch from the original landing, applied cleanly to current main, including preservation of the original program, shared state, and custom pass-list behavior.
The original landing was reverted because a downstream custom adapter invoked ExportedProgram-aware passes on a GraphModule. The adapter migration is tracked in [D123765406](https://www.internalfb.com/diff/D123765406) and uses the native CortexMPassManager(...).passes API. Keep this reland in draft until that prerequisite lands.
Authored with AI assistance from OpenAI Codex.
### Test plan
35 Python tests passed:
```bash
pytest -q backends/transforms/test/test_remove_unused_constants_pass.py \
backends/cortex_m/test/test_pass_manager.py \
backends/cortex_m/test/test_explicit_layout_pipeline.py \
-k 'not test_implementation_explicit_layout_fuses_same_padding and not test_implementation_transpose_conv2d_strided_pointwise'
```
This covers constant pruning, original-program validity, shared state, mutation and gradient preservation, both layouts, native and legacy export entry points, PTE serialization, and custom pass-list ordering. Six FVP implementation cases were deselected.
Lintrunner passed on all eight changed files. The reviewed downstream recipe passed twelve compatibility cases with this cleanup. Four additional ModAI integration tests passed, covering ten primary exports on the internal baseline where the cleanup remains reverted.
Differential Revision: D124196546
Pull Request resolved: pytorch#23599
0 commit comments