Fix LUT fusion treating an already-fused LUT node as a plain unary op#10756
Open
sachinhambar wants to merge 1 commit into
Open
Fix LUT fusion treating an already-fused LUT node as a plain unary op#10756sachinhambar wants to merge 1 commit into
sachinhambar wants to merge 1 commit into
Conversation
`xnn_define_unary_elementwise_lut_in_place` converts a chain of unary ops in place into a node with 2 inputs (tensor + LUT table) and `unary_operator == xnn_unary_invalid`. `is_pure_unary_elementwise` did not check for this, so if the fusion pass encounters that node again it misreads `inputs[0]` as an ordinary single-input operand and tries to fuse the LUT node into a further LUT.
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.
is_pure_unary_elementwisetreated anyxnn_node_type_unary_elementwisenode as a plain single-input op, reading
inputs[0]unconditionally.But a node already fused into a LUT (via
xnn_define_unary_elementwise_lut_in_place) hasnum_inputs == 2(tensor + LUT table) and
unary_operator == xnn_unary_invalid. If thefusion pass reaches that node again — the outer loop in
xnn_subgraph_fuse_unary_quantized_into_lutcan revisit the same slotwithin a single pass, and
xnn_subgraph_optimizecan also be calledmore than once on the same subgraph — it would misinterpret the LUT
node as an ordinary unary op and try to fuse it again.