Repository navigation
Unsloth Studio (AMD): pick a discrete GPU that fits over a larger APU in automatic GPU selection - #13196
Conversation
…matic GPU selection
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The problem
On a ROCm host with an APU next to a discrete card (for example a Strix Halo or Strix Point APU plus a Radeon dGPU), automatic GPU selection for training and Transformers loads can put the model on the APU even when the discrete card has room for it.
auto_select_gpu_idsranks candidates by free memory only. For a ROCm APU,_reconcile_rocm_unified_memorywidens the row to the shared GTT pool, so with 96 GB of shared memory the APU reports far more free memory than a 24 GB discrete card and is picked first. The unified-memory flag already exists on the torch inventory rows (_rocm_known_unified), but selection never read it.The change
Before the existing ranked loop, on ROCm only and only when more than one GPU is a candidate: if the top-ranked device is a unified-memory APU and a discrete card alone has enough free memory for the estimate, that discrete card goes first. Everything else is unchanged:
Tests
studio/backend/tests/test_rocm_apu_discrete_first.py, with the selection inputs stubbed:The first case fails on main and passes here; the four controls pass on both. The related Studio backend suites (
test_gpu_selection_sandbox,test_training_gpu_arch_gate,test_training_vram_coexistence,test_rocm_multi_gpu_vram_system_wide,test_rocm_live_telemetry_hip_ids) give the same results on main and on this branch, as dotest_gpu_selection.pyandtest_chat_load_during_training.py(245 passed on main plus the new test; the only difference in failing test IDs is the new case).No host with an AMD APU and a discrete card was available, so this is shown with stubbed device rows.
The desktop Ryzen iGPU case from #8847
The same ranking hits a desktop Ryzen 7000 / 9000 with its integrated graphics enabled beside a Radeon card on Windows ROCm. The AMD multi-arch Windows wheel has kernels for the gfx1036 iGPU, so the arch gate from #8791 keeps it as a candidate, and its free reading is the WDDM shared pool, half of system RAM. On a 32 GB machine that is about 16 GB, level with an RX 7800 XT.
Selection inputs stubbed to that host (iGPU HIP 0 with a shared pool of RAM / 2, RX 7800 XT HIP 1 with 15.4 GB free), every RAM size in {24, 32, 48, 64, 96} GB x model estimate in {6, 10, 14, 20} GB, 20 cells:
12 cells move, all to the discrete card and all where it fits alone; the 8 others are identical.
Related: #8847