Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for torch.nn.functional.scaled_mm operation in Thunder. This operation performs scaled matrix multiplication, which is commonly used for FP8 quantized operations.
- Adds a new
scaled_mmfunction tothunder/torch/__init__.pywith input validation and shape inference logic - Registers the implementation in
thunder/executors/torchex.pyto delegate to PyTorch - Adds comprehensive test coverage with tensor-wise, row-wise, and block-wise scaling tests
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| thunder/torch/init.py | Implements the scaled_mm symbol with parameter validation and output shape/dtype inference |
| thunder/executors/torchex.py | Registers the torch executor implementation for scaled_mm |
| thunder/tests/test_ops.py | Adds test helper functions and comprehensive tests for scaled_mm with different scaling strategies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mattteochen
reviewed
Nov 6, 2025
kshitij12345
reviewed
Nov 6, 2025
crcrpar
commented
Nov 7, 2025
e13728e to
9aae77b
Compare
Collaborator
kshitij12345
left a comment
There was a problem hiding this comment.
Overall looks good, just a few comments regarding the tests. Thanks!
kshitij12345
approved these changes
Nov 17, 2025
Collaborator
kshitij12345
left a comment
There was a problem hiding this comment.
LGTM, thanks @crcrpar
Collaborator
Author
|
@KaelanDt could you review this? |
…wise scaling Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
Signed-off-by: Masaki Kozuki <mkozuki@nvidia.com>
1af92d0 to
d433277
Compare
KaelanDt
approved these changes
Dec 8, 2025
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.
What does this PR do?
As per title, this PR adds
F.scaled_mmtothunder.torchand cover it with torchex impl.Ref: https://docs.pytorch.org/docs/main/generated/torch.nn.functional.scaled_mm.html