Repository navigation
cub, c.parallel: {lower,upper}_bound - #7007
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| const unsigned int thread_count = 256; | ||
| const size_t items_per_block = 512; |
There was a problem hiding this comment.
Are these essentially hardcoded somewhere in the CUB as well?
There was a problem hiding this comment.
Yes. There's no tunings for for, and this just follows that.
I'm planning to start working on a warp level binary search algorithm in the new year, and then build a device wide one on top of that, as a replacement of the current approach - we'll do actual tunings then.
shwina
left a comment
There was a problem hiding this comment.
The C side looks good to me. Thanks!
This comment has been minimized.
This comment has been minimized.
| { | ||
| pushed = try_push_context(); | ||
| auto exec_status = | ||
| Invoke(d_data, num_items, d_values, num_values, d_out, op, build.cc, (CUfunction) build.kernel, stream); |
There was a problem hiding this comment.
Suggestion: can we use static_cast here? If not, maybe reinterpret_cast.
There was a problem hiding this comment.
This mirrors what for does, I can go clean it up a little in both places later but I'd rather not multiply the drive by fixes here.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🥳 CI Workflow Results🟩 Finished in 6h 50m: Pass: 100%/133 | Total: 6d 05h | Max: 5h 37m | Hits: 71%/177855See results here. |
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
…r}_bound (NVIDIA/cccl#7007) Upstream: NVIDIA/cccl@d12fbd9 - cuda find.h: include renamed to <cub/device/device_find.cuh> (verbatim upstream) - generic binary_search.inl: removed the unused `namespace p = thrust::placeholders;` aliases - HIP counterpart: none needed (rocPRIM-based hip find/binary_search have no CUB header include or placeholder alias) - test/ counterpart: none needed (no test changes upstream) - Not compiled, tests not run (autonomous no-build mode) Co-Authored-By: Claude <[email protected]>
Description
This PR adds {lower,upper}_bound device algorithms to both CUB and c.parallel.
In the case of CUB, the implementation is very straightforward and directly follows current implementation in Thrust (which I have cleaned up as a drive by change).
In the case of c.parallel, because of how CUB's
for_eachpasses in kernel arguments, repeating the slight madness of the currentforoperator construction for the for_each algorithm itself felt beyond annoying, but I needed a kernel pointer; so instead of reusing the kernels available in CUB, I adapted the static-block-sizefor_eachkernel to accept all the necessary arguments as separate kernel arguments, then construct the for operator expected by CUB inside the kernel, and finally invoke the CUBfor_eachagent with that operator. So, it's a manually constructed kernel, but it reuses both the agent code and binary search helper types from CUB.Resolves #6695
Checklist