Repository navigation
[Fix][Relax] Skip vector weights in ReorderTakeAfterMatmul - #20815
Merged
Merged
Conversation
hiyufan
marked this pull request as ready for review
October 25, 2026 11:27
hiyufan
force-pushed
the
fix/reorder-take-vector-20595
branch
from
November 15, 2026 02:51
8c25b3a to
2426fe9
Compare
Contributor
Author
|
@tlopex, would you have time to review this scoped correctness fix? You reviewed the related take-mode fix in #20206. Rank-one weights select along the reduction axis, so the column-selection rewrite must leave them unchanged; a positive control retains the valid vector-activation/matrix-weight rewrite. I've rebased onto current main and rerun the three related test files (26 passed), plus 20 CPU VM cases against NumPy. Fresh CI results are pending. Thank you. |
A vector weight has only a reduction axis. Moving its take after matmul either takes from a scalar or changes the result of a matrix-vector product. Require rank-two or higher weights for the column-selection rewrite, and cover both failures and the supported vector-activation case.
hiyufan
force-pushed
the
fix/reorder-take-vector-20595
branch
from
November 15, 2026 03:38
2426fe9 to
7f43aec
Compare
tlopex
approved these changes
Nov 15, 2026
Member
|
LGTM. Thanks for the fixing |
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.
With rank-one weights,
take(..., axis=0)selects elements on the MatMul reduction axis. Moving it after MatMul raises on vector activations and changes results on matrix activations, even when the output shape stays the same.Require weight rank >= 2 in the simple column-selection rewrite. Leave vector weights unchanged. Add two regressions and a positive control showing that vector activations with matrix weights still rewrite.
Fixes #20595.
Validation against main
30fd3017fd, Python 3.11, LLVM 21.1.8 and source-built pinned TIRx/FFI dependencies:test_transform_reorder_take_after_matmul.py,test_transform_expand_matmul_of_sum.py, andtest_op_linear_algebra.py: 26 passed.Prepared with OpenAI Codex assistance. The build and validation above were executed locally.
Includes the shared packaging fix in #20980: the pinned TIRx source now carries the final
0.1.0tag, which the old CMake/Python bounds rejected on macOS and Windows. The pass/operator implementation is unchanged by this CI follow-up. Fresh CI results are pending.