Cortex-M: keep the activation on a max pool that will not lower - #22232
Open
rascani wants to merge 1 commit into
Open
Cortex-M: keep the activation on a max pool that will not lower#22232rascani wants to merge 1 commit into
rascani wants to merge 1 commit into
Conversation
ActivationFusionPass folds a following relu, hardtanh or clamp into its producer by narrowing that producer's quantized output range and erasing the activation node. CortexMMaxPool2DCheck annotates a pool it cannot lower before tagging it, so such a pool still carries qparams and reads as a fusion target. It then falls back to the portable kernel, which reads no range, and the activation is gone: relu(max_pool2d(dilation=2)) over randn(1, 4, 8, 8) * 20 came out unclamped, 19.8 away from the reference at its worst element. Nothing caught it because the op counts look right either way -- the activation is supposed to disappear -- and no test paired a pool with one. Authored with Claude Code.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22232
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
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.
ActivationFusionPass folds a following relu, hardtanh or clamp into its producer by narrowing that producer's quantized output range and erasing the activation node. CortexMMaxPool2DCheck annotates a pool it cannot lower before tagging it, so such a pool still carries qparams and reads as a fusion target. It then falls back to the portable kernel, which reads no range, and the activation is gone: relu(max_pool2d(dilation=2)) over randn(1, 4, 8, 8) * 20 came out unclamped, 19.8 away from the reference at its worst element.
Nothing caught it because the op counts look right either way -- the activation is supposed to disappear -- and no test paired a pool with one.
Authored with Claude Code.