Fix int32 overflow in embedding_dense_backward#165095
Closed
yinghai wants to merge 8 commits intopytorch:mainfrom
Closed
Fix int32 overflow in embedding_dense_backward#165095yinghai wants to merge 8 commits intopytorch:mainfrom
yinghai wants to merge 8 commits intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/165095
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit b7fb34d with merge base a2f29bc ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Collaborator
|
Test? |
ngimel
approved these changes
Oct 9, 2025
test/nn/test_embedding.py
Outdated
| ) | ||
|
|
||
| @onlyCUDA | ||
| @dtypes(torch.bfloat16,) |
Collaborator
There was a problem hiding this comment.
decorate is with @largeTensorTest to avoid ooms
eqy
requested changes
Oct 9, 2025
| const int gid = blockIdx.x * blockDim.x + threadIdx.x; | ||
| const int id = gid / stride_warped; | ||
| const int startFeature = gid % stride_warped; | ||
| const int64_t gid = blockIdx.x * blockDim.x + threadIdx.x; |
Collaborator
Collaborator
There was a problem hiding this comment.
ugh interesting that the test isn't catching it
eqy
approved these changes
Oct 10, 2025
Collaborator
|
@pytorchbot merge |
Collaborator
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Chao1Han
pushed a commit
to Chao1Han/pytorch
that referenced
this pull request
Oct 21, 2025
If `max_partial_segment` is large we can overflow `gid` and cause a bunch of IMA. Pull Request resolved: pytorch#165095 Approved by: https://github.com/ngimel, https://github.com/eqy
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.
If
max_partial_segmentis large we can overflowgidand cause a bunch of IMA.