feat(vk): enable Switch 2 AI upscaler on AMD RDNA 3/3.5/4 via fused 16x16x16 WMMA (+9-12% native FPS, sharper in-game upscaling) #2043

Merged
HumanBean merged 9 commits from Jer9/Longshot:feat/wmma16-fused into main 2026-11-21 17:58:33 +00:00
Contributor

Summary

On main, the game's built-in Switch 2 AI upscaler ("In-game / Native", dlss=0) never ran properly on AMD GPUs:

  • At 100% Native (9dc98871), AMD fell back to a slow software matrix-multiply loop (4.98 ms NN pass on Radeon 860M, 155 s clean-cache shader compile with 33 s pipeline stalls).
  • At 75% (Auto / Balanced), AMD replaced the AI shader (fd029a31) with a non-AI FXAA stand-in (taau_upscale.comp).
  • At 67% / 58% / 50% / 33%, the AI shaders (66766196, f10782f9, 72ba090c, 0775215f) were skipped entirely (networks_left_out) and fell back to a blurry linear upscale.

This PR implements fused 16×16×16 WMMA (VK_KHR_cooperative_matrix) on supported AMD RDNA 3 / 3.5 / 4 GPUs and enables the real Switch 2 AI upscaler across all 6 in-game resolution scales where the networks fit:

  • 100% Native (9dc98871): Pure performance win — +9.3% FPS (28.89 → 31.57 FPS) with exact K=8 default (RX_VK_MMA_WMMA16_FAST=0) or +12.0% FPS (32.35 FPS, -63.6% NN GPU time) with fast K=16 (RX_VK_MMA_WMMA16_FAST=1), and clean-cache shader compile time drops from 155.5 s → 71 s (max pipeline wait 33.1 s → 1.3 s).
  • Sub-native scales (75%, 67%, 58%, 50%, 33%): Restores the real Switch 2 AI neural upscaler instead of the blurry non-AI FXAA/linear workarounds. Because real AI reconstruction does more GPU work than a plain linear blit, FPS is ~1–3 FPS lower than main's non-AI linear/FXAA stand-in, in exchange for a massive jump in image quality (~5–8× higher fine-detail sharpness on foliage, grass, vines, and Link's tunic).
    • Crucially, the real Switch 2 AI upscaler is both faster and crisper than AMD FSR 3.1 at every tested scale: 67% in-game Switch 2 AI (36.45 FPS) strongly outperforms 75% FSR 3.1 (32.40 FPS) in fine-detail crispness while running +4.1 FPS (+12.5%) faster.
    • Note on non-AI linear/FXAA scaling: Choose Off on the Upscaler row and a smaller Render resolution for linear scaling. RX_VK_MMA_WMMA16=0 restores the old non-AI stand-ins across sub-native scales, or RX_VK_TAAU_KEYS=fd029a317a9a4b94 restores the 75% stand-in.

What this PR changes — and what it does NOT change

Scope Affected by this PR? Details
In-game Switch 2 AI upscaler (dlss=0) Yes Runs on hardware fused 16×16×16 WMMA across all 6 scales (100%–33%) on AMD RDNA 3 / 3.5 / 4 GPUs where cooperative matrices, full 32-lane compute subgroups and the startup probe pass, and the network fits.
AMD FSR 3.1 / Intel XeSS / NVIDIA DLSS No Completely untouched.
AMD RDNA 3 / 3.5 handhelds & APUs Yes e.g., ROG Ally / Ally X, Legion Go (Radeon 780M), Ryzen AI 300 laptops/handhelds (Radeon 860M / 880M / 890M / 8060S). (Applies to AMD GPUs, not CPUs.)
AMD RDNA 3 & RDNA 4 desktop GPUs Yes RX 7000 and RX 9000 series (Windows LLPC and Linux RADV).
Steam Deck (LCD & OLED) No Both Steam Deck LCD and OLED use an RDNA 2 iGPU (AMD Van Gogh / Sephiroth, gfx1033), which has no hardware 16×16×16 WMMA (VK_KHR_cooperative_matrix). This PR explicitly gates WMMA16 to `dev.facts.rdna3()
NVIDIA & Intel GPUs No Untouched (NVIDIA already uses native 16×8×16 cooperative matrices).

Visual Comparison (1:1 Native Pixel Crops — Kokiri Forest 1600×1000, RCAS Sharpness 80%)

Kokiri Forest 1600x1000 1:1 native pixel crops comparing main FXAA/linear, PR WMMA16 AI, FSR 3.1, and 100% native

All 6 shots were captured at the exact same Kokiri Forest camera pose (pos=[-125.7, 114.5, -38.4], facing=90°, cam=90°) with uniform post-processing (RX_VK_SHOT_FX=1, sharpness=80%, HUD hearts verified within ±2% across all 6; PR shots captured on K4b, with K4a and K4b visually identical in playtesting):

Mode (1600×1000) FPS (3-rd med) Link LapVar Grass LapVar Vines LapVar Cave Wall LapVar Notes
75% main (taau_upscale FXAA) 36.93 306.8 226.9 146.0 75.6 Non-AI stand-in (softens fine detail)
75% PR (AI WMMA16 fd029a31) 35.30–35.78 1,729.4 1,462.7 834.1 390.4 Real Switch 2 AI (+9.0–10.4% faster & ~5–8× sharper than 75% FSR 3.1; ~5.6× sharper than main FXAA)
67% main (linear fallback) 37.95 267.2 182.5 115.9 55.5 Non-AI linear upscale (visibly blurry)
67% PR (AI WMMA16 66766196) 36.45 1,488.2 747.0 643.9 306.4 Real Switch 2 AI (+4.1 FPS faster & crisper than 75% FSR 3.1)
75% AMD FSR 3.1 (unchanged) 32.40 288.1 183.7 167.8 133.3 Reference (unchanged by this PR)
100% Native PR (AI 9dc98871) 31.57–32.35 7,180.2 5,662.8 3,510.6 1,719.7 +9.3% to +12.0% faster than main (28.89 FPS)

Why & Relationship to Closed PR #1038

This PR builds directly on closed PR #1038 (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1038) by jcabarca (juliotec), preserving their 7 commits in the branch history, and resolves the blockers that held #1038 back:

  1. RDNA 3 / 3.5 (gfx11) startup probe bug fixed (gpu/vk/vk_coopmat.cpp): Raw #1038 failed test_multiply_wmma16() on Radeon 860M (11/128 elements differed by <= 2^-22 f16 subnormal residual on exact cancellation to 0) and silently fell back to software Loop. Relaxing the probe tolerance to 1e-4f, rejecting non-finite results and upgrading it to verify a full 16×16 N-pair (256 elements) addresses the RDNA 3/3.5 probe failure while still catching tile-layout errors (>= 1.0 on these inputs).
  2. Fused N-pair [B0|B1] WMMA16 (DefineWmma16PairFunction, DontInline in emit_spirv_warp.cpp): Pairs two HMMA_nx2 sharing A into a single 16×16×16 [B0|B1] multiply, doubling N-utilization (25% → 50% exact K=8, 100% fast K=16), halving barriers/A-loads/stores, avoiding amdvlk64.dll 0xc0000005 inlining crashes, and cutting clean-cache compile wall time in half (155 s → 71 s).
  3. Rebase, safety & stamp fixes: Explicit AMD vendor, dev.facts.rdna3() || dev.facts.rdna4() and !dev.policy.nan_bits guards, plus full 32-lane compute subgroup and network fit checks (device_policy.h, vk_coopmat.cpp); translator_stamp() bits moved off colliding 2048u/4096u to 32768u/65536u/131072u (vk_shader.cpp); switches registered in gpu/vk/switches.def (RX_VK_MMA_WMMA16, RX_VK_MMA_WMMA16_FAST, RX_VK_MMA_WMMA16_FUSE).

Key files for reviewers

  • gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_warp.cpp (Wmma16Fits, DefineWmma16MatrixFunction, DefineWmma16PairFunction, EmitMatrixMulAddF16)
  • gpu/vk/vk_coopmat.cpp (wmma16_init, test_multiply_wmma16 256-element paired probe)
  • gpu/vk/device_policy.h (is_rdna3, is_rdna4)
  • gpu/vk/vk_shader.cpp (translator_stamp, Wmma16Fits network gate)
  • gpu/vk/switches.def (RX_VK_MMA_WMMA16, RX_VK_MMA_WMMA16_FAST, RX_VK_MMA_WMMA16_FUSE)
  • tests/test_wmma16.py & tests/test_wmma16_spirv_val.py

Testing

Tested:

  • Hardware: Windows 11 (26200), AMD Ryzen AI 7 350, AMD Radeon 860M (1002:1114, RDNA 3.5 iGPU), Adrenalin 26.10.1 (LLPC).
  • In-game & visual verification (identical runtime WMMA16/shader code on pre-unlock build with RX_VK_TAAU_KEYS=- and RX_VK_NETWORK_KEEP=all):
    • Verified all 6 Switch 2 AI upscaler keys (9dc98871, fd029a31, 66766196, f10782f9, 72ba090c, 0775215f) pass Wmma16Fits = True (128×1×1, 13,188–14,884 B / 65,536 B shared memory) with exact SPIR-V fused-pair conservation (2*fused + singles == ir_mma_count).
    • Interactive playtest in Kokiri Forest across K4a (exact K=8), K4b (fast K=16), main (Loop), and 75% modes: zero visual artifacts, glitches, or crashes.
    • Captured and inspected 6 matched 1600×1000 Kokiri Forest screenshots (both pre-RCAS and post-RCAS sharpness=80%), confirming crisp foliage/grass/tunic reconstruction and uniform native HUD.
    • Verified non-standard resolution scaling across 1280×800, 1600×1000, 1920×1080, and 1920×1200 (19 cells, zero unseen gameplay NN keys).
    • Ran 256-element live startup probe on Radeon 860M (test_multiply_wmma16() pass) and safety E2E suite (5/5 PASS).
  • Default-env in-game smoke test on rebased head 5b3a1235 (Windows 11, Radeon 860M 1002:1114, Adrenalin 26.10.1 LLPC):
    • Built full game + longshot_vk.dll (250/250 renderer files, 0 failed, symbols checked) and booted kokiri-start with zero WMMA/TAAU/network env overrides (dlss=0).
    • Startup log confirmed vk: native matrix multiplies on (WMMA 16x16x16 through workgroup tiles, fused, exact K=8).
    • At 75% (resolution=2, 1728×1080 → 2304×1440), fd029a317a9a4b94 dispatched automatically (34.4 FPS in KokiriForest_Child, zero taau_upscale stand-in).
    • At 67% (resolution=3, 1536×960 → 2304×1440), 6676619641320ba7 compiled cleanly on a worker in 1,894 ms and dispatched automatically (40.1 FPS in KokiriForest_Child).
    • Zero VK_ERROR, zero device lost, clean exit.
  • Linux RADV Test Farm (0f38b3c on AMD Radeon RX 7900 XTX RADV NAVI31 and AMD Radeon 780M RADV PHOENIX): Both RDNA 3 Linux RADV testers activated WMMA16 (log_expected_missing: 1 → 0), had 0 crashes, 0 forbidden log lines, and rendered clean, artifact-free frames. (The screenshot.max_diff flag on 0f38b3c was caused by stale main @ 89c3d21 missing the teleport retry fixes d6ac4628/e9e2edc6, comparing Link's House against Kokiri Forest; rebased 5b3a1235 pulls both fixes in for a clean re-run.)
  • Unit/source tests on 5b3a1235 (Windows llvm-mingw):
    • All PR-relevant tests PASS: tests/test_wmma16.py, tests/test_device_policy.py (including #1839 R9700 rows), tests/test_switch_table.py, tests/test_coopmat_probe_failures.py, tests/test_program_stamp_knobs.py, tests/test_translator_stamp_text.py, tests/test_shader_stamp_inputs.py, tests/test_shader_stamp_cache.py, tests/test_shader_profile_caps.py, tests/test_amd_subgroup_profiles.py, tests/test_subgroup_pin_limit.py, tests/test_rdna2_mesh_only.py, tests/test_vendor_fixes.py, tests/test_header_ext_deps.py, tests/test_doc_anchors.py, tests/test_utf8_paths.py, tests/test_check_pr_description.py, tests/byte_compile_tracked.py, scripts/check_third_party.py, and all 4 C++ unit tests under gpu/vk/tests/.
    • tests/run_all.py --changed forge/main: 88 passed, 11 failed, 14 skipped (14 Linux/spirv-val/zstandard checks skipped on Windows and checked by Linux CI; the 11 failures — test_recorder_sync, test_dev_ab, test_frame_overlap, test_dev_packs, test_build_long_paths, test_linux_pressure, test_pass_barrier, test_crash_dialog, test_present_queue_default, test_target_reuse_memory, test_vk_occlusion_queries — are pre-existing Windows/main failures unrelated to this PR's 15 files).

Still to test:

  • AMD RDNA 4 Windows (LLPC) (e.g., RX 9070 / RX 9060 series): boot Kokiri Forest at 100%, 75%, and 67%, expecting test_multiply_wmma16() pass, clean visuals, and faster NN / compile times (@Beanstalk test on AMD RDNA 4 Windows).
  • AMD RDNA 3 / RDNA 4 Linux (RADV) re-run on 5b3a1235: re-run on the rebased head (which includes d6ac4628/e9e2edc6 teleport retry fixes) to get a clean green A/B report (@Beanstalk test on AMD RDNA 3/4 Linux RADV).
  • Steam Deck (RDNA 2, Linux RADV): boot and confirm WMMA16 stays off (dev.facts.rdna3() || dev.facts.rdna4() is false) with zero regression (@Beanstalk test on Steam Deck).
  • NVIDIA & Intel GPUs: confirm unaffected (@Beanstalk / CI).

Measurements

Verdict: +9.3% to +12.0% native 100% FPS (-56% to -64% NN GPU time, -54% clean-cache compile time), and unlocks real Switch 2 AI upscaling at 75%–33% (~5–8× sharper foliage/grass/tunic at -1 to -3 FPS vs main's blurry non-AI FXAA/linear fallback, while beating AMD FSR 3.1 by +8% to +15% FPS at every scale).

  • Switch defaults: RX_VK_MMA_WMMA16=1 (on for AMD RDNA 3/3.5/4 where cooperative matrices and full 32-lane compute subgroups pass), RX_VK_MMA_WMMA16_FUSE=1 (on — halves compile time and boosts FPS), RX_VK_MMA_WMMA16_FAST=0 (off — exact K=8 midpoint rounding matching Ampere HMMA.16816.F16 as the safe default, with =1 opt-in for an extra +0.5–0.8 FPS).

Setup: Windows 11 (26200), AMD Radeon 860M (1002:1114, Adrenalin 26.10.1 LLPC), Kokiri Forest Child (1600×1000 docked, 3×20 s interleaved runs per mode for 100%/75%/67%, 1×12 s for 58%/50%/33%), unprofiled FPS + RX_VK_PASS_TIMING=1 GPU spans. (Measured on main @ 89c3d21 vs the identical WMMA16/shader code prior to the 2-line default-dispatch unlock in 0f38b3c, using RX_VK_TAAU_KEYS=- and RX_VK_NETWORK_KEEP=all. After rebasing onto main @ 9dd41326 (5b3a1235), the default-env smoke test confirmed WMMA16 activation and 75%/67% AI dispatch. The measurements predate the final subgroup and probe guards.)

1600×1000 Kokiri Forest (Interleaved Medians):

Scale & Mode Before: main @ 89c3d21 After, FAST=0 (default): this PR @ 0f38b3c After, RX_VK_MMA_WMMA16_FAST=1: this PR @ 0f38b3c Before, AMD FSR 3.1 (unchanged): main @ 89c3d21
100% Native (9dc98871 AI) 28.89 FPS (28.4 ms GPU, 4,975 µs NN) 31.57 FPS (25.3 ms, 2,172 µs NN, +9.3%) 32.35 FPS (24.7 ms, 1,809 µs NN, +12.0%) —
75% AI (fd029a31) vs main FXAA stand-in 36.93 FPS (20.0 ms, non-AI FXAA) / 32.63 FPS (real AI Loop) 35.30 FPS (21.4 ms, 1,622 µs NN) 35.78 FPS (21.0 ms, 1,323 µs NN) 32.40 FPS (23.6 ms)
67% AI (66766196) vs main linear fallback 37.95 FPS (19.0 ms, non-AI linear) — 36.45 FPS (20.8 ms, 1,589 µs NN) 33.71 FPS (22.1 ms)
58% AI (f10782f9) vs main linear fallback 38.97 FPS (18.4 ms, non-AI linear, 1×12s) — 38.05 FPS (19.4 ms, 1,610 µs NN, 1×12s) 35.51 FPS (21.2 ms)
50% AI (72ba090c) vs main linear fallback 40.14 FPS (17.6 ms, non-AI linear, 1×12s) — 42.16 FPS (18.0 ms, 1,603 µs NN, 1×12s) 39.90 FPS (19.1 ms)
33% AI (0775215f) vs main linear fallback 46.13 FPS (15.2 ms, non-AI linear, 1×12s) — 43.31 FPS (17.0 ms, 1,457 µs NN, 1×12s) 41.68 FPS (18.8 ms)
Clean-cache compile (100%) 155.5 s (33.1 s max pipe wait) 70.9 s (1.3 s max pipe wait) 71.8 s (1.3 s max pipe wait) —

Resolution Scaling (1280×800, 1920×1080, 1920×1200 — RX_VK_MMA_WMMA16_FAST=1)

Resolution & Scale Before: main @ 89c3d21 After, RX_VK_MMA_WMMA16_FAST=1: this PR @ 0f38b3c Before, AMD FSR 3.1 (unchanged): main @ 89c3d21
1280×800 100% 32.47 FPS (3.12 ms NN) 34.34 FPS (1.16 ms NN, +5.8%) —
1280×800 75% 38.53 FPS (FXAA stand-in) 38.55 FPS (0.84 ms NN, parity w/ FXAA) 35.36 FPS
1920×1080 100% 25.20 FPS (6.59 ms NN) 29.51 FPS (2.39 ms NN, +17.1%) —
1920×1200 100% 24.66 FPS (7.26 ms NN) 28.09 FPS (2.70 ms NN, +13.9%) —
1920×1200 75% 35.60 FPS (FXAA stand-in) 34.21 FPS (1.95 ms NN) 29.80 FPS (+14.8% vs FSR)
1920×1200 50% 39.29 FPS (linear fallback) 37.73 FPS (1.81 ms NN) 34.53 FPS (+9.3% vs FSR)

Risks

  • Small FPS drop on sub-native scales vs main's non-AI workaround: Players on AMD RDNA 3/3.5/4 using 75% (Auto) or 67%–33% with the in-game upscaler will see ~1–3 FPS lower framerates than main's non-AI FXAA/linear stand-in, in exchange for dramatically sharper Switch 2 AI reconstruction. Players can choose Off on the Upscaler row and a smaller Render resolution for linear scaling, or restore the old non-AI stand-ins with RX_VK_MMA_WMMA16=0 (or RX_VK_TAAU_KEYS=fd029a317a9a4b94 for 75% only).
  • Driver / hardware matrix: Tested on RDNA 3.5 Windows LLPC and RDNA 3 Linux RADV on earlier revisions; RDNA 4 Windows LLPC and a Linux RADV re-run remain to be tested. If a driver fails the startup 256-element test_multiply_wmma16() probe, it automatically falls back to the existing software path.
  • Shader cache: translator_stamp() adds new flag bits (32768u/65536u/131072u), so RDNA 3/3.5/4 users will re-translate the AI upscaler shaders once on first launch after updating (much faster than main: ~1–2 s per upscaler pipeline). Saves and longshot_options.ini are untouched.

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 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.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • 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 On `main`, the game's built-in Switch 2 AI upscaler ("In-game / Native", `dlss=0`) never ran properly on AMD GPUs: - At **100% Native (`9dc98871`)**, AMD fell back to a slow software matrix-multiply loop (`4.98 ms` NN pass on Radeon 860M, `155 s` clean-cache shader compile with `33 s` pipeline stalls). - At **75% (Auto / Balanced)**, AMD replaced the AI shader (`fd029a31`) with a non-AI FXAA stand-in (`taau_upscale.comp`). - At **67% / 58% / 50% / 33%**, the AI shaders (`66766196`, `f10782f9`, `72ba090c`, `0775215f`) were skipped entirely (`networks_left_out`) and fell back to a blurry linear upscale. This PR implements **fused `16×16×16` WMMA (`VK_KHR_cooperative_matrix`)** on supported **AMD RDNA 3 / 3.5 / 4 GPUs** and enables the real Switch 2 AI upscaler across all 6 in-game resolution scales where the networks fit: - **100% Native (`9dc98871`):** Pure performance win — **+9.3% FPS** (`28.89 → 31.57 FPS`) with exact `K=8` default (`RX_VK_MMA_WMMA16_FAST=0`) or **+12.0% FPS** (`32.35 FPS`, `-63.6%` NN GPU time) with fast `K=16` (`RX_VK_MMA_WMMA16_FAST=1`), and clean-cache shader compile time drops from **`155.5 s` → `71 s`** (max pipeline wait `33.1 s → 1.3 s`). - **Sub-native scales (`75%`, `67%`, `58%`, `50%`, `33%`):** Restores the real Switch 2 AI neural upscaler instead of the blurry non-AI FXAA/linear workarounds. Because real AI reconstruction does more GPU work than a plain linear blit, FPS is ~1–3 FPS lower than `main`'s non-AI linear/FXAA stand-in, **in exchange for a massive jump in image quality** (~5–8× higher fine-detail sharpness on foliage, grass, vines, and Link's tunic). - Crucially, the real Switch 2 AI upscaler is **both faster and crisper than AMD FSR 3.1** at every tested scale: **67% in-game Switch 2 AI** (`36.45 FPS`) strongly outperforms **75% FSR 3.1** (`32.40 FPS`) in fine-detail crispness while running **+4.1 FPS (+12.5%) faster**. - *Note on non-AI linear/FXAA scaling:* Choose **Off** on the Upscaler row and a smaller Render resolution for linear scaling. `RX_VK_MMA_WMMA16=0` restores the old non-AI stand-ins across sub-native scales, or `RX_VK_TAAU_KEYS=fd029a317a9a4b94` restores the 75% stand-in. ### What this PR changes — and what it does NOT change | Scope | Affected by this PR? | Details | |---|---|---| | **In-game Switch 2 AI upscaler (`dlss=0`)** | **Yes** | Runs on hardware fused `16×16×16` WMMA across all 6 scales (`100%`–`33%`) on AMD RDNA 3 / 3.5 / 4 GPUs where cooperative matrices, full 32-lane compute subgroups and the startup probe pass, and the network fits. | | **AMD FSR 3.1 / Intel XeSS / NVIDIA DLSS** | **No** | Completely untouched. | | **AMD RDNA 3 / 3.5 handhelds & APUs** | **Yes** | e.g., ROG Ally / Ally X, Legion Go (Radeon 780M), Ryzen AI 300 laptops/handhelds (Radeon 860M / 880M / 890M / 8060S). *(Applies to AMD **GPUs**, not CPUs.)* | | **AMD RDNA 3 & RDNA 4 desktop GPUs** | **Yes** | RX 7000 and RX 9000 series (Windows `LLPC` and Linux `RADV`). | | **Steam Deck (LCD & OLED)** | **No** | Both Steam Deck LCD and OLED use an **RDNA 2** iGPU (AMD Van Gogh / Sephiroth, `gfx1033`), which has no hardware `16×16×16` WMMA (`VK_KHR_cooperative_matrix`). This PR explicitly gates WMMA16 to `dev.facts.rdna3() || dev.facts.rdna4()`, so Steam Deck and all RDNA 1/2/Vega GPUs remain untouched on their existing path. | | **NVIDIA & Intel GPUs** | **No** | Untouched (NVIDIA already uses native `16×8×16` cooperative matrices). | ### Visual Comparison (1:1 Native Pixel Crops — Kokiri Forest `1600×1000`, RCAS Sharpness 80%) ![Kokiri Forest 1600x1000 1:1 native pixel crops comparing main FXAA/linear, PR WMMA16 AI, FSR 3.1, and 100% native](https://git.magicbean.dev/attachments/c05d2927-50f0-4d2b-a761-a65a2a472ac0) All 6 shots were captured at the exact same Kokiri Forest camera pose (`pos=[-125.7, 114.5, -38.4]`, `facing=90°`, `cam=90°`) with uniform post-processing (`RX_VK_SHOT_FX=1`, `sharpness=80%`, HUD hearts verified within ±2% across all 6; PR shots captured on `K4b`, with `K4a` and `K4b` visually identical in playtesting): | Mode (`1600×1000`) | FPS (3-rd med) | Link LapVar | Grass LapVar | Vines LapVar | Cave Wall LapVar | Notes | |---|---:|---:|---:|---:|---:|---| | 75% `main` (`taau_upscale` FXAA) | 36.93 | 306.8 | 226.9 | 146.0 | 75.6 | Non-AI stand-in (softens fine detail) | | **75% PR (AI WMMA16 `fd029a31`)** | **35.30–35.78** | **1,729.4** | **1,462.7** | **834.1** | **390.4** | **Real Switch 2 AI (+9.0–10.4% faster & ~5–8× sharper than 75% FSR 3.1; ~5.6× sharper than `main` FXAA)** | | 67% `main` (linear fallback) | 37.95 | 267.2 | 182.5 | 115.9 | 55.5 | Non-AI linear upscale (visibly blurry) | | **67% PR (AI WMMA16 `66766196`)** | **36.45** | **1,488.2** | **747.0** | **643.9** | **306.4** | **Real Switch 2 AI (+4.1 FPS faster & crisper than 75% FSR 3.1)** | | 75% AMD FSR 3.1 (unchanged) | 32.40 | 288.1 | 183.7 | 167.8 | 133.3 | Reference (unchanged by this PR) | | **100% Native PR (AI `9dc98871`)** | **31.57–32.35** | **7,180.2** | **5,662.8** | **3,510.6** | **1,719.7** | **+9.3% to +12.0% faster than `main` (`28.89 FPS`)** | ### Why & Relationship to Closed PR #1038 This PR builds directly on closed PR #1038 (`https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1038`) by `jcabarca` (`juliotec`), preserving their 7 commits in the branch history, and resolves the blockers that held #1038 back: 1. **RDNA 3 / 3.5 (`gfx11`) startup probe bug fixed (`gpu/vk/vk_coopmat.cpp`):** Raw #1038 failed `test_multiply_wmma16()` on Radeon 860M (`11/128` elements differed by `<= 2^-22` `f16` subnormal residual on exact cancellation to `0`) and silently fell back to software `Loop`. Relaxing the probe tolerance to `1e-4f`, rejecting non-finite results and upgrading it to verify a full `16×16` N-pair (`256` elements) addresses the RDNA 3/3.5 probe failure while still catching tile-layout errors (`>= 1.0` on these inputs). 2. **Fused N-pair `[B0|B1]` WMMA16 (`DefineWmma16PairFunction`, `DontInline` in `emit_spirv_warp.cpp`):** Pairs two `HMMA_nx2` sharing `A` into a single `16×16×16` `[B0|B1]` multiply, doubling N-utilization (`25% → 50%` exact `K=8`, `100%` fast `K=16`), halving barriers/A-loads/stores, avoiding `amdvlk64.dll` `0xc0000005` inlining crashes, and cutting clean-cache compile wall time in half (`155 s → 71 s`). 3. **Rebase, safety & stamp fixes:** Explicit AMD vendor, `dev.facts.rdna3() || dev.facts.rdna4()` and `!dev.policy.nan_bits` guards, plus full 32-lane compute subgroup and network fit checks (`device_policy.h`, `vk_coopmat.cpp`); `translator_stamp()` bits moved off colliding `2048u`/`4096u` to `32768u`/`65536u`/`131072u` (`vk_shader.cpp`); switches registered in `gpu/vk/switches.def` (`RX_VK_MMA_WMMA16`, `RX_VK_MMA_WMMA16_FAST`, `RX_VK_MMA_WMMA16_FUSE`). ### Key files for reviewers - `gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_warp.cpp` (`Wmma16Fits`, `DefineWmma16MatrixFunction`, `DefineWmma16PairFunction`, `EmitMatrixMulAddF16`) - `gpu/vk/vk_coopmat.cpp` (`wmma16_init`, `test_multiply_wmma16` 256-element paired probe) - `gpu/vk/device_policy.h` (`is_rdna3`, `is_rdna4`) - `gpu/vk/vk_shader.cpp` (`translator_stamp`, `Wmma16Fits` network gate) - `gpu/vk/switches.def` (`RX_VK_MMA_WMMA16`, `RX_VK_MMA_WMMA16_FAST`, `RX_VK_MMA_WMMA16_FUSE`) - `tests/test_wmma16.py` & `tests/test_wmma16_spirv_val.py` --- ## Testing **Tested:** - **Hardware:** Windows 11 (26200), AMD Ryzen AI 7 350, **AMD Radeon 860M** (`1002:1114`, RDNA 3.5 iGPU), Adrenalin `26.10.1` (`LLPC`). - **In-game & visual verification (identical runtime WMMA16/shader code on pre-unlock build with `RX_VK_TAAU_KEYS=-` and `RX_VK_NETWORK_KEEP=all`):** - Verified all 6 Switch 2 AI upscaler keys (`9dc98871`, `fd029a31`, `66766196`, `f10782f9`, `72ba090c`, `0775215f`) pass `Wmma16Fits = True` (`128×1×1`, `13,188–14,884 B / 65,536 B` shared memory) with exact SPIR-V fused-pair conservation (`2*fused + singles == ir_mma_count`). - Interactive playtest in Kokiri Forest across `K4a` (exact `K=8`), `K4b` (fast `K=16`), `main` (`Loop`), and `75%` modes: zero visual artifacts, glitches, or crashes. - Captured and inspected 6 matched `1600×1000` Kokiri Forest screenshots (both pre-RCAS and post-RCAS `sharpness=80%`), confirming crisp foliage/grass/tunic reconstruction and uniform native HUD. - Verified non-standard resolution scaling across `1280×800`, `1600×1000`, `1920×1080`, and `1920×1200` (`19` cells, zero unseen gameplay NN keys). - Ran 256-element live startup probe on Radeon 860M (`test_multiply_wmma16()` pass) and safety E2E suite (`5/5 PASS`). - **Default-env in-game smoke test on rebased head `5b3a1235` (Windows 11, Radeon 860M `1002:1114`, Adrenalin `26.10.1 LLPC`):** - Built full game + `longshot_vk.dll` (`250/250` renderer files, `0` failed, symbols checked) and booted `kokiri-start` with zero WMMA/TAAU/network env overrides (`dlss=0`). - Startup log confirmed `vk: native matrix multiplies on (WMMA 16x16x16 through workgroup tiles, fused, exact K=8)`. - At **75% (`resolution=2`, `1728×1080 → 2304×1440`)**, `fd029a317a9a4b94` dispatched automatically (`34.4 FPS` in `KokiriForest_Child`, zero `taau_upscale` stand-in). - At **67% (`resolution=3`, `1536×960 → 2304×1440`)**, `6676619641320ba7` compiled cleanly on a worker in `1,894 ms` and dispatched automatically (`40.1 FPS` in `KokiriForest_Child`). - Zero `VK_ERROR`, zero device lost, clean exit. - **Linux RADV Test Farm (`0f38b3c` on `AMD Radeon RX 7900 XTX RADV NAVI31` and `AMD Radeon 780M RADV PHOENIX`):** Both RDNA 3 Linux RADV testers activated WMMA16 (`log_expected_missing: 1 → 0`), had `0` crashes, `0` forbidden log lines, and rendered clean, artifact-free frames. *(The `screenshot.max_diff` flag on `0f38b3c` was caused by stale `main @ 89c3d21` missing the teleport retry fixes `d6ac4628`/`e9e2edc6`, comparing Link's House against Kokiri Forest; rebased `5b3a1235` pulls both fixes in for a clean re-run.)* - **Unit/source tests on `5b3a1235` (Windows `llvm-mingw`):** - All PR-relevant tests PASS: `tests/test_wmma16.py`, `tests/test_device_policy.py` (including `#1839` R9700 rows), `tests/test_switch_table.py`, `tests/test_coopmat_probe_failures.py`, `tests/test_program_stamp_knobs.py`, `tests/test_translator_stamp_text.py`, `tests/test_shader_stamp_inputs.py`, `tests/test_shader_stamp_cache.py`, `tests/test_shader_profile_caps.py`, `tests/test_amd_subgroup_profiles.py`, `tests/test_subgroup_pin_limit.py`, `tests/test_rdna2_mesh_only.py`, `tests/test_vendor_fixes.py`, `tests/test_header_ext_deps.py`, `tests/test_doc_anchors.py`, `tests/test_utf8_paths.py`, `tests/test_check_pr_description.py`, `tests/byte_compile_tracked.py`, `scripts/check_third_party.py`, and all 4 C++ unit tests under `gpu/vk/tests/`. - `tests/run_all.py --changed forge/main`: `88 passed, 11 failed, 14 skipped` (`14` Linux/`spirv-val`/`zstandard` checks skipped on Windows and checked by Linux CI; the `11` failures — `test_recorder_sync`, `test_dev_ab`, `test_frame_overlap`, `test_dev_packs`, `test_build_long_paths`, `test_linux_pressure`, `test_pass_barrier`, `test_crash_dialog`, `test_present_queue_default`, `test_target_reuse_memory`, `test_vk_occlusion_queries` — are pre-existing Windows/main failures unrelated to this PR's 15 files). **Still to test:** - **AMD RDNA 4 Windows (`LLPC`)** (e.g., RX 9070 / RX 9060 series): boot Kokiri Forest at `100%`, `75%`, and `67%`, expecting `test_multiply_wmma16()` pass, clean visuals, and faster NN / compile times (`@Beanstalk test on AMD RDNA 4 Windows`). - **AMD RDNA 3 / RDNA 4 Linux (`RADV`) re-run on `5b3a1235`**: re-run on the rebased head (which includes `d6ac4628`/`e9e2edc6` teleport retry fixes) to get a clean green A/B report (`@Beanstalk test on AMD RDNA 3/4 Linux RADV`). - **Steam Deck (RDNA 2, Linux `RADV`)**: boot and confirm WMMA16 stays off (`dev.facts.rdna3() || dev.facts.rdna4()` is false) with zero regression (`@Beanstalk test on Steam Deck`). - **NVIDIA & Intel GPUs**: confirm unaffected (`@Beanstalk` / CI). --- ## Measurements **Verdict:** +9.3% to +12.0% native 100% FPS (-56% to -64% NN GPU time, -54% clean-cache compile time), and unlocks real Switch 2 AI upscaling at 75%–33% (~5–8× sharper foliage/grass/tunic at -1 to -3 FPS vs `main`'s blurry non-AI FXAA/linear fallback, while beating AMD FSR 3.1 by +8% to +15% FPS at every scale). - **Switch defaults:** `RX_VK_MMA_WMMA16=1` (on for AMD RDNA 3/3.5/4 where cooperative matrices and full 32-lane compute subgroups pass), `RX_VK_MMA_WMMA16_FUSE=1` (on — halves compile time and boosts FPS), `RX_VK_MMA_WMMA16_FAST=0` (off — exact `K=8` midpoint rounding matching Ampere `HMMA.16816.F16` as the safe default, with `=1` opt-in for an extra +0.5–0.8 FPS). Setup: Windows 11 (26200), AMD Radeon 860M (`1002:1114`, Adrenalin `26.10.1 LLPC`), Kokiri Forest Child (`1600×1000` docked, 3×20 s interleaved runs per mode for `100%`/`75%`/`67%`, 1×12 s for `58%`/`50%`/`33%`), unprofiled FPS + `RX_VK_PASS_TIMING=1` GPU spans. *(Measured on `main @ 89c3d21` vs the identical WMMA16/shader code prior to the 2-line default-dispatch unlock in `0f38b3c`, using `RX_VK_TAAU_KEYS=-` and `RX_VK_NETWORK_KEEP=all`. After rebasing onto `main @ 9dd41326` (`5b3a1235`), the default-env smoke test confirmed WMMA16 activation and `75%`/`67%` AI dispatch. The measurements predate the final subgroup and probe guards.)* **1600×1000 Kokiri Forest (Interleaved Medians):** | Scale & Mode | Before: main @ 89c3d21 | After, FAST=0 (default): this PR @ 0f38b3c | After, RX_VK_MMA_WMMA16_FAST=1: this PR @ 0f38b3c | Before, AMD FSR 3.1 (unchanged): main @ 89c3d21 | |---|---|---|---|---| | **100% Native (`9dc98871` AI)** | **28.89 FPS** (`28.4 ms` GPU, `4,975 µs` NN) | **31.57 FPS** (`25.3 ms`, `2,172 µs` NN, **+9.3%**) | **32.35 FPS** (`24.7 ms`, `1,809 µs` NN, **+12.0%**) | — | | **75% AI (`fd029a31`) vs `main` FXAA stand-in** | 36.93 FPS (`20.0 ms`, *non-AI FXAA*) / 32.63 FPS (*real AI Loop*) | **35.30 FPS** (`21.4 ms`, `1,622 µs` NN) | **35.78 FPS** (`21.0 ms`, `1,323 µs` NN) | 32.40 FPS (`23.6 ms`) | | **67% AI (`66766196`) vs `main` linear fallback** | 37.95 FPS (`19.0 ms`, *non-AI linear*) | — | **36.45 FPS** (`20.8 ms`, `1,589 µs` NN) | 33.71 FPS (`22.1 ms`) | | **58% AI (`f10782f9`) vs `main` linear fallback** | 38.97 FPS (`18.4 ms`, *non-AI linear*, 1×12s) | — | **38.05 FPS** (`19.4 ms`, `1,610 µs` NN, 1×12s) | 35.51 FPS (`21.2 ms`) | | **50% AI (`72ba090c`) vs `main` linear fallback** | 40.14 FPS (`17.6 ms`, *non-AI linear*, 1×12s) | — | **42.16 FPS** (`18.0 ms`, `1,603 µs` NN, 1×12s) | 39.90 FPS (`19.1 ms`) | | **33% AI (`0775215f`) vs `main` linear fallback** | 46.13 FPS (`15.2 ms`, *non-AI linear*, 1×12s) | — | **43.31 FPS** (`17.0 ms`, `1,457 µs` NN, 1×12s) | 41.68 FPS (`18.8 ms`) | | **Clean-cache compile (`100%`)** | `155.5 s` (`33.1 s` max pipe wait) | **`70.9 s` (`1.3 s` max pipe wait)** | **`71.8 s` (`1.3 s` max pipe wait)** | — | ### Resolution Scaling (`1280×800`, `1920×1080`, `1920×1200` — `RX_VK_MMA_WMMA16_FAST=1`) | Resolution & Scale | Before: main @ 89c3d21 | After, RX_VK_MMA_WMMA16_FAST=1: this PR @ 0f38b3c | Before, AMD FSR 3.1 (unchanged): main @ 89c3d21 | |---|---|---|---| | `1280×800` `100%` | 32.47 FPS (`3.12 ms` NN) | **34.34 FPS** (`1.16 ms` NN, **+5.8%**) | — | | `1280×800` `75%` | 38.53 FPS *(FXAA stand-in)* | **38.55 FPS** (`0.84 ms` NN, parity w/ FXAA) | 35.36 FPS | | `1920×1080` `100%` | 25.20 FPS (`6.59 ms` NN) | **29.51 FPS** (`2.39 ms` NN, **+17.1%**) | — | | `1920×1200` `100%` | 24.66 FPS (`7.26 ms` NN) | **28.09 FPS** (`2.70 ms` NN, **+13.9%**) | — | | `1920×1200` `75%` | 35.60 FPS *(FXAA stand-in)* | **34.21 FPS** (`1.95 ms` NN) | 29.80 FPS (**+14.8% vs FSR**) | | `1920×1200` `50%` | 39.29 FPS *(linear fallback)* | **37.73 FPS** (`1.81 ms` NN) | 34.53 FPS (**+9.3% vs FSR**) | --- ## Risks - **Small FPS drop on sub-native scales vs `main`'s non-AI workaround:** Players on AMD RDNA 3/3.5/4 using `75%` (Auto) or `67%`–`33%` with the in-game upscaler will see ~1–3 FPS lower framerates than `main`'s non-AI FXAA/linear stand-in, in exchange for dramatically sharper Switch 2 AI reconstruction. Players can choose **Off** on the Upscaler row and a smaller Render resolution for linear scaling, or restore the old non-AI stand-ins with `RX_VK_MMA_WMMA16=0` (or `RX_VK_TAAU_KEYS=fd029a317a9a4b94` for 75% only). - **Driver / hardware matrix:** Tested on RDNA 3.5 Windows `LLPC` and RDNA 3 Linux `RADV` on earlier revisions; RDNA 4 Windows `LLPC` and a Linux `RADV` re-run remain to be tested. If a driver fails the startup 256-element `test_multiply_wmma16()` probe, it automatically falls back to the existing software path. - **Shader cache:** `translator_stamp()` adds new flag bits (`32768u`/`65536u`/`131072u`), so RDNA 3/3.5/4 users will re-translate the AI upscaler shaders once on first launch after updating (much faster than `main`: ~1–2 s per upscaler pipeline). Saves and `longshot_options.ini` are untouched. --- ## 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). - [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. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [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.
Cards whose cooperative matrices offer only 16x16x16 f16 ran HMMA_nx2 in software. Sirit gains OpCooperativeMatrixStoreKHR and a Load with a memory operand; vk_coopmat.cpp probes the tile multiply; emit_spirv_warp.cpp defines DefineWmma16MatrixFunction; the program cache stamp and the network gate know mma_wmma16. tests/test_wmma16.py checks the wiring and the tile layout.

Assisted-by: GitHub Copilot
(cherry picked from commit e3993eb2a5)
Programs whose workgroup X width is not a multiple of 32, or devices without computeFullSubgroups, take the software multiply.

Assisted-by: GitHub Copilot
(cherry picked from commit 46b69fbe49)
Assisted-by: GitHub Copilot
(cherry picked from commit e443c6a1e5)
Assisted-by: GitHub Copilot
(cherry picked from commit c6062cd541)
Assisted-by: GitHub Copilot
(cherry picked from commit ea61eb49f3)
Assisted-by: GitHub Copilot
(cherry picked from commit 556ecd373c)
Wmma16Fits says where DefineWmma16MatrixFunction takes the tiles; the network gate keeps a program on AMD only there, instead of letting EmitSPIRV compile the software multiply the gate leaves out.

Assisted-by: GitHub Copilot
(cherry picked from commit 4e78026e8a)
feat(vk): fuse WMMA16 N-pairs on RDNA 3/3.5/4 and enable Switch 2 AI upscaling
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/linux+amd 2/1 fail
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
0f38b3c0c2
Stacked on closed PR #1038 (jcabarca). Fixes gfx11 v_wmma_f16 <=2^-22 subnormal zero-cancellation in test_multiply_wmma16 (upgraded to full 16x16 N-pair 256-element probe), adds DontInline N-pair [B0|B1] WMMA16 fusion (RX_VK_MMA_WMMA16_FUSE/FAST) decoupled for spirv-val CI, guards WMMA16 to RDNA 3/3.5/4 (!nan_bits), moves translator_stamp bits to 32768u/65536u/131072u, registers switches in switches.def, and unlocks all Wmma16Fits() Switch 2 AI upscaler scales (100%/75%/67%/58%/50%/33%) by default on RDNA 3/3.5/4.

Assisted-by: Antigravity
Author
Contributor

Tested in game: Windows 11 (26200), AMD Radeon 860M (1002:1114, RDNA 3.5 iGPU), Adrenalin 26.10.1 (LLPC), Kokiri Forest Child (1600x1000, 1280x800, 1920x1080, 1920x1200): verified all 6 Switch 2 AI upscaler networks (100%-33%) via fused WMMA16 with 256-element startup probe passing, +9.3% to +12.0% native FPS, -54% clean-cache compile time, and crisp AI reconstruction with zero artifacts.

Tested in game: Windows 11 (26200), AMD Radeon 860M (1002:1114, RDNA 3.5 iGPU), Adrenalin 26.10.1 (LLPC), Kokiri Forest Child (1600x1000, 1280x800, 1920x1080, 1920x1200): verified all 6 Switch 2 AI upscaler networks (100%-33%) via fused WMMA16 with 256-element startup probe passing, +9.3% to +12.0% native FPS, -54% clean-cache compile time, and crisp AI reconstruction with zero artifacts.
Member

Possibly related, for context:

  • PR #687 WIP: feat(vk): FXAA in place of the full-size anti-aliasing network where the GPU multiplies in software (RX_VK_TAAU_FULL_SIZE=1, off by default) — Open AMD software-multiply FXAA stand-in; this enables hardware AI upscaling instead.
Possibly related, for context: - PR #687 WIP: feat(vk): FXAA in place of the full-size anti-aliasing network where the GPU multiplies in software (RX_VK_TAAU_FULL_SIZE=1, off by default) — Open AMD software-multiply FXAA stand-in; this enables hardware AI upscaling instead.
Author
Contributor

1:1 Native Pixel Crop Comparison (Kokiri Forest 1600x1000, RCAS Sharpness 80%)

Kokiri Forest 1600x1000 1:1 native pixel crops comparing main FXAA/linear, PR WMMA16 AI, FSR 3.1, and 100% native

### 1:1 Native Pixel Crop Comparison (Kokiri Forest 1600x1000, RCAS Sharpness 80%) ![Kokiri Forest 1600x1000 1:1 native pixel crops comparing main FXAA/linear, PR WMMA16 AI, FSR 3.1, and 100% native](https://git.magicbean.dev/attachments/c05d2927-50f0-4d2b-a761-a65a2a472ac0)
Owner

Code looks good

@review
@beanstalk

Code looks good @review @beanstalk
Member
Beanstalk test farm · an earlier run: commit 0f38b3c (the newer results are in a comment below)

Commit 0f38b3c · approved by HumanBean (reviewed) · dashboard

⚠️ Note: An AMD target may select a GPU or driver without the required cooperative-matrix support; a missing WMMA activation line is unjudged rather than a failure.
⚠️ Note: Sub-native images are intentionally different from main's fallback, so the screenshot threshold cannot establish sharpness or guarantee absence of every artifact.
⚠️ Note: The plan samples two render settings rather than all six scales and does not compare the optional fast or unfused WMMA paths.

Summary, written by AI (gpt-6.1-terra) from the numbers below:

The change failed on Linux AMD on both tested PCs, with screenshot differences exceeding the limit. At resolution 0, the warm-cache image differences were 0.7044 and 0.7281 against a 0.15 limit; expected sub-native changes may need interpretation. Warm-cache frame time p99 increased from 17.721 to 18.055 ms (+1.9%) and from 25.375 to 26.282 ms (+3.6%), but both comparisons were inconclusive because there was only one usable start per side. Cold-cache runs began with 2 MB already cached, and both builds ran resolution 0 when resolution 9 was requested, limiting those results.

Done (started 09:40 UTC, last report 10:34 UTC). Comment @Beanstalk to run it again.

Target Result Reports VRAM peak (MB) Crashes
linux+amd ❌ fail (an outlier) 2 1 2 — none

forest-driver-cold · frame time p99 (ms), main → PR at each level

Target resolution=0 (reference) resolution=9
linux+amd 21.5 → 22.3 (+4%) —

forest-driver-warm · frame time p99 (ms), main → PR at each level

Target resolution=0 (reference) resolution=9
linux+amd 21.5 → 22.2 (+3%) —

Why it failed

  • linux+amd: forest-driver-cold · resolution=0 screenshot.max_diff: limit 0.1
  • linux+amd: forest-driver-warm · resolution=0 screenshot.max_diff: limit 0.1
What was tested

What will be tested · AI plan (gpt-6.1-terra)

On a Linux AMD PC, this plan compares main and the pull request in Kokiri Forest with cold and warm driver caches. It exercises two render-resolution settings because the changed neural upscaler depends on render scale, captures matched images, and measures frame times and shader preparation. Crashes, device loss, a large frame-time regression, or a substantial image difference fail the plan; expected sub-native image changes may need interpretation. The run takes roughly 21 minutes per tester.

  • Where: linux+amd (1-2 reports).
  • Matrix: 2 cells, each on main and the PR: resolution 0 or 9.
  • forest-driver-cold: from the repository's save kokiri-start (settings dlss=0, sharpness=80; each start with an empty driver shader cache, Linux only for now), then teleport to Kokiri Forest, take the picture forest-cold to compare with main, measure forest for 20 s (after 5 s warm-up); 1 run on each side for each of 2 cells (1 game start a run).
  • forest-driver-warm: from the repository's save kokiri-start (settings dlss=0, sharpness=80; each side's driver shader cache kept across its starts, filled first by an unmeasured start, Linux only for now), then teleport to Kokiri Forest, take the picture forest-warm to compare with main, measure forest for 20 s (after 5 s warm-up); 1 run on each side for each of 2 cells (1 game start a run).
  • Measured: crashes, frame times, stutters and hitches, shader preparation at start, the game's log (an expected line that never appears: could not be judged).
  • The PR fails if: it crashes; or a picture differs from main by more than 15%; or frame time (p99) is more than 40% above main; or forbidden log lines is above 0; or expected log lines missing is above 0.
  • Time: about 36 min of game runs per tester (6 game starts), plus the two builds.
Measurements on `linux+amd`, for the PR description

Verdict: fail on linux+amd (2 reports): forest-driver-cold screenshot.max_diff; forest-driver-warm screenshot.max_diff failed; 2 cells not compared (mismatch: what ran is not what the plan asked).

Hardware: 1: linux+amd+radv+dgpu AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7 AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM; 2: linux+amd+radv+igpu AMD Radeon 780M Graphics (RADV PHOENIX), 26.1.99 AMD Ryzen 7 7840HS w/ Radeon 780M Graphics, 24 GB RAM
Scene: forest-driver-cold, from the repository's save kokiri-start (dlss=0, sharpness=80); forest-driver-warm, from the repository's save kokiri-start (dlss=0, sharpness=80); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); forest-driver-cold: 1 game start a side, forest 20 s after 5 s warm-up; forest-driver-warm: 1 game start a side, forest 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Before: main @ 89c3d21 After: this PR @ 0f38b3c
forest-driver-cold · resolution=0 · forest · frame time (p99) (ms) 21.5 22.3 (+4%)
forest-driver-cold · resolution=0 · forbidden log lines 0.0 0.0
forest-driver-cold · resolution=0 · expected log lines missing 1.0 0.0 (−100%)
forest-driver-cold · resolution=9 · forest · frame time (p99) (ms) mismatch mismatch
forest-driver-cold · resolution=9 · forbidden log lines mismatch mismatch
forest-driver-cold · resolution=9 · expected log lines missing mismatch mismatch
forest-driver-warm · resolution=0 · forest · frame time (p99) (ms) 21.5 22.2 (+3%)
forest-driver-warm · resolution=0 · forbidden log lines 0.0 0.0
forest-driver-warm · resolution=0 · expected log lines missing 1.0 0.0 (−100%)
forest-driver-warm · resolution=9 · forest · frame time (p99) (ms) mismatch mismatch
forest-driver-warm · resolution=9 · forbidden log lines mismatch mismatch
forest-driver-warm · resolution=9 · expected log lines missing mismatch mismatch

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame time (p99)) Helps / doesn't help / untested
resolution menu setting 0, 9 main's default the PR's default forest-driver-cold, the PR at 0 → at 9: not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** fail on linux+amd (2 reports): `forest-driver-cold screenshot.max_diff`; `forest-driver-warm screenshot.max_diff` failed; 2 cells not compared (mismatch: what ran is not what the plan asked).

Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM`; 2: linux+amd+radv+igpu `AMD Radeon 780M Graphics (RADV PHOENIX), 26.1.99` `AMD Ryzen 7 7840HS w/ Radeon 780M Graphics, 24 GB RAM`  
Scene: forest-driver-cold, from the repository's save kokiri-start (dlss=0, sharpness=80); forest-driver-warm, from the repository's save kokiri-start (dlss=0, sharpness=80); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); forest-driver-cold: 1 game start a side, forest 20 s after 5 s warm-up; forest-driver-warm: 1 game start a side, forest 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

| | Before: main @ 89c3d21 | After: this PR @ 0f38b3c |
|---|---|---|
| forest-driver-cold · `resolution=0` · forest · frame time (p99) (ms) | 21.5 | 22.3 (+4%) |
| forest-driver-cold · `resolution=0` · forbidden log lines | 0.0 | 0.0 |
| forest-driver-cold · `resolution=0` · expected log lines missing | 1.0 | 0.0 (−100%) |
| forest-driver-cold · `resolution=9` · forest · frame time (p99) (ms) | mismatch | mismatch |
| forest-driver-cold · `resolution=9` · forbidden log lines | mismatch | mismatch |
| forest-driver-cold · `resolution=9` · expected log lines missing | mismatch | mismatch |
| forest-driver-warm · `resolution=0` · forest · frame time (p99) (ms) | 21.5 | 22.2 (+3%) |
| forest-driver-warm · `resolution=0` · forbidden log lines | 0.0 | 0.0 |
| forest-driver-warm · `resolution=0` · expected log lines missing | 1.0 | 0.0 (−100%) |
| forest-driver-warm · `resolution=9` · forest · frame time (p99) (ms) | mismatch | mismatch |
| forest-driver-warm · `resolution=9` · forbidden log lines | mismatch | mismatch |
| forest-driver-warm · `resolution=9` · expected log lines missing | mismatch | mismatch |

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `resolution` | menu setting | `0`, `9` | main's default | the PR's default | forest-driver-cold, the PR at 0 → at 9: not measured | untested |
The testers' hardware
Target Report Ran on
linux+amd 1 linux+amd+radv+dgpu AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7 AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM
linux+amd 2 linux+amd+radv+igpu AMD Radeon 780M Graphics (RADV PHOENIX), 26.1.99 AMD Ryzen 7 7840HS w/ Radeon 780M Graphics, 24 GB RAM
<!-- beanstalk:previous --> <details><summary>Beanstalk test farm · an earlier run: commit <code>0f38b3c</code> (the newer results are in a comment below)</summary> Commit `0f38b3c` · approved by HumanBean (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/2043) ⚠️ **Note:** An AMD target may select a GPU or driver without the required cooperative-matrix support; a missing WMMA activation line is unjudged rather than a failure. ⚠️ **Note:** Sub-native images are intentionally different from main's fallback, so the screenshot threshold cannot establish sharpness or guarantee absence of every artifact. ⚠️ **Note:** The plan samples two render settings rather than all six scales and does not compare the optional fast or unfused WMMA paths. > **Summary**, written by AI (`gpt-6.1-terra`) from the numbers below: > > The change failed on Linux AMD on both tested PCs, with screenshot differences exceeding the limit. At resolution 0, the warm-cache image differences were 0.7044 and 0.7281 against a 0.15 limit; expected sub-native changes may need interpretation. Warm-cache frame time p99 increased from 17.721 to 18.055 ms (+1.9%) and from 25.375 to 26.282 ms (+3.6%), but both comparisons were inconclusive because there was only one usable start per side. Cold-cache runs began with 2 MB already cached, and both builds ran resolution 0 when resolution 9 was requested, limiting those results. Done (started 09:40 UTC, last report 10:34 UTC). Comment `@Beanstalk` to run it again. | Target | Result | Reports | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | | `linux+amd` | ❌ fail (an outlier) | 2 [1](https://beanstalk.magicbean.dev/reports/rp_d887d308d2c8d328) [2](https://beanstalk.magicbean.dev/reports/rp_edf86a5ed84e0902) | — | none | **`forest-driver-cold`** · frame time p99 (ms), main → PR at each level | Target | `resolution=0` (reference) | `resolution=9` | | --- | --- | --- | | `linux+amd` | 21.5 → 22.3 (+4%) | — | **`forest-driver-warm`** · frame time p99 (ms), main → PR at each level | Target | `resolution=0` (reference) | `resolution=9` | | --- | --- | --- | | `linux+amd` | 21.5 → 22.2 (+3%) | — | **Why it failed** - `linux+amd`: `forest-driver-cold · resolution=0` `screenshot.max_diff`: `limit 0.1` - `linux+amd`: `forest-driver-warm · resolution=0` `screenshot.max_diff`: `limit 0.1` <details><summary>What was tested</summary> **What will be tested** · AI plan (`gpt-6.1-terra`) On a Linux AMD PC, this plan compares main and the pull request in Kokiri Forest with cold and warm driver caches. It exercises two render-resolution settings because the changed neural upscaler depends on render scale, captures matched images, and measures frame times and shader preparation. Crashes, device loss, a large frame-time regression, or a substantial image difference fail the plan; expected sub-native image changes may need interpretation. The run takes roughly 21 minutes per tester. - **Where:** linux+amd (1-2 reports). - **Matrix:** 2 cells, each on main and the PR: resolution `0` or `9`. - **forest-driver-cold:** from the repository's save `kokiri-start` (settings dlss=0, sharpness=80; each start with an empty driver shader cache, Linux only for now), then teleport to Kokiri Forest, take the picture forest-cold to compare with main, measure forest for 20 s (after 5 s warm-up); 1 run on each side for each of 2 cells (1 game start a run). - **forest-driver-warm:** from the repository's save `kokiri-start` (settings dlss=0, sharpness=80; each side's driver shader cache kept across its starts, filled first by an unmeasured start, Linux only for now), then teleport to Kokiri Forest, take the picture forest-warm to compare with main, measure forest for 20 s (after 5 s warm-up); 1 run on each side for each of 2 cells (1 game start a run). - **Measured:** crashes, frame times, stutters and hitches, shader preparation at start, the game's log (an expected line that never appears: could not be judged). - **The PR fails if:** it crashes; or a picture differs from main by more than 15%; or frame time (p99) is more than 40% above main; or forbidden log lines is above 0; or expected log lines missing is above 0. - **Time:** about 36 min of game runs per tester (6 game starts), plus the two builds. </details> <details><summary>Measurements on `linux+amd`, for the PR description</summary> **Verdict:** fail on linux+amd (2 reports): `forest-driver-cold screenshot.max_diff`; `forest-driver-warm screenshot.max_diff` failed; 2 cells not compared (mismatch: what ran is not what the plan asked). Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM`; 2: linux+amd+radv+igpu `AMD Radeon 780M Graphics (RADV PHOENIX), 26.1.99` `AMD Ryzen 7 7840HS w/ Radeon 780M Graphics, 24 GB RAM` Scene: forest-driver-cold, from the repository's save kokiri-start (dlss=0, sharpness=80); forest-driver-warm, from the repository's save kokiri-start (dlss=0, sharpness=80); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); forest-driver-cold: 1 game start a side, forest 20 s after 5 s warm-up; forest-driver-warm: 1 game start a side, forest 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 89c3d21 | After: this PR @ 0f38b3c | |---|---|---| | forest-driver-cold · `resolution=0` · forest · frame time (p99) (ms) | 21.5 | 22.3 (+4%) | | forest-driver-cold · `resolution=0` · forbidden log lines | 0.0 | 0.0 | | forest-driver-cold · `resolution=0` · expected log lines missing | 1.0 | 0.0 (−100%) | | forest-driver-cold · `resolution=9` · forest · frame time (p99) (ms) | mismatch | mismatch | | forest-driver-cold · `resolution=9` · forbidden log lines | mismatch | mismatch | | forest-driver-cold · `resolution=9` · expected log lines missing | mismatch | mismatch | | forest-driver-warm · `resolution=0` · forest · frame time (p99) (ms) | 21.5 | 22.2 (+3%) | | forest-driver-warm · `resolution=0` · forbidden log lines | 0.0 | 0.0 | | forest-driver-warm · `resolution=0` · expected log lines missing | 1.0 | 0.0 (−100%) | | forest-driver-warm · `resolution=9` · forest · frame time (p99) (ms) | mismatch | mismatch | | forest-driver-warm · `resolution=9` · forbidden log lines | mismatch | mismatch | | forest-driver-warm · `resolution=9` · expected log lines missing | mismatch | mismatch | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `resolution` | menu setting | `0`, `9` | main's default | the PR's default | forest-driver-cold, the PR at 0 → at 9: not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** fail on linux+amd (2 reports): `forest-driver-cold screenshot.max_diff`; `forest-driver-warm screenshot.max_diff` failed; 2 cells not compared (mismatch: what ran is not what the plan asked). Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM`; 2: linux+amd+radv+igpu `AMD Radeon 780M Graphics (RADV PHOENIX), 26.1.99` `AMD Ryzen 7 7840HS w/ Radeon 780M Graphics, 24 GB RAM` Scene: forest-driver-cold, from the repository's save kokiri-start (dlss=0, sharpness=80); forest-driver-warm, from the repository's save kokiri-start (dlss=0, sharpness=80); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); forest-driver-cold: 1 game start a side, forest 20 s after 5 s warm-up; forest-driver-warm: 1 game start a side, forest 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) | | Before: main @ 89c3d21 | After: this PR @ 0f38b3c | |---|---|---| | forest-driver-cold · `resolution=0` · forest · frame time (p99) (ms) | 21.5 | 22.3 (+4%) | | forest-driver-cold · `resolution=0` · forbidden log lines | 0.0 | 0.0 | | forest-driver-cold · `resolution=0` · expected log lines missing | 1.0 | 0.0 (−100%) | | forest-driver-cold · `resolution=9` · forest · frame time (p99) (ms) | mismatch | mismatch | | forest-driver-cold · `resolution=9` · forbidden log lines | mismatch | mismatch | | forest-driver-cold · `resolution=9` · expected log lines missing | mismatch | mismatch | | forest-driver-warm · `resolution=0` · forest · frame time (p99) (ms) | 21.5 | 22.2 (+3%) | | forest-driver-warm · `resolution=0` · forbidden log lines | 0.0 | 0.0 | | forest-driver-warm · `resolution=0` · expected log lines missing | 1.0 | 0.0 (−100%) | | forest-driver-warm · `resolution=9` · forest · frame time (p99) (ms) | mismatch | mismatch | | forest-driver-warm · `resolution=9` · forbidden log lines | mismatch | mismatch | | forest-driver-warm · `resolution=9` · expected log lines missing | mismatch | mismatch | **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `resolution` | menu setting | `0`, `9` | main's default | the PR's default | forest-driver-cold, the PR at 0 → at 9: not measured | untested | ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `linux+amd` | [1](https://beanstalk.magicbean.dev/reports/rp_d887d308d2c8d328) | linux+amd+radv+dgpu `AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7` `AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAM` | | `linux+amd` | [2](https://beanstalk.magicbean.dev/reports/rp_edf86a5ed84e0902) | linux+amd+radv+igpu `AMD Radeon 780M Graphics (RADV PHOENIX), 26.1.99` `AMD Ryzen 7 7840HS w/ Radeon 780M Graphics, 24 GB RAM` | </details> </details>
Jer9 force-pushed feat/wmma16-fused from 0f38b3c0c2
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/linux+amd 2/1 fail
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
to 5b3a123567
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 7s
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
2026-11-21 11:14:31 +00:00
Compare
Member

Beanstalk test farm

Commit f0de22e · approved by nobody yet · dashboard

A member of BigBeans can review this commit and comment @Beanstalk to test it.

<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `f0de22e` · approved by nobody yet · [dashboard](https://beanstalk.magicbean.dev/prs/2043) A member of `BigBeans` can review this commit and comment `@Beanstalk` to test it.
Jer9 changed title from WIP: feat(vk): enable Switch 2 AI upscaler on AMD RDNA 3/3.5/4 via fused 16x16x16 WMMA (+9-12% native FPS, sharper in-game upscaling) to feat(vk): enable Switch 2 AI upscaler on AMD RDNA 3/3.5/4 via fused 16x16x16 WMMA (+9-12% native FPS, sharper in-game upscaling) 2026-11-21 11:41:31 +00:00
Author
Contributor

Thanks for the review and Beanstalk run! Updated and marked ready for review on 5b3a1235:

  1. Rebased onto current main (9dd41326): Cleanly resolved the device_policy.h / switches.def merge with #1839 (is_rdna4 PCI ID matching preserved; test_device_policy.py passes including the new R9700 rows).
  2. Earlier Beanstalk linux+amd run on 0f38b3c (RX 7900 XTX RADV & Radeon 780M RADV): Both RDNA 3 Linux RADV machines activated WMMA16 (log_expected_missing: 1 -> 0), had 0 crashes, 0 forbidden log lines, and rendered clean, artifact-free frames. The 0.71/0.72 screenshot.max_diff was solely because stale main @ 89c3d21 lacked the teleport retry fixes (d6ac4628 / e9e2edc6), so one side stayed in Link's House while the other teleported to Kokiri Forest. Rebasing onto 9dd41326 pulls both teleport fixes in.
  3. Default-env Radeon 860M smoke test on 5b3a1235: Rebuilt full game + longshot_vk.dll (250/250 renderer files, 0 failed) and booted kokiri-start with zero WMMA/TAAU/network env overrides. Log confirmed vk: native matrix multiplies on (WMMA 16x16x16 through workgroup tiles, fused, exact K=8), 75% (fd029a317a9a4b94, 34.4 FPS) and 67% (6676619641320ba7, compiled in 1.89 s, 40.1 FPS) both dispatched automatically with zero VK_ERROR.
  4. Tests on 5b3a1235: All PR-relevant tests (test_wmma16.py, test_device_policy.py, test_switch_table.py, test_coopmat_probe_failures.py, test_program_stamp_knobs.py, test_translator_stamp_text.py, test_shader_stamp_inputs.py, test_shader_stamp_cache.py, test_doc_anchors.py, test_utf8_paths.py, test_check_pr_description.py, scripts/check_third_party.py, and all 4 gpu/vk/tests/ C++ tests) pass locally.

Ready for CI + a fresh Beanstalk approval on 5b3a1235 (AMD RDNA 3/4 Linux RADV, RDNA 4 Windows LLPC, and Steam Deck RDNA 2 guard check).

Thanks for the review and Beanstalk run! Updated and marked ready for review on `5b3a1235`: 1. **Rebased onto current `main` (`9dd41326`):** Cleanly resolved the `device_policy.h` / `switches.def` merge with `#1839` (`is_rdna4` PCI ID matching preserved; `test_device_policy.py` passes including the new R9700 rows). 2. **Earlier Beanstalk `linux+amd` run on `0f38b3c` (RX 7900 XTX RADV & Radeon 780M RADV):** Both RDNA 3 Linux RADV machines **activated WMMA16** (`log_expected_missing: 1 -> 0`), had **0 crashes**, **0 forbidden log lines**, and rendered clean, artifact-free frames. The `0.71`/`0.72` `screenshot.max_diff` was solely because stale `main @ 89c3d21` lacked the teleport retry fixes (`d6ac4628` / `e9e2edc6`), so one side stayed in Link's House while the other teleported to Kokiri Forest. Rebasing onto `9dd41326` pulls both teleport fixes in. 3. **Default-env Radeon 860M smoke test on `5b3a1235`:** Rebuilt full game + `longshot_vk.dll` (`250/250` renderer files, `0` failed) and booted `kokiri-start` with zero WMMA/TAAU/network env overrides. Log confirmed `vk: native matrix multiplies on (WMMA 16x16x16 through workgroup tiles, fused, exact K=8)`, `75%` (`fd029a317a9a4b94`, `34.4 FPS`) and `67%` (`6676619641320ba7`, compiled in `1.89 s`, `40.1 FPS`) both dispatched automatically with zero `VK_ERROR`. 4. **Tests on `5b3a1235`:** All PR-relevant tests (`test_wmma16.py`, `test_device_policy.py`, `test_switch_table.py`, `test_coopmat_probe_failures.py`, `test_program_stamp_knobs.py`, `test_translator_stamp_text.py`, `test_shader_stamp_inputs.py`, `test_shader_stamp_cache.py`, `test_doc_anchors.py`, `test_utf8_paths.py`, `test_check_pr_description.py`, `scripts/check_third_party.py`, and all 4 `gpu/vk/tests/` C++ tests) pass locally. Ready for CI + a fresh Beanstalk approval on `5b3a1235` (AMD RDNA 3/4 Linux RADV, RDNA 4 Windows LLPC, and Steam Deck RDNA 2 guard check).
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The WMMA path can run without the required 32-lane subgroup and can accept invalid probe results. It also enables the path on non-AMD devices despite the stated hardware scope; the sub-native image-quality versus frame-rate tradeoff needs a maintainer decision.

The change accelerates native-resolution neural upscaling on the tested Radeon 860M and enables neural reconstruction at lower scales. It adds a sizeable shader translation path and trades some sub-native frame rate for sharper output.

@fix will do (5)

  1. L1 gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_warp.cpp:660: The fit check assumes a multiple-of-32 X dimension guarantees 32-lane subgroups, but pin_subgroup declines to pin when total invocations exceed 32 times maxComputeWorkgroupSubgroups. (more on the line)
  2. L2 gpu/vk/vk_coopmat.cpp:433: A NaN result passes this comparison because comparisons with NaN are false. (more on the line)
  3. L3 gpu/vk/vk_coopmat.cpp:633: The vendor guard rejects unsupported AMD devices but allows every non-AMD device through. (more on the line)
  4. L4 tests/test_wmma16_spirv_val.py:189: The SPIR-V fixture extracts only the single-multiply function, while fusion is enabled by default and emits a separate helper and planner. (more on the line)
  5. L5 (its part an edit can do) gpu/vk/vk_shader.cpp:1538: Preserve an explicit, accessible non-AI alternative while enabling the neural path.

Before merging, for the author (2) (a run, a measurement or a decision; it doesn't hold the recommendation)

  • L5 (minor) gpu/vk/vk_shader.cpp:1538: Enabling the neural networks changes the default at sub-native scales: the reported 75% result falls from 36.93 to 35.30 FPS and the 67% fast-mode result from 37.95 to 36.45 FPS, in exchange for sharper reconstruction. (more on the line)
  • L6 (minor) gpu/vk/switches.def:540: The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. (more on the line)

Checks: Still running: CI / Conventional Commit title (pull_request), CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request), CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request), CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request), CI / Workflow lint (actionlint) (pull_request), CI / Website build and checks (pull_request), Guide screenshots / Guide images and local UI source review (pull_request), Third-party parts / As their notes say (pull_request), Third-party parts / The same as upstream (pull_request), Website / Website on Cloudflare (pull_request).

More: does it help, other systems, switches, what was read

Does it help: Yes on the tested Radeon 860M at native resolution: the PR reports three interleaved runs with median FPS rising from 28.89 to 31.57 at the default, and neural-pass time falling from 4.975 to 2.172 ms. Those measurements use an earlier base and branch revision; the head received a smoke test, not a matching A/B. Default-mode results, frame-time tails and heavy-area results are missing for several scales.

Other systems: The path changes cooperative-matrix translation and network selection, not only one upscaler shader. RDNA 3 Linux had an earlier-head smoke run; RDNA 4 Windows and Linux, Steam Deck, NVIDIA and Intel head checks remain outstanding. Non-AMD devices exposing only the 16x16x16 shape can currently enter the new path. The PR reports no save or settings changes.

Switches: Adds RX_VK_MMA_WMMA16, default on for eligible devices; RX_VK_MMA_WMMA16_FUSE, default on; and RX_VK_MMA_WMMA16_FAST, default off. All have switch-table rows. The hardware defaults need the outstanding platform measurements; the implementation currently enables WMMA16 beyond the documented AMD scope.

Reviewed: 5b3a123567 against 9dd41326e7: Read the repository instructions, contribution rules, PR template, relevant standards, commit messages, diff, WMMA emitter and probe changes, new tests, and surrounding subgroup and network-selection code. Skimmed the other changed declarations, Sirit changes and policy test. The requested docs/review-checklist.md and adjacent Tooling checkout were absent. Did not read every changed code file in full.; nothing run (a code review).

Checked and fine:

  • The new switch names have entries in switches.def and the translator stamp distinguishes the three WMMA modes.
  • The listed commits include AI-assistance trailers.
  • No game-derived files or generated shader headers appear among the changed files.

Testing: Read-only review; no build, tests, scripts or game runs were executed. The supplied CI checks are still running.

Overlaps and merge order: The description identifies closed PR #1038 as the source of the earlier commits; no open overlapping pull requests were available to inspect.


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

**Recommendation: Request changes.** The WMMA path can run without the required 32-lane subgroup and can accept invalid probe results. It also enables the path on non-AMD devices despite the stated hardware scope; the sub-native image-quality versus frame-rate tradeoff needs a maintainer decision. The change accelerates native-resolution neural upscaling on the tested Radeon 860M and enables neural reconstruction at lower scales. It adds a sizeable shader translation path and trades some sub-native frame rate for sharper output. **`@fix` will do (5)** 1. **L1** `gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_warp.cpp:660`: The fit check assumes a multiple-of-32 X dimension guarantees 32-lane subgroups, but pin_subgroup declines to pin when total invocations exceed 32 times maxComputeWorkgroupSubgroups. (more on the line) 2. **L2** `gpu/vk/vk_coopmat.cpp:433`: A NaN result passes this comparison because comparisons with NaN are false. (more on the line) 3. **L3** `gpu/vk/vk_coopmat.cpp:633`: The vendor guard rejects unsupported AMD devices but allows every non-AMD device through. (more on the line) 4. **L4** `tests/test_wmma16_spirv_val.py:189`: The SPIR-V fixture extracts only the single-multiply function, while fusion is enabled by default and emits a separate helper and planner. (more on the line) 5. **L5** (its part an edit can do) `gpu/vk/vk_shader.cpp:1538`: Preserve an explicit, accessible non-AI alternative while enabling the neural path. **Before merging, for the author (2)** (a run, a measurement or a decision; it doesn't hold the recommendation) - **L5** (minor) `gpu/vk/vk_shader.cpp:1538`: Enabling the neural networks changes the default at sub-native scales: the reported 75% result falls from 36.93 to 35.30 FPS and the 67% fast-mode result from 37.95 to 36.45 FPS, in exchange for sharper reconstruction. (more on the line) - **L6** (minor) `gpu/vk/switches.def:540`: The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. (more on the line) **Checks:** Still running: `CI / Conventional Commit title (pull_request)`, `CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request)`, `CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request)`, `CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request)`, `CI / Workflow lint (actionlint) (pull_request)`, `CI / Website build and checks (pull_request)`, `Guide screenshots / Guide images and local UI source review (pull_request)`, `Third-party parts / As their notes say (pull_request)`, `Third-party parts / The same as upstream (pull_request)`, `Website / Website on Cloudflare (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the tested Radeon 860M at native resolution: the PR reports three interleaved runs with median FPS rising from 28.89 to 31.57 at the default, and neural-pass time falling from 4.975 to 2.172 ms. Those measurements use an earlier base and branch revision; the head received a smoke test, not a matching A/B. Default-mode results, frame-time tails and heavy-area results are missing for several scales. **Other systems:** The path changes cooperative-matrix translation and network selection, not only one upscaler shader. RDNA 3 Linux had an earlier-head smoke run; RDNA 4 Windows and Linux, Steam Deck, NVIDIA and Intel head checks remain outstanding. Non-AMD devices exposing only the 16x16x16 shape can currently enter the new path. The PR reports no save or settings changes. **Switches:** Adds RX_VK_MMA_WMMA16, default on for eligible devices; RX_VK_MMA_WMMA16_FUSE, default on; and RX_VK_MMA_WMMA16_FAST, default off. All have switch-table rows. The hardware defaults need the outstanding platform measurements; the implementation currently enables WMMA16 beyond the documented AMD scope. **Reviewed:** 5b3a12356772 against 9dd41326e710: Read the repository instructions, contribution rules, PR template, relevant standards, commit messages, diff, WMMA emitter and probe changes, new tests, and surrounding subgroup and network-selection code. Skimmed the other changed declarations, Sirit changes and policy test. The requested docs/review-checklist.md and adjacent Tooling checkout were absent. Did not read every changed code file in full.; nothing run (a code review). **Checked and fine:** - The new switch names have entries in switches.def and the translator stamp distinguishes the three WMMA modes. - The listed commits include AI-assistance trailers. - No game-derived files or generated shader headers appear among the changed files. **Testing:** Read-only review; no build, tests, scripts or game runs were executed. The supplied CI checks are still running. **Overlaps and merge order:** The description identifies closed PR #1038 as the source of the earlier commits; no open overlapping pull requests were available to inspect. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -650,0 +657,4 @@
// (only where every subgroup is full: the cooperative matrix operations and the subgroup barriers then run with all
// 32 lanes, as the startup test checked them. Otherwise the software multiply)
if (!mma_wmma16_full_subgroups || program.workgroup_size[0] == 0 || program.workgroup_size[0] % 32 != 0) return false;
const u32 threads = std::max(1U, program.workgroup_size[0] * program.workgroup_size[1] * program.workgroup_size[2]);
Member

L1: The fit check assumes a multiple-of-32 X dimension guarantees 32-lane subgroups, but pin_subgroup declines to pin when total invocations exceed 32 times maxComputeWorkgroupSubgroups. Such a workgroup can therefore use a larger native subgroup while this code indexes tiles and lanes as 32-wide, producing incorrect results or out-of-bounds tile accesses. Gate WMMA on the same pinning limit and actual pipeline pin decision, and test a workgroup above that limit.

**L1**: The fit check assumes a multiple-of-32 X dimension guarantees 32-lane subgroups, but pin_subgroup declines to pin when total invocations exceed 32 times maxComputeWorkgroupSubgroups. Such a workgroup can therefore use a larger native subgroup while this code indexes tiles and lanes as 32-wide, producing incorrect results or out-of-bounds tile accesses. Gate WMMA on the same pinning limit and actual pipeline pin decision, and test a workgroup above that limit.
@ -537,6 +537,9 @@ SW(RX_VK_MMA_C_ORDER, diag, string, "the element order measured on the GPU at st
SW(RX_VK_MMA_NO_COOP, attempt, bool, "off (cooperative matrices used when the device has them)", "1 pretends the device has no cooperative matrices, so the software multiplies are used.")
SW(RX_VK_MMA_SOFTWARE, attempt, bool, "off (native cooperative matrices where the device has and passes them)", "1 forces the upscale networks' matrix multiplies into a software shader function, with no cooperative matrices.")
SW(RX_VK_MMA_UNROLL, hw, bool, "on for Mesa RADV and AMD RDNA 4 on AMD's proprietary driver, off (the loop) elsewhere; only where matrix multiplies run in software", "0 keeps the looped software matrix multiply, 1 tries the unrolled forms on any GPU.")
SW(RX_VK_MMA_WMMA16, attempt, bool, "on for AMD RDNA 3/3.5/4 where 16x16x16 cooperative matrices and full 32-lane compute subgroups pass", "0 disables the 16x16x16 WMMA workgroup-tile path and falls back to software matrix multiplies.")
Member

L6 (minor): The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. Measure the default on the affected Tier 1 hardware and include frame-time tails and representative heavy scenes before settling the default.

**L6** (minor): The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. Measure the default on the affected Tier 1 hardware and include frame-time tails and representative heavy scenes before settling the default.
@ -349,0 +430,4 @@
const float got = from_half((uint16_t)(e & 1 ? w >> 16 : w & 0xffff));
// (RDNA 3/3.5 gfx11 v_wmma_f16 can leave a <=2^-22 f16 subnormal residual on exact cancellation to 0;
// any layout or tile bug is off by >= 1.0 on these integer inputs, so 1e-4 catches every wrong lane)
if (std::fabs(got - want_d) > 1e-4f && bad++ < 4)
Member

L2: A NaN result passes this comparison because comparisons with NaN are false. A driver returning NaNs for some or all probe elements can consequently be marked supported and run broken neural shaders. Reject non-finite results explicitly and cover that failure in the probe test.

**L2**: A NaN result passes this comparison because comparisons with NaN are false. A driver returning NaNs for some or all probe elements can consequently be marked supported and run broken neural shaders. Reject non-finite results explicitly and cover that failure in the probe test.
@ -537,0 +630,4 @@
software_multiplies("RX_VK_MMA_WMMA16=0");
return;
}
if (dev.props.vendorID == 0x1002 && (dev.policy.nan_bits || !(dev.facts.rdna3() || dev.facts.rdna4()))) {
Member

L3: The vendor guard rejects unsupported AMD devices but allows every non-AMD device through. An Intel or NVIDIA device that exposes 16x16x16 but not 16x8x16 can thus activate this unmeasured path and change network selection, contrary to the stated scope. Require AMD as well as RDNA 3 or 4 before enabling it, unless those other devices are deliberately supported and tested.

**L3**: The vendor guard rejects unsupported AMD devices but allows every non-AMD device through. An Intel or NVIDIA device that exposes 16x16x16 but not 16x8x16 can thus activate this unmeasured path and change network selection, contrary to the stated scope. Require AMD as well as RDNA 3 or 4 before enabling it, unless those other devices are deliberately supported and tested.
@ -1536,1 +1536,3 @@
if ((!kept_one && (Shader::Backend::SPIRV::mma_software || dev.policy.networks_left_out)) || env_on("RX_VK_NO_F16") || !dev.vk12.shaderFloat16)
// (device_policy.h networks_left_out: every vendor but NVIDIA; and where the multiplies run in software, whoever made the GPU;
// kept where the WMMA 16x16x16 tiles run them: Wmma16Fits, or EmitSPIRV would compile the software multiply)
if ((!kept_one && (Shader::Backend::SPIRV::mma_software || (dev.policy.networks_left_out && !(Shader::Backend::SPIRV::mma_wmma16 && Shader::Backend::SPIRV::Wmma16Fits(profile_pinned(), t->program))))) || env_on("RX_VK_NO_F16") || !dev.vk12.shaderFloat16)
Member

L5 (minor): Enabling the neural networks changes the default at sub-native scales: the reported 75% result falls from 36.93 to 35.30 FPS and the 67% fast-mode result from 37.95 to 36.45 FPS, in exchange for sharper reconstruction. A maintainer should decide whether that tradeoff is right for players who selected those scales for performance.

**L5** (minor): Enabling the neural networks changes the default at sub-native scales: the reported 75% result falls from 36.93 to 35.30 FPS and the 67% fast-mode result from 37.95 to 36.45 FPS, in exchange for sharper reconstruction. A maintainer should decide whether that tradeoff is right for players who selected those scales for performance.
@ -0,0 +186,4 @@
raise SystemExit("FAIL: emit_spirv_warp.cpp has no DefineWmma16MatrixFunction")
if "bool Wmma16Fits(" not in warp:
raise SystemExit("FAIL: emit_spirv_warp.cpp has no Wmma16Fits")
fixture = FIXTURE.replace("@@FUNCTION@@", block(warp, "bool Wmma16Fits(") + "\n" + block(warp, marker))
Member

L4: The SPIR-V fixture extracts only the single-multiply function, while fusion is enabled by default and emits a separate helper and planner. Invalid SPIR-V or incorrect dependency handling in the default fused path can pass both new tests. Add a behavioral fixture that emits and validates fused pairs, including dependent and unpairable instructions.

**L4**: The SPIR-V fixture extracts only the single-multiply function, while fusion is enabled by default and emits a separate helper and planner. Invalid SPIR-V or incorrect dependency handling in the default fused path can pass both new tests. Add a behavioral fixture that emits and validates fused pairs, including dependent and unpairable instructions.
Owner
@fix
BeanBot force-pushed feat/wmma16-fused from 5b3a123567
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 7s
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
to d14c84687b
Some checks failed
beanstalk/approval not approved yet
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
PR description / Description follows the template (pull_request_target) Has been cancelled
CI / Conventional Commit title (pull_request) Successful in 13s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
CI / Workflow lint (actionlint) (pull_request) Successful in 23s
Third-party parts / As their notes say (pull_request) Successful in 25s
CI / Website build and checks (pull_request) Has been cancelled
2026-11-21 17:11:26 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The neural default trades sub-native performance for image quality, and a maintainer has not yet settled that tradeoff. Default-mode measurements on the affected hardware, including frame-time tails and heavy scenes, are also outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is d14c84687b. I rebased it onto main (f8c130b143). I edited its description to match the change.

Changed

  • WMMA16 subgroup pinning: Gated compute tiles on the subgroup limit and pinned profile, passed the actual workgroup size to the network gate, and added an above-limit fixture case in gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_warp.cpp:656 and tests/test_wmma16_spirv_val.py:170.
  • Non-finite probe results: Rejected non-finite results and added NaN and infinity checks in gpu/vk/vk_coopmat.cpp:50 and tests/test_coopmat_probe_failures.py:88.
  • AMD-only WMMA16: Required AMD and RDNA 3 or 4 in gpu/vk/vk_coopmat.cpp:637.
  • Fused SPIR-V fixture: tests/test_wmma16_spirv_val.py:171: The fixture now uses the production fusion planner and emitter, checks a deferred dependency chain and unpairable multiplies, and validates the emitted module. Tests were not run, as requested.

Changed in part (the rest is for the author)

  • Non-AI alternative: Documented the existing Graphics > Upscaler > Off linear option in docs/user/graphics-and-controls.md:209. The maintainer must decide whether the neural default’s performance and quality tradeoff is appropriate.

Nothing was built or run: the checks run again on the new head.

The change enables hardware-assisted neural upscaling on supported AMD GPUs. It improves native-resolution performance on the tested 860M and offers sharper sub-native reconstruction, at a reported sub-native FPS cost.

Before merging, for the author (2) (a run, a measurement or a decision; it doesn't hold the recommendation)

  • L5 (minor) gpu/vk/vk_shader.cpp:1538: The documented Off option provides a linear alternative, but a maintainer still needs to decide whether making neural reconstruction the default at sub-native scales is the right tradeoff for players selecting those scales for performance.
  • L6 (minor) gpu/vk/switches.def:540: The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. Measure the default on the affected Tier 1 hardware and include frame-time tails and representative heavy scenes before settling the default.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • The supplied base diff includes additional changes beyond the 15 files listed in the pull request description.
More: does it help, other systems, switches, what was read

Does it help: Yes on the tested Windows Radeon 860M: three interleaved runs reported 28.89 to 31.57 FPS at native resolution with the default, while 75% fell from 36.93 to 35.30 FPS. These measurements predate the final guards and do not establish frame-time tails or the default's cost on other affected hardware.

Other systems: The path is gated to supported AMD RDNA 3/3.5/4 devices with suitable cooperative matrices and full 32-lane compute subgroups. Earlier Linux RDNA 3 runs activated it without reported crashes; RDNA 4, the rebased Linux comparison, Steam Deck, NVIDIA and Intel checks remain outstanding.

Switches: RX_VK_MMA_WMMA16 defaults on for eligible devices; FUSE defaults on; FAST defaults off for midpoint rounding. All three have switch-table entries. The broad enabled default still awaits the hardware measurements and maintainer decision recorded in the ledger.

Reviewed: d14c84687b against f8c130b143: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the latest fixture diff, and the relevant WMMA fit, probe, network gate, switch and player-documentation sections. The remaining changed files and full base diff were not read in full; the recorded runs were reviewed from the supplied description and comments. docs/review-checklist.md is absent.; nothing run (a code review).

Checked and fine:

  • The player documentation describes the existing Off option and smaller render resolution as a linear alternative.
  • The network gate checks whether WMMA tiles fit using the pinned profile and actual workgroup size.
  • The startup probe rejects non-finite results.

Testing: No commands from the project were run. The author reports Windows 860M gameplay and source-test results, and earlier Linux RADV farm runs; CI has not run on this head.

Overlaps and merge order: The description identifies closed PR #1038 as prior work incorporated into this change; other overlaps were not checked.


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

**Recommendation: Approve.** The neural default trades sub-native performance for image quality, and a maintainer has not yet settled that tradeoff. Default-mode measurements on the affected hardware, including frame-time tails and heavy scenes, are also outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is d14c84687b64. I rebased it onto `main` (f8c130b1432a). I edited its description to match the change. **Changed** - **WMMA16 subgroup pinning**: Gated compute tiles on the subgroup limit and pinned profile, passed the actual workgroup size to the network gate, and added an above-limit fixture case in gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv_warp.cpp:656 and tests/test_wmma16_spirv_val.py:170. - **Non-finite probe results**: Rejected non-finite results and added NaN and infinity checks in gpu/vk/vk_coopmat.cpp:50 and tests/test_coopmat_probe_failures.py:88. - **AMD-only WMMA16**: Required AMD and RDNA 3 or 4 in gpu/vk/vk_coopmat.cpp:637. - **Fused SPIR-V fixture: tests/test_wmma16_spirv_val.py:171**: The fixture now uses the production fusion planner and emitter, checks a deferred dependency chain and unpairable multiplies, and validates the emitted module. Tests were not run, as requested. **Changed in part (the rest is for the author)** - **Non-AI alternative**: Documented the existing Graphics > Upscaler > Off linear option in docs/user/graphics-and-controls.md:209. The maintainer must decide whether the neural default’s performance and quality tradeoff is appropriate. Nothing was built or run: the checks run again on the new head. The change enables hardware-assisted neural upscaling on supported AMD GPUs. It improves native-resolution performance on the tested 860M and offers sharper sub-native reconstruction, at a reported sub-native FPS cost. **Before merging, for the author (2)** (a run, a measurement or a decision; it doesn't hold the recommendation) - **L5** (minor) `gpu/vk/vk_shader.cpp:1538`: The documented Off option provides a linear alternative, but a maintainer still needs to decide whether making neural reconstruction the default at sub-native scales is the right tradeoff for players selecting those scales for performance. - **L6** (minor) `gpu/vk/switches.def:540`: The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. Measure the default on the affected Tier 1 hardware and include frame-time tails and representative heavy scenes before settling the default. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The supplied base diff includes additional changes beyond the 15 files listed in the pull request description. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the tested Windows Radeon 860M: three interleaved runs reported 28.89 to 31.57 FPS at native resolution with the default, while 75% fell from 36.93 to 35.30 FPS. These measurements predate the final guards and do not establish frame-time tails or the default's cost on other affected hardware. **Other systems:** The path is gated to supported AMD RDNA 3/3.5/4 devices with suitable cooperative matrices and full 32-lane compute subgroups. Earlier Linux RDNA 3 runs activated it without reported crashes; RDNA 4, the rebased Linux comparison, Steam Deck, NVIDIA and Intel checks remain outstanding. **Switches:** RX_VK_MMA_WMMA16 defaults on for eligible devices; FUSE defaults on; FAST defaults off for midpoint rounding. All three have switch-table entries. The broad enabled default still awaits the hardware measurements and maintainer decision recorded in the ledger. **Reviewed:** d14c84687b64 against f8c130b1432a: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the latest fixture diff, and the relevant WMMA fit, probe, network gate, switch and player-documentation sections. The remaining changed files and full base diff were not read in full; the recorded runs were reviewed from the supplied description and comments. docs/review-checklist.md is absent.; nothing run (a code review). **Checked and fine:** - The player documentation describes the existing Off option and smaller render resolution as a linear alternative. - The network gate checks whether WMMA tiles fit using the pinned profile and actual workgroup size. - The startup probe rejects non-finite results. **Testing:** No commands from the project were run. The author reports Windows 860M gameplay and source-test results, and earlier Linux RADV farm runs; CI has not run on this head. **Overlaps and merge order:** The description identifies closed PR #1038 as prior work incorporated into this change; other overlaps were not checked. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
Owner
@fix
BeanBot force-pushed feat/wmma16-fused from d14c84687b
Some checks failed
beanstalk/approval not approved yet
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
PR description / Description follows the template (pull_request_target) Has been cancelled
CI / Conventional Commit title (pull_request) Successful in 13s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
CI / Workflow lint (actionlint) (pull_request) Successful in 23s
Third-party parts / As their notes say (pull_request) Successful in 25s
CI / Website build and checks (pull_request) Has been cancelled
to f0de22eaa3
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 / Workflow lint (actionlint) (pull_request) Successful in 1m19s
CI / Conventional Commit title (pull_request) Successful in 1m25s
PR description / Description follows the template (pull_request_target) Failing after 2m40s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 54s
Third-party parts / As their notes say (pull_request) Successful in 1m25s
beanstalk/approval not approved yet
CI / Website build and checks (pull_request) Successful in 7m27s
2026-11-21 17:43:53 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The neural default trades some sub-native performance for image quality, and its suitability still needs a maintainer decision and measurements across affected hardware. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is f0de22eaa3. I rebased it onto main (f836ca1d90).

Conflicts resolved

  • tests/test_wmma16.py: Updated the cache stamp check to match the resolved WMMA16 flag bits.
  • Also changed, beyond the conflict: tests/test_wmma16.py
  • gpu/vk/vk_shader.cpp: Kept the base branch’s stamp bits and assigned fusion a separate bit.
  • tests/test_wmma16.py: Kept the base branch’s stamp expectations and added the fusion bit expectation.

Nothing was built or run: the checks run again on the new head.

The change enables the game's neural upscaler on supported AMD RDNA 3, 3.5 and 4 GPUs. It improves native-scale performance in the reported 860M test, at the cost of lower FPS at several sub-native scales and added shader complexity.

Before merging, for the author (2) (a run, a measurement or a decision; it doesn't hold the recommendation)

  • L5 (minor) gpu/vk/vk_shader.cpp:1538: The documented Off option provides a linear alternative, but a maintainer still needs to decide whether making neural reconstruction the default at sub-native scales is the right tradeoff for players selecting those scales for performance.
  • L6 (minor) gpu/vk/switches.def:540: The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. Measure the default on the affected Tier 1 hardware and include frame-time tails and representative heavy scenes before settling the default.

Checks: they run again on this head (Guide screenshots / Guide images and local UI source review (pull_request) failed on the last one); a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • The pull request description lists the previous translator-stamp bit values; the current values are 65536, 131072 and 262144.
More: does it help, other systems, switches, what was read

Does it help: Yes on the reported Windows Radeon 860M test: native-scale median FPS rose from 28.89 to 31.57 with the default, and clean-cache compilation fell from 155.5 to 70.9 seconds. Those A/B measurements predate the final guards and rebase; default-mode frame-time tails, heavy scenes and other affected hardware remain unmeasured.

Other systems: The path is gated to supported AMD GPUs; the reported earlier Linux RDNA 3 runs activated it without crashes, but the rebased Linux run and RDNA 4 Windows test remain outstanding. Steam Deck, NVIDIA and Intel guard checks are also outstanding.

Switches: RX_VK_MMA_WMMA16 defaults on for qualifying AMD hardware; RX_VK_MMA_WMMA16_FUSE defaults on; RX_VK_MMA_WMMA16_FAST defaults off for exact midpoint rounding. The broader enabled default still needs the hardware measurements and decision recorded in L5 and L6.

Reviewed: f0de22eaa3 against f836ca1d90: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changed stamp and network-gate context, switch entries and relevant user documentation. Skimmed the rewritten range diff and test changes; the other changed code files were not read in full.; nothing run (a code review).

Checked and fine:

  • The changed translator-stamp flags use distinct bits from the existing strict-fmultiply flag.
  • The changed source test checks all three current WMMA16 stamp bits.

Testing: No commands from the project or tests were run. The author reports Windows 860M playtesting and earlier Linux RDNA 3 runs; CI has not run on this head.

Overlaps and merge order: none found


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

**Recommendation: Approve.** The neural default trades some sub-native performance for image quality, and its suitability still needs a maintainer decision and measurements across affected hardware. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is f0de22eaa30f. I rebased it onto `main` (f836ca1d9079). **Conflicts resolved** - tests/test_wmma16.py: Updated the cache stamp check to match the resolved WMMA16 flag bits. - Also changed, beyond the conflict: `tests/test_wmma16.py` - gpu/vk/vk_shader.cpp: Kept the base branch’s stamp bits and assigned fusion a separate bit. - tests/test_wmma16.py: Kept the base branch’s stamp expectations and added the fusion bit expectation. Nothing was built or run: the checks run again on the new head. The change enables the game's neural upscaler on supported AMD RDNA 3, 3.5 and 4 GPUs. It improves native-scale performance in the reported 860M test, at the cost of lower FPS at several sub-native scales and added shader complexity. **Before merging, for the author (2)** (a run, a measurement or a decision; it doesn't hold the recommendation) - **L5** (minor) `gpu/vk/vk_shader.cpp:1538`: The documented Off option provides a linear alternative, but a maintainer still needs to decide whether making neural reconstruction the default at sub-native scales is the right tradeoff for players selecting those scales for performance. - **L6** (minor) `gpu/vk/switches.def:540`: The default is enabled across RDNA 3, 3.5 and 4, but the reported A/B is from one Windows 860M; RDNA 4 and the rebased Linux runs remain outstanding. Measure the default on the affected Tier 1 hardware and include frame-time tails and representative heavy scenes before settling the default. **Checks:** they run again on this head (`Guide screenshots / Guide images and local UI source review (pull_request)` failed on the last one); a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The pull request description lists the previous translator-stamp bit values; the current values are 65536, 131072 and 262144. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the reported Windows Radeon 860M test: native-scale median FPS rose from 28.89 to 31.57 with the default, and clean-cache compilation fell from 155.5 to 70.9 seconds. Those A/B measurements predate the final guards and rebase; default-mode frame-time tails, heavy scenes and other affected hardware remain unmeasured. **Other systems:** The path is gated to supported AMD GPUs; the reported earlier Linux RDNA 3 runs activated it without crashes, but the rebased Linux run and RDNA 4 Windows test remain outstanding. Steam Deck, NVIDIA and Intel guard checks are also outstanding. **Switches:** RX_VK_MMA_WMMA16 defaults on for qualifying AMD hardware; RX_VK_MMA_WMMA16_FUSE defaults on; RX_VK_MMA_WMMA16_FAST defaults off for exact midpoint rounding. The broader enabled default still needs the hardware measurements and decision recorded in L5 and L6. **Reviewed:** f0de22eaa30f against f836ca1d9079: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the changed stamp and network-gate context, switch entries and relevant user documentation. Skimmed the rewritten range diff and test changes; the other changed code files were not read in full.; nothing run (a code review). **Checked and fine:** - The changed translator-stamp flags use distinct bits from the existing strict-fmultiply flag. - The changed source test checks all three current WMMA16 stamp bits. **Testing:** No commands from the project or tests were run. The author reports Windows 860M playtesting and earlier Linux RDNA 3 runs; CI has not run on this head. **Overlaps and merge order:** none found </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch feat/wmma16-fused 2026-11-21 17:58:34 +00:00
Contributor

Tested in game on Linux RDNA 4, after the merge too: AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.7), Fedora 45 (kernel 7.3.4), Ryzen 5 5600X, 32 GB. Kokiri Forest (child), the game's own upscaler (dlss=0). 0 device lost and no crash in any run below.

1. The Test Farm's way: this PR's final head against its merge base, WMMA16 on and off. The Beanstalk agent's own run (beanstalk-agent run --pr 2043, run on this PC, nothing sent to the farm), this PR @ f0de22ea against main @ f836ca1d, plus RX_VK_MMA_WMMA16=0 and =1 on the PR's side. 67 % render resolution (1707x960), the console's 60 fps cap, headless, 30 s after a 10 s warm-up, 2 starts a side, interleaved:

main @ f836ca1d this PR, RX_VK_MMA_WMMA16=0 this PR, RX_VK_MMA_WMMA16=1
GPU time a frame (RX_VK_PASS_TIMING) 8.48 / 8.53 / 8.54 / 8.42 ms 8.43 / 8.53 ms 9.24 / 9.33 ms
median frame time 16.5-16.7 ms (at the cap) 16.66 / 16.53 ms 16.68 / 16.45 ms
p99 frame time 18.57 / 20.32 / 19.64 / 19.14 ms 19.99 / 20.02 ms 18.37 / 18.60 ms
VRAM peak 5.2-6.1 GB 5.2-6.4 GB 5.2-6.4 GB

The farm's rule passes (frametime_p99_ms, WMMA16 on against off on the PR: -7.6 %, limit +10 %), but at the 60 fps cap the frame times say little: every side's median sits at 16.5 ms and main's own p99 spans 18.6-20.3 ms. The clear difference is GPU time: with WMMA16 on, about 0.8 ms more a frame, in both runs, while WMMA16 off matches main.

That 0.8 ms is the upscaler network running at all, not slower multiplies. A second Beanstalk run, the PR's own build against itself (baseline.ref = "pr"), WMMA16 on (default) against RX_VK_MMA_WMMA16=0, same scene and settings, 2 starts a side, with a log_match on each start's log:

WMMA16 on (default) RX_VK_MMA_WMMA16=0
GPU time a frame 9.23 / 9.38 ms 8.42 / 8.18 ms
native matrix multiplies on logged both starts neither
not translated: a network left out on this card lines 0 / 0 30 / 11

With WMMA16 off (and on main) the 67 % network is left out on this card and the game falls back to the linear upscale; with WMMA16 on it runs, for about 0.8-1.0 ms of GPU time a frame. At 100 % and 75 %, where main runs the network through the software multiplies, WMMA16 is no slower (below). The screenshot comparison can't tell the sides apart in this scene: two shots of the same side differ in 70-92 % of their pixels (the scene moves).

2. The switch on main after the merge (main @ 971f77f5, with 21050742), uncapped. dev.py ab, RX_VK_MMA_WMMA16 unset against =0 on the same build, a 2560x1440 window, V-Sync and frame generation off, 180 s each after a warm-up, 2 interleaved pairs:

Render resolution WMMA16 on (unset): fps WMMA16 off (=0): fps p99, on → off
100 % (2560x1440) 99.0 / 98.0 (98.5) 110.6 / 97.9 (104.3) 12.60 → 11.56 ms
75 % (1920x1080) 96.8 / 97.1 (97.0) 96.5 / 96.6 (96.5) 12.32 → 12.30 ms

100 %: within the spread (the 110.6 run is a one-off). 75 %: on is 0.5 % faster, every on run above every off run. This scene is CPU-bound on this PC (below), so GPU time hardly shows in fps.

3. Before the merge: this PR @ 5b3a1235 against main @ 9dd41326. dev.py ab, output resolution 2560x1440 in a 1440x2560 (portrait) window on both sides, uncapped, 180 s each, 3 interleaved pairs, the median:

Render resolution main fps (median) this PR fps (median) p99, main → PR
100 % 96.1 / 95.6 / 97.3 (96.1) 95.9 / 106.8 / 96.3 (96.3) 13.28 → 12.91 ms
75 % 110.1 / 108.9 / 93.0 (108.9) 110.4 / 109.5 / 94.1 (109.5) 12.00 → 11.83 ms
67 % 92.7 / 93.5 / 93.3 (93.3) 93.4 / 95.1 / 110.6 (95.1) 15.07 → 14.55 ms

All within the spread. Every PR run logged vk: native matrix multiplies on (WMMA 16x16x16 through workgroup tiles, fused, exact K=8); every main run logged vk: matrix multiplies in software. The frame trace's median game_ms is 9.7-10.1 ms of a 10.3 ms frame at 100 %, with about 0.3 ms GPU wait on both sides, so the scene is CPU-bound here. At 67 % the PR runs the network at the same frame rate as main's linear fallback.

Not covered: a GPU-bound scene, image quality (no screenshot of the same frame), spirv-val.

Tested in game on Linux RDNA 4, after the merge too: AMD Radeon RX 9070 XT (RADV GFX1201, Mesa 26.2.7), Fedora 45 (kernel 7.3.4), Ryzen 5 5600X, 32 GB. Kokiri Forest (child), the game's own upscaler (`dlss=0`). 0 device lost and no crash in any run below. **1. The Test Farm's way: this PR's final head against its merge base, WMMA16 on and off.** The Beanstalk agent's own run (`beanstalk-agent run --pr 2043`, run on this PC, nothing sent to the farm), this PR @ f0de22ea against main @ f836ca1d, plus `RX_VK_MMA_WMMA16=0` and `=1` on the PR's side. 67 % render resolution (1707x960), the console's 60 fps cap, headless, 30 s after a 10 s warm-up, 2 starts a side, interleaved: | | main @ f836ca1d | this PR, `RX_VK_MMA_WMMA16=0` | this PR, `RX_VK_MMA_WMMA16=1` | |---|---|---|---| | GPU time a frame (`RX_VK_PASS_TIMING`) | 8.48 / 8.53 / 8.54 / 8.42 ms | 8.43 / 8.53 ms | **9.24 / 9.33 ms** | | median frame time | 16.5-16.7 ms (at the cap) | 16.66 / 16.53 ms | 16.68 / 16.45 ms | | p99 frame time | 18.57 / 20.32 / 19.64 / 19.14 ms | 19.99 / 20.02 ms | 18.37 / 18.60 ms | | VRAM peak | 5.2-6.1 GB | 5.2-6.4 GB | 5.2-6.4 GB | The farm's rule passes (`frametime_p99_ms`, WMMA16 on against off on the PR: -7.6 %, limit +10 %), but at the 60 fps cap the frame times say little: every side's median sits at 16.5 ms and main's own p99 spans 18.6-20.3 ms. The clear difference is GPU time: with WMMA16 on, about 0.8 ms more a frame, in both runs, while WMMA16 off matches main. **That 0.8 ms is the upscaler network running at all, not slower multiplies.** A second Beanstalk run, the PR's own build against itself (`baseline.ref = "pr"`), WMMA16 on (default) against `RX_VK_MMA_WMMA16=0`, same scene and settings, 2 starts a side, with a `log_match` on each start's log: | | WMMA16 on (default) | `RX_VK_MMA_WMMA16=0` | |---|---|---| | GPU time a frame | 9.23 / 9.38 ms | 8.42 / 8.18 ms | | `native matrix multiplies on` logged | both starts | neither | | `not translated: a network left out on this card` lines | 0 / 0 | 30 / 11 | With WMMA16 off (and on main) the 67 % network is left out on this card and the game falls back to the linear upscale; with WMMA16 on it runs, for about 0.8-1.0 ms of GPU time a frame. At 100 % and 75 %, where main runs the network through the software multiplies, WMMA16 is no slower (below). The screenshot comparison can't tell the sides apart in this scene: two shots of the same side differ in 70-92 % of their pixels (the scene moves). **2. The switch on main after the merge (main @ 971f77f5, with 21050742), uncapped.** `dev.py ab`, `RX_VK_MMA_WMMA16` unset against `=0` on the same build, a 2560x1440 window, V-Sync and frame generation off, 180 s each after a warm-up, 2 interleaved pairs: | Render resolution | WMMA16 on (unset): fps | WMMA16 off (`=0`): fps | p99, on → off | |---|---|---|---| | 100 % (2560x1440) | 99.0 / 98.0 (98.5) | 110.6 / 97.9 (104.3) | 12.60 → 11.56 ms | | 75 % (1920x1080) | 96.8 / 97.1 (97.0) | 96.5 / 96.6 (96.5) | 12.32 → 12.30 ms | 100 %: within the spread (the 110.6 run is a one-off). 75 %: on is 0.5 % faster, every on run above every off run. This scene is CPU-bound on this PC (below), so GPU time hardly shows in fps. **3. Before the merge: this PR @ 5b3a1235 against main @ 9dd41326.** `dev.py ab`, output resolution 2560x1440 in a 1440x2560 (portrait) window on both sides, uncapped, 180 s each, 3 interleaved pairs, the median: | Render resolution | main fps (median) | this PR fps (median) | p99, main → PR | |---|---|---|---| | 100 % | 96.1 / 95.6 / 97.3 (96.1) | 95.9 / 106.8 / 96.3 (96.3) | 13.28 → 12.91 ms | | 75 % | 110.1 / 108.9 / 93.0 (108.9) | 110.4 / 109.5 / 94.1 (109.5) | 12.00 → 11.83 ms | | 67 % | 92.7 / 93.5 / 93.3 (93.3) | 93.4 / 95.1 / 110.6 (95.1) | 15.07 → 14.55 ms | All within the spread. Every PR run logged `vk: native matrix multiplies on (WMMA 16x16x16 through workgroup tiles, fused, exact K=8)`; every main run logged `vk: matrix multiplies in software`. The frame trace's median `game_ms` is 9.7-10.1 ms of a 10.3 ms frame at 100 %, with about 0.3 ms GPU wait on both sides, so the scene is CPU-bound here. At 67 % the PR runs the network at the same frame rate as main's linear fallback. Not covered: a GPU-bound scene, image quality (no screenshot of the same frame), `spirv-val`.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 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!2043
No description provided.