Skip to content

Arm backend: Refactor scalar handling#18402

Merged
Erik-Lundell merged 2 commits into
pytorch:mainfrom
Erik-Lundell:call-scalar
Mar 23, 2026
Merged

Arm backend: Refactor scalar handling#18402
Erik-Lundell merged 2 commits into
pytorch:mainfrom
Erik-Lundell:call-scalar

Conversation

@Erik-Lundell
Copy link
Copy Markdown
Collaborator

@Erik-Lundell Erik-Lundell commented Mar 23, 2026

Arm backend: use scalars instead of fulls in TFA

Scalars are then converted to buffers by the
ScalarsToAttribute pass. This both simplifies the code,
and allows affected ops to be moved to device with
model.to(device=...).

Note that this does not solve all issues with device
kwargs after TFA, only specifically for scalar cases.

Arm backend: Clean up some pass inefficiencies.

- The ScalarToAttribute pass went through all submodules
for each node, it only needs to do it once.
- Some exir passes used full_like for scalars. This creates
very buffers of the same size as the input, when a single
value is enough.

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

Scalars are then converted to buffers by the
ScalarsToAttribute pass. This both simplifies the code,
and allows affected ops to be moved to device with
model.to(device=...).

Note that this does not solve all issues with device
kwargs after TFA, only specifically for scalar cases.

Signed-off-by: Erik Lundell <erik.lundell@arm.com>
Change-Id: I65c4ac69ec8fbfae98d8660a670658af6ea2eca8
- The ScalarToAttribute pass went through all submodules
for each node, it only needs to do it once.
- Some exir passes used full_like for scalars. This creates
very buffers of the same size as the input, when a single
value is enough.

Signed-off-by: Erik Lundell <erik.lundell@arm.com>
Change-Id: Ie48cec7dd2f78855eda90811fd1bc7dfec7d3a15
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Mar 23, 2026

🔗 Helpful Links

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

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

❌ 1 Cancelled Job, 1 Pending, 5 Unrelated Failures

As of commit 2087f35 with merge base f7977a6 (image):

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

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was 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 Mar 23, 2026
@Erik-Lundell Erik-Lundell added release notes: arm Changes to the ARM backend delegate release notes: none Do not include this in the release notes partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm ciflow/trunk and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. release notes: arm Changes to the ARM backend delegate labels Mar 23, 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 Mar 23, 2026
@Erik-Lundell
Copy link
Copy Markdown
Collaborator Author

Unrelated failures, merging.

@Erik-Lundell Erik-Lundell merged commit 410dd83 into pytorch:main Mar 23, 2026
405 of 437 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. 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