refactor(vk): add GPU architecture classifier (gpu_arch.h) and expose DeviceFacts::arch #2227

Open
madebyjordan wants to merge 3 commits from madebyjordan/Longshot:feat/gpu-arch into main
Member

Summary

Adds a centralized, Vulkan-free GPU architecture classifier (gpu/vk/gpu_arch.h) and exposes it on DeviceFacts in gpu/vk/device_policy.h so driver workarounds and hardware policy rules can be gated by GPU generation (e.g. RDNA 2 vs RDNA 3/4, Alchemist vs Battlemage) instead of vendor-wide or ad-hoc device-ID helpers.

What this changes:

  • Adds gpu/vk/gpu_arch.h with GpuArch (amd_gcn, amd_vega, amd_rdna1..amd_rdna4, intel_gen12, intel_alchemist, intel_meteor_arrow, intel_lunar, intel_battlemage, intel_panther, nvidia_pascal..nvidia_blackwell), gpu_arch_name(), classify_gpu_arch(), and is_rdna1..is_rdna4 helpers.
  • Moves is_rdna3 and is_rdna4 from gpu/vk/device_policy.h into gpu/vk/gpu_arch.h (no change to existing RDNA 3/4 classification) and adds DeviceFacts::arch(), arch_name(), rdna1()..rdna4(), and amd_win().
  • Logs (arch <name>) on the startup vk: policy: facts line so player logs immediately report the detected architecture.
  • Adds tests/test_gpu_arch.py covering AMD (including Steam Deck Van Gogh 0x163F, OLED Sephiroth 0x1435, GCN 1–4, and Vega 12), Intel (including DG1), and NVIDIA (including RTX 5070 0x2F04, GP108 vs Volta, and Hopper exclusions) device IDs and name fallbacks, updates tests/test_device_policy.py with end-to-end DeviceFacts::arch() / (arch <name>) log assertions, updates tests/test_mma_software.py to read is_rdna4 from gpu/vk/gpu_arch.h, and documents gpu_arch.h in docs/dev/reference/architecture.md.

No default policy value changes on any GPU.

Read first: gpu/vk/gpu_arch.h, then gpu/vk/device_policy.h (DeviceFacts).

Testing

Tested: Windows 11, AMD Radeon RX 6700 XT (1002:73df), AMD driver 26.10.1 (0x800161), headless in-game boot on castle-gate (HyruleField_Child): startup log prints vk: policy: facts 1002:73df (arch amd_rdna2), driver id 1, version 0x800161 (26.10.1 (AMD proprietary shader compiler)), type 2, Windows with all policy fields identical to main.

  • Game-free checks on 6d9b7c662 with both clang++ and g++: test_gpu_arch.py, test_device_policy.py, test_mma_software.py (with spirv-val), and test_doc_anchors.py all pass (plus earlier full sweep on e8915426; test_switch_table.py fails only on the pre-existing main sort order of RX_VK_GRASS_DISTANCE / RX_VK_SIM_TURF_ADAPTIVE, tracked in #2197).
  • dev.py vk builds longshot_vk.dll cleanly on Windows (llvm-mingw).

Still to test:

  • Linux build and in-game startup check: confirm GCC/Clang compilation of gpu_arch.h and that vk: policy: facts logs the expected (arch <name>) with unchanged policy fields (by hand — Beanstalk cannot validate GPU-specific arch values or diff policy fields against main).

Measurements

Nothing to measure: pure header-only architecture classification and one startup log token ((arch <name>)), with zero runtime behavior change on any GPU.

Risks

Minimal: classify_gpu_arch() is only logged on vk: policy: facts and existing is_rdna3/is_rdna4 rules are unchanged. A revert cleanly removes it. Nothing changes in saves, longshot_options.ini, or caches.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary Adds a centralized, Vulkan-free GPU architecture classifier ([`gpu/vk/gpu_arch.h`](gpu/vk/gpu_arch.h)) and exposes it on `DeviceFacts` in [`gpu/vk/device_policy.h`](gpu/vk/device_policy.h) so driver workarounds and hardware policy rules can be gated by GPU generation (e.g. RDNA 2 vs RDNA 3/4, Alchemist vs Battlemage) instead of vendor-wide or ad-hoc device-ID helpers. **What this changes:** - Adds `gpu/vk/gpu_arch.h` with `GpuArch` (`amd_gcn`, `amd_vega`, `amd_rdna1`..`amd_rdna4`, `intel_gen12`, `intel_alchemist`, `intel_meteor_arrow`, `intel_lunar`, `intel_battlemage`, `intel_panther`, `nvidia_pascal`..`nvidia_blackwell`), `gpu_arch_name()`, `classify_gpu_arch()`, and `is_rdna1`..`is_rdna4` helpers. - Moves `is_rdna3` and `is_rdna4` from `gpu/vk/device_policy.h` into `gpu/vk/gpu_arch.h` (no change to existing RDNA 3/4 classification) and adds `DeviceFacts::arch()`, `arch_name()`, `rdna1()`..`rdna4()`, and `amd_win()`. - Logs `(arch <name>)` on the startup `vk: policy: facts` line so player logs immediately report the detected architecture. - Adds `tests/test_gpu_arch.py` covering AMD (including Steam Deck Van Gogh `0x163F`, OLED Sephiroth `0x1435`, GCN 1–4, and Vega 12), Intel (including DG1), and NVIDIA (including RTX 5070 `0x2F04`, GP108 vs Volta, and Hopper exclusions) device IDs and name fallbacks, updates `tests/test_device_policy.py` with end-to-end `DeviceFacts::arch()` / `(arch <name>)` log assertions, updates `tests/test_mma_software.py` to read `is_rdna4` from `gpu/vk/gpu_arch.h`, and documents `gpu_arch.h` in `docs/dev/reference/architecture.md`. No default policy value changes on any GPU. Read first: `gpu/vk/gpu_arch.h`, then `gpu/vk/device_policy.h` (`DeviceFacts`). ## Testing **Tested:** Windows 11, AMD Radeon RX 6700 XT (`1002:73df`), AMD driver `26.10.1` (`0x800161`), headless in-game boot on `castle-gate` (`HyruleField_Child`): startup log prints `vk: policy: facts 1002:73df (arch amd_rdna2), driver id 1, version 0x800161 (26.10.1 (AMD proprietary shader compiler)), type 2, Windows` with all policy fields identical to `main`. - Game-free checks on `6d9b7c662` with both `clang++` and `g++`: `test_gpu_arch.py`, `test_device_policy.py`, `test_mma_software.py` (with `spirv-val`), and `test_doc_anchors.py` all pass (plus earlier full sweep on `e8915426`; `test_switch_table.py` fails only on the pre-existing `main` sort order of `RX_VK_GRASS_DISTANCE` / `RX_VK_SIM_TURF_ADAPTIVE`, tracked in #2197). - `dev.py vk` builds `longshot_vk.dll` cleanly on Windows (`llvm-mingw`). **Still to test:** - Linux build and in-game startup check: confirm GCC/Clang compilation of `gpu_arch.h` and that `vk: policy: facts` logs the expected `(arch <name>)` with unchanged policy fields (by hand — Beanstalk cannot validate GPU-specific arch values or diff policy fields against `main`). ## Measurements Nothing to measure: pure header-only architecture classification and one startup log token (`(arch <name>)`), with zero runtime behavior change on any GPU. ## Risks Minimal: `classify_gpu_arch()` is only logged on `vk: policy: facts` and existing `is_rdna3`/`is_rdna4` rules are unchanged. A revert cleanly removes it. Nothing changes in saves, `longshot_options.ini`, or caches. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
feat(vk): add GPU architecture classifier (gpu_arch.h) and expose DeviceFacts::arch
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
PR description / Description follows the template (pull_request_target) Successful in 15s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 19s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 19s
Third-party parts / As their notes say (pull_request) Successful in 22s
CI / Website build and checks (pull_request) Failing after 55s
e8915426f3
Centralize GPU architecture classification for AMD (GCN, Vega, RDNA 1-4),
Intel (Gen12, Alchemist, Meteor/Arrow Lake, Lunar Lake, Battlemage, Panther
Lake) and NVIDIA (Pascal-Blackwell) in gpu/vk/gpu_arch.h, wired into
DeviceFacts::arch() / arch_name() and logged on the vk: policy: facts line.

Moves is_rdna3 and is_rdna4 into gpu_arch.h alongside new is_rdna1 and
is_rdna2 helpers, with no behavior change on any GPU. Adds tests/test_gpu_arch.py
and updates tests/test_mma_software.py to read is_rdna4 from gpu_arch.h.

Assisted-by: Antigravity
Author
Member

Tested in game: Windows 11, AMD Radeon RX 6700 XT (1002:73df), AMD driver 26.10.1 (0x800161), headless castle-gate (HyruleField_Child): startup log prints 'vk: policy: facts 1002:73df (arch amd_rdna2)' with all policy fields identical to main.

Tested in game: Windows 11, AMD Radeon RX 6700 XT (1002:73df), AMD driver 26.10.1 (0x800161), headless castle-gate (HyruleField_Child): startup log prints 'vk: policy: facts 1002:73df (arch amd_rdna2)' with all policy fields identical to main.
Member

Possibly related, for context:

  • PR #1839 fix(vk): recognize RDNA 4 GPUs by PCI device ID — Merged predecessor: centralized RDNA 4 identification, now generalized into architecture classifier
  • PR #1590 perf(vk): try unrolled software MMA on AMD RDNA 4 Windows LLPC — Merged policy work introducing RDNA 4 detection that this refactor relocates
Possibly related, for context: - PR #1839 fix(vk): recognize RDNA 4 GPUs by PCI device ID — Merged predecessor: centralized RDNA 4 identification, now generalized into architecture classifier - PR #1590 perf(vk): try unrolled software MMA on AMD RDNA 4 Windows LLPC — Merged policy work introducing RDNA 4 detection that this refactor relocates
madebyjordan force-pushed feat/gpu-arch from e8915426f3
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
PR description / Description follows the template (pull_request_target) Successful in 15s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 19s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 19s
Third-party parts / As their notes say (pull_request) Successful in 22s
CI / Website build and checks (pull_request) Failing after 55s
to 218a728d93
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 11s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 19s
CI / Workflow lint (actionlint) (pull_request) Successful in 20s
Third-party parts / As their notes say (pull_request) Successful in 23s
PR description / Description follows the template (pull_request_target) Failing after 6s
CI / Website build and checks (pull_request) Failing after 3m47s
2026-11-22 09:03:55 +00:00
Compare
dazemc left a comment

The classifier's AMD GCN coverage is incomplete, and the uncatalogued fallback is only RADV's hint; on AMD's Windows driver many GCN IDs become Unknown.

The enum/docs claim GCN 1–4 (HD 7000/8000, R9 200/300, RX 400/500), but classify_gpu_arch() maps only 0x67DF/67EF/67FF/699F/7300. 0x6798 (HD 7970), 0x6818/683D (Pitcairn/Cape Verde), 0x6650 (Bonaire) and 0x67A0/67B0 (Hawaii) are not mapped; the only uncatalogued GCN in the test (0x6798) passes radv_gcn=true, which DeviceFacts gets only on RADV (!storage_io16). An AMD proprietary GCN — the platform #2228 targets — is Unknown, not AmdGcn. That is a safe no-rule fallback, but it means a future arch()==AmdGcn gate will not fire; add a real GCN Windows case with radv_gcn=false and either map the family or state GCN is RADV-only.

Also missing/misclassified: Vega 12 (0x69A0–0x69AF) is not in the Vega ranges; Intel DG1 (0x4900) is not IntelGen12; NVIDIA Volta (0x1DB4 and the 0x1Dxx range) falls in the Pascal range and is classified Pascal — a wrong family, not Unknown. These are future-rule gaps; current rules do not use them.

Use sites do not change behaviour. rdna3()/rdna4() still resolve through the same is_rdna3/is_rdna4 logic; p.batch_submits, p.mma_unroll_try, p.rdna4 and auto_profile's direct is_rdna4 call are unchanged; (arch …) is a startup log token; amd_win()/rdna1()/rdna2() are new. test_device_policy and test_mma_software pass, so this is a refactor plus log, not a policy change.

Test: test_gpu_arch.py is new and fails on main because gpu_arch.h does not exist there; it covers representative AMD/Intel/NVIDIA IDs, helper parity, cross-vendor isolation and unknown. It does not cover a proprietary GCN, Vega 12, DG1 or Volta, and it does not build a DeviceFacts end-to-end — only source strings for arch()/the log. Add those cases if the classifier is meant to be exhaustive.

Not already solved on main: main has is_rdna3/is_rdna4 in device_policy.h and #1839 only recognizes RDNA 4 by ID; there is no gpu_arch.h or GpuArch, so this is new.

No approval, no fix claim; the refactor is quiet on today's rules, and the gaps are about the breadth of the new classifier.

**The classifier's AMD GCN coverage is incomplete, and the uncatalogued fallback is only RADV's hint; on AMD's Windows driver many GCN IDs become `Unknown`.** The enum/docs claim GCN 1–4 (HD 7000/8000, R9 200/300, RX 400/500), but `classify_gpu_arch()` maps only `0x67DF/67EF/67FF/699F/7300`. `0x6798` (HD 7970), `0x6818/683D` (Pitcairn/Cape Verde), `0x6650` (Bonaire) and `0x67A0/67B0` (Hawaii) are not mapped; the only uncatalogued GCN in the test (`0x6798`) passes `radv_gcn=true`, which `DeviceFacts` gets only on RADV (`!storage_io16`). An AMD proprietary GCN — the platform #2228 targets — is `Unknown`, not `AmdGcn`. That is a safe no-rule fallback, but it means a future `arch()==AmdGcn` gate will not fire; add a real GCN Windows case with `radv_gcn=false` and either map the family or state GCN is RADV-only. Also missing/misclassified: **Vega 12** (`0x69A0–0x69AF`) is not in the Vega ranges; **Intel DG1** (`0x4900`) is not `IntelGen12`; **NVIDIA Volta** (`0x1DB4` and the `0x1Dxx` range) falls in the Pascal range and is classified Pascal — a wrong family, not `Unknown`. These are future-rule gaps; current rules do not use them. **Use sites do not change behaviour.** `rdna3()`/`rdna4()` still resolve through the same `is_rdna3`/`is_rdna4` logic; `p.batch_submits`, `p.mma_unroll_try`, `p.rdna4` and `auto_profile`'s direct `is_rdna4` call are unchanged; `(arch …)` is a startup log token; `amd_win()`/`rdna1()`/`rdna2()` are new. `test_device_policy` and `test_mma_software` pass, so this is a refactor plus log, not a policy change. **Test:** `test_gpu_arch.py` is new and fails on main because `gpu_arch.h` does not exist there; it covers representative AMD/Intel/NVIDIA IDs, helper parity, cross-vendor isolation and unknown. It does **not** cover a proprietary GCN, Vega 12, DG1 or Volta, and it does not build a `DeviceFacts` end-to-end — only source strings for `arch()`/the log. Add those cases if the classifier is meant to be exhaustive. **Not already solved on main:** main has `is_rdna3`/`is_rdna4` in `device_policy.h` and #1839 only recognizes RDNA 4 by ID; there is no `gpu_arch.h` or `GpuArch`, so this is new. No approval, no fix claim; the refactor is quiet on today's rules, and the gaps are about the breadth of the new classifier.
fix(vk): expand AMD GCN/Vega 12 and Intel DG1 coverage and exclude Volta/Hopper
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Failing after 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
CI / Workflow lint (actionlint) (pull_request) Successful in 11s
Third-party parts / As their notes say (pull_request) Successful in 12s
CI / Website build and checks (pull_request) Failing after 35s
5d80be2c2b
Address review feedback on gpu_arch.h classification and test coverage:
- Map AMD GCN 1-4 discrete PCI ID ranges (Oland/Bonaire/Hainan, Tahiti/Hawaii, Pitcairn/Cape Verde, Topaz/Tonga, Polaris 10/11/12/22 including 0x6FDF, Fiji) so proprietary Windows GCN GPUs classify as AmdGcn without relying on RADV's storage_io16 hint, while keeping TeraScale excluded.
- Add AMD Vega 12 (0x69A0-0x69AF) to AmdVega and Intel DG1 (0x4900) to IntelGen12.
- Restrict NVIDIA Pascal 0x1Dxx to GP108 (0x1D00-0x1D7F) so Volta GV100 (0x1D80-0x1DFF) returns Unknown, and restrict Ampere to 0x22xx/0x24xx/0x25xx so Hopper GH100 (0x23xx) returns Unknown.
- Add unit tests for all new/excluded families and end-to-end DeviceFacts::arch() / (arch <name>) log assertions in tests/test_device_policy.py.

Assisted-by: Antigravity
Author
Member

Thanks for the thorough review, @dazemc — all of those gaps are addressed in 5d80be2c2:

  • AMD GCN 1–4 without radv_gcn_hint: Mapped the GCN 1–4 discrete PCI ID ranges in gpu/vk/gpu_arch.h (0x6600–0x667F Oland/Bonaire/Hainan, 0x6780–0x67FF Tahiti/Hawaii/Polaris 10–11, 0x6800–0x683F Pitcairn/Cape Verde, 0x6900–0x693F Topaz/Tonga, 0x694C–0x694F Polaris 22/Vega M, 0x6980–0x699F Polaris 12, 0x6FDF RX 580 2048SP / 590 GME, 0x7300 Fiji) so AMD Windows proprietary GCN classifies as AmdGcn directly, while excluding TeraScale (0x6700–0x677F, 0x6840–0x685F, 0x6880–0x68FF) and keeping radv_gcn_hint as the RADV fallback for uncatalogued GCN APUs.
  • AMD Vega 12 & Intel DG1: Added 0x69A0–0x69AF to AmdVega (with GCN PCI IDs checked before the "Vega" name fallback so GFX8 Vega M 0x694C–0x694F stays AmdGcn) and 0x4900 to IntelGen12.
  • NVIDIA Volta & Hopper exclusions: Split 0x1Dxx at 0x1D7F so Pascal GP108 (0x1D00–0x1D7F, e.g. GT 1030 / MX150) remains NvidiaPascal while Volta GV100 (0x1D80–0x1DFF, e.g. TITAN V 0x1D81, V100 0x1DB4) returns Unknown. Also narrowed NvidiaAmpere to 0x22xx/0x24xx/0x25xx so Hopper GH100 (0x23xx, e.g. H100 0x2330) returns Unknown rather than NvidiaAmpere.
  • Tests: Added unit cases in tests/test_gpu_arch.py for all of the above (including Windows GCN with radv_gcn=false, TeraScale exclusion, Vega 12 by ID with null name, DG1, Pascal GP108 vs Volta, and Hopper) and end-to-end DeviceFacts::arch() / amd_win() / (arch <name>) log assertions in tests/test_device_policy.py.

Re-verified on 5d80be2c2: test_gpu_arch.py (clang++ & g++), test_device_policy.py (clang++ & g++), test_mma_software.py (with spirv-val), and test_doc_anchors.py all pass.

Thanks for the thorough review, @dazemc — all of those gaps are addressed in `5d80be2c2`: - **AMD GCN 1–4 without `radv_gcn_hint`:** Mapped the GCN 1–4 discrete PCI ID ranges in `gpu/vk/gpu_arch.h` (`0x6600–0x667F` Oland/Bonaire/Hainan, `0x6780–0x67FF` Tahiti/Hawaii/Polaris 10–11, `0x6800–0x683F` Pitcairn/Cape Verde, `0x6900–0x693F` Topaz/Tonga, `0x694C–0x694F` Polaris 22/Vega M, `0x6980–0x699F` Polaris 12, `0x6FDF` RX 580 2048SP / 590 GME, `0x7300` Fiji) so AMD Windows proprietary GCN classifies as `AmdGcn` directly, while excluding TeraScale (`0x6700–0x677F`, `0x6840–0x685F`, `0x6880–0x68FF`) and keeping `radv_gcn_hint` as the RADV fallback for uncatalogued GCN APUs. - **AMD Vega 12 & Intel DG1:** Added `0x69A0–0x69AF` to `AmdVega` (with GCN PCI IDs checked before the `"Vega"` name fallback so GFX8 Vega M `0x694C–0x694F` stays `AmdGcn`) and `0x4900` to `IntelGen12`. - **NVIDIA Volta & Hopper exclusions:** Split `0x1Dxx` at `0x1D7F` so Pascal GP108 (`0x1D00–0x1D7F`, e.g. GT 1030 / MX150) remains `NvidiaPascal` while Volta GV100 (`0x1D80–0x1DFF`, e.g. TITAN V `0x1D81`, V100 `0x1DB4`) returns `Unknown`. Also narrowed `NvidiaAmpere` to `0x22xx`/`0x24xx`/`0x25xx` so Hopper GH100 (`0x23xx`, e.g. H100 `0x2330`) returns `Unknown` rather than `NvidiaAmpere`. - **Tests:** Added unit cases in `tests/test_gpu_arch.py` for all of the above (including Windows GCN with `radv_gcn=false`, TeraScale exclusion, Vega 12 by ID with null name, DG1, Pascal GP108 vs Volta, and Hopper) and end-to-end `DeviceFacts::arch()` / `amd_win()` / `(arch <name>)` log assertions in `tests/test_device_policy.py`. Re-verified on `5d80be2c2`: `test_gpu_arch.py` (`clang++` & `g++`), `test_device_policy.py` (`clang++` & `g++`), `test_mma_software.py` (with `spirv-val`), and `test_doc_anchors.py` all pass.
Author
Member
@review
BeanBot requested changes 2026-11-22 10:22:21 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The classifier can report a GCN GPU as RDNA 2 because a broad name match takes precedence over its known PCI ID. That makes the startup log misleading and makes the new architecture API unsafe for generation-specific rules.

The change centralizes GPU architecture detection and adds it to the startup policy log. Existing RDNA 3 and RDNA 4 policy predicates retain their prior behavior, but the new classifier needs more precise precedence for known devices.

@fix will do (4)

  1. L1 gpu/vk/gpu_arch.h:115: The "RX 6" fallback runs before the GCN PCI ID ranges, so a Polaris Radeon RX 640, for example, is classified as RDNA 2 even when its known GCN device ID is supplied. (more on the line)
  2. L3: The check PR description / Description follows the template (pull_request_target) fails on this head and passes on the base branch: Failing after 9s.
  3. L4: The check Guide screenshots / Guide images and local UI source review (pull_request) fails on this head and passes on the base branch: Failing after 10s.
  4. L5: The check CI / Website build and checks (pull_request) fails on this head and passes on the base branch: Failing after 35s.

Before merging: testing (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 (minor): A Linux in-game run remains outstanding. Check startup and the reported architecture on a supported Linux GPU, and record the result alongside the Windows run.
More: does it help, other systems, switches, what was read

Does it help: Unproven as a classifier across supported hardware. The supplied Windows RX 6700 XT run reports RDNA 2 and unchanged policy fields; the supplied game-free tests cover representative IDs. This is not a performance change.

Other systems: The existing RDNA 4 policy fields, auto profile and cooperative-matrix paths continue to use the same RDNA 3/4 predicates. The new classification also appears in logs on Linux, Windows, Steam Deck, NVIDIA and Intel systems; the supplied in-game run covers one Windows AMD GPU.

Switches: None added, changed or removed.

Reviewed: 5d80be2c2b against a2dc538590: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the full new classifier and test, the changed portions and relevant surrounding code in device_policy.h and the two existing tests, their callers, the diff and both commit messages. Skimmed the architecture reference and test runner. docs/review-checklist.md and the adjacent Tooling AGENTS.md were unavailable. No generated files or recorded runs were changed.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The diff contains no game-derived files, generated shaders, third-party changes or renderer API version changes.
  • The RDNA 3 and RDNA 4 helper implementations are unchanged, and their existing policy uses retain equivalent results.
  • The new classifier test accepts the test runner's compiler selection and does not read runtime switches.

Testing: No commands that build or run code were executed, as requested. The supplied reports describe Windows in-game testing and game-free checks; Linux in-game testing remains outstanding. Three head-only CI failures are supplied separately and are not restated.

Overlaps and merge order: Not determined; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by madebyjordan. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The classifier can report a GCN GPU as RDNA 2 because a broad name match takes precedence over its known PCI ID. That makes the startup log misleading and makes the new architecture API unsafe for generation-specific rules. The change centralizes GPU architecture detection and adds it to the startup policy log. Existing RDNA 3 and RDNA 4 policy predicates retain their prior behavior, but the new classifier needs more precise precedence for known devices. **`@fix` will do (4)** 1. **L1** `gpu/vk/gpu_arch.h:115`: The "RX 6" fallback runs before the GCN PCI ID ranges, so a Polaris Radeon RX 640, for example, is classified as RDNA 2 even when its known GCN device ID is supplied. (more on the line) 2. **L3**: The check `PR description / Description follows the template (pull_request_target)` fails on this head and passes on the base branch: Failing after 9s. 3. **L4**: The check `Guide screenshots / Guide images and local UI source review (pull_request)` fails on this head and passes on the base branch: Failing after 10s. 4. **L5**: The check `CI / Website build and checks (pull_request)` fails on this head and passes on the base branch: Failing after 35s. **Before merging: testing (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** (minor): A Linux in-game run remains outstanding. Check startup and the reported architecture on a supported Linux GPU, and record the result alongside the Windows run. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven as a classifier across supported hardware. The supplied Windows RX 6700 XT run reports RDNA 2 and unchanged policy fields; the supplied game-free tests cover representative IDs. This is not a performance change. **Other systems:** The existing RDNA 4 policy fields, auto profile and cooperative-matrix paths continue to use the same RDNA 3/4 predicates. The new classification also appears in logs on Linux, Windows, Steam Deck, NVIDIA and Intel systems; the supplied in-game run covers one Windows AMD GPU. **Switches:** None added, changed or removed. **Reviewed:** 5d80be2c2b45 against a2dc53859018: Read AGENTS.md, CONTRIBUTING.md, the PR template, standards, the full new classifier and test, the changed portions and relevant surrounding code in device_policy.h and the two existing tests, their callers, the diff and both commit messages. Skimmed the architecture reference and test runner. docs/review-checklist.md and the adjacent Tooling AGENTS.md were unavailable. No generated files or recorded runs were changed.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The diff contains no game-derived files, generated shaders, third-party changes or renderer API version changes. - The RDNA 3 and RDNA 4 helper implementations are unchanged, and their existing policy uses retain equivalent results. - The new classifier test accepts the test runner's compiler selection and does not read runtime switches. **Testing:** No commands that build or run code were executed, as requested. The supplied reports describe Windows in-game testing and game-free checks; Linux in-game testing remains outstanding. Three head-only CI failures are supplied separately and are not restated. **Overlaps and merge order:** Not determined; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by madebyjordan. Nothing was run; a maintainer decides.</sub>
@ -0,0 +112,4 @@
default:
break;
}
return device_name && (std::strstr(device_name, "GFX103") || std::strstr(device_name, "NAVI2") ||
Member

L1: The "RX 6" fallback runs before the GCN PCI ID ranges, so a Polaris Radeon RX 640, for example, is classified as RDNA 2 even when its known GCN device ID is supplied. This produces an incorrect log and could enable an incompatible future RDNA 2 rule. Resolve known PCI IDs before name fallbacks, and add a test using an RX 640 name and its GCN ID.

**L1**: The "RX 6" fallback runs before the GCN PCI ID ranges, so a Polaris Radeon RX 640, for example, is classified as RDNA 2 even when its known GCN device ID is supplied. This produces an incorrect log and could enable an incompatible future RDNA 2 rule. Resolve known PCI IDs before name fallbacks, and add a test using an RX 640 name and its GCN ID.
fix(vk): resolve known AMD PCI IDs before name fallbacks and tighten RX 6xxx match
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Failing after 42s
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Description follows the template (pull_request_target) Successful in 6s
6d9b7c6621
Resolve all catalogued AMD PCI device IDs (RDNA 4/3/2/1, Vega, GCN 1-4)
via classify_amd_pci_id() before any device-name substring fallback, and
require 4-digit RX 6NNN names in the RDNA 2 name fallback so 3-digit Polaris
OEM cards like Radeon RX 640 (0x6987/0x699F) cannot match RDNA 2.

Keep is_rdna4() self-contained for tests/test_mma_software.py, route
is_rdna1..3() through classify_gpu_arch() for consistent ID-first precedence,
and add RX 640 regression tests (both with GCN PCI IDs and by name alone).

Assisted-by: Antigravity
Author
Member

Addressed BeanBot's review findings in 6d9b7c662 and updated the PR description:

  • L1 (fixed in 6d9b7c662): Good catch on Polaris Radeon RX 640 (0x6987 / 0x699F). classify_gpu_arch() now resolves all catalogued AMD PCI device IDs via classify_amd_pci_id() before any device-name fallback, is_rdna1..3() delegate to classify_gpu_arch() for consistent ID-first precedence (while keeping is_rdna4() self-contained for tests/test_mma_software.py), and the RDNA 2 name fallback now requires a 4-digit RX 6NNN model number (has_rx_4digit_series) so 3-digit RX 640 cannot match RDNA 2 even by name alone. Added RX 640 regression tests in tests/test_gpu_arch.py.
  • L3 (fixed in PR description): Removed the unticked Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. line from When it applies (Linux build/run remains tracked under Still to test); scripts/check_pr_description.py now passes on #2227.
  • L4 (Guide screenshots) & L5 (CI / Website build and checks): Both are pre-existing failures on the base branch main (a2dc53859018: runs 48672/jobs/0 and 48671/jobs/5), not regressions from this PR (scripts/check_guide_screenshots.py --review-sources reports 10 pre-existing UI hash drifts on settings-graphics.png; test_guide_screenshots.py and test_launcher_capture.py pass).

Re-verified on 6d9b7c662: test_gpu_arch.py (clang++ & g++), test_device_policy.py (clang++ & g++), test_mma_software.py (with spirv-val), test_doc_anchors.py, and scripts/check_pr_description.py all pass.

Addressed BeanBot's review findings in `6d9b7c662` and updated the PR description: - **L1 (fixed in `6d9b7c662`):** Good catch on Polaris Radeon RX 640 (`0x6987` / `0x699F`). `classify_gpu_arch()` now resolves all catalogued AMD PCI device IDs via `classify_amd_pci_id()` before any device-name fallback, `is_rdna1..3()` delegate to `classify_gpu_arch()` for consistent ID-first precedence (while keeping `is_rdna4()` self-contained for `tests/test_mma_software.py`), and the RDNA 2 name fallback now requires a 4-digit `RX 6NNN` model number (`has_rx_4digit_series`) so 3-digit `RX 640` cannot match RDNA 2 even by name alone. Added RX 640 regression tests in `tests/test_gpu_arch.py`. - **L3 (fixed in PR description):** Removed the unticked `Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.` line from `When it applies` (Linux build/run remains tracked under `Still to test`); `scripts/check_pr_description.py` now passes on #2227. - **L4 (`Guide screenshots`) & L5 (`CI / Website build and checks`):** Both are pre-existing failures on the base branch `main` (`a2dc53859018`: runs `48672/jobs/0` and `48671/jobs/5`), not regressions from this PR (`scripts/check_guide_screenshots.py --review-sources` reports 10 pre-existing UI hash drifts on `settings-graphics.png`; `test_guide_screenshots.py` and `test_launcher_capture.py` pass). Re-verified on `6d9b7c662`: `test_gpu_arch.py` (`clang++` & `g++`), `test_device_policy.py` (`clang++` & `g++`), `test_mma_software.py` (with `spirv-val`), `test_doc_anchors.py`, and `scripts/check_pr_description.py` all pass.
Author
Member
@review
BeanBot left a comment

Recommendation: Request changes. The RX 640 classification is fixed, and the Windows run reports the expected architecture. A Linux in-game startup check remains outstanding. (It stands on L4: The check Guide screenshots / Guide images and local UI source review (pull_request) fails on this head and passes on the base branch: Failing after 10s.)

The change centralizes GPU architecture classification and adds the detected architecture to the startup log. Known AMD PCI IDs now take precedence over name fallbacks, at the cost of maintaining the classification table.

@fix will do (2)

  1. L4: The check Guide screenshots / Guide images and local UI source review (pull_request) fails on this head and passes on the base branch: Failing after 10s.
  2. L5: The check CI / Website build and checks (pull_request) fails on this head and passes on the base branch: Failing after 35s.

Before merging: testing (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 (minor): A Linux in-game run remains outstanding. Check startup and the reported architecture on a supported Linux GPU, and record the result alongside the Windows run.

Since the last review (on 5d80be2c2b)
Resolved: L1 (The "RX 6" fallback runs before the GCN PCI ID ranges, so a Polaris Radeon RX 640, for exa…); L3 (The check PR description / Description follows the template (pull_request_target) fails…)
Still open: L2 (A Linux in-game run remains outstanding. Check startup and the reported architecture on a…); L4 (The check Guide screenshots / Guide images and local UI source review (pull_request) fai…); L5 (The check CI / Website build and checks (pull_request) fails on this head and passes on…)

Also noticed (1; not asked for, not blocking)
  • The standalone is_rdna4 helper still uses name matching before considering other known AMD IDs, so it can disagree with DeviceFacts::rdna4 for a conflicting ID and name.
More: does it help, other systems, switches, what was read

Does it help: Unproven: the reported Windows RX 6700 XT run showed the expected RDNA 2 log and unchanged policy fields; the Linux integration has not yet been run in game. This is not a performance change.

Other systems: The classifier covers AMD, Intel and NVIDIA; the recorded in-game evidence is Windows on AMD only. RDNA 4 classification also feeds policy and other renderer paths; Linux startup remains unverified.

Switches: None.

Reviewed: 6d9b7c6621 against a2dc538590: Read AGENTS.md, CONTRIBUTING.md, the pull request template, gpu/vk/gpu_arch.h and tests/test_gpu_arch.py; reviewed the diff and searched RDNA helper callers. The other changed files and surrounding callers were skimmed, not read in full. No review-checklist.md was found.; nothing run (a code review).

Checked and fine:

  • The RX 640 name-only fallback no longer matches RDNA 2.
  • The author reports both head CI failures also occur on the base.

Testing: No commands that build or run the project were executed. The author reports game-free checks with clang++ and g++, a Windows build, and a Windows in-game startup; Linux in-game testing remains outstanding.

Overlaps and merge order: none found


Automated code review by BeanBot (gpt-6.1-terra), asked for by madebyjordan. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The RX 640 classification is fixed, and the Windows run reports the expected architecture. A Linux in-game startup check remains outstanding. (It stands on L4: The check `Guide screenshots / Guide images and local UI source review (pull_request)` fails on this head and passes on the base branch: Failing after 10s.) The change centralizes GPU architecture classification and adds the detected architecture to the startup log. Known AMD PCI IDs now take precedence over name fallbacks, at the cost of maintaining the classification table. **`@fix` will do (2)** 1. **L4**: The check `Guide screenshots / Guide images and local UI source review (pull_request)` fails on this head and passes on the base branch: Failing after 10s. 2. **L5**: The check `CI / Website build and checks (pull_request)` fails on this head and passes on the base branch: Failing after 35s. **Before merging: testing (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** (minor): A Linux in-game run remains outstanding. Check startup and the reported architecture on a supported Linux GPU, and record the result alongside the Windows run. **Since the last review** (on 5d80be2c2b45) Resolved: L1 (The "RX 6" fallback runs before the GCN PCI ID ranges, so a Polaris Radeon RX 640, for exa…); L3 (The check `PR description / Description follows the template (pull_request_target)` fails…) Still open: L2 (A Linux in-game run remains outstanding. Check startup and the reported architecture on a…); L4 (The check `Guide screenshots / Guide images and local UI source review (pull_request)` fai…); L5 (The check `CI / Website build and checks (pull_request)` fails on this head and passes on…) <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The standalone is_rdna4 helper still uses name matching before considering other known AMD IDs, so it can disagree with DeviceFacts::rdna4 for a conflicting ID and name. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported Windows RX 6700 XT run showed the expected RDNA 2 log and unchanged policy fields; the Linux integration has not yet been run in game. This is not a performance change. **Other systems:** The classifier covers AMD, Intel and NVIDIA; the recorded in-game evidence is Windows on AMD only. RDNA 4 classification also feeds policy and other renderer paths; Linux startup remains unverified. **Switches:** None. **Reviewed:** 6d9b7c6621d3 against a2dc53859018: Read AGENTS.md, CONTRIBUTING.md, the pull request template, gpu/vk/gpu_arch.h and tests/test_gpu_arch.py; reviewed the diff and searched RDNA helper callers. The other changed files and surrounding callers were skimmed, not read in full. No review-checklist.md was found.; nothing run (a code review). **Checked and fine:** - The RX 640 name-only fallback no longer matches RDNA 2. - The author reports both head CI failures also occur on the base. **Testing:** No commands that build or run the project were executed. The author reports game-free checks with clang++ and g++, a Windows build, and a Windows in-game startup; Linux in-game testing remains outstanding. **Overlaps and merge order:** none found </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by madebyjordan. Nothing was run; a maintainer decides.</sub>
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Failing after 42s
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Description follows the template (pull_request_target) Successful in 6s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/gpu-arch:madebyjordan-feat/gpu-arch'
git switch 'madebyjordan-feat/gpu-arch'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2227
No description provided.