Repository navigation
install.sh: route Strix to the AMD arch index on rocm7.2 (#7264) + PCI detection hint - #7293
Conversation
…cm7.2, add PCI hint Two Linux install fixes for AMD Strix Halo / Strix Point: 1. #7264: Strix reverts to rocm7.2. Modern ROCm (7.3+) caps to the generic rocm7.2 index and the Radeon repo can be unavailable, so gfx1151/gfx1150 landed on a non-arch-specific build (torch 2.11+rocm7.2) instead of repo.amd.com/rocm/whl/gfx<arch> (torch 2.11+rocm7.13, AMD's real Strix fixes). The reroute to that arch index only fired on rocm7.1; broaden it to rocm7.2 too. Only acts when a gfx1151/gfx1150 is actually detected, so other arches on rocm7.2 pass through unchanged. 2. Rows about Strix not detected -> CPU-only: when no GPU is detected but an AMD display GPU is on the PCI bus, print a targeted hint (ROCm kernel stack / /dev/kfd missing) instead of only the generic docs pointer. Purely additive diagnostic; does not change the torch index decision.
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function _amd_gpu_present_via_pci to detect AMD display GPUs on the PCI bus, improving the "no GPU detected" warning when ROCm is not properly configured. It also extends the Strix Halo/Point routing logic to cover ROCm 7.2 and refines the associated warning messages. The reviewer suggested optimizing the PCI device check by using the shell's built-in read command instead of spawning external cat processes, and adding a defensive check for the existence of the /sys/bus/pci/devices directory.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| _amd_gpu_present_via_pci() { | ||
| for _pci_vendor in /sys/bus/pci/devices/*/vendor; do | ||
| [ -r "$_pci_vendor" ] || continue | ||
| [ "$(cat "$_pci_vendor" 2>/dev/null)" = "0x1002" ] || continue | ||
| case "$(cat "${_pci_vendor%vendor}class" 2>/dev/null)" in | ||
| 0x03*) return 0 ;; | ||
| esac | ||
| done | ||
| return 1 | ||
| } |
There was a problem hiding this comment.
Spawning external cat processes twice for every PCI device in a loop can be highly inefficient, especially on systems with many PCI devices or in virtualized/containerized environments where process creation is expensive. Since this script is executed with POSIX sh, we can use the shell's built-in read command to read the sysfs files directly without spawning any subprocesses. Additionally, we should defensively check if the /sys/bus/pci/devices directory exists before attempting to iterate over it.
| _amd_gpu_present_via_pci() { | |
| for _pci_vendor in /sys/bus/pci/devices/*/vendor; do | |
| [ -r "$_pci_vendor" ] || continue | |
| [ "$(cat "$_pci_vendor" 2>/dev/null)" = "0x1002" ] || continue | |
| case "$(cat "${_pci_vendor%vendor}class" 2>/dev/null)" in | |
| 0x03*) return 0 ;; | |
| esac | |
| done | |
| return 1 | |
| } | |
| _amd_gpu_present_via_pci() { | |
| [ -d /sys/bus/pci/devices ] || return 1 | |
| for _pci_vendor in /sys/bus/pci/devices/*/vendor; do | |
| [ -r "$_pci_vendor" ] || continue | |
| read -r _vendor < "$_pci_vendor" 2>/dev/null || continue | |
| [ "$_vendor" = "0x1002" ] || continue | |
| _class_file="${_pci_vendor%vendor}class" | |
| if [ -r "$_class_file" ] && read -r _class < "$_class_file" 2>/dev/null; then | |
| case "$_class" in | |
| 0x03*) return 0 ;; | |
| esac | |
| fi | |
| done | |
| return 1 | |
| } |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 115e147931
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _amd_gpu_present_via_pci; then | ||
| substep "An AMD GPU is on the PCI bus but ROCm cannot see it (no /dev/kfd," "$C_WARN" | ||
| substep " rocminfo, or amd-smi). Install the ROCm kernel stack so /dev/kfd exists;" | ||
| substep " Strix Halo (gfx1151/gfx1150) needs a recent kernel (6.11+) and ROCm 7.x." |
There was a problem hiding this comment.
Limit the PCI hint to failed ROCm detection
This predicate is evaluated for every CPU-index fallback, not only when ROCm failed to enumerate the GPU. For example, an AMD GPU with ROCm 5.x is successfully detected by rocminfo, but get_torch_index_url intentionally selects CPU wheels because supported wheels require ROCm 6.0+; the PCI check then incorrectly tells the user that ROCm cannot see the GPU and to install the kernel stack. Gate this message on the failed _has_amd_rocm_gpu case (or retain that result from detection) so unsupported/unknown ROCm versions receive the correct upgrade guidance instead.
Useful? React with 👍 / 👎.
| # The Radeon repo now ships cp313 wheels for rocm-rel-7.1, so when | ||
| # _amd_gpu_radeon=true the installer silently lands on the broken combo. | ||
| # Detect these GPUs when TORCH_INDEX_URL is rocm7.1 and override to rocm7.2. | ||
| # ── Strix Halo / Strix Point: route to the AMD arch-specific index ─────────── |
There was a problem hiding this comment.
Restore the marker used by the previous-torch-pin test
tests/sh/test_previous_torch_pin.sh still locates this block by grepping for Strix Halo / Strix Point: force rocm7.2 wheels; after this heading changed, its “pin evaluated after the Strix reroute” assertion fails and the script exits 1, despite the ordering being unchanged. Update that test's marker (or retain a stable marker here) so the repository's existing installer validation passes.
Useful? React with 👍 / 👎.
…fix test marker, use read builtin - Only show the 'ROCm cannot see the GPU' hint when _has_amd_rocm_gpu fails; a detected-but-too-old ROCm (rocminfo works, wheels need 6.0+) has its own path. - Update test_previous_torch_pin.sh to the stable 'Strix Halo / Strix Point:' marker after the heading reworded (the old grep broke the ordering assert). - _amd_gpu_present_via_pci: read builtin instead of spawning cat twice per device, and guard /sys/bus/pci/devices existence.
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
/gemini review |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Generalize the Strix reroute from the hardcoded rocm7.1/rocm7.2 match to a version compare against the arch index's own build (rocm7.13): - backwards: rocm6.0-6.4 and rocm7.0 now reroute (were silently missed) - forwards: any future intermediate rocm7.x below 7.13 reroutes; rocm7.13+ is left alone so a generic index that already carries the fix is not downgraded to the arch build _rocm_index_below does an integer major.minor compare (so rocm7.2 < rocm7.13); non-rocm, arch (gfx), and unparseable URLs return false, so NVIDIA/CPU and the arch index itself are untouched. Reroute still fires only for gfx1150/gfx1151.
|
Generalized the Strix reroute so it is forwards and backwards compatible instead of matching the literal The rule is now a version compare against the arch index's own build ( What this changes (verified against the reroute matrix):
Testing: extracted the real |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42ebed8501
ℹ️ 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".
| # 0 when URL's generic rocmX.Y tag is older than floor $2.$3 (int compare, so | ||
| # rocm7.2 < rocm7.13). Non-rocm / arch (gfx) / unparseable URLs return 1. | ||
| _rocm_index_below() { | ||
| _rb=$(printf '%s' "$1" | grep -oE 'rocm[0-9]+\.[0-9]+' | head -1 || true) |
There was a problem hiding this comment.
Parse the ROCm version from the index leaf
When UNSLOTH_PYTORCH_MIRROR contains a ROCm-looking path segment, this extracts that earlier segment rather than the selected index family. For example, a Strix system using https://mirror.example/rocm7.13/cache with its automatically selected .../rocm7.2 index makes _rb equal rocm7.13; the comparison then skips the arch-specific reroute and installs the generic wheels the change is intended to avoid. Extract and validate the final URL path segment (as the nearby index-family logic does) before comparing versions.
Useful? React with 👍 / 👎.
| case "$TORCH_INDEX_URL" in | ||
| */rocm7.1|*/rocm7.1.*) | ||
| */rocm[0-9]*) |
There was a problem hiding this comment.
Update the obsolete Strix routing test
TestStrixRocm71Override.test_strix_override_only_fires_on_rocm71 still asserts that this routing is limited to ROCm 7.1. It now passes accidentally because its source-text search for rocm7.1 matches the new rocm7.13 comment, not because it verifies the case selector. Consequently, the test suite will not catch a future regression that removes the intended ROCm 7.2 routing; replace it with assertions for the new version-comparison behavior.
Useful? React with 👍 / 👎.
|
Both addressed in 65f221a.
Testing: |
…review) Address two review points on the rocm-version reroute: - Parse the final path segment (_torch_index_leaf) instead of grepping the whole URL. A custom mirror whose base path holds its own rocm token (e.g. .../rocm7.13/cache/rocm7.2) previously matched the base and skipped the reroute; now it compares the leaf (rocm7.2) like the nearby index-family logic. Renamed the helper to _rocm_leaf_below and switched the case selector to $_torch_index_leaf. - Replace the stale test_strix_override_only_fires_on_rocm71 (which passed by matching the new rocm7.13 comment) with an executed test that runs _rocm_leaf_below and asserts rocm6.0-7.12 reroute while rocm7.13+/gfx/cu leaves do not.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Lines 2865 to 2867 in 299873a
On an AMD host where amd-smi successfully identifies the GPU but an installed rocminfo fails or emits no matching gfx token, this assignment exits with status 1 because grep -oE finds no match; under the script's global set -e, the installer terminates before the subsequent amd-smi fallback can run. The prior code exposed this only for the rocm7.1 path, but the widened rocm[0-9]* selector now makes ordinary ROCm 6.x/7.2 installations fail in that mixed-tool state. Make this probe non-fatal (for example, append || true) so the fallback is reachable.
ℹ️ 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".
The Strix reroute now matches every rocm* index, not just rocm7.1, so its gfx detection runs on all AMD installs. Each `_gfx_all=$(rocminfo|amd-smi | grep -oE gfx...)` returns 1 when grep finds no match, which under set -euo pipefail aborts the installer before the next fallback runs (e.g. rocminfo present but emitting no gfx token). Append `|| true` to the three probes, matching the display block that already guards this. Add an executed regression test (shimmed rocminfo/amd-smi) that fails if any probe becomes fatal again.
|
Fixed in 6333a31. This was a real regression from widening the selector. The gfx-detection probes ( Appended Verified empirically that |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
install.sh and test_previous_torch_pin.sh Strix changes already landed via unslothai#7293/unslothai#7264, so drop them (main is a superset). The remaining fix is studio/install_python_stack.py: replace the ver < (7, 2) gate with _strix_needs_amd_arch_index, which reroutes gfx1150/gfx1151 off any generic pytorch.org rocm index below the 7.13 AMD arch floor. This fixes ROCm 7.14 (unslothai#7280) and stays correct if pytorch.org later adds rocm7.3+. Keep the two Python-side tests; main's install.sh-scoped tests replace the old text-match one.
…slothai#7305 The _amd_gpu_present_via_pci helper and the PCI-bus 'no GPU detected' hint already landed in main via unslothai#7293 / unslothai#7264, so this drops the duplicated copies and keeps main's versions. The unique part of unslothai#7301 stays: _infer_linux_amd_gfx_arch (UNSLOTH_ROCM_GFX_ARCH, /proc/cpuinfo, lspci) plus the install.sh + install_python_stack.py routing that installs AMD per-arch wheels when no ROCm runtime is visible, mirroring install.ps1 on Windows. This does not touch _has_amd_rocm_gpu, so it is complementary to unslothai#7314 (which fixes detection when the kernel driver is present).
What
Two Linux-installer fixes for AMD Strix Halo (gfx1151) / Strix Point (gfx1150).
1. Strix reverts torch to rocm7.2 (#7264)
Strix should install torch
2.11+rocm7.13fromrepo.amd.com/rocm/whl/gfx<arch>/, which carries AMD's real gfx1150/gfx1151 fixes. But:download.pytorch.org/whl/rocm7.2index, andrepo.radeon.com) can be unavailable,and the reroute to the arch-specific index only fired on
*/rocm7.1. So a gfx1151 box on ROCm 7.14 whose Radeon repo was down fell back torocm7.2(the reported "found 7.14, reverts to 7.2"). This broadens the reroute trigger torocm7.2as well. The inner logic already only acts when a gfx1151/gfx1150 is actually detected (via rocminfo/amd-smi, honoring HIP_VISIBLE_DEVICES), so every other arch onrocm7.2passes through unchanged. This matches the Windows installer, which already maps gfx1151 torepo.amd.com/.../gfx1151.2. Strix not detected -> silent CPU-only
Reports of Strix Halo installing CPU-only PyTorch on bare-metal Linux (Arch, AI Max). When ROCm cannot see the GPU (no
/dev/kfd,rocminfo, oramd-smi) the installer fell back to CPU-only with only a generic docs pointer. Added_amd_gpu_present_via_pci(vendor0x1002+ display class0x03*) so that when an AMD GPU is on the PCI bus but ROCm can't use it, the installer prints a targeted hint (install the ROCm kernel stack so/dev/kfdexists; Strix needs kernel 6.11+ and ROCm 7.x). Purely additive diagnostic, no change to the torch-index decision.Verification
bash -nclean; no behavior change for non-Strix arches or non-AMD hosts.