Skip to content
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

[backport] thrust/mr: fix the case of reuising a block for a smaller alloc. (#1232) #1317

Merged

Conversation

griwes
Copy link
Collaborator

@griwes griwes commented 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

…DIA#1232)

* 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
@griwes griwes requested review from a team as code owners January 24, 2024 00:26
@griwes griwes changed the title thrust/mr: fix the case of reuising a block for a smaller alloc. (#1232) [backport] thrust/mr: fix the case of reuising a block for a smaller alloc. (#1232) Jan 24, 2024
@miscco
Copy link
Collaborator

miscco commented Feb 16, 2024

@griwes can we merge this?

@jrhemstad jrhemstad enabled auto-merge (squash) February 21, 2024 16:09
@jrhemstad jrhemstad merged commit 5487cac into NVIDIA:branch/2.3.x Feb 22, 2024
537 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants