Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compute_shared_memory_aggs used by shared memory groupby #17162

Open
wants to merge 10 commits into
base: branch-24.12
Choose a base branch
from

Conversation

PointKernel
Copy link
Member

Description

This work is part of splitting the original bulk shared memory groupby PR #16619.

This PR introduces the compute_shared_memory_aggs API, which is utilized by the shared memory groupby. The shared memory groupby process consists of two main steps. The first step was introduced in #17147, and this PR implements the second step, where the actual aggregations are performed based on the offsets from the first step. Each thread block is designed to handle up to 128 unique keys. If this limit is exceeded, there won't be enough space to store temporary aggregation results in shared memory, so a flag is set to indicate that follow-up global memory aggregations are needed to complete the remaining aggregation requests.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@PointKernel PointKernel added the CMake CMake build issue label Oct 24, 2024
@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label Oct 24, 2024
@PointKernel PointKernel added non-breaking Non-breaking change feature request New feature or request labels Oct 24, 2024
@PointKernel PointKernel marked this pull request as ready for review October 24, 2024 00:18
@PointKernel PointKernel requested review from a team as code owners October 24, 2024 00:18
@PointKernel PointKernel self-assigned this Oct 24, 2024
@PointKernel PointKernel added the 3 - Ready for Review Ready for review by team label Oct 24, 2024

size_t dynamic_shmem_size = 0;
CUDF_CUDA_TRY(cudaOccupancyAvailableDynamicSMemPerBlock(
&dynamic_shmem_size, single_pass_shmem_aggs_kernel, active_blocks_per_sm, GROUPBY_BLOCK_SIZE));
Copy link
Contributor

@davidwendt davidwendt Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will change within a process. I wonder if it could be cached by making the variable static?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of this function will be used in another TU as well: https://github.com/PointKernel/cudf/blob/ed9243b83181d15646b46e15e1aa42963131c5f6/cpp/src/groupby/hash/compute_aggregations.cuh#L69

I've updated the code to calculate the available shared memory only once in compute_aggregations and pass available_shmem_size as an argument, rather than repeatedly calling the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team CMake CMake build issue feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants