[Fix][Relax] Validate non-concat axes before fusing parallel matmul biases - #20243
Open
OmarAzizi wants to merge 2 commits into
Open
[Fix][Relax] Validate non-concat axes before fusing parallel matmul biases#20243OmarAzizi wants to merge 2 commits into
OmarAzizi wants to merge 2 commits into
Conversation
tlopex
requested changes
Sep 2, 2026
| if (bias_shape_unknown) { | ||
| return ffi::Map<Var, Expr>{}; | ||
| } | ||
| if (!shapes_compatible_excluding_trailing_axes(bias_shapes, 1)) { |
Member
There was a problem hiding this comment.
Please also require each bias’s last dimension to match the corresponding splits[i].split_size. For weights [3,4]/[3,5] and biases [2,1]/[2,1], both original adds are valid via broadcasting, but this check passes and produces a [2,2] concatenated bias that cannot broadcast to the combined [2,9] output. This case should skip fusion, with a regression test added.
Contributor
Author
There was a problem hiding this comment.
Done, I added the check and a new regression test in a c67ceca.
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.
CombineParallelMatmul fused parallel matmul biases by checking rank alone, not whether their non-concat axes actually matched, so incompatible shapes like [1, 4] and [2, 5] slipped through and crashed in concat.
Added a check that validates the non-concat axes and skips fusing the bias when they don't match.
Fixes #20205.