21 #ifndef ROCPRIM_DETAIL_BINARY_OP_WRAPPERS_HPP_ 22 #define ROCPRIM_DETAIL_BINARY_OP_WRAPPERS_HPP_ 24 #include <type_traits> 26 #include "../config.hpp" 27 #include "../intrinsics.hpp" 28 #include "../types.hpp" 29 #include "../functional.hpp" 31 #include "../detail/various.hpp" 33 BEGIN_ROCPRIM_NAMESPACE
40 class ResultType =
typename BinaryFunction::result_type,
41 class InputType =
typename BinaryFunction::input_type
45 using result_type = ResultType;
46 using input_type = InputType;
48 ROCPRIM_HOST_DEVICE
inline 51 ROCPRIM_HOST_DEVICE
inline 53 : binary_op_(binary_op)
57 ROCPRIM_HOST_DEVICE
inline 58 ~reverse_binary_op_wrapper() =
default;
60 ROCPRIM_HOST_DEVICE
inline 61 result_type operator()(
const input_type& t1,
const input_type& t2)
63 return binary_op_(t2, t1);
67 BinaryFunction binary_op_;
71 template<
class V,
class F,
class BinaryFunction>
74 static_assert(std::is_convertible<F, bool>::value,
"F must be convertible to bool");
76 using result_type = rocprim::tuple<V, F>;
77 using input_type = result_type;
79 ROCPRIM_HOST_DEVICE
inline 82 ROCPRIM_HOST_DEVICE
inline 88 ROCPRIM_HOST_DEVICE
inline 89 ~headflag_scan_op_wrapper() =
default;
91 ROCPRIM_HOST_DEVICE
inline 92 result_type operator()(
const input_type& t1,
const input_type& t2)
94 return rocprim::make_tuple(
95 rocprim::get<1>(t2) == 0
96 ? scan_op_(rocprim::get<0>(t1), rocprim::get<0>(t2))
97 :
static_cast<decltype(scan_op_(rocprim::get<0>(t1), rocprim::get<0>(t2)))
>(
99 F{rocprim::get<1>(t2) || rocprim::get<1>(t1)});
103 BinaryFunction scan_op_;
107 template<
class EqualityOp>
110 using equality_op_type = EqualityOp;
112 ROCPRIM_HOST_DEVICE
inline 115 ROCPRIM_HOST_DEVICE
inline 117 : equality_op(equality_op)
120 template<
class T,
class U>
121 ROCPRIM_DEVICE ROCPRIM_INLINE
122 bool operator()(
const T &a,
const U &b)
124 return !equality_op(a, b);
127 equality_op_type equality_op;
132 END_ROCPRIM_NAMESPACE
134 #endif // ROCPRIM_DETAIL_BINARY_OP_WRAPPERS_HPP_ Definition: binary_op_wrappers.hpp:43
Deprecated: Configuration of device-level scan primitives.
Definition: block_histogram.hpp:62
Definition: binary_op_wrappers.hpp:72
Definition: binary_op_wrappers.hpp:108