Skip to content

Reland "Arm backend: Add real implementation for TOSA dialect ops (re-land)" v2 (#20674)#20674

Open
rascani wants to merge 1 commit into
mainfrom
revert-20670-revert-20537-real-tosa-impl-2
Open

Reland "Arm backend: Add real implementation for TOSA dialect ops (re-land)" v2 (#20674)#20674
rascani wants to merge 1 commit into
mainfrom
revert-20670-revert-20537-real-tosa-impl-2

Conversation

@rascani

@rascani rascani commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary:
Reverts #20670 and relands #20537

In a first commit,

Arm backend: Add infra for real implementations of Tosa ops

Tested by applying the infra to the avg_pool2d Tosa dialect op.
The rewrite_avg_pool2d tests can now be ran to verify that
the produced Tosa is correct. To make it completely correct,
two additional passes need to be added to the test.

Then,

Arm backend: Add real impls to all TOSA dialect ops

Additionally,

Remove special case in ComputeOpsAOT pass for such ops,
since they can now be executed.
Start running the model in tests were this was previously
impossible due to ops not having a real impl.

Differential Revision: D110362915

Pulled By: rascani

@pytorch-bot

pytorch-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 7 Pending

As of commit 08f8c84 with merge base 3bd4748 (image):
💚 Looks good so far! There are no failures yet. 💚

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 1, 2026
@rascani rascani marked this pull request as draft July 1, 2026 19:49
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

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.

@meta-codesync

meta-codesync Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@rascani has imported this pull request. If you are a Meta employee, you can view this in D110362915.

…-land)" v2 (#20674)

Summary:
Reverts #20670 and relands #20537

In a first commit,

Arm backend: Add infra for real implementations of Tosa ops

Tested by applying the infra to the avg_pool2d Tosa dialect op.
The rewrite_avg_pool2d tests can now be ran to verify that
the produced Tosa is correct. To make it completely correct,
two additional passes need to be added to the test.

Then,

Arm backend: Add real impls to all TOSA dialect ops

Additionally,

Remove special case in ComputeOpsAOT pass for such ops,
since they can now be executed.
Start running the model in tests were this was previously
impossible due to ops not having a real impl.

Pull Request resolved: #20674

Differential Revision: D110362915

Pulled By: rascani
@rascani rascani force-pushed the revert-20670-revert-20537-real-tosa-impl-2 branch from d87e5e5 to 08f8c84 Compare July 2, 2026 16:15
@meta-codesync meta-codesync Bot changed the title Reland "Arm backend: Add real implementation for TOSA dialect ops (re-land)" v2 Reland "Arm backend: Add real implementation for TOSA dialect ops (re-land)" v2 (#20674) Jul 2, 2026
@meta-codesync

meta-codesync Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@rascani has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110362915.

@rascani rascani requested review from Erik-Lundell and zingo July 2, 2026 16:18
@rascani rascani marked this pull request as ready for review July 2, 2026 16:18
Comment on lines +57 to +61
# Import lazily: the reference model is only needed to execute an op,
# not to import the dialect. Linking the native extension into every
# dialect consumer overflows the ELF relocation limit in large builds.
import tosa_reference_model as reference_model # type: ignore[import-not-found, import-untyped]
import tosa_serializer as ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fyi @Erik-Lundell - this is the only non-BUCK change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds good. Makes the dialect less sensitive to missing the tosa-tools dependency as well.

@Erik-Lundell Erik-Lundell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tough one to land... LGTM, thanks for fixing

Comment on lines +57 to +61
# Import lazily: the reference model is only needed to execute an op,
# not to import the dialect. Linking the native extension into every
# dialect consumer overflows the ELF relocation limit in large builds.
import tosa_reference_model as reference_model # type: ignore[import-not-found, import-untyped]
import tosa_serializer as ts

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds good. Makes the dialect less sensitive to missing the tosa-tools dependency as well.

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

Labels

ci-no-td ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported module: arm Issues related to arm backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants