Repository navigation
Installer Windows: honour UNSLOTH_FORCE_ROCM_TORCH on a mixed NVIDIA + AMD host and say when the AMD card is skipped - #19181
Merged
danielhanchen merged 22 commits intoNov 24, 2026
Conversation
…ding CUDA_VISIBLE_DEVICES on mixed NVIDIA + AMD hosts, and say when the AMD card is skipped
…IDIA CUDA mask in the notice, and warn about a hiding mask on update too
…wing iGPU on a mixed host, as setup.ps1 picks it
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…iant and the device-pack fast path [skip ci]
…er and opaque pins; no amd-smi in the notice probe [skip ci]
…route, weigh amd-smi arches, keep Write-StudioLine in step with setup.ps1
…DIA; initialise the mute flag for StrictMode callers [skip ci]
…onsole-less banner test
…see, not just a declared arch [skip ci]
danielhanchen
added a commit
that referenced
this pull request
Nov 24, 2026
## Problem On runners with 16 GB of RAM, 35 llama.cpp placement tests fail across `(Python 3.13, g-l)` and `(Python 3.13, m-r)`. The staging runs for #19113, #19181 and #19244 all show them, for example: ``` test_llama_cpp_placement.py::test_the_moe_cache_stays_off[ram_cannot_pin_experts-] assert _load_mode(cmd) == "none" (None == 'none') Load mode: keeping mmap; pinning the host-side weights plus the 9.0 GB llama-server grows into would hold more than 50% of the 15.3 GB of RAM, which the OS cannot page out. ``` They pass on larger runners and locally, so this only shows up on some runners. ## Cause #19231 (price llama-server host RAM growth before pinning a spilled load) is correct. A pinned launch (`--load-mode none`) now also checks that the pinned host-side weights plus llama-server's growth stay under a safe share of total RAM. That total comes from `_host_memory_capacity_mib()`, which reads the real `MemTotal` and the cgroup limit. The placement tests fake the GPUs and, where they care, the available RAM. They never pin the total, so each launch decided against whatever machine ran it. Reproduced locally by stubbing `_total_system_memory_mib` to 15667 MiB: 35 failed, 770 passed in the three files below. ## Fix - `test_llama_cpp_placement.py` gets an autouse fixture, `_pinned_host_ram`. It pins `LlamaCppBackend._total_system_memory_mib` to 256 GiB and `_cgroup_memory_limit_mib` to `None`, so every launch sees the same host on any runner. - `test_lookup_table_fit.py` and `test_prompt_cache_sized_to_context.py` launch through that file's helpers, so they import the fixture. - Tests that are about host RAM still set their own total in the test body, which overrides the fixture. ## Verification - The three files on this branch: 805 passed. - With the host forced to 15.3 GB (a plugin stubbing `_total_system_memory_mib`): 805 passed on this branch, and 35 failed on main. - All 34 test files that import `test_llama_cpp_placement`: 2365 passed and 24 skipped. - One test failed: `test_cached_gguf_routes.py::test_pipeline_class_guard_passes_every_shipped_family`. - It fails identically on main, because this host has diffusers 0.41.0.dev0 and the test needs 0.42.0. It is unrelated to this change.
…nce, not a second arch inference [skip ci]
danielhanchen
added a commit
that referenced
this pull request
Nov 24, 2026
…9310) ## Problem `tests/test_prefetch_snapshot_scope.py::test_st_cache_resolutions_honor_explicit_hf_cache_dir` fails on main since #19170, and with it the Core legs of every PR based on main (seen first on the staging run for #19181): ``` AssertionError: an ST cache_dir resolution must read an explicit kwargs.get('cache_dir') first ``` ## Cause #19170 added `_refuse_network_share_raw_adapter_base(...)` before both `SentenceTransformer(...)` loads. On the `for_inference = True` route it passes ```python cache_dir = st_kwargs.get("cache_folder") or os.environ.get("SENTENCE_TRANSFORMERS_HOME"), ``` The code is right. A few lines earlier the same function maps an explicit HF `cache_dir` onto `st_kwargs["cache_folder"]`: ```python _st_cache = kwargs.get("cache_dir") or kwargs.get("cache_folder") if _st_cache is not None: st_kwargs["cache_folder"] = _st_cache ``` so `st_kwargs.get("cache_folder")` already reads `cache_dir` first, and it is the same value the neighbouring `_check_modules_json_types(..., cache_dir = st_kwargs.get("cache_folder"))` call and the `SentenceTransformer(**st_kwargs)` load use. The guard only looked for the literal `'cache_dir'` inside the expression, so it could not see the mapping. #19170's own CI ran on an older base and the failure showed up only after it merged. ## Fix Test only, no product code changes. The guard now accepts a resolution that either: - reads `kwargs.get("cache_dir")` as its first operand, or - reads `<dict>.get("cache_folder")` first, where the same function, earlier, assigns `<dict>["cache_folder"]` only from expressions whose first operand reads `cache_dir` (directly or through one local name). This is stricter than before in one way: `cache_dir` has to come first, not just appear somewhere in the expression. ## Verification - `tests/test_prefetch_snapshot_scope.py`: 43 passed (1 failed on main). - Sabotage, one at a time on `sentence_transformer.py`, each makes the guard fail: - swapping the mapping to `kwargs.get("cache_folder") or kwargs.get("cache_dir")`; - dropping `st_kwargs["cache_folder"] = _st_cache`; - changing the delegated route's resolution to `kwargs.get("cache_folder") or os.environ.get("SENTENCE_TRANSFORMERS_HOME")`. - With `tests/test_adapter_unc_base_guard.py` (the tests #19170 added): all pass.
…he CUDA-mask juggling it needed [skip ci]
Member
|
@codex review |
1 similar comment
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
danielhanchen
added a commit
that referenced
this pull request
Nov 24, 2026
## Problem Two install.ps1 source checks fail on main since #19181 (honour `UNSLOTH_FORCE_ROCM_TORCH` on a mixed NVIDIA + AMD Windows host): - `tests/studio/install/test_rdna1_unsupported_message_8529.py::test_the_unsupported_arch_variable_is_declared_outside_the_amd_block` ``` AssertionError: install.ps1: the AMD declaration block was restructured; re-check this test ``` - `tests/studio/install/test_rocm_support.py::TestHipSdkInstalledButDeviceInaccessible::test_install_ps1_sets_flag_when_hipinfo_binary_found` ``` assert (-1 != -1) ``` ## Cause #19181 widened two gates on purpose, and both tests anchored on the exact old text: - The AMD probe gate went from `if (-not $HasNvidiaSmi) {` to `if (-not $HasNvidiaSmi -or $ProbeAmdBesideNvidia) {`, so a mixed host is probed for the flag, mask and notice. `$ROCmUnsupportedGfxArch = $null` is still declared before that gate, which is the property the first test protects; its regex just no longer matched the gate line. - The hipinfo block went from `if ($hipinfoExe) {` to `if ($hipinfoExe -and -not $script:StudioMuteLines) {`. The silent, notice-only probe on an NVIDIA host that keeps CUDA does not run hipinfo, so an unbounded HIP tool cannot hold up that install (comment above the block). `$HipSdkInstalled = $true` is still the first statement inside it; the second test searched for the literal `if ($hipinfoExe)` and found nothing. The installer is right in both places; the tests needed to follow it. ## Fix Test only: - The first test accepts any gate that starts `if (-not $HasNvidiaSmi` and still requires the declaration between `$ROCmGfxArch = $null` and that gate. - The second test finds the `if ($hipinfoExe ...)` block by regex, so extra conditions are allowed, but it still requires the gate to test `$hipinfoExe` and now also requires `$HipSdkInstalled = $true` to be the block's first statement (before it only had to appear somewhere after the gate). ## Verification - Both files: 951 passed, 1 skipped (2 failed on main). - Sabotage on `install.ps1`, one at a time, each makes the matching test fail: - moving `$ROCmUnsupportedGfxArch = $null` inside the probe gate; - putting another statement before `$HipSdkInstalled = $true`; - dropping `$hipinfoExe` from the hipinfo gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #12248
On Windows,
install.ps1andsetup.ps1stop looking for AMD once an NVIDIA GPU is found, so a mixed host always gets CUDA torch,UNSLOTH_FORCE_ROCM_TORCHdoes nothing, and nothing says the AMD card was skipped. Linux already handles all three.UNSLOTH_FORCE_ROCM_TORCH=1, orCUDA_VISIBLE_DEVICES=-1, installs ROCm torch through the existing AMD-only Windows route, andsetup.ps1keeps it while the flag or mask is set.install_python_stack.pyno longer ignores the flag on Windows.test_windows_mixed_host_force_rocm_12248.py+ 9 Windows AMD routing suitestest_nvidia_adapter_presence.ps1Not run: a real Windows install on a machine with both an NVIDIA and an AMD GPU.