-
Notifications
You must be signed in to change notification settings - Fork 112
Matmul 2d input config selection bugfix #667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
AshAnand34
wants to merge
7
commits into
tracel-ai:main
Choose a base branch
from
AshAnand34:matmul-2d-input-config-selection-bugfix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Matmul 2d input config selection bugfix #667
AshAnand34
wants to merge
7
commits into
tracel-ai:main
from
AshAnand34:matmul-2d-input-config-selection-bugfix
Conversation
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
…hub.com/AshAnand34/cubecl into matmul-2d-input-config-selection-bugfix
2 tasks
louisfd
requested changes
May 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that we would need to optimize for degenerate vector cases 😄 However there are a few things to fix, hope my comments can guide you
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.
This pull request introduces enhancements to the matrix multiplication (
matmul
) logic to handle 2D inputs more robustly, including updates to stage size validation, error handling, and new test cases. The key changes focus on ensuring correctness for edge cases like 1xN and Mx1 matrices.Enhancements to 2D input handling:
Stage size adjustments for 2D inputs: Modified the
matmul_selection
logic to ensure stage sizes divide evenly when handling 1xN or Mx1 matrices. This includes iterative adjustments tostage_size_m
andstage_size_n
to meet divisibility constraints. (crates/cubecl-linalg/src/convolution/selection.rs
, crates/cubecl-linalg/src/convolution/selection.rsL148-R185)Validation for 2D stage sizes: Added checks in the
MatmulConfigFactory
implementation to validate that stage sizes for 2D inputs (1xN or Mx1) divide the corresponding dimensions evenly. Errors are returned if the constraints are not met. (crates/cubecl-linalg/src/matmul/components/tile/accelerated.rs
, crates/cubecl-linalg/src/matmul/components/tile/accelerated.rsR129-R151)Testing improvements:
test_2d_input_matmul
, to validate matrix multiplication for 1xN and Mx1 input scenarios. This ensures that the new logic handles these edge cases correctly. (crates/cubecl-linalg/tests/matmul_2d.rs
, crates/cubecl-linalg/tests/matmul_2d.rsR1-R64)Validate your PR with burn.
It is important that you make sure that you don't introduce any bugs in burn.
Instructions