Skip to content

[Bug, confirmed] Multi-GPU auto-selection on ROCm picks iGPU (shared memory) over dGPU by free-memory heuristic, crashing instead of falling back — workaround: disable iGPU #7624

Closed

Description

@live1053

Note: Please do not remove the questions. Answer beside them.

  1. Did you update? pip install --upgrade unsloth unsloth_zoo YES
  2. Colab or Kaggle or local / cloud LOCAL
  3. Number GPUs used, use nvidia-smi 2 but only discreet should be used
  4. Which notebook? Please link! desktop, self built
  5. Which Unsloth version, TRL version, transformers version, PyTorch version?
  6. Which trainer? SFTTrainer, GRPOTrainer etc
Put Minimal code to reproduce error here ###Remove Hugging Face token###
###Please make sure to check formatting properly, edit if needed.###

🦥 You can also ask via our Reddit page: https://reddit.com/r/unsloth/

Environment:

  • OS: Windows 11
  • Unsloth Studio (latest, updated via unsloth studio update)
  • Hardware: dual-GPU system — AMD integrated graphics (AMD Radeon(TM) Graphics) + AMD Radeon AI PRO R9700 (gfx1201, discrete, 32GB VRAM)
  • llama.cpp backend: linked via UNSLOTH_LOCAL_LLAMA_CPP_DIR to an official llama-b10173-bin-win-hip-radeon-x64 release (confirmed via --version and presence of ggml-hip.dll)
  • Model: unsloth/Qwen3.6-27B-MTP-GGUF (UD-Q6_K_XL)

Description:

On a system with both an iGPU and a discrete AMD GPU visible via ROCm, Studio's device auto-selection for llama-server loads appears to choose based on raw reported free memory, without accounting for whether the binary actually supports that device's architecture. The iGPU reports a larger "free" figure (because it shares system RAM) and wins the selection, but the linked HIP build doesn't have compiled kernels for the iGPU's architecture, producing a hard crash rather than a graceful skip/fallback to the working discrete GPU.

Log evidence:

Startup correctly detects both devices:

Hardware detected: ROCm (HIP 7.13.99004) -- AMD Radeon(TM) Graphics
ROCm devices (2):
  [0] AMD Radeon(TM) Graphics
  [1] AMD Radeon AI PRO R9700

At model load, selection logic picks device 0 based on free memory alone:

"GGUF size: 24.2 GB, mmproj: 0.9 GB, est. KV cache: 6.2 GB, ... GPUs free: [(0, 36243), (1, 32473)], selected: [0], fit: False"

(Device 0's 36243 MB "free" is shared system RAM reported by the iGPU; device 1, the R9700, has its full 32473 MB genuinely free and is architecturally correct for the linked HIP build.)

Every retry strategy Studio attempted failed identically, confirming the device selection — not the model, vision projector, flash attention, or MTP — is the root cause:

try0 (fit off):                     exit 3221226505, "ROCm error: device kernel image is invalid", current device: 0
try1 (fit on):                      exit 3221226505, same error, current device: 0
retry (flash-attn off):             exit 3221226505, same error, current device: 0
retry (no --mmproj, text-only):     exit 3221226505, same error, current device: 0
retry (no speculative decoding):    exit 3221226505, same error, current device: 0

Final surfaced error:

"llama-server crashed at startup on both the vision and text-only attempts -- a GPU driver/runtime initialization crash, not a model or vision-projector problem. This often means an unsupported secondary GPU..."

Additional context:

  • Setting $env:ROCR_VISIBLE_DEVICES = "1" in the Studio launch script did not change device selection — no "Applied gpu_ids: CUDA_VISIBLE_DEVICES=..." line appears anywhere in the affected logs, and both ROCm devices are still enumerated at startup, suggesting Studio's internal gpu_ids selection logic runs independently of/overrides this environment variable for the llama-server launch path.
  • No GPU/device-selection control was found in Studio's UI (checked the model's Run/Configuration panel and Settings → System → Live monitor / GPU devices — both are read-only or lack a device picker).
  • Settings → System → GPU devices only lists one device (AMD Radeon(TM) Graphics, GPU 0) despite the backend correctly detecting two — possibly a related display bug in the same selection logic.

Suggested fix: Either (a) don't select a device purely by reported free memory on ROCm multi-GPU systems — check architecture/compute-capability compatibility with the linked llama.cpp build first, or catch the "device kernel image is invalid" failure mode and retry on the next candidate device before surfacing an error, or (b) expose a manual GPU/device override in the UI so users on asymmetric multi-GPU (iGPU + dGPU) systems aren't dependent on the heuristic and don't have to disable a device system-wide as a workaround.

Confirmation: Disabling the iGPU in Windows Device Manager (Device Manager → Display adapters → AMD Radeon(TM) Graphics → Disable) resolves the issue completely. With only the R9700 visible to ROCm, the model loads successfully and generates at ~36 t/s — matching expected throughput with MTP speculative decoding active. This confirms the iGPU was being selected instead of the R9700, and that no model/vision-projector/flash-attention/MTP factor was involved — purely a device-selection defect.

Activity

  1. eslam-ahmed43 commented on Jul 30, 2026

    @eslam-ahmed43

    Hi, I would like to work on this issue if it is still available. I will look into it and open a PR when ready.

  2. 15 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions