Repository navigation
feature/use lemonade-sdk llamacpp-rocm binaries - #5303
danielhanchen merged 38 commits into
Conversation
…Cm hosts
For AMD GPUs that rocminfo/hipinfo reports a recognised gfx target
(gfx103X / gfx110X / gfx1150 / gfx1151 / gfx120X), resolve_lemonade_rocm_choice()
now fetches the latest lemonade-sdk/llamacpp-rocm release and returns the
matching per-architecture zip, bundling all required ROCm runtime libs.
This runs before the existing upstream ggml-org combined-ROCm tarball fallback
on Linux and before the upstream HIP zip on Windows, so both platforms benefit
from the more targeted build when available.
Changes:
- Add LEMONADE_ROCM_REPO / LEMONADE_ROCM_RELEASES_API constants
- Add HostInfo.rocm_gfx_target populated from rocminfo (Linux) / hipinfo (Windows)
- Add _LEMONADE_GFX_FAMILIES prefix map and _lemonade_gfx_family() helper
- Add resolve_lemonade_rocm_choice() that fetches latest lemonade release and
constructs the llama-{tag}-{os}-rocm-{gfxFamily}-x64.zip asset URL
- Wire into resolve_upstream_asset_choice() for both Linux (ubuntu) and Windows paths
There was a problem hiding this comment.
Code Review
This pull request introduces support for per-GPU ROCm prebuilts from the lemonade-sdk repository. It updates the host detection logic to identify specific ROCm graphics targets (e.g., gfx1100) and implements a resolution mechanism that prioritizes these specialized assets for both Linux and Windows before falling back to upstream releases. Review feedback suggests externalizing the hardcoded GPU family mapping to a configuration file for better maintainability and refining the exception handling in the network request logic to avoid broad catch-all blocks.
| # Map detected gfx IDs to lemonade-sdk asset family suffixes. | ||
| # More-specific prefixes must come before shorter ones (e.g. gfx1151 before gfx110). | ||
| _LEMONADE_GFX_FAMILIES: list[tuple[str, str]] = [ | ||
| ("gfx1151", "gfx1151"), | ||
| ("gfx1150", "gfx1150"), | ||
| ("gfx120", "gfx120X"), | ||
| ("gfx110", "gfx110X"), |
There was a problem hiding this comment.
| ) | ||
| return None | ||
| try: | ||
| release = fetch_json(LEMONADE_ROCM_RELEASES_API) | ||
| except Exception as exc: |
There was a problem hiding this comment.
Avoid using broad exception handlers like except Exception. Instead, catch specific exceptions and ensure the exception is logged (at least at a debug level) to aid in troubleshooting. If a failure is expected, log the specific exception type and its details.
References
- Avoid broad except Exception clauses. Instead, catch specific exceptions and log them (at least at a debug level) to aid in troubleshooting.
The resolver always fetched lemonade-sdk/llamacpp-rocm's /releases/latest,
ignoring the upstream llama.cpp tag the caller had pinned. On a reproducible
install where the user requested 'b1260' that meant we would silently pick
up whatever lemonade had published as latest at install time, with no way
to roll back to the matching tag.
Lemonade tags llama.cpp upstream tags 1:1, so:
- When llama_tag is unset or 'latest', keep hitting /releases/latest.
- When llama_tag is pinned (e.g. 'b1260'), hit /releases/tags/b1260.
- When the pinned tag is not published by lemonade (404), skip silently
and let the caller fall through to the upstream tarball -- this keeps
pinned installs reproducible instead of drifting.
resolve_lemonade_rocm_choice now takes llama_tag (default 'latest' for
backward compatibility) and both call sites in resolve_upstream_asset_choice
forward the upstream llama_tag to it.
Note: this PR still has open integration concerns flagged in review --
the simple-policy planner and approved-checksum manifest don't yet route
or accept lemonade assets. Those are larger changes and not in scope for
this commit; addressing the pinned-tag drift independently because it is
small, localized, and self-contained.
Validates GPU family mapping and that resolve_lemonade_rocm_choice returns real lemonade release URLs for all supported gfx targets on both Linux and Windows, without requiring AMD hardware.
|
Added a mock test to validate the installer logic without needing the hardware: studio/backend/tests/test_lemonade_llamacpp_rocm_bins_mock.py The test fakes HostInfo with each supported rocm_gfx_target and hits the real lemonade GitHub API to confirm the installer would actually find and download the right binary. No AMD GPU required. Results against lemonade release b1261: All supported GPU families resolve to real assets on both Linux and Windows. Unknown GPUs cleanly fall through to the upstream build as expected. |
setup.sh invokes install_llama_prebuilt.py with --simple-policy, which dispatches through resolve_simple_install_release_plans -> direct_linux_release_plan (or direct_upstream_release_plan on Windows). Those planners only handled CUDA + CPU attempts, so ROCm-only hosts (e.g. gfx1151 Strix Halo) had no compatible prebuilt asset and silently fell through to source build, even though resolve_lemonade_rocm_choice already knew how to fetch a per-GPU lemonade-sdk binary. Add a lemonade ROCm/HIP attempt to both simple-policy planners for ROCm-only hosts, and add regression tests that drive the dispatchers end-to-end so this can't be skipped silently again.
The lemonade-sdk asset filename uses "ubuntu" as a label, but the binary is a manylinux-style glibc build with no Ubuntu-specific dependencies. It runs on Arch, Fedora, openSUSE, Debian, etc. as long as the host glibc is recent enough. No behavior change -- the dispatch already runs for any Linux ROCm host. This commit only clarifies the comment, docstring, and log message so users on non-Ubuntu distros (e.g. Strix Halo on Arch) don't mistake the asset name for distro gating.
…atternfix Pattern matching fix for libggml-cpu*.so*
|
GPU: gfx1030 (amd 6950 XT) |
|
Seems to work for me on gfx1100 Lemonade downloads during install, inference and a quick training run of gemma4-E2B worked |
|
Strix Halo (gfx1151), Arch Linux (Kernel 7.0.3), ROCm 7.2.3 (on host) Both training and GGUF inference were successful. |
|
successfully built on my machine RX 9060 xt: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57ed615cec
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b2402d9b4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@danielhanchen @rolandtannous pls review, lemonade rocm builds are life-time-savers for amd rdna3/4cards |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b426c12b9a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…IP fallback; stub API in tests - direct_linux_release_plan: pass bundle.upstream_tag (not requested_tag) to resolve_lemonade_rocm_choice so a "latest" request doesn't mix a newer lemonade binary with an older planned unsloth release (Codex P2) - direct_upstream_release_plan: same fix on the Windows path (release_tag instead of requested_tag); also add the upstream HIP asset (llama-<tag>-bin-win-hip-radeon-x64.zip) as a fallback between lemonade and CPU so unsupported GPUs or transient lemonade failures don't silently downgrade to CPU when an upstream ROCm prebuilt exists (Codex P2) - test file: stub fetch_json with a synthetic lemonade release payload so the suite is hermetic and not subject to GitHub API rate limits (Codex P1); add test_simple_policy_windows_hip_falls_back_to_upstream_when_lemonade_unavailable to cover the new HIP fallback path
…tic tests The previous commit wrongly passed bundle.upstream_tag / release_tag to resolve_lemonade_rocm_choice. Lemonade uses its own versioning (b1262, b1264, …) completely independent of unslothai's tags (b9186, …), so passing a resolved unslothai tag caused a 404 and silently skipped the lemonade binary entirely. Revert both call sites to requested_tag. Keep the two valid fixes from the prior commit: - Upstream HIP fallback (llama-<tag>-bin-win-hip-radeon-x64.zip) between lemonade and CPU in direct_upstream_release_plan, so unsupported GPUs or transient lemonade failures don't silently downgrade to CPU (Codex P2) - Stub fetch_json in tests so the suite is hermetic (Codex P1)
|
@LeoBorcherding ran No preflight failure, no source-build fallback. The bundle activates and runs. Post-install state on
Sequence across all four passes:
Two small observations, neither blockers:
LGTM from the gfx1151 side — ready to merge. Repro: https://github.com/h34v3nzc0dex/strix-halo-llm-finetune-guide/tree/main/pr-5303-validation (Pass 4 section, plus the full verbose log + |
Store binary_repo and binary_release_tag in UNSLOTH_PREBUILT_INFO.json so the setup.sh summary can distinguish the source tree (unslothai/llama.cpp) from the actual binary origin (lemonade-sdk/llamacpp-rocm). Before: 'installed release: unslothai/llama.cpp@b9334' After: 'installed release: unslothai/llama.cpp@b9334 + lemonade@b1280' Upstream installs are unchanged (binary_repo == published_repo).
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@LeoBorcherding confirmed Before ( After (
{
"source": "lemonade",
"published_repo": "unslothai/llama.cpp",
"release_tag": "b9334",
"binary_repo": "lemonade-sdk/llamacpp-rocm",
"binary_release_tag": "b1280",
"asset": "llama-b1280-ubuntu-rocm-gfx1151-x64.zip"
}Install still completes cleanly — 80 Full verbose log + JSON snapshot in |
|
Thanks for the quick re-run. Should be ready for merge. |
Resolve conflict in studio/install_llama_prebuilt.py: Keep feature-branch runtime_patterns_for_choice() which preserves explicit per-lib patterns for linux-cpu/cuda and adds the broad lib*.so* glob for linux-rocm to capture the full bundled HIP/ROCm runtime shipped by Lemonade prebuilts. Upstream simplified this to a single lib*.so* for all linux targets; the feature-branch version is a strict superset and retains the ROCm-specific documentation.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@LeoBorcherding ran Verification on the activated install:
The conflict resolution in One pre-existing wart that's not new in this commit and not blocking: bitsandbytes prerelease wheel (1.33.7rc0 from continuous-release_main, manylinux_2_24 tag) fails to install on our py3.13 stack — Studio's "bnb pre-release unreachable; falling back to PyPI" path catches it cleanly and continues. Same behavior on every pass back to c41e20d. Worth noting only because the error line surfaces in the install output. Full verbose log + ldd output: |
…cm-prebuilts # Conflicts: # studio/install_llama_prebuilt.py
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
…x branch - elif host.has_rocm instead of if...not to match fix/rocm-strix-halo-unified-memory - _resolve_exe instead of _resolve_amd_exe with identical body/docstring Eliminates the two conflict hunks that would otherwise block a clean bot merge of feature/lemonade-rocm-prebuilts on top of fix/rocm-strix-halo-unified-memory.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
|
||
| When llama_tag is unset or "latest", point at /releases/latest. When the | ||
| caller has pinned a specific tag (e.g. "b1260"), point at the same tag in | ||
| lemonade. Lemonade tags match `ggml-org/llama.cpp` upstream tags 1:1 |
There was a problem hiding this comment.
Lemonade tags match
ggml-org/llama.cppupstream tags 1:1
This isn't true, eg latest lemonade is b1281
but latest ggml-org is b9370
Just a docstring issue.
There was a problem hiding this comment.
thank you! fixed it, appreciate the help!
- _lemonade_release_api_for: fix docstring claiming lemonade tags match ggml-org 1:1 -- lemonade may be several builds behind ggml-org (noted by oobabooga, confirmed: lemonade b1281 vs ggml-org b9370) - direct_linux_release_plan: move cpu_choice into else-branch so ROCm-only hosts never get a CPU fallback in the attempts list -- a failed lemonade binary now raises PrebuiltFallback and triggers the HIP source build instead of silently installing a CPU-only binary - apply_approved_hashes: pass lemonade attempts through without requiring a manifest entry; lemonade is explicitly documented as relying on functional validation only, so rejecting it here caused PrebuiltFallback on the non-simple-policy path before the upstream ROCm/HIP fallback could be considered
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
copy_globs matches filenames only and copies flat, so it cannot preserve the hipblaslt/library/<gfx>/ and rocblas/library/<gfx>/ Tensile kernel catalog trees that lemonade ROCm zips ship alongside the .so files. Add runtime_subdirs_for_choice() and call shutil.copytree for each named subdir after the copy_globs pass in install_from_archives.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Three fixes in this push.
|
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
2 similar comments
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
1fdb9fe to
3f5b550
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
… staging/rocm-super-merge
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
For AMD GPUs that rocminfo/hipinfo reports a recognised gfx target (gfx103X / gfx110X / gfx1150 / gfx1151 / gfx120X), resolve_lemonade_rocm_choice() now fetches the latest lemonade-sdk/llamacpp-rocm release and returns the matching per-architecture zip, bundling all required ROCm runtime libs.
This runs before the existing upstream ggml-org combined-ROCm tarball fallback on Linux and before the upstream HIP zip on Windows, so both platforms benefit from the more targeted build when available.
https://github.com/lemonade-sdk/llamacpp-rocm
Changes: