-
Notifications
You must be signed in to change notification settings - Fork 200
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
Avoid potential race conditions in device_scalar/device_uvector setters #725
Merged
rapids-bot
merged 6 commits into
rapidsai:branch-0.19
from
harrism:fix-async-set-value-literal
Mar 18, 2021
Merged
Avoid potential race conditions in device_scalar/device_uvector setters #725
rapids-bot
merged 6 commits into
rapidsai:branch-0.19
from
harrism:fix-async-set-value-literal
Mar 18, 2021
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
harrism
added
3 - Ready for review
Ready for review by team
breaking
Breaking change
improvement
Improvement / enhancement to an existing function
labels
Mar 10, 2021
This was referenced Mar 10, 2021
rongou
approved these changes
Mar 11, 2021
codereport
suggested changes
Mar 15, 2021
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, one minor change
I also expanded the |
codereport
approved these changes
Mar 17, 2021
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.
lgtm 👍
rapids-bot bot
pushed a commit
to rapidsai/cugraph
that referenced
this pull request
Mar 17, 2021
After rapidsai/rmm#725 is merged, this PR updates cuspatial to eliminate passing literal values to device_uvector::set_element_async. Companion PR to rapidsai/cuspatial#367 Authors: - Mark Harris (@harrism) Approvers: - Seunghwa Kang (@seunghwak) - Alex Fender (@afender) - Andrei Schaffer (@aschaffer) URL: #1453
rapids-bot bot
pushed a commit
to rapidsai/cuspatial
that referenced
this pull request
Mar 18, 2021
After rapidsai/rmm#725 is merged, this PR updates cuspatial to eliminate passing literal values to `device_uvector::set_element_async`. Authors: - Mark Harris (@harrism) Approvers: - Paul Taylor (@trxcllnt) - Christopher Harris (@cwharris) URL: #367
@gpucibot merge |
rapids-bot bot
pushed a commit
to rapidsai/cudf
that referenced
this pull request
Mar 19, 2021
…_scalar::set_value (#7563) After rapidsai/rmm#725 is merged, this PR updates cuspatial to eliminate passing literal values to `device_scalar::set_value`. Note there are still similar issues with uses of `cudf::scalar` that need to be addressed. But I wanted to get this open before the end of the week. This can be merged after RMM 725 is merged to fix the build, so I think the `scalar` issues should be fixed separately. Authors: - Mark Harris (@harrism) Approvers: - Devavret Makkar (@devavret) - Paul Taylor (@trxcllnt) - Mike Wilson (@hyperbolic2346) URL: #7563
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3 - Ready for review
Ready for review by team
breaking
Breaking change
cpp
Pertains to C++ code
improvement
Improvement / enhancement to an existing function
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.
There is a subtle problem with
rmm::device_uvector::set_element_async
andrmm::device_scalar::set_value
. It's common to pass a literal (e.g. 0) to these functions. But these functions accept the parameter by reference, so if you pass a literal, it's possible for the temporary created to store the literal to be destroyed before thecudaMemcpyAsync
is performed, resulting in a use after free. This PR:&&
) overload. This is a breaking API change.device_scalar
, adds an optimization forbool
types to always usecudaMemsetAsync
.device_scalar
, add a new methodset_value_zero
for the common case of initialization to zero. Also usescudaMemsetAsync
.These changes will require PRs to fix up some uses in cudf, cuspatial, and cugraph.