Repository navigation
Windows/WSL installer: fix winget msstore cert failure, amd-smi DiskPart prompt, and enable AMD GPU (Strix Halo gfx1151) - #5940
Conversation
`winget install` was invoked without `--source winget`, so winget also queried the msstore source. When msstore fails certificate pinning (error 0x8a15005e, "The server certificate did not match any of the expected values") winget aborts and demands `--source`, so the Python (and uv) install fails even though the package exists in the winget source. - Pass `--source winget` to all winget install calls (Python x2, uv). Both packages live in the winget source, so this is strictly correct and skips the failing msstore round-trip entirely. - Add a python.org fallback (Install-PythonFromPythonOrg) that downloads the official installer and runs it silently per-user (no admin/UAC) when winget is unavailable or fails for any reason. Mirrors the existing uv -> astral.sh fallback so Python installs without manual steps. Resolves the latest 3.13.x from python.org with a pinned fallback, and selects the amd64/arm64/x86 installer per architecture. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Two winget invocations in studio/setup.ps1 still queried all sources and could hit the same msstore certificate-pinning failure (0x8a15005e) that broke the Python install in install.ps1: - `winget show Nvidia.CUDA --versions` (CUDA Toolkit version probe) - `winget install ... ShiningLight.OpenSSL.Dev` (OpenSSL dev for llama-server) Every other winget call in this file already passes `--source winget` (Git, CMake, VS Build Tools, CUDA install, Node.js, and setup.ps1's own Python 3.12 install), so these two were stragglers. Both packages live in the winget source; pinning it makes setup robust to an unhealthy msstore source, matching the rest of the file. Co-Authored-By: Claude Opus 4.8 <[email protected]>
On Windows, AMD GPU detection in install.ps1 and studio/setup.ps1 runs `amd-smi list` / `static --asic` / `version`. amd-smi (shipped in System32 by the Adrenalin driver) auto-elevates to read GPU/APU memory details, surfacing a confusing DiskPart UAC prompt mid-install. The Studio backend already documents and circuit-breaks on this in studio/backend/utils/hardware/amd.py, but the installers did not. Add an Invoke-AmdSmiNoElevate helper (both scripts) that runs amd-smi via Start-Process under __COMPAT_LAYER=RunAsInvoker so it cannot auto-elevate (no prompt), with a 30s timeout (matching amd.py) so a flaky amd-smi cannot stall the install for minutes. On failure/timeout the existing WMI name -> gfx fallback still resolves the arch, so detection is unchanged on working hosts. Verified on a Strix Halo (Radeon 8060S / gfx1151) box: the prompt is gone and the probe is bounded. Co-Authored-By: Claude Opus 4.8 <[email protected]>
install.sh already routes gfx1151 (Radeon 8060S / Strix Halo) to the repo.amd.com/rocm/whl/gfx1151 wheels once a ROCm runtime is present, but it does not install AMD's driver/ROCm stack -- a large, admin-gated prerequisite. scripts/install_rocm_wsl_strixhalo.sh automates the Linux side on a dedicated Ubuntu 24.04 WSL2 distro: ROCm 7.2 (wsl usecase), the rocr4wsl HSA runtime, a librocdxg build, env setup, and a PyTorch gfx1151 GPU smoke test. A hard preflight refuses to run until the Adrenalin >=26.3.1 driver is actually present, so it cannot half-install. Procedure adapted from AMD's ROCm-on-WSL docs and community gfx1151 notes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The gfx-arch inference from the WMI GPU name was gated behind $HasROCm, which the hipinfo/amd-smi probe leaves false on the common Windows case (Adrenalin driver only, no HIP SDK -- and amd-smi often cannot read the arch without elevation). So an AMD GPU was detected by name but never mapped to a gfx target, --rocm-gfx was not forwarded, and studio setup fell back to a CPU llama.cpp build. Un-gate the inference (install.ps1 + studio/setup.ps1) so it runs whenever an AMD GPU name is available. The inferred gfx is forwarded as --rocm-gfx, which makes install_llama_prebuilt.py download the matching lemonade-sdk ROCm prebuilt (e.g. llama-bNNNN-windows-rocm-gfx1151-x64.zip) -- a GPU-accelerated llama.cpp that bundles its own ROCm runtime, so it runs with just the Adrenalin driver. PyTorch's ROCm wheels still require a confirmed HIP SDK ($HasROCm), so this only affects llama.cpp / inference and never pulls broken ROCm torch. Also broaden the name->arch table to every family lemonade ships Windows assets for: gfx120X (RDNA 4), gfx110X (RDNA 3), gfx1151/gfx1150 (RDNA 3.5), and gfx103X (RDNA 2). Unknown names still fall back to CPU. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The earlier PowerShell guard covered install.ps1 / setup.ps1, but the Python installer (install_llama_prebuilt.py detect_host, install_python_stack.py ROCm probes) and the Studio backend monitor (amd.py) also shell out to amd-smi on Windows, where it auto-elevates and pops the same DiskPart UAC prompt mid-install / at runtime. Inject __COMPAT_LAYER=RunAsInvoker into the amd-smi subprocess env on Windows so it runs un-elevated (no prompt). Callers already tolerate an empty/failed result and fall back to WMI / name detection (installer) or the existing circuit breaker (amd.py). Gated to Windows so Linux/macOS amd-smi behaviour is unchanged. - install_llama_prebuilt.py: handled centrally in run_capture (covers detect_host's `amd-smi list` and the version probe). - install_python_stack.py: new _amd_smi_env() helper on its 3 raw subprocess.run amd-smi calls. - amd.py: merge RunAsInvoker into the existing child env. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The W9[0-9]{3} and RX 90[0-9]{2} patterns added for RDNA 4 were
speculative and over-broad: W9xxx would also match old GCN FirePro
W9100/W9000 cards (wrong gfx1201 -> a lemonade gfx120X download that
fails validation), and RX 90[0-9]{2} was redundant with the explicit
9070/9060 entries. Drop both; keep only confirmed RDNA 4 SKUs. Unmatched
AMD names still fall back cleanly to CPU.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
The prebuilt validation downloads a tiny GGUF test model from huggingface via bare urllib. On Windows / proxy setups where the server sends an incomplete TLS chain, urllib cannot complete the Amazon CA chain (it does no AIA intermediate fetching) and fails with CERTIFICATE_VERIFY_FAILED, so a perfectly good GPU prebuilt is rejected and the installer falls back to a CPU source build. Route the validation-model download through huggingface_hub (hf_hub_download) -- the same mechanism Studio uses for model downloads, which completes the chain where urllib cannot -- keeping the direct URL as a fallback. This lets the lemonade ROCm prebuilt validate and install on cert-restricted machines (verified: hf_hub_download succeeds where urllib returns CERTIFICATE_VERIFY_FAILED). Co-Authored-By: Claude Opus 4.8 <[email protected]>
A ROCm-version detector in install_llama_prebuilt.py called amd-smi version through a raw subprocess.run that bypassed run_capture's Windows RunAsInvoker guard, so it still triggered the DiskPart UAC prompt during setup. Route it through run_capture like the other amd-smi calls. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces several improvements to the installation and setup scripts, primarily focusing on robust AMD GPU detection and installation fallback mechanisms. Key changes include adding a fallback mechanism to install Python directly from python.org when winget fails, pinning winget sources to bypass certificate issues, and preventing confusing UAC elevation prompts on Windows by running amd-smi with __COMPAT_LAYER=RunAsInvoker. Additionally, an experimental script is added to automate ROCm-on-WSL setup for AMD Strix Halo, and the validation model download process is updated to prefer huggingface_hub. The review feedback recommends defensively checking for null process objects when starting processes in PowerShell and avoiding parsing ls output in shell scripts.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (-not $p.WaitForExit($TimeoutSec * 1000)) { | ||
| try { $p.Kill() } catch {} | ||
| $global:LASTEXITCODE = 124 | ||
| return "" | ||
| } | ||
| $global:LASTEXITCODE = $p.ExitCode |
There was a problem hiding this comment.
Defensively guard against $p being $null. If Start-Process fails to launch the executable under certain execution policies or if the caller has a global $ErrorActionPreference set to SilentlyContinue, $p can be $null. Calling .WaitForExit() or accessing .ExitCode on a $null object will throw a cryptic runtime exception. Adding a null check ensures the function fails gracefully.
if ($null -eq $p) {
$global:LASTEXITCODE = 1
return ""
}
if (-not $p.WaitForExit($TimeoutSec * 1000)) {
try { $p.Kill() } catch {}
$global:LASTEXITCODE = 124
return ""
}
$global:LASTEXITCODE = $p.ExitCode
| if (-not $p.WaitForExit($TimeoutSec * 1000)) { | ||
| try { $p.Kill() } catch {} | ||
| $global:LASTEXITCODE = 124 | ||
| return "" | ||
| } | ||
| $global:LASTEXITCODE = $p.ExitCode |
There was a problem hiding this comment.
Defensively guard against $p being $null. If Start-Process fails to launch the executable under certain execution policies or if the caller has a global $ErrorActionPreference set to SilentlyContinue, $p can be $null. Calling .WaitForExit() or accessing .ExitCode on a $null object will throw a cryptic runtime exception. Adding a null check ensures the function fails gracefully.
if ($null -eq $p) {
$global:LASTEXITCODE = 1
return ""
}
if (-not $p.WaitForExit($TimeoutSec * 1000)) {
try { $p.Kill() } catch {}
$global:LASTEXITCODE = 124
return ""
}
$global:LASTEXITCODE = $p.ExitCode
| # The Adrenalin >=26.3.1 driver injects ROCm/DXG runtime libs into | ||
| # /usr/lib/wsl/lib. If only the base D3D12/dxcore libs are present, the driver | ||
| # is too old -- stop before touching apt. | ||
| if ! ls /usr/lib/wsl/lib/ 2>/dev/null | grep -qiE 'hsa|rocm|amdhip|dxg'; then |
There was a problem hiding this comment.
Avoid parsing the output of ls as it can be fragile (e.g., if filenames contain unusual characters, though unlikely here). A more robust and idiomatic way to check for the presence of specific files in a directory is to use find or a glob expansion.
| if ! ls /usr/lib/wsl/lib/ 2>/dev/null | grep -qiE 'hsa|rocm|amdhip|dxg'; then | |
| if ! find /usr/lib/wsl/lib/ -maxdepth 1 -mindepth 1 2>/dev/null | grep -qiE 'hsa|rocm|amdhip|dxg'; then |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2ad7e2845
ℹ️ 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".
| # below) so a GPU-accelerated llama.cpp is downloaded instead of a CPU build. | ||
| # (PyTorch's ROCm wheels still require a confirmed HIP SDK -- they stay gated | ||
| # on $HasROCm below -- so this only affects llama.cpp / inference.) | ||
| if (-not $script:ROCmGfxArch) { |
There was a problem hiding this comment.
Forward inferred ROCm arch without requiring HasROCm
When only the new WMI/name-inference path succeeds, $script:ROCmGfxArch is now set while $HasROCm remains false, but the llama prebuilt invocation still adds --has-rocm/--rocm-gfx only inside if ($HasROCm) at studio/setup.ps1:2539-2545. In that Adrenalin-only scenario described here, the inferred arch is never forwarded to install_llama_prebuilt.py, so setup still downloads the CPU llama.cpp build instead of the intended ROCm lemonade prebuilt.
Useful? React with 👍 / 👎.
setup.ps1 forwarded --rocm-gfx (and picked the windows-hip llama.cpp prebuilt) only inside `if ($HasROCm)`. On Adrenalin-only hosts (amd-smi present but no HIP SDK, so $HasROCm stays false) the gfx arch was name-inferred but never forwarded, so install_llama_prebuilt.py saw has_rocm=False and installed the CPU build -- even though the lemonade gfx1151 GPU prebuilt runs fine there (it bundles its own ROCm runtime; verified: llama-cli --list-devices -> ROCm0: AMD Radeon 8060S, 69 GB). Forward --rocm-gfx whenever a gfx arch is known (it is authoritative and implies ROCm in install_llama_prebuilt.py), and treat a known gfx arch as windows-hip in the existing-install mismatch check. --has-rocm stays gated on the confirmed-runtime signal. Verified on Radeon 8060S / gfx1151: the installer now selects, validates, and installs llama-b1286-windows-rocm-gfx1151-x64.zip (ROCm DLLs present) instead of the CPU build. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef808e0fc8
ℹ️ 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".
| @{ P = "780M|760M|740M|Phoenix"; A = "gfx1103" } # RDNA 3 iGPU (Phoenix) | ||
| @{ P = "9070 XT|9080"; A = "gfx1201" } # RDNA 4 (Radeon RX 9070 XT / 9080) | ||
| @{ P = "9070|9060"; A = "gfx1200" } # RDNA 4 (Radeon RX 9070 / 9060) | ||
| @{ P = "8060S|8050S|8040S|890M|Strix Halo|Ryzen AI Max|HX 37[05]|HX 38[05]|AI 9 HX|AI Max"; A = "gfx1151" } # RDNA 3.5 (Strix Halo / Radeon 8000S iGPU) |
There was a problem hiding this comment.
Map Radeon 890M/HX parts to gfx1150
When the new WMI/name-only inference path is used, this row now feeds --rocm-gfx and forces a Windows HIP llama.cpp install, so Radeon 890M / Ryzen AI 9 HX 370-style Strix Point hosts get classified as gfx1151. The repo’s runtime classifier documents 890M/880M as Strix Point gfx1150 and reserves 8060S/8050S for Strix Halo gfx1151 (studio/backend/core/training/worker.py:720-722), so these users will download the wrong ROCm prebuilt/index. Please move the 890M/HX 37x/AI 9 HX patterns to the gfx1150 row here and in the mirrored install.ps1 table.
Useful? React with 👍 / 👎.
…port) setup.ps1 picked the AMD ROCm PyTorch wheels only inside `if ($HasROCm ...)`. On Adrenalin-only hosts (amd-smi present but no HIP SDK, so $HasROCm is false) the gfx arch was name-inferred but the ROCm-wheel branch never ran, so the host got torch+cpu. With CPU torch, torch.cuda.is_available() is False, so the Studio backend sets CHAT_ONLY=True and hides Train/Export. Un-gate the ROCm PyTorch index resolution on a known gfx arch (mirrors the llama.cpp --rocm-gfx fix). AMD's per-arch Windows wheels (repo.amd.com/rocm/whl/<gfx>) bundle the ROCm runtime, so they work without a HIP SDK; a failed install still falls back to CPU. Verified on Radeon 8060S / gfx1151: torch 2.11.0+rocm7.13.0 installs and torch.cuda.is_available() -> True, device "AMD Radeon(TM) 8060S Graphics", GPU matmul OK -> CHAT_ONLY=False -> Train/Export enabled. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Guarding individual amd-smi call sites kept missing some (install_python_stack.py's probe loop and its Windows GPU re-check), so the DiskPart UAC prompt kept reappearing. Set __COMPAT_LAYER=RunAsInvoker process-wide at the top of install_python_stack.py and install_llama_prebuilt.py on Windows so every amd-smi subprocess (current and future) runs un-elevated with no per-call guard. Safe: these scripts only spawn amd-smi/rocminfo/hipinfo probes and pip/uv. setup.ps1 keeps per-call guards because it also spawns winget installers that need elevation. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05e394ebcc
ℹ️ 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".
|
|
||
| # ── Step 5: verify the runtime sees the GPU ── | ||
| say "Verifying rocminfo sees ${GFX}" | ||
| rocminfo | grep -E 'Load librocdxg|gfx1151|Marketing Name' || die "rocminfo did not enumerate ${GFX}. Re-check the driver version and reboot." |
There was a problem hiding this comment.
Require gfx1151 in the ROCm verification
On WSL hosts where rocminfo runs but does not actually enumerate the Strix Halo GPU, this alternation still succeeds if the output contains a generic Marketing Name or Load librocdxg line, so the script skips the intended die and continues to install/test PyTorch. Because the Python test only prints torch.cuda.is_available() and does not fail when it is false, a broken ROCm setup can reach the final “Done” message; make the verification require a gfx1151 match instead of any of these diagnostic lines.
Useful? React with 👍 / 👎.
Start-Process -PassThru leaves the returned process object's .ExitCode $null after WaitForExit on Windows PowerShell 5.1, so the helper set $LASTEXITCODE to $null and every caller's `if ($LASTEXITCODE -eq 0 ...)` was always false -- the amd-smi GPU / gfx-token / ROCm-version detection branch was effectively dead (masked only because the un-gated WMI name->gfx inference still ran). Reproduced on PS 5.1.26100. Rewrite the helper to use [System.Diagnostics.Process]::Start with a ProcessStartInfo (UseShellExecute=false), whose .ExitCode is reliable, with async stream reads (ReadToEndAsync) to avoid a pipe-buffer deadlock and WaitForExit(timeout) to bound a flaky amd-smi. __COMPAT_LAYER= RunAsInvoker (inherited via the process env) still suppresses the auto-elevation / DiskPart prompt. Also drops the temp files and the empty-ArgumentList edge case. Verified: exit code propagates (7 -> $LASTEXITCODE=7), output captured, env restored. Also fix the gfx1100 name pattern `RX 7700(?! S)` -> `RX 7700(?!S)` so the spaceless retail name "RX 7700S" is correctly excluded (it belongs to the gfx1102 row). Both found by PR review. Co-Authored-By: Claude Opus 4.8 <[email protected]>
From the multi-agent PR review: - install.sh: sync the AMD name->arch table with install.ps1 / setup.ps1 (the bash table had drifted to the old narrow patterns). Adds RDNA 2 (gfx103X), workstation PRO W SKUs, and more Strix Halo/Point names, and orders gfx1102 before gfx1100 so the spaceless retail name "RX 7700S" resolves correctly (bash case has no negative lookahead). AMD-ROCm-only: the name inference stays gated behind _has_amd_rocm_gpu(), so NVIDIA / CPU / macOS are unaffected. - setup.ps1: the "dependencies up to date" fast path skipped the torch reinstall, so an existing user who had CPU torch (installed before ROCm-wheel support) stayed stuck in CHAT_ONLY. Now, when an AMD gfx arch is known AND the installed torch is CPU-only, don't skip -- force the dependency pass so the ROCm wheels install. - scripts/install_rocm_wsl_strixhalo.sh: resolve the real /opt/rocm dir instead of hardcoding ROCM_VER for LD_LIBRARY_PATH / the librocdxg symlink (breaks if amdgpu-install lays ROCm under a patch-version dir); add a LIBROCDXG_REF pin knob and a "verified against" freshness header. - tests/studio/install/test_pr5940_followups.py: cover _hf_resolve_url_parts, _fetch_validation_model_bytes (hf path + urllib fallback), run_capture's Windows-only amd-smi RunAsInvoker injection, and install.ps1 vs setup.ps1 name-table parity (catches future drift). 14 tests, all passing. Co-Authored-By: Claude Opus 4.8 <[email protected]>
On Windows, amd-smi re-initialises the ROCm runtime on every invocation (even `amd-smi version`) and, on hosts without a working HIP runtime (consumer APUs/dGPUs with only the Adrenalin driver), elevates a child process at runtime -- popping a UAC/DiskPart prompt. amd-smi's own manifest is asInvoker, so __COMPAT_LAYER=RunAsInvoker cannot suppress that runtime elevation (verified: even `amd-smi version` hangs and times out with RunAsInvoker set). Replace the ineffective RunAsInvoker-only approach with a real gate: only spawn amd-smi on Windows when a HIP SDK is detectable (hipinfo present, so amd-smi runs un-elevated) or the user opts in with UNSLOTH_ENABLE_AMD_SMI=1. The gfx arch is already resolved from WMI name inference (forwarded via --rocm-gfx), so ROCm wheel + lemonade llama.cpp selection is unaffected. Linux/macOS amd-smi never elevates and is untouched (no regression). RunAsInvoker is kept as harmless belt-and-suspenders for tools that DO use manifest elevation. Applied consistently across: - studio/backend/utils/hardware/amd.py (runtime GPU polling) - install.ps1, studio/setup.ps1 (install-time detection) - studio/install_llama_prebuilt.py (prebuilt arch probe + version) - studio/install_python_stack.py (ROCm version + arch probe) Verified live on AMD Radeon 8060S (gfx1151), native Windows: fresh install detects the GPU, installs ROCm torch (torch.cuda.is_available() True), launches Studio with no DiskPart prompt, and inference, tool calling, web search, LoRA finetuning, and GGUF export all run on the GPU. Tests: add 6 _amd_smi_allowed() gating tests + PowerShell-installer gate assertions; update the three amd-smi monitoring tests to opt in (they mock amd-smi as available). Full suite: 267 passed, 2 skipped. Co-Authored-By: Claude Opus 4.8 <[email protected]>
In WSL, an AMD GPU's ROCm-on-WSL runtime is only available with a recent Adrenalin driver AND a distro AMD supports (currently Ubuntu 24.04). When neither is in place, GPU detection (rocminfo/_has_amd_rocm_gpu) finds nothing and we silently fall back to CPU. Add an actionable hint in the CPU-fallback path, shown only on WSL and only AFTER detection has already failed -- so it is forward-compatible: the moment a driver/distro DOES expose the GPU (e.g. if AMD later adds Ubuntu 26.04 support), detection succeeds and the hint never fires. The message: - notes a GPU is plumbed in (/dev/dxg) but no ROCm runtime is exposed, - lists the two prerequisites (Adrenalin driver + Ubuntu 24.04), - if the distro is not 24.04, says AMD may not support it yet, - tells the user to `wsl --install Ubuntu-24.04` and re-run, - links AMD's ROCm-on-WSL guide + the experimental Strix Halo helper. Verified live: on Ubuntu-24.04 the hint shows (version-warning omitted) and the CPU install completes; on Ubuntu-26.04 the extra "this distro may not be supported" line appears and points to 24.04. Also fix the experimental scripts/install_rocm_wsl_strixhalo.sh: AMD's repo.radeon.com/amdgpu-install/ is indexed by unified installer version (30.30, 31.30, ...), NOT ROCm version, so the hard-coded amdgpu-install/7.2.0/ path 404'd. Scan the installer dirs newest-first for a noble .deb matching the target ROCm major.minor (ROCm 7.2 -> 30.30.x/amdgpu-install_7.2.x), falling back to the newest available. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee8c7e06ed
ℹ️ 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".
| $amdSmiAllowed = $HipSdkInstalled -or ($env:UNSLOTH_ENABLE_AMD_SMI -match '^(?i)(1|true|yes|on)$') | ||
| if (-not $HasROCm -and $amdSmiAllowed) { |
There was a problem hiding this comment.
Honor the amd-smi opt-out before probing
When UNSLOTH_ENABLE_AMD_SMI=0 is set on a Windows host that has a HIP SDK binary but a broken/non-working runtime, this expression is still true because $HipSdkInstalled wins the -or, so setup continues into Invoke-AmdSmiNoElevate and can show the DiskPart/UAC prompt the new opt-out is meant to avoid; install.ps1 has the same gate. Treat the explicit false values as an override before allowing the HIP-SDK path.
Useful? React with 👍 / 👎.
Two WSL-related fixes informed by AMD's official ROCm-on-WSL docs and field reports for Strix Halo / Ryzen AI Max+ (Radeon 8060S, gfx1151): 1. Shortcut collision (real bug). install.sh's WSL branch wrote "Unsloth Studio.lnk" to the SAME Desktop / Start Menu folder as the native-Windows installer (install.ps1 New-StudioShortcuts). Running install.sh in WSL therefore silently retargeted the native shortcut at the WSL launcher (wt.exe -> wsl.exe), so the desktop/start-menu icon stopped launching native GPU Studio. Now the WSL shortcut uses a DISTINCT name -- "Unsloth Studio (WSL - <distro>).lnk" -- and fetches the Unsloth .ico to %LOCALAPPDATA%\Unsloth Studio so it shows the proper icon. Native and WSL shortcuts now coexist. 2. Precise ROCm-on-WSL prerequisites. Research (AMD radeon-ryzen WSL compatibility matrix, gianni.rosagallina.com Feb-2026 guide, ROCm/legacy-rocm-build#4952/#5509/#6022) confirms WSL GPU on Strix Halo requires AMD Adrenalin Edition >= 26.1.1 (26.2.2+ is the first production ROCDXG/WSL release) + ROCm 7.2.1 + Ubuntu 24.04; an older driver does not inject the ROCm/DXG runtime into /usr/lib/wsl/lib, so rocminfo sees only the CPU. install.sh's WSL hint and the experimental install_rocm_wsl_strixhalo.sh header/preflight now state the exact driver version (was a guessed ">=26.3.1"), bump ROCM_VER to 7.2.1, link AMD's radeon-ryzen docs, and document the known librocdxg caveat that usable VRAM is currently capped at the .wslconfig memory setting. bash -n clean; install test suite 267 passed, 2 skipped. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Adds a detect-and-guide hook for the optional WSL-GPU path. An AMD GPU on native Windows can also be used inside WSL2, but only with AMD Adrenalin Edition >= 26.2.2 (the first production ROCDXG/WSL release). Native Windows GPU works with any recent driver, so this is purely about enabling the WSL path. We intentionally do NOT auto-install the driver: AMD referrer-gates driver downloads (scripted curl/Invoke-WebRequest are blocked) and does not publish Adrenalin via winget, so no installer can reliably fetch it -- and silently swapping a live display driver is risky. Instead we point the user at AMD's official download page (one click), after which the existing WSL detection lights up automatically. - install.ps1: new Show-AmdWslDriverHint -- when an AMD GPU is present and the installed driver predates the 26.2.2 release (DriverDate < 2026-02-01), print a concise tip with the AMD download URL. Handles DriverDate as either a CIM DateTime or a WMI string. Suppress with UNSLOTH_SKIP_AMD_DRIVER_HINT=1. - install.sh (WSL hint): add the direct Adrenalin 26.2.2 download URL and note that AMD downloads are referrer-gated (open in a browser). Verified: hint fires on a Sept-2025 driver, auto-suppresses on >= 2026-02-01; install.ps1 parses; install.sh bash -n clean; suite 267 passed, 2 skipped. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 933c767e70
ℹ️ 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".
| # ($HasROCm false): the gfx arch inferred from the WMI GPU name lets the | ||
| # studio setup forward --rocm-gfx and pull a GPU-accelerated (lemonade) | ||
| # llama.cpp, which bundles its own ROCm runtime. PyTorch's ROCm wheels | ||
| # still require a confirmed HIP SDK -- they stay gated on $HasROCm below. |
There was a problem hiding this comment.
Route name-inferred AMD arch into install.ps1 torch path
When this new WMI/name-inference path succeeds on an Adrenalin-only Windows host, $ROCmGfxArch is set while $HasROCm remains false, but standalone install.ps1 still selects the AMD PyTorch index only under if ($HasROCm -and ...) later in the file. That means the same users this inference now recognizes still fall through to CPU torch in the native installer; mirror the setup.ps1 gate that treats either $HasROCm or a known gfx arch as sufficient before installing from the AMD ROCm index.
Useful? React with 👍 / 👎.
After writing the Desktop / Start Menu .lnk, nudge Explorer to refresh its icon (ie4uinit.exe -show). Without this, a stale icon cache can show a blank shortcut icon until the next explorer restart -- most visible when a shortcut of the same name was rewritten (e.g. a native install followed by a WSL install, which previously shared the name; now they use distinct names, but the cache nudge makes the icon appear immediately regardless). Best-effort and wrapped in try/catch so it never fails the install. The bundled unsloth.ico itself is valid (verified it renders). Co-Authored-By: Claude Opus 4.8 <[email protected]>
For AMD, GPU acceleration comes from the lemonade ROCm prebuilt (it bundles the ROCm runtime, no HIP SDK needed) and is the preferred/default path. The source-build fallback is CPU-only -- a HIP/ROCm *source* build would need the full HIP SDK + ROCm clang toolchain, which the prebuilt exists to avoid. Previously, if an AMD-GPU host ever fell through to the source build (e.g. the prebuilt could not be downloaded), it printed "building llama.cpp (CPU-only, no NVIDIA GPU detected)" and quietly produced a CPU binary -- masking the lost GPU acceleration. Now that case emits a loud [WARN] explaining the GPU prebuilt is the AMD path and how to restore it (re-run / check network / set UNSLOTH_LLAMA_RELEASE_TAG), so AMD never silently degrades to CPU. No behavior change on the happy path: AMD still gets the GPU prebuilt (verified on gfx1151: ggml-hip.dll bundled, ~80% GPU compute during inference). NVIDIA (CUDA source build) and CPU-only hosts are unchanged. setup.ps1 parses; install suite 267 passed, 2 skipped. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…L shortcut
Three gaps found by running a real uninstall on a native-Windows + WSL host;
all fixes are scoped to Unsloth-owned paths and no-op on the other pathways
(env/custom-root, NVIDIA/AMD/CPU, Mac) so nothing else regresses.
uninstall.ps1:
- Remove the default-mode SHARED llama.cpp build + cache. setup.ps1 installs
them at ~/.unsloth/llama.cpp and ~/.unsloth/.cache -- SIBLINGS of studio,
not under it -- so deleting <studio> left hundreds of MB behind. Now removed
explicitly, then ~/.unsloth is dropped ONLY if empty (never nukes unrelated
content). No-op in env/custom mode (llama.cpp nests under the custom root,
removed already) and when absent. UNSLOTH_LLAMA_CPP_PATH (user-owned) is kept.
- New _StopProcessesLockingRoots: _StopStudioProcesses only matched the venv
unsloth/python/studio exe, so it missed (a) llama-server.exe under llama.cpp
and (b) an orphaned multiprocessing python fork that ran from the SYSTEM
python but loaded a venv DLL (bitsandbytes) -- on Windows an open DLL handle
blocks the directory delete, leaving a half-removed install. The new helper
kills any process whose image path OR loaded module is under a target root
(module scan scoped to python/unsloth/llama-server names; vendor-agnostic).
- _RemovePath now retries (transient post-kill handle release).
uninstall.sh:
- Remove the default-mode ~/.unsloth/llama.cpp + ~/.unsloth/.cache; rmdir
~/.unsloth only if empty.
- WSL Windows-side shortcut cleanup now matches by TARGET (any
"Unsloth Studio*.lnk" whose target launches wsl.exe), covering both the
legacy "Unsloth Studio.lnk" and the new "Unsloth Studio (WSL - <distro>).lnk"
-- and never removes a native-Windows shortcut (which launches wscript.exe).
uninstall.ps1 parses; uninstall.sh passes sh -n and bash -n.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
… `<|audio|>` probe (unslothai#6018) * Studio: fix load_freeze audio-type tests for unslothai#6000 Gemma 4 <|audio|> probe unslothai#6000 extended LlamaCppBackend._detect_audio_type_strict audio_vlm arm to also probe Gemma 4 `<|audio|>` (alongside Gemma 3n `<audio_soft_token>`), but did not update the load_freeze simulation suite (last touched by unslothai#5922). Its "no-match" and "bicodec" fixtures only defeat `<audio_soft_token>`; the unmapped `<|audio|>` probe falls through to FakeLlamaServer 1-token default, so detect_audio_type now returns audio_vlm where these tests expect None / bicodec: - test_functional_equivalence_no_match - test_functional_equivalence_bicodec_match - test_response_shape_matches_pre_fix_for_no_match main push-CI does not run "Repo tests (CPU)" (pull_request-only), so this surfaces in every open PR merge-ref (e.g. unslothai#5940, which is unrelated to audio). Fix: map `<|audio|>` to a 2-token response in the three fixtures that intend a non-audio_vlm result (restoring their original semantics), and add a positive test_functional_equivalence_audio_vlm_match locking in unslothai#6000 new `<|audio|>` detection. Co-Authored-By: Claude Opus 4.8 <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
# Conflicts: # unsloth_cli/commands/studio.py
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72655b94e3
ℹ️ 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".
| if ($amdSmiVer) { | ||
| try { | ||
| $smiVerOut = & $amdSmiVer.Source version 2>&1 | Out-String | ||
| $smiVerOut = Invoke-AmdSmiNoElevate $amdSmiVer.Source @('version') |
There was a problem hiding this comment.
Honor the amd-smi opt-out for version probing
When a HIP SDK exists but hipconfig --version does not yield a version, this still invokes amd-smi version even if the user set UNSLOTH_ENABLE_AMD_SMI=0. The new gate above explicitly says that opt-out must win because a broken HIP runtime can still trigger the DiskPart/UAC prompt, but this fallback bypasses $amdSmiAllowed, so affected Windows users still see the prompt during the top-level installer. Guard this version probe with the same $amdSmiAllowed check or skip it when opted out.
Useful? React with 👍 / 👎.
| if ($amdSmiVer) { | ||
| try { | ||
| $smiVerOut = & $amdSmiVer.Source version 2>&1 | Out-String | ||
| $smiVerOut = Invoke-AmdSmiNoElevate $amdSmiVer.Source @('version') |
There was a problem hiding this comment.
Honor the amd-smi opt-out for version probing
This fallback still invokes amd-smi version whenever the HIP SDK is present and hipconfig did not produce a version, even when UNSLOTH_ENABLE_AMD_SMI=0 was set. The newly added $amdSmiAllowed gate above is meant to prevent exactly this prompt-prone path on broken HIP-runtime hosts, but the setup script bypasses it here, so the Studio setup entrypoint can still pop the DiskPart/UAC prompt. Apply the same gate to this version probe.
Useful? React with 👍 / 👎.
| printf 'export PATH="%s/bin:${PATH}"\n' "${_rw_rocm}" | ||
| printf 'export LD_LIBRARY_PATH="%s/lib:${LD_LIBRARY_PATH:-}"\n' "${_rw_rocm}" | ||
| printf '# <<< Unsloth ROCm-on-WSL (gfx1151) <<<\n' | ||
| } > /etc/profile.d/unsloth-rocm-wsl.sh 2>/dev/null || true |
There was a problem hiding this comment.
Persist the restored WSL ROCm environment
After a WSL uninstall leaves shared ROCm/librocdxg in place but removes /etc/profile.d/unsloth-rocm-wsl.sh, a normal non-root reinstall takes this fast path and silently fails to recreate the profile drop-in because the redirection is not run through sudo. The current installer shell gets PATH/LD_LIBRARY_PATH, but later Studio launches do not, so ROCm can disappear again after install; recreate this file with sudo/tee or fall back to the helper when persistence fails.
Useful? React with 👍 / 👎.
| Get-ChildItem -LiteralPath $d -Filter "Unsloth Studio*.lnk" -ErrorAction SilentlyContinue | ForEach-Object { | ||
| try { | ||
| $sc = $ws.CreateShortcut($_.FullName); | ||
| if ("$($sc.TargetPath) $($sc.Arguments)" -match "wsl\.exe") { | ||
| Remove-Item -LiteralPath $_.FullName -Force -ErrorAction SilentlyContinue |
There was a problem hiding this comment.
Preserve other WSL distro shortcuts
With Studio installed in more than one WSL distro, this glob deletes every Unsloth Studio*.lnk whose target or arguments mention wsl.exe, not just the shortcut for the distro running the uninstaller. Since the installer now creates per-distro names like Unsloth Studio (WSL - Ubuntu).lnk, uninstalling one distro removes the launchers for the others; filter by the current $WSL_DISTRO_NAME/shortcut arguments before deleting.
Useful? React with 👍 / 👎.
|
|
||
| # Resolve the latest 3.13.x patch from the python.org listing, falling | ||
| # back to the pinned version if the listing cannot be fetched. | ||
| $full = $PythonFallbackFullVersion |
There was a problem hiding this comment.
Respect pinned Python minor in the fallback
When UNSLOTH_PYTHON pins a non-default minor such as 3.12 and the python.org directory listing cannot be fetched, this fallback still seeds $full with the hard-coded 3.13.13, so the installer downloads and accepts Python 3.13 instead of the requested minor. Since this path is specifically for winget/listing failures, derive the pinned full version from $PythonVersion or keep a per-minor fallback map.
Useful? React with 👍 / 👎.
| printf '%s\n' "$_rocminfo_out" | head -25 >&2 || true | ||
| die "rocminfo did not enumerate a ${GFX} GPU agent. Most common cause: the Windows AMD driver predates production ROCDXG -- update Adrenalin (install.ps1 offers this), reboot, and re-run." | ||
| fi | ||
| printf '%s\n' "$_rocminfo_out" | grep -E 'Marketing Name|Device Type|Compute Unit' | grep -iE "Radeon|GPU|Compute" | head -3 |
There was a problem hiding this comment.
Don't let the rocminfo summary abort bootstrap
After verification succeeds, this display-only pipeline still runs under set -euo pipefail; if the filtered summary has no matches on a rocminfo variant, or if head -3 closes the pipe early on a verbose output, the helper exits non-zero and install.sh falls back to CPU even though gfx1151 was already enumerated. Make this summary best-effort, e.g. capture it with || true, so only the explicit verification gate can fail the bootstrap.
Useful? React with 👍 / 👎.
…, non-root) Fixes valid findings from the Codex/Gemini PR review: - install.ps1 / setup.ps1: gate the `amd-smi version` ROCm-version fallback with $amdSmiAllowed so UNSLOTH_ENABLE_AMD_SMI=0 opt-out is honored (the device probe was gated but this fallback wasn't), avoiding the DiskPart/UAC prompt. - install_rocm_wsl_strixhalo.sh: make the post-verification rocminfo summary best-effort (|| true) so head's early pipe-close under `set -o pipefail` can't fail the bootstrap after gfx1151 was already enumerated; pin the Windows SDK `winget install` to --source winget (matches the msstore-cert fix rationale). - install.ps1: python.org fallback installs the py launcher per-user (InstallLauncherAllUsers=0, avoids admin), and derives the fallback full version from the requested minor so a non-default UNSLOTH_PYTHON (e.g. 3.12) isn't silently replaced with 3.13 when the listing is unreachable. - install.sh: recreate /etc/profile.d/unsloth-rocm-wsl.sh via `sudo tee` for a non-root reinstall (a plain redirect failed silently, dropping the ROCm env). - uninstall.sh: scope WSL Windows-side shortcut removal to the current WSL_DISTRO_NAME (per-distro name or -d "<distro>" arg) so uninstalling one distro no longer deletes other distros' launchers. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Four fixes from PR #5940 field reports (Win11 native, gfx1151): 1. bitsandbytes arch-probe spam: bnb's get_rocm_gpu_arch() runs hipinfo.exe via subprocess PATH at import; the AMD torch wheel ships hipInfo.exe in the venv Scripts dir, which is only on PATH for activated venvs. Every bnb import logged "Could not detect ROCm GPU architecture: [WinError 2]" ERROR + WARNING (even with the HIP SDK installed, whose bin dir is not on PATH either). Prepend the Scripts dir to PATH before bnb imports in main.py, worker.py, and install_python_stack.py, gated on the file existing (only AMD wheels ship it). Verified on gfx1151: ROCM_GPU_ARCH now resolves to gfx1151 with zero errors. 2. OOM-guard double-tax on native Windows unified APUs: mem_get_info's total is the WDDM budget the driver grants HIP (BIOS carve + ~half of remaining RAM) -- the OS share is already outside it. The 0.80 unified cap on top denied loads that fit (field report: 48.49 GiB budget -> "38.79 GiB allowed" OOM for a 47.29 GiB load with 48.08 free). Use 1.0 on win32 unified; Linux keeps 0.80, discrete 0.90. 3. "Missing VRAM" confusion: log the WDDM budget vs physical RAM with the fix (BIOS UMA frame buffer / AMD Software Variable Graphics Memory) when the grant is under 75% of RAM, so a 48 GiB cap on a 96 GiB box reads as policy, not a Studio bug. 4. llama-server fit-step crash (Qwen3.6-27B-MTP + mmproj, lemonade gfx1151): --fit defaults to 'on' upstream, so the fit step runs even when Studio already placed the model via -ngl -1, and aborts in ggml-cuda.cu on some ROCm hosts. Retry the spawn once with --fit off when the server crashes during startup and Studio's own VRAM math had placed the model (never when use_fit or an explicit fit flag was passed). Also keep the TAIL of crash output in the error log (the diagnostic line prints last; head-truncation cut exactly that) and reference the full on-disk log. Verified live on Radeon 8060S: bnb import clean, Qwen3.5-4B-MTP loads and generates through the new spawn loop, stub-crash retry appends --fit off and recovers, fraction probes confirm WDDM overcommit and sub-1.0-only enforcement on current AMD wheels.
…40-branch # Conflicts: # studio/backend/core/inference/llama_cpp.py # studio/backend/core/training/worker.py # studio/backend/main.py # studio/backend/tests/test_rocm_oom_guard.py # studio/install_python_stack.py
amd-smi does not reliably exist on Windows: the HIP SDK never ships a CLI, inbox Windows Update drivers do not, and only some full Adrenalin packages drop amd-smi.exe into System32 (field report: fresh Win11 + Adrenalin + HIP SDK, still no amd-smi anywhere). Make every consumer work without it: - install_python_stack._detect_windows_gfx_arch: two new probes after hipinfo/amd-smi -- (2b) the venv Scripts hipInfo.exe shipped by AMD torch wheels (drives `studio update` on driver-only hosts), and (4) a last-resort GPU marketing-name -> gfx table via WMI (Win32_VideoController), mirroring setup.ps1's $nameArchTable so a standalone repair resolves the arch with zero AMD tooling installed. - install_llama_prebuilt._resolve_exe: also probe the venv Scripts dir so a standalone rerun finds hipInfo.exe without HIP_PATH. - hardware/amd.py _run_amd_smi: which() guard before spawning -- absence now disables the poller in one step instead of burning the 3-strike circuit breaker on FileNotFoundError; corrected the stale comment claiming Adrenalin ships amd-smi. Simulated against the real detection functions on gfx1151: amd-smi absent, present-but-crashing (exit 1), present-but-hanging (60s sleep vs 5-10s probe timeouts), and hard opt-out -- all resolve gfx1151, no exceptions, bounded time. Full adversarial install (broken amd-smi stub first on PATH + UNSLOTH_ENABLE_AMD_SMI=1, fresh uninstall first): exit 0, name-table arch inference, lemonade gfx1151 b1292 prebuilt, torch 2.11.0+rocm7.13.0 cuda_avail=True on the 8060S, Studio boots healthy and stops cleanly.
There was a problem hiding this comment.
💡 Codex Review
Line 1725 in 97b758d
On Adrenalin-only Windows hosts the new WMI/name path sets $ROCmGfxArch while $HasROCm remains false, but this gate still requires $HasROCm before selecting the AMD repo.amd.com torch index. In that exact scenario the installer prints that GPU ROCm wheels are coming, then leaves $ROCmIndexUrl null and installs CPU PyTorch; studio/setup.ps1 already uses ($HasROCm -or $ROCmGfxArch) for the same path, so mirror that here.
ℹ️ 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".
Found by cross-platform simulation of the --fit off retry (Windows + Linux sandboxes, real load_model with stub servers): - llama-server log filename now carries the spawn-attempt index. The retry can respawn within the same epoch second; reusing the name opened the same file with "w" and truncated the crash log the retry warning had just pointed the user at (proven with a frozen time.time: one file, crash evidence gone; with the suffix both attempts keep their logs). Regression-pinned in test_llama_cpp_wait_for_health.py. - test_amd_primary_gpu_with_mock now mocks shutil.which alongside subprocess.run: the amd-smi absence guard which()-checks before spawning, so on hosts without a real amd-smi (Linux CI, driver-only Windows) the subprocess mock was never reached and the test failed. Surfaced by running the suite in a clean Linux sandbox. Simulation coverage on both OSes: 67-case platform/edge matrix (real shipped code blocks under win32/linux/darwin spoofs: OOM-guard fractions + VGM-hint boundary, bnb PATH-prepend gates, retry eligibility incl. equals-forms and decoy tokens, GPU-name table adversarial set, WMI fallback without powershell, monitor absence semantics), 6-scenario live retry matrix (crash-once/crash-always/ exit-zero/explicit-fit/hang/log-collision) against real llama-server spawns on Windows and WSL (GPU success legs on the 8060S), and a 3-engine browser matrix (chromium/firefox/webkit) driving the live backend's health + authed /v1 chat completion.
Align the ROCm OOM-guard classifier with PR #5988's UMA gate: consult hipDeviceProp_t.integrated (props.is_integrated) before the hardcoded arch set. Strictly additive -- truthy upgrades to unified; 0/absent falls through to the existing gfx1150/gfx1151 + device-name logic, so wheels that omit or zero the field cannot downgrade the known APU set. Extends correct unified-cap treatment to APUs outside that set (e.g. gfx1103 Phoenix iGPUs) and keeps Studio's two unified-memory consumers on one driver signal. Verified live on gfx1151 (is_integrated == 1 on the AMD Windows wheel -> ('gfx1151', True) via the new path).
…setup.sh gfx table Fleet validation on a Strix Halo WSL2 box showed the system rocminfo (HSA 1.18, ROCm 7.2.1) only enumerates the GPU over /dev/dxg when HSA_ENABLE_DXG_DETECTION=1, and that rocminfo can sit at /opt/rocm/bin off PATH outside login shells. Detection probes that miss either of these report no GPU on a working ROCDXG host and select the CPU build even though the lemonade bundle offloads fine (95.7 tok/s measured vs 64.5 CPU on the same laptop). Seed the env (a no-op on bare metal) and the PATH fallback in install.sh, studio/setup.sh, and the installer's Linux rocm probe, mirroring what main.py/worker.py already do for the runtime. Also sync studio/setup.sh's name->gfx table with install.sh: 890M and the HX 37/AI 9 HX SKUs are Strix Point (gfx1150, not gfx1151), RX 7700S must match gfx1102 before the gfx1100 row, and the RDNA2/workstation rows were missing. New parity test pins the two bash tables together so they cannot drift again.
|
Pushed a follow-up in 8cd2711, closing two gaps a cross-check of the fleet validation surfaced.
All 381 tests in tests/studio/install pass (23 followups incl. the new parity test, 269 rocm_support, 89 installer logic). |
Field report (Strix Halo, 96 GB UMA carve, WSL and native Windows): "the studio just terminates without a warning". A native crash in the GPU runtime kills the process with no Python traceback, and a desktop- shortcut console closes before anything can be read. The server only ever logged to the console, so there was nothing to send back. run_server now tees stdout/stderr to ~/.unsloth/studio/logs/server/server-<ts>-pid<n>.log (console behavior unchanged; file copy is best-effort), arms faulthandler at the same file so access violations / SIGSEGV leave a stack trace on disk, and exports PYTHONFAULTHANDLER=1 so training workers inherit crash dumps on their captured stderr. Armed before `from main import app` so even import-time failures leave evidence. Keeps the newest 20 session logs; opt out with UNSLOTH_STUDIO_NO_FILE_LOG=1. Prints "Session log: <path>" at startup so users know what to attach. Verified on this box: a forced real segfault (faulthandler._sigsegv) leaves the full session output plus "Fatal Python error: Segmentation fault" and the thread stack in the file while the console shows nothing; a normal server boot captures the startup banner and serves health as before.
Match the shell helpers, which use the parameter-default form: a user who exports HSA_ENABLE_DXG_DETECTION=0 to deliberately hide the GPU from DXG detection should not have the probe override it.
Follow-up to the merged #5940. Trims verbose comments across the Windows/WSL installer and Studio backend to their load-bearing content (constraints, env-var names, issue refs, magic-value rationale), removing restated-code narration and multi-sentence justifications. Comment-only and machine-verified: every .py file is AST-dump-identical (docstrings normalized), every .ps1 is non-comment-token identical, and every .sh has zero non-comment-line changes with bash -n clean, all checked against main. Install suites (340 passed) and backend suites (282 passed) unchanged. Net -159 comment lines across 15 files. Co-Authored-By: Claude Fable 5 <[email protected]>
Summary
Makes the Windows (
install.ps1/studio/setup.ps1/ the Python installers)and WSL AMD paths robust and GPU-capable. Started from a user hitting the
winget
msstorecert error onirm https://unsloth.ai/install.ps1 | iex, andgrew to cover the AMD GPU experience end-to-end.
All verified on an AMD Ryzen AI Max+ / Radeon 8060S (Strix Halo, gfx1151)
laptop, including a full
install.ps1run (exit 0) and a cleanuninstall → reinstall cycle.
1. winget
msstorecertificate failure (the reported bug)winget installran without--source winget, so winget also queried themsstoresource. Whenmsstorefails cert pinning (0x8a15005e, common aftera Windows reinstall, clock skew, proxy, or stale source cache) winget aborts and
demands
--source, even though the package is in the healthywingetsource.--source wingetto everywinget install(Python ×2 ininstall.ps1; OpenSSL + the CUDAwinget showinsetup.ps1). Matches therest of
setup.ps1, which already pins the source elsewhere — these werestragglers (one was reproduced live during testing).
Install-PythonFromPythonOrg): if winget ismissing/broken, download the official installer and run it silently per-user
(no admin), mirroring the existing
uv -> astral.shfallback.Verified:
Python.Python.3.13installs cleanly via--source winget; fullinstall reaches exit 0.
2.
amd-smiDiskPart UAC prompt during installOn AMD hosts, GPU detection runs
amd-smi(shipped inSystem32by Adrenalin),which auto-elevates to read GPU/APU memory and pops a confusing DiskPart UAC
prompt mid-install. The Studio backend already documents this in
backend/utils/hardware/amd.pybut the installers did not guard it.Invoke-AmdSmiNoElevate(PowerShell) and__COMPAT_LAYER=RunAsInvokerinjection in the Python installers (
run_capture,install_python_stack.py)and
amd.py, run viaStart-Processwith a 30s timeout (a flakyamd-smicould otherwise stall the install for minutes). On failure detection falls
back to the WMI name → gfx lookup. Windows-only.
Verified: control run pops the prompt; guarded run does not.
3. Native-Windows AMD GPU detection → lemonade GPU llama.cpp
Previously the name → gfx inference only ran when
$HasROCmwas already true(amd-smi/hipinfo confirmed). On Adrenalin-only hosts (amd-smi present but no HIP
SDK) that left the arch unresolved, so
--rocm-gfxwas never forwarded and thehost got a CPU llama.cpp.
confirmed ROCm runtime →
--rocm-gfxis forwarded →has_rocm=True→install_llama_prebuilt.pyselects the lemonade-sdk gfx1151 windows-hipprebuilt (ROCm runtime bundled, no HIP SDK needed).
to known SKUs only, so unmatched AMD names still fall back to CPU.
Verified: gfx1151 detected from "Radeon 8060S"; the lemonade gfx1151 build runs
on this machine —
llama-cli --list-devices→ROCm0: AMD Radeon(TM) 8060S Graphics (69 GB)on the Adrenalin driver alone.4. Prebuilt validation: fetch the test model via huggingface_hub
The prebuilt validator downloads a tiny GGUF test model from huggingface via
bare
urllib. On setups where the server sends an incomplete TLS chain, urllibcan't complete the Amazon CA chain (no AIA fetching) →
CERTIFICATE_VERIFY_FAILED→ a good GPU prebuilt is discarded for a CPU source build.
huggingface_hub(the samemechanism Studio uses), with the direct URL as fallback.
Verified:
hf_hub_downloadsucceeds where urllib returnedCERTIFICATE_VERIFY_FAILED; the prebuilt now validates instead of source-building.5. Experimental ROCm-on-WSL helper
scripts/install_rocm_wsl_strixhalo.shautomates the Linux-side ROCm-on-WSLprerequisite for gfx1151 on a dedicated Ubuntu 24.04 distro, with a hard
preflight that refuses to run until the Adrenalin ≥26.3.1 driver is present.
Testing
install.ps1/setup.ps1parse under PowerShell 5.1; the Python filescompileall; the new.shpassesbash -n.verified live on Strix Halo hardware.
Validation update: WSL ROCm offload confirmed on real hardware
Since opening this PR the AMD GPU paths were re-validated end to end on real
hardware, which now includes the WSL ROCm path from section 5 (previously only
the native Windows path was confirmed).
WSL2 (the section 5 helper path):
librocdxg: the lemonade gfx1151 bundle offloads at 95.7 tok/s (CPU baseline on
the same box 64.5), with the server enumerating
ROCm0: AMD Radeon(TM) 8060S Graphics. The in-processHSA_ENABLE_DXG_DETECTION=1set instudio/backend/main.pyandworker.pyis what lets the system ROCm runtime enumerate the GPU over/dev/dxgfor non-login launches; the lemonade bundle's own HSA runtimeauto-detects DXG and resolves the system librocdxg via ldconfig, so no extra
plumbing is needed once the section 5 helper has run.
(for example Ubuntu 26.04), correctly falls back to the CPU build.
Native Windows (lemonade windows-hip), broadening beyond gfx1151:
142.8 tok/s.
So both the native-Windows lemonade path (section 3) and the WSL ROCm path
(section 5) are confirmed to reach real GPU offload, across gfx1151 and gfx1200,
with a correct CPU fallback whenever no ROCm GPU is reachable.