Repository navigation
Allow public tuning of non-ByKey cub::DeviceReduce - #8863
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
77f7fcb to
8cb51b7
Compare
|
/ok to test 8cb51b7 |
This comment has been minimized.
This comment has been minimized.
21e13d1 to
981733f
Compare
d83c423 to
d9b1bea
Compare
3a79d69 to
c448335
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (24)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (20)
📝 WalkthroughSummary by CodeRabbit
WalkthroughNon-ByKey ChangesReducePolicy API productization
Assessment against linked issues
Possibly related PRs
Suggested reviewers: Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cub/cub/device/dispatch/dispatch_reduce_deterministic.cuh (1)
199-205: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick wincritical:
reduce_grid_sizeundercounts exact full-chunk inputs. Whennum_items % num_items_per_chunk == 0,last_chunk_grid_sizeis0, but the loop still launches a full final chunk and writes anotherchunk_grid_sizepartials into an allocation sized for one fewer chunk; the final single-tile pass also misses those partials. Account for the final full chunk whenhas_partial_chunkis false. As per path instructions,cub/**/*reviews should focus on memory access safety.Source: Path instructions
🧹 Nitpick comments (2)
cub/cub/device/dispatch/dispatch_reduce_deterministic.cuh (1)
103-104: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: Mark the read-only
active_policyparametersconstor takeconst ReducePolicy&in both helpers. As per coding guidelines, all variables that are not modified must be declaredconst.Also applies to: 172-173
Source: Coding guidelines
cub/cub/device/dispatch/tuning/tuning_reduce.cuh (1)
405-415: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winsuggestion: redundant default-init + reassignment of
rp.Declare and initialize directly, matching the pattern used two branches below (lines 426-427, 438-439).
Simplify rp construction
- ReducePassPolicy rp{}; auto [scaled_items, scaled_threads] = scale_mem_bound(sm100_tuning->threads, sm100_tuning->items, accum_size); - rp = ReducePassPolicy{ - scaled_threads, scaled_items, sm100_tuning->items_per_vec_load, BLOCK_REDUCE_WARP_REDUCTIONS, LOAD_LDG}; + const ReducePassPolicy rp{ + scaled_threads, scaled_items, sm100_tuning->items_per_vec_load, BLOCK_REDUCE_WARP_REDUCTIONS, LOAD_LDG}; return {rp, rp};
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: aff48938-e949-4e30-8b08-1dcdbecaf6dc
📒 Files selected for processing (24)
cub/benchmarks/bench/reduce/arg_extrema.cucub/benchmarks/bench/reduce/base.cuhcub/benchmarks/bench/reduce/deterministic.cucub/benchmarks/bench/reduce/nondeterministic.cucub/benchmarks/bench/segmented_reduce/base.cuhcub/benchmarks/bench/transform_reduce/sum.cucub/cub/agent/agent_reduce.cuhcub/cub/device/device_reduce.cuhcub/cub/device/dispatch/dispatch_reduce.cuhcub/cub/device/dispatch/dispatch_reduce_deterministic.cuhcub/cub/device/dispatch/kernels/kernel_reduce.cuhcub/cub/device/dispatch/kernels/kernel_reduce_deterministic.cuhcub/cub/device/dispatch/kernels/kernel_segmented_reduce.cuhcub/cub/device/dispatch/tuning/tuning_reduce.cuhcub/cub/device/dispatch/tuning/tuning_segmented_reduce.cuhcub/test/catch2_test_device_reduce_deterministic.cucub/test/catch2_test_device_reduce_dispatcher.cucub/test/catch2_test_device_reduce_env.cucub/test/catch2_test_device_reduce_env_api.cucub/test/catch2_test_device_reduce_nondeterministic.cucub/test/catch2_test_device_segmented_reduce_custom_policy_hub.cucub/test/catch2_test_device_segmented_reduce_env.cudocs/cub/tuning.rstdocs/cub/tuning_infra.rst
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/cub/tuning.rst (2)
45-67: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftimportant: Keep the selector name consistent throughout the example.
CustomReducePolicySelectoris introduced here, but the later snippets still instantiatemy_reduce_tuning<int>andmy_scan_tuning. As written, the page is internally inconsistent and the copy/paste example no longer matches the new API naming. Please update the later usages, or keep compatible aliases if you want the old names to remain valid. As per path instructions, documentation examples should be technically accurate and buildable.Also applies to: 106-139
Source: Path instructions
50-52: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winsuggestion: Clamp or constrain
items_per_thread.
64 / sizeof(T)can become0for widerT, which yields an invalid tuning value if this template is instantiated beyond the narrow built-in types listed in the comment. Please either constrain the template to the intended element sizes or clamp the expression to at least1. As per path instructions, documentation examples should stay technically accurate.Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 58ef6c8b-7cab-4d79-9bec-47b73534dc61
📒 Files selected for processing (4)
cub/cub/agent/agent_reduce.cuhcub/cub/device/dispatch/dispatch_reduce.cuhcub/cub/device/dispatch/tuning/tuning_reduce.cuhdocs/cub/tuning.rst
🚧 Files skipped from review as they are similar to previous changes (3)
- cub/cub/agent/agent_reduce.cuh
- cub/cub/device/dispatch/tuning/tuning_reduce.cuh
- cub/cub/device/dispatch/dispatch_reduce.cuh
This comment has been minimized.
This comment has been minimized.
NaderAlAwar
left a comment
There was a problem hiding this comment.
Important: we still need to update device_scope.rst since it uses reduce policy tuning as an example. Line 247 should say multi_tile instead of reduce and line 458 should return cub::ReducePolicy
This comment has been minimized.
This comment has been minimized.
5027a2c to
a58c441
Compare
🥳 CI Workflow Results🟩 Finished in 2h 46m: Pass: 100%/287 | Total: 13d 09h | Max: 2h 44m | Hits: 19%/986441See results here. |
detail::reduce[_nd]::dispatch[_nd]#8826Device reduce can be tunedtests that cover the two other determinismsMyfrom the policy selector names in the API exampleDeviceReduce::Sumand rather use a struct with appropriate sub members, likeDeviceTransform. There is not actually a difference between the two cases (as I tried to argue).block_algorithmtoreduce_algorithm.Fixes: #7577