Skip to content

[Engine] AMD: skip the integrated GPU when a discrete one exists - #333

Merged
VecSzn merged 2 commits into
simplexai-labs:mainfrom
okada-shogo:port/hip-skip-igpu
Nov 25, 2026
Merged

VecSzn merged 2 commits into
simplexai-labs:mainfrom
okada-shogo:port/hip-skip-igpu

Conversation

@okada-shogo

Copy link
Copy Markdown
Contributor

Problem and result

On some AMD setups the Ryzen iGPU is listed as HIP device 0 in front of the real card (seen on WSL with ROCm 10.2; ROCm 7.2.4 hid it). strata-poly used device 0, and rocBLAS aborted on the iGPU (gfx1036).

Now, on HIP builds, an integrated device (hipDeviceProp_t.integrated, or arch gfx90c/gfx1035/gfx1036/gfx1103/gfx1150-1153) is left out when a discrete device exists. One line on stderr says what was chosen:

strata-poly: GPU device 1 of 2: skipped 1 integrated device(s); set HIP_VISIBLE_DEVICES to choose by hand

Device list Used
iGPU, discrete the discrete one
only an iGPU the iGPU
two discrete both, in order (as before)
HIP_VISIBLE_DEVICES, ROCR_VISIBLE_DEVICES, CUDA_VISIBLE_DEVICES or GPU_DEVICE_ORDINAL set every visible device, nothing skipped

CUDA and Metal are unchanged (the new code is compiled only for HIP). The same code serves the Qwen models, since they run in the same Engine.

Related discussion

None.

Approach

  • device_pick.hpp: the choice as a pure function over a device list.
  • engine.cpp: device_ids() reads the devices once on HIP; Engine::open sets the first one, and a layer split (and STRATA_POLY_CARDS) maps its parts onto that list in turn.
  • --expert-gpu still takes a raw device index.

Validation

Passed:

  • poly_device_pick_test (no GPU): iGPU first, iGPU second, only an iGPU, two discrete, flag-only iGPU, arch with :xnack- suffix, env override.
  • Builds, 0 errors: HIP gfx1201 (ROCm 7.2.4 and 10.2) and CUDA sm_75 (CUDA 12.9).
  • Live, Ryzen 7 7800X3D + RX 9070 XT, ROCm 10.2, Inkling 2 Mini IQ4_NL, 302-token prompt + 16 tokens:
Run Device chosen Result
main, default 9070 XT (here the iGPU is device 1) ok, 59.3 tok/s decode
this PR, default 9070 XT, line: GPU device 0 of 2: skipped 1 integrated device(s) ok, 60.3 tok/s decode
main, HIP_VISIBLE_DEVICES=1,0 (iGPU first) iGPU aborts: rocBLAS has no gfx1036 tables
this PR, HIP_VISIBLE_DEVICES=1,0 iGPU (env kept exactly) same abort, by design

Failed:

  • None.

Not run:

  • A default run where the iGPU is listed first without an env variable: this machine lists the 9070 XT first, so the abort above was reproduced only through the env order.
  • Metal build.

Limits

  • An iGPU that reports neither integrated nor a listed arch would still be seen as discrete; use HIP_VISIBLE_DEVICES then.
  • To use the iGPU together with a card, set HIP_VISIBLE_DEVICES=0,1.
  • --expert-gpu N and the separate Qwen 3.6 engine (qwen35/) are not changed.

🤖 Generated with Claude Code

okada-shogo and others added 2 commits November 25, 2026 10:25
…xists

Some setups (WSL, ROCm 10.2) list the Ryzen iGPU as HIP device 0, and the engine
used device 0, so rocBLAS aborted there. HIP_VISIBLE_DEVICES / ROCR_VISIBLE_DEVICES
still choose exactly. One log line says which device and why. CUDA and Metal unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@VecSzn
VecSzn merged commit 18936ae into simplexai-labs:main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants