-
Notifications
You must be signed in to change notification settings - Fork 902
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
Update bitmask_and
and bitmask_or
to return a pair of resulting mask and count of unset bits
#9616
Update bitmask_and
and bitmask_or
to return a pair of resulting mask and count of unset bits
#9616
Conversation
Codecov Report
@@ Coverage Diff @@
## branch-21.12 #9616 +/- ##
================================================
- Coverage 10.79% 10.68% -0.11%
================================================
Files 116 117 +1
Lines 18869 19867 +998
================================================
+ Hits 2036 2123 +87
- Misses 16833 17744 +911
Continue to review full report at Codecov.
|
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.
Looking good.
bitmask_and
to return both resulting mask and count of valid bitsbitmask_and
to return a struct of resulting mask, count of valid bits, and count of null bits
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.
Thanks for the good work. This is a nice cleanup!
Quick high level feedback — proper review to follow. I’m a little unsure about the new struct being named edit: My concern about the invariants of the type might have been invalid. I think I overlooked that the set and unset bits were both zero in a case where the code exited early because the total number of rows was also zero. 😛 This looked fine in the other places I saw. |
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.
Nice job @PointKernel. I have some suggestions and questions attached. I thought some more since my previous comment and I'm okay with naming the resulting struct bitmask
(I couldn't come up with a better name).
bitmask_and
to return a struct of resulting mask, count of valid bits, and count of null bitsbitmask_and
and bitmask_or
to return a struct of resulting mask, valid count, and null count
bitmask_and
and bitmask_or
to return a struct of resulting mask, valid count, and null countbitmask_and
and bitmask_or
to return a struct of resulting mask and null count
bitmask_and
and bitmask_or
to return a struct of resulting mask and null countbitmask_and
and bitmask_or
to return a pair of resulting mask and null count
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 like this much better without struct bitmask
. I also lament not being able to name the returns well, but I feel like a pair of two things is much easier to reason about here.
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.
Great work @PointKernel! I am really happy with how this turned out. I have a couple final comments, resolve them however you see fit. 🚀
mr); | ||
ret_validity_buffers.push_back(std::move(new_mask)); | ||
return std::make_pair( | ||
reinterpret_cast<bitmask_type const*>(ret_validity_buffers.back().data()), null_count); |
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.
Consider static_cast
here, which should be safer than reinterpret_cast
for the void*
returned by rmm::device_buffer
's data()
method.
reinterpret_cast<bitmask_type const*>(ret_validity_buffers.back().data()), null_count); | |
static_cast<bitmask_type const*>(ret_validity_buffers.back().data()), null_count); |
Side note: There are two other reinterpret_cast
s in this file that I think are safe to delete (their values already seem to be the right types) if we wish to eliminate the appearance of potentially unsafe reinterpret_cast
s in this file.
bitmask_and
and bitmask_or
to return a pair of resulting mask and null countbitmask_and
and bitmask_or
to return a pair of resulting mask and count of unset bits
@gpucibot merge |
This PR updates the function `cudf::detail::inplace_bitmask_and` to return the null count of the result. This change aligns `inplace_bitmask_and` with behavior changes introduced in #9616 to return null counts from functions acting on bitmasks. This will be helpful for #9621. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Nghia Truong (https://github.com/ttnghia) - Robert Maynard (https://github.com/robertmaynard) URL: #9904
Closes #9176
bitmask_and
andbitmask_or
to return both resulting mask and count of unset bitsbitmask_and/or