Skip to content

Arm backend: Rerun duplicate-user fusion after TOSA lowering#21041

Merged
YufengShi-dudu merged 1 commit into
pytorch:mainfrom
YufengShi-dudu:rerun-deplicate-user-fusion
Jul 21, 2026
Merged

Arm backend: Rerun duplicate-user fusion after TOSA lowering#21041
YufengShi-dudu merged 1 commit into
pytorch:mainfrom
YufengShi-dudu:rerun-deplicate-user-fusion

Conversation

@YufengShi-dudu

@YufengShi-dudu YufengShi-dudu commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Late TOSA transformations can introduce equivalent operations after the first FuseDuplicateUsersPass invocation. Rerun it after TOSA and shape transformations, before output nodes are made unique.

TOSA-FP operator comparisons:

Model Before After Reduction
SD3 1,663 1,573 90 (5.4%)
InceptionV3 762 746 16 (2.1%)
Conformer delegate 537 494 43 (8.0%)

All three reference-output tests pass with late fusion enabled.

Add regression coverage for the late fusion and output uniqueness pass ordering.

Change-Id: Ia4e2335e05b18d16b93c7e035a5502b8f050855c

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

@YufengShi-dudu YufengShi-dudu added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk module: arm Issues related to arm backend release notes: none Do not include this in the release notes labels Jul 20, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Unrelated Failure

As of commit 5d9ab46 with merge base a19d1ba (image):

NEW FAILURE - The following job has failed:

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.

@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 Jul 20, 2026
Late TOSA transformations can introduce equivalent operations after the
first FuseDuplicateUsersPass invocation. Rerun it after TOSA and shape
transformations, before output nodes are made unique.

TOSA-FP operator comparisons:

| Model              | Before | After | Reduction |
|--------------------|-------:|------:|----------:|
| SD3                |  1,663 | 1,573 | 90 (5.4%) |
| InceptionV3        |    762 |   746 | 16 (2.1%) |
| Conformer delegate |    537 |   494 | 43 (8.0%) |

All three reference-output tests pass with late fusion enabled.

Add regression coverage for the late fusion and output uniqueness pass
ordering.

Change-Id: Ia4e2335e05b18d16b93c7e035a5502b8f050855c
Signed-off-by: Yufeng Shi <yufeng.shi@arm.com>
@YufengShi-dudu
YufengShi-dudu force-pushed the rerun-deplicate-user-fusion branch from 4c0696c to 5d9ab46 Compare July 21, 2026 08:29
@YufengShi-dudu
YufengShi-dudu merged commit 667c91b into pytorch:main Jul 21, 2026
490 of 494 checks passed
metascroy added a commit that referenced this pull request Jul 21, 2026
…#21106)

Reverts #21041

This change breaks executorch/backends/arm/test:addmm
test_addmm_u55_INT[basic] on Corstone-300: the model output is all zeros
instead of the reference [[2,4],[6,8]].

Root cause: running FuseDuplicateUsersPass after InsertRescalePass. In
the
[basic] case x1 and x3 are value-identical, so FuseEqualPlaceholdersPass
merges them into a single placeholder that feeds both the matmul operand
and the bias/add path. After rescale insertion, that shared producer has
multiple tosa.RESCALE users, and fusing them corrupts the quantized
addmm
data flow, zeroing the output. Bisected to the late
FuseDuplicateUsersPass
insertion specifically (reordering EnsureUniqueOutputNodesPass is not
the
cause).

cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils
@Sebastian-Larsson @robell @rascani
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: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants