diff --git a/cpp/src/groupby/hash/global_memory_aggregator.cuh b/cpp/src/groupby/hash/global_memory_aggregator.cuh index 9b646313239..86769df9b4b 100644 --- a/cpp/src/groupby/hash/global_memory_aggregator.cuh +++ b/cpp/src/groupby/hash/global_memory_aggregator.cuh @@ -266,6 +266,8 @@ struct gmem_element_aggregator { bool* source_mask, cudf::size_type source_index) const noexcept { + // Early exit for all aggregation kinds since shared memory aggregation of + // `COUNT_ALL` is always valid if (!source_mask[source_index]) { return; } update_target_element_gmem<Source, k>{}( diff --git a/cpp/src/groupby/hash/shared_memory_aggregator.cuh b/cpp/src/groupby/hash/shared_memory_aggregator.cuh index 49524c25545..94fe77a87ab 100644 --- a/cpp/src/groupby/hash/shared_memory_aggregator.cuh +++ b/cpp/src/groupby/hash/shared_memory_aggregator.cuh @@ -255,6 +255,7 @@ struct shmem_element_aggregator { cudf::column_device_view source, cudf::size_type source_index) const noexcept { + // Check nullability for all aggregation kinds but `COUNT_ALL` if constexpr (k != cudf::aggregation::COUNT_ALL) { if (source.is_null(source_index)) { return; } }