Skip to content

Arm backend: Avoid running passes with no matching target ops#19839

Merged
YufengShi-dudu merged 3 commits into
pytorch:mainfrom
YufengShi-dudu:avoid-running-nonmatching-target-op-passes
May 29, 2026
Merged

Arm backend: Avoid running passes with no matching target ops#19839
YufengShi-dudu merged 3 commits into
pytorch:mainfrom
YufengShi-dudu:avoid-running-nonmatching-target-op-passes

Conversation

@YufengShi-dudu
Copy link
Copy Markdown
Collaborator

@YufengShi-dudu YufengShi-dudu commented May 28, 2026

Add ArmPass.should_run_pass() as a reusable early-exit hook before
call() starts the normal ExportPass retracing path. The default hook
returns true, preserving existing behavior for ArmPass subclasses.

Introduce ArmOpTargetedPass for passes that only transform a known
set of operator targets. It implements should_run_pass() by scanning
the current graph and nested GraphModules for matching target
operators. If no matching target operator is found, the pass returns
an unmodified PassResult.

For passes that already gate transformations with
allowed_to_transform(), allow the target pre-scan to apply the same
check before deciding whether the pass needs to run. This avoids
running TFA passes when all matching target nodes are marked as
disallowed.

The should_run_pass() hook and ArmOpTargetedPass pre-scan avoid
rebuilding graphs for decomposition and rewrite passes that cannot
affect the current graph. The speedup is most visible on large models.

Single-run paired benchmarks on Arm backend model tests
across FP32, INT, VGF no-quant, and VGF quant variants:

Model E2E avg Pass-manager avg
T5-small +30.5% +47.5%
DeepLabV3 +12.9% +49.8%
Wav2Letter +16.9% +51.2%
InceptionV3 +22.2% +46.5%
MobileNetV2 +22.2% +52.5%
MobileNetV3 +29.9% +54.6%

Model rows are unweighted averages over successful variants.
Unweighted average across 23 successful model/target variants:
E2E speedup: +22.4%
Pass-manager speedup: +50.5%

Change-Id: Iaa09638473a1d6d1e2ce98f5a0e3fc3a14378143

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

@YufengShi-dudu YufengShi-dudu requested a review from zingo May 28, 2026 09:26
@YufengShi-dudu YufengShi-dudu added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk release notes: arm Changes to the ARM backend delegate module: arm Issues related to arm backend labels May 28, 2026
@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 May 28, 2026
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 28, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 New Failure, 3 Unrelated Failures

As of commit d22f5c1 with merge base acce7cd (image):

NEW FAILURE - The following job has failed:

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.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 28, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Erik-Lundell / name: Erik Lundell (920dc9d)
  • ✅ login: YufengShi-dudu / name: Yufeng Shi (920dc9d)

@YufengShi-dudu
Copy link
Copy Markdown
Collaborator Author

@claude Please find the email address that causes the unknown commit author error

@claude
Copy link
Copy Markdown

claude Bot commented May 28, 2026

Claude finished @YufengShi-dudu's task in 1m 37s —— View job


Finding the problematic commit email

  • Check the commit that causes the EasyCLA error
  • Report the email address

The problematic email is per.astrand@arm.com from the co-author trailer in commit 2b16e08:

Co-authored-by: Per Åstrand <per.astrand@arm.com>

The EasyCLA bot successfully resolved:

  • yufeng.shi@arm.com → GitHub user YufengShi-dudu
  • erik.lundell@arm.com → GitHub user Erik-Lundell
  • per.astrand@arm.comnot linked to any GitHub account

To fix this, either:

  1. Per Åstrand needs to add per.astrand@arm.com to their GitHub account (user per based on the CC list), or
  2. Update the co-author line to use their GitHub noreply email, e.g.:
    Co-authored-by: Per Åstrand <per@users.noreply.github.com>
    
  3. Or remove the Co-authored-by line if Per's contribution doesn't need to be attributed in this commit.

@YufengShi-dudu
Copy link
Copy Markdown
Collaborator Author

3. Or remove the Co-authored-by line if Per's contribution doesn't need to be attributed in this commit.

@claude How can I remove the Per's Co-authored-by line? Do I need to push a new commit?

@claude
Copy link
Copy Markdown

claude Bot commented May 28, 2026

Claude finished @YufengShi-dudu's task in 24s —— View job


Removing the Co-authored-by line

  • Understand the request
  • Provide instructions

You don't need a new commit — you need to amend the existing commit to remove the line, then force push. Here's how:

If the problematic commit is the latest one:

git commit --amend

This opens your editor. Delete the Co-authored-by: Per Åstrand <per.astrand@arm.com> line, save, and exit. Then:

git push --force origin avoid-running-nonmatching-target-op-passes

If the problematic commit is NOT the latest one (e.g., it's 2b16e08 and there are commits after it):

git rebase -i 2b16e08^

In the editor, change pick to edit for commit 2b16e08, save and exit. Then:

git commit --amend

Remove the Co-authored-by line, save, then continue the rebase:

git rebase --continue
git push --force origin avoid-running-nonmatching-target-op-passes

After force pushing, comment /easycla on the PR to re-trigger the CLA check.


  Add ArmPass.should_run_pass() as a reusable early-exit hook before
  call() starts the normal ExportPass retracing path. The default hook
  returns true, preserving existing behavior for ArmPass subclasses.

  Introduce ArmOpTargetedPass for passes that only transform a known
  set of operator targets. It implements should_run_pass() by scanning
  the current graph and nested GraphModules for matching target
  operators. If no matching target operator is found, the pass returns
  an unmodified PassResult.

  For passes that already gate transformations with
  allowed_to_transform(), allow the target pre-scan to apply the same
  check before deciding whether the pass needs to run. This avoids
  running TFA passes when all matching target nodes are marked as
  disallowed.

  The should_run_pass() hook and ArmOpTargetedPass pre-scan avoid
  rebuilding graphs for decomposition and rewrite passes that cannot
  affect the current graph. The speedup is most visible on large models.

  Single-run paired benchmarks on Arm backend model tests
  across FP32, INT, VGF no-quant, and VGF quant variants:

  | Model       | E2E avg | Pass-manager avg |
  |-------------|--------:|-----------------:|
  | T5-small    | +30.5%  | +47.5%           |
  | DeepLabV3   | +12.9%  | +49.8%           |
  | Wav2Letter  | +16.9%  | +51.2%           |
  | InceptionV3 | +22.2%  | +46.5%           |
  | MobileNetV2 | +22.2%  | +52.5%           |
  | MobileNetV3 | +29.9%  | +54.6%           |

  Model rows are unweighted averages over successful variants.
  Unweighted average across 23 successful model/target variants:
  E2E speedup: +22.4%
  Pass-manager speedup: +50.5%

Change-Id: Iaa09638473a1d6d1e2ce98f5a0e3fc3a14378143
Signed-off-by: Yufeng Shi <yufeng.shi@arm.com>
Co-authored-by: Erik Lundell <erik.lundell@arm.com>
@YufengShi-dudu YufengShi-dudu force-pushed the avoid-running-nonmatching-target-op-passes branch from 80f629c to 920dc9d Compare May 28, 2026 14:06
Copy link
Copy Markdown
Collaborator

@oscarandersson8218 oscarandersson8218 left a comment

Choose a reason for hiding this comment

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

New file test_arm_op_targeted_pass.py should be covered by glob in targets.bzl. Should be OK to merge.

@YufengShi-dudu YufengShi-dudu merged commit 513a4ea into pytorch:main May 29, 2026
460 of 466 checks passed
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. module: arm Issues related to arm backend partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants