Skip to content

Arm backend: Fix int64 argmax delegation rejection#20765

Open
zingo wants to merge 1 commit into
pytorch:mainfrom
zingo:Arm-backend-Fix-int64-argmax-delegation-rejection
Open

Arm backend: Fix int64 argmax delegation rejection#20765
zingo wants to merge 1 commit into
pytorch:mainfrom
zingo:Arm-backend-Fix-int64-argmax-delegation-rejection

Conversation

@zingo

@zingo zingo commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

TOSA 1.0 ARGMAX returns int32 indices, while aten.argmax returns int64. If the graph consumes the raw aten.argmax result on CPU fallback, delegating ARGMAX changes the dtype and can fail with an Int-vs-Long mismatch.

Keep delegation enabled only when every user immediately casts the argmax result to int32:

aten.argmax
-> _to_dim_order_copy(dtype=int32)
-> users

Otherwise reject the node during support checking so the PyTorch-compatible int64 result is preserved.

Fixes the flow test:

test_argmax_dim[arm_tosa_fp]

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

TOSA 1.0 ARGMAX returns int32 indices, while aten.argmax returns
int64. If the graph consumes the raw aten.argmax result on CPU
fallback, delegating ARGMAX changes the dtype and can fail with an
Int-vs-Long mismatch.

Keep delegation enabled only when every user immediately casts the
argmax result to int32:

  aten.argmax
    -> _to_dim_order_copy(dtype=int32)
    -> users

Otherwise reject the node during support checking so the
PyTorch-compatible int64 result is preserved.

Fixes the flow test:

  test_argmax_dim[arm_tosa_fp]

Signed-off-by: Zingo Andersen <Zingo.Andersen@arm.com>
Change-Id: I7222ab7d0feb16eec0d83c841a87e671ca754680
@zingo zingo requested a review from digantdesai as a code owner July 7, 2026 14:43
@zingo zingo added partner: arm For backend delegation, kernels, demo, etc. from the 3rd-party partner, Arm release notes: arm Changes to the ARM backend delegate labels Jul 7, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 3 New Failures, 9 Pending, 1 Unrelated Failure

As of commit 6f55027 with merge base b1ef9a5 (image):

NEW FAILURES - The following jobs have failed:

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

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 7, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Jul 7, 2026
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.

1 participant