Repository navigation
studio: prefer system ROCm over the regressed bundled runtime on bare-metal Strix Halo (#6276) - #7295
danielhanchen wants to merge 1 commit into
Conversation
…ix Halo The gfx1151 llama.cpp prebuilt bundles a regressed TheRock ROCm runtime whose libhsa-runtime64 segfaults at HIP init on bare-metal Strix Halo (unslothai#6276), so every model / embedder load crashes (code -11) while a Vulkan build works. Extend the existing WSL-only _wsl_system_rocm_lib_dirs (which already shadows a bad bundled HIP with the system one) to also return the system ROCm lib dirs on bare-metal Strix Halo (detected via /proc/cpuinfo) when a system HIP runtime is present. The bundle still supplies libggml-hip / librocblas gfx1151 kernels; the driver-matched system libamdhip64 / libhsa-runtime64 drive the GPU. Applied identically to the serve-time and install-validation mirrors so a prebuilt that validates runs the same. No-op without system ROCm or on any non-Strix arch; UNSLOTH_LLAMA_NO_SYSTEM_ROCM=1 opts out. The complete fix is repinning the bundled runtime to a good TheRock nightly in the llama.cpp prebuilt CI; this is the in-repo mitigation.
There was a problem hiding this comment.
Code Review
This pull request updates the ROCm library detection logic to shadow the bundled HIP runtime with the system ROCm on WSL and bare-metal Strix Halo systems, preventing segfaults. The feedback suggests simplifying the regex search in /proc/cpuinfo to target only Ryzen AI Max, as GPU names and codenames do not appear in CPU metadata.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| _cpu = fh.read() | ||
| except OSError: | ||
| return [] | ||
| if not re.search(r"Ryzen AI Max|Radeon 80[0-9]0S|Strix Halo", _cpu): |
There was a problem hiding this comment.
Searching for GPU names (like Radeon 80[0-9]0S) or development codenames (like Strix Halo) inside /proc/cpuinfo is ineffective because /proc/cpuinfo only exposes CPU-specific metadata (such as the processor brand string from CPUID, e.g., AMD Ryzen AI Max 395). GPU and codename strings do not appear in /proc/cpuinfo.
Since all Strix Halo CPUs are branded as Ryzen AI Max, simplifying the regex to match only Ryzen AI Max is sufficient and avoids searching for non-existent strings in /proc/cpuinfo.
| if not re.search(r"Ryzen AI Max|Radeon 80[0-9]0S|Strix Halo", _cpu): | |
| if not re.search(r"Ryzen AI Max", _cpu): |
| _cpu = fh.read() | ||
| except OSError: | ||
| return [] | ||
| if not re.search(r"Ryzen AI Max|Radeon 80[0-9]0S|Strix Halo", _cpu): |
There was a problem hiding this comment.
Searching for GPU names (like Radeon 80[0-9]0S) or development codenames (like Strix Halo) inside /proc/cpuinfo is ineffective because /proc/cpuinfo only exposes CPU-specific metadata (such as the processor brand string from CPUID, e.g., AMD Ryzen AI Max 395). GPU and codename strings do not appear in /proc/cpuinfo.
Since all Strix Halo CPUs are branded as Ryzen AI Max, simplifying the regex to match only Ryzen AI Max is sufficient and avoids searching for non-existent strings in /proc/cpuinfo.
| if not re.search(r"Ryzen AI Max|Radeon 80[0-9]0S|Strix Halo", _cpu): | |
| if not re.search(r"Ryzen AI Max", _cpu): |
|
Closing in favor of #7233, which solves the same bundled-HIP-crash problem more generally: it prepends system ROCm on any native Linux AMD host (gated on a bundled HIP runtime plus /dev/kfd), so Strix Halo (#6276) is covered as a subset. I have pushed the one thing this PR had that #7233 lacked (the UNSLOTH_LLAMA_NO_SYSTEM_ROCM opt-out) directly onto #7233. |
What
Mitigate #6276: the gfx1151 (Strix Halo) llama.cpp prebuilt bundles a regressed TheRock ROCm runtime whose
libhsa-runtime64jumps through a bad function pointer inrocr::AMD::GpuAgent::InitDma()at HIP init, so on bare-metal Strix Halo every model / embedder load segfaults (exit code -11). Users confirm dropping in a Vulkan llama.cpp build works, i.e. the bundled ROCm runtime is the culprit. It also surfaces as the misleading "llama.cpp prebuilt lacks MTP support" warning.How
There is already a WSL-only helper,
_wsl_system_rocm_lib_dirs, that prepends the system ROCm lib dirs ahead of the bundle so the working system HIP drives the GPU while the bundle still supplieslibggml-hip/librocblas(the gfx1151 kernels). This extends it to also cover bare-metal Strix Halo:/proc/cpuinfoidentifies a Strix Halo (Ryzen AI Max/Radeon 80[0-9]0S/Strix Halo) and a system HIP runtime (libamdhip64/libhsa-runtime64) is present under/opt/rocm/lib*, return those dirs so they shadow the regressed bundled runtime.Applied identically to both mirrors (
llama_cpp.pyserve-time andinstall_llama_prebuilt.pyinstall-validation) so a prebuilt that passes validation runs the same way at serve time (executable logic verified byte-identical).Safety
/proc/cpuinfogate) and when system ROCm is absent.UNSLOTH_LLAMA_NO_SYSTEM_ROCM=1opts out entirely.Note
The complete fix is upstream: repin the bundled ROCm runtime in the
unslothai/llama.cppgfx1151 prebuilt CI to a good TheRock nightly (the regressed build is what ships today). This PR is the in-repo mitigation for users who have a working system ROCm.ast.parseclean on both files.