Repository navigation
studio: make NVIDIA prebuilt selection track CUDA version bumps (Windows + Linux) - #5879
Conversation
The Windows prebuilt selector hardcoded the cuda13 minor as 13.1. ggml-org bumped their published Windows CUDA 13 build to 13.3 (b9400+), so the 13.1 asset name no longer exists upstream and a CUDA 13 host silently fell back to the cuda12 build. Discover the published cuda-1X.Y minor from the release asset list so the selector follows the bump, keeping the hardcoded value only as a fallback. Resolves the prebuilt-selection half of #5861.
There was a problem hiding this comment.
Code Review
This pull request introduces dynamic detection of the highest published CUDA minor version for Windows upstream assets, allowing the selector to automatically track minor version bumps (e.g., from 13.1 to 13.3) instead of relying on hardcoded defaults. It also adds comprehensive unit tests to validate this behavior. The reviewer suggested making the major version extraction more future-proof by dynamically parsing the version from the runtime line rather than using a hardcoded conditional check.
| attempts: list[AssetChoice] = [] | ||
| for runtime_line in runtime_order: | ||
| runtime = runtime_by_line[runtime_line] | ||
| major = 13 if runtime_line == "cuda13" else 12 |
There was a problem hiding this comment.
The hardcoded major = 13 if runtime_line == "cuda13" else 12 logic is not future-proof and will incorrectly map any future CUDA versions (e.g., cuda14) to 12. We can dynamically extract the major version from the runtime_line prefix to make this robust and future-proof.
| major = 13 if runtime_line == "cuda13" else 12 | |
| major = int(runtime_line[4:]) if runtime_line.startswith("cuda") else 12 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 043be8c9ee
ℹ️ 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".
| runtime = ( | ||
| _published_windows_cuda_runtime(upstream_assets, major) | ||
| or runtime_by_line[runtime_line] |
There was a problem hiding this comment.
Keep cuda12 pinned to the 12.4 baseline
When runtime_line is cuda12, this now also replaces the hardcoded 12.4 baseline with the highest 12.x asset present in the release. On a Windows host whose driver only satisfies the existing CUDA 12.4 gate (pick_windows_cuda_runtime/compatible_windows_runtime_lines only prove cuda12 compatibility), a release that adds cuda-12.8 alongside cuda-12.4 would select the newer 12.8 archive and bypass the 12.4 fallback, even though that driver may not be new enough for the 12.8 runtime. The dynamic minor lookup should be limited to the intended cuda13 bump or gated against the detected driver minor before applying it to cuda12.
Useful? React with 👍 / 👎.
Derive the candidate CUDA runtime lines from the driver major (newest major down to cuda12) and discover the published minor per major from the release asset list, on both the Windows (ggml-org) and Linux (unsloth) paths. A future toolkit (cuda 13.4, cuda14, ...) is then selected with no code change while llama.cpp keeps its binary naming (cudart64_<major>.dll, libcudart.so.<major>, llama-...-win-cuda-<maj>.<min>-x64.zip, app-...-linux-x64-cuda<major>-<class>.tar.gz). Unknown future Linux majors inherit the newest known major's sm coverage as a forward default with the GPU smoke test as the backstop; a newer-major driver with no matching build still degrades to the newest older-major build via backward compatibility.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ec90cba27
ℹ️ 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".
| return { | ||
| "cuda13": ("cudart64_13*.dll", "cublas64_13*.dll", "cublasLt64_13*.dll"), | ||
| "cuda12": ("cudart64_12*.dll", "cublas64_12*.dll", "cublasLt64_12*.dll"), | ||
| f"cuda{m}": ( | ||
| f"cudart64_{m}*.dll", | ||
| f"cublas64_{m}*.dll", | ||
| f"cublasLt64_{m}*.dll", | ||
| ) | ||
| for m in range(_MAX_PROBE_CUDA_MAJOR, _MIN_CUDA_MAJOR - 1, -1) |
There was a problem hiding this comment.
Preserve fallback when future CUDA DLLs lack assets
On a future Windows host with only CUDA 14 toolkit DLLs installed, this generated probe makes detected_runtime_lines contain only cuda14. windows_cuda_attempts then filters normal_runtime_lines to detected lines before asset lookup, so when ggml-org has not published a cuda14 zip yet, the new missing-asset path skips cuda14 and never attempts the compatible packaged cuda13/cuda12 fallbacks; the new downgrade test only covers the case where detected DLLs are mocked as cuda13/cuda12. Please keep detected future lines from excluding older compatible packaged runtimes, or retry older lines after a missing asset.
Useful? React with 👍 / 👎.
A cuda-13.3 build is only offered to a driver that advertises >= 13.3; a 13.1/13.2 driver is gated to the cuda-12.4 build (guaranteed by backward compatibility) instead of an unguaranteed 13.3 that would rely on minor-version compatibility (13.3 needs a 610+ driver, 13.1 ships 590). Selection now keys on the full driver (major, minor) <= build (major, minor); older majors still pass (a 14.x driver runs 13.3), and a gated line falls through to the next older major. A 13.3 driver still gets 13.3, so #5861 stays fixed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47f02deb5c
ℹ️ 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".
| runtime = _published_windows_cuda_runtime( | ||
| upstream_assets, major, host.driver_cuda_version | ||
| ) |
There was a problem hiding this comment.
Gate published Windows artifacts by CUDA minor
When the install uses a published release, published_windows_cuda_attempts still calls this new minor-gating logic with a synthetic asset map that only contains cuda-13.1/cuda-12.4, then selects the real manifest artifact only by runtime_line. In that path, a Windows host reporting CUDA 13.1 can pass this check via the synthetic 13.1 name and then install a published cuda-13.3 artifact, bypassing the driver-minor fallback that the upstream path now enforces. Please base the gate on the actual published asset runtime (or pass the published asset names into this helper) before accepting cuda13 artifacts.
Useful? React with 👍 / 👎.
published_windows_cuda_attempts selected a real published artifact by runtime_line only, so a future published cuda-13.3 artifact could reach a 13.1 driver and bypass the driver-version gate. Gate the real published minor against the driver and pair the cudart bundle from the real minor. No-op today (no manifest declares windows-cuda artifacts) but closes the latent bypass.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d616bc0ff
ℹ️ 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".
| am = re.search(r"-bin-win-cuda-(\d+)\.(\d+)-x64\.zip$", artifact.asset_name) | ||
| # Gate the real published minor against the driver, so a published | ||
| # windows-cuda artifact can never bypass the driver-version gate. | ||
| if ( | ||
| am is not None | ||
| and host.driver_cuda_version is not None | ||
| and (int(am.group(1)), int(am.group(2))) > host.driver_cuda_version | ||
| ): |
There was a problem hiding this comment.
Include future published CUDA majors in ordering
When installing from a published-release manifest on a Windows CUDA 14 host, this real-artifact gate is only reached for lines returned by windows_cuda_attempts, but that order is still seeded from a synthetic asset map containing only cuda12/cuda13 above. A manifest artifact with runtime_line="cuda14" is therefore never considered even though the new compatibility code advertises future-major support, so the published path falls back to older artifacts or none while the upstream path can select the CUDA 14 build.
Useful? React with 👍 / 👎.
ggml-org bumped the Windows win-cuda-13 build from 13.1 to 13.3 at b9365 and now ships only cuda-12.4 and cuda-13.3. A Blackwell (sm_120/sm_121) host on a 13.1 or 13.2 driver is gated off the 13.3 build and drops to cuda-12.4, which predates Blackwell (ggml compiles sm_120 only at toolkit >= 12.8) and so runs CPU-only. b9360 is the last release whose win-cuda-13 build is sub-13.3 (13.1) and is immutable, so pin it. On the upstream install path, when a Blackwell host is gated off the in-release cuda13 build but its driver can run 13.1, insert the b9360 cuda-13.1 build (with paired cudart and verified sha256) ahead of the cuda-12.4 attempt. The pin is dormant for non-Blackwell hosts, sub-13.1 or non-NVIDIA drivers, and any release that ships a driver-runnable cuda13 build, so it self-disables once upstream resumes a sub-13.3 build. Refs #5887.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7c3c0442c
ℹ️ 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 any(attempt.runtime_line == "cuda13" for attempt in existing_cuda_attempts): | ||
| return None |
There was a problem hiding this comment.
Suppress the Blackwell pin when newer CUDA is selected
On a future Windows Blackwell host with a CUDA 14 driver, windows_cuda_attempts() can already return a runnable in-release cuda14 artifact, but this guard only checks for an existing cuda13 attempt. direct_upstream_release_plan() then inserts the pinned b9360 CUDA 13.1 archive at the front, so the installer chooses the older fallback over the current CUDA 14 build even though the in-release asset is compatible. Suppress the pin when any runnable in-release CUDA attempt at or above the fallback line exists, or insert it only ahead of older/CPU fallbacks.
Useful? React with 👍 / 👎.
published_windows_cuda_attempts seeded its runtime-line ordering from a
hardcoded {cuda12: 12.4, cuda13: 13.1} map, so a future published cuda14
windows-cuda asset would never be ordered (it works today only because the
real minor is re-gated afterward). Derive the seed from the release's actual
published windows-cuda minors so a new CUDA major is handled with no code
change, matching the rest of the selector. Falls back to the prior default
when a release lists no windows-cuda asset. Adds the unit coverage this path
was missing.
There was a problem hiding this comment.
💡 Codex Review
unsloth/studio/install_llama_prebuilt.py
Lines 3390 to 3393 in 4ec4490
In the published-release path, this sorts all artifacts for a runtime line and ignores the concrete minor that windows_cuda_attempts() just selected from the release's published minors. If a manifest contains both cuda-13.1 and cuda-13.3 artifacts with the same rank, a 13.3-capable Windows host will still pick 13.1 because that name sorts first, defeating the new dynamic-minor selection and pairing the older cudart bundle. Please filter candidates to the selected ordered_attempt.name/minor, or order same-line candidates by the driver-supported minor chosen by windows_cuda_attempts().
ℹ️ 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".
…m_120 The pin suppressed itself only when an in-release cuda13 attempt existed. A future Blackwell host with an in-release cuda14 build (and no cuda13) would still get the older b9360 cuda-13.1 pin inserted ahead of the runnable cuda14. Suppress instead when any in-release windows-cuda attempt is built with a toolkit >= 12.8 (the threshold at which ggml compiles sm_120), read from the asset name, so the pin defers to a runnable cuda13/cuda14 (or a future cuda-12.8) and fires only when the in-release choice is the sm_120-incapable cuda-12.4.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d3a1061f8
ℹ️ 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".
| pinned = _pinned_windows_cuda_fallback(host, attempts) | ||
| if pinned is not None: | ||
| attempts.insert(0, pinned) |
There was a problem hiding this comment.
Apply the Blackwell pin on the published install path
This pin is only inserted in direct_upstream_release_plan, but the default non---simple-policy installer path goes through resolve_install_release_plans() → resolve_release_asset_choice() → published_windows_cuda_attempts() and never calls this helper. On a Windows Blackwell host (sm_120/sm_121) with a CUDA 13.1/13.2 driver and a published release containing only cuda-13.3 plus cuda-12.4, the published path gates off 13.3 and returns the CPU-only 12.4 attempt, so the new b9360 GPU fallback is not used for the normal install flow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 787acc2aa4
ℹ️ 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".
| pinned = _pinned_windows_cuda_fallback(host, attempts) | ||
| if pinned is not None: | ||
| attempts.insert(0, pinned) |
There was a problem hiding this comment.
Pair the pinned fallback with its source tag
On the Windows Blackwell 13.1/13.2 direct-upstream path, inserting the b9360 attempt into the current release plan leaves InstallReleasePlan.llama_tag set to the current release tag. validate_prebuilt_choice() hydrates source from that plan-level llama_tag before overlaying choice.name, so the first attempt installs b9360 binaries on top of newer source/scripts (and records the newer tag in metadata). If the fallback is needed, it should be planned with the matching b9360 source/provenance or otherwise carry per-attempt source metadata.
Useful? React with 👍 / 👎.
The pin was only inserted in direct_upstream_release_plan (the --simple-policy path). Both setup scripts pass --simple-policy, so production installs already reach it, but a non-simple-policy invocation (resolve_install_release_plans -> resolve_release_asset_choice) bypassed it. Insert it there too via a shared helper that also augments the approved checksums with the pin's own verified hashes so it survives apply_approved_hashes. The helper is a no-op whenever the pin is dormant, so no other host changes behavior.
The pinned b9360 binary intentionally overlays the current release's source tree and convert scripts, with its own tag recorded via binary_release_tag, the same binary/source split already used for the lemonade prebuilt. Note this on the pin so the provenance is not mistaken for a tag bug.
…t blocked (#5912) * Studio: defer the Windows CUDA Toolkit check so prebuilt users are not blocked setup.ps1 section 1e validated the installed CUDA Toolkit against the driver in Phase 1 and hard-exited when the toolkit was newer than the driver supports. That ran before the prebuilt llama.cpp install (Phase 3.4), which is self-contained and needs no local toolkit. A Blackwell host (sm_120) on a driver that advertises CUDA 13.2 with CUDA Toolkit 13.3 installed was blocked entirely, even though the prebuilt selector would have given it a working GPU build. The toolkit (nvcc) is only consumed by the Phase 4 source build. Move section 1e into a Resolve-CudaToolkit function and call it lazily at the source-compile branch, gated on $HasNvidiaSmi. The prebuilt path no longer touches the toolkit; forced/source builds keep the identical requirement, winget auto-install, and error text via -RequireOrExit. Add a pwsh unit test that extracts the real function and runs it against a spoofed Blackwell sm_120 / driver 13.2 / toolkit 13.3 host: the prebuilt path defers, the forced build still fails fast. Refs #5879. * Studio: correct a stale Phase-1 prerequisites comment (CUDA Toolkit is now resolved lazily) * Studio: retrigger Windows GGUF CI (artifact upload flake)
Summary
The Windows prebuilt selector hardcoded the cuda13 minor as
13.1. ggml-org bumped their published Windows CUDA 13 build to13.3(b9365 and later; current releases shipcuda-12.4andcuda-13.3only), so the selector requested acuda-13.1asset that no longer exists, missed, and silently fell back tocuda-12.4. The native cuda13 prebuilt was unreachable.Rather than swap one hardcoded minor for another, this makes the NVIDIA prebuilt selection version-dynamic and driver-gated on both the Windows (ggml-org) and Linux (unslothai/llama.cpp) paths, so future CUDA bumps are handled with no code change while staying safe across driver versions. It then pins one immutable older asset to keep Blackwell on a sub-13.3 driver on the GPU.
What this changes
cuda12) instead of a hardcodedcuda13/cuda12pair. A driver runs its own major and any older major (backward compatibility).(major, minor) <= driver. So the selector follows ggml-org's minor bumps (13.1->13.3-> ...) but does not hand a13.3build to a driver that only advertises13.1(that would rely on the unguaranteed minor-version-compatibility path; CUDA 13.3 wants a 610+ driver, 13.1 ships 590). A gated line falls through to the next older major, which the driver can run.cudart64_<major>.dllon Windows,libcudart.so.<major>on Linux), so a new toolkit is detected without a code change.cuda<major>generically; an unknown future major inherits the newest known major's sm coverage for the same class as a forward default, with the post-build GPU smoke test as the backstop.cuda12/cuda13pair, so a future publishedcuda14asset is ordered with no code change.Blackwell GPU fallback (b9360 cuda-13.1 pin)
ggml-org compiles Blackwell
sm_120(120a-real) only when the CUDA toolkit is>= 12.8, so theircuda-12.4Windows build never offloads on Blackwell. With the gating above, a Blackwell (sm_120/sm_121) host on a13.1or13.2driver is correctly kept off the13.3build, but the only sub-13.3 Windows asset iscuda-12.4, so it would run CPU-only.b9360is the last release whose Windowscuda-13build is sub-13.3 (13.1), and release assets are immutable. So on the upstream install path, when a Blackwell host is gated off the in-release cuda13 build but its driver can run13.1, the selector inserts theb9360cuda-13.1build (with its paired cudart and verified sha256 for both archives) ahead ofcuda-12.4. If that download or validation ever fails it degrades tocuda-12.4then CPU, exactly as before.The pin is dormant for non-Blackwell hosts, sub-
13.1or non-NVIDIA drivers, and any release that publishes a driver-runnable cuda13 build (theno existing cuda13 attemptguard), so it self-disables the moment upstream resumes a sub-13.3 build. Linux is unaffected: it uses unslothai/llama.cppcuda12-newer, built with toolkit 12.8, which already covers Blackwell.Behavior (verified by spoofing the driver version, no GPU)
Windows (ggml-org ships
12.4+13.3):When ggml-org publishes a
cuda-14.0or resumes a sub-13.3 build, the dynamic selection picks it automatically and the pin stays dormant.Linux / WSL (unslothai/llama.cpp major-named bundles): a 13.x driver selects the cuda13 bundle, a 14.x driver selects a published cuda14 bundle when present (else cuda13 via backward compatibility), and a 12.x driver selects cuda12. Unaffected by the Windows minor rename because these bundles are named by major.
Tests
tests/studio/install/test_selection_logic.py:cuda14bundle parse.direct_upstream_release_planthe order is[b9360 cuda-13.1, cuda-12.4, windows-cpu]for a 13.1 driver and unchanged for a 13.3 driver.Validation
python -m pytest tests/studio/install/green (532 passed, 1 skipped), no regression.cuda12-newer, downloaded and sha256-verified the bundle, thevalidate_serverGPU smoke passed, and the activatedllama-serveroffloads to the GPU (CUDA0 in use, coherent output). A Blackwell host gets a working CUDA prebuilt on Linux, not CPU.b9360URLs resolve (HTTP 200) and their sizes match the GitHub asset digests embedded as the verified sha256.Notes
Scope is the prebuilt asset selector. #5826 (source-build
-allow-unsupported-compiler+ CUDA to CPU fallback) and #5817 (UMD version detection) are separate code paths. The Blackwell pin resolves the13.1/13.2-driver case of #5887; the13.0/12.x-driver Blackwell sliver remains a driver-update matter (or is closed when ggml-org ships a sub-13.3 Windows build). Refs #5861, #5817, #5807, #5858, #5854, #5826, #5887.