Skip to content

Commit 7b19a43

Browse files
authored
deprecates policy hubs (#3514)
1 parent 3427d0a commit 7b19a43

11 files changed

+49
-32
lines changed

cub/cub/device/device_radix_sort.cuh

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,22 @@ private:
151151
int end_bit,
152152
cudaStream_t stream)
153153
{
154-
return DispatchRadixSort<IsDescending, KeyT, ValueT, OffsetT, DeviceRadixSortPolicy<KeyT, ValueT, OffsetT>, DecomposerT>::
155-
Dispatch(
156-
d_temp_storage,
157-
temp_storage_bytes,
158-
d_keys,
159-
d_values,
160-
static_cast<OffsetT>(num_items),
161-
begin_bit,
162-
end_bit,
163-
is_overwrite_okay,
164-
stream,
165-
decomposer);
154+
return DispatchRadixSort<
155+
IsDescending,
156+
KeyT,
157+
ValueT,
158+
OffsetT,
159+
detail::radix::policy_hub<KeyT, ValueT, OffsetT>,
160+
DecomposerT>::Dispatch(d_temp_storage,
161+
temp_storage_bytes,
162+
d_keys,
163+
d_values,
164+
static_cast<OffsetT>(num_items),
165+
begin_bit,
166+
end_bit,
167+
is_overwrite_okay,
168+
stream,
169+
decomposer);
166170
}
167171

168172
template <bool IsDescending, typename KeyT, typename ValueT, typename NumItemsT, typename DecomposerT>

cub/cub/device/dispatch/dispatch_reduce.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ struct DispatchReduce
567567
template <typename ActivePolicyT>
568568
CUB_RUNTIME_FUNCTION _CCCL_FORCEINLINE cudaError_t Invoke(ActivePolicyT active_policy = {})
569569
{
570-
auto wrapped_policy = MakeReducePolicyWrapper(active_policy);
570+
auto wrapped_policy = detail::reduce::MakeReducePolicyWrapper(active_policy);
571571
if (num_items <= static_cast<OffsetT>(
572572
wrapped_policy.SingleTile().BlockThreads() * wrapped_policy.SingleTile().ItemsPerThread()))
573573
{

cub/cub/device/dispatch/dispatch_streaming_reduce.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ template <typename InputIteratorT,
187187
typename ReductionOpT,
188188
typename InitT,
189189
typename PolicyChainT =
190-
DeviceReducePolicy<KeyValuePair<PerPartitionOffsetT, InitT>, PerPartitionOffsetT, ReductionOpT>>
190+
detail::reduce::policy_hub<KeyValuePair<PerPartitionOffsetT, InitT>, PerPartitionOffsetT, ReductionOpT>>
191191
struct dispatch_streaming_arg_reduce_t
192192
{
193193
// Internal dispatch routine for computing a device-wide argument extremum, like `ArgMin` and `ArgMax`

cub/cub/device/dispatch/tuning/tuning_adjacent_difference.cuh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ struct policy_hub
7777
} // namespace adjacent_difference
7878
} // namespace detail
7979

80-
// TODO(bgruber): deprecate this alias. Users should not access policy_hubs directly.
8180
template <typename InputIteratorT, bool MayAlias = true>
82-
using DeviceAdjacentDifferencePolicy = detail::adjacent_difference::policy_hub<InputIteratorT, MayAlias>;
81+
using DeviceAdjacentDifferencePolicy CCCL_DEPRECATED_BECAUSE(
82+
"This class is considered an implementation detail and it "
83+
"will be removed.") = detail::adjacent_difference::policy_hub<InputIteratorT, MayAlias>;
8384

8485
CUB_NAMESPACE_END

cub/cub/device/dispatch/tuning/tuning_merge_sort.cuh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ struct policy_hub
9292
} // namespace detail
9393

9494
template <typename KeyIteratorT>
95-
using DeviceMergeSortPolicy = detail::merge_sort::policy_hub<KeyIteratorT>;
95+
using DeviceMergeSortPolicy CCCL_DEPRECATED_BECAUSE("This class is considered an implementation detail and it will be "
96+
"removed.") = detail::merge_sort::policy_hub<KeyIteratorT>;
9697

9798
CUB_NAMESPACE_END

cub/cub/device/dispatch/tuning/tuning_radix_sort.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ struct policy_hub
887887
} // namespace radix
888888
} // namespace detail
889889

890-
// TODO(bgruber): deprecate this alias. Users should not access policy_hubs directly.
891890
/**
892891
* @brief Tuning policy for kernel specialization
893892
*
@@ -901,6 +900,7 @@ struct policy_hub
901900
* Signed integer type for global offsets
902901
*/
903902
template <typename KeyT, typename ValueT, typename OffsetT>
904-
using DeviceRadixSortPolicy = detail::radix::policy_hub<KeyT, ValueT, OffsetT>;
903+
using DeviceRadixSortPolicy CCCL_DEPRECATED_BECAUSE("This class is considered an implementation detail and it will be "
904+
"removed.") = detail::radix::policy_hub<KeyT, ValueT, OffsetT>;
905905

906906
CUB_NAMESPACE_END

cub/cub/device/dispatch/tuning/tuning_reduce.cuh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ struct policy_hub
141141
} // namespace reduce
142142
} // namespace detail
143143

144-
// TODO(bgruber): deprecate at some point when we have a better API for users to supply tunings
145144
/// @tparam AccumT
146145
/// Accumulator data type
147146
///
@@ -152,10 +151,20 @@ struct policy_hub
152151
/// Binary reduction functor type having member
153152
/// `auto operator()(const T &a, const U &b)`
154153
template <typename AccumT, typename OffsetT, typename ReductionOpT>
155-
using DeviceReducePolicy = detail::reduce::policy_hub<AccumT, OffsetT, ReductionOpT>;
154+
using DeviceReducePolicy CCCL_DEPRECATED_BECAUSE(
155+
"This class is considered an implementation detail and it will be "
156+
"removed.") = detail::reduce::policy_hub<AccumT, OffsetT, ReductionOpT>;
156157

157-
// TODO(bgruber): deprecate those
158-
using detail::reduce::MakeReducePolicyWrapper;
159-
using detail::reduce::ReducePolicyWrapper;
158+
template <typename PolicyT, typename Enable = void>
159+
using ReducePolicyWrapper CCCL_DEPRECATED_BECAUSE("This class is considered an implementation detail and it will be "
160+
"removed.") = detail::reduce::ReducePolicyWrapper<PolicyT, Enable>;
161+
162+
template <typename PolicyT>
163+
CCCL_DEPRECATED_BECAUSE("This function is considered an implementation detail and it will "
164+
"be removed.")
165+
CUB_RUNTIME_FUNCTION detail::reduce::ReducePolicyWrapper<PolicyT> MakeReducePolicyWrapper(PolicyT policy)
166+
{
167+
return detail::reduce::ReducePolicyWrapper<PolicyT>{policy};
168+
}
160169

161170
CUB_NAMESPACE_END

cub/cub/device/dispatch/tuning/tuning_scan.cuh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ struct policy_hub
332332
} // namespace scan
333333
} // namespace detail
334334

335-
// TODO(bgruber): deprecate this at some point when we have a better way to allow users to supply tunings
336335
template <typename AccumT, typename ScanOpT = ::cuda::std::plus<>>
337-
using DeviceScanPolicy = detail::scan::policy_hub<AccumT, ScanOpT>;
336+
using DeviceScanPolicy CCCL_DEPRECATED_BECAUSE("This class is considered an implementation detail and it will be "
337+
"removed.") = detail::scan::policy_hub<AccumT, ScanOpT>;
338338

339339
CUB_NAMESPACE_END

cub/cub/device/dispatch/tuning/tuning_scan_by_key.cuh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,9 @@ struct policy_hub
790790
} // namespace scan_by_key
791791
} // namespace detail
792792

793-
// TODO(bgruber): deprecate this at some point in the future when we have a better API for users to supply policies
794793
template <typename KeysInputIteratorT, typename AccumT, typename ValueT = AccumT, typename ScanOpT = ::cuda::std::plus<>>
795-
using DeviceScanByKeyPolicy = detail::scan_by_key::policy_hub<KeysInputIteratorT, AccumT, ValueT, ScanOpT>;
794+
using DeviceScanByKeyPolicy CCCL_DEPRECATED_BECAUSE(
795+
"This class is considered an implementation detail and it will be "
796+
"removed.") = detail::scan_by_key::policy_hub<KeysInputIteratorT, AccumT, ValueT, ScanOpT>;
796797

797798
CUB_NAMESPACE_END

cub/cub/device/dispatch/tuning/tuning_segmented_sort.cuh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ struct policy_hub
272272
} // namespace segmented_sort
273273
} // namespace detail
274274

275-
// TODO(bgruber): Deprecate this at some point when we have a better API for users to provide tunings
276275
template <typename KeyT, typename ValueT>
277-
using DeviceSegmentedSortPolicy = detail::segmented_sort::policy_hub<KeyT, ValueT>;
276+
using DeviceSegmentedSortPolicy CCCL_DEPRECATED_BECAUSE(
277+
"This class is considered an implementation detail and it will "
278+
"be removed.") = detail::segmented_sort::policy_hub<KeyT, ValueT>;
278279

279280
CUB_NAMESPACE_END

0 commit comments

Comments
 (0)