Repository navigation
[PSTL] Use env based overload for DeviceFindIf - #9318
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
suggestion: WalkthroughConvert stream-based CUB dispatches to env-based APIs (const-ref), add dispatch overloads that accept caller-provided temporary storage, route DeviceFind through env dispatch helpers, update PSTL find_if to use choose_offset_t and detail::find::dispatch with policy, and extend tests to exercise sizing and user-provided temp storage across env variants. Changesenv dispatch & DeviceFind migration
Possibly related issues
Suggested reviewers
Comment |
This comment has been minimized.
This comment has been minimized.
26183bc to
d1e6753
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 165d6480-fc76-449e-ba17-fb2ac0a8b8da
📒 Files selected for processing (4)
cub/cub/detail/env_dispatch.cuhcub/cub/device/device_find.cuhcub/test/catch2_test_device_find_env.culibcudacxx/include/cuda/std/__pstl/cuda/find_if.h
🚧 Files skipped from review as they are similar to previous changes (1)
- libcudacxx/include/cuda/std/__pstl/cuda/find_if.h
d1e6753 to
e512d5e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 44be2432-1b4d-4cf9-9773-e9e5d50a9605
📒 Files selected for processing (4)
cub/cub/detail/env_dispatch.cuhcub/cub/device/device_find.cuhcub/test/catch2_test_device_find_env.culibcudacxx/include/cuda/std/__pstl/cuda/find_if.h
🚧 Files skipped from review as they are similar to previous changes (3)
- cub/test/catch2_test_device_find_env.cu
- cub/cub/detail/env_dispatch.cuh
- cub/cub/device/device_find.cuh
88539e2 to
4b10484
Compare
This comment has been minimized.
This comment has been minimized.
gonidelis
left a comment
There was a problem hiding this comment.
why are we substituting the stream overloads with env overloads? don't we already have existing env overloads at home?
| template <typename InputIteratorT, | ||
| typename OutputIteratorT, | ||
| typename ScanOpT, | ||
| typename NumItemsT, | ||
| typename EnvT = ::cuda::std::execution::env<>> | ||
| CUB_RUNTIME_FUNCTION static cudaError_t FindIf( | ||
| void* d_temp_storage, | ||
| size_t& temp_storage_bytes, | ||
| InputIteratorT d_in, | ||
| OutputIteratorT d_out, | ||
| ScanOpT scan_op, | ||
| NumItemsT num_items, | ||
| cudaStream_t stream = nullptr) | ||
| const EnvT& env = {}) |
There was a problem hiding this comment.
Remark: Changing to an environment here would require several new tests to be added, not only about whether various stream types can be passed here, but also whether a tuning passed here would be applied. If we proceed with more such changes across the entire CUB device layer, we would need to write a TON of redundant tests.
I think we should try to move as much logic as possible into the dispatch function, so the device layer becomes so thin that we can reasonably only cover one of the overloads (e.g. the one without temp storage args) with all tests.
There was a problem hiding this comment.
The way the refactoring is structured is to just forward to the dispatch layer.
The forward is exactly the same as with the current env overloads, so I am not sure whether we would need any more testing.
My suggestion is be to split the effort in two. There is no reason why we need to block refactoring the top level APIs on the dispatch refactoring, given we only dispatch to the same function anyway.
There was a problem hiding this comment.
I will keep your reply in mind and send any resulting bugs your way ;)
1acde58 to
cf33786
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c3cca406-9b61-49da-be5e-44cbfe674161
📒 Files selected for processing (4)
cub/cub/detail/env_dispatch.cuhcub/cub/device/device_find.cuhcub/test/catch2_test_device_find_env.culibcudacxx/include/cuda/std/__pstl/cuda/find_if.h
🚧 Files skipped from review as they are similar to previous changes (3)
- cub/test/catch2_test_device_find_env.cu
- cub/cub/detail/env_dispatch.cuh
- cub/cub/device/device_find.cuh
This comment has been minimized.
This comment has been minimized.
We have only those that take care of all the memory management. But we also need the env for those where the user provides memory |
This comment has been minimized.
This comment has been minimized.
| temp_storage_bytes = 1; | ||
| return cudaSuccess; | ||
| } | ||
| return detail::dispatch_with_env( |
There was a problem hiding this comment.
again thinking for future developers that will jump on CUB ship, our high level bodies start to look really ugly, no complain for now. just laying this one out in the field
We want to use env based API to ensure that we take advantage of user provided tunings
7ee7e13 to
0a5dcbd
Compare
🥳 CI Workflow Results🟩 Finished in 1h 24m: Pass: 100%/343 | Total: 2d 16h | Max: 1h 08m | Hits: 99%/476366See results here. |
We want to use env based API to ensure that we take advantage of user provided tunings