Fix NN-descent L2 norm shared memory opt-in#2310
Open
tkcaccia wants to merge 1 commit into
Open
Conversation
Author
|
Thanks for the automated checks. I do not have permission to add labels on this repository. Could a maintainer please add the required Label Checker labels? Suggested labels:
This PR fixes the NN-descent CUDA launch failure reported in #2267 and does not change public API or intended behavior. |
Contributor
|
/ok to test 5ec35c4 |
Contributor
|
Thanks for the PR @tkcaccia ! It looks like the style checks are failing. Could you run the pre-commit hooks? It'll fix the style for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2267.
Summary
This PR fixes a CUDA launch failure in cuVS NN-descent when the L2 norm kernel requires more dynamic shared memory than the default per-block launch limit.
For high-dimensional FP32 L2 input, for example a
1440 x 16384host DLPack tensor passed through the cuVS C API,cuvsNNDescentBuildcan fail after launchingcompute_l2_norms_kernelwith:The dynamic shared-memory request for
dim = 16384andfloatinput is 65536 bytes, which is larger than the usual default dynamic shared-memory launch limit but within the opt-in limit on the tested GPU.Change
The patch adds a small helper around
compute_l2_norms_kernelthat:cudaDevAttrMaxSharedMemoryPerBlockOptinfor the current device;cudaFuncSetAttribute(..., cudaFuncAttributeMaxDynamicSharedMemorySize, ...)before launching the kernel.The helper is used at both NN-descent L2 norm launch sites.
Validation
Locally in this PR checkout:
I could not build CUDA/cuVS on the local macOS machine used to prepare the PR. The same fix was previously validated by rebuilding cuVS 26.06.00 on a Linux CUDA machine and rerunning the reproducer described in #2267:
The change does not alter the NN-descent algorithm and does not introduce a fallback to another method.