Skip to content

Commit 0c8f9cb

Browse files
authored
Rework reduction case statement as dispatch_type_and_aggregation (#20078)
Reworks the switch/case statement in reductions.cpp to use `dispatch_type_and_aggregation` instead. This allows the specific functors to indicate valid aggregation/type support, reduce behavior when no data is given, as well as the reduction function itself. This makes it easier to update existing aggregations and support newer ones more reliably. It also allows for a reduction-specific `is_valid_aggregation()` API by keeping making the valid checks a compile-time feature. Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Bradley Dice (https://github.com/bdice) - Nghia Truong (https://github.com/ttnghia) URL: #20078
1 parent dcf7eff commit 0c8f9cb

File tree

4 files changed

+523
-170
lines changed

4 files changed

+523
-170
lines changed

cpp/include/cudf/reduction.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,20 @@ std::pair<std::unique_ptr<scalar>, std::unique_ptr<scalar>> minmax(
255255
rmm::cuda_stream_view stream = cudf::get_default_stream(),
256256
rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref());
257257

258+
/**
259+
* @brief Reduction namespace
260+
*/
261+
namespace reduction {
262+
/**
263+
* @brief Indicate if a reduction is supported for a source datatype.
264+
*
265+
* @param source The source data type.
266+
* @param kind The reduction aggregation.
267+
* @returns true if the reduction is supported.
268+
*/
269+
bool is_valid_aggregation(data_type source, aggregation::Kind kind);
270+
} // namespace reduction
271+
258272
/** @} */ // end of group
259273

260274
} // namespace CUDF_EXPORT cudf

0 commit comments

Comments
 (0)