Cortex-M: add opt-in explicit-layout lowering - #22544
Conversation
Add an explicit-layout quantization mode and a separately selected, blessed pass sequence for lowering quantized spatial regions to the NHWC operator family. The legacy quantizer checks and pass sequence remain the default, while explicit mode validates that no unsupported spatial anchors or malformed layout copies survive lowering. Authored with Codex.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22544
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 1979f91 with merge base c65b23a ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Summary
Add the opt-in explicit-layout lowering pipeline for Cortex-M.
CortexMQuantizer(use_explicit_layout=True)selects the explicit convolution eligibility checks and includes Conv1d annotation before it is widened to Conv2d.CortexMPassManager(use_explicit_layout=True)selects a separate, ordered pass list that forms NHWC spatial regions, removes redundant local layout copies, validates the resulting graph, and lowers to the experimental NHWC Cortex-M operators.The default quantizer checks and pass list remain unchanged. The mode is selected only at the quantization and lowering boundaries; it is not threaded through individual passes or the target configuration. Unsupported quantized spatial anchors fail closed instead of mixing legacy and explicit operator families.
Test plan
pytest --config-file=backends/arm/test/pytest.ini backends/cortex_m/test/test_explicit_layout_pipeline.py backends/cortex_m/test/misc/test_quantization.py backends/cortex_m/test/misc/test_quantizer_reporter.pylintrunner -m origin/mainAI-assisted: Codex.
Stack created with GitHub Stacks CLI • Give Feedback 💬