Skip to content

Arm backend: expect int8 cat under EXT-INT64 to delegate after to_edge promotes it - #24628

Closed
shoumikhin wants to merge 1 commit into
pytorch:mainfrom
shoumikhin:arm-int64-cat-byte-expectation
Closed

shoumikhin wants to merge 1 commit into
pytorch:mainfrom
shoumikhin:arm-int64-cat-byte-expectation

Conversation

@shoumikhin

@shoumikhin shoumikhin commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

test_int64_extension_partition_tosa_INT[cat_byte] fails on main in the Arm TOSA tests.

Two changes met on main. #24381 changed to_edge so that a cat with mixed dtypes casts its narrower inputs to the result dtype. #24306 added the cat_byte case, which joins an int64 tensor with an int8 tensor and expects nothing to be delegated. Its CI ran on a base from before #24381.

After #24381, the int8 input reaches the partitioner already cast to int64. The cast stays on the CPU, and the cat now sees only int64 inputs, so the partitioner delegates it. That is correct under the int64 extension, so this change expects 1 delegate for cat_byte and adds a short comment saying why.

@abm-77, could you confirm this matches what you meant the case to check? If you want to keep a case where a narrow input blocks delegation, it needs an op that to_edge does not promote. I am happy to change it that way instead.

Test plan

Ran backends/arm/test/misc/test_int64.py and backends/arm/test/misc/test_tosa_operator_support.py: all pass. Without this change, cat_byte fails with the same error as on main.

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

…e promotes it

test_int64_extension_partition_tosa_INT[cat_byte] fails on main. to_edge now
casts a mixed-dtype cat's narrower operands to the result dtype, so the int8
input reaches the partitioner already cast to int64, the cast stays on the CPU,
and the all-int64 cat delegates. The test still expected the int8 operand to
keep cat off the delegate.

Test plan: test_int64.py and test_tosa_operator_support.py pass.
@shoumikhin shoumikhin added the release notes: arm Changes to the ARM backend delegate label Nov 4, 2026
Copilot AI balanced review requested due to automatic review settings November 4, 2026 18:29
@pytorch-bot

pytorch-bot Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

⏳ No Failures, 8 Pending

As of commit 4388f95 with merge base c7f7931 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@shoumikhin

Copy link
Copy Markdown
Contributor Author

@claude /pr-review

@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 Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels Nov 4, 2026
@claude

claude Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Claude finished @shoumikhin's task in 8m 51s —— View job


The cat_byte count of 1 is correct now that to_edge casts cat inputs, but with this change no test checks that a narrow operand blocks delegation, so I recommend adding an or_byte (bitwise_or) case before merging.

Detailed review

PR Review: #24628

Summary

to_edge now casts mixed-dtype cat inputs to the result dtype, so this PR changes the expected delegate count for cat_byte from 0 to 1. The new count is correct. The problem is that this removes the only case for the rejection branch of the int64 operand check, and the suite's comments no longer match its cases.

Testing

  • backends/arm/test/misc/test_int64.py:150: no case tests the narrow-operand rule any more (major).

    • The suite header (lines 141-142) already says what cat_byte was for: "an operand narrower than int32 falls back instead".
    • That rule is the dtypes <= {int64, int32, bool} branch of _int64_operands_agree (backends/arm/operator_support/tosa_supported_operators.py:1216), which gates support at :1448.
    • cat_byte was the only case that reached this branch. RemoveMixedTypeOperators now casts every cat/stack input to the output dtype (exir/passes/remove_mixed_type_operators.py:21-24), so no cat case can reach it.
    • The only direct unit test, test_tosa_operator_support.py:336, only asserts True.
    • Trigger: someone loosens line 1216 to accept int8/int16/uint8, or drops the dtype condition. Every test still passes, but the partitioner would then accept bitwise_or(int64, int8), even though EXT-INT64 has no int8→int64 cast (backends/arm/tosa/cast_support.py:83-88).
    • Fix: take the alternative you offered in the description, using bitwise_or. bitwise_or.Tensor is in TOSA_PRO_INT_EXT_INT64_SupportList (tosa_profile_supported_op_lists.py:375) but not in promotion_type_allow_list (remove_mixed_type_operators.py:30-39), so its int8 operand reaches the partitioner without a cast. Add next to or_narrow:
      "or_byte": (torch.bitwise_or, (_WIDE, _BYTES), 0),
      The promoted ops (add/mul/sub/div/minimum) and cat/stack won't work for this. Low confidence on the exact count: pytest needed approval in this environment, so I could not run the case. Please confirm it gives 0 delegates.

    Fix this →

Code Quality

  • backends/arm/test/misc/test_int64.py:141-142, 149: if cat_byte stays at 1, the comments contradict the cases (minor).

    • Two lines below the header's narrow-operand rule, cat_byte passes an int8 operand and expects a delegate.
    • The new note on line 149 explains only cat_byte, but to_edge casts the inputs of cat_narrow (147) and cat_bool (152) the same way. Without that note, their names suggest the partitioner still sees int32 or bool operands on cat.
    • Fix: move the to_edge note into the suite header so it covers all three cat entries. Reword the narrow-operand rule there so it covers only ops whose operands to_edge does not cast.

    Fix this →

Recommendation

Request Changes

The flip alone unblocks main, but it drops the coverage that the suite's own header describes. The fix is one extra case and moving one comment, both in the same file.

Review tasks
  • Load /pr-review skill
  • Gather context (diff, checklist, related code)
  • Run independent reviews (3 reviewers; all three reported both findings)
  • Consolidate findings
  • Fact-check findings against the cited code (pytest not run: it needs approval here, so the suggested or_byte case is untested)
  • Post review

@abm-77

abm-77 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thanks! I put up #24621 for this a little earlier. The case was meant to check that an operand narrower than int32 falls back, and cat can't exercise that anymore after #24381, so #24621 switches it to bitwise_or, which to_edge doesn't promote. Happy to go with either one though.

@shoumikhin

Copy link
Copy Markdown
Contributor Author

Thanks, yours is the better fix since it keeps what the test is meant to check. Closing this one in favor of #24621.

@shoumikhin shoumikhin closed this Nov 4, 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 release notes: arm Changes to the ARM backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants