Skip to content

Studio: keep a working GPU llama.cpp prebuilt over a CPU-only source fallback, and say so in the footer - #10975

Merged
danielhanchen merged 12 commits into
mainfrom
keep-gpu-prebuilt-over-cpu-source-fallback
Sep 15, 2026
Merged

danielhanchen merged 12 commits into
mainfrom
keep-gpu-prebuilt-over-cpu-source-fallback

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Closes #9255. Supersedes #9267, whose footer warning is folded in here with the initialisation it was missing.

The defect

When the llama.cpp prebuilt install fails during unsloth studio update (a GitHub API limit, a TLS failure, a bad release), setup.sh restores the existing install and then source-builds. On a host without nvcc that build is CPU-only, and the swap at the end replaced the restored CUDA prebuilt with it. The footer said built. The user's GPU was gone until the next successful update, and nothing told them why.

This is the Linux half of the "my GPU stopped being used after an update" reports. setup.ps1 already fails a source build that has no toolkit rather than degrading, so Windows is not affected.

The fix

A working GPU prebuilt is never replaced by a source build that a failed update forced. At the failed update itself, setup.sh checks whether the install on disk is worth keeping:

  • the install directory has a llama-server and a marker recording backend cuda, rocm or vulkan (older markers are read through llama_backend or the asset name);
  • the GPU the marker names is still on the host (_setup_nvidia_physical for cuda, _setup_amd_detected for rocm, any of NVIDIA, AMD or Intel for vulkan);
  • the bundle still covers the card and the driver: the marker's supported_sms (physical caps when a mask empties the visible ones) or mapped_targets, and its runtime_line against the driver's compatible lines, checked offline by the updater's own --check-installed;
  • the build was not asked for by hand (UNSLOTH_LLAMA_FORCE_COMPILE=1 or UNSLOTH_LLAMA_PR still build).

When it is, no source build starts. The step reads, for example:

llama.cpp   update failed (GitHub rate limit); keeping the installed cuda prebuilt, the next update will retry

The reason is read from the helper's log (rate limit, network error, or download failed). The same decision runs again before the compile and at the swap, for the source-build paths that reach a CPU binary another way (no prebuilt for the platform, a CUDA or ROCm build that fell back to CPU part way through). A kept prebuilt is reported as the installed release, not as a failed build, so the footer does not read limited, and the footer repeats the one-line reason.

A GPU host that genuinely ends on a CPU build (nothing to keep) gets a footer warning naming the cause, which is what #9267 set out to add. The arm64 CPU prebuilt fallback is covered too.

Tests

tests/studio/install/test_setup_keeps_gpu_prebuilt_over_cpu_source_fallback.py: the decision is sliced out of setup.sh and driven against real markers (cuda on an NVIDIA host is kept, rocm and vulkan on an AMD host are kept, a cuda marker with the GPU gone is replaced, cpu markers, absent, malformed and non-string markers are replaced, no server is replaced, a forced or PR build still runs, legacy marker shapes), the coverage check (SMs, physical SMs under a mask, runtime line against the driver, gfx targets and family), the failure reason wording, plus wiring checks for the three decision sites, the configure gate, the status arm and the three footers.

Every tests/sh/test_setup_*.sh suite and the install pytest files pass. bash -n is clean.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-15T06:53:05.683608Z 7c1f2db Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

…d name the arm64 CPU fallback in the footer for PR #10975
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 15, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 15, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 7c1f2dbed4

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 6f64398 into main Sep 15, 2026
50 of 60 checks passed
@danielhanchen
danielhanchen deleted the keep-gpu-prebuilt-over-cpu-source-fallback branch September 15, 2026 08:43
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…fallback, and say so in the footer (unslothai#10975)

* Studio: keep a working GPU llama.cpp prebuilt over a CPU-only source fallback, and say so in the footer

* Match the kept prebuilt to the GPU vendor that can run it, and keep Vulkan on an Intel host for PR unslothai#10975

* Read legacy marker backends, validate the kept prebuilt, and name an Intel host on CPU for PR unslothai#10975

* Check the kept prebuilt offline with the updater's own completeness check for PR unslothai#10975

* Keep a GPU prebuilt only while it still covers the installed card, and name the arm64 CPU fallback in the footer for PR unslothai#10975

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Check the kept CUDA prebuilt against the physical SMs and the driver's runtime lines for PR unslothai#10975

* Name both causes of a CPU-only source fallback in the footer for PR unslothai#10975

* Keep the installed GPU prebuilt at the failed update itself, with a one-line reason, for PR unslothai#10975

* Do not keep the old prebuilt over an explicit llama.cpp version pin for PR unslothai#10975

* Shorten the keep-prebuilt comments for PR unslothai#10975

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: danielhanchen <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

[Bug] A failed llama.cpp prebuilt install silently falls back to a CPU-only build on a CUDA host

2 participants