Repository navigation
Source llama.cpp prebuilts from unslothai/llama.cpp (CUDA, ROCm, macOS) - #5963
Conversation
…no dormant full path)
There was a problem hiding this comment.
Code Review
This pull request expands prebuilt support by integrating ROCm (Linux and Windows) and ARM64 CUDA bundles, routing GPU-enabled hosts to the fork's repository while keeping CPU-only hosts on the upstream repository. It unifies the installation planning under a single resolver that delegates to a manifest-reading branch for complex architectures (ARM64 CUDA, Windows CUDA, per-gfx ROCm, macOS) and a fast filename-based path for Linux x64. Additionally, Windows CUDA selection is updated to support app-named bundles, SM-filtering, and relaxed driver version constraints for CUDA 12. Feedback on the changes suggests stripping leading and trailing whitespace from mapped_targets when parsing them from the manifest to ensure robust matching.
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.
…th and hardcoded coverage tables
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors and unifies the prebuilt installation logic for llama.cpp across Linux, Windows, and macOS, removing the legacy --simple-policy flag and introducing a unified manifest-aware resolver for fork bundles. It adds support for arm64 CUDA, Windows CUDA, per-gfx ROCm, and macOS bundles, matching ROCm bundles by the host's detected gfx family. Feedback on the changes highlights a potential sorting issue in published_windows_cuda_attempts where legacy bundles lacking SM metadata could evaluate to a range of 0 and incorrectly outrank valid targeted bundles; a defensive fallback range is suggested to resolve this.
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.
|
Pushed 72f3236 to this branch: it fixes Windows AMD hosts never reaching the lemonade prebuilt. The fork release scan pins The Linux attempt builder already passes the requested tag ("latest") to lemonade, which is why the Linux path works. The commit threads the requested tag through Verified on the same box after the fix: native Windows selects One thing for a possible follow-up: a planning failure still lets the scanner spend around 40 unauthenticated API calls walking old releases. Capping scan iterations or treating a 403 as PrebuiltFallback would soften that failure mode. |
|
Item 1 above (the fork-path Windows CUDA hash mismatch) now has a workflow-side fix: unslothai/llama.cpp#20 records the upstream win-cuda binary digests under their own asset names in the sha256 index. Since the installer checks the exact asset name before the cudart alias, no installer change is needed here - the alias stays as a backstop for older manifests. Verified against the live b9518 assets (binary 52e8dddb vs cudart 8c79a9b2, and the 13.3 entry now present). It is stacked on #17 and mergeable immediately after it. |
…nslothai#5963 Audit follow-up to 72f3236 across the other selection pathways. The ggml-org direct planner kept its lemonade attempt for Windows ROCm hosts but planned only the CPU tarball for Linux ROCm hosts, so an AMD Linux box routed to ggml-org (for example a --published-repo override) silently installed the CPU build. That lemonade planning used to live in the --simple-policy dispatcher this PR removed. Add the lemonade attempt ahead of the CPU tarball in the Linux x86_64 branch, mirroring the Windows branch, with the lookup keyed to the requested tag. Adds a regression test asserting lemonade is the first attempt for a Linux ROCm host on the direct path. Also re-verified the other pathways on a gfx1151 box: the fork-routed flows pass the requested tag everywhere, repeat runs over an existing lemonade install correctly skip with "already matches selected release b9518" on both native Windows and WSL, and macOS, CUDA and CPU selection are untouched. Suites: 328 passed on Linux, Windows matches the pre-existing baseline.
|
Audited the remaining selection pathways for the same class of issue and pushed one more commit (457c51b). The ggml-org direct planner kept its lemonade attempt for Windows ROCm hosts but planned only the CPU tarball for Linux ROCm hosts, so an AMD Linux box routed to ggml-org (for example a Everything else checked out clean:
|
|
Tested end-to-end on N1X "RTX Spark" hardware (Windows-on-ARM -> WSL2 Ubuntu 24.04, Blackwell sm_121, driver CUDA 13.1): The fork-manifest path works for arm64 CUDA on this machine. Host detection got everything right ( Today's behavior (no arm64 asset in unslothai releases yet) is the correct graceful fallback: Two small notes, neither blocking:
|
# Conflicts: # studio/setup.ps1
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed33286f9f
ℹ️ 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".
| # not usability: an unusable NVIDIA host has a good CPU prebuilt to fall back to, | ||
| # whereas tightening AMD would regress ROCm hosts exposing only hipconfig/hipinfo | ||
| # into an unnecessary CPU build. | ||
| if [ "$_setup_nvidia_usable" = true ] && [ "${CUDA_VISIBLE_DEVICES:-}" != "-1" ]; then |
There was a problem hiding this comment.
Treat empty CUDA_VISIBLE_DEVICES as hidden
After the visibility fix, this shell probe still only excludes CUDA_VISIBLE_DEVICES=-1; when users hide GPUs with CUDA_VISIBLE_DEVICES= (empty), install_llama_prebuilt.py treats that as no usable NVIDIA device, but setup.sh routes to unslothai/llama.cpp anyway. On CPU-only/hidden-GPU Linux hosts the fork has no CPU bundle, so these installs fall back to a source build instead of using the ggml CPU prebuilt; handle the set-but-empty value the same way as -1.
Useful? React with 👍 / 👎.
Brings the Playwright chat UI driver fix (unslothai#6153) that follows Compare chat into the More submenu; the previous merge predated it, which is why Chat UI Tests failed on this branch with 'Compare chat item not found'.
|
Pushed 9979b2e: merged main again to pick up the Playwright driver fix from #6153 (follow Compare chat into the More submenu). The previous merge predated it, which is why Chat UI Tests failed on this branch with "Compare chat item not found" - that was the only genuinely red check left after the rebase; the earlier Chat UI / Studio Updating failures were HF 429 rate limits on the validation-model fetch, which main's huggingface_hub download path now mitigates. Status of the audit items on this branch after the merges: the setup.ps1 ownership guard is back in place (test_studio_install_workspace_guard passes, 44/44), and the updater concern is moot - the in-app updater was refactored into the read-only llama_cpp_freshness staleness check, so nothing re-runs the installer without the detected gfx anymore. The Blackwell cuda-12.4 exclusion and the NVIDIA linux-cpu gate landed as #6156 against main; whichever of that PR and this one merges second will want a trivial reconcile in install_llama_prebuilt.py and test_selection_logic.py. |
…ackwell/CPU hardening) # Conflicts: # studio/install_llama_prebuilt.py # tests/studio/install/test_selection_logic.py
Resolve conflicts from the #5963 installer rework: - main.py: keep both the routes.llama and hub.* router imports/registrations - provider.tsx: keep main's DownloadManagerPanel/TooltipProvider alongside the LlamaUpdateBanner, and mount the banner on the macOS desktop (native titlebar) path so macOS users get the in-app update - test_desktop_auth.py: union the routes.llama and routes.prompts stub modules
…ller Re-run install_llama_prebuilt.py the way setup.sh/setup.ps1 now do, and harden the update flow against the edge cases raised in review. Installer invocation (utils/llama_cpp_update.py): - Forward the AMD gfx target the same way setup does. The install marker's asset name carries the gfx family for lemonade HIP bundles, so derive --rocm-gfx (or --has-rocm for the fork ROCm-version bundles) from it; without this, the update could mis-plan a non-HIP asset on amd-smi-only / name-inferred hosts. - Do not pass --cpu-fallback: setup only uses it for the arm64 source-build rescue, and it force-drops GPU detection; re-running into the same install-dir and published-repo already reproduces the right CPU bundle. - No --simple-policy (removed from setup by #5963; the default policy scans the published repo). Update safety: - Put the backend into a maintenance state for the install window: set a flag under the serial load lock and unload whenever a server process exists (is_active, not just is_loaded). load_model() rejects fast while the flag is set so no server starts from a half-swapped binary; the flag clears in a finally. Fails open when the backend is unavailable. - Frontend hook: handle a 200 response that did not start a job (no marker / installer missing) by surfacing the reason instead of polling forever, and track an externally started job to completion so the banner does not stick on Updating. Shared poll helper used by both paths. Tests: rocm-gfx / has-rocm derivation, ggml-org CPU marker has no --cpu-fallback, no --simple-policy, backward-compatible marker without an asset field, refusal paths, and the maintenance-flag set/clear plus fail-open coverage.
…#6097) Adds an in-app "Update llama.cpp" banner and button to Unsloth Studio. When the installed prebuilt is behind the latest published release, a non-invasive banner appears; clicking Update downloads the latest prebuilt for this host and swaps it in place in the background, with no restart. Detection reuses the freshness check from #5529. The update re-runs install_llama_prebuilt.py the same way setup.sh and setup.ps1 do after #5963: it forwards the published repo and the AMD gfx target derived from the install marker, and does not pass the removed --simple-policy or the arm64-only --cpu-fallback. While the installer swaps binaries the backend enters a maintenance state (flag set under the serial load lock, active server unloaded) so a concurrent load cannot start a server from a half-swapped binary; the next load uses the new build. The banner also handles refused responses and jobs started in another tab so it never sticks on "Updating...". Verified end to end on an NVIDIA B200: installed b9493, detected the update, applied it, and confirmed the binary at the same path advanced to b9585 in the same process. Hermetic backend tests and the frontend type-check pass.
…prebuilt step (#6189) #5963 folded the manifest resolver into the simple-path resolver, removed the installer's --simple-policy flag, and moved macOS prebuilts to the unslothai/llama.cpp fork. The MLX CI prebuilt step still passed the deleted flag, so argparse exits 2 and the workflow has been red on every main push since. Point the step at the fork with no extra flags, exactly like studio/setup.sh on macOS.
…ause the CUDA bundles ship no cudart/cublas (#17463) Chat-only (no-torch) installs with an NVIDIA GPU run llama.cpp on the CPU. Reported in the Discord help thread: a 5070 Ti on Windows (driver 591.86) got ~20 tok/s where LM Studio gets ~140, `llama-server --list-devices` printed `(none)`, and the log showed `n_threads = 2` on the CPU. ## Why The `app-*` CUDA bundles Unsloth Studio installs since #5963 ship `ggml-cuda.dll` but no `cudart`/`cublas`. A full install doesn't need them: PyTorch already carries the CUDA runtime, and Unsloth Studio puts it on llama-server's search path, which saves ~400-550 MB per bundle. A chat-only install skips PyTorch, so there is nothing to borrow, `ggml-cuda.dll` fails to load, and llama.cpp quietly falls back to the CPU. ``` .unsloth/ ├ llama.cpp/…/Release/ same in every case: ggml-cuda.dll, no cudart └ studio/unsloth_studio/…/site-packages/ ├ torch/lib/ full install: cudart64_12.dll, cublas64_12.dll → GPU ├ (nothing) chat-only today → CPU └ nvidia/cu13/bin/ chat-only with this PR: cudart64_13.dll, … → GPU ``` On Windows torch ships these DLLs inside its own wheel (`torch\lib`). On Linux torch pulls NVIDIA's `nvidia-cuda-runtime` / `nvidia-cublas` wheels into `site-packages/nvidia/`, which are the same wheels this PR installs. ## Change - **Linux, before bundle selection.** Selection only takes a CUDA bundle whose runtime line is already on disk, so a driver-only host would skip CUDA and fall back to a source build. On an x64 NVIDIA host with an `auto`/`cuda` request and no runtime the driver can use, the installer now installs the wheels for the newest line the driver runs first, then selects. Pre-Turing GPUs get CUDA 12, and a CUDA 13 runtime already on disk does not count for them. - **After install, both OSes.** The install kind and CUDA major come from the asset name, since the install marker records no install kind. If the runtime is missing (Linux: `detected_linux_runtime_lines()`, the same scan selection uses; Windows: `cudart`, `cublas` and `cublasLt` of that major, each found in the bundle, `torch/lib`, the env's `nvidia/` wheels, `CUDA_PATH` or the loader's own DLL dirs from `windows_runtime_dirs()`, checked flat), it installs NVIDIA's wheels: `nvidia-cuda-runtime` + `nvidia-cublas`, or the `-cu12` names with cublas pinned to 12.9.2.10 on Windows, the last one with a `win_amd64` wheel. - **Repair.** `--check-installed` reports such an install as not ready, so setup and update reinstall it and fill the gap on machines that are already broken. - `llama_cpp.py` already puts the env's `nvidia/*` wheel dirs on `PATH` / `LD_LIBRARY_PATH`, so it needs no change. Full installs and machines with the CUDA toolkit download nothing new. ARM64 bundles already ship the runtime and are untouched. This replaces unslothai/llama.cpp#362, which put the runtime in every bundle (+373 to +552 MiB each). ## Tests `tests/studio/install/test_no_torch_cuda_runtime_wheels.py`, 30 passed on macOS at `907e50f558` (code-level, the filesystem, loader and host are faked). Not run yet on a real Windows or Linux NVIDIA machine with a chat-only install. --------- Co-authored-by: oobabooga <[email protected]>
This PR wires the new prebuilts that will be generated by unslothai/llama.cpp#17 to the installer here. I'll mark it as a draft until that PR gets merged.
New platforms
New = not previously provided by unslothai/llama.cpp:
How bundles are selected
Anything not covered falls back to a source build, same as today.
Which repo the installer pulls from is decided in the setup scripts:
setup.sh(Linux/macOS) andsetup.ps1(Windows) point GPU hosts at the fork and keep CPU-only on ggml-org.I also moved all of unslothai/llama.cpp onto the manifest. linux-x64 used to take a separate filename-based path with hardcoded coverage tables; I removed it so the fork selects every platform from the manifest, one source of truth. ggml-org still selects by filename since it ships no manifest. This is most of the deleted lines in the diff.
Testing
I tested the full path with a real install on a linux-x64 CUDA box, which pulled and ran b9457 from the release. The per-host bundle selection for every platform is covered by unit tests against the real b9457 manifest.