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_mapping_indices used by shared memory groupby #17147

Merged
merged 4 commits into from
Oct 28, 2024

Conversation

PointKernel
Copy link
Member

@PointKernel PointKernel commented Oct 22, 2024

Description

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

This PR introduces the compute_mapping_indices API, which is used by the shared memory groupby. libcudf will opt for the shared memory code path when the aggregation request is compatible with shared memory, i.e. there is enough shared memory space and no dictionary aggregation requests. Aggregating with shared memory involves two steps. The first step, introduced in this PR, calculates the offset for each input key within the shared memory aggregation storage, as well as the offset when merging the shared memory results into global memory.

Checklist

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

@github-actions github-actions bot added libcudf Affects libcudf (C++/CUDA) code. CMake CMake build issue labels Oct 22, 2024
@PointKernel PointKernel added feature request New feature or request non-breaking Non-breaking change 3 - Ready for Review Ready for review by team labels Oct 22, 2024
@PointKernel PointKernel marked this pull request as ready for review October 22, 2024 23:31
@PointKernel PointKernel requested review from a team as code owners October 22, 2024 23:31
Copy link
Member

@harrism harrism left a comment

Choose a reason for hiding this comment

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

One question.

cpp/src/groupby/hash/compute_mapping_indices.cuh Outdated Show resolved Hide resolved
@PointKernel PointKernel self-assigned this Oct 23, 2024
@ttnghia
Copy link
Contributor

ttnghia commented Oct 28, 2024

So this step doesn't have any usage for the new code as well as tests, right? If there is no unit tests, it would be difficult to verify if the implementation is valid. But I'm fine to have it verified in the next step follow-up PR.

@PointKernel
Copy link
Member Author

So this step doesn't have any usage for the new code as well as tests, right? If there is no unit tests, it would be difficult to verify if the implementation is valid. But I'm fine to have it verified in the next step follow-up PR.

Correct, this and #17162 are the two major kernels for shared memory groupby. Creating unit tests for those kernels isn’t straightforward. Both PRs are synced with #16619, so if #16619 passes all tests, the algorithm should be correct.

@PointKernel
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit ef28cdd into rapidsai:branch-24.12 Oct 28, 2024
102 checks passed
@PointKernel PointKernel deleted the groupby-mapping-indices branch October 28, 2024 17:34
rapids-bot bot pushed a commit that referenced this pull request Oct 31, 2024
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.

Authors:
  - Yunsong Wang (https://github.com/PointKernel)

Approvers:
  - David Wendt (https://github.com/davidwendt)
  - Nghia Truong (https://github.com/ttnghia)
  - Bradley Dice (https://github.com/bdice)

URL: #17162
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
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants