Arm backend: Add support for clamp.Tensor#16273
Merged
zingo merged 2 commits intopytorch:mainfrom Dec 17, 2025
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16273
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New Failures, 2 Unrelated FailuresAs of commit f4183b4 with merge base df626bd ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Decompose aten.clamp.Tensor to a chain of minimum/maximum operations, since TOSA clamp only supports scalar min/max bounds. This change: - Rename DecomposeInt32ClampPass to DecomposeTOSAUnsupportedClampPass - Extend the pass to handle aten.clamp.Tensor variants already annotated by ArmQuantizer - Mark aten.clamp.Tensor as supported in the TOSA operator support lists - Fix clamp decomposition to apply max with the lower bound, then min with the upper bound (y_i = min(max(x_i, min_i), max_i)), matching torch.clamp semantics even when min > max Change-Id: Iee52062599c1ef58421bc772a47b165646de435c Signed-off-by: Yufeng Shi <yufeng.shi@arm.com> Co-authored-by: Ryan O'Shea <ryan.oshea3@arm.com> Co-authored-by: Oscar Andersson <oscar.andersson@arm.com>
Collaborator
Author
|
Issues around lifted tensor constants have been fixed in this PR #16274 |
Collaborator
|
This got a merge conflict in process_node.py and need a rebase. |
efb206b to
a6182b2
Compare
zingo
approved these changes
Dec 16, 2025
Collaborator
|
Failed tests are unrelated |
xingguo01
pushed a commit
to xingguo01/executorch
that referenced
this pull request
Dec 18, 2025
Decompose aten.clamp.Tensor to a chain of minimum/maximum operations, since TOSA clamp only supports scalar min/max bounds. This change: - Rename DecomposeInt32ClampPass to DecomposeTOSAUnsupportedClampPass - Extend the pass to handle aten.clamp.Tensor variants already annotated by ArmQuantizer - Mark aten.clamp.Tensor as supported in the TOSA operator support lists - Fix clamp decomposition to apply max with the lower bound, then min with the upper bound (y_i = min(max(x_i, min_i), max_i)), matching torch.clamp semantics even when min > max - Align the memory layout of lifted tensor constants in process_inputs_to_lifted_tensor_constants with the TOSA memory format Signed-off-by: Yufeng Shi <yufeng.shi@arm.com> Co-authored-by: Ryan O'Shea <ryan.oshea3@arm.com> Co-authored-by: Oscar Andersson <oscar.andersson@arm.com>
jirioc
pushed a commit
to nxp-upstream/executorch
that referenced
this pull request
Dec 19, 2025
Decompose aten.clamp.Tensor to a chain of minimum/maximum operations, since TOSA clamp only supports scalar min/max bounds. This change: - Rename DecomposeInt32ClampPass to DecomposeTOSAUnsupportedClampPass - Extend the pass to handle aten.clamp.Tensor variants already annotated by ArmQuantizer - Mark aten.clamp.Tensor as supported in the TOSA operator support lists - Fix clamp decomposition to apply max with the lower bound, then min with the upper bound (y_i = min(max(x_i, min_i), max_i)), matching torch.clamp semantics even when min > max - Align the memory layout of lifted tensor constants in process_inputs_to_lifted_tensor_constants with the TOSA memory format Signed-off-by: Yufeng Shi <yufeng.shi@arm.com> Co-authored-by: Ryan O'Shea <ryan.oshea3@arm.com> Co-authored-by: Oscar Andersson <oscar.andersson@arm.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Decompose aten.clamp.Tensor to a chain of minimum/maximum operations, since TOSA clamp only supports scalar min/max bounds.
This change:
Change-Id: Iee52062599c1ef58421bc772a47b165646de435c
cc @freddan80 @per @zingo @oscarandersson8218 @digantdesai