Repository navigation
Description
Possible regression from the fix for #7208 (system-ROCm prepend on native Linux).
Environment:
- Unsloth Desktop (AppImage, Linux), fresh install — reproduces identically after full uninstall/reinstall
- OS: CachyOS (Arch-based), native Linux (
/dev/kfdpresent, no/dev/dxg) - GPU: AMD Radeon RX 7900 XTX (RDNA 3, gfx1100), 24 GB
- CPU: AMD Ryzen 7 9800X3D
- System ROCm 7.2 properly installed;
rocminfosees gfx1100 - Studio venv PyTorch: ROCm build (HIP 7.2.26015),
torch.cuda.is_available()= True - llama.cpp prebuilt: build 11798 (ec0da70e9), "Compiled by the Unsloth team"
What happens:
Loading a GGUF model (reproduced with unsloth/LFM2.5-24B-A2B-GGUF, UD-Q4_K_XL) and prompting it shows CPU-bound inference: the model is resident in system RAM (~20 GB RSS on llama-server), the GPU stays idle. There is no error or warning anywhere, even at --verbosity 4.
The studio's planner correctly detects the GPU via PyTorch and builds a full offload plan, so the launch flags (-ngl -1, etc.) are all correct. The failure is purely in library resolution at llama-server startup: the GPU never gets registered as a device.
Log excerpt from the studio-launched llama-server (~/.unsloth/studio/logs/llama-server/):
device_info:
- CPU : AMD Ryzen 7 9800X3D 8-Core Processor (...)
load_tensors: CPU model buffer size = 6133.85 MiB
load_tensors: CPU_REPACK model buffer size = 8046.00 MiB
llama_kv_cache: CPU KV buffer size = 2560.00 MiB
sched_reserve: CPU compute buffer size = 217.02 MiB
No ROCm0 entry in device_info; no WARN/ERR lines.
Root cause:
The spawn environment the studio gives llama-server sets:
LD_LIBRARY_PATH=/opt/rocm/lib:/opt/rocm/lib/llvm/lib:~/.unsloth/llama.cpp/build/bin:~/.unsloth/studio/unsloth_studio/lib/python3.13/site-packages/torch/lib
With /opt/rocm/lib first, the dynamic loader shadows the ROCm libraries bundled with the llama.cpp build with the system ROCm installation's copies. On this machine that combination makes the HIP backend fail to initialize silently — the GPU is never registered, and -ngl -1 becomes a no-op.
Verified by bisection of the spawned process environment (captured from /proc/<pid>/environ, 117 variables): LD_LIBRARY_PATH is the only variable whose presence hides the GPU, and within it, only the /opt/rocm/lib entry is sufficient.
Minimal reproduction, no model load needed:
# Bare invocation (clean environment) — GPU IS detected:
~/.unsloth/llama.cpp/llama-server --list-devices
# → ROCm0: AMD Radeon RX 7900 XTX (24560 MiB, ...)
# Same binary with /opt/rocm/lib injected — GPU VANISHES:
LD_LIBRARY_PATH=/opt/rocm/lib ~/.unsloth/llama.cpp/llama-server --list-devices
# → Available devices:
# (none)
The remaining studio paths (/opt/rocm/lib/llvm/lib, build/bin, torch's lib) individually do not hide the GPU.
Relation to prior issues:
This looks like the mirror image of #7208, and part of a broader pattern in which different AMD setups need opposite LD_LIBRARY_PATH orderings:
- #7208 (July, RX 7800 XT, also gfx1100, also native Linux with system ROCm 7.2.x): the bundled ROCR runtime crashed in
hsa_init(), and llama-server silently fell back to CPU. The suggested and implemented fix was to prepend/opt/rocm/libahead of the bundled HIP runtime on native Linux (the workaround had previously been gated to WSL only). - #7307 / PR #7233 (July, RDNA4 / gfx1201): the prebuilt llama-server segfaulted immediately. Fixed by the same change — prepending system ROCm libs ahead of the bundled HIP runtime, applied arch-agnostically.
- #6276 (June, Strix Halo, gfx1151): the bundled ROCm runtime was the broken side — SIGSEGV during GPU agent initialization. The working workaround was the opposite direction: remove the bundled ROCm runtime libraries from
build/binentirely so everything resolves to system ROCm. - This report (October, RX 7900 XTX, gfx1100, ROCm 7.2): the system-ROCm prepend from the [Bug] [ROCm] llama-server silently falls back to CPU on native Linux AMD: bundled ROCR runtime crashes in
hsa_init(), system-ROCm override only applied on WSL #7208/fix(rocm): prepend system ROCm libs on native Linux to avoid bundled HIP crash #7233 fix now shadows the bundled runtime on a machine where the bundled runtime works and the system one is the mismatch — silently removing the GPU entirely.
Put together: two gfx1100 users on native Linux with system ROCm 7.2 need opposite orderings (bundled-first here, system-first in #7208), RDNA4 needs system-first, and gfx1151 needed system-only. Presumably the shipped bundles carry different ROCR builds over time, each compatible with different subsets of host drivers and system-ROCm versions — so any fixed ordering will keep breaking one subset of AMD hosts.
Workaround (verified working):
Replace the ~/.unsloth/llama.cpp/llama-server symlink with a wrapper that strips /opt/rocm/lib from LD_LIBRARY_PATH before exec-ing the real binary:
#!/bin/bash
if [ -n "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH=$(echo "$LD_LIBRARY_PATH" | tr ':' '\n' | grep -v '^/opt/rocm/lib$' | paste -sd:)
fi
exec ~/.unsloth/llama.cpp/build/bin/llama-server "$@"
After applying, all buffers land on the GPU and inference runs at GPU speed:
load_tensors: ROCm0 model buffer size = 14179.85 MiB
llama_kv_cache: ROCm0 KV buffer size = 2560.00 MiB
sched_reserve: ROCm0 compute buffer size = 213.01 MiB
Suggestions:
- Detection over ordering: probe GPU visibility (e.g.
run --list-devicesor checkhsa_init) with and without the system ROCm prepend at spawn time, and keep whichever ordering actually detects the GPU. Any fixed ordering will keep breaking one subset of AMD hosts — the four issues above each needed a different one. - Fail loudly: when the user requested GPU offload (
-ngl > 0) and no GPU backend initializes, emit a prominent warning instead of silently serving on CPU. [Bug] [ROCm] llama-server silently falls back to CPU on native Linux AMD: bundled ROCR runtime crashes inhsa_init(), system-ROCm override only applied on WSL #7208's author asked for the same thing — the silent fallback is what makes this costly to diagnose. The only observable symptom is slow tokens.
Activity
danielhanchen commentedon Oct 23, 2026
Fixed! Studio put the system ROCm libraries ahead of the ROCm runtime bundled with llama.cpp on native Linux, and on hosts like yours where the system copy does not match, the GPU silently vanished and the model ran on the CPU. Studio now checks once whether llama-server can see the GPU with that ordering, and if it only sees it with the bundled runtime, it uses the bundled runtime and logs a warning. Hosts where the system ROCm ordering is the one that works keep it. Fixed in #14933, which will be in the next Studio / Desktop release. Thanks for the detailed bisection, it made this easy to pin down. Reopen if it still happens.
Studio (AMD Linux): keep the bundled ROCm runtime when the system ROC…
carottemendoza commentedon Oct 23, 2026
Awesome! Thank you very much!