30 #ifndef HIPCUB_ROCPRIM_BLOCK_BLOCK_EXCHANGE_HPP_
31 #define HIPCUB_ROCPRIM_BLOCK_BLOCK_EXCHANGE_HPP_
33 #include "../../../config.hpp"
35 #include <rocprim/block/block_exchange.hpp>
37 BEGIN_HIPCUB_NAMESPACE
43 bool WARP_TIME_SLICING =
false,
46 int ARCH = HIPCUB_ARCH
49 :
private ::rocprim::block_exchange<
58 BLOCK_DIM_X * BLOCK_DIM_Y * BLOCK_DIM_Z > 0,
59 "BLOCK_DIM_X * BLOCK_DIM_Y * BLOCK_DIM_Z must be greater than 0"
63 typename ::rocprim::block_exchange<
72 typename base_type::storage_type& temp_storage_;
75 using TempStorage =
typename base_type::storage_type;
83 BlockExchange(TempStorage& temp_storage) : temp_storage_(temp_storage)
87 template<
typename OutputT>
89 void StripedToBlocked(InputT (&input_items)[ITEMS_PER_THREAD],
90 OutputT (&output_items)[ITEMS_PER_THREAD])
92 base_type::striped_to_blocked(input_items, output_items, temp_storage_);
95 template<
typename OutputT>
97 void BlockedToStriped(InputT (&input_items)[ITEMS_PER_THREAD],
98 OutputT (&output_items)[ITEMS_PER_THREAD])
100 base_type::blocked_to_striped(input_items, output_items, temp_storage_);
103 template<
typename OutputT>
105 void WarpStripedToBlocked(InputT (&input_items)[ITEMS_PER_THREAD],
106 OutputT (&output_items)[ITEMS_PER_THREAD])
108 base_type::warp_striped_to_blocked(input_items, output_items, temp_storage_);
111 template<
typename OutputT>
113 void BlockedToWarpStriped(InputT (&input_items)[ITEMS_PER_THREAD],
114 OutputT (&output_items)[ITEMS_PER_THREAD])
116 base_type::blocked_to_warp_striped(input_items, output_items, temp_storage_);
119 template<
typename OutputT,
typename OffsetT>
121 void ScatterToBlocked(InputT (&input_items)[ITEMS_PER_THREAD],
122 OutputT (&output_items)[ITEMS_PER_THREAD],
123 OffsetT (&ranks)[ITEMS_PER_THREAD])
125 base_type::scatter_to_blocked(input_items, output_items, ranks, temp_storage_);
128 template<
typename OutputT,
typename OffsetT>
130 void ScatterToStriped(InputT (&input_items)[ITEMS_PER_THREAD],
131 OutputT (&output_items)[ITEMS_PER_THREAD],
132 OffsetT (&ranks)[ITEMS_PER_THREAD])
134 base_type::scatter_to_striped(input_items, output_items, ranks, temp_storage_);
137 template<
typename OutputT,
typename OffsetT>
139 void ScatterToStripedGuarded(InputT (&input_items)[ITEMS_PER_THREAD],
140 OutputT (&output_items)[ITEMS_PER_THREAD],
141 OffsetT (&ranks)[ITEMS_PER_THREAD])
143 base_type::scatter_to_striped_guarded(input_items, output_items, ranks, temp_storage_);
146 template<
typename OutputT,
typename OffsetT,
typename Val
idFlag>
148 void ScatterToStripedFlagged(InputT (&input_items)[ITEMS_PER_THREAD],
149 OutputT (&output_items)[ITEMS_PER_THREAD],
150 OffsetT (&ranks)[ITEMS_PER_THREAD],
151 ValidFlag (&is_valid)[ITEMS_PER_THREAD])
153 base_type::scatter_to_striped_flagged(input_items, output_items, ranks, is_valid, temp_storage_);
156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
159 HIPCUB_DEVICE
inline void StripedToBlocked(
160 InputT (&items)[ITEMS_PER_THREAD])
162 StripedToBlocked(items, items);
165 HIPCUB_DEVICE
inline void BlockedToStriped(
166 InputT (&items)[ITEMS_PER_THREAD])
168 BlockedToStriped(items, items);
171 HIPCUB_DEVICE
inline void WarpStripedToBlocked(
172 InputT (&items)[ITEMS_PER_THREAD])
174 WarpStripedToBlocked(items, items);
177 HIPCUB_DEVICE
inline void BlockedToWarpStriped(
178 InputT (&items)[ITEMS_PER_THREAD])
180 BlockedToWarpStriped(items, items);
183 template <
typename OffsetT>
184 HIPCUB_DEVICE
inline void ScatterToBlocked(
185 InputT (&items)[ITEMS_PER_THREAD],
186 OffsetT (&ranks)[ITEMS_PER_THREAD])
188 ScatterToBlocked(items, items, ranks);
191 template <
typename OffsetT>
192 HIPCUB_DEVICE
inline void ScatterToStriped(
193 InputT (&items)[ITEMS_PER_THREAD],
194 OffsetT (&ranks)[ITEMS_PER_THREAD])
196 ScatterToStriped(items, items, ranks);
199 template <
typename OffsetT>
200 HIPCUB_DEVICE
inline void ScatterToStripedGuarded(
201 InputT (&items)[ITEMS_PER_THREAD],
202 OffsetT (&ranks)[ITEMS_PER_THREAD])
204 ScatterToStripedGuarded(items, items, ranks);
207 template <
typename OffsetT,
typename Val
idFlag>
208 HIPCUB_DEVICE
inline void ScatterToStripedFlagged(
209 InputT (&items)[ITEMS_PER_THREAD],
210 OffsetT (&ranks)[ITEMS_PER_THREAD],
211 ValidFlag (&is_valid)[ITEMS_PER_THREAD])
213 ScatterToStriped(items, items, ranks, is_valid);
220 TempStorage& private_storage()
222 HIPCUB_SHARED_MEMORY TempStorage private_storage;
223 return private_storage;
Definition: block_exchange.hpp:56