fix(vk): recognize RDNA 4 GPUs by PCI device ID #1839

Merged
HumanBean merged 4 commits from gmourao/Longshot:fix/vk-rdna4-pci-id into main 2026-11-20 22:56:10 +00:00
Contributor

Summary

The renderer told an AMD RDNA 4 card only by its name ("RX 9" or "GFX12"), in three copies that could drift apart: DeviceFacts::rdna4(), is_rdna4() in vk_internal.h, and the check in auto_profile(). A card with another name, such as the Radeon AI PRO R9700, was not taken for RDNA 4. These are the follow-up suggestions from the #1590 review.

This PR:

  • Keeps one definition. is_rdna4(vendor_id, device_id, device_name) in gpu/vk/device_policy.h is used by DeviceFacts::rdna4(), choose_software_form() (vk_coopmat.cpp) and auto_profile() (vk_main.cpp). The copy in vk_internal.h is removed.
  • Checks the PCI device ID first. AMD (0x1002) 0x7550 (Navi 48: RX 9070 / XT / GRE), 0x7551 (Navi 48: Radeon AI PRO R9700 / R9700S / R9600D) and 0x7590 (Navi 44: RX 9050 / 9060 / 9060 XT). The name match stays as the fallback for cards not in the list.
  • Fixes the driver wording. VK_DRIVER_ID_AMD_PROPRIETARY is also what AMDGPU-PRO reports on Linux. The code has no _WIN32 check, and this PR does not add one. So the comments and the looped-path log line say "AMD's proprietary driver" instead of "AMD's Windows driver". The RX_VK_MMA_UNROLL row in switches.def now lists the default as "on for Mesa RADV and AMD RDNA 4 on AMD's proprietary driver" (before, it said only "on for Mesa RADV"). In auto_settings.h, the comment reads "an AMD RDNA 4 card, an RX 9000 or Radeon AI PRO: FSR 4". The player guide says "an AMD RDNA 4 card (RX 9000)".

How to see it on main: take an AMD RDNA 4 card whose deviceName has neither "RX 9" nor "GFX12", for example AMD Radeon AI PRO R9700 (1002:7551). On every driver, the device policy log block shows rdna4=0. On AMD's proprietary driver it also shows mma_unroll_try=0. RADV already tries the unrolled form, whatever the name. tests/test_device_policy.py with this PR's two R9700 rows fails on main for exactly those two fields (see Measurements).

Read first: is_rdna4() and DeviceFacts::rdna4() in gpu/vk/device_policy.h, choose_software_form() in gpu/vk/vk_coopmat.cpp, auto_profile() in gpu/vk/vk_main.cpp. See #1590.

Testing

Tested:

  • In the game, Windows 11, AMD Radeon RX 9060 XT (1002:7590), AMD driver 26.11.2 (LLPC), driver id 1: I built the renderer from this PR's commit with python -I scripts/dev.py vk: 246 files, 0 failed, symbols checked. I put that longshot_vk.dll into a copy of nightly-596-2692a6e3; the log reads longshot nightly-596-2692a6e3 (source 14be9eeb), the host's revision. It ran with its own empty caches and options. Both runs went through the job queue (dev.py queue run rdna4-pci-smoke --mode shared), with scripts/longshot_ctl.py booting kokiri-start to play. Each run then stayed in Kokiri Forest (KokiriForest_Child) for 70 s with the game's own upscaler at 100%, and I read its status every 10 s. This build has no FSR 4.

    • default: rdna4=1, mma_unroll_try=1, and the full line vk: software matrix multiplies unrolled, f16 rounding by conversion, A through quad broadcasts: the loop's words for 8192 lanes (RX_VK_MMA_UNROLL=0: looped). Frames 6642 → 10407, 50 to 60 fps, never stalled.
    • RX_VK_MMA_UNROLL=0: rdna4=1, mma_unroll_try=1, and vk: software matrix multiplies looped (RX_VK_MMA_UNROLL=0). Frames 6547 → 10694, 60 fps, never stalled.
    • Both runs: no VK_ERROR or device lost in the log.

    This card's name already matches "RX 9", so the run checks that nothing changed for it. The ID-only path is covered by the tests below.

  • Checks on Windows (clang++, Vulkan-Headers 1.4.345):

    • tests/test_device_policy.py: 21 PCs, 69 fields, 64 environments, 55 rule edges: ok. With main's device_policy.h it fails on the two new R9700 rows (rdna4, mma_unroll_try).
    • tests/test_mma_software.py: switch() (12 is_rdna4 cases: ID-only names, name fallback, null name, other AMD generations, NVIDIA with an RDNA 4 ID or an "RX 9" name), inputs() and the emitter/stamp wiring: pass, run on its own (python -I -B tests/test_mma_software.py --cxx clang++ --headers <SPIRV-Headers>). spirv() stops there because this PC has no spirv-val. The run below skips this whole file for the same reason. The auto_profile() check now ignores comments; I confirmed it fails when the assignment is commented out with // or /* */.
    • tests/test_auto_settings.py, tests/test_switch_table.py (712 switches), tests/test_doc_anchors.py, tests/test_vendor_fixes.py (16 devices): pass.
    • python -I -B tests/run_all.py --changed origin/main (the 117 checks that read a changed file) on Windows: 97 passed, 16 failed, 9 skipped here. As a narrower comparison, I ran the same list's tests/ checks on main @ 068fb8eb, same PC: 93 passed, 16 failed. The same 16 checks fail on both, so none is new with this PR. One of them, test_direct_buffer_writes, only hit its 60 s compile timeout because both runs were going at once; run alone, it passes on both (6.6 s here). I did not find the cause of every one of the other 15. Two examples: test_auto_handheld uses POSIX setenv / unsetenv, and several report compile errors in their own fixtures against main's current names. They are: test_appimage_player_build, test_auto_handheld, test_crash_dialog, test_crt_options, test_dev_ab, test_frame_overlap, test_fsr_uniform_ownership, test_hud_layout_row, test_linux_pressure, test_prepare_cache_save, test_present_queue_default, test_present_thread, test_replay_write_order, test_vk_occlusion_queries, test_walk_key. The 9 skips need spirv-val or Linux.
    • Lint: pre-commit (4.2.0, this repo's config) on the changed files: end-of-file, trailing-whitespace and gitleaks pass. The ruff hook stopped on a duplicate --force-exclude from the hook wrapper, so I ran ruff 0.12.0 directly with --force-exclude on the two changed Python files: all checks passed. actionlint was not run (no workflow changed). git diff --check: clean.
    • Not run: the full mise run test and mise run lint. This PC is Windows without mise, and much of the suite needs Linux tools. This PR is open as WIP so CI can run them; a maintainer's OK to rely on CI for them is welcome, and I'll tick the boxes once CI passes.

Still to test:

  • Linux, any GPU: the full mise run test, including tests/test_mma_software.py spirv() with spirv-val, and the host build with clang/gcc, expecting no new failures (CI, or @Beanstalk Linux build and full test suite).
  • An RDNA 4 card reported by ID without "RX 9" / "GFX12" in its name (Radeon AI PRO R9700 on AMD's Windows driver or AMDGPU-PRO, or RADV): check the log for rdna4=1 and the selected MMA form. Record the PCI ID, deviceName and Vulkan driver ID; on AMDGPU-PRO, check which ICD was loaded. Then, in a build with FSR 4 and a working FSR 4 runtime, with fresh options, record what Auto chooses and which upscaler is actually active (by hand, whoever has one).
  • RX 9070 XT, Linux RADV: boot to play and check rdna4=1 with the same MMA form as on main (@Beanstalk).

Measurements

Verdict: fixed. The two R9700 rows fail on main and pass here. Nothing changes on cards whose name already matched. This is not a perf change: the default for the unrolled software MMA on RDNA 4 + AMD's proprietary driver was measured in #1590 (RX 9060 XT).

Setup: Windows 11, clang++ (llvm-mingw 23.1.5), python -I -B tests/test_device_policy.py --cxx clang++ --headers <Vulkan-Headers 1.4.345>, run with main's device_policy.h and then with this PR's. I ran it again after main was merged into the branch: the result is the same as on 068fb8eb. The one new commit on main (08994a9e, #1815) touches none of this PR's files.

Before: main @ 08994a9e After: this PR @ 89369883
Radeon AI PRO R9700, AMD's Windows driver (LLPC) (1002:7551) rdna4 is 0, mma_unroll_try is 0: FAIL all 69 fields as expected
Radeon AI PRO R9700, AMD's proprietary driver on Linux (AMDGPU-PRO) rdna4 is 0, mma_unroll_try is 0: FAIL all 69 fields as expected
The other 19 PCs, including RX 9070 XT and RX 6800 XT pass pass

In the game, this PR on the RX 9060 XT shows rdna4=1, mma_unroll_try=1 and the unrolled form (Testing above). That is the same result #1590 recorded for this card.

Risks

Who changes: only AMD cards with IDs 1002:7550, 7551 or 7590 whose name has neither "RX 9" nor "GFX12". In practice that is the Radeon AI PRO R9700 family, or a driver that reports a generic name. For them:

  • rdna4=1 on every driver.
  • With RX_VK_MMA_UNROLL unset, only cards on VK_DRIVER_ID_AMD_PROPRIETARY gain the unrolled software MMA trial, and the 8192-lane self-test still decides which form is used. RADV already tried it before this PR. AMDVLK keeps the loop.
  • Auto: at tier 2 or higher, in a build with FSR 4, a fresh or reapplied Auto (this PC) can now choose FSR 4 and its render resolution. This is Auto's rule for RDNA 4, now applied to the R9700 too. At startup, an already-saved Auto setup whose fingerprint still matches keeps its saved choice, since the fingerprint does not include rdna4.
  • Caches: the build-time LONGSHOT_SHADER_STAMP is unchanged. The runtime translator_stamp() includes the selected MMA form, so a card that moves from the loop to an unrolled form rebuilds its program, preparation and pipeline caches once.

Everyone else: cards whose name already matched, RDNA 1-3, NVIDIA and Intel get the same policy as on main. Their saves, longshot_options.ini and caches are untouched. No MKWVK_API_VERSION bump and no shader change.

Turning it off: RX_VK_MMA_UNROLL=0 brings back the looped MMA (it does not affect the Auto choice). A revert restores the name-only check.

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). (Windows subset above; full suite on CI)
  • 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 fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows built; Linux on CI)
  • 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.

🤖 Generated with Claude Code

## Summary The renderer told an AMD RDNA 4 card only by its name ("RX 9" or "GFX12"), in three copies that could drift apart: `DeviceFacts::rdna4()`, `is_rdna4()` in `vk_internal.h`, and the check in `auto_profile()`. A card with another name, such as the **Radeon AI PRO R9700**, was not taken for RDNA 4. These are the follow-up suggestions from the #1590 review. This PR: - **Keeps one definition.** `is_rdna4(vendor_id, device_id, device_name)` in `gpu/vk/device_policy.h` is used by `DeviceFacts::rdna4()`, `choose_software_form()` (`vk_coopmat.cpp`) and `auto_profile()` (`vk_main.cpp`). The copy in `vk_internal.h` is removed. - **Checks the PCI device ID first.** AMD (`0x1002`) `0x7550` (Navi 48: RX 9070 / XT / GRE), `0x7551` (Navi 48: Radeon AI PRO R9700 / R9700S / R9600D) and `0x7590` (Navi 44: RX 9050 / 9060 / 9060 XT). The name match stays as the fallback for cards not in the list. - **Fixes the driver wording.** `VK_DRIVER_ID_AMD_PROPRIETARY` is also what AMDGPU-PRO reports on Linux. The code has no `_WIN32` check, and this PR does not add one. So the comments and the looped-path log line say "AMD's proprietary driver" instead of "AMD's Windows driver". The `RX_VK_MMA_UNROLL` row in `switches.def` now lists the default as "on for Mesa RADV and AMD RDNA 4 on AMD's proprietary driver" (before, it said only "on for Mesa RADV"). In `auto_settings.h`, the comment reads "an AMD RDNA 4 card, an RX 9000 or Radeon AI PRO: FSR 4". The player guide says "an AMD RDNA 4 card (RX 9000)". **How to see it on `main`:** take an AMD RDNA 4 card whose `deviceName` has neither "RX 9" nor "GFX12", for example `AMD Radeon AI PRO R9700` (`1002:7551`). On every driver, the device policy log block shows `rdna4=0`. On AMD's proprietary driver it also shows `mma_unroll_try=0`. RADV already tries the unrolled form, whatever the name. `tests/test_device_policy.py` with this PR's two R9700 rows fails on `main` for exactly those two fields (see Measurements). Read first: `is_rdna4()` and `DeviceFacts::rdna4()` in `gpu/vk/device_policy.h`, `choose_software_form()` in `gpu/vk/vk_coopmat.cpp`, `auto_profile()` in `gpu/vk/vk_main.cpp`. See #1590. ## Testing **Tested:** - **In the game, Windows 11, AMD Radeon RX 9060 XT (`1002:7590`), AMD driver 26.11.2 (LLPC), driver id 1:** I built the renderer from this PR's commit with `python -I scripts/dev.py vk`: 246 files, 0 failed, symbols checked. I put that `longshot_vk.dll` into a copy of `nightly-596-2692a6e3`; the log reads `longshot nightly-596-2692a6e3 (source 14be9eeb)`, the host's revision. It ran with its own empty caches and options. Both runs went through the job queue (`dev.py queue run rdna4-pci-smoke --mode shared`), with `scripts/longshot_ctl.py` booting `kokiri-start` to play. Each run then stayed in Kokiri Forest (`KokiriForest_Child`) for 70 s with the game's own upscaler at 100%, and I read its status every 10 s. This build has no FSR 4. - default: `rdna4=1`, `mma_unroll_try=1`, and the full line `vk: software matrix multiplies unrolled, f16 rounding by conversion, A through quad broadcasts: the loop's words for 8192 lanes (RX_VK_MMA_UNROLL=0: looped)`. Frames 6642 → 10407, 50 to 60 fps, never stalled. - `RX_VK_MMA_UNROLL=0`: `rdna4=1`, `mma_unroll_try=1`, and `vk: software matrix multiplies looped (RX_VK_MMA_UNROLL=0)`. Frames 6547 → 10694, 60 fps, never stalled. - Both runs: no `VK_ERROR` or device lost in the log. This card's name already matches "RX 9", so the run checks that nothing changed for it. The ID-only path is covered by the tests below. - **Checks on Windows** (`clang++`, Vulkan-Headers 1.4.345): - `tests/test_device_policy.py`: 21 PCs, 69 fields, 64 environments, 55 rule edges: ok. With `main`'s `device_policy.h` it fails on the two new R9700 rows (`rdna4`, `mma_unroll_try`). - `tests/test_mma_software.py`: `switch()` (12 `is_rdna4` cases: ID-only names, name fallback, null name, other AMD generations, NVIDIA with an RDNA 4 ID or an "RX 9" name), `inputs()` and the emitter/stamp wiring: pass, run on its own (`python -I -B tests/test_mma_software.py --cxx clang++ --headers <SPIRV-Headers>`). `spirv()` stops there because this PC has no `spirv-val`. The run below skips this whole file for the same reason. The `auto_profile()` check now ignores comments; I confirmed it fails when the assignment is commented out with `//` or `/* */`. - `tests/test_auto_settings.py`, `tests/test_switch_table.py` (712 switches), `tests/test_doc_anchors.py`, `tests/test_vendor_fixes.py` (16 devices): pass. - `python -I -B tests/run_all.py --changed origin/main` (the 117 checks that read a changed file) on Windows: `97 passed, 16 failed, 9 skipped` here. As a narrower comparison, I ran the same list's `tests/` checks on `main` @ `068fb8eb`, same PC: `93 passed, 16 failed`. The **same 16 checks fail on both**, so none is new with this PR. One of them, `test_direct_buffer_writes`, only hit its 60 s compile timeout because both runs were going at once; run alone, it passes on both (6.6 s here). I did not find the cause of every one of the other 15. Two examples: `test_auto_handheld` uses POSIX `setenv` / `unsetenv`, and several report compile errors in their own fixtures against `main`'s current names. They are: `test_appimage_player_build`, `test_auto_handheld`, `test_crash_dialog`, `test_crt_options`, `test_dev_ab`, `test_frame_overlap`, `test_fsr_uniform_ownership`, `test_hud_layout_row`, `test_linux_pressure`, `test_prepare_cache_save`, `test_present_queue_default`, `test_present_thread`, `test_replay_write_order`, `test_vk_occlusion_queries`, `test_walk_key`. The 9 skips need `spirv-val` or Linux. - Lint: `pre-commit` (4.2.0, this repo's config) on the changed files: end-of-file, trailing-whitespace and gitleaks pass. The ruff hook stopped on a duplicate `--force-exclude` from the hook wrapper, so I ran ruff 0.12.0 directly with `--force-exclude` on the two changed Python files: all checks passed. `actionlint` was not run (no workflow changed). `git diff --check`: clean. - **Not run:** the full `mise run test` and `mise run lint`. This PC is Windows without `mise`, and much of the suite needs Linux tools. This PR is open as WIP so CI can run them; a maintainer's OK to rely on CI for them is welcome, and I'll tick the boxes once CI passes. **Still to test:** - Linux, any GPU: the full `mise run test`, including `tests/test_mma_software.py` `spirv()` with `spirv-val`, and the host build with clang/gcc, expecting no new failures (CI, or @Beanstalk Linux build and full test suite). - An RDNA 4 card reported by ID without "RX 9" / "GFX12" in its name (Radeon AI PRO R9700 on AMD's Windows driver or AMDGPU-PRO, or RADV): check the log for `rdna4=1` and the selected MMA form. Record the PCI ID, `deviceName` and Vulkan driver ID; on AMDGPU-PRO, check which ICD was loaded. Then, in a build with FSR 4 and a working FSR 4 runtime, with fresh options, record what Auto chooses and which upscaler is actually active (by hand, whoever has one). - RX 9070 XT, Linux RADV: boot to play and check `rdna4=1` with the same MMA form as on `main` (@Beanstalk). ## Measurements **Verdict:** fixed. The two R9700 rows fail on `main` and pass here. Nothing changes on cards whose name already matched. This is not a perf change: the default for the unrolled software MMA on RDNA 4 + AMD's proprietary driver was measured in #1590 (RX 9060 XT). Setup: Windows 11, `clang++` (llvm-mingw 23.1.5), `python -I -B tests/test_device_policy.py --cxx clang++ --headers <Vulkan-Headers 1.4.345>`, run with `main`'s `device_policy.h` and then with this PR's. I ran it again after `main` was merged into the branch: the result is the same as on `068fb8eb`. The one new commit on `main` (`08994a9e`, #1815) touches none of this PR's files. | | Before: main @ 08994a9e | After: this PR @ 89369883 | |---|---|---| | `Radeon AI PRO R9700, AMD's Windows driver (LLPC)` (`1002:7551`) | `rdna4 is 0`, `mma_unroll_try is 0`: FAIL | all 69 fields as expected | | `Radeon AI PRO R9700, AMD's proprietary driver on Linux (AMDGPU-PRO)` | `rdna4 is 0`, `mma_unroll_try is 0`: FAIL | all 69 fields as expected | | The other 19 PCs, including RX 9070 XT and RX 6800 XT | pass | pass | In the game, this PR on the RX 9060 XT shows `rdna4=1`, `mma_unroll_try=1` and the unrolled form (Testing above). That is the same result #1590 recorded for this card. ## Risks **Who changes:** only AMD cards with IDs `1002:7550`, `7551` or `7590` whose name has neither "RX 9" nor "GFX12". In practice that is the Radeon AI PRO R9700 family, or a driver that reports a generic name. For them: - `rdna4=1` on every driver. - With `RX_VK_MMA_UNROLL` unset, only cards on `VK_DRIVER_ID_AMD_PROPRIETARY` gain the unrolled software MMA trial, and the 8192-lane self-test still decides which form is used. RADV already tried it before this PR. AMDVLK keeps the loop. - **Auto:** at tier 2 or higher, in a build with FSR 4, a fresh or reapplied Auto (this PC) can now choose FSR 4 and its render resolution. This is Auto's rule for RDNA 4, now applied to the R9700 too. At startup, an already-saved Auto setup whose fingerprint still matches keeps its saved choice, since the fingerprint does not include `rdna4`. - **Caches:** the build-time `LONGSHOT_SHADER_STAMP` is unchanged. The runtime `translator_stamp()` includes the *selected* MMA form, so a card that moves from the loop to an unrolled form rebuilds its program, preparation and pipeline caches once. **Everyone else:** cards whose name already matched, RDNA 1-3, NVIDIA and Intel get the same policy as on `main`. Their saves, `longshot_options.ini` and caches are untouched. No `MKWVK_API_VERSION` bump and no shader change. **Turning it off:** `RX_VK_MMA_UNROLL=0` brings back the looped MMA (it does not affect the Auto choice). A revert restores the name-only check. ## 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. - [ ] `mise run test` passes (any failure that also fails on `main` is named). *(Windows subset above; full suite on CI)* - [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 fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. *(Windows built; Linux on CI)* - [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. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(vk): recognize RDNA 4 GPUs by PCI device ID
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
3694491867
RDNA 4 was told only by the device name ("RX 9" or "GFX12"), in three copies:
DeviceFacts::rdna4(), is_rdna4() in vk_internal.h and auto_profile(). A card
named otherwise, such as the Radeon AI PRO R9700, was not taken for RDNA 4.

One is_rdna4(vendor, device ID, name) in device_policy.h now serves all three.
It knows AMD's RDNA 4 PCI IDs 0x7550 and 0x7551 (Navi 48) and 0x7590 (Navi 44),
with the name as a fallback. The software matrix multiply rule and its switch
row say "AMD's proprietary driver", as the driver ID it tests is also
AMDGPU-PRO's on Linux.

See #1590.

Assisted-by: Gemini (Antigravity), OpenAI Codex gpt-6.2
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11, AMD Radeon RX 9060 XT (1002:7590), AMD driver 26.11.2 (LLPC). Renderer built from this PR's commit (dev.py vk) on nightly-596-2692a6e3, run through the job queue with empty caches: kokiri-start to play, 70 s in Kokiri Forest per run at 50-60 fps with no stall. Default: rdna4=1, mma_unroll_try=1, unrolled form matching the loop over 8192 lanes. RX_VK_MMA_UNROLL=0: looped. No VK_ERROR or device lost in either run.

Tested in game: Windows 11, AMD Radeon RX 9060 XT (1002:7590), AMD driver 26.11.2 (LLPC). Renderer built from this PR's commit (dev.py vk) on nightly-596-2692a6e3, run through the job queue with empty caches: kokiri-start to play, 70 s in Kokiri Forest per run at 50-60 fps with no stall. Default: rdna4=1, mma_unroll_try=1, unrolled form matching the loop over 8192 lanes. RX_VK_MMA_UNROLL=0: looped. No VK_ERROR or device lost in either run.
Member

Possibly related, for context:

  • PR #1038 WIP: feat(vk): matrix multiplies through WMMA 16x16x16 workgroup tiles on AMD RDNA 3/4 — Open AMD RDNA 3/4 cooperative-matrix work overlaps adjacent Vulkan MMA policy/code
Possibly related, for context: - PR #1038 WIP: feat(vk): matrix multiplies through WMMA 16x16x16 workgroup tiles on AMD RDNA 3/4 — Open AMD RDNA 3/4 cooperative-matrix work overlaps adjacent Vulkan MMA policy/code
Merge branch 'main' into fix/vk-rdna4-pci-id
Some checks failed
PR description / Description follows the template (pull_request_target) Failing after 3s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
893698839a
gmourao changed title from WIP: fix(vk): recognize RDNA 4 GPUs by PCI device ID to fix(vk): recognize RDNA 4 GPUs by PCI device ID 2026-11-20 04:52:35 +00:00
Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): the two Radeon AI PRO R9700 rows expect acquire_ahead, as every row does on main
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 14s
PR description / Description follows the template (pull_request_target) Failing after 19s
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 26s
CI / Website build and checks (pull_request) Failing after 36s
9d3e0d8aa0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean left a comment

Recommendation: Approve. It turns three copies of the RDNA 4 check into one and has it check the PCI ID first, so a Radeon AI PRO R9700 on AMD's proprietary driver gets the RDNA 4 policy the RX 9070 and 9060 cards already get. Cards whose name already matched see no change. Recommend approval; not approved on the forge.

For players: on an RDNA 4 card whose name has neither "RX 9" nor "GFX12" (in practice the Radeon AI PRO R9700 family on AMD's Windows driver or AMDGPU-PRO), Auto (this PC) can now pick FSR 4, and the software matrix multiplies try the unrolled form that #1590 measured, still gated by the 8192-lane self-test. The code is better for it: one definition (is_rdna4 in device_policy.h) instead of three that could drift apart, and the comments now say "proprietary driver" because the rule never had a _WIN32 check.

Does it help: not a perf change. It is a fix, and the test shows it: the two R9700 rows in test_device_policy.py fail on main for rdna4 and mma_unroll_try and pass here. The in-game run (RX 9060 XT, Windows, LLPC) checks that nothing changed for a card the name already matched. The ID-only path has not been run in the game.
Other systems: on RADV, nothing changes: its names carry "GFX1201"/"GFX1200", so the name match already caught every RDNA 4 card. NVIDIA, Intel and RDNA 1-3 are untouched (the vendor check comes first, and the ID list has only RDNA 4 IDs, checked against 0x73DF and 0x744C in the test). On the affected cards, translator_stamp() includes the selected MMA form, so they rebuild their program caches once. A saved Auto setup keeps its choice because the fingerprint has no rdna4. Both effects are stated in Risks. There is no API version bump and no shader change.
Switches: RX_VK_MMA_UNROLL: its behaviour is unchanged. The row now gives its real default ("on for Mesa RADV and AMD RDNA 4 on AMD's proprietary driver"), which the code already had since #1590. That default is right: it is what was measured, and the self-test decides. No switch is added or removed.

Reviewed: head 9d3e0d8a against main 3df5c13e (the merge of main this review pushed; before that, 89369883 against 08994a9e). Read in full: device_policy.h (is_rdna4, DeviceFacts::rdna4, the mma_unroll_try and rdna4 rules), vk_coopmat.cpp software_unroll_wanted/choose_software_form, vk_main.cpp auto_profile and the DeviceFacts fill (pf.device_id = dev.props.deviceID), vk_internal.h, auto_settings.h choose, switches.def row, the user doc lines, test_device_policy.py rows, test_mma_software.py switch(). Nothing run (a code review).
Fixed in this review (pushed to fix/vk-rdna4-pci-id, your commits kept):

  • 950e8714: merged main in. The one conflict was vk_internal.h: main added QueueMutex next to the old is_rdna4. I dropped the old is_rdna4, as this PR does, and kept main's code.
  • 9d3e0d8a: on main, acquire_ahead is now on for every driver, and every row in test_device_policy.py lists it. Your two new R9700 rows did not, so they would have failed on the merged head. Both now list it, and nothing else in them changed (the RX 9070 XT row differs from the PR's copy only by that word).

Checked and fine:

  • vk_main.cpp and vk_coopmat.cpp are both in mkwvk and include device_policy.h through vk_internal.h, so the old two-argument is_rdna4 has no callers left.
  • p.vendorID == 0x1002 is the same test as the old hw.vendor == AMD.
  • DeviceFacts::rdna4() keeps its old amd() guard through is_rdna4's vendor check.
  • A null name still answers false, unless the ID matches.
  • The test would catch the fix being undone: dropping the ID line fails the AMD Device 7550/7590 and R9700 cases and both policy rows.
  • The auto_profile check strips comments first, so a commented-out assignment fails it.
  • The IDs match the RDNA 4 parts I know of: 0x7550 Navi 48 (RX 9070 / XT / GRE), 0x7551 Navi 48 (Radeon AI PRO R9700), 0x7590 Navi 44 (RX 9060 / XT). They do not include CDNA parts like MI350's 0x75Ax, which is right.
  • Nothing else in the tree lists these IDs.

Suggestions (the author may take or leave)

  • gpu/vk/device_policy.h:51: an RDNA 4 part with another ID and a generic name (a mobile or OEM part, if one ships) would still fall through to the name match. That is fine as it stands; it is just one more line in the list when such a card turns up.

Testing: in the game on an RX 9060 XT, Windows, AMD 26.11.2 (LLPC): rdna4=1, unrolled, and with RX_VK_MMA_UNROLL=0, looped (the author's run and comment). Two runs are still wanted, and neither holds the merge in my view:

  • an R9700 or another ID-only card, by hand. It is rare, and the policy it now gets is the one measured on the same Navi 48 silicon;
  • an RX 9070 XT on RADV. The name match already applies there, so its policy cannot change.

CI on 9d3e0d8a was still running when I posted. "Guide screenshots" fails on review hashes for dozens of headers this PR does not touch, which comes from main, not this PR. The description check fails on the two CI-reliant boxes.
Overlaps and merge order:

  • #1893 (batch_submits off on discrete RDNA 4 RADV) reads f.rdna4(), so it gets this PR's ID-first detection with no change. Both orders merge without a textual overlap (different hunks in device_policy.h, switches.def and test_device_policy.py). Taking this one first is cleaner.
  • #1801 (Battlemage depth bias) is independent.
  • #1038 (WIP WMMA on RDNA 3/4) should call is_rdna4 rather than match names.
**Recommendation: Approve.** It turns three copies of the RDNA 4 check into one and has it check the PCI ID first, so a Radeon AI PRO R9700 on AMD's proprietary driver gets the RDNA 4 policy the RX 9070 and 9060 cards already get. Cards whose name already matched see no change. Recommend approval; not approved on the forge. For players: on an RDNA 4 card whose name has neither "RX 9" nor "GFX12" (in practice the Radeon AI PRO R9700 family on AMD's Windows driver or AMDGPU-PRO), Auto (this PC) can now pick FSR 4, and the software matrix multiplies try the unrolled form that #1590 measured, still gated by the 8192-lane self-test. The code is better for it: one definition (`is_rdna4` in `device_policy.h`) instead of three that could drift apart, and the comments now say "proprietary driver" because the rule never had a `_WIN32` check. **Does it help:** not a perf change. It is a fix, and the test shows it: the two R9700 rows in `test_device_policy.py` fail on `main` for `rdna4` and `mma_unroll_try` and pass here. The in-game run (RX 9060 XT, Windows, LLPC) checks that nothing changed for a card the name already matched. The ID-only path has not been run in the game. **Other systems:** on RADV, nothing changes: its names carry "GFX1201"/"GFX1200", so the name match already caught every RDNA 4 card. NVIDIA, Intel and RDNA 1-3 are untouched (the vendor check comes first, and the ID list has only RDNA 4 IDs, checked against `0x73DF` and `0x744C` in the test). On the affected cards, `translator_stamp()` includes the selected MMA form, so they rebuild their program caches once. A saved Auto setup keeps its choice because the fingerprint has no `rdna4`. Both effects are stated in Risks. There is no API version bump and no shader change. **Switches:** `RX_VK_MMA_UNROLL`: its behaviour is unchanged. The row now gives its real default ("on for Mesa RADV and AMD RDNA 4 on AMD's proprietary driver"), which the code already had since #1590. That default is right: it is what was measured, and the self-test decides. No switch is added or removed. **Reviewed:** head 9d3e0d8a against main 3df5c13e (the merge of `main` this review pushed; before that, 89369883 against 08994a9e). Read in full: `device_policy.h` (is_rdna4, DeviceFacts::rdna4, the mma_unroll_try and rdna4 rules), `vk_coopmat.cpp` software_unroll_wanted/choose_software_form, `vk_main.cpp` auto_profile and the DeviceFacts fill (`pf.device_id = dev.props.deviceID`), `vk_internal.h`, `auto_settings.h` choose, `switches.def` row, the user doc lines, `test_device_policy.py` rows, `test_mma_software.py` switch(). Nothing run (a code review). **Fixed in this review** (pushed to `fix/vk-rdna4-pci-id`, your commits kept): - 950e8714: merged `main` in. The one conflict was `vk_internal.h`: `main` added `QueueMutex` next to the old `is_rdna4`. I dropped the old `is_rdna4`, as this PR does, and kept `main`'s code. - 9d3e0d8a: on `main`, `acquire_ahead` is now on for every driver, and every row in `test_device_policy.py` lists it. Your two new R9700 rows did not, so they would have failed on the merged head. Both now list it, and nothing else in them changed (the RX 9070 XT row differs from the PR's copy only by that word). **Checked and fine:** - `vk_main.cpp` and `vk_coopmat.cpp` are both in `mkwvk` and include `device_policy.h` through `vk_internal.h`, so the old two-argument `is_rdna4` has no callers left. - `p.vendorID == 0x1002` is the same test as the old `hw.vendor == AMD`. - `DeviceFacts::rdna4()` keeps its old `amd()` guard through `is_rdna4`'s vendor check. - A null name still answers false, unless the ID matches. - The test would catch the fix being undone: dropping the ID line fails the `AMD Device 7550/7590` and R9700 cases and both policy rows. - The `auto_profile` check strips comments first, so a commented-out assignment fails it. - The IDs match the RDNA 4 parts I know of: `0x7550` Navi 48 (RX 9070 / XT / GRE), `0x7551` Navi 48 (Radeon AI PRO R9700), `0x7590` Navi 44 (RX 9060 / XT). They do not include CDNA parts like MI350's `0x75Ax`, which is right. - Nothing else in the tree lists these IDs. **Suggestions** (the author may take or leave) - `gpu/vk/device_policy.h:51`: an RDNA 4 part with another ID and a generic name (a mobile or OEM part, if one ships) would still fall through to the name match. That is fine as it stands; it is just one more line in the list when such a card turns up. **Testing:** in the game on an RX 9060 XT, Windows, AMD 26.11.2 (LLPC): `rdna4=1`, unrolled, and with `RX_VK_MMA_UNROLL=0`, looped (the author's run and comment). Two runs are still wanted, and neither holds the merge in my view: - an R9700 or another ID-only card, by hand. It is rare, and the policy it now gets is the one measured on the same Navi 48 silicon; - an RX 9070 XT on RADV. The name match already applies there, so its policy cannot change. CI on 9d3e0d8a was still running when I posted. "Guide screenshots" fails on review hashes for dozens of headers this PR does not touch, which comes from `main`, not this PR. The description check fails on the two CI-reliant boxes. **Overlaps and merge order:** - [#1893](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1893) (batch_submits off on discrete RDNA 4 RADV) reads `f.rdna4()`, so it gets this PR's ID-first detection with no change. Both orders merge without a textual overlap (different hunks in `device_policy.h`, `switches.def` and `test_device_policy.py`). Taking this one first is cleaner. - [#1801](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1801) (Battlemage depth bias) is independent. - [#1038](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1038) (WIP WMMA on RDNA 3/4) should call `is_rdna4` rather than match names.
@ -48,1 +48,4 @@
// AMD RDNA 4 (GFX12): Navi 48 (0x7550 RX 9070 series, 0x7551 Radeon AI PRO R9700) and Navi 44 (0x7590 RX 9060 series),
// with name matching as a fallback for future or uncatalogued GFX12 cards.
inline bool is_rdna4(uint32_t vendor_id, uint32_t device_id, const char* device_name) {
Owner

Suggestion: an RDNA 4 part with another ID and a generic name (a mobile or OEM part, if one ships) falls through to the name match. That is fine as it stands; add its ID here when one turns up. The three IDs match the RDNA 4 parts I know of (Navi 48 0x7550/0x7551, Navi 44 0x7590), and CDNA's 0x75Ax is rightly left out.

Suggestion: an RDNA 4 part with another ID and a generic name (a mobile or OEM part, if one ships) falls through to the name match. That is fine as it stands; add its ID here when one turns up. The three IDs match the RDNA 4 parts I know of (Navi 48 0x7550/0x7551, Navi 44 0x7590), and CDNA's 0x75Ax is rightly left out.
HumanBean deleted branch fix/vk-rdna4-pci-id 2026-11-20 22:56:14 +00:00
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!1839
No description provided.