Skip to content

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

Closed

Description

@kennysamuerto

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

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)

#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:

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.

Activity

  1. danielhanchen commented on Jun 13, 2026

    @danielhanchen
    Member

    Investigating now

  2. slewsys commented on Jun 18, 2026

    @slewsys

    I don't have a commit, but the last gfx1151 ROCm nightly which does not segfault is: 7.14.0a20260608

    As of this writing, the last gfx1151 nightly upload was a week ago (2026-06-12).

  3. hafrp commented on Jul 17, 2026

    @hafrp

    The exact same problem is occuring again since updating unsloth studio with bundled llama about 2 days ago (Ryzen AI MAX+ 395).
    Also the suggested workaround still works as expected.

    Unsloth-Version
    v0.1.49-beta
    Paketversion
    2026.7.3
    llama.cpp-Version
    b10043-mix-0ac9dfb

  4. gururise commented on Jul 17, 2026

    @gururise

    Another datapoint:
    Ubuntu 26.04
    Using Official AMD rocm 7.14 deb installation

    Same exact issue.

  5. LeoBorcherding commented on Sep 2, 2026

    @LeoBorcherding
    Collaborator

    hi @kennysamuerto, this should be fixed now: #7233 (merged 07-22, shipped in 2026.7.5) prepends the system ROCm libs ahead of the bundled runtime on native Linux, and it was confirmed on gfx1151. Your setup is /opt/rocm, which the search covers, so the workaround should no longer be needed. Could you confirm on the current release (v0.1.806) so this can close? If it still segfaults, paste ls -d /opt/rocm* and ldconfig -p | grep libhsa-runtime64. Machines with ROCm somewhere other than /opt/rocm are still exposed and that's #7380, not this one.

  6. kennysamuerto commented on Sep 2, 2026

    @kennysamuerto
    Author

    Confirmed fixed on the current release. ✅

    Tested today on the same bare-metal Strix Halo machine (Ryzen AI MAX+ 395 / Radeon 8060S, gfx1151, Ubuntu 24.04, system ROCm 7.2 at /opt/rocm):

    • unsloth 2026.8.19, llama.cpp prebuilt build 10472 (commit 7a556b8f9, rocm-gfx1151)
    • ./llama-server --version and --list-devices run clean — no segfault, GPU detected (ROCm0: AMD Radeon 8060S Graphics, 131072 MiB)
    • Loaded Qwen3.6-35B-A3B-UD-Q4_K_XL (22 GB) with full GPU offload and ran inference: ~50 tok/s eval, works perfectly

    One extra data point: I deliberately forced the bundled runtime with LD_LIBRARY_PATH=$PWD (and ldd confirms libhsa-runtime64.so.1 / libamdhip64.so.7 resolve to the bundled copies, now 7.16.26323), and it works too — so on top of the #7233 system-ROCm fallback, the bundled runtime itself no longer crashes on gfx1151. The workaround from the OP is no longer needed either way.

    Fine to close from my side. Thanks!

  7. danielhanchen commented on Sep 15, 2026

    @danielhanchen
    Member

    Fixed! The system ROCm libraries are prepended ahead of the bundled runtime on native Linux now, and you confirmed gfx1151 loads and runs on the current release. ROCm installed somewhere other than /opt/rocm or the HIP and ROCM path variables is tracked separately.

    To update: Studio is unsloth studio update, Unsloth Desktop updates from its update banner, and in Docker it's docker exec <container> unsloth-studio-update.

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