Skip to content

Arm backend: Remove old transform_for_cortex_m_backend and --enable_qdq_fusion_pass#17740

Open
psiddh wants to merge 9 commits intomainfrom
aot_pre
Open

Arm backend: Remove old transform_for_cortex_m_backend and --enable_qdq_fusion_pass#17740
psiddh wants to merge 9 commits intomainfrom
aot_pre

Conversation

@psiddh
Copy link
Contributor

@psiddh psiddh commented Feb 26, 2026

Summary:
Remove the transform_for_cortex_m_backend() function and deprecate --enable_qdq_fusion_pass CLI flag from aot_arm_compiler.py. Instead, ReplaceQuantNodesPass is now applied directly inside to_edge_TOSA_delegate() and to_edge_no_delegate(), making each compilation path self-contained rather than relying on a post-hoc fixup applied to all targets.
This is a prerequisite for PR #17075, which introduces Cortex-M as a first-class compilation target with its own dedicated pipeline.

cc @digantdesai @SS-JIA @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell

Copilot AI review requested due to automatic review settings February 26, 2026 18:40
@psiddh psiddh requested a review from digantdesai as a code owner February 26, 2026 18:40
@pytorch-bot
Copy link

pytorch-bot bot commented Feb 26, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17740

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures, 1 Cancelled Job, 2 Unrelated Failures

As of commit 7d11bdb with merge base e95555a (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOB - The following job was cancelled. Please retry:

BROKEN TRUNK - The following jobs 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.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 26, 2026
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the legacy Cortex-M post-processing step from aot_arm_compiler.py and makes the delegation pipeline more explicit by applying remaining Q/DQ cleanup directly in the delegated export flow.

Changes:

  • Removed transform_for_cortex_m_backend() and the --enable_qdq_fusion_pass CLI flag.
  • Dropped unused Cortex-M fusion/convert pass imports tied to the removed flag.
  • Applied ReplaceQuantNodesPass inside to_edge_TOSA_delegate() to handle boundary quantized_decomposed::* ops after lowering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 26, 2026 23:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…pass flag

Summary:
Remove the transform_for_cortex_m_backend() function and the --enable_qdq_fusion_pass CLI flag from aot_arm_compiler.py. The function applied Cortex-M passes as a post-hoc step to all non-VGF targets, which made the compilation flow hard to follow and coupled the delegation path to Cortex-M-specific logic.

Instead, ReplaceQuantNodesPass is now applied directly inside to_edge_TOSA_delegate() to handle any boundary quantized_decomposed::* nodes that remain outside the delegated subgraph. This makes the delegation path self-contained and explicit about its runtime requirements.

This change is in preparation for an upcoming PR (#17075) that introduces Cortex-M as a first-class compilation target with its own dedicated pipeline, including CortexMQuantizer and CortexMPassManager.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 27, 2026 04:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 602 to 608
parser.add_argument(
"--non_strict_export",
dest="strict_export",
required=False,
action="store_false",
help="Disable strict checking while exporting models.",
)
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes the --enable_qdq_fusion_pass CLI flag, but examples/arm/run.sh still constructs and passes --enable_qdq_fusion_pass (see run.sh around the qdq_fusion_op_flag assignment). That script will now fail with an “unrecognized arguments” error; update the script (and any other callers) to stop using the removed flag.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will clean it up in follow up PR

Copy link
Collaborator

@zingo zingo Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If "One way is to keep the flag but it it does nothing more the print that is deprecated?" is done that would be OK (Se my other comment)

But if NOT it will break run.sh args for a while (as the flag can the used from it) so in that case its better to try to fix both in same PR to keep stuff "working" all the time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added deprecated text to the flag in this PR,

Updated the _apply_replace_quant_nodes function to accept a generic edge argument instead of EdgeProgramManager.
Copilot AI review requested due to automatic review settings February 27, 2026 04:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zingo zingo added the partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm label Feb 27, 2026
@zingo zingo changed the title Remove legacy transform_for_cortex_m_backend and --enable_qdq_fusion_… Arm backend: Remove legacy transform_for_cortex_m_backend and --enable_qdq_fusion_… Feb 27, 2026
@zingo zingo changed the title Arm backend: Remove legacy transform_for_cortex_m_backend and --enable_qdq_fusion_… Arm backend: Remove old transform_for_cortex_m_backend and --enable_qdq_fusion_pass Feb 27, 2026
Remove deprecated --enable_qdq_fusion_pass argument and related logging.
Copilot AI review requested due to automatic review settings February 27, 2026 15:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 27, 2026 15:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings February 27, 2026 16:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants