Skip to content

Studio: find uv off PATH for the CUDA runtime wheel step, and name Repair in the GPU backend warning - #17675

Merged
danielhanchen merged 3 commits into
mainfrom
studio-cuda-runtime-uv-lookup
Nov 14, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-cuda-runtime-uv-lookup

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #17663

After an in-app llama.cpp update on Windows (RTX 5090 Laptop), llama-server ran entirely on the CPU, and only Repair installation brought the GPU back.

Why

The app-* Windows CUDA bundles ship ggml-cuda.dll but no CUDA runtime. In b12319 (and b12284), the cuda13 ggml-cuda.dll imports cublas64_13.dll, cublasLt64_13.dll and nvcudart_hybrid64.dll. llama.cpp loads its backends dynamically (GGML_BACKEND_DL), so when those cannot be found it falls back to the CPU without an error. #17463 (merged after v0.1.917-beta, not released yet) installs NVIDIA's runtime wheels when an install has no runtime. Two gaps remain on the path this report took:

  1. The wheel step finds uv only through shutil.which("uv"). A Desktop-started backend can run with a PATH that lacks uv's directory (s3_runtime._find_uv and mlx_repair._uv_executable already guard this). The fallback python -m pip cannot work either, because the venv is made by uv venv with no pip. In that case an in-app update logs "CUDA runtime wheel install failed; llama.cpp will run on the CPU" and still reports success. The step now also looks in ~/.local/bin and ~/.cargo/bin, where install.ps1 / install.sh put uv by default, the same lookup mlx_repair uses.
  2. When the GPU is found but llama.cpp cannot use it, the chat warning pointed only at the logs. It now also says that Repair installation in the desktop app, or re-running the installer, reinstalls the engine, which is what fixed this report. The wording matches the existing PyTorch mismatch notice.

Nothing changes when uv is on PATH, and the warning shows under the same conditions as before.

Tests

  • tests/studio/install/test_no_torch_cuda_runtime_wheels.py::test_uv_off_path_is_still_used: with no uv on PATH and uv in ~/.local/bin, the wheels are installed with that uv. Fails without the change.
  • studio/frontend/tests/partial-offload.test.ts: the GPU backend warning names Repair installation. Fails without the change.
  • tests/studio/install: 21 failures on both base and head (pre-existing, for example in test_dependency_pass_skips.py); head passes one more test, the new one.

Not covered: a real Windows Desktop run. The reporter's exact cause is unconfirmed without their install log, so this hardens the path #17463 added rather than proving their root cause.

Screenshots

The toast after loading a model whose GPU llama.cpp could not use. This was a real CPU load of SmolLM2-135M Q4_K_M in Studio, built from the merge base (left) and this branch (right), with only the load response's GPU backend flag forced on, since this host has no GPU.

before / after: the on-CPU toast now names Repair installation

@danielhanchen danielhanchen self-assigned this Nov 13, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T07:53:10.179805Z ab2b535 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: b2fe081042

ℹ️ 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

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: ab2b535188

ℹ️ 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 d06a401 into main Nov 14, 2026
@danielhanchen
danielhanchen deleted the studio-cuda-runtime-uv-lookup branch November 14, 2026 08:13
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 14, 2026
…nslothai#17744)

Follow-up to unslothai#17675 for
unslothai#17663

In unslothai#17663 an in-app llama.cpp update on Windows left llama-server
running entirely on the CPU, and the update still reported "Updated
llama.cpp to b12319". The installer exits 0 when the CUDA runtime it
needs could not be installed, because the CPU fallback still works. So
the update had no way to tell the user anything was wrong, and the first
sign was slow generation.

## Change

- `install_llama_prebuilt.py` already logs "CUDA runtime wheel install
failed ...; llama.cpp will run on the CPU" when the runtime install
fails. After a runtime install that succeeds, it now re-checks, and if
the runtime is still missing it logs the same notice.
- `update_flow.stream_installer` returns whether the installer printed
that notice. It was already reading every line, so this needs no extra
process and no new probe.
- The llama.cpp update keeps its success state, but its message now
adds: "The CUDA runtime llama.cpp needs could not be installed, so it
will run on the CPU. Use Repair installation in Settings in the desktop
app, or re-run the Unsloth installer."

The update flow, its states and the installed files are unchanged. Only
the completion message differs, and only when the installer said
llama.cpp will run on the CPU.

## Tests

- `test_the_installer_logs_the_cpu_fallback_notice_the_update_reads`:
guards against the installer's wording drifting from what the update
looks for.
- `test_an_update_that_leaves_llama_on_the_cpu_says_so[True|False]`:
with the notice in the installer output the message names Repair
installation; without it the message is unchanged.
- `test_a_runtime_still_missing_after_its_install_is_reported`: the
re-check fires only when the install succeeded and the runtime is still
missing.
- Every suite that drives `llama_cpp_update` or `stream_installer`
passes (376 passed, 1 skipped). These are the update, combined update,
backend switch, update-flow messages, orphaned children, account
mutations, path settings, local link and source build suites.
danielhanchen added a commit that referenced this pull request Nov 14, 2026
…09 lint (#17748)

## Summary

`Source lint`, `workflow-trigger lint` and `Repo tests (CPU, rest-2)`
fail on main and every PR based on it since #17675, in
`tests/security/test_lint_av_shapes.py::test_the_repository_is_clean_against_its_baseline`:

```
tests/studio/install/test_no_torch_cuda_runtime_wheels.py:308: [AV009] error: copies a Windows system binary
1 new error(s).
```

The test #17675 added copies the `uv` executable found on PATH into a
fake home (`shutil.copy2(uv, home / ".local" / "bin" / ...)`), then
builds the child's PATH from the venv plus `%SystemRoot%` and
`System32`. AV009 fires on any file copy within a few lines of a
`System32` path, which is the shape of renaming a Microsoft-signed tool.
Here the copied file is uv, and `System32` is only put on the child's
PATH, so the finding is a false positive. Both the test and the lint
rule are right about what they check; they only meet by proximity.

## Change

A `lint-allow: AV009 <reason>` comment above that one copy, the escape
hatch the linter's own message names for a line that has to stay. No
other line, rule or baseline entry changes, so a real System32 copy
anywhere else, including in this file, still fails.

## Testing

- `python scripts/lint_av_shapes.py`: `0 new errors` (1 on main).
- `pytest tests/security/test_lint_av_shapes.py`: 19 passed (the
baseline test fails on main).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UX] GPU idle after engine update - only “Restore installation” restored GPU inference

1 participant