Studio: fail fast when the installed llama.cpp prebuilt has no kernels for this GPU - #8841
Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00c356fd80
ℹ️ 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: e9b49c5ea6
ℹ️ 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".
| _sm_gate = self._cuda_sm_gate_error(binary) | ||
| if _sm_gate: | ||
| raise RuntimeError(_sm_gate) |
There was a problem hiding this comment.
Apply the CUDA SM gate to the RAG embed server
When RAG selects GPU embeddings on the mismatched-host scenario this change targets, this verdict is never checked: core/rag/embed_llama_server.py:_spawn_once launches the same managed llama-server, while its _build_env only applies the ROCm arch gate. Consequently RAG_EMBED_DEVICE=gpu still waits for startup and fails with the generic health error, and automatic mode incurs the failed startup before falling back to CPU. Reuse this gate before the embedding GPU spawn so the new metadata protects every managed llama-server consumer.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. The RAG embed spawn behaved exactly the same way before this PR, so nothing regressed there; this asks to extend the new gate to another consumer rather than to fix a defect in this change. It is a reasonable follow-up, but it belongs in its own PR that can carry the embed-path tests with it rather than widening this one into core/rag.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9b49c5ea6
ℹ️ 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".
| if not zero_vram_chat_load( | ||
| gpu_memory_mode, | ||
| gpu_layers, | ||
| extra_args, | ||
| effective_is_vision, | ||
| speculative_type, | ||
| ): |
There was a problem hiding this comment.
Honor explicit CPU device pins in the SM gate
When an unsupported host leaves gpu_memory_mode="auto" (or uses a nonzero manual layer count) but deliberately passes --device none/--device cpu, or inherits LLAMA_ARG_DEVICE=none, with no GPU companions or gpu_ids, this condition still runs the SM gate because zero_vram_chat_load returns false solely from the memory mode. The launch code and existing placement tests explicitly treat these effective device values as CPU placement, so the child would not use the unsupported GPU, but the new gate rejects it before argv is built. The fresh evidence beyond the prior manual-zero finding is that pass-through CPU device pins are independently recognized elsewhere as forcing the runtime to use no GPU; include that effective placement in this exemption.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this. Those requests keep the GPUs visible to the child: _cpu_only_zero_offload requires manual mode with zero layers, and _arch_gate_forced_cpu is ROCm-only, so an auto-placement load writes the normal device mask and the CUDA backend still initialises regardless of what --device says. --device cpu is additionally rejected by llama.cpp's own parse_device_list, so honoring it would trade an actionable message for llama-server exiting on an invalid argument. The supported CPU-only path is manual with zero layers, which is exempt and now covers the CPU-pinned companion cases too.
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
The gate treats "no visible GPU's SM is in The CUDA bundles are built with plain arch numbers, not
Host-side kernel selection is clamped by Measured on a host with an RTX 6000 Ada (sm_89) and an RTX 3090 (sm_86), driver 580.173.02. The
The refusal is raised before the spawn and outside the The direction that genuinely aborts is the reverse one: a bundle newer than the GPU, such as
On JIT cost, with an isolated The rest of the change reads correctly: the marker plumbing at |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
…#8841 The ROCm arch gate has test_gpu_arch_gate_os_matrix_7624.py asserting it is inert off its one supported host shape; the CUDA gate had no equivalent, and inertness is exactly what output alone cannot show since a gate that ran and passed returns None like one that never ran. Spy the marker reader and the nvidia-smi probe across [Windows, Linux, WSL, macOS] x [NVIDIA, AMD, CPU-only]. Also pins two properties the design rests on but nothing checked: supported_sms must stay out of expected_install_fingerprint, or every pre-existing install compares stale and reinstalls on upgrade, and a non-CUDA bundle must record an empty list, which is the only reason the call site needs no Vulkan guard. Covers the floor decision (sm_121 PTX cannot JIT down to sm_120, but sm_120 to sm_121 can), unreadable and failing probes, and the visibility masks: a numeric mask without PCI_BUS_ID ordering fails open, an empty one hides everything, and a UUID or MIG mask is dropped so the whole host is weighed.
for more information, see https://pre-commit.ci
|
Reviewed this one closely because it is the only PR here that can refuse a launch that currently works. Verdict: the change is sound and worth landing, but the PR description argues the wrong direction and should be corrected before merge. Before: the prebuilt marker recorded no CUDA SM coverage. A bundle baked for one GPU could reach After: The description is backwards. It gives a T4-baked bundle failing on an H100 as the motivating case. That is the direction that works: the bundles compile plain arch numbers, so each fatbin carries PTX beside its cubins and the driver JITs forward onto a newer card, exactly as Simulation. Isolated uv venv, Python 3.11, no NVIDIA hardware: nvidia-smi, the marker and the visibility masks are faked in the shapes the installer really writes.
440 tests pass across the gate and installer suites. Old installs. A marker without Pushed the matrix and the two invariant tests to this branch. No behaviour change from me. One thing left as a note rather than a change: |
|
On UI evidence for this one: there is a visible effect, since the gate surfaces as a load error in place of a repeated failed spawn, but I could not produce an honest before/after pair on this host and did not want to post a misleading one. The blocker is that the effect needs a bundle that genuinely lacks kernels for the host GPU. This box is sm_100 and its installed bundle covers it correctly, so the gate is silent here by design. I can doctor The decision itself is pinned by tests instead, which is the more useful artefact here anyway since the claim is a decision table rather than an appearance: 91 tests across |
|
@codex review |
1 similar comment
|
@codex review |
|
@codex review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3d61a3124
ℹ️ 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".
| except ValueError: | ||
| continue |
There was a problem hiding this comment.
Fail open when any visible compute capability is unknown
When nvidia-smi returns a valid capability for one visible GPU but N/A or another unparseable value for another, this continue silently drops the unknown GPU. If every parsed GPU is below the bundle's floor, _cuda_sm_gate_error then concludes that every visible GPU is unsupported and rejects the load, even though the omitted GPU may be compatible. The tests already recognize N/A as an unknown capability; preserve the fail-open contract for partial results as well by treating any visible unparseable row as an unknown probe rather than returning a partial map.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one.
The uniform case already fails open, and that is the case that actually happens. compute_cap support is a property of the driver, not of the card, so an nvidia-smi too old to know the field reports it unreadable for every row, caps comes back empty and _cuda_sm_gate_error returns None on not caps. test_unreadable_caps_fail_open covers exactly that.
For a mixed table, one readable row beside an unreadable one, the only mechanism I could confirm is a GPU that has dropped off the PCIe bus, which is where N/A or ERR! shows up for a single row while the others read normally. That card cannot run anything in that state, CUDA reports no capable device until the host is rebooted, so judging on the cards that are actually usable is the correct answer rather than a false refusal. compute_cap is a static architectural property, so it does not go unreadable per card the way the utilization and power fields do on MIG or vGPU hosts.
Treating any unparseable row as an unknown probe would also mean a single stray line on stdout switches the gate off for the whole host, which is the one outcome the gate exists to prevent. Keeping the row skip.
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
One correction to the description, the code itself is fine. The description says a bundle baked for an older arch (T4) fails on a newer GPU (H100). That is the wrong way round. Plain Worth fixing the wording so the next reader does not take the gate to be guarding the opposite case. |
|
@codex review |

The installer picks the prebuilt bundle for the GPU present at install time, so an install baked on one GPU (e.g. a T4 cloud image layer) can land on another (H100) whose SM the bundle doesn't cover. llama-server then aborts on every launch and Studio retries ~8 times with misleading errors.
This records the bundle's supported_sms in UNSLOTH_PREBUILT_INFO.json (outside the fingerprint, backfilled on reuse) and checks it against the host's compute caps before launch. On a mismatch the load fails immediately with: run unsloth studio update. Fails open on unknown coverage, mirroring the ROCm mapped_targets gate.
Verified on Modal: T4-baked cuda13-older bundle on H100 fails fast with the new message; after unsloth studio update the gate clears and inference wor