Skip to content

Commit

Permalink
Deprecate thrust::async (NVIDIA#3324)
Browse files Browse the repository at this point in the history
Fixes: NVIDIA#100
  • Loading branch information
bernhardmgruber authored and davebayer committed Jan 22, 2025
1 parent 34dffe5 commit 3497c3e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 33 deletions.
8 changes: 3 additions & 5 deletions thrust/thrust/async/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,15 @@ struct copy_fn final
// Synthesize a suitable new execution policy, because we don't want to
// try and extract twice from the one we were passed.
,
typename ::cuda::std::remove_cvref_t<
decltype(thrust::detail::derived_cast(thrust::detail::strip_const(exec)))>::tag_type{},
typename remove_cvref_t<decltype(thrust::detail::derived_cast(thrust::detail::strip_const(exec)))>::tag_type{},
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output)))

template <typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output) THRUST_RETURNS(copy_fn::call(
thrust::detail::select_system(
typename thrust::iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename thrust::iterator_system<::cuda::std::remove_cvref_t<OutputIt>>::type{}),
thrust::detail::select_system(typename thrust::iterator_system<remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename thrust::iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output)))
Expand Down
2 changes: 1 addition & 1 deletion thrust/thrust/async/for_each.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct for_each_fn final

template <typename ForwardIt, typename Sentinel, typename UnaryFunction>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f) THRUST_RETURNS(for_each_fn::call(
thrust::detail::select_system(typename iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(f)))
Expand Down
39 changes: 18 additions & 21 deletions thrust/thrust/async/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct reduce_fn final
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
thrust::plus<::cuda::std::remove_cvref_t<T>>{})) _CCCL_SUPPRESS_DEPRECATED_POP
thrust::plus<remove_cvref_t<T>>{})) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel>
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH
Expand All @@ -111,15 +111,14 @@ struct reduce_fn final
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
typename iterator_traits<::cuda::std::remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<
::cuda::std::remove_cvref_t<typename iterator_traits<::cuda::std::remove_cvref_t<ForwardIt>>::value_type>>{}))
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))
_CCCL_SUPPRESS_DEPRECATED_POP

template <typename ForwardIt, typename Sentinel, typename T, typename BinaryOp>
_CCCL_HOST static auto call4(ForwardIt&& first, Sentinel&& last, T&& init, BinaryOp&& op, thrust::false_type)
THRUST_RETURNS(reduce_fn::call(
thrust::detail::select_system(typename iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
Expand All @@ -128,11 +127,11 @@ struct reduce_fn final
template <typename ForwardIt, typename Sentinel, typename T>
_CCCL_HOST static auto call3(ForwardIt&& first, Sentinel&& last, T&& init, thrust::false_type)
THRUST_RETURNS(reduce_fn::call(
thrust::detail::select_system(typename iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
thrust::plus<::cuda::std::remove_cvref_t<T>>{}))
thrust::plus<remove_cvref_t<T>>{}))

// MSVC WAR: MSVC gets angsty and eats all available RAM when we try to detect
// if T1 is an execution_policy by using SFINAE. Switching to a static
Expand Down Expand Up @@ -225,7 +224,7 @@ struct reduce_into_fn final
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
thrust::plus<::cuda::std::remove_cvref_t<T>>{})) _CCCL_SUPPRESS_DEPRECATED_POP
thrust::plus<remove_cvref_t<T>>{})) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH
Expand All @@ -240,17 +239,16 @@ struct reduce_into_fn final
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
typename iterator_traits<::cuda::std::remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<
::cuda::std::remove_cvref_t<typename iterator_traits<::cuda::std::remove_cvref_t<ForwardIt>>::value_type>>{}))
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))
_CCCL_SUPPRESS_DEPRECATED_POP

template <typename ForwardIt, typename Sentinel, typename OutputIt, typename T, typename BinaryOp>
_CCCL_HOST static auto call5(
ForwardIt&& first, Sentinel&& last, OutputIt&& output, T&& init, BinaryOp&& op, thrust::false_type)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<::cuda::std::remove_cvref_t<OutputIt>>::type{}),
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
Expand All @@ -260,25 +258,24 @@ struct reduce_into_fn final
template <typename ForwardIt, typename Sentinel, typename OutputIt, typename T>
_CCCL_HOST static auto call4(ForwardIt&& first, Sentinel&& last, OutputIt&& output, T&& init, thrust::false_type)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<::cuda::std::remove_cvref_t<OutputIt>>::type{}),
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
thrust::plus<::cuda::std::remove_cvref_t<T>>{}))
thrust::plus<remove_cvref_t<T>>{}))

template <typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<::cuda::std::remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<::cuda::std::remove_cvref_t<OutputIt>>::type{}),
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
typename iterator_traits<::cuda::std::remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<::cuda::std::remove_cvref_t<
typename iterator_traits<::cuda::std::remove_cvref_t<ForwardIt>>::value_type>>{}))
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))

// MSVC WAR: MSVC gets angsty and eats all available RAM when we try to detect
// if T1 is an execution_policy by using SFINAE. Switching to a static
Expand Down
12 changes: 6 additions & 6 deletions thrust/thrust/async/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct inclusive_scan_fn final
typename Sentinel,
typename OutputIt,
typename BinaryOp,
typename = std::enable_if_t<!is_execution_policy_v<::cuda::std::remove_cvref_t<ForwardIt>>>>
typename = std::enable_if_t<!is_execution_policy_v<remove_cvref_t<ForwardIt>>>>
CCCL_DEPRECATED _CCCL_SUPPRESS_DEPRECATED_PUSH
auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, BinaryOp&& op) const
// ADL dispatch.
Expand Down Expand Up @@ -169,7 +169,7 @@ struct inclusive_scan_fn final
typename OutputIt,
typename InitialValueType,
typename BinaryOp,
typename = std::enable_if_t<!is_execution_policy_v<::cuda::std::remove_cvref_t<ForwardIt>>>>
typename = std::enable_if_t<!is_execution_policy_v<remove_cvref_t<ForwardIt>>>>
CCCL_DEPRECATED _CCCL_SUPPRESS_DEPRECATED_PUSH
auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, InitialValueType&& init, BinaryOp&& op) const
// ADL dispatch.
Expand Down Expand Up @@ -249,15 +249,15 @@ struct exclusive_scan_fn final
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(out),
iterator_value_t<::cuda::std::remove_cvref_t<ForwardIt>>{},
iterator_value_t<remove_cvref_t<ForwardIt>>{},
thrust::plus<>{})) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename ForwardIt,
typename Sentinel,
typename OutputIt,
typename InitialValueType,
typename BinaryOp,
typename = std::enable_if_t<!is_execution_policy_v<::cuda::std::remove_cvref_t<ForwardIt>>>>
typename = std::enable_if_t<!is_execution_policy_v<remove_cvref_t<ForwardIt>>>>
CCCL_DEPRECATED _CCCL_SUPPRESS_DEPRECATED_PUSH
auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, InitialValueType&& init, BinaryOp&& op) const
// ADL dispatch.
Expand All @@ -274,7 +274,7 @@ struct exclusive_scan_fn final
typename Sentinel,
typename OutputIt,
typename InitialValueType,
typename = std::enable_if_t<!is_execution_policy_v<::cuda::std::remove_cvref_t<ForwardIt>>>>
typename = std::enable_if_t<!is_execution_policy_v<remove_cvref_t<ForwardIt>>>>
CCCL_DEPRECATED _CCCL_SUPPRESS_DEPRECATED_PUSH
auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, InitialValueType&& init) const
// ADL dispatch.
Expand All @@ -297,7 +297,7 @@ struct exclusive_scan_fn final
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(out),
iterator_value_t<::cuda::std::remove_cvref_t<ForwardIt>>{},
iterator_value_t<remove_cvref_t<ForwardIt>>{},
thrust::plus<>{})) _CCCL_SUPPRESS_DEPRECATED_POP
};

Expand Down

0 comments on commit 3497c3e

Please sign in to comment.