Skip to content

studio: prefer system ROCm over the regressed bundled runtime on bare-metal Strix Halo (#6276) - #7295

Closed
danielhanchen wants to merge 1 commit into
mainfrom
fix/llama-strix-system-rocm
Closed

danielhanchen wants to merge 1 commit into
mainfrom
fix/llama-strix-system-rocm

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What

Mitigate #6276: the gfx1151 (Strix Halo) llama.cpp prebuilt bundles a regressed TheRock ROCm runtime whose libhsa-runtime64 jumps through a bad function pointer in rocr::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 supplies libggml-hip / librocblas (the gfx1151 kernels). This extends it to also cover bare-metal Strix Halo:

  • WSL ROCDXG path: unchanged.
  • Bare-metal: if /proc/cpuinfo identifies 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.py serve-time and install_llama_prebuilt.py install-validation) so a prebuilt that passes validation runs the same way at serve time (executable logic verified byte-identical).

Safety

  • No-op on any non-Strix arch (the /proc/cpuinfo gate) and when system ROCm is absent.
  • For gfx1151 the bundled runtime already segfaults (so validation already fails / CPU-fallback today); preferring system ROCm can only improve that path.
  • UNSLOTH_LLAMA_NO_SYSTEM_ROCM=1 opts out entirely.

Note

The complete fix is upstream: repin the bundled ROCm runtime in the unslothai/llama.cpp gfx1151 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.parse clean on both files.

…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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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):

@danielhanchen

Copy link
Copy Markdown
Member Author

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.

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.

1 participant