Repository navigation
[XNNPACK] Compose stacked activations in FuseActivationPass instead of overwriting - #24484
Merged
JakeStevens merged 2 commits intoNov 9, 2026
Merged
Conversation
When two clamping activations follow the same op, for example Linear -> ReLU6 -> ReLU, the second fusion overwrote the OutputMinMax tag of the first one, so the delegate applied the wrong clamp range and silently changed the output. The pass now composes the existing range with the new one, keeping the "+inf"/"-inf" string convention used by serialization.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24484
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit 76b9feb with merge base ebdb936 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
Author
|
@pytorchbot label "release notes: xnnpack" |
JakeStevens
approved these changes
Nov 9, 2026
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.
FuseActivationPassstores the fused clamp range innode.meta. When two clamping activations follow the same op (for exampleLinear -> ReLU6 -> ReLU), the second fusion overwrote the first tag, so the delegate applied[0, inf)instead of[0, 6](and[-1, 1]instead of[0, 1]forReLU -> Hardtanh(-1, 1)), silently changing outputs.The pass now composes the existing range with the new one (clamp of clamp), keeping the
"+inf"/"-inf"string convention used by serialization. Behavior without a previously fused activation is unchanged.Test plan: new
test_activation_fusion_stacked_activations(6 cases: 5 fail before this change, all pass after).pytest backends/xnnpack/test/passes: 70 passed with this change, and no other test changes outcome. End to end through the XNNPACK runtime, the maximum absolute difference to eager forLinearfollowed byReLU6, ReLU/Hardtanh(-1, 1), ReLU/ReLU, Hardtanh(-1, 1)/Hardtanh(-2, 2), Hardtanh(-1, 3)is 3.12 / 8.49 / 1.00 / 1.00 before and 0 after (run with the v1.5.1 pybindings, where the pass and its test file are identical to main).I used Claude Code to help with this change.
cc @GregoryComer @digantdesai @cbilgin @JakeStevens @nil-is-all