Conversation
kali
added a commit
that referenced
this pull request
Apr 28, 2026
The change_axes impl on MultiBroadcastTo introduced in 106f605 ("more decluttering around broadcast and axes op") accepted any AxisOp whose change_shape succeeds on self.shape, and (worse) used recip() for the io=Input case so an Rm at the input grew self.shape instead of shrinking it. This let an Rm propagate through a broadcast into a Source with a non-trivial dim. Reproducer: \`tract trunet_dummy.nnef.tgz --nnef-tract-core --pulse 1 -O bench\`. ChangeAxes proposes Rm(1) on a Const initial-state, the change traverses a MultiBroadcastTo into a Scan input, the Scan recurses into its body, and a Source whose dim 1 is the streaming symbol S bails with "Removing non-trivial axis #1 of dim: 1,S,32". Scan's try_body_axes_change passes that bail through with `?`, so the whole declutter pass aborts, and the bundle CI entrypoint that runs trunet net_bench dies under set -e. Fix: only accept axis changes on MultiBroadcastTo when the touched axes are passthrough — i.e. input and output shapes agree there. Touching a true broadcast axis (input=1, output=N) cannot be safely propagated in either direction. The recip() switch is dropped: for MultiBroadcastTo the input-side and output-side shapes track each other directly. Also reject Move on rank-mismatched inputs. trunet net_bench now passes; tract-core lib (231) and test-unit-core (777) stay green.
kali
added a commit
that referenced
this pull request
Apr 29, 2026
The change_axes impl on MultiBroadcastTo introduced in 106f605 ("more decluttering around broadcast and axes op") accepted any AxisOp whose change_shape succeeds on self.shape, and (worse) used recip() for the io=Input case so an Rm at the input grew self.shape instead of shrinking it. This let an Rm propagate through a broadcast into a Source with a non-trivial dim. Reproducer: \`tract trunet_dummy.nnef.tgz --nnef-tract-core --pulse 1 -O bench\`. ChangeAxes proposes Rm(1) on a Const initial-state, the change traverses a MultiBroadcastTo into a Scan input, the Scan recurses into its body, and a Source whose dim 1 is the streaming symbol S bails with "Removing non-trivial axis #1 of dim: 1,S,32". Scan's try_body_axes_change passes that bail through with `?`, so the whole declutter pass aborts, and the bundle CI entrypoint that runs trunet net_bench dies under set -e. Fix: only accept axis changes on MultiBroadcastTo when the touched axes are passthrough — i.e. input and output shapes agree there. Touching a true broadcast axis (input=1, output=N) cannot be safely propagated in either direction. The recip() switch is dropped: for MultiBroadcastTo the input-side and output-side shapes track each other directly. Also reject Move on rank-mismatched inputs. trunet net_bench now passes; tract-core lib (231) and test-unit-core (777) stay green.
4 tasks
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.
No description provided.