Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The 2 MiB minimum-page-size fallback assumes alignment that non-VMM allocations do not guarantee, potentially leaving disjoint-pool slabs undersized and causing out-of-bounds writes.
1 open issue
What changed in this PR
This PR lets the CUDA memory provider initialize when a device does not support virtual memory management, which its allocation APIs do not require.
Changes:
- Centralizes CUDA allocation-granularity queries in a helper.
- Returns a 2 MiB fallback for
CUDA_ERROR_NOT_SUPPORTED, while preserving other errors. - Uses the helper during initialization and both page-size queries.
| File | Description |
|---|---|
src/provider/provider_cuda.c |
Adds the fallback helper and replaces three direct granularity queries. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
The CUDA_ERROR_NOT_SUPPORTED fallback lacks deterministic test coverage for successful provider creation, the 256-byte minimum, the 2 MiB recommendation, and continued failure on other CUDA errors.
1 open issue
1 resolved since last review
Review effort: Balanced
Comment on lines
+176
to
+179
| if (cu_result == CUDA_ERROR_NOT_SUPPORTED) { | ||
| *granularity = (option == CU_MEM_ALLOC_GRANULARITY_RECOMMENDED) | ||
| ? CU_FALLBACK_RECOMMENDED_GRANULARITY | ||
| : CU_FALLBACK_MIN_GRANULARITY; |
This branch has not been deployed
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.


Description
On a Windows machine with an NVIDIA A100 GPU without VMM,
cuMemGetAllocationGranularity()returnsCUDA_ERROR_NOT_SUPPORTED. This makespost_initializefail, so the CUDA provider can't be created. The provider allocates withcuMemAlloc,cuMemHostAllocandcuMemAllocManaged, which don't need virtual memory management (VMM).