Skip to content

feature/use lemonade-sdk llamacpp-rocm binaries - #5303

Merged
danielhanchen merged 38 commits into
unslothai:mainfrom
LeoBorcherding:feature/lemonade-rocm-prebuilts
May 30, 2026
Merged

danielhanchen merged 38 commits into
unslothai:mainfrom
LeoBorcherding:feature/lemonade-rocm-prebuilts

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented May 6, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • 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

LeoBorcherding and others added 2 commits May 5, 2026 23:35
…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

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

Comment on lines +3132 to +3138
# 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"),

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

The _LEMONADE_GFX_FAMILIES list is hardcoded. Consider if this mapping needs to be updated frequently, and if so, whether it should be moved to a configuration file or fetched dynamically to avoid modifying the core logic when new GPU architectures are released.

Comment thread studio/install_llama_prebuilt.py Outdated
Comment on lines +3168 to +3172
)
return None
try:
release = fetch_json(LEMONADE_ROCM_RELEASES_API)
except Exception as exc:

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

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
  1. Avoid broad except Exception clauses. Instead, catch specific exceptions and log them (at least at a debug level) to aid in troubleshooting.

danielhanchen and others added 4 commits May 6, 2026 12:33
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.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

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:

[llama-prebuilt] AMD GPU 'gfx1151' (gfx1151) -- trying lemonade-sdk ROCm prebuilt llama-b1261-ubuntu-rocm-gfx1151-x64.zip
[llama-prebuilt] AMD GPU 'gfx1150' (gfx1150) -- trying lemonade-sdk ROCm prebuilt llama-b1261-ubuntu-rocm-gfx1150-x64.zip
[llama-prebuilt] AMD GPU 'gfx1201' (gfx120X) -- trying lemonade-sdk ROCm prebuilt llama-b1261-ubuntu-rocm-gfx120X-x64.zip
[llama-prebuilt] AMD GPU 'gfx1100' (gfx110X) -- trying lemonade-sdk ROCm prebuilt llama-b1261-ubuntu-rocm-gfx110X-x64.zip
[llama-prebuilt] AMD GPU 'gfx1030' (gfx103X) -- trying lemonade-sdk ROCm prebuilt llama-b1261-ubuntu-rocm-gfx103X-x64.zip
[llama-prebuilt] AMD GPU 'gfx1151' (gfx1151) -- trying lemonade-sdk ROCm prebuilt llama-b1261-windows-rocm-gfx1151-x64.zip
[llama-prebuilt] AMD GPU 'gfx1100' (gfx110X) -- trying lemonade-sdk ROCm prebuilt llama-b1261-windows-rocm-gfx110X-x64.zip
[llama-prebuilt] AMD GPU 'gfx999' is not covered by lemonade-sdk ROCm prebuilts; skipping lemonade prebuilt

All supported GPU families resolve to real assets on both Linux and Windows. Unknown GPUs cleanly fall through to the upstream build as expected.

LeoBorcherding and others added 6 commits May 6, 2026 23:51
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*
@adroitous

Copy link
Copy Markdown

GPU: gfx1030 (amd 6950 XT)
OS: linux

(base) vincent@vincent-G715:~/GitRepo/unsloth-pr-5303$ rm -rf ~/.unsloth/studio/unsloth_studio
(base) vincent@vincent-G715:~/GitRepo/unsloth-pr-5303$ git status
On branch feature/lemonade-rocm-prebuilts
Your branch is up to date with 'origin/feature/lemonade-rocm-prebuilts'.

nothing to commit, working tree clean
(base) vincent@vincent-G715:~/GitRepo/unsloth-pr-5303$ ./install.sh --local

  🦥 Unsloth Studio Installer
  ────────────────────────────────────────────────────

  platform       linux
  deps           all system dependencies found
  venv           creating Python 3.13 virtual environment
                 /home/vincent/.unsloth/studio/unsloth_studio
  venv           using environment
                 /home/vincent/.unsloth/studio/unsloth_studio

  AMD ROCm detected -- installing ROCm-enabled PyTorch (https://download.pytorch.org/whl/rocm6.4)

                 installing PyTorch (https://download.pytorch.org/whl/rocm6.4)...
                 installing bitsandbytes for AMD ROCm (pre-release, PR #1887)...
                 installing unsloth (this may take a few minutes)...
                 overlaying local repo (editable)...
                 overlaying unsloth-zoo from git main...
  setup          running unsloth studio update...

  🦥 Unsloth Studio Setup
  ────────────────────────────────────────────────────
                 local mode: overlaying /home/vincent/GitRepo/unsloth-pr-5303 (editable) + unsloth-zoo from git main
  frontend       up to date
  deps           [===-----------------]  2/13  ROCm torch check       bnb pre-release unreachable; falling back to PyPI (4-bit decode will be broken on ROCm)
  deps           [==========----------]  7/13  flash-attn            warning        No compatible flash-attn prebuilt wheel found
  deps           [====================] 13/13  ROCm torch (final)
   bnb pre-release unreachable; falling back to PyPI (4-bit decode will be broken on ROCm)
  deps           installed
  transformers   5.3.0 pre-installed
  transformers   5.5.0 pre-installed
                 installing prebuilt llama.cpp...
                 existing install detected -- validating update
  llama.cpp      prebuilt install failed (continuing)
                 llama.cpp diagnostics (last 120 lines):
   | [llama-prebuilt] existing llama.cpp install detected at /home/vincent/.unsloth/llama.cpp; validating staged prebuilt update before replacement
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b9022 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8955 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8902 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8884 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8811 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8779 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8778 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8746 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8733 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8724 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8720 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8712 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8702 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8699 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8698 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8690 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8679 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8676 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8665 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8663 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8660 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8656 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8648 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8647 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8641 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8639 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8637 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8635 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8604 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8595 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8591 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8583 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8581 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8508 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] published release skipped for install planning: unslothai/llama.cpp@b8495 (no compatible Linux prebuilt asset was found)
   | [llama-prebuilt] prebuilt install path failed; falling back to source build
   | [llama-prebuilt] prebuilt fallback reason: no compatible Linux prebuilt asset was found
   | platform=Linux machine=x86_64
   | driver_cuda_version=None
   | compute_caps=unknown
   | cuda_visible_devices=unset
   | has_physical_nvidia=False
   | has_usable_nvidia=False
   | chosen_asset=none
   | asset_source=none
                 prebuilt update failed; existing install restored
                 falling back to source build
                 building (CPU, ROCm driver found but hipcc missing)...
  llama.cpp      built
  llama-quantize built
  ────────────────────────────────────────────────────
  Unsloth Studio Installed
  ────────────────────────────────────────────────────
  launch         unsloth studio -p 8888
                 (add -H 0.0.0.0 to allow network / cloud access)

                 Created Unsloth Studio shortcut

  Unsloth Studio installed!
  ────────────────────────────────────────────────────

@Calandracas606

Copy link
Copy Markdown

Seems to work for me on gfx1100

Lemonade downloads during install, inference and a quick training run of gemma4-E2B worked

@jaeiclee

jaeiclee commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Strix Halo (gfx1151), Arch Linux (Kernel 7.0.3), ROCm 7.2.3 (on host)

                 requested llama.cpp tag: latest (repo: unslothai/llama.cpp)
                 installing prebuilt llama.cpp...
[llama-prebuilt] no existing llama.cpp install detected at /home/ideocl4st/.unsloth/llama.cpp; performing fresh prebuilt install
[llama-prebuilt] AMD GPU 'gfx1151' (gfx1151) -- trying lemonade-sdk ROCm prebuilt llama-b1262-ubuntu-rocm-gfx1151-x64.zip (works on any glibc Linux, not just Ubuntu)
[llama-prebuilt] AMD GPU 'gfx1151' (gfx1151) -- trying lemonade-sdk ROCm prebuilt llama-b1262-ubuntu-rocm-gfx1151-x64.zip (works on any glibc Linux, not just Ubuntu)
[llama-prebuilt] downloading tiny GGUF validation model
Downloading stories260K.gguf:  88.5% (1.0 MiB/1.1 MiB) at 1.5 MiB/s
Downloading stories260K.gguf: 100.0% (1.1 MiB/1.1 MiB) at 1.6 MiB/s
[llama-prebuilt] selected llama-b1262-ubuntu-rocm-gfx1151-x64.zip (lemonade) from published release b9022 for Linux x86_64
[llama-prebuilt] created install staging dir /home/ideocl4st/.unsloth/.staging/llama.cpp.staging-4a5hhnp5
[llama-prebuilt] hydrating upstream llama.cpp source for b9022 into /home/ideocl4st/.unsloth/.staging/llama.cpp.staging-4a5hhnp5
[llama-prebuilt] downloading llama.cpp source tree for b9022
Downloading llama.cpp-source-b9022.tar.gz:   3.1% (1.0 MiB/32.4 MiB) at 4.9 MiB/s
...
Downloading llama.cpp-source-b9022.tar.gz: 100.0% (32.4 MiB/32.4 MiB) at 17.6 MiB/s
[llama-prebuilt] downloaded llama.cpp source tree for b9022 without a published sha256; relying on install validation
[llama-prebuilt] overlaying prebuilt bundle llama-b1262-ubuntu-rocm-gfx1151-x64.zip into /home/ideocl4st/.unsloth/.staging/llama.cpp.staging-4a5hhnp5
[llama-prebuilt] downloading llama-b1262-ubuntu-rocm-gfx1151-x64.zip from lemonade release
Downloading llama-b1262-ubuntu-rocm-gfx1151-x64.zip:   0.2% (1.0 MiB/427.0 MiB) at 2.6 MiB/s
...
Downloading llama-b1262-ubuntu-rocm-gfx1151-x64.zip: 100.0% (427.0 MiB/427.0 MiB) at 9.3 MiB/s
[llama-prebuilt] downloaded prebuilt archive llama-b1262-ubuntu-rocm-gfx1151-x64.zip without a published sha256; relying on install validation
[llama-prebuilt] staged prebuilt validation succeeded for llama-b1262-ubuntu-rocm-gfx1151-x64.zip
[llama-prebuilt] activating staged install /home/ideocl4st/.unsloth/.staging/llama.cpp.staging-7gxmw51e -> /home/ideocl4st/.unsloth/llama.cpp
[llama-prebuilt] activated staged install at /home/ideocl4st/.unsloth/llama.cpp
[llama-prebuilt] confirming activated install tree at /home/ideocl4st/.unsloth/llama.cpp
[llama-prebuilt] activated install tree confirmed at /home/ideocl4st/.unsloth/llama.cpp
  llama.cpp      prebuilt installed and validated
                 installed release: unslothai/llama.cpp@b9022
                 llama.cpp install dir: /home/ideocl4st/.unsloth/llama.cpp

Both training and GGUF inference were successful.

@LeoBorcherding

LeoBorcherding commented May 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

successfully built on my machine RX 9060 xt:

[llama-prebuilt] AMD GPU 'gfx1200' (gfx120X) -- trying lemonade-sdk ROCm prebuilt llama-b1264-windows-rocm-gfx120X-x64.zip
[llama-prebuilt] selected llama-b1264-windows-rocm-gfx120X-x64.zip (lemonade) from published release b9105
[llama-prebuilt] staged prebuilt validation succeeded
[llama-prebuilt] activated install tree confirmed

@LeoBorcherding
LeoBorcherding marked this pull request as ready for review May 11, 2026 13:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread studio/install_llama_prebuilt.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread studio/install_llama_prebuilt.py Resolved
@Xsander

Xsander commented May 14, 2026

Copy link
Copy Markdown

@danielhanchen @rolandtannous pls review, lemonade rocm builds are life-time-savers for amd rdna3/4cards

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread studio/install_llama_prebuilt.py Resolved
LeoBorcherding and others added 3 commits May 16, 2026 15:37
…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)
@h34v3nzc0dex

Copy link
Copy Markdown
Contributor

@LeoBorcherding ran ./install.sh --local --verbose against 9d9eeb27 on the gfx1151 box. Clean end-to-end with lemonade.

[llama-prebuilt] AMD GPU 'gfx1151' (gfx1151) -- trying lemonade-sdk ROCm prebuilt llama-b1280-ubuntu-rocm-gfx1151-x64.zip
[llama-prebuilt] selected llama-b1280-ubuntu-rocm-gfx1151-x64.zip (lemonade) from published release b9334 for Linux x86_64
[llama-prebuilt] downloading llama-b1280-ubuntu-rocm-gfx1151-x64.zip from lemonade release (443.8 MiB)
[llama-prebuilt] staged prebuilt validation succeeded for llama-b1280-ubuntu-rocm-gfx1151-x64.zip
[llama-prebuilt] activated install tree confirmed at /home/auroraai/.unsloth/llama.cpp
  llama.cpp      prebuilt installed and validated

No preflight failure, no source-build fallback. The bundle activates and runs.

Post-install state on /home/auroraai/.unsloth/llama.cpp/build/bin/:

  • 80 .so files present (up from ~10 on the upstream-only path) — full lemonade overlay landed
  • All previously-missing transitive deps now present: libLLVM.so.23.0git, libclang-cpp.so.23.0git, libamd_comgr.so.3, librocm_kpack.so*, librocm_sysdeps_* (bz2/lzma/drm/elf/zstd/numa/z), librocblas.so.5, librocsolver.so.0, libroctx64.so.4, libhipblas.so.3, libamdhip64.so.7
  • ldd llama-server: 0 missing libs — every NEEDED entry resolves into the install dir
  • llama-server --version: version: 1 (35a74c8), built with Clang 23.0.0 for Linux — runs cleanly

Sequence across all four passes:

Pass HEAD Result
1 39cf5d6 manual staging proved asset URL pattern works
2 76fe0912 install failed — missing librocm_kpack, librocm_sysdeps_*
3 c41e20db install failed one layer deeper — missing libLLVM, libclang-cpp
4 9d9eeb27 install succeeds end-to-end

Two small observations, neither blockers:

  • The success line installed release: unslothai/llama.cpp@b9334 is technically the source-tree tag from unsloth's fork (the overlay hydrates source from there). The binary set is from lemonade b1280. If you'd find the surfacing cleaner, you could log both — something like installed release: unsloth-source@b9334 + lemonade-binaries@b1280. Not actually a bug, just slight surprise on first read since lemonade is what users care about on the ROCm path.
  • The two new [llama-prebuilt] lines about lemonade tarballs being outside the approved-hash manifest are clear and well-flagged — good signpost for anyone running with UNSLOTH_DISABLE_LEMONADE_ROCM=1 to opt out.

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 + ldd output in that dir).

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).
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@h34v3nzc0dex

Copy link
Copy Markdown
Contributor

@LeoBorcherding confirmed d4d447c0 on the gfx1151 box. New summary line + JSON metadata both land.

Before (9d9eeb27):

installed release: unslothai/llama.cpp@b9334

After (d4d447c0):

installed release: unslothai/llama.cpp@b9334 + lemonade@b1280

UNSLOTH_PREBUILT_INFO.json gained both new fields cleanly:

{
  "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 .so files in /home/auroraai/.unsloth/llama.cpp/build/bin/, 0 missing libs per ldd. The source != "upstream" and binary_repo != repo gate in setup.sh correctly keeps the upstream-only path's output unchanged.

Full verbose log + JSON snapshot in pr-5303-validation/ (pass 5 section). LGTM, still ready to merge.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

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.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@h34v3nzc0dex

Copy link
Copy Markdown
Contributor

@LeoBorcherding ran ./install.sh --local --verbose against a9176189 on the gfx1151 box. Merge-with-main is clean — Linux ROCm install path identical to d4d447c0.

[llama-prebuilt] AMD GPU 'gfx1151' (gfx1151) -- trying lemonade-sdk ROCm prebuilt llama-b1280-ubuntu-rocm-gfx1151-x64.zip
[llama-prebuilt] selected llama-b1280-ubuntu-rocm-gfx1151-x64.zip (lemonade) from published release b9334 for Linux x86_64
[llama-prebuilt] staged prebuilt validation succeeded for llama-b1280-ubuntu-rocm-gfx1151-x64.zip
[llama-prebuilt] activated install tree confirmed at /home/auroraai/.unsloth/llama.cpp
  llama.cpp      prebuilt installed and validated
                 installed release: unslothai/llama.cpp@b9334 + lemonade@b1280

Verification on the activated install:

  • 80 .so files in /home/auroraai/.unsloth/llama.cpp/build/bin/ — full lemonade overlay
  • ldd llama-server: 0 missing libs
  • All transitive deps present (libLLVM 23.0git, libclang-cpp, libamd_comgr, librocm_kpack, librocm_sysdeps_*, librocblas, libroctx64, libamdhip64, libhipblas)
  • UNSLOTH_PREBUILT_INFO.json retains both binary_repo: lemonade-sdk/llamacpp-rocm and binary_release_tag: b1280 from your d4d447c surfacing fix
  • llama-server --version: version: 1 (35a74c8), built with Clang 23.0.0 for Linux — runs cleanly

The conflict resolution in studio/install_llama_prebuilt.py (keeping the feature-branch per-target patterns as a strict superset of upstream's simplified lib*.so*) preserves correct behavior on the linux-rocm path.

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: pr-5303-validation/ (pass 6 section). Still LGTM.

…cm-prebuilts

# Conflicts:
#	studio/install_llama_prebuilt.py
@chatgpt-codex-connector

Copy link
Copy Markdown

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.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

Comment thread studio/install_llama_prebuilt.py Outdated

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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
@chatgpt-codex-connector

Copy link
Copy Markdown

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.
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Collaborator Author

Three fixes in this push.

  1. the docstring for _lemonade_release_api_for was wrong -- it said lemonade tags match ggml-org 1:1, which they don't. Fixed to say lemonade may be several builds behind.

  2. on ROCm-only Linux hosts the CPU asset was being added as a fallback even when lemonade was the only option. This meant a failed lemonade validation would silently install a CPU binary instead of raising and triggering the HIP source build. Moved the CPU choice into the else branch so ROCm-only hosts don't get it.

  3. lemonade ROCm zips bundle hipblaslt and rocblas as directory trees (hipblaslt/library/gfx.../), not flat files. The existing copy step only matched filenames and copied flat, so those Tensile kernel catalogs were silently dropped. Added a pass after the flat copy that uses copytree to preserve those subdirs in the install overlay.

@chatgpt-codex-connector

Copy link
Copy Markdown

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
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@danielhanchen
danielhanchen force-pushed the feature/lemonade-rocm-prebuilts branch from 1fdb9fe to 3f5b550 Compare May 29, 2026 10:54
@chatgpt-codex-connector

Copy link
Copy Markdown

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 added a commit to LeoBorcherding/unsloth that referenced this pull request May 29, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.

@danielhanchen
danielhanchen merged commit 61df3aa into unslothai:main May 30, 2026
26 of 30 checks passed
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.

8 participants