You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Arm backend: Support int64 comparisons, where, slice and buffers under EXT-INT64 (3/4) - #24622
Adds comparisons, where, slice_copy, full_like and zeros_like back to TOSA_PRO_INT_EXT_INT64_SupportList. Each lowers to EQUAL, GREATER, GREATER_EQUAL, SELECT, SLICE or CONST, which EXT-INT64 defines for i64.
CastIntComparisonInputsPass compares int64 directly instead of rejecting it.
WhereSupported and SliceCopySupported accept int64, and where only when every operand casts to int64.
The int64 partitioning tests compare outputs against the reference model with values outside the int32 range. Added unit tests for both passes. Arm ops, passes and misc tests on the reference model: same results as main apart from the new tests. 44 single-op models: identical to main under TOSA-1.0+INT and TOSA-1.1+INT+int64. A sweep of 1,018 int64 cases against main (inputs, buffers and constants, in and out of int32 range, across 38 ops and 7 operand dtypes) showed no regressions or lost delegations.
This comment was automatically generated by Dr. CI and updates every 15 minutes.
meta-claBot
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
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
ciflow/trunk
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Large-integer scalar comparisons lose precision and standalone static-cache pipelines crash without a lowering context, alongside mixed-dtype overflow and comparison-support regressions.
Extends the Arm backend’s EXT-INT64 support to comparisons, selection, slicing, and constants, continuing the work in #24095 and #24306. Quantized-flow narrowing remains deferred to part 4.
Changes:
Enables additional int64 operators and comparison dtype promotion.
Preserves int64 buffers when their consumers compute in int64.
Adds pass tests and delegated-output checks using values outside the int32 range.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The preservation check misses scalar comparison overloads, causing valid wide-int64 buffer comparisons to raise int32-range errors during narrowing even with EXT-INT64 enabled.
Preserve wide int64 buffers in scalar comparison overloads
backends/arm/_passes/cast_int64_pass.py:91
target_ops contains only .Tensor comparisons, but this buffer pass runs before scalar-to-tensor replacement (arm_pass_manager.py:642–660). With EXT-INT64 enabled, a registered int64 buffer containing 2**40 used in torch.where(self.wide > 7, x, y) fails this check and raises an int32-range error during narrowing. Include the supported .Scalar comparison overloads in the preservation check and add a wide-buffer scalar-comparison regression.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because dtype promotion, rank normalization, and shared int64 buffer narrowing interact in ways that can change results or cause lowering failures.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The int64-buffer preservation logic causes accepted multi-buffer indexing, mixed-width comparisons, and comparison/cast graphs to fail during lowering.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because mixed-rank dtype promotion and fractional-scalar conversion can silently produce incorrect results in newly accepted operations.
@YufengShi-dudu you were right, all three were broken. They delegated and then crashed or gave the wrong answer, whereas main just left them on the CPU.
I was only checking operand dtypes, but torch doesn't always compute in int64 when one operand is int64. 0-d tensors do not promote, so where runs in int32, and x < 0.5 runs in float. In the new changes, int64 only stays on the delegate if the op actually computes in int64. All three stay on the CPU and are in test_int64.py.
I also ran 0-d tensors and float scalars through the same op/dtype sweep as before and nothing else came up.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues block the Arm backend’s expanded TOSA PRO-INT int64 support.
No open issues 🎉
Review effort: Balanced
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ciflow/trunkCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.community: contributionPRs coming from community (excluding hardware partners)module: armIssues related to arm backendpartner: armFor backend delegation, kernels, demo, etc. from the 3rd-party partner, Armrelease notes: armChanges to the ARM backend delegate
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds comparisons,
where,slice_copy,full_likeandzeros_likeback toTOSA_PRO_INT_EXT_INT64_SupportList. Each lowers to EQUAL, GREATER, GREATER_EQUAL, SELECT, SLICE or CONST, which EXT-INT64 defines for i64.CastIntComparisonInputsPasscompares int64 directly instead of rejecting it.WhereSupportedandSliceCopySupportedaccept int64, andwhereonly when every operand casts to int64.CastInt64BuffersToInt32Passkeeps an int64 buffer when every user computes in int64, returns it, or compares it with int64, int32 or bool operands, and narrows the rest as before. This covers the buffer cases deferred from Arm backend: Delegate int64 only to the operators EXT-INT64 covers (2/3) #24306.I removed two rows in
test_comparison_dtype_pass.pythat expected int64 comparisons to be rejected.This PR covers PRO-INT only. With FP enabled, int64 comparisons fall back to the CPU as before.
The quantized flow still narrows int64 to int32 during annotation. Part 4 will fix that.
Part 3 of 4 for #24095, following #24306.
Test Plan
The int64 partitioning tests compare outputs against the reference model with values outside the int32 range. Added unit tests for both passes. Arm ops, passes and misc tests on the reference model: same results as main apart from the new tests. 44 single-op models: identical to main under
TOSA-1.0+INTandTOSA-1.1+INT+int64. A sweep of 1,018 int64 cases against main (inputs, buffers and constants, in and out of int32 range, across 38 ops and 7 operand dtypes) showed no regressions or lost delegations.This PR was authored with Claude Code.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani @nil-is-all @YufengShi-dudu @Erik-Lundell