ITADN

[Bug] [Studio] Bundled ROCm runtime in rocm-gfx1151 prebuilt segfaults on bare-metal Strix Halo (Ryzen AI MAX+ 395) — works with system ROCm

#6276Openkennysamuerto 创建于 2026-06-13
bug
K
kennysamuertocommented
## Summary The `rocm-gfx1151` llama.cpp prebuilts crash with `SIGSEGV` on startup on a bare-metal Strix Halo machine (Ryzen AI MAX+ 395 / Radeon 8060S, `gfx1151`). The crash occurs inside the **bundled** `libhsa-runtime64.so.1.21.0` during GPU agent initialization. The same binaries work correctly when the bundled ROCm runtime libraries are removed so the loader falls back to the system ROCm 7.2 installation. In Studio this appears as: `Failed to load model: llama-server failed to start. Check that the GGUF file is valid and you have enough memory.` This happens for every GGUF model and also breaks the DiffusionGemma visual runner (`llama-diffusion-gemma-visual-server`). ## Environment * CPU/GPU: AMD Ryzen AI MAX+ 395 with Radeon 8060S (`gfx1151`), 128 GB unified memory * OS: Ubuntu 24.04.4 LTS, kernel `6.18.7` * System ROCm: 7.2 (`hipconfig` `7.2.26015-fc0010cf6a`, `hsa-runtime` `1.18.70200`) installed at `/opt/rocm` * Affected prebuilts: * `b9601-mix-a0e2906` * `b9608-mix-5efc536` * Affected assets: * `app-b96xx-mix-*-linux-x64-rocm-gfx1151.tar.gz` from `unslothai/llama.cpp` releases * Previously working build: * `lemonade-sdk/llamacpp-rocm` * `llama-b1287-ubuntu-rocm-gfx1151-x64.zip` * installed on `2026-06-03` * worked correctly on the same machine ## Reproduction ```bash cd ~/.unsloth/llama.cpp/build/bin LD_LIBRARY_PATH=$PWD ./llama-server --version # => Segmentation fault (core dumped) # kernel: llama-server[...]: segfault at 100000001 ip 0000000100000001 ... error 14 ``` Any entry point that initializes HIP crashes. Even `--version` is enough, because it goes through `llama_supports_rpc` → backend registry → `ggml_cuda_init`. ## Backtrace (gdb, b9608) ```text #0 0x0000000100000001 in ?? () #1 rocr::AMD::GpuAgent::InitDma() from libhsa-runtime64.so.1 (bundled 1.21.0) #2 rocr::AMD::GpuAgent::PostToolsInit() #3 rocr::core::Runtime::Load() #4 rocr::core::Runtime::Acquire() #5 rocr::HSA::hsa_init() #6-9 libamdhip64.so.7 (bundled 7.14.60850) #12 hipGetDeviceCount() #13 ggml_cuda_init() from libggml-hip.so.0 ``` This looks like a call through a garbage function pointer (`ip 0x100000001`) inside the bundled HSA runtime while initializing the GPU agent. ## Workaround that fully fixes it Remove the bundled ROCm runtime libraries from `build/bin` so everything resolves to the system ROCm through `ldconfig` while keeping the bundled ggml/llama libraries: ```bash cd ~/.unsloth/llama.cpp/build/bin && mkdir -p .bundled-rocm-broken mv libhsa-runtime64.so* libamdhip64.so* libamd_comgr.so* libhipblas.so* \ libhipblaslt.so* librocblas.so* librocsolver.so* librocroller.so* \ librocprofiler-register.so* libroctx64.so* librocm_kpack.so* \ libLLVM.so* libclang-cpp.so* .bundled-rocm-broken/ ``` After this: * `--list-devices` shows `ROCm0: AMD Radeon Graphics (131072 MiB)` * models load correctly * real inference works * verified with `Qwen3.6-35B-A3B Q4_K_XL` * verified with the DiffusionGemma 26B visual runner The workaround must be re-applied after every llama.cpp update, whether through the installer, `unsloth studio update`, or the in-app update button, because the bundled libraries are restored each time. ## Suggestion Studio already special-cases essentially this same failure mode on WSL in `studio/backend/core/inference/llama_cpp.py`, via `_wsl_system_rocm_lib_dirs()`, with the comment: > The bundled bare-metal HIP can't drive WSL's /dev/dxg and segfaults on the first GPU call That same escape hatch would solve this on bare metal as well. For example: * an environment variable or setting such as `UNSLOTH_LLAMA_SYSTEM_ROCM=1` that prepends `/opt/rocm/lib` to `LD_LIBRARY_PATH` for all spawned llama.cpp binaries, including: * `llama-server` * `llama-diffusion-gemma-visual-server` * or an automatic fallback to system ROCm when the bundled-runtime probe segfaults during install-time validation I can provide core dumps, `rocminfo` output, or test candidate builds on this hardware if needed.
1 条评论