Replace cudf::detail::valid_if with cudf::bools_to_mask#4301
Replace cudf::detail::valid_if with cudf::bools_to_mask#4301mythrocks wants to merge 7 commits intoNVIDIA:release/26.04from
cudf::detail::valid_if with cudf::bools_to_mask#4301Conversation
This commit is part of the continuihng effort to reduce the dependency of spark-rapids-jni on `cudf::detail` APIs. In this commit, some of the references to `cudf::detail::valid_if` with `cudf::bools_to_mask`. The functionality should not be altered. Existing tests ought to cover the changes. Signed-off-by: MithunR <mithunr@nvidia.com>
Greptile SummaryThis PR replaces
Confidence Score: 5/5Safe to merge; only remaining finding is a P2 stream-policy nit in benchmark code. The bools_to_mask migration is semantically correct at all call sites and return-type changes are handled properly. The V2 bloom filter feature matches the Spark reference and is well-tested. The single open finding is a stream inconsistency in non-production benchmark code. src/main/cpp/benchmarks/common/generate_input.cu — stream policy inconsistency in create_random_null_mask. Important Files Changed
Reviews (6): Last reviewed commit: "Merge remote-tracking branch 'origin/rel..." | Re-trigger Greptile |
|
Build |
This change is more controversial. The only way to get away from using `cudf::detail::valid_if` in the files modified here is to materialize a temporary bool vector (that is then packed). Signed-off-by: MithunR <mithunr@nvidia.com>
|
Build |
|
c3f2550 is slightly controversial; the only way to stop using There might be value in requesting for a |
cudf::detail::valid_if with cudf::bools_to_maskcudf::detail::valid_if with cudf::bools_to_mask
Signed-off-by: MithunR <mithunr@nvidia.com>
|
Build |
|
Build |
ttnghia
left a comment
There was a problem hiding this comment.
Please hold off a little bit. We need to discuss on mitigating the issue with code duplicates and unavoidable dependency from cudf detail namespace. We should also avoid performance impact by doing this.
|
NOTE: release/26.04 has been created from main. Please retarget your PR to release/26.04 if it should be included in the release. |
The base branch was changed.
|
Build |
| auto [null_mask, null_count] = cudf::detail::valid_if( | ||
| valid_it, valid_it + should_be_nullified->size(), thrust::logical_not<bool>{}, stream, mr); | ||
| return {null_count > 0 ? std::move(null_mask) : rmm::device_buffer{0, stream, mr}, null_count}; | ||
| rmm::device_uvector<bool> valids(should_be_nullified->size(), stream); |
There was a problem hiding this comment.
Can we directly write to something bit-packed instead, to avoid the extra work from calling bools_to_mask?
There was a problem hiding this comment.
This is exactly what the valid_if kernel is doing. You are suggesting to reimplementing the valid_if kernel 😄
| auto [null_mask, null_count] = cudf::detail::valid_if( | ||
| valid_it, valid_it + should_be_nullified->size(), thrust::logical_not<bool>{}, stream, mr); | ||
| return {null_count > 0 ? std::move(null_mask) : rmm::device_buffer{0, stream, mr}, null_count}; | ||
| rmm::device_uvector<bool> valids(should_be_nullified->size(), stream); |
There was a problem hiding this comment.
In case we are no longer be able to use cudf::detail::valid_if, now I am OK to make a copy of valid_if inside spark-rapids-jni so we can just call it, similar to what we have done with make_counting_transform_iterator.
There was a problem hiding this comment.
If cudf continue to bar downstream libraries/applications from using its detail utilities, this will be the trend that we are unavoidable to follow, unfortunately. There are many more things that would be copied very soon.
There was a problem hiding this comment.
OK to make a copy of
valid_ifinsidespark-rapids-jni...
If it's going to come to that, then I might punt this change out of 26.04.
I'm neither keen nor proud of having to replicate CUDF kernels here. But our hand might be forced. CUDF has made it quite clear that cudf::detail::valid_if() is not a candidate for exposure/consumption from the public API.
Making a custom copy might be best for efficiency, albeit at the cost of maintenance.
This commit is part of the continuing effort to reduce the dependency of spark-rapids-jni on
cudf::detailAPIs. In this commit, some of the references tocudf::detail::valid_ifwithcudf::bools_to_mask.The functionality should not be altered. Existing tests ought to cover the changes.