Avoid double-counting CPU RAM for integrated CUDA - #4186
Open
arpansahu wants to merge 1 commit into
Open
Conversation
Integrated CUDA devices share host memory, so exposing both the device budget and a separate CPU budget lets automatic device mapping treat one physical pool as two. Skip the CPU entry when CUDA device properties report an integrated GPU.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: arpan sahu <28574248+arpansahu@users.noreply.github.com>
Author
|
Disclosure: this contribution was prepared with AI assistance (GitHub Copilot CLI), and The defect, the fix and the regression test were verified locally: the new test fails on If your project would prefer not to take AI-assisted contributions, or you would rather this |
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.
Problem
get_max_memory()adds a separate"cpu"memory entry even when CUDA reports an integrated GPU. Integrated CUDA devices share host RAM, so downstream device-map planning can treat one physical memory pool as independent CUDA and CPU capacities. Closes #4183.Reproducer
Fix
Track whether any available CUDA device reports
is_integratedand skip adding a separate CPU memory budget in that case. The attribute is read withgetattr(..., False)so older PyTorch/device properties keep the existing behavior.Testing
Added
tests/test_modeling_utils.py::ModelingUtilsTester::test_get_max_memory_integrated_cuda_does_not_add_cpu.Before the fix:
After the fix:
Quality: