Repository navigation
Refactor CUB DeviceFind::{Lower,Upper}BoundSortedValues two-phase… - #11234
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:
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
cub/test/catch2_test_device_find_bound_sorted_values_env.cu (2)
156-156: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Verify the selected stream for each non-default stream environment.
cudaDeviceSynchronize()waits for work on all streams. A dispatch that ignoresenvand uses the default stream still passes these checks. Use the capture-based assertion incub/test/catch2_test_env_launch_helper.h, or an equivalent stream-specific check.
cub/test/catch2_test_device_find_bound_sorted_values_env.cu#L156-L156: add a stream-specific assertion forLowerBoundSortedValues.cub/test/catch2_test_device_find_bound_sorted_values_env.cu#L287-L287: add a stream-specific assertion forUpperBoundSortedValues.Sources: Coding guidelines, Path instructions
108-111: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Declare read-only test values
const. The inputs, expected outputs, and test lambdas are not reassigned. Keepd_outputand temporary storage mutable.
cub/test/catch2_test_device_find_bound_sorted_values_env.cu#L108-L111: declared_range,d_values, andexpectedconst.cub/test/catch2_test_device_find_bound_sorted_values_env.cu#L127-L127: declaretest_lower_bound_sorted_valuesconst.cub/test/catch2_test_device_find_bound_sorted_values_env.cu#L239-L242: declared_range,d_values, andexpectedconst.cub/test/catch2_test_device_find_bound_sorted_values_env.cu#L258-L258: declaretest_upper_bound_sorted_valuesconst.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: f5fe3c04-8393-4793-a494-b5a484f1fa78
📒 Files selected for processing (2)
cub/cub/device/device_find.cuhcub/test/catch2_test_device_find_bound_sorted_values_env.cu
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.
e172043 to
52a8861
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (3)
cub/cub/device/device_find.cuh (1)
865-865: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Declare immutable callback parameters
const.policy_selector,storage, andstreamare not reassigned before dispatch in either callback. As per coding guidelines, “All variables that are not modified must be declared const.”Also applies to: 1117-1117
Source: Coding guidelines
cub/test/catch2_test_device_find_bound_sorted_values_env.cu (2)
110-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Declare the immutable input fixtures
const.d_range,d_values, andexpectedare not modified in either test. Keepd_outputmutable because the algorithm writes through its iterator. As per coding guidelines, “All variables that are not modified must be declared const.”Also applies to: 243-246
Source: Coding guidelines
158-158: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winsuggestion: Synchronize the selected stream. The direct
DeviceFindcalls pass stream-bearing environments but then callcudaDeviceSynchronize(). A regression that ignorescuda::get_streamand launches on the default stream can still pass. Use a stream-specific completion check or event dependency for each selected stream.Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 32eab430-ab35-4796-93dd-bd8c4184faf6
📒 Files selected for processing (2)
cub/cub/device/device_find.cuhcub/test/catch2_test_device_find_bound_sorted_values_env.cu
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.
|
/ok to test 52a8861 |
miscco
left a comment
There was a problem hiding this comment.
This looks good. Thanks a lot 🎉
| typename OutputIteratorT, | ||
| typename CompareOpT> | ||
| typename CompareOpT, | ||
| typename EnvT = ::cuda::std::execution::env<>> |
There was a problem hiding this comment.
We will probably need an additional constraint that verifies that CompareOpT is a suitable binary predicate.
Otherwise there is a high chance of running into ambiguities with the single pass overload
There was a problem hiding this comment.
Thanks for your comment: I just added a strict weak ordering constraint on CompareOpT for the two-phase overloads.
bernhardmgruber
left a comment
There was a problem hiding this comment.
Library changes LGTM, can you please also add a test that a tuning is successfully extracted?
This comment has been minimized.
This comment has been minimized.
Thanks for your comment, I added a tuning extraction test for both the one-phase and the two-phase overloads. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
cub/cub/device/device_find.cuh (1)
845-845: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Use
::cuda::std::strict_weak_orderin both constraints. This preserves the required global namespace qualification in the CUB header.As per path instructions, “qualify ::cuda namespace calls in headers according to CUB style.”
Also applies to: 1099-1099
Source: Path instructions
cub/test/catch2_test_device_find_bound_sorted_values_env.cu (1)
140-140: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Add a comment that explains why these tests require
TEST_LAUNCH == 0. State the exact unsupported launch mode or test-harness limitation.As per coding guidelines, “If a test is unsupported, expected to fail, disabled, or skipped on a platform, motivate it with a comment.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0cf56eae-861b-44d2-add0-b09b83214c4d
📒 Files selected for processing (2)
cub/cub/device/device_find.cuhcub/test/catch2_test_device_find_bound_sorted_values_env.cu
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review.
69ebdf0 to
8e164d5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cub/test/catch2_test_device_find_bound_sorted_values_env.cu (1)
136-136: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuesuggestion: Declare
expectedasconst.The test does not modify
expected. This declaration is also inconsistent with the adjacent lower-bound and user-provided-memory tests.As per path instructions, “Keep non-modified variables const.”
Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 78f0a5a3-2509-416f-aff3-99c4d0ea3813
📒 Files selected for processing (1)
cub/test/catch2_test_device_find_bound_sorted_values_env.cu
Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.
11d1a15 to
1e7cb58
Compare
|
@nfcalabria are you still working on this PR? |
I implemented the requested modifications and waiting for their review. |
…oads to accept environments
Remove the strict_weak_order constraint, which rejects heterogeneous comparators, share the dispatch between all overloads through select_tuning_and_dispatch, and align the tests with the other two-phase environment migrations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1e7cb58 to
f01125e
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…unch Co-Authored-By: Claude Opus 5.5 <[email protected]>
…environment Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@nfcalabria I had claude apply my suggestions now and rebase. |
|
/ok to test 14a48b4 |
🥳 CI Workflow Results🟩 Finished in 3h 26m: Pass: 100%/210 | Total: 9d 12h | Max: 3h 26m | Hits: 27%/1068953See results here. |
|
@nfcalabria thank you for the contribution! |
|
…overloads to accept environments
Description
Fixes: #11703 (Part of #9875)
Refactors the two-phase
cub::DeviceFind::LowerBoundSortedValuesandcub::DeviceFind::UpperBoundSortedValuesoverloads to accept an execution environment instead of acudaStream_t.Changes
cudaStream_targument in the two-phase overloads with the templated argumentconst EnvT& env.Testing
All tests pass locally.
Checklist