Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace cub::Min with cuda::minimum #4948

Merged
merged 6 commits into from
Mar 6, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions cpp/src/prims/detail/per_v_transform_reduce_e.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,12 @@ __global__ static void per_v_transform_reduce_e_mid_degree(
}
}

#if CCCL_MAJOR_VERSION >= 3
using cuda::minimum;
#else
using minimum = cub::Min;
#endif

if (edge_partition_e_mask) {
if constexpr (update_major && std::is_same_v<ReduceOp, reduce_op::any<T>>) {
auto rounded_up_local_degree =
Expand All @@ -601,7 +607,7 @@ __global__ static void per_v_transform_reduce_e_mid_degree(
e_op_result = call_e_op(i);
}
first_valid_lane_id = WarpReduce(temp_storage[threadIdx.x / raft::warp_size()])
.Reduce(e_op_result ? lane_id : raft::warp_size(), cub::Min());
.Reduce(e_op_result ? lane_id : raft::warp_size(), minimum{});
first_valid_lane_id = __shfl_sync(raft::warp_full_mask(), first_valid_lane_id, int{0});
if (lane_id == first_valid_lane_id) { reduced_e_op_result = *e_op_result; }
if (first_valid_lane_id != raft::warp_size()) { break; }
Expand Down Expand Up @@ -634,7 +640,7 @@ __global__ static void per_v_transform_reduce_e_mid_degree(
e_op_result = call_e_op(i);
}
first_valid_lane_id = WarpReduce(temp_storage[threadIdx.x / raft::warp_size()])
.Reduce(e_op_result ? lane_id : raft::warp_size(), cub::Min());
.Reduce(e_op_result ? lane_id : raft::warp_size(), minimum{});
first_valid_lane_id = __shfl_sync(raft::warp_full_mask(), first_valid_lane_id, int{0});
if (lane_id == first_valid_lane_id) { reduced_e_op_result = *e_op_result; }
if (first_valid_lane_id != raft::warp_size()) { break; }
Expand Down Expand Up @@ -781,6 +787,12 @@ __global__ static void per_v_transform_reduce_e_high_degree(
}
}

#if CCCL_MAJOR_VERSION >= 3
using cuda::minimum;
#else
using minimum = cub::Min;
#endif

if (edge_partition_e_mask) {
if constexpr (update_major && std::is_same_v<ReduceOp, reduce_op::any<T>>) {
auto rounded_up_local_degree =
Expand All @@ -799,7 +811,7 @@ __global__ static void per_v_transform_reduce_e_high_degree(
.Reduce(e_op_result
? threadIdx.x
: per_v_transform_reduce_e_kernel_high_degree_reduce_any_block_size,
cub::Min());
minimum{});
if (threadIdx.x == 0) { output_thread_id = first_valid_thread_id; }
__syncthreads();
first_valid_thread_id = output_thread_id;
Expand Down Expand Up @@ -843,7 +855,7 @@ __global__ static void per_v_transform_reduce_e_high_degree(
.Reduce(e_op_result
? threadIdx.x
: per_v_transform_reduce_e_kernel_high_degree_reduce_any_block_size,
cub::Min());
minimum{});
if (threadIdx.x == 0) { output_thread_id = first_valid_thread_id; }
__syncthreads();
first_valid_thread_id = output_thread_id;
Expand Down