-
Notifications
You must be signed in to change notification settings - Fork 157
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
thrust/mr: fix the case of reuising a block for a smaller alloc. #1232
Merged
Conversation
This file contains 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
Previously, the pool happily returned a pointer to a larger oversized block than requested, without storing the information that the block is now smaller, which meant that on deallocation, it'd look for the descriptor of the block in the wrong place. This is now fixed by moving the descriptor to always be where deallocation can find it using the user-provided size, and by storing the original size to restore the descriptor to its rightful place when deallocating. Also a drive-by fix for a bug where in certain cases the reallocated cached oversized block wasn't removed from the cached list. Whoops. Kinda surprised this hasn't exploded before.
jrhemstad
added
the
backport branch/2.3.x
For backporting to the 2.3.x release branch
label
Jan 10, 2024
miscco
approved these changes
Jan 18, 2024
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.
Looks good to me.
Some suggestions regarding improved readability
GitHub Actions is not permitted to create or approve pull requests. |
griwes
added a commit
that referenced
this pull request
Jan 24, 2024
* thrust/mr: fix the case of reuising a block for a smaller alloc. Previously, the pool happily returned a pointer to a larger oversized block than requested, without storing the information that the block is now smaller, which meant that on deallocation, it'd look for the descriptor of the block in the wrong place. This is now fixed by moving the descriptor to always be where deallocation can find it using the user-provided size, and by storing the original size to restore the descriptor to its rightful place when deallocating. Also a drive-by fix for a bug where in certain cases the reallocated cached oversized block wasn't removed from the cached list. Whoops. Kinda surprised this hasn't exploded before. * thrust/mr: add aliases to reused pointer traits in pool.h
jrhemstad
added a commit
that referenced
this pull request
Feb 22, 2024
…) (#1317) * thrust/mr: fix the case of reuising a block for a smaller alloc. Previously, the pool happily returned a pointer to a larger oversized block than requested, without storing the information that the block is now smaller, which meant that on deallocation, it'd look for the descriptor of the block in the wrong place. This is now fixed by moving the descriptor to always be where deallocation can find it using the user-provided size, and by storing the original size to restore the descriptor to its rightful place when deallocating. Also a drive-by fix for a bug where in certain cases the reallocated cached oversized block wasn't removed from the cached list. Whoops. Kinda surprised this hasn't exploded before. * thrust/mr: add aliases to reused pointer traits in pool.h Co-authored-by: Jake Hemstad <jhemstad@nvidia.com>
miscco
added
backport done
This PR has been backported to the relevant branch
thrust
For all items related to Thrust.
bug: functional
and removed
backport branch/2.3.x
For backporting to the 2.3.x release branch
labels
Feb 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport done
This PR has been backported to the relevant branch
bug: functional
thrust
For all items related to Thrust.
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.
Description
Previously, the pool happily returned a pointer to a larger oversized block than requested, without storing the information that the block is now smaller, which meant that on deallocation, it'd look for the descriptor of the block in the wrong place. This is now fixed by moving the descriptor to always be where deallocation can find it using the user-provided size, and by storing the original size to restore the descriptor to its rightful place when deallocating.
Also a drive-by fix for a bug where in certain cases the reallocated cached oversized block wasn't removed from the cached list. Whoops. Kinda surprised this hasn't exploded before.
Resolves #585
Checklist