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

[REVIEW] Fix race condition in device_scalar::set_value #569

Merged
merged 7 commits into from
Sep 23, 2020

Conversation

jrhemstad
Copy link
Contributor

@jrhemstad jrhemstad commented Sep 21, 2020

device_scalar::set_value performs a host to device copy to set the value of the contained object. This copy is performed asynchronously and does not perform any synchronization.

Previously, the host_value was being passed by value. This is problematic when combined with the fact that the copy was asynchronous. This could mean that the copy would not complete before the function local copy of host_value was destroyed.

I remedied this by making it pass by reference and clarifying the documentation about the asynchronous behavior.

@jrhemstad jrhemstad requested a review from a team as a code owner September 21, 2020 19:23
@jrhemstad jrhemstad added the 3 - Ready for review Ready for review by team label Sep 21, 2020
@GPUtester
Copy link
Contributor

Please update the changelog in order to start CI tests.

View the gpuCI docs here.

Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add _async to the name of set_value() in this PR?

include/rmm/device_scalar.hpp Outdated Show resolved Hide resolved
include/rmm/device_scalar.hpp Outdated Show resolved Hide resolved
include/rmm/device_scalar.hpp Outdated Show resolved Hide resolved
include/rmm/device_scalar.hpp Outdated Show resolved Hide resolved
@jrhemstad
Copy link
Contributor Author

Should we add _async to the name of set_value() in this PR?

That would break code in cuDF and elsewhere and I didn't want to deal with that in this PR. See #570

@jrhemstad
Copy link
Contributor Author

rerun tests

@jrhemstad
Copy link
Contributor Author

@cwharris need approval

Copy link
Contributor

@cwharris cwharris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@harrism harrism merged commit cce9081 into rapidsai:branch-0.16 Sep 23, 2020
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants