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

Adds virtual shared memory helper and tests #619

Merged
merged 13 commits into from
Nov 12, 2023
Merged

Conversation

elstehle
Copy link
Contributor

@elstehle elstehle commented Oct 25, 2023

Description

This PR adds a virtual shared memory helper utility. This utility helps to work around the limitation of a CUB algorithm requiring more shared memory than is available per thread block (by default, 48K of static shared memory). This scenario usually only becomes relevant for large user types, e.g., once they exceed hundred(s) of bytes and more.

The utility has two mechanisms to work around this limitation:

  1. The utility supports a fallback policy that adapts to this shared memory constraint. It achieves this by employing a smaller tile size, which means fewer threads per block and fewer items per thread. The memory requirements are intricately tied to the tile size and the data type the algorithm operates on. If the default policy surpasses the shared memory capacity while the fallback policy with a reduced tile size remains within these boundaries, the utility dynamically switches to the fallback policy. This ensures optimal resource usage without compromising performance.
  2. If the algorithm with the fallback policy still exceeds the shared memory, we will provide the algorithm with virtual shared memory, which is memory backed by global memory.

Closes #553 and #1082

The plan is to put the new vsmem utility to use in a follow-up PR by integrating it into DeviceMergeSort for further evaluation. Once the API has proven to be robust, I'll add further documentation in the Developer Overview.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@elstehle elstehle requested review from a team as code owners October 25, 2023 19:45
@elstehle elstehle requested review from gevtushenko and alliepiper and removed request for a team October 25, 2023 19:45
Copy link
Contributor

@alliepiper alliepiper left a comment

Choose a reason for hiding this comment

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

Some minor nits, but otherwise lgtm

@elstehle elstehle requested a review from a team as a code owner November 10, 2023 15:16
@elstehle elstehle requested review from ericniebler and removed request for a team November 10, 2023 15:16
@elstehle elstehle merged commit 7395463 into NVIDIA:main Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

MVP for VSmem abstraction
4 participants