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

Drop zipped_binary_op #1988

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 0 additions & 18 deletions thrust/thrust/detail/internal_functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,6 @@ struct generate_functor
thrust::detail::identity_<device_generate_functor<Generator>>>
{};

template <typename ResultType, typename BinaryFunction>
struct zipped_binary_op
{
using result_type = ResultType;

_CCCL_HOST_DEVICE zipped_binary_op(BinaryFunction binary_op)
: m_binary_op(binary_op)
{}

template <typename Tuple>
_CCCL_HOST_DEVICE inline result_type operator()(Tuple t)
{
return m_binary_op(thrust::get<0>(t), thrust::get<1>(t));
}

BinaryFunction m_binary_op;
};

template <typename T>
struct is_non_const_reference
: ::cuda::std::_And<thrust::detail::not_<::cuda::std::is_const<T>>,
Expand Down
13 changes: 4 additions & 9 deletions thrust/thrust/system/detail/generic/inner_product.inl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <thrust/functional.h>
#include <thrust/system/detail/generic/inner_product.h>
#include <thrust/transform_reduce.h>
#include <thrust/zip_function.h>

THRUST_NAMESPACE_BEGIN
namespace system
Expand Down Expand Up @@ -66,15 +67,9 @@ _CCCL_HOST_DEVICE OutputType inner_product(
BinaryFunction1 binary_op1,
BinaryFunction2 binary_op2)
{
using ZipIter = thrust::zip_iterator<thrust::tuple<InputIterator1, InputIterator2>>;

ZipIter first = thrust::make_zip_iterator(thrust::make_tuple(first1, first2));

// only the first iterator in the tuple is relevant for the purposes of last
ZipIter last = thrust::make_zip_iterator(thrust::make_tuple(last1, first2));

return thrust::transform_reduce(
exec, first, last, thrust::detail::zipped_binary_op<OutputType, BinaryFunction2>(binary_op2), init, binary_op1);
const auto first = thrust::make_zip_iterator(first1, first2);
const auto last = thrust::make_zip_iterator(last1, first2); // only first iterator matters
return thrust::transform_reduce(exec, first, last, thrust::make_zip_function(binary_op2), init, binary_op1);
} // end inner_product()

} // namespace generic
Expand Down
Loading