Skip to content

AMD: CI coverage for recent fixes, plus three wrong gfx ids - #7431

Merged
LeoBorcherding merged 15 commits into
unslothai:mainfrom
LeoBorcherding:rocm-ci-test-coverage
Jul 25, 2026
Merged

LeoBorcherding merged 15 commits into
unslothai:mainfrom
LeoBorcherding:rocm-ci-test-coverage

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Jul 25, 2026 •

Copy link
Copy Markdown
Collaborator

Recent ROCm work landed with thin or no CI coverage. This adds regression tests for three of those fixes, closes a gap where the shell installer suite silently stopped growing, and corrects three gfx ids that were wrong in every copy of the GPU-name table.

To be clear about what this is: most of the line count is regression tests for bugs already fixed, not coverage for hardware that doesn't exist yet. The genuinely forward-looking parts are called out below.

1. CI gaps

Shell tests were a hardcoded list. studio-backend-ci.yml named 13 test files explicitly. tests/sh/ holds 22, so 9 files sat in the repo and never ran in CI. Replaced with a discovery loop over tests/sh/test_*.sh plus an explicit two-file skip list, and a guard that fails the job if discovery finds nothing. CI on this PR now reports ran 20 shell installer test files. tests/studio/test_ci_shell_suite_coverage.py asserts the workflow keeps discovering rather than enumerating, so new shell tests are picked up without anyone remembering to add them.

Path filters missed their own tests. The job's paths: filter didn't include tests/**, install.sh, or install.ps1, so a PR touching only the installers or only the tests didn't run them. Added.

2. Regression tests for recent ROCm fixes

  • tests/studio/install/test_rocm_native_linux_lib_dirs.py covers the bundled-HIP crash fix (fix(rocm): prepend system ROCm libs on native Linux to avoid bundled HIP crash #7233): system ROCm lib dirs are prepended only on native Linux, gated on /dev/kfd present and /dev/dxg absent, so WSL and non-AMD hosts are untouched.
  • studio/backend/tests/test_grouped_mm_rdna4_fallback.py covers the torch._grouped_mm null-HIP-kernel fallback on RDNA4 at ROCm <= 7.12, including that the fallback is not taken on 7.13+ where the kernel exists.
  • tests/studio/install/test_rocm_arch_table_parity.py covers the GPU-name -> gfx table, which is duplicated across the codebase.

3. Three wrong gfx ids

The parity test compares each copy against AMD's published ROCm compatibility matrix rather than against a sibling copy, since agreement between copies proves nothing if they were all transcribed from the same mistake. Three ids were wrong everywhere:

GPU was AMD documents die
RX 9070 / 9070 GRE (non-XT) gfx1200 gfx1201 Navi 48, same as the XT
RX 7800 XT / 7700 XT / PRO W7700 gfx1100 gfx1101 Navi 32
PRO V710 gfx1102 gfx1101 Navi 32

RX 7700S is not one of the three: it was already gfx1102 in every copy and stays there. What moved is the (?!S) lookahead that keeps it out of the arm above it, which is now the gfx1101 arm rather than the gfx1100 one, so it stays as an explicit ordering-trap guard.

Not purely cosmetic. All of these collapse to the same pip index leaf (gfx120X-all, gfx110X-all), so no user's wheel selection changes: verified against all four index-family maps. But install.sh prints Tip: set UNSLOTH_ROCM_GFX_ARCH=<arch>, so a 7800 XT user following that advice exported gfx1100 and made the wrong id authoritative for every later run.

tests/studio/install/test_rocm_support.py had pinned two of the wrong ids as expected values (RX 9070 -> gfx1200, RX 7700 XT -> gfx1100); corrected.

4. The table lives in seven places

The in-code "kept in sync with" comments list four. Fixing the ids turned up two more (a second table inside install.sh driving the detection banner and the Tip: line, plus studio/setup.sh). Since counting by hand is exactly what let them drift, TestNoUnregisteredArchTable now rediscovers the copies by scanning the source tree, and that scan found a seventh: tests/_zoo_rocm_spoof.py.

That one matters. It's the fixture other ROCm tests build their fake AMD host from, and it states the mapping backwards (gfx -> the name torch should report), which makes it an independent witness. It had gfx1101 -> RX 7800 XT and gfx1201 -> RX 9070 XT correct all along while all six installer copies were wrong, and nothing compared the two. They're now round-tripped against each other.

Detection heuristic: a line that names a card and gives its arch. Real tables score 9 to 17 such lines; the only other hits in the repo are two single-line prose comments, so the three-line threshold isn't load-bearing. A companion test asserts the scan still finds the known copies, so it can't go blind and pass by finding nothing.

Known divergence, pinned rather than normalised: the spoof says RX 6700 XT is gfx1031 (Navi 22); all installer copies group it into the gfx1030 arm. Left alone deliberately. AMD's matrix documents no consumer RX 6000 card and no gfx1031 at all, the installer arm is commented gfx103X family, and gfx1031 appears only as an index-family key, never as a value any name table emits. With no external source to correct against, changing shipped behaviour would be guesswork. A test fails if the divergence ever disappears, so the exemption can't go stale.

What is and isn't future-proofed

Forward-looking: the shell discovery loop, the unregistered-copy scan, test_inferred_arch_always_has_an_index_family (any new arch must route to a wheel index), test_wheel_arch_list_covers_every_mapped_arch, and a new reverse check that a documented card matching no arm anywhere is flagged as the silent CPU fallback it is.

Not future-proofed, stated plainly rather than implied: none of this detects hardware AMD ships that nobody transcribed. _AMD_DOCUMENTED_ARCH is a hand-maintained constant, so it only fires when a human edits it. Real detection would need a live fetch of AMD's matrix at test time, which makes the suite non-hermetic and breaks offline runners. The docstring says so instead of implying coverage that isn't there.

Also worth naming: every one of these tests runs CPU-mocked. No gfx kernel executes anywhere in CI. That ceiling only moves with a self-hosted AMD runner.

Verification

Run on Linux, not just the authoring host, in both CI job shapes:

shell installer suite (exact CI discovery loop):  ran 20, failed 0
repo-cpu-tests shape:                             478 passed
backend shape:                                     48 passed
bash -n across 69 shell files:                      0 failures

The new AMD-matrix assertions fail exactly 6 tests when stashed against the unfixed tables. All five new drift guards were mutation-tested individually (unregistered copy appears, spoof drifts, documented GPU matches nothing, heuristic goes blind, exemption goes stale) and each fails when its invariant is broken.

One test, test_no_version_cpu_warning_respects_gfx_override, fails on any host with ROCm installed: it stubs hipconfig/dpkg/rpm/amd-smi but not the /opt/rocm/.info/version file read. Pre-existing on main, passes on clean runners, untouched here.

Known follow-up, deliberately not in this PR

AMD Radeon AI PRO R9700 (gfx1201) is missing from all seven copies and currently resolves to None, which means CPU-only torch on a supported RDNA4 card. It's Navi 48, same silicon as the RX 9070 XT, but the tables match the literal string 9070|9080 and "R9700" contains neither. Adding it flips real users from CPU to ROCm, so it's a behaviour change rather than a correction and deserves its own PR. The new reverse check detects it the moment it's added to the ground-truth list.

LeoBorcherding and others added 4 commits July 24, 2026 17:18
…NA4 grouped_mm, discovery-based shell suite

Three merged ROCm fixes shipped without tests, and the CI wiring that
would have run them was gated on files the fixes do not touch.

Tests added (113):
  tests/studio/install/test_rocm_arch_table_parity.py (27)
    diffs the four duplicated gfx -> AMD pip-index tables across
    install.sh, install.ps1, studio/setup.ps1 and install_python_stack.py,
    plus the GPU-name -> arch tables and the torch 2.11 pin allowlist.
  tests/studio/install/test_rocm_native_linux_lib_dirs.py (26)
    covers unslothai#7233: system-ROCm lib dirs prepended ahead of bundled
    libggml-hip, the /dev/kfd + not-WSL + libhsa gate, the opt-out env
    var, root resolution order, and source parity between the two copies.
  studio/backend/tests/test_grouped_mm_rdna4_fallback.py (46)
    covers unslothai#7292: registration on the CUDA dispatch key, grouped and
    ungrouped numerics, bias/dtype promotion, and the Linux HIP<7.13 +
    RDNA4 name gate, executed from the shipped source rather than a copy.
  tests/studio/test_ci_shell_suite_coverage.py (14)
    fails if either shell runner goes back to a hardcoded list or skips
    a file without a recorded reason.

CI wiring:
  studio-backend-ci.yml: add install.sh / install.ps1 to the path filter
    (the suites it runs assert against those two files, so install-only
    changes -- the shape most AMD/ROCm routing fixes take -- skipped it),
    and replace the 13-file hardcoded shell list with directory
    discovery. That list had fallen seven files behind, including
    test_strixhalo_wsl_reroute.sh, the only shell coverage of the ROCm
    WSL reroute, which had never run on a PR.
  tests/run_all.sh: same discovery loop so local and CI agree.
Self-review of the previous commit found four tests that passed for the
wrong reason.

1. The arch-table parity test pinned expected gfx ids copied out of the
   shipped tables, which enshrined three upstream inaccuracies as
   correct: RX 9070 (non-XT) is gfx1201 not gfx1200, RX 7800 XT is
   gfx1101 not gfx1100, and PRO V710 is gfx1101 not gfx1102 per AMD's
   ROCm compatibility matrix. The expectation is now the AMD pip index
   leaf -- the thing the tables exist to produce, and what a wrong
   answer costs the user. The three known drifts are listed explicitly
   with a test asserting they stay cosmetic, i.e. that the wrong and
   right ids still map to the same wheel index. That test turns red the
   day one of them starts routing users to the wrong wheel.

2. The RDNA4 device-name test extracted the regex from worker.py and
   then matched with it, so it could not fail. Widening the pattern --
   the dangerous edit, since it forces the slow Python mm fallback onto
   RDNA3 users -- would have been silently accepted. It now reads the
   live pattern and checks it against fixed cases, plus asserts the
   name match stays guarded by `not _lin_arch` and that the name is
   lowercased before matching.

3. The CI-coverage test matched a verbatim line of studio-backend-ci.yml,
   so reindenting the step would fail the build while a real regression
   to a hardcoded list could slip past a reformat. It now parses the
   YAML, finds the step by name, and asserts on the glob plus the
   absence of individual filenames. The path-filter test likewise reads
   the parsed trigger instead of scanning raw text.

4. A set comprehension in the parity helper had a ternary whose branches
   were identical.

Mutation-tested: widening the RDNA4 regex, desyncing one copy of the
name table, dropping install.sh from the path filter, and re-skipping
the ROCm WSL shell suite each fail at least two tests. Verified on
Linux (WSL Ubuntu 24.04) with CI's torch pin: 86 + 48 pass.
The name -> gfx tables disagreed with AMD's ROCm compatibility matrix on
three entries. Corrected against the "Radeon GPU" list at
rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html:

  RX 9070, RX 9070 GRE   gfx1200 -> gfx1201   (Navi 48, same die as the XT)
  RX 7800 XT, RX 7700 XT gfx1100 -> gfx1101   (Navi 32, not Navi 31)
  PRO W7700              gfx1100 -> gfx1101
  PRO V710               gfx1102 -> gfx1101   (Navi 32, not Navi 33)

No wheel changes for anyone: gfx1200/gfx1201 both resolve to gfx120X-all
and gfx1100/gfx1101/gfx1102 all resolve to gfx110X-all, in all four copies
of the index-family map. That collapse is why the errors survived being
copied into six places -- the leaf-level tests could not see them.

It was not purely cosmetic, though. install.sh's second copy feeds
"Tip: set UNSLOTH_ROCM_GFX_ARCH=<arch>", so a 7800 XT user following the
printed advice exported gfx1100 and made a wrong id authoritative for
every later run. It would also have become a real misroute the moment AMD
split a family across index leaves, as they already do for gfx1151/gfx1150.

Fixed in all six places, which is two more than the table's own "kept in
sync with" comments claim exist:

  install.sh   _infer_amd_gfx_arch_from_gpu_name
  install.sh   case "$_gpu_disp_mkt"          (banner + env tip; undocumented)
  studio/setup.sh
  install.ps1
  studio/setup.ps1
  studio/install_python_stack.py

Ordering is preserved: the gfx1102 arm still precedes gfx1101 in the shell
copies so "RX 7700S" cannot fall onto the "RX 7700" glob, and the
PowerShell copies keep the (?!S) lookahead.

Test changes:
  - test_rocm_arch_table_parity.py gains _AMD_DOCUMENTED_ARCH, exact gfx
    ids transcribed from AMD rather than from the tables. Agreement between
    six copies proves nothing when all six were transcribed from the same
    mistake, so the ground truth has to come from outside. Verified it
    catches the bug: against the pre-fix tables it fails 6 tests.
  - The parity check now covers all six copies. It had four; the two
    install.sh copies were being treated as one, and
    _WIN_GPU_NAME_ARCH_TABLE was not checked at all.
  - test_rocm_support.py's TestGfxArchNameFallback pinned two of the wrong
    ids as expected values; updated, and extended with a 9060 XT and a
    7900 XTX case so each RDNA3/4 die is represented.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author
image

LeoBorcherding and others added 3 commits July 25, 2026 00:23
Counting the copies by hand is what let them drift: the in-code "kept in
sync with" comments claimed four, the arch-id fix found six, and scanning
the tree turns up a seventh.

TestNoUnregisteredArchTable rediscovers the copies from the source tree
instead of trusting a hand-maintained list. A table line is one that names
a card and gives its arch; real tables score 9-17 such lines and the only
other hits in the repo are two single-line prose comments, so the
three-line threshold is not load-bearing. A companion test asserts the
scan still finds the known copies, so the heuristic cannot go blind and
pass by finding nothing.

The seventh copy is tests/_zoo_rocm_spoof.py, the fixture other ROCm tests
build their fake AMD host from. It states the mapping backwards (gfx ->
the name torch should report), which makes it an independent witness: it
had gfx1101 -> RX 7800 XT and gfx1201 -> RX 9070 XT right while all six
installer copies were wrong, and nothing compared the two. Now they are
round-tripped against each other.

RX 6700 XT is pinned as a known divergence rather than normalised. AMD's
compatibility matrix documents no consumer RX 6000 card and no gfx1031 at
all, the installer arm is commented "gfx103X family", and gfx1031 appears
only as an index-family key, never as a value a name table emits. With no
external source to correct against, changing shipped behaviour would be
guesswork. A test fails if the divergence ever disappears, so the
exemption cannot go stale.

Also adds the reverse of the AMD-matrix check: a documented card that
matches no arm anywhere is a silent CPU fallback rather than a wrong id.
This cannot detect hardware nobody transcribed, which would need a live
fetch of AMD's matrix and a non-hermetic suite; the docstring says so
rather than implying coverage that is not there.

Verified on Linux: 478 passed, plus all five new guards mutation-tested
to confirm each fails when its invariant is broken.
@LeoBorcherding
LeoBorcherding marked this pull request as ready for review July 25, 2026 05:47
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

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

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

Comment thread tests/run_all.sh Resolved
@LeoBorcherding LeoBorcherding changed the title ROCm/AMD: CI coverage for recent fixes, plus three wrong gfx ids AMD: CI coverage for recent fixes, plus three wrong gfx ids Jul 25, 2026
tests/run_all.sh discovered tests/sh/ instead of listing files, but still
invoked each one with sh. Every file there declares a bash shebang, and on
Debian/Ubuntu /bin/sh is dash: test_apt_distro_prompt.sh,
test_studio_home_node_dir.sh and test_with_llama_cpp_dir_link_behavior.sh
fail on bashisms under dash and pass under bash. The old hand-written list
happened to name only dash-clean files, so switching to discovery is what
surfaced it. Backend CI already used bash, so this was a local-only break.

Guarded by a new test asserting both runners invoke tests/sh/ with bash.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Confirmed and fixed in 593cca7. Verified on Ubuntu 24.04 where /bin/sh is dash: test_apt_distro_prompt.sh, test_studio_home_node_dir.sh and test_with_llama_cpp_dir_link_behavior.sh fail under sh and pass under bash, the other 17 pass either way. The old hand-written list only named dash-clean files, so switching to discovery is what surfaced it. run_all.sh now uses bash "$_t", matching Backend CI, and a new guard in tests/studio/test_ci_shell_suite_coverage.py asserts both runners invoke tests/sh/ with bash.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 8d505630bf

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

danielhanchen and others added 2 commits July 25, 2026 01:28
The GPU-name tables map 860M/840M and the Ryzen AI 7 350 / AI 5 340 CPU
strings to gfx1150, but Krackan Point is gfx1152. AMD's own lemonade table
(src/cpp/server/system_info.cpp) maps both Krackan iGPUs to gfx1152.

Unlike the three ids already fixed here, this one is not wheel-neutral:
repo.amd.com publishes gfx1150 and gfx1152 as separate index leaves with
separately built torch wheels, so these laptops were installing wheels
built for a different LLVM target. gfx1152 was absent from the codebase
entirely, so it needed the index-family maps, the torch 2.11 floor lists
(same _grouped_mm bug as gfx1150/1151), the Strix reroute set and the
Windows arch allowlist as well as the seven name tables.

The parity test added in this PR did not catch it because its AMD-matrix
expectations stopped at 890M/880M. Added the APU rows, so the case that
actually changes a wheel is now covered: reverting the tables fails 9
tests naming 860M, 840M and Krackan.

gfx1153 (Ryzen AI 5 430 era) is left alone; AMD publishes no gfx1153
wheel family, so there is nothing to route it to.

Verified: bash -n on both shell installers, PowerShell AST parse on both
.ps1 files, python ast.parse on all touched modules, install suite 1334
passed with no new failures against main, shell suite 20 files.

@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: 433a062e15

ℹ️ 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_python_stack.py Resolved
@danielhanchen

Copy link
Copy Markdown
Member

Reviewed this on a Strix Halo box (Radeon 8060S, gfx1151) and checked the three id corrections against AMD's own sources rather than the PR description. All three are right:

  • RX 9070 / 9070 GRE -> gfx1201, RX 7800 XT / 7700 XT / PRO W7700 -> gfx1101, PRO V710 -> gfx1101, confirmed in the ROCm compatibility matrix and in the supported-GPU list on the install-on-linux page.
  • The ROCm 6.4 rocBLAS error in ROCm/ROCm#4625 independently lists the shipped Tensile libraries as gfx1101, gfx1102, gfx1200, gfx1201, so those are genuinely distinct build targets.
  • Wheel-neutrality holds: gfx1101 resolves to gfx110X-all in all four index-family maps, and the only arch allowlist (studio/setup.ps1) already contained it.

The new tests do what they claim. Reverting the tables and keeping the tests fails exactly the six expected cases, and the TestNoUnregisteredArchTable meta-guard catches a planted eighth copy. The sh -> bash change in run_all.sh is a good catch.

One more wrong id, and this one is not wheel-neutral

I pushed a commit for it. The tables map 860M / 840M and the Ryzen AI 7 350 / AI 5 340 CPU strings to gfx1150, but Krackan Point is gfx1152. AMD's own lemonade maps both Krackan iGPUs to gfx1152:

// lemonade-sdk/lemonade, src/cpp/server/system_info.cpp
if (device_lower.find("840m") != std::string::npos ||
    device_lower.find("860m") != std::string::npos) {
    return "gfx1152";
}

Unlike the three ids already fixed here, this one changes the wheel. repo.amd.com publishes gfx1150 and gfx1152 as separate index leaves with separately built torch wheels:

repo.amd.com/rocm/whl/gfx1150/  200   torch-2.11.0+rocm7.13.0  707,288,123 bytes
repo.amd.com/rocm/whl/gfx1151/  200   torch-2.11.0+rocm7.13.0  707,142,594 bytes
repo.amd.com/rocm/whl/gfx1152/  200   torch-2.11.0+rocm7.13.0  707,286,296 bytes

Different sizes, so these are distinct per-arch builds and Krackan laptops were installing wheels built for another target. gfx1152 was absent from the codebase entirely, so the commit adds it to the index-family maps, the torch 2.11 floor lists (same _grouped_mm bug as gfx1150/1151), the Strix reroute set and the Windows allowlist, not just the name tables.

The parity test here did not catch it because its AMD-matrix expectations stopped at 890M/880M. I added the APU rows, so the one case that actually costs a user a wheel is now covered. Reverting the tables now fails 9 tests naming 860M, 840M and Krackan.

I left gfx1153 alone. AMD documents it for the Ryzen AI 5 430 era, but repo.amd.com/rocm/whl/gfx1153/ is a 403, so there is no index to route it to.

Small thing in the description

The third row of the table in the PR body is not right. It says RX 7700S was gfx1101 and should be gfx1102, but 7700S was already gfx1102 in every copy. The actual third change is PRO V710 gfx1102 -> gfx1101, which is not mentioned (it is folded into row 2, whose "was" column says gfx1100). Worth fixing so the changelog matches the diff.

Verification

Ran on Windows 11 + Strix Halo, against a clean main worktree for the baseline:

install suite (tests/studio/install + ci shell coverage):  1334 passed, no new failures vs main
shell discovery loop:                                      20 files (3 failures, all pre-existing on main, MSYS only)
bash -n:                                                   install.sh, studio/setup.sh
PowerShell AST parse:                                      install.ps1, studio/setup.ps1
python ast.parse:                                          all touched modules

Looks good to merge once the description row is corrected.

…based

Krackan Point (gfx1152, Radeon 860M/840M) is the third RDNA 3.5 APU and
shares one GPU/system-RAM pool exactly like Strix Point (gfx1150) and
Strix Halo (gfx1151), but only the installers knew about it. The two
runtime classifiers still had two-element arch sets, so a Krackan laptop
got the 0.90 discrete headroom factor on a shared pool and ran llama.cpp
without GGML_CUDA_ENABLE_UNIFIED_MEMORY.

- worker.py _rocm_classify_unified_memory: add gfx1152 to the arch set,
  and 860m/840m to the device-name fallback. The NVIDIA GeForce 840M
  cannot collide there: the function is only reached under _hw.IS_ROCM.
- llama_cpp.py _amd_apu_wants_unified_memory: add gfx1152 to the arch set.
- Tests for both, including the :sramecc-:xnack- suffix form.

TestGfx211AllowlistParity compared four hardcoded allowlist strings, so
adding gfx1152 to all four installers correctly turned three assertions
red without any installer actually disagreeing with another. Each test
now extracts the set its installer holds and compares it to one EXPECTED
constant. Order and spacing are free, membership is not, and the next
leaf is a one-line edit instead of four.
@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author

Fixed both, thanks.

Codex P1 (gfx1152 in the unified-memory classifiers): the installers knew about Krackan Point but the two runtime classifiers didn't, so a 860M/840M laptop got the 0.90 discrete headroom factor on a shared pool and ran llama.cpp without GGML_CUDA_ENABLE_UNIFIED_MEMORY. Added gfx1152 to _rocm_classify_unified_memory and _amd_apu_wants_unified_memory, plus 860m/840m to the device-name fallback. That fallback is only reached under _hw.IS_ROCM, so the NVIDIA GeForce 840M can't collide with it. Tests cover both, including the gfx1152:sramecc-:xnack- suffix form.

The three red parity assertions: those were stale tests, not disagreeing installers. TestGfx211AllowlistParity compared four hardcoded allowlist strings, so adding gfx1152 to all four installers correctly turned it red. Each test now extracts the set its installer actually holds and compares it to one EXPECTED constant, so order and spacing are free and the next leaf is a one-line edit instead of four.

@danielhanchen on the description: you're right, 7700S was already gfx1102 in every copy. The real third change is PRO V710 gfx1102 -> gfx1101; what moved for the 7700S is the (?!S) lookahead, which now guards the gfx1101 arm. PR body updated.

The remaining test_gguf_load_cache_reuse.py failure is not from this branch: git diff --name-only upstream/main...HEAD doesn't include routes/inference.py or that test file. Merged main in as well, so CI now runs against the merged head.

@codex review

@LeoBorcherding

Copy link
Copy Markdown
Collaborator Author
image

@LeoBorcherding
LeoBorcherding merged commit 3ea6d14 into unslothai:main Jul 25, 2026
54 of 56 checks passed
@danielhanchen

Copy link
Copy Markdown
Member

Following up post-merge. The gfx1152 work is in main and main is green on my Strix Halo box: 1371 passed across tests/studio/install, the shell-suite coverage test and the APU unified-memory suite, with no new failures against a clean pre-merge main baseline.

The Add gfx1152 to unified-memory classifiers follow-up caught a real gap I missed. I only did the installers, and the two runtime classifiers still had two-element arch sets, so a Krackan laptop would have taken the 0.90 discrete headroom factor on a shared pool. I checked the safety claim in that commit and it holds: the name-based is_unified fallback in _rocm_classify_unified_memory is only consumed at the if _hw.IS_ROCM: call site, and the other call site discards the flag and uses _lin_arch only, so a GeForce 840M cannot reach it either way. Making TestGfx211AllowlistParity set-based was the right call too, my change turned three of those assertions red purely on ordering.

One consequence we did not catch: there is no gfx1152 llama.cpp bundle

Making gfx1152 a first-class arch changed llama.cpp prebuilt selection, because the published bundles do not cover it. From the current release manifest (b10079-mix-fb3d4ca):

gfx103X  mapped_targets=['gfx1030', 'gfx1031', 'gfx1032', 'gfx1034']
gfx110X  mapped_targets=['gfx1100', 'gfx1101', 'gfx1102', 'gfx1103']
gfx1150  mapped_targets=['gfx1150']
gfx1151  mapped_targets=['gfx1151']
gfx120X  mapped_targets=['gfx1200', 'gfx1201']
gfx908   mapped_targets=['gfx908']
gfx90a   mapped_targets=['gfx90a']

published_rocm_choice_for_host matches the concrete mapped_targets list deliberately, so an in-generation but unbuilt arch is not served a sibling family bundle. Ran it against those exact bundles:

host gfx1150  -> app-b10079-linux-x64-rocm-gfx1150.tar.gz
host gfx1151  -> app-b10079-linux-x64-rocm-gfx1151.tar.gz
host gfx1201  -> app-b10079-linux-x64-rocm-gfx120X.tar.gz
host gfx1152  -> None    (no published bundle, falls back to a HIP source build)

So a Krackan box now gets correct gfx1152 torch wheels but no prebuilt llama.cpp, and drops to a source build where it previously downloaded the gfx1150 bundle.

I do not think this should be reverted. The gfx1150 binary was being handed to gfx1152 hardware before, which is the same wrong-ISA problem the torch side had, so the source build is arguably the more correct outcome and the previous prebuilt may well have been broken in a quieter way. But it is a real change in install time for those users and it was not intentional.

The clean fix is on the llama.cpp side: either publish a -gfx1152 bundle alongside gfx1150/gfx1151, or add gfx1152 to the gfx1150 bundle's mapped_targets if that build genuinely covers both. Worth adding gfx1152 to TestPublishedRocmGfxSelection.GFX in test_selection_logic.py at the same time, since that matrix still stops at gfx1151 and would not have flagged this.

Happy to open a tracking issue on unslothai/llama.cpp for the bundle if you want.

danielhanchen added a commit that referenced this pull request Jul 27, 2026
… silent (#7491)

* tests: record the gfx1152 llama.cpp bundle gap so the next one is not silent

#7431 made gfx1152 (Krackan Point, Radeon 860M/840M) a first-class arch, which
fixed torch wheel selection: those laptops were pulling gfx1150 wheels built for
a different LLVM target. It also changed llama.cpp prebuilt selection, because
no gfx1152 bundle is published. published_rocm_choice_for_host deliberately
refuses to serve a sibling-family bundle, so those hosts now fall back to a HIP
source build.

That is the right outcome, a wrong-ISA binary fails at the first BLAS call
rather than merely installing slowly, but nothing recorded it and nothing would
have caught it. TestPublishedRocmGfxSelection builds its release from a
hardcoded family list, so it can only assert about arches someone already
thought to add.

Adds TestPublishedRocmBundleCoverage:

- PUBLISHED mirrors the mapped_targets in llama-prebuilt-manifest.json.
- KNOWN_GAPS lists arches _GFX_TO_AMD_INDEX_ARCH routes torch for that no bundle
  covers: gfx1033/1035/1036 (RDNA 2, never built) and gfx1152.
- test_known_gaps_fall_back_to_source_build pins each to None.
- test_every_torch_routed_arch_is_covered_or_a_known_gap compares the routed set
  against bundle coverage, so adding an arch for torch without a bundle has to
  be a deliberate KNOWN_GAPS entry.

The invariant fires both ways. Simulating a new routed arch fails with
"coverage drifted: ['gfx1153'] newly uncovered"; simulating a published gfx1152
bundle fails with "gfx1152 is in KNOWN_GAPS but a bundle now matches it; drop it
from the set", so closing the gap cannot leave the list stale.

Reads _GFX_TO_AMD_INDEX_ARCH from source instead of importing
install_python_stack, which this suite does not otherwise depend on.

No production code changes. Install suite 1355 passed, no new failures.

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
danielhanchen added a commit to LeoBorcherding/unsloth that referenced this pull request Jul 27, 2026
One conflict, in the Strix reroute arch case. Both sides were wanted:

- this branch wraps the case in `[ "$_gfx906_env" != "gfx906" ]` so an explicit
  UNSLOTH_ROCM_GFX_ARCH=gfx906 suppresses the Strix reroute on a mixed host;
- main added gfx1152 (Krackan Point) to the arch list in unslothai#7431.

Resolved by keeping the gfx906 guard around main's three-arch list.

Verified: bash -n install.sh, rocm support + arch parity suites 465 passed,
test_strixhalo_wsl_reroute.sh 53 passed, and the tokenizers/torch-constraint
file fails the same 14 pre-existing E2E sandbox tests it fails on main.
danielhanchen added a commit that referenced this pull request Aug 3, 2026
…st (#7774)

* Anchor the host-defaults assertions and take the file off the skip list

test_install_host_defaults.sh has been quarantined since #7431 and failing for
longer, with a recorded reason that covers one of three drifts. None of them is
a regression: install.sh, install.ps1 and the README all still behave as the
test intends. Every failure comes from how the test carves out the text it
greps.

Both installers were sliced with a fixed tail. install.sh grew past its 50-line
window in #6258 and install.ps1 past its 25-line window in #7be1085, the day
after the test landed, so the prompt each assertion looks for sat just above the
window. Both now start at the block's own 'In interactive terminals' comment.

The README extractor stopped at a '#### Update' heading that was later deleted,
so its Launch section silently became the rest of the file and picked up the
-H 0.0.0.0 from the remote-access section 137 lines below. It now stops at the
next heading of any name.

Two assertions could not have failed. setup.sh's launch hint sits at line 2332
while tail -30 covered 2339 onward, so the negative check no longer looked at
the hint at all, and 'read' as a needle also matches 'readable' and
'_can_read_tty', so the prompt check passed with the prompt deleted. Both are
pinned to what they mean to protect; each of the six assertions now fails when
its target is removed.

With the extraction fixed the file passes 10/10, so it comes off the skip list
in run_all.sh, studio-backend-ci.yml and test_ci_shell_suite_coverage.py, which
have to change together.

* Give the setup.sh window a canary and stop at any heading level

The setup.sh launch-hint extraction was the only one of the four with no
positive assertion over it. The other three each pin something that must be
present, so a broken extraction fails loudly; this one had a lone
assert_not_contains, and a negative check over an empty window passes. Renaming
the printf label empties it, and the test then stays green with 0.0.0.0
hard-coded in the hint, which is the failure this PR exists to remove.

The README extractor's comment promised the next heading of any name while the
pattern only matched an h4, so demoting the following heading would widen the
window again.

* Tighten the comments on the anchored host-defaults assertions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants