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

Fix copy assignment and the comparison operator of rmm_host_allocator #15677

Merged

Conversation

vuule
Copy link
Contributor

@vuule vuule commented May 6, 2024

Description

Copy assignment of rmm_host_allocator, used in hostdevice_vector, is missing the stream member assignment, leading to deallocation in the default stream in the assigned-to allocator.

This PR fixes this error by switching to the auto-generated special functions.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@vuule vuule added bug Something isn't working non-breaking Non-breaking change labels May 6, 2024
@vuule vuule self-assigned this May 6, 2024
@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label May 6, 2024
@vuule vuule marked this pull request as ready for review May 6, 2024 22:39
@vuule vuule requested a review from a team as a code owner May 6, 2024 22:39
@vuule vuule requested review from vyasr, PointKernel and shrshi May 6, 2024 22:39
Copy link
Contributor

@shrshi shrshi left a comment

Choose a reason for hiding this comment

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

🔥

*/
rmm_host_allocator& operator=(rmm_host_allocator const& other)
{
mr = other.mr;
Copy link
Member

Choose a reason for hiding this comment

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

I notice that the equality operator == also only checks mr but not stream. Seems it's intentional but not sure why. Worth double checking with @nvdbaranec

Could we set up a stream mode test for cpp/tests/utilities_tests/io_utilities_tests.cpp? In this way, we can avoid/uncover similar issues before delivery.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this should probably be checking the stream as well. If you had two of these objects using the same underlying allocator, but different streams you definitely could not consider them identical. Stream ordering violations could absolutely cause issues downstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added stream comparison to the operator==

@vuule vuule requested a review from PointKernel May 7, 2024 20:41
@vuule vuule changed the title Fix copy assignment of rmm_host_allocator Fix copy assignment and the comparison operator of rmm_host_allocator May 7, 2024
@vuule
Copy link
Contributor Author

vuule commented May 8, 2024

/merge

@rapids-bot rapids-bot bot merged commit 46ae8cb into rapidsai:branch-24.06 May 8, 2024
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants