Repository navigation
fix(studio): correct the AMD GPU name to gfx table against AMD's own device lists - #17904
Conversation
|
@danielhanchen Could you review this AMD detection fix? The fork account cannot execute GitHub reviewer requests, so I am tagging you here. |
…s; registry fallback only when WMI fails [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efa7d63dea
ℹ️ 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".
| _registry_tokens = [ | ||
| _arch for _name in _registry_names if (_arch := _gfx_arch_from_gpu_name(_name)) is not None | ||
| ] | ||
| _registry_pick = _dedup_pick(_registry_tokens, warn = False) |
There was a problem hiding this comment.
Preserve adapter indices in the registry fallback
When WMI fails on a hybrid AMD machine and the registry contains AMD Radeon(TM) Graphics followed by AMD Radeon RX 6700S, HIP_VISIBLE_DEVICES=0 currently yields gfx1032: the first name is discarded before _dedup_pick indexes the list. This silently selects the dGPU despite the iGPU being pinned, and _ensure_rocm_torch can install the wrong per-arch device pack. Resolve the mask over the full adapter-name list and only borrow another adapter's arch when unpinned, matching the WMI path above.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in ac6d70d: the mask now indexes the full registry adapter list, and another adapter's arch is borrowed only when unpinned, matching the WMI path.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac6d70d0c2
ℹ️ 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 _registry_pick: | ||
| _safe_print(f" gfx arch inferred from GPU registry: {_registry_pick}") | ||
| return _registry_pick |
There was a problem hiding this comment.
Apply registry recovery before the PowerShell stale-venv check
On a driver-only Windows host whose WMI remains unavailable, this recovery exists only in the Python stage: setup.ps1 still has no arch and publishes a CPU expectation. After ROCm is installed using this result, the next studio update treats the ROCm venv as stale (studio/setup.ps1:6693–6709) and force-reinstalls CPU torch (studio/setup.ps1:8309–8317) before Python repairs it back to ROCm. The bundled hipInfo.exe does not prevent this because setup explicitly excludes venv copies at studio/setup.ps1:4264–4266. Reuse registry recovery before setup's stale-venv and index decisions so subsequent updates do not repeatedly replace a working GPU build with CPU and then ROCm again.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cf94aba by removing the registry fallback: the name table change covers the reported card, and a Python-only fallback would make setup.ps1 swap the venv back to CPU on every update.
| _registry_names[_pick_visible_index(len(_registry_names), warn = False)] | ||
| ) | ||
| else: | ||
| _registry_pick = _dedup_pick(_registry_tokens, warn = False) |
There was a problem hiding this comment.
Translate the unpinned mask hint back to adapter indices
The pinned branch fixes the earlier report, but this unpinned branch still gives _dedup_pick a shortened list even though that helper prints a device-index hint. With WMI unavailable and registry order [AMD Radeon 780M Graphics, AMD Radeon RX 580, AMD Radeon RX 6700 XT], it selects gfx1031 but recommends HIP_VISIBLE_DEVICES=1, because the unmapped RX 580 was removed from _registry_tokens. Following that advice makes the next invocation's pinned registry branch resolve index 1 to the RX 580 and return None instead of gfx1031. Translate the suggested index back to the original adapter list—index 2 here—rather than exposing an index into the compressed token list.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The registry fallback is removed in cf94aba, so this hint path no longer exists.
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
…apper above it (rest shard red on main) (#17952) ## Summary `Repo tests (CPU, rest)` fails on current main (seen on #17921, #17934 and the staging run of #17904) in: ``` tests/test_flex_mask_graph_breaks.py::test_compiled_flex_mask_has_no_graph_breaks_and_matches_eager E torch._dynamo.exc.Unsupported: Data-dependent branching E File ".../unsloth_zoo/temporary_patches/misc.py", line 1318, in flex_attention_mask E return original(*bound.args, **bound.kwargs) E File ".../unsloth/import_fixes.py", line 2471, in flex_attention_mask E return original(*args, **kwargs) E File ".../transformers/masking_utils.py", line 685, in flex_attention_mask E if attention_mask is not None and not fast_all(attention_mask): ``` It started with unslothai/unsloth-zoo#2551 (the test passes with zoo at its parent and fails at it). That PR wraps the registered `flex_attention` mask builder to keep the padding `mask_mod` during training, and forwards every call as `original(*bound.args, **bound.kwargs)`, i.e. by position. The wrapper it sits on is Unsloth's `fix_transformers_flex_mask_graph_breaks` patch, which only handled keyword calls: with any positional argument it called transformers directly, so while Dynamo traces the `fast_all(attention_mask)` branch came back and `fullgraph` tracing broke. Both patches are right on their own; the Unsloth one was fragile about how it is called, so this hardens it rather than changing zoo. ## Change - `unsloth/import_fixes.py`: the flex mask patch binds positional arguments to the original's signature and continues with keywords (new helper `_keyword_arguments`, which merges `**kwargs` parameters and returns `None` for anything it cannot express as keywords; then the call goes through unchanged, as before). - `tests/test_flex_mask_graph_breaks.py`: new `test_a_wrapper_forwarding_by_position_keeps_the_compiled_path` registers a wrapper that forwards by position above the patch (as zoo's does) and checks the `fullgraph` compile of a padded batch matches eager. It does not depend on which zoo is installed. ## Testing | unsloth | unsloth_zoo | `test_flex_mask_graph_breaks.py` | |---|---|---| | main | main | 1 failed (the CI failure) | | this PR | main | 4 passed, 1 skipped | | this PR | before #2551 | 4 passed, 1 skipped | | main | before #2551 | 1 failed: the new positional-wrapper test | CPU, torch 2.10, transformers 5.17 (the CI pins for this shard).
…he gloo shard (2100 s cap) (#17969) ## Summary `Repo tests (CPU, gloo)` is timing out again: the shard's pytest runs under `timeout --signal=INT 2100` and recent runs were cut off there with nothing failing: | run | result | |---|---| | #17934 (upstream) | 257 passed, 3 skipped in 2089.55 s, exit 124 | | staging run of #17904 | 258 passed, 3 skipped in 2095.11 s, exit 124 | | staging run of #17957 | 251 passed, 1 failed in 2096.44 s, exit 124 | For comparison the same shard ran 241 tests in 1292 s when #17892 merged this morning. Since then #17886 (`test_tp_dpo_peft_ref_adapter_gloo.py`), #17930 (`test_cp_ulysses_media_towers_gloo.py`), `test_cp_ulysses_dynamic_len_gloo.py` and the DeepSeek-V4.1 additions to `test_parallel_deepseek_v41_gloo.py` landed in it, and a slower runner now goes over the cap. Every one of those tests passes; the shard just no longer fits. ## Change - `.github/workflows/studio-backend-ci.yml`: `tests/test_tp_[!n]*gloo*.py` (the non-native tensor parallel files: `tp_env`, `tp_eval`, `tp_full_finetune`, `tp_replica`, `tp_kv_replicated`, `tp_moe_dropout`, `tp_dpo_peft_ref_adapter`, ...; 12 files) moves out of `gloo` into a new `gloo-tp-env` shard. `gloo` keeps its other three globs (19 files). Comment added with the numbers above. - `tests/studio/test_backend_ci_parallel_isolation.py`: the command scan's expected counts go from 15 parallel runs / 10 repo-root shards to 16 / 11, as its message asks when a shard is added. ## Why that split Measured locally on main with the shard's exact command (`-n 4 --dist loadgroup`): 275 passed in 1302.83 s. Of the 40 slowest tests (2815 worker-seconds), 2716 s are in `tests/test_tp_[!n]*gloo*.py`; out of about 5200 worker-seconds in total, so these 12 files are well over half of the shard. Each half now has room under the cap on a slower runner. ## Testing - `tests/test_ci_repo_cpu_shards.py` (every repo test file collected by exactly one shard, every glob matches a file): 15 passed. - All 15 test files that read `studio-backend-ci.yml`: 341 passed, 3 skipped. - The new shard's first run on this PR is the timing check.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c8bea9925
ℹ️ 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".
| *"860M"*|*"840M"*|*"Krackan"*|*"AI 7 35"*|*"AI 5 34"*|*"AI 7 PRO 35"*|*"AI 5 33"*) _sup_gfx_out="gfx1152" ;; # RDNA 3.5 (Krackan Point: Radeon 860M/840M, Ryzen AI 7 350 / AI 5 340) | ||
| *"RX 7600"*|*"RX 7700S"*|*"RX 7650"*|*"PRO W7600"*|*"PRO W7500"*) _sup_gfx_out="gfx1102" ;; # RDNA 3 (Navi 33) | ||
| *"890M"*|*"880M"*|*"Strix Point"*|*"HX 37"*|*"AI 9 HX"*|*"AI 9 36"*|*"Z2 Extreme"*) _sup_gfx_out="gfx1150" ;; # RDNA 3.5 (Strix Point: Radeon 890M/880M, Ryzen AI 9 HX 370/375) | ||
| *"860M"*|*"840M"*|*"Krackan"*|*"AI 7 35"*|*"AI 5 34"*|*"AI 7 PRO 35"*) _sup_gfx_out="gfx1152" ;; # RDNA 3.5 (Krackan Point: Radeon 860M/840M, Ryzen AI 7 350 / AI 5 340) |
There was a problem hiding this comment.
Update the Krackan peer regression with the name-table change
The existing Linux regression tests/studio/install/test_setup_sh_gfx1153_lspci_peer.py::test_marketing_name_block fails for its RX 7900 peer case after this removal: _setup_supported_gfx_from_name no longer matches AMD Ryzen AI 5 330 w/ Radeon 820M, leaving _setup_gfx empty rather than the test's expected gfx1152. The same case passes on the parent commit. .github/workflows/studio-backend-ci.yml includes this test in the studio-install shard (lines 354–356 and 526–536), so update the regression to reflect the intended corrected behavior alongside this table change; otherwise the installer CI remains failing.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 29b338c: the covered lspci peer now decides the arch (gfx1100 for the RX 7900 case), matching install_python_stack._linux_amd_gfx_from_lspci; the old gfx1152 expectation came from the wrong 'AI 5 33' row.
…oint 2 APU [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
Fixes #17874
What changed
On Windows, AMD's multi-arch index ships PyTorch GPU kernels per exact chip (
torch[device-gfxNNNN]; theamd-torch-device-gfx1030wheel carries onlytorch_gfx1030.kpack). When the installer can only read the GPU's marketing name (driver-only hosts, no HIP SDK), the name table decides which chip's kernels get installed. Since #11846 moved Windows RDNA onto that index, the table's coarse RDNA 2 grouping gave several cards kernels for a different chip, and a few other rows were wrong or missing.Every row was checked against AMD-maintained and upstream sources, not against the other copies of the table:
amdgpu.ids(maintained by AMD) and pci.idskfd_device.c, Mesaamd_family.c, TheRocktherock_amdgpu_targets.cmake, LLVM AMDGPUUsageWrong chip (fixed)
The RX 6750 GRE is one name on two dies (amdgpu.ids 73DF Navi 22 for 12GB, 73FF Navi 23 for 10GB). TheRock names gfx1153 "AMD Radeon 820M iGPU", and AMD ships a Windows gfx1153 device pack; Linux keeps its existing Krackan Point 2 handling (no Linux gfx1153 wheel), so the gfx1153 row is only in the Windows and Python copies.
Recognised now (previously CPU torch on driver-only hosts)
RX 7400, RX 7300, Radeon Pro W7400, Steam Machine (gfx1102); RX 9050 (gfx1200); Radeon AI PRO R9600D (gfx1201); Radeon 6550S (gfx1034); Radeon Pro V620 (gfx1030).
Deliberately left unmapped
Radeon 680M / 660M / 610M (RDNA 2 iGPUs) stay on CPU torch: ROCm training on RDNA 2 APUs is unmeasured and gfx1033 computes wrong answers (
studio/ROCM_RDNA2_APU.md); a test pins this. "Radeon 840M" ships on both Krackan (gfx1152) and Krackan 2 (gfx1153) per amdgpu.ids 1114 / 1902, so the name alone cannot tell them apart; it keeps gfx1152 and hipinfo still decides when present.All six copies change together (
install.ps1,studio/setup.ps1,studio/install_python_stack.py,studio/backend/utils/hardware/hardware.py,install.sh,studio/setup.sh). On Linux every moved arch still resolves to the same wheel family, and the Krackan Point 2 lspci / cpuinfo paths are unchanged.Validation
tests/studio/install/test_rocm_arch_table_parity.py: the sourced arches are now checked in every copy; the gfx1031 spoof exemption is removed; the RDNA 2 iGPUs are pinned unmapped.tests/studio/install/test_windows_amd_name_detection.py: a WMI name resolves to its owntorch[device-gfxNNNN]pack, gfx1153 included.tests/studio/test_amd_name_arch_r9700.ps1: the same names through PowerShell's own-match.