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.
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
[REVIEW] Add per-thread-default stream support to pool_memory_resource using thread-local CUDA events #425
[REVIEW] Add per-thread-default stream support to pool_memory_resource using thread-local CUDA events #425
Changes from 4 commits
e2be0ba
5514703
93bebd7
2a18521
78467d5
4110fa0
29d65f9
e53a59e
3d178ff
889bf55
0d314b9
b1620d9
07af3c8
714e924
c14d1af
2ffbcaa
ccea946
af3b9c7
1d039ff
22c77cb
a6390a4
6fd4544
1d24547
0d7cb97
fc133ae
4af5652
6e9bac0
26c2909
01385bc
3df09f9
13486e7
0a57993
94cae03
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 feels like there is a potential optimization here. We're merging two sorted
std::list
s and coalescing adjacent blocks. If we ignored the fact that we're coalescing blocks, you could just usestd::list::merge
.The current implementation is
O(m*n)
as it requires doing a linear search of the destination list for every element in the source list. It seems like we should be able to make that beO(m + n)
.At the very least, I think we should add a
free_list::merge(free_list&& other)
function and use that here. Then we can explore doing something more optimal that exploits the fact that both lists are already sorted by pointer.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.
One option would be to just use
std::list::merge
and ignore coalescing, and then do a second pass through the merged list and coalesce any adjacent blocks. But that operation likely can be fused with a custom merge algorithm.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.
I think we need to do something other than check against
0
for the default stream. Someone could passcudaStreamPerThread
explicitly, which is different from0
.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.
Yeah, thought about that. Need to check for either 0 or cudaStreamPerThread, good point.
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.
Fixed.