Repository navigation
Allow public tuning of cub::DeviceSelect (without UniqueByKey) and cub::DevicePartition (without three-way) - #9316
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:
important: WalkthroughPublic SelectPolicy and PartitionPolicy types added; agent select-if policy internals moved to detail::agent_select_if_policy with deprecated alias; tuning helpers, policy hub, and dispatch paths updated to use SelectPolicy; DevicePartition adds PartitionPolicy and adapter; benchmarks, tests, docs, and libc++ dispatch calls updated; DispatchSelectIf deprecated. ChangesSelectPolicy Tuning Type Productization
Assessment against linked issues
possibly related PRs
suggested reviewers
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cub/cub/device/dispatch/tuning/tuning_select_if.cuh (1)
37-38: ⚡ Quick winsuggestion: Replace this struct doc opening with an explicit
//!@brief...form so it is consistently consumed by the Doxygen pipeline.
As per coding guidelines, "Use Doxygen-style//!comments with@brieftags for documentation."Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e5ed72c3-b50e-42d5-b5d3-764f59808ff2
📒 Files selected for processing (15)
cub/benchmarks/bench/partition/flagged.cucub/benchmarks/bench/partition/if.cucub/benchmarks/bench/select/flagged.cucub/benchmarks/bench/select/if.cucub/benchmarks/bench/select/unique.cucub/cub/agent/agent_select_if.cuhcub/cub/device/device_partition.cuhcub/cub/device/device_select.cuhcub/cub/device/dispatch/dispatch_select_if.cuhcub/cub/device/dispatch/tuning/tuning_select_if.cuhcub/test/catch2_test_device_partition_env.cucub/test/catch2_test_device_partition_env_api.cucub/test/catch2_test_device_select_env.cucub/test/catch2_test_device_select_env_api.cucub/test/catch2_test_device_select_if_custom_policy_hub.cu
| [] __host__ __device__(int v) { | ||
| return v < 5; | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -nP '\[\]\s*__host__\s*__device__' cub/test/catch2_test_device_select_env_api.cuRepository: NVIDIA/cccl
Length of output: 95
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="cub/test/catch2_test_device_select_env_api.cu"
# Inspect context around the reported lambda
sed -n '380,470p' "$file" | nl -ba | sed -n '1,120p'
# Find other host-device lambdas in cub/test
rg -nP '\[\]\s*__host__\s*__device__' cub/test | head -n 50
# Find other host-device lambdas in cub (broader)
rg -nP '\[\]\s*__host__\s*__device__' cub | head -n 50Repository: NVIDIA/cccl
Length of output: 98
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="cub/test/catch2_test_device_select_env_api.cu"
# Show surrounding code with line numbers (no nl dependency)
sed -n '400,465p' "$file" | cat -n
# Search for other host-device lambdas in nearby tests (limit output)
rg -nP '\[\]\s*__host__\s*__device__' cub/test | head -n 50
# Broader search within cub (limit output)
rg -nP '\[\]\s*__host__\s*__device__' cub | head -n 50Repository: NVIDIA/cccl
Length of output: 3392
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search for the guideline wording (or close variants)
rg -n --hidden --no-ignore-vcs "Never allow.*lambda|lambda expression|host__device.*lambda|__host__ __device.*lambda" . | head -n 50
# Inspect a couple other occurrences for style consistency
for f in \
cub/test/catch2_test_device_partition_env_api.cu \
cub/test/catch2_test_device_find_env_api.cu \
cub/test/catch2_test_device_segmented_scan_api.cu
do
echo "---- $f"
rg -nP '\[\]\s*__host__\s*__device__\b' "$f" | head -n 5
doneRepository: NVIDIA/cccl
Length of output: 1337
🏁 Script executed:
#!/bin/bash
set -euo pipefail
file="cub/test/catch2_test_device_select_env_api.cu"
sed -n '420,450p' "$file" | cat -n
echo "---- skills: libcudacxx-style/SKILL.md ----"
sed -n '70,130p' .agent/skills/libcudacxx-style/SKILL.md | cat -n
echo "---- skills: libcudacxx-test/SKILL.md ----"
sed -n '30,80p' .agent/skills/libcudacxx-test/SKILL.md | cat -nRepository: NVIDIA/cccl
Length of output: 6740
important: Replace the [] __host__ __device__(int v) predicate in the tuned cub::DeviceSelect::If call with a named functor (cub/test/catch2_test_device_select_env_api.cu, lines 435-437) to follow CCCL’s device-code/lambda constraints (e.g., struct Pred { __host__ __device__ bool operator()(int v) const { return v < 5; } };).
Source: Coding guidelines
|
|
||
| #include <thrust/device_vector.h> | ||
|
|
||
| #include <cuda/__execution/tune.h> |
There was a problem hiding this comment.
Question: This currently uses a non-exposed header. If we productize this which header should a user include?
There was a problem hiding this comment.
#include <cuda/execution.tune.h> if they want to, but it also just works with just <cub/device/device_select.cuh>
cub::DeviceSelect (without UniqueByKey) and cub::DevicePartition (without three-way) tuning APIcub::DeviceSelect (without UniqueByKey) and cub::DevicePartition (without three-way)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@miscco that's on you :) Do you need to use the Dispatch struct because of temporary storage query again? |
71566a1 to
cdd8705
Compare
This comment has been minimized.
This comment has been minimized.
803b740 to
65625a6
Compare
This comment has been minimized.
This comment has been minimized.
65625a6 to
f175ea7
Compare
|
If I remember correctly this was because of |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // example-begin partition-if-policy-selector | ||
| struct PartitionPolicySelector | ||
| { | ||
| __host__ __device__ constexpr auto operator()(cuda::compute_capability cc) const -> cub::PartitionPolicy |
There was a problem hiding this comment.
tiny nit: is there a reason for not using the less verbal
__host__ __device__ constexpr cub::PartitionPolicy operator()(cuda::compute_capability cc) const?
There was a problem hiding this comment.
Personal preference. I find it more readable.
NaderAlAwar
left a comment
There was a problem hiding this comment.
benchmarks look good
…ePartition (without three-way) tuning API Fixes: NVIDIA#8583 Fixes: NVIDIA#8575
f175ea7 to
7faeef7
Compare
This comment has been minimized.
This comment has been minimized.
🥳 CI Workflow Results🟩 Finished in 2d 00h: Pass: 100%/343 | Total: 12d 08h | Max: 2h 20m | Hits: 36%/1334368See results here. |
Fixes: #8583
Fixes: #8575