Skip to content

Say ROCm does not cover RDNA 1 instead of advising a fix that cannot work - #8577

Merged
danielhanchen merged 37 commits into
mainfrom
rdna1-unsupported-message-8529
Aug 13, 2026
Merged

danielhanchen merged 37 commits into
mainfrom
rdna1-unsupported-message-8529

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Reported by @AssabTigleG in #8529.

What the user saw

A Radeon RX 5700 XT on Windows, plainly present and working in Task Manager, and an installer that ended on Torch 2.10.0+cpu after telling them:

Installing CPU-only PyTorch (AMD GPU arch unknown -- install the HIP SDK
or set UNSLOTH_ROCM_GFX_ARCH to enable GPU ROCm).

Why the CPU fallback is correct, and unchanged

The RX 5700 XT is Navi 10, gfx1010, RDNA 1. AMD publishes Windows torch indexes for gfx103X (RDNA 2), gfx110X (RDNA 3), gfx1150 / gfx1151 (RDNA 3.5) and gfx120X (RDNA 4). There is no gfx101X index, and no PyTorch ROCm build targets gfx101X on Linux either. CPU PyTorch is the right answer on this card and this PR does not change it. Every routing table, wheel index and supported-arch list is untouched, and the tests below re-assert on each path that RDNA 1 still resolves to no arch and still falls back to CPU.

Why the old advice was impossible to act on

The name-inference table only maps arches that have wheels, so an RDNA 1 card left the arch null and fell into the arch unknown arm. Both remedies that arm names are dead ends:

  • The HIP SDK does not add wheels. Unsloth installs AMD's bundled-runtime wheels from repo.amd.com, so the SDK was never what was missing.
  • UNSLOTH_ROCM_GFX_ARCH=gfx1010 is honoured, lands on the unmapped-arch path, and returns CPU anyway. The user pays for an SDK install and a reboot to reach the same place.

Worth noting that the neighbouring branch already had the right words for a known-but-unmapped arch ("no ROCm PyTorch wheels are available for $ROCmGfxArch"). RDNA 1 simply never reached it, because nothing ever named its arch.

The change

A second, separate name lookup for AMD generations ROCm PyTorch does not cover. It is read only to word a message. It never assigns the variable the installers route on, so the CPU fallback is reached by exactly the same code path as before, and a row added to it can never make an arch installable. That property is asserted directly: no arch in the new table may appear in the gfx-to-index family map, and the two tables may not share an arch.

The new arm now says the GPU was detected, names its arch, states that ROCm does not cover it, and points at the one path that does work.

Which arches are named, and which are not

Included, with product names taken from LLVM's AMDGPU processor tables rather than guessed:

arch names matched
gfx1010 RX 5700 / 5700 XT, RX 5600 / 5600 XT / 5600M, Radeon Pro 5600 XT
gfx1011 Radeon Pro V520, Radeon Pro 5600M
gfx1012 RX 5500 / 5500 XT
gfx803 RX 470 / 480, RX 570 / 580 / 590 (Polaris 10 / 20 / 30)

Polaris 10/20/30 is here because #8458 is the same defect on an RX 580, and that is the silicon the card reports itself as.

Deliberately left out: Polaris 11/12 (RX 460 / 550 / 560), Vega (gfx900 / gfx906), and gfx1013, which LLVM lists with no product names at all. Polaris 11/12 is a different die and I could not confirm gfx803 against gfx804 for it; the others have no report confirming them and no in-repo evidence for the mappings. A wrong arch printed at a user is worse than no arch, and the value of this table is that it never guesses. Adding a row later is a one-line change per file.

The name collision this table is one keystroke away from

RX 570 is a prefix of RX 5700, and RX 550 of RX 5500. A Polaris row that swallowed an RX 5700 XT would be a straight regression on the card this PR started from.

Python and PowerShell carry (?!0) lookahead guards, so those rows are correct matched on their own. POSIX case has no lookahead, so in install.sh and studio/setup.sh correctness rests entirely on arm order: the RDNA 1 arms come first and the Polaris arm comes last. That order is now documented as load-bearing at both sites and asserted directly, and the shipped case arms are evaluated under a real sh rather than checked by eye. Reversing them in a scratch copy does resolve AMD Radeon RX 5700 XT to gfx803, which is what the ordering test exists to catch.

Where these users can actually go: llama.cpp on Vulkan

Saying "ROCm does not cover this GPU" is true and still a dead end. Vulkan is not: #8458's reporter got an RX 580 running through it, and LM Studio drives the same card with its Vulkan llama.cpp engine. Torch stays on CPU on these boards, but GGUF chat runs on the GPU.

Nothing sends these users there on its own. _should_auto_vulkan_for_amd_windows opens with:

active = _active_rocm_gfx_target(host)
if not active:
    # ROCm confirmed but gfx unknown (--has-rocm only): keep the HIP / fork / source path.
    return False

A pre-RDNA 2 card resolves to no gfx target at all, so the existing Windows auto-Vulkan fallback structurally cannot fire for exactly the cards that need it most. The environment variable is their only route, which is why the message now names it.

Two things about that advice are load-bearing, and both are asserted per site rather than per file:

Which spelling. Only UNSLOTH_LLAMA_CPP_BACKEND=vulkan is taught. The legacy UNSLOTH_FORCE_VULKAN still works, but force_vulkan_requested() resolves the new variable first and consults the legacy one only when the new one is absent or unparseable:

backend = resolved_llama_backend(llama_backend)
if backend is not None:
    # Authoritative, so =hip is a real opt-out a stale UNSLOTH_FORCE_VULKAN cannot
    # overrule.
    return backend == "vulkan"
return os.environ.get("UNSLOTH_FORCE_VULKAN", "").strip().lower() in (...)

That precedence is deliberate and keeps =hip a real opt-out, so new text spreading the legacy name would work against it. A test bans the legacy spelling from any line that prints, while leaving the back-compat code that reads it alone.

When to set it. The variable selects which llama.cpp bundle is downloaded, at install time. The only runtime read is _vulkan_prebuilt_was_auto_selected, which inspects whether an override was set purely to word a crash message; nothing at runtime swaps a binary. #8458's reporter set the variable after installing, saw nothing happen, and only a clean reinstall worked. Advice that names the variable without naming the moment costs the next person the same evening, so every message that names it also says the bundle is chosen at install time.

Files touched

  • install.ps1 -- new $unsupportedNameArchTable, consulted only after the supported table misses; three message sites (the gpu summary, the reroute note, the CPU-only note).
  • studio/setup.ps1 -- same table, reusing the existing Get-GfxArchFromGpuName; the gpu summary and the rocm step.
  • install.sh -- _infer_unsupported_amd_gfx_arch_from_gpu_name plus an lspci-driven _infer_linux_unsupported_amd_gfx_arch; the index-selector warning that used to say "repair rocminfo/amd-smi", and the */cpu note that used to say "install the ROCm/HIP SDK".
  • studio/setup.sh -- _setup_unsupported_gfx_from_name and the gpu step.
  • studio/install_python_stack.py -- _UNSUPPORTED_GPU_NAME_ARCH_TABLE and _unsupported_gfx_arch_from_gpu_name; the WMI-name warning in _detect_windows_gfx_arch, which is the exact line the reporter's driver-only host hits.
  • README.md -- the Vulkan instructions now lead with UNSLOTH_LLAMA_CPP_BACKEND=vulkan in both copy-paste blocks, and say that this is the path for pre-RDNA 2 AMD GPUs. The installer now names a variable, and the README is where people will go to check it.
  • tests/studio/install/test_rocm_support.py -- test_cpu_index_note_respects_explicit_pin asserted that a pin check appeared within a character window before a note. That is a budget on how much source may sit between the two, not the ordering property the test is named for, and this work had already pushed it from 400 to 1400 with the real distance at ~1121. It now walks the enclosing if/elif chain by indentation and asserts that the pin arm opens the chain and the message sits in a later arm. No distance, nothing left to re-tune.

studio/frontend/src/i18n/locales/en.ts is deliberately not touched. See below.

The "No visible GPU" string

I looked at whether Studio can honestly say "detected but unsupported" instead of "No visible GPU detected", and it cannot today.

resources-tab.tsx branches on hasGpu = (displayedGpu?.available ?? false) && metrics.devices.length > 0, and its only input is GET /api/system. That payload's devices list is populated exclusively from torch.cuda / torch.xpu / MLX in get_backend_visible_gpu_info(); the SMI branch is explicitly skipped on ROCm. Nothing in the response carries an adapter inventory (there is no WMI or lspci enumeration anywhere in the backend), no installer-recorded gfx arch (unsloth_install_manifest.json has no gfx field, and /api/system never reads it), and no CPU-only torch flavour tag. The nearest reason field, chat_only_reason, collapses both cases to "no_gpu" and is not on this endpoint anyway.

So the frontend genuinely cannot tell an absent GPU from an unusable one. Distinguishing them needs a torch-independent adapter probe plus a torch-unavailability reason surfaced on /api/system, and new i18n keys in en.ts and all 11 overlays (CI runs npm run i18n:check:strict). That is a backend change and its own PR. Making the string vaguer in the meantime would trade a specific wrong message for a woolly one, so I left it alone.

How it was verified

New coverage:

  • tests/studio/install/test_rdna1_unsupported_message_8529.py -- 60 tests. The lookup itself; a parity check that all five copies of the table answer identically; the scope guards (no arch here is routable, the supported table still misses RDNA 1); the Windows WMI path driven end to end with hipinfo and amd-smi absent, asserting both that no arch comes back and that the printed text names gfx1010 without teaching the override; the shell copies executed under a real sh rather than parsed; and the branch ordering in each installer, with "was found" guards so a renamed branch fails instead of passing vacuously.
  • tests/studio/test_rdna1_unsupported_message_8529.ps1 -- now also covers the Polaris rows, the standalone (?!0) guards, and the Vulkan advice per site. Runs the table under the .NET regex engine that actually ships it, which is the only place -match semantics are real, and checks the source text with CRLF normalisation.

Every new assertion was mutation tested: the source change it covers was reverted, the test confirmed to fail, and the source restored. 48 mutants, 48 killed, no survivors. They cover deleting or gutting each advice site in all five files, dropping the timing clause at each site independently, teaching the legacy spelling, demoting a message to a comment, removing the Polaris row and its (?!0) guards from each of the five copies, reordering the shell case arms, making gfx803 routable, claiming Polaris 11/12, reverting each README block, and inverting the pin arm the reworked ordering test guards.

Four mutants survived a first pass and each one moved a test rather than being written off:

  • Deleting an install.sh advice site whole. Both remaining tests were file-level, so the surviving site answered for the file. There is now an explicit per-site registry with expected counts, anchored on each arm's announcement line.
  • Demoting a message to a comment. The window was over raw source, and every phrase asserted also appears in the comment that explains the branch. Windows now drop comment lines.
  • Weakening the offer to "GGUF chat may work" while keeping the variable. Each site is now required to name Vulkan in prose, not only inside the variable's value. install.ps1 was reworded to match, since one arm reached the backend name only through the lowercase value.
  • Dropping the (?!0) guards from a PowerShell table. Row order already stops the RDNA 1 names from ever reaching the Polaris row, so the guard was untestable through the table. It is now matched standalone in both the Python suite and the pwsh one.

Two more things worth stating about how these were checked. The shell case arms are executed under real dash and bash instead of being parsed and re-implemented, and the PowerShell rows are matched by the .NET engine that ships them. And the guard against a table becoming a routing change is asserted directly: gfx803 must stay absent from _GFX_TO_AMD_INDEX_ARCH.

Suites, run serially:

suite result
test_rocm_support.py 490 passed, 1 skipped
test_rocm_arch_table_parity.py 79 passed
test_rdna1_unsupported_message_8529.py 151 passed
test_cross_platform_parity.py 76 passed
test_windows_amd_gpu_scan_fallback.py 79 passed
test_rocm_rdna_routing.py 23 passed
test_rocm_gfx_spoof_7331.py 72 passed
test_selection_logic.py 216 passed
test_pr5940_followups.py 53 passed
test_install_llama_prebuilt_logic.py 106 passed, 1 skipped
test_rdna1_unsupported_message_8529.ps1 all checks passed
test_pre_turing_cap.ps1 all checks passed

No AMD hardware was involved. As with all AMD coverage in this repo, everything here is mock-based.

An RX 5700 XT (Navi 10, gfx1010, RDNA 1) correctly lands on CPU PyTorch:
AMD publishes Windows torch indexes for gfx103X, gfx110X, gfx1150, gfx1151
and gfx120X, and there is no gfx101X index. Because the name-inference table
covers only arches that have wheels, the arch stayed null and the installer
fell into the "arch unknown" arm, which tells the user to install the HIP SDK
or set UNSLOTH_ROCM_GFX_ARCH. Neither can work: UNSLOTH_ROCM_GFX_ARCH=gfx1010
lands on the unmapped-arch path and returns CPU anyway.

Add a separate name lookup for AMD generations ROCm PyTorch does not cover,
read only to word the report. Product names come from LLVM's AMDGPU GFX10.1
processor table. The lookup never sets the arch the installers route on, so
CPU fallback is reached by exactly the same path as before.

Mirrored across install.ps1, studio/setup.ps1, install.sh, studio/setup.sh
and studio/install_python_stack.py so every install path agrees.

@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: 7ff4e4a8c4

ℹ️ 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 install.sh
Comment on lines +2908 to +2912
_unsup_disp=$(lspci -nn 2>/dev/null | grep -E 'VGA compatible controller|3D controller|Display controller' | grep -E 'AMD|ATI' || true)
while IFS= read -r _unsup_ln; do
[ -n "$_unsup_ln" ] || continue
if _unsup_gfx=$(_infer_unsupported_amd_gfx_arch_from_gpu_name "$_unsup_ln"); then
echo "$_unsup_gfx"

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 Restrict unsupported detection to the selected AMD adapter

On a multi-AMD host, this scans every display controller and returns the first RDNA 1 match without respecting HIP_VISIBLE_DEVICES/ROCR_VISIBLE_DEVICES or identifying which adapter caused arch detection to fail. For example, a selected MI/CDNA or otherwise supported-but-name-unmapped GPU alongside an RX 5700 will now be told that CPU fallback is expected and that repairing rocminfo cannot help, even though the RX 5700 may be an unused display card and restoring the runtime probe would enable ROCm on the selected GPU. Tie this lookup to the selected adapter, or only issue the categorical warning when all candidate AMD adapters are known unsupported.

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.

Checked and not taking this one.

The new lookup sits inside if [ -z "$_amd_gfx_probe" ] (install.sh:3370), and _probe_amd_gfx_arch greps rocminfo, then amd-smi list, then amd-smi static --asic. On the host you describe the MI/CDNA card is selected and working, so it enumerates, the probe is non-empty, and line 3380 is never reached. _infer_linux_amd_gfx_arch also runs first and returns outright for any supported card the name table knows. The second site (install.sh:4506) is inside case "$TORCH_INDEX_URL" in */cpu), and the runtime-less reroute at 4034 has already rewritten that variable for a name-mapped supported card.

What is left needs a multi-AMD host where rocminfo and amd-smi both fail to enumerate anything, plus a supported card missing from the name table. I ran that case (MI210 + RX 5700, no rocminfo) against both revisions: whl/cpu before, whl/cpu after, in either PCI order. Only the stderr wording differs.

And the pre-existing _infer_linux_amd_gfx_arch (install.sh:2967) does exactly the same thing, one lspci scan, first mapping line wins, no HIP_VISIBLE_DEVICES, with its comment documenting that choice. That one feeds TORCH_INDEX_URL and exports UNSLOTH_ROCM_GFX_ARCH; this one only picks words. Tying the messaging copy to the selected adapter while the routing copy stays first-match would be the wrong half to harden.

Also, HIP_VISIBLE_DEVICES indexes ROCr agent enumeration order, not PCI order, so there is no correct mapping from it onto a list of lspci lines, and on this code path ROCr is by construction not answering.

The previous commit stopped at "ROCm does not cover this GPU", which is true
and still a dead end. There is a working path: llama.cpp's Vulkan bundle drives
these cards, which is how #8458's reporter got an RX 580 running and how LM
Studio drives the same hardware.

Nothing routes these users there automatically. _should_auto_vulkan_for_amd_windows
opens with `active = _active_rocm_gfx_target(host); if not active: return False`,
and a pre-RDNA 2 card resolves to no gfx target at all, so the Windows auto-Vulkan
fallback structurally cannot fire for exactly the cards that need it. The
environment variable is their only route, so the message now names it.

Two things about that advice are load-bearing and both are tested:

- The current spelling, UNSLOTH_LLAMA_CPP_BACKEND=vulkan. The legacy
  UNSLOTH_FORCE_VULKAN still works but force_vulkan_requested() resolves the new
  variable first and consults the legacy one only when the new one is absent or
  unparseable, deliberately, so =hip stays a real opt-out that a stale legacy
  variable cannot overrule. New text must not spread the legacy name.
- WHEN to set it. The variable picks the llama.cpp bundle at install/download
  time; nothing reads it at runtime to choose a binary. #8458's reporter set it
  after installing, saw no change, and only a clean reinstall worked. Advice that
  names the variable without naming the moment is worse than none.

Also adds Polaris 10/20/30 (RX 470/480/570/580/590, gfx803) to the
messaging-only table so #8458's card gets the right message. gfx803 stays out of
_GFX_TO_AMD_INDEX_ARCH and every supported-arch table, and routing is untouched;
a test pins that directly. Polaris 11/12 (RX 460/550/560) is left out because
gfx803 vs gfx804 could not be confirmed for that die, and this table is only
worth having while it never guesses.

"RX 570" is a prefix of "RX 5700" and "RX 550" of "RX 5500". Python and
PowerShell carry (?!0) lookahead guards; POSIX `case` has no lookahead, so in
install.sh and studio/setup.sh correctness rests on arm order and the RDNA 1
arms come first. That order is now documented and asserted, and the shipped
arms are evaluated in a real shell rather than checked by eye.

README leads with the current spelling, since the installer now names a variable
and the README is where users check it.

Finally, test_cpu_index_note_respects_explicit_pin asserted a pin check appeared
within a character window before a note. That is a budget on intervening source,
not the ordering property it is for, and this work had already pushed it from
400 to 1400. It now walks the enclosing if/elif chain by indentation, so it
tests order and has no distance left to re-tune.

@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: 4c969f6d1f

ℹ️ 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 install.sh
# Repairing rocminfo cannot help a generation ROCm PyTorch never covered:
# the arch would read fine and still have no wheels (unslothai#8529). Same
# CPU index either way; only the advice changes.
if _amd_unsup_gfx=$(_infer_linux_unsupported_amd_gfx_arch 2>/dev/null); then

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 Classify readable unsupported gfx arches before selecting ROCm

On a Linux RDNA 1/Polaris host where rocminfo or amd-smi successfully reports gfx1010/gfx803, _amd_gfx_probe is nonempty, so the outer if [ -z "$_amd_gfx_probe" ] skips this new unsupported lookup entirely. With a readable ROCm version, get_torch_index_url then proceeds to a generic ROCm index instead of this CPU branch, and studio/setup.sh similarly labels any nonempty _setup_gfx as AMD ROCm; thus the normal runtime-readable case never receives the unsupported/Vulkan diagnosis this change adds. Check the probed arch against the unsupported set before continuing to ROCm version/index selection.

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.

The control-flow reading is right and the failure is real, but it is not this PR's, so no change here.

Verified by running get_torch_index_url from both revisions against a stubbed host:

host before after
rocminfo reads gfx1010, ROCm 6.4 whl/rocm6.4 whl/rocm6.4
rocminfo reads gfx803, ROCm 6.4 whl/rocm6.4 whl/rocm6.4
rocminfo missing whl/cpu whl/cpu

Index selection on the readable path is purely ROCm-version-keyed (the case at install.sh:3404); there is no arch allowlist or denylist in front of it, and git show <base>:install.sh | grep -c 'gfx1010\\|gfx803' returns 0. So the mis-route you describe predates this branch and this branch does not touch it. Same for studio/setup.sh: the new arm is an elif after [ -n "$_setup_gfx" ], exactly as before.

It is worth fixing, and separately. It is a routing change, which is the one thing both new tables are commented as never doing, and it needs its own regression coverage: the arch has to be classified before version-tag selection so the host lands on $_base/cpu instead of hipErrorNoBinaryForGpu at the first GPU op. Note also that the ROCm 7.x hsa_init abort on gfx803 already tips those hosts into the empty-probe branch this PR added, so the remaining exposure is ROCm 6.x. I will open that one on its own.

…dvice

An RDNA 1 or Polaris user who already installed the HIP SDK never saw the new
message: the $HipSdkInstalled arm sits earlier in the chain and told them the
ROCm compute driver was missing, which is the impossible remediation this change
exists to remove, and those users installed the SDK because the old advice said
to. Guard that arm, plus the matching CPU-hint arm in install.ps1, on the
unsupported arch.

The Vulkan setter was printed as UNSLOTH_LLAMA_CPP_BACKEND=vulkan by the two
PowerShell installers and by the Windows-only branch in install_python_stack.py.
PowerShell parses that as a command name, so a user who pastes it sets nothing
and the next install picks the same CPU bundle. Print
$env:UNSLOTH_LLAMA_CPP_BACKEND = "vulkan" there, as the README already does.

The arms also said PyTorch training runs on CPU on these GPUs. It does not: with
no CUDA or XPU accelerator, unsloth raises NotImplementedError at import, which
is why studio/setup.sh already tells its other CPU-torch hosts that training and
GPU inference are unavailable. Say the same thing here.

README: Vega 20 (Radeon VII, MI50, gfx906) is older than RDNA 2 and does have a
ROCm PyTorch path (install.sh routes it to rocm6.3), so name Polaris and RDNA 1
instead of every pre-RDNA 2 AMD GPU.
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 2da871520d

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

pre-commit-ci Bot and others added 4 commits August 12, 2026 16:14
The ban was on one exact literal, so "every AMD GPU older than RDNA 2"
passed while contradicting the Vega 20 carve-out two sentences later.
Match the phrase family instead, and assert the group is named by its
members (Polaris, RDNA 1) rather than by a generation cutoff.
Comments only, no code or user-facing string touched. Every reason a
guard exists is kept, just said in fewer lines.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

pre-commit-ci Bot and others added 2 commits August 12, 2026 17:46
…on block

The ROCm summary reads $script:ROCmUnsupportedGfxArch unconditionally, but the
assignment sat inside `if (-not $HasNvidiaSmi)`, so an NVIDIA host never
defined it and a caller's Set-StrictMode turned the summary into an aborting
undefined-variable error. ROCmGfxArch beside it was always initialised at top
level; this one was not.

The guard asks the PowerShell parser whether any assignment is unnested rather
than comparing line numbers: the file has three -not $HasNvidiaSmi blocks, so
an ordering check picks the wrong one and passes for the wrong reason.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

…p mixed AMD hosts on the arch-unknown advice

Adds the Navi 10 / Navi 14 professional boards LLVM's processor table omits
(Radeon Pro W5700/W5700X -> gfx1010, Pro W5500/W5500M/W5300M and RX 5300/5300M
-> gfx1012) to all five copies of the unsupported-name table. Each mapping comes
from libdrm data/amdgpu.ids read against pci.ids and the kernel amdgpu PCI table,
not from a guess; the tables still route nothing.

studio/setup.sh's KFD sysfs fallback detects the GPU without rocminfo or amd-smi,
so it left the marketing name empty and the report fell through to a plain
AMD ROCm line on a host with no ROCm. It now reads lspci for that report only,
never writing it back into the name the supported table and --rocm-gfx key on.

install.ps1's WMI fallback classifies adapter 0 only, so a host pairing an
RX 5700 with an RX 7900 was told nothing could enable ROCm, which is false there.
The verdict is now withheld when another adapter is covered, leaving the
arch-unknown advice that does apply. install_python_stack.py and studio/setup.ps1
already scored every adapter.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: c80b821bf7

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

CI triage for this PR: nothing here is this PR's fault, and two of the red checks are not failures at all.

The three Backend failures on Python 3.10 through 3.13 are main's own defect, reproduced on a clean detached worktree at origin/main with no PR applied:

3 failed, 3 passed in 9.92s
tests/test_desktop_auth.py::test_health_response_reports_desktop_capability_fields
  ImportError: cannot import name 'openai_codex_auth_router' from 'routes' (unknown location)
tests/test_external_provider_usage_chunk.py::test_other_providers_do_not_get_the_continuation_flags[openai-...]
  ValueError: Responses event type is missing
tests/test_gemini_provider.py::test_openai_responses_forced_function_tool_choice_drops_hosted_tools
  ValueError: Responses event type is missing

with event = {}, event_name = '' at core/inference/openai_responses_shared.py:93. #8590 fixes the first, #8608 the other two; both are open. This PR is blocked behind those merges.

mac macos-15-intel / mask / file is red on main and does not block. The installer correctly declines torch on an Intel Mac ("PyTorch is unavailable for this platform (dropped Jan 2024)"), and then clean-machine-install-ci.yml:358 asserts import torch anyway, because that matrix row passes empty flags instead of --no-torch. The row is experimental: true under continue-on-error, so the workflow still concludes success; gh pr checks lists it as fail regardless. Byte-identical on a clean main run. That one wants a separate main-side CI fix.

@danielhanchen

Copy link
Copy Markdown
Member Author

Platform-isolation audit: this one is clean, and I want the reasoning on the record rather than a bare pass.

The RDNA 1 message is gated on if (-not $HasNvidiaSmi) at install.ps1:3161 and setup.ps1:2200, and on $_nvidia_detected -eq 0 plus _has_amd_rocm_gpu at install.sh:3342,3351. So an NVIDIA box never reaches it, and an Intel-only box fails the AMD predicate. No shared code path is touched: every change in this PR lives in the installer scripts, not in unsloth/.

WSL takes the Linux branch, which is correct.

The blocking failures on this PR are main's, not this PR's, and I have posted that separately.

Stated plainly: no AMD RDNA 1 hardware here. This is a static trace of the guards, not an observation.

…oards it was missing

A host is not one GPU. On a box pairing an uncovered card with one that has
wheels -- an RX 580 beside an RX 7900 XTX, or beside an Instinct MI210 --
"setting UNSLOTH_ROCM_GFX_ARCH will not enable ROCm PyTorch" was false:
masking to the other card and pinning its arch installs them, and install.sh
routes exactly that host to gfx110X-all a few lines earlier. Every advice site
now says what is true of the card it just named and claims nothing beyond it.

Deciding it at runtime was tried and dropped. Reading "an AMD adapter neither
table names" as a working peer misfires on the Vega-class iGPU (Raven through
Cezanne, Mendocino) that sits beside the dGPU on most Ryzen desktops and has no
ROCm torch path of its own, which would trade a correct dead stop for the
open-ended errand this change exists to remove. Reading only the supported
table misses the Instinct and V620 parts that are routable and appear in no
name table at all. Neither rule is right often enough to speak for a host.

Four real boards are added to all five copies of the message-only table:
Radeon Pro 5700 / 5700 XT (pci.ids 7319 and 731b, Navi 10, gfx1010) are the
only Navi 10 retail parts whose name carries neither "RX 5700" nor a W prefix,
and Radeon Pro WX 7100 / WX 5100 (Ellesmere, gfx803) carry no RX number at all,
so both fell through to the generic advice. Provenance from pci.ids as before,
and the shell case arms are matched case-sensitively, which is now stated where
only the arm ordering was.

Tests:

- The absolute host-wide phrasings are banned from all five sources, with the
  scoped replacements required per site so deleting the sentence cannot pass.
- test_unsupported_arch_routing_guards_8529.py drives the real index resolvers
  rather than asserting table shape: install.sh's get_torch_index_url and
  _amd_arch_index_family_for_gfx under sh, the .ps1 family maps under pwsh
  (including writes after the declaration, and the -contains list), the Python
  resolvers on both platforms, the Strix per-arch reroute, and studio/setup.sh's
  report-only lookup. Positive controls throughout.
- _assert_guarded_by_pin_arm matches the pin arm exactly rather than by prefix,
  binds the message's own enclosing arm, requires the pin arm to still say its
  note, ignores comment lines, and detects inline and re-indented chain closes.

Mutation tested: 13 mutants covering a post-declaration map write in each .ps1,
a single-quoted arch in _rocmWheelArches, a bypass inside get_torch_index_url,
the Strix arm, feeding the unsupported lookup into _setup_gfx directly and one
hop later, an inline-closed pin chain, a re-indented fi, and removing each new
table row. All killed.
@danielhanchen

Copy link
Copy Markdown
Member Author

Pushed a follow-up, a5f67f68e. Two things, both still messaging only: every routing table, wheel index and supported-arch list is untouched, and the new tests re-assert on each path that these arches still resolve to CPU.

The verdict spoke for the host, and a host is not one GPU

On a box pairing an uncovered card with one that has wheels, "setting UNSLOTH_ROCM_GFX_ARCH will not enable ROCm PyTorch" is false. Masking to the other card and pinning its arch does install them, and install.sh routes exactly that host to gfx110X-all a few lines earlier. Driving the real code with a scripted lspci, an RX 580 beside an Instinct MI210 got:

[WARN] AMD GPU detected (gfx803) -- no ROCm PyTorch wheels exist for that arch, installing CPU PyTorch.
[WARN] This is expected on this GPU; repairing rocminfo/amd-smi or setting UNSLOTH_ROCM_GFX_ARCH will not enable ROCm PyTorch.

while UNSLOTH_ROCM_GFX_ARCH=gfx90a on the same host returns https://repo.amd.com/rocm/whl/gfx90a/. studio/setup.sh was worse: on the KFD-only host it never runs the supported inference at all, so an RX 580 beside an RX 7900 XTX got the same absolute sentence while install.sh on that host routed torch to gfx110X-all.

Every advice site now says what is true of the card it just named. Same in install.ps1 and studio/setup.ps1, so the wording matches across platforms.

Why there is no peer check

I built one first, softening the sentence when another AMD adapter was present that the tables could not name. It reads the wrong way round on ordinary hardware: the Vega-class iGPU (Raven through Cezanne, plus Mendocino) sits beside the dGPU on most Ryzen desktops, is unroutable, and matches no table, so an RX 5700 XT in a Ryzen 5000G box would have lost "This is expected on this GPU" and been sent back to the errand this PR exists to remove. Confirmed against the real family map:

gfx90c    not routable      gfx1036   ROUTABLE -> gfx103X-all
gfx902    not routable      gfx90a    ROUTABLE -> gfx90a

Keying on the supported table instead, which is what install.ps1's $coveredPeer scan does, is right for the APU host and misses the Instinct and V620 parts that are routable and appear in no name table. Neither rule is right often enough to speak for a whole host, so neither ships.

Four boards the table should have named

Sweeping every AMD display device in pci.ids through all five copies turned up real parts falling through to the generic advice:

arch added pci.ids
gfx1010 Radeon Pro 5700, Pro 5700 XT 7319, 731b under Navi 10
gfx803 Radeon Pro WX 7100, WX 5100 67c0/67c4/67d4, 67c7/67d7 under Ellesmere

The MPX boards are the only Navi 10 retail parts whose name carries neither RX 5700 nor a W prefix, and the WX boards carry no RX number at all, so no consumer row could reach either. Same provenance rule as the rest of the table, and the full 1115-device sweep shows no new false positive: Baffin WX 4100, Lexa WX 3100, Vega WX 9100, and the FirePro W5100 / W7100 parts stay unclaimed, as do RX 6800, RX 7900 XTX, RX 9070 XT and R9700.

I also noted where only the arm ordering was documented that the shell case copies match case-sensitively while the regex copies do not. Every source that reaches them spells these names as pci.ids does.

Tests

  • The host-wide phrasings are banned from all five sources, with the scoped replacement required per site so deleting the sentence cannot pass the ban.
  • test_unsupported_arch_routing_guards_8529.py drives the real resolvers rather than asserting table shape: get_torch_index_url and _amd_arch_index_family_for_gfx under sh, the .ps1 family maps under pwsh including writes made after the declaration and the -contains list, the Python resolvers on both platforms, the Strix per-arch reroute, and studio/setup.sh's report-only lookup. Positive controls throughout, since a guard that matches nothing passes everything.
  • _assert_guarded_by_pin_arm matches the pin arm exactly rather than by prefix, binds the message's own enclosing arm, requires the pin arm to still say its note, ignores comment lines, and detects inline and re-indented chain closes.

Mutation tested, all killed: a post-declaration map write in each .ps1, a single-quoted arch in $_rocmWheelArches, a bypass inside get_torch_index_url itself, adding an uncovered arch to the Strix arm, feeding the unsupported lookup into _setup_gfx directly and one hop later, an inline-closed pin chain, a re-indented fi, and removing each new table row.

Suites on this branch: test_rdna1_unsupported_message_8529.py 257, the new guard file 124, test_rocm_support.py 490 + 1 skip, test_rocm_arch_table_parity.py 79, test_cross_platform_parity.py 76, test_windows_amd_gpu_scan_fallback.py 79, test_rocm_rdna_routing.py 23, test_rocm_gfx_spoof_7331.py 72, test_selection_logic.py 216, test_pr5940_followups.py 53, test_install_llama_prebuilt_logic.py 106 + 1 skip, and both pwsh suites green. Verified again with current main merged in, where test_amd_name_arch_r9700.ps1 also still passes.

The Backend CI and mac macos-15-intel failures on this PR are pre-existing on main (the same three backend tests fail on runs 31625613672 and 31619287682, and that mac leg asserts import torch on a leg where the installer deliberately skips it). Repo tests (CPU), where this PR's tests run, is green.

No AMD hardware was involved. As with all AMD coverage here, everything is mock-based.

studio/setup.ps1 carries the same WMI scan install.ps1 does, for its own name
inference, and it had the same gate. amd-smi can report GPUs with no gfx token
and only the first market name, which sets $HasROCm with no arch, so the scan
was skipped, $script:ROCmGpuLabels held one name, $gpuNames was one entry, and
a host pairing an RX 5700 with an RX 7900 was judged entirely on the 5700 even
with HIP_VISIBLE_DEVICES=1 selecting the 7900.

The scan is now gated on the arch, which is the condition the inference block
below already runs under, so the two can no longer disagree about whether there
is anything to infer from. A host that already has an arch still does no WMI
work here, and amd-smi's label still wins when it had one: only the peer list
is new on that path.

The pwsh suite walks the AST from the $script:ROCmGpuLabels assignment to its
enclosing if and asserts the condition names the arch and not $HasROCm, as it
already does for install.ps1. Restoring the old gate fails it.

tests/test_windows_amd_gpu_scan_fallback.py extracts that block with a regex
anchored on the literal gate, so its pattern follows the new condition.
chatgpt-codex-connector[bot]

This comment was marked as resolved.

The guard added last round only covered setup.sh's lspci fallback, so a named
hit still walked past it. amd-smi reports one market name, the first device's,
so on a host whose RX 5700 precedes an RX 7900 the name IS the uncovered card
and the false verdict came back through the other door.

The scan now runs first, for both paths:

    lone RX 5700, named            named    -> unchanged
    lone RX 580, named             named    -> unchanged
    RX 5700 + RX 7900, named 5700  named    -> quiet
    RX 5700 + RX 7900, no name     quiet    -> unchanged

It must not become a silencer, so it applies only when lspci can answer: with
no adapter list there is no peer to find, and the single-card host this report
exists for still has to be told. A test drives the lookup with lspci off PATH
and requires the verdict to survive.

Putting the named hit back in front fails the two mixed-host cases while that
no-lspci control still passes, so the ordering is what is pinned, not just the
presence of the guard.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 13, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 13, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: f1b75dea05

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

chatgpt-codex-connector[bot]

This comment was marked as resolved.

install.ps1:3331 was the only live Get-WmiObject call left in the file; every
other WMI query in it already asks Get-CimInstance, and the script handles
PSEdition Core explicitly. Get-WmiObject was superseded by Get-CimInstance in
PowerShell 3.0 and removed outright in PowerShell 7, so on pwsh the call threw,
the block's own catch swallowed it, and $wmiAmdNames came back empty. That is
the peer list the guard added two rounds ago reads, so on pwsh the guard could
never fire and the amd-smi path went back to blaming the uncovered card.

Same class, same properties, and the CIM cmdlets ship with 5.1 as well, so the
swap costs nothing downlevel and matches what studio/setup.ps1 already does.

The harness stubbed Get-WmiObject, so it was answering for a cmdlet the
installer no longer calls. It now stubs Get-CimInstance and defines
Get-WmiObject to throw, so a revert fails loudly instead of quietly returning
nothing through that catch. Reverting the call fails four tests.
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 6e78e0b892

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

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 0f184b5c48

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

Follow-up opened as #8689. Two of the guards I added here went past message-only and changed which PyTorch gets installed on some AMD hosts.

studio/setup.ps1: widening the adapter scan gate from $HasROCm to the arch let CIM fill $script:ROCmGpuLabels, which feeds $gpuNames and therefore the arch inference. The existing unpinned "borrow another adapter's arch" rule then resolved an arch where none was resolved before.

host before after
amd-smi confirms ROCm, no gfx token, one RX 9070 XT arch null, CPU torch gfx1201, ROCm wheels
same, RX 5700 XT then RX 7900 XTX arch null, CPU torch gfx1100, ROCm wheels, --rocm-gfx gfx1100 forwarded to llama.cpp and whisper

install.ps1: the Get-WmiObject to Get-CimInstance swap did the same on PowerShell 7, where the old call throws and the catch {} swallows it.

#8689 restores both scans byte-for-byte and moves the peer names into their own variable that only the uncovered-card verdict reads. It also fixes a drift it exposed: the five copies of the unsupported table were never pinned to each other, and the shell globs matched "RX 5800" as Polaris through RX 580 while the regex copies correctly did not.

danielhanchen added a commit that referenced this pull request Aug 13, 2026
…they exposed (#8689)

* Keep the peer guards message-only, and stop the shell Polaris arms over-matching

Adversarial verification of the "message-only" claim found two ways this branch had
started changing what gets installed, both introduced by my own review fixes.

studio/setup.ps1: widening the adapter scan gate from $HasROCm to the arch let CIM
fill $script:ROCmGpuLabels on the amd-smi path. That variable feeds $gpuNames and so
the arch inference, and the existing unpinned "borrow another adapter's arch" rule
then resolved an arch where none was resolved before. On a host where amd-smi
confirms a runtime but reports no gfx token, an RX 9070 XT went from CPU torch to
gfx1201, and an RX 5700 beside an RX 7900 went to gfx1100, with --rocm-gfx forwarded
to the llama.cpp and whisper installers.

install.ps1: the Get-WmiObject to Get-CimInstance swap had the same effect on
PowerShell 7, where the old call threw and the catch swallowed it. A host CIM can see
but the ROCm tools cannot went from CPU torch to a repo.amd.com index.

Both scans are now exactly what they were before this branch, byte for byte, and the
peer names live in their own variable that only the uncovered-card verdict reads:
$wmiAmdNames in install.ps1, $script:ROCmPeerLabels in studio/setup.ps1. Neither
block writes a label or an arch. The pwsh suite asserts that through the AST rather
than asserting the gate, which is the property that actually matters; appending a
label or arch assignment to either block fails it.

The PowerShell 7 Get-WmiObject defect is therefore still there. Fixing it changes
what every pwsh 7 AMD host without a HIP SDK installs, so it belongs in its own PR.

Separately, the five copies of the unsupported table were not pinned to each other,
only the supported ones were, and they had already drifted: the regex copies carry
(?!0) so "RX 5800" is not Polaris, while the shell globs matched it through "RX 580".
The shell arms now carry the same guard, and a new test compares all five tables by
EVALUATING them in their own languages over a shared name corpus. Adding a row to one
file alone fails it.

Also pinned: a blank UNSLOTH_TORCH_INDEX_URL / _FAMILY must not read as a pin in the
Python path, which dropping the .strip() previously passed.

* Yield the peer suppression to an AMD visible-device mask

The peer check walked every adapter without looking at HIP_VISIBLE_DEVICES or
ROCR_VISIBLE_DEVICES, so on a mixed host a masked-out supported card could
silence the verdict about the card the user had actually selected. Both
installers now skip the suppression under a mask, which is the rule
studio/setup.ps1 already applies to its arch-borrowing branch: the mask names
the card, so the verdict is about that one.

HIP and ROCR only, deliberately, not Test-VisibleDevicesPinned's set:
CUDA_VISIBLE_DEVICES masks NVIDIA devices and says nothing about which Radeon
was chosen, and counting it fired the verdict beside a covered Radeon on every
host that sets it, which two of the pwsh cases caught immediately.

Three assertions per file pin it. Emptying the mask list fails one, adding
CUDA_VISIBLE_DEVICES back fails another.

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

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

* Scan adapters with CIM and drop the masked verdict when it may name another card for PR #8689

---------

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.

1 participant