NVIDIA / NVIDIA/cudf

[FEA] Batch computation for compound hash-based groupby aggregations

Open
#20,936 0 comments 0 reactions 1 assignee Claimed by @ttnghia View on GitHub
feature request libcudf
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
When computing hash-based groupby aggregations, we firstly compute the single-pass aggregations, then compute the compound aggregations as a finalizer step:
```
if (has_compound_aggs) {
for (auto const& request : requests) {
auto const& agg_v = request.aggregations;
auto const& col = request.values;
auto finalizer = hash_compound_agg_finalizer(col, cache, row_bitmask, stream, mr);
for (auto&& agg : agg_v) {
agg->finalize(finalizer);
}
}
}
```
As we see, this compound step executes sequentially for each aggregation. Each call to `agg->finalize(finalizer)` typically invokes at least one CUDA kernel. If we have hundreds+ aggregations, this will result in hundreds+ kernel calls and other operations such as memory allocations etc, implying a lot of overhead.

**Describe the solution you'd like**
We can combine multiple similar operations to a single kernel call to reduce overhead and improve kernel execution efficiency. For example, if we need to compute hundreds aggregations of type `MEAN`, just launch a single batch processing kernel to compute the average values for all these hundreds+ output columns at once. Then, we can launch a single batch processing kernel for generating the null mask for all these columns.

**Describe alternatives you've considered**
TBA

**Additional context**
TBA

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.