Skip to content

Unsloth Studio / Desktop (AMD, Windows): never run amd-smi from the installers - #19615

Merged
danielhanchen merged 7 commits into
unslothai:mainfrom
LeoBorcherding:amd-smi-installer-opt-in
Nov 27, 2026
Merged

danielhanchen merged 7 commits into
unslothai:mainfrom
LeoBorcherding:amd-smi-installer-opt-in

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

AMD's amd-smi.exe on Windows elevates a child and pops a UAC prompt for DiskPart, which RunAsInvoker can't suppress. #14041 took it off the app's default path (studio/backend/utils/hardware/amd.py). The installers kept running it whenever a HIP SDK was detectable:

  • install.ps1 and studio/setup.ps1: amd-smi list (plus static --asic) when hipinfo found no GPU, and amd-smi version when hipconfig gave no version.
  • studio/install_python_stack.py and studio/install_llama_prebuilt.py: _amd_smi_allowed() returned true for any hipinfo outside the venv, so amd-smi version / amd-smi list ran on every install and update.

Reported in the Discord help thread: an RX 9060 XT user got several DiskPart UAC prompts while updating Unsloth Desktop.

Change. The Windows installers never run amd-smi, opted in or not.

  • install.ps1 / setup.ps1: the amd-smi list, static --asic and version probes, Invoke-AmdSmiNoElevate, and the opted-in amd-smi veto in the adapter check are removed.
  • Python installers: _amd_smi_allowed() is platform.system() != "Windows" (Linux keeps amd-smi). The Windows notice probe in install_python_stack.py runs hipinfo only. The _path_inside_venv / _external_hipinfo_on_path helpers only fed the old gate, so they're gone.
  • The arch and ROCm version still come from hipinfo, hipconfig, WMI and the forwarded --rocm-gfx. The PowerShell venv-hipinfo exclusion stays, since $HipSdkInstalled still drives the hipinfo probe.
  • The app runtime is unchanged: amd.py still honours UNSLOTH_ENABLE_AMD_SMI=1.

Tests. The gate tests cover both Python copies and pin "never on Windows" for no HIP SDK / HIP SDK and unset / opt-in / opt-out, plus a text check that neither PowerShell installer mentions amd-smi. Tests of the removed amd-smi parsing are dropped. The hipinfo mask test now checks that an amd-smi on PATH is ignored on Windows.

What ran. On macOS, every install test file that mentions amd-smi: 1733 passed, 2 failed (test_amd_fastpath_probe, which fail the same way on main on this machine). The pwsh tests were skipped because there's no pwsh here. I haven't run it on a Windows AMD box, and the reporter hasn't confirmed the HIP SDK yet.

…mi unless opted in

amd-smi.exe elevates a child and pops a UAC/DiskPart prompt that RunAsInvoker
cannot suppress, with or without a HIP SDK. The runtime already made it opt-in
(unslothai#14041); the four installer gates still ran it whenever a HIP SDK was found,
so updates popped the prompt. Match the runtime: UNSLOTH_ENABLE_AMD_SMI=1 only.
hipinfo, hipconfig, WMI and the forwarded --rocm-gfx already give the arch and
ROCm version, so the amd-smi list/static/version probes and their helper go.
@LeoBorcherding LeoBorcherding changed the title Unsloth Studio / Desktop (AMD, Windows): keep the installer off amd-smi unless opted in Unsloth Studio / Desktop (AMD, Windows): never run amd-smi from the installers Nov 25, 2026
@LeoBorcherding LeoBorcherding added AMD windows Windows-specific labels Nov 26, 2026
@danielhanchen danielhanchen self-assigned this Nov 27, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-27T19:14:07.522398Z
We couldn’t complete this review. Comment @codex review to try again.
041afc4 Draft marked ready
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 643cb2ba26

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

Copy link
Copy Markdown
Member

pre-commit.ci run

# Conflicts:
#	install.ps1
#	studio/setup.ps1

[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex 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: 2f7131a119

ℹ️ 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 thread studio/install_llama_prebuilt.py Outdated
Comment on lines 3103 to 3104
_win_probes = [(["hipinfo"], lambda out: "gcnarchname" in out.lower())]
if _amd_smi_allowed():
_win_probes.append((["amd-smi", "list"], _amd_smi_has_gpu))
for _cmd, _check in _win_probes:

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 Preserve AMD detection when hipinfo crashes after reporting an arch

If the Windows HIP SDK's hipinfo prints gcnArchName and then crashes with 0xC0000005, the remaining probe still discards the valid arch because it requires returncode == 0. Removing the fallback therefore prevents _auto_host_following_rocm_torch() from confirming AMD on a mixed AMD+NVIDIA host without a manual gfx environment override: Automatic updates now take the CUDA branch even when ROCm torch is installed/requested, and the updater's forwarded gfx does not clear the NVIDIA flags. Accept arch-bearing partial output here, as setup.ps1 and install_python_stack._detect_windows_gfx_arch() already do, to preserve this route without running amd-smi.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in d514274: detect_host and the Windows notice probe now accept hipinfo output that names gcnArchName whatever the exit code, as setup.ps1 / install.ps1 do; regression test test_a_crashed_hipinfo_counts_only_when_it_named_an_arch fails without the fix.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: d51427410f

ℹ️ 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 marked this pull request as ready for review November 27, 2026 19:13
@danielhanchen
danielhanchen merged commit 3c2da02 into unslothai:main Nov 27, 2026
32 of 69 checks passed
danielhanchen added a commit that referenced this pull request Nov 27, 2026
…ince unsloth-zoo #2910) (#20024)

## Problem

`MLX CI on Mac M1` fails two stub parity tests in
`studio/backend/tests/test_mlx_inference_backend.py`, for example on
#19615's run:

```
test_the_stub_answers_every_helper_zoo_imports_from_inference:
  AssertionError: zoo imports ['_MarkovTreeDrafter'] from mlx.inference and the stub cannot answer them
test_the_stub_accepts_every_call_zoo_makes_to_an_inference_helper:
  AttributeError: _MarkovTreeDrafter
```

unsloth-zoo #2910 (DSpark trees over the Markov lattice under Fast
Verify) made `unsloth_zoo/mlx/speculative.py` import
`_MarkovTreeDrafter` from `.inference`, and check
`isinstance(drafter._draft, _MarkovTreeDrafter)`. The test's stand-in
for `unsloth_zoo.mlx.inference` reads the names zoo imports from zoo's
own source, and it fails until each one has an answer. That is its job,
and it caught the new import as intended.

## Fix

Add `_MarkovTreeDrafter` to the stub's private helpers, as a plain class
like `_SparseDrafter` next to it. The `isinstance` check then has a type
to test against.

## Verification

`tests/test_mlx_inference_backend.py -k stub`:

| unsloth-zoo | this branch | main's stub |
|---|---|---|
| main (`2fc45a4`, includes #2910) | 11 passed, 1 skipped | 2 failed
(the two above) |
| released 2026.11.11 | 11 passed, 1 skipped | not run |

The skip is the `mlx_lm` case, which needs Apple Silicon.
danielhanchen added a commit that referenced this pull request Nov 27, 2026
…t (red on main since #19615) (#20060)

## Problem

The `parity (ubuntu-latest)` job fails one check in
`tests/studio/test_nvidia_adapter_presence.ps1` on main (`bcbfe14c4f`),
for example on the #20038 staging run:

```
FAIL  WMI without the AMD card: an opted-in amd-smi vetoes the promotion
1 check(s) failed
```

#19615 made the Windows installers stop running `amd-smi`, because it
pops a UAC prompt that cannot be suppressed. With it went the
`UNSLOTH_ENABLE_AMD_SMI` opt-in in `Test-OtherVendorAdapterPresent`,
which used to let an opted-in `amd-smi` veto promoting the NVIDIA route.
That was the intended change, and `install.ps1` and `studio/setup.ps1`
no longer mention `amd-smi` at all. This test still listed "an opted-in
amd-smi" among the signals that veto, so it now asserts behaviour that
was deliberately removed.

## Fix

- The opted-in `amd-smi` case is dropped from the list of AMD signals
that veto the promotion. `hipinfo` on PATH, a HIP SDK under `HIP_PATH`,
and a HIP SDK under `ROCM_PATH` still veto, and are still checked.
- The `amd-smi` check now asserts what #19615 made true: `amd-smi` on
PATH does not veto, either without the opt-in or with
`UNSLOTH_ENABLE_AMD_SMI=1`.
- The new assertion with the opt-in set would have failed on the code
before #19615, so a return of the `amd-smi` probe would be caught.

## Verification

- `pwsh -NoProfile -File tests/studio/test_nvidia_adapter_presence.ps1`
on Linux: `all checks passed`. Before, on main: `1 check(s) failed`, the
line above.
- The test file stays ASCII-only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants