Skip to content

Studio prebuilt selection: Windows CUDA lines ordered by detected DLLs rather than filtered, portable fallback attempt, keep paths require SM coverage - #11006

Merged
danielhanchen merged 4 commits into
mainfrom
windows-cuda-lines-and-keep-coverage
Sep 15, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
windows-cuda-lines-and-keep-coverage

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Three selection defects in install_llama_prebuilt.py that leave a Windows or Linux host on the wrong llama.cpp bundle, found while re-checking the GPU downgrade reports after #10975, #10976 and #10985.

What was wrong

  • Windows filtered the CUDA runtime lines by the DLLs already on disk. published_windows_cuda_attempts kept only the driver-compatible lines whose runtime DLLs were detected, and fell back to the full list only when nothing was detected. A Pascal card (sm_61) beside a CUDA 13 runtime that torch or another app installed had cuda13 detected, so the cuda12-legacy bundle it needs was filtered out and the host got no fork attempt at all.
  • Windows picked the targeted bundle or the portable one, never both. The Linux selector queues the portable bundle behind the targeted one as the fallback attempt; the Windows one chose a single artifact, so a failed targeted download had nothing left to try.
  • Two keep paths never checked SM coverage. The no-plan fast path compares the recorded host profile, which omits the physical compute capabilities: a card swapped under a CUDA_VISIBLE_DEVICES mask changes only those, so the old bundle was kept as current. The update-failure keep in install_prebuilt only asked whether the binaries start, which proves nothing about the kernels the bundle carries after a card swap.

The change

  • Detection now only orders the lines: detected first, then the remaining driver-compatible ones.
  • The portable bundle follows the best targeted one as its fallback attempt, as on Linux.
  • Both keep paths require _kept_install_covers_host, the same coverage check the plan comparison already uses. The rejection is logged as kept install rejected: the bundle no longer covers this card or driver; the failure path then falls back as before instead of reporting success on a bundle that cannot run the card.

Tests

tests/studio/install/test_windows_cuda_lines_and_keep_coverage.py: a Pascal card beside CUDA 13 DLLs still gets cuda12-legacy; a detected line is tried first with the other line still following; the portable bundle follows the targeted one and is the only attempt when nothing targeted covers the card; a card swapped under a mask is not kept by the fast path; an update failure keeps the install only while it covers the card, on Linux and Windows layouts.

tests/studio/install/test_pr10648_host_matrix.py's attribution helper also neutralises the coverage guard, since it now refuses the same card swaps the host profile refuses.

The install suite passes (5144 passed); the one failure, test_the_pr_only_added_new_arms_to_the_setup_status_blocks, fails identically on clean main.

…llback attempt, keep paths require SM coverage
@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-15T12:20:27.494181Z 9873938 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.

danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request 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

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0f4f81fa2

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

Comment on lines +3337 to +3339
ordered_lines = [line for line in compatible if line in detected] + [
line for line in compatible if line not in detected
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align fast-path selectability with the new Windows ordering

When Windows detects one runtime line but Torch prefers another driver-compatible line (for example, CUDA 13 DLLs are detected while torch.version.cuda is CUDA 12), this selector now correctly moves the Torch line to the front even though it was not detected. However, _runtime_line_selectable still requires a preferred Windows line to be detected whenever any DLL line is present, so _runtime_preference_moved returns false and the no-plan fast path keeps an existing CUDA 13 install rather than replanning to the CUDA 12 bundle that this code would select. Update the fast-path predicate to treat every driver-compatible app-bundle line as selectable on Windows.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9873938: _runtime_line_selectable treats every driver-compatible Windows line as selectable, since detection only orders the Windows lines now; Linux still requires the runtime on disk. Covered by test_every_driver_compatible_windows_line_is_selectable.

@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 Datta0/unsloth-staging-3 that referenced this pull request Sep 15, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 98739388d8

ℹ️ 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 23146c6 into main Sep 15, 2026
53 checks passed
@danielhanchen
danielhanchen deleted the windows-cuda-lines-and-keep-coverage branch September 15, 2026 13:21
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…s rather than filtered, portable fallback attempt, keep paths require SM coverage (unslothai#11006)

* Windows CUDA lines ordered not filtered by detected DLLs, portable fallback attempt, keep paths require SM coverage

* Shorten two comments for PR unslothai#11006

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

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

* Every driver-compatible Windows runtime line is selectable for the fast path, for PR unslothai#11006

---------

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.

2 participants