Repository navigation
Recompiler: Wave32 pixel mask writes kill one SGPR, not a pair - #2781
Conversation
In a Wave32 pixel shader a VALU mask write (a carry or compare SDST) and a scalar SAVEEXEC / WREXEC write one dword: write_mask calls write32 when the program is not wave64. The liveness that decides whether a mask needs the helper lanes' quad reads (x64_masks) took its kill sets from the ISA tables, which describe the wave64 pair. So `v_add_co_u32 v3, s20, ...` was taken to overwrite s21 as well; an earlier carry into s21 that `v_bcnt_u32_b32 v4, s21, 0` reads later was taken for a lane-local mask and built with ballot_px_local, and with WQM on its helper lanes' bits were missing at triangle edges (xcl-dev#2584). For Wave32 pixel shaders those writes now kill one dword, and a mask write takes the full ballot when either this liveness or the existing pair rule says its destination can be read whole, so no mask that took the full ballot before loses it. Split wave64 and wave64 pixel shaders keep the pair rule; the direct DXIL path (by_pc) is unchanged. Tests: x64_masks::tests::wave32_carry_into_s20_preserves_a_whole_read_of_s21 and gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges, which draws the issue's program on two triangles. Fix and tests by akimfomin (akimfomin/xcl@d3e7725), carried onto main without its README line. Refs xcl-dev#2584 Co-authored-by: akimfomin <akim.fomin@mail.ru> Assisted-by: Google Antigravity CLI (Claude Opus 5.5 (High))
|
Confirmed the new pixel regression and its passing result on RX 9070 under Wine at exact head Tested
Invoked the libtest binaries directly through GE-Proton Wine:
All 22 raw summaries, the three repeated failure messages, source inventories and executable hashes were checked after testing. Not tested Native Windows, other GPUs, the Direct-DXIL graphics path, retail workloads, smoke runs, full workspace suite, or performance. The ignored benchmark was not run. AI use OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, ran and checked the paired synthetic tests, and drafted this report. Publication authorized by the account owner. |
|
Ran the Wave32 pixel mask tests at Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build. Both new tests pass here. The GPU regression test runs on the real adapter, so the adjacent mask survives the Wave32 carry at triangle edges on this Blackwell part too. What this adds: the author tested an RTX 5080 and an RTX 2080 SUPER. This is a third NVIDIA host, with a different driver and DXC version, and the thread has no report from another machine. Not tested: the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, WARP, Wine, release profile, title data. AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used. |
|
AMD and NVIDIA run on this exact rebased commit (listed as untested): the regression test passes on an RX 9070 XT and an RTX 3060, and nothing else changes in the GPU suite. Head
Not tested: Intel, a title. |
|
Suite on RTX 5070 Ti (Windows 11) at Tested
Not tested
AI use
|
|
Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2781 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib wave32_carry_into_s20_preserves_a_whole_read_of_s21 -- --nocapture |
1 passed; 0 failed; 0 ignored; 1337 filtered out (0.00s) |
cargo test --release -p xcl --lib gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges -- --nocapture (3 consecutive runs, on-GPU RTX 4060) |
1 passed; 0 failed; 0 ignored; 1337 filtered out × 3 (0.30s, 0.23s, 0.23s) |
cargo test --release -p xcl --lib gpu::recomp:: |
403 passed; 0 failed; 20 ignored; 915 filtered out (5.06s; Wave64-only and #1426-refused subcases self-skipped as expected on Wave32-only RTX 4060) |
cargo build --release -p xcl --bin xcl |
Clean build (1m 11s, exit 0) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):
xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB
PR #2781 (e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3):
xcl-smoke v1
commit: e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1629 (PresentX 1629)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 13991 MB
Runtime log observations (xcl.log)
9223log lines,0[ERROR]/ device-removal / panic lines.- Final draw/memory telemetry in log:
19648 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample13991 MB committed by the process; video memory 6115 MB local, 4650 MB non-local.
Limits of coverage
- Single-SGPR Wave32 pixel mask liveness (
wave32_carry_into_s20_preserves_a_whole_read_of_s21) and WQM helper-lane preservation at triangle edges (gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges, 3/3 on-GPU RTX 4060 runs) passed directly alongside the fullgpu::recomp::suite (403/0/20). - Wave64-only GPU subcases in
gpu::recomp::self-skipped on the Wave32-only RTX 4060, and the 60 s retail smoke ontitle: 29640639ran against the warm shader cache as an end-to-end non-regression check (no visual triangle-edge screenshot diff was captured in live gameplay). Frame-count delta vs. the cached parent smoke (1629vs.1518) reflects normal single-run startup variance and is not attributed to this PR.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
…xcl-dev#2818 (loop budget, wave32 mask kill, SDWA SDST, u32x2 routing)
|
Tested Clean
Not tested Parent, direct DXIL, other adapters, performance, full workspace suite, and retail smoke. AI use T3 Code / Codex ( |
|
merge-check claim |
|
merge-check |
|
merge-check |
In a Wave32 pixel shader, VALU mask writes (carry or compare
SDST) and scalarSAVEEXEC/WREXECwrite a single 32-bit SGPR, whereasx64_masksliveness used the wave64 pair kill sets from the ISA tables. A subsequent Wave32 carry intos20therefore killed a live mask ins21, causing the earliers21carry to be lowered withballot_px_localand lose WQM helper-lane bits at triangle edges (Fixes #2584).Carried onto
main(b49be183) fromakimfomin/xcl@d3e7725with his narrow liveness fix and regression tests preserved, adding thegpu_ready()guard on the new GPU test so WARP CI skips cleanly, and omitting the unrelated README line.What is in it
Recompiler: Wave32 pixel mask writes kill one SGPR, not a pair(e1e5bbf0):crates/xcl/src/gpu/recomp/x64_masks.rs: addliveness_uses(masking Wave32V_*,SAVEEXEC, andWREXECkill sets to one dword) andfull_mask_destinations(preserving the existing pair rule while forcing full ballots when a Wave32 pixel mask's single output word can still be read whole), plus unit testwave32_carry_into_s20_preserves_a_whole_read_of_s21.crates/xcl/src/gpu/recomp/emit.rs&crates/xcl/src/gpu/recomp/mod.rs: switchEmfrommask_whole_live(live & (3 << n) == 0) tofull_mask_destinations(live & (1 << n) == 0), passingopt.wave64for pixel shaders andtruefor split wave64 compute/mesh/kernel shaders.crates/xcl/src/gpu/recomp/tests.rs: add GPU regression testgpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges(withgpu_ready()guard for WARP CI).Tested
Commit
e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3(based onmainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7), clean checkouts on both PCs, debug builds for workspace tests and release build for the retail smoke run.b49be183+ new GPU test only, DXC1.9.2609.5,XCL_ADAPTER=NVIDIA):gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edgesFAILED as expected (mask popcount at 0: left 12.0, right 16.0).XCL_ADAPTER=warp):gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edgesskips cleanly (SKIPPED: no wave64, 0.03 s); fork Windows CI green (2m43s).32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200,rustc 1.97.0(stable-x86_64-pc-windows-msvc), DXC1.9.2609.5, debug build (XCL_ADAPTER=NVIDIA).cargo build --workspace: exit 0.cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1437 passed, 0 failed, 47 ignored (both new tests pass).SKIPPED: 26 (no wave64, 3 refused wave32 per-lane f16/cvt forms#1426, no heap windows, driver cache requiring Developer Mode).32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200,rustc 1.99.1(stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC1.8.2502.11, debug build (XCL_ADAPTER=NVIDIA).cargo build --workspace: exit 0.cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1437 passed, 0 failed, 47 ignored (both new tests pass).SKIPPED: 29 (same 26 as PC 1 plus 3 requiringd3d12SDKLayers.dll).Regression run
main(b49be183, RTX 5080, release):PR (
e1e5bbf0, RTX 5080, release):Not tested
d3e7725patch on RX 9070 XT, RX 6800M, and RTX 3060 in#2584).scripts/smoke.ps1on the RTX 2080 SUPER, Linux / Wine / vkd3d-proton, and past-world-load gameplay scenes (the 60 s smoke stays in loading and checks for regressions).AI use
Ran via Samaritan:
#2584, carriedakimfomin's fix ontomain(preservingCo-authored-by), reviewed the diff, and ran the pre-fix repro.gpu_ready()guard ine1e5bbf0, ran the dual-PC workspace suites and paired RTX 5080b49be183/e1e5bbf0smokes.scripts/pr_check.py --local, and prepared this description.akimfomin(assisted by OpenAI Codex (GPT-6) per#2584).