Recompiler: Wave32 pixel mask writes kill one SGPR, not a pair #2771
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2781"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by itsSio on 2026-11-26T12:22:26Z.
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).Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T12:35:02Z.
Confirmed the new pixel regression and its passing result on RX 9070 under Wine at exact head
e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3.Tested
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7with only the new GPU test appended torecomp/tests.rs. Main's translator and mask analysis were unchanged. The head had no local source changes.8293130ebe370b1+(local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, releasex86_64-pc-windows-gnu.XCL_ADAPTER="AMD Radeon RX 9070",XCL_REQUIRE_GPU=wave64,XCL_DIRECT_DXIL=0,XCL_NETWORK=0. Fresh process and XCL DXIL cache directory for each run; vkd3d shader cache disabled.Invoked the libtest binaries directly through GE-Proton Wine:
mask popcount at 32, withleft: 10.0,right: 16.0. Each run: 0 passed, 1 failed, 0 ignored, 0 skip markers.gpu::recomp::x64_masks::tests::, at both--test-threads=1and4: main control 19 passed / 0 failed / 1 ignored; head 20 passed / 0 failed / 1 ignored. The ignored test is the existing manualbench_whole_live_outbenchmark. No skip markers.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.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T12:42:06Z.
Ran the Wave32 pixel mask tests at
e1e5bbf0: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.
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-26T13:37:17Z.
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
e1e5bbfapplied onmainb49be18, debug, Windows 11 Pro 26200, card chosen withXCL_ADAPTER:gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges --nocapture: ok on both cards, no SKIPPED. Without the fix this test fails on both cards (mask popcount at 32, left 10.0, right 16.0 on the RX 9070 XT;mask popcount at 0, left 12.0, right 16.0 on the RTX 3060), as I reported ford3e7725in #2584.x64_masks: 20 passed, 0 failed on both cards.cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR: the only result changes aregpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edgesandwave32_carry_into_s20_preserves_a_whole_read_of_s21, both ok, with no new skips. RX 9070 XT (RDNA4, 32.0.32029.2010): 708 → 710 passed, 2 failed (#2115, the same onmain), 6 SKIPPED. RTX 3060 (32.0.16.1088): 710 → 712 passed, 0 failed, 24 SKIPPED.Not tested: Intel, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-26T15:07:33Z.
Suite on RTX 5070 Ti (Windows 11) at
e1e5bbf0: 1433 passed, 4 failed (the fuzz out-of-memory ones, same onmain); both new tests passTested
e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3(parentmainb49be183), clean detached worktree, built as is, debug. PR open and head unchanged when I started.cargo build --workspace: ok.cargo test --workspace --no-fail-fast -- --test-threads=4: 1433 passed, 4 failed, 47 ignored.SKIPPED: 21 "no wave64", 3 wave32 per-lane forms refused (f16 arithmetic, f16 packed, f32 conversions), 1heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3, eachCreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E). They fail the same way onmainb49be183(cargo test -p xcl --lib gpu::dxil::fuzz_tests::fuzz_validate_and_gpu: 0 passed, 4 failed).cargo test -p xcl --lib -- gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges wave32_carry_into_s20_preserves_a_whole_read_of_s21 x64_masks:: --nocapture --test-threads=1: 21 passed, 0 failed, 1 ignored (bench_whole_live_out, a manual benchmark). Both new tests are among the 21; the GPU one ran and was not skipped.Not tested
main, to see it fail on this card. The PR and other reports show it does.AI use
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T22:02:19Z.
Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2781 at head
e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3(1commit; exact parent & merge-base:b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, pre-#2555ancestor ofmain).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
e1e5bbf0)cargo test --release -p xcl --lib wave32_carry_into_s20_preserves_a_whole_read_of_s21 -- --nocapture1 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 xcl1m 11s, exit0)Paired quiet 60 s retail smoke (
title: 29640639)Exact parent & merge-base (
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):PR #2781 (
e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3):Runtime log observations (
xcl.log)9223log lines,0[ERROR]/ device-removal / panic lines.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
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).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).
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:59:39Z.
Tested
Clean
e1e5bbf0d9bd5b1567c58d55acf2be7ce8d44bc3on Windows 11 build 26200, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC and DXC/DXIL 1.9.2602.17. Built usingcargo test -j 2 -p xcl --lib --no-runin a dedicated target. Used checked-in synthetic inputs only.gpu::recomp::x64_masks::tests::, plus exact libtest filtersgpu::recomp::tests::ps_masks_in_loops_quad_read_the_operands_not_the_compareandgpu::recomp::tests::wave32_src_vccz_execz_and_saveexec_b32_hlsl, all with--nocapture --test-threads=1. 22 passed, 0 failed, 1 ignored (manual benchmark), 0 skips.XCL_ADAPTER=A770 XCL_DIRECT_DXIL=0, ran$exe --exact --nocapture --test-threads=1 <filter>separately under the shared Arc mutex forgpu::recomp::tests::gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges,gpu::recomp::tests::gpu_ps_masks_hold_helper_lanes_on_triangle_edges, andgpu::recomp::tests::gpu_ps_mask_loop_on_a_primitive_edge_ends. 3 passed, 0 failed, 0 ignored, 0 skips. The carry readback matched all 1,024 pixels. The helper-lane test reported zero mismatches in 1,024 pixels for each input width. The Wave32-input loop reported zero mismatches in 1,024 pixels and 16 hardware lanes.Not tested
Parent, direct DXIL, other adapters, performance, full workspace suite, and retail smoke.
AI use
T3 Code / Codex (
gpt-6.2-solfor the worker run) built and ran the fixtures and drafted the report. Codex in the coordinator session independently reran the same filters.Imported from ivall/xcl. Originally posted by throny on 2026-11-27T21:10:59Z.
merge-check claim
head:
e1e5bbf0d9Imported from ivall/xcl. Originally posted by throny on 2026-11-27T21:27:16Z.
merge-check
base:
6089122ahead:
e1e5bbf0d9merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1467 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored
review: none. The renamed field has all its uses on main updated; the wave64 path is equivalent to the old check; the wave32 rule only adds liveness, so it is conservative. A tester in the thread reports the GPU test fails without the fix (not run on main here).
performance: it changes a translator source: every tester re-translates all shaders once. One extra liveness pass per wave32 pixel program (reasoned).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T22:18:26Z.
merge-check
base:
2c717a043c(main)head:
e1e5bbf0d9merge: clean, uncommitted trial merge
build:
cargo build --workspace --locked-> oktests:
cargo test --workspace --locked --no-fail-fast -- --test-threads=4-> 1,467 passed, 1 failed, 47 ignored; 25 GPUSKIPPEDnotices. Both new Wave32 tests passed, including the RTX 3080 Ti pixel readback. The only failure,console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, is the same failure on cleanmain2c717a04with the same command and machine (1,465 passed, 1 failed, 47 ignored, 25 skips; paired baseline report). As a negative control, I added only this PR's 39-line GPU regression to cleanmain:cargo test -p xcl --lib gpu_wave32_pixel_carry_preserves_adjacent_mask_at_triangle_edges --locked -- --nocapture-> 0 passed, 1 failed, 0 ignored, 0 skips (mask popcount at 0: 12.0versus16.0). The unchanged test passed in the merged full suite.review: No blocker in the four-file diff. Wave32 mask writes now kill only their actual SGPR word during liveness, so a later write to
s20does not erase the whole read ofs21; Wave64 retains the previous pair-wide decision. The emitter consumes the new per-destination result, and the GPU test compares the carry result against a separately computed WQM EXEC count. A separate open Direct-DXIL optimization, #2571, still uses width-blind pair kills inps_masks.rs; it needs its own Wave32 follow-up, but does not change this PR's HLSL fix.performance: Wave32 pixel translation runs two liveness analyses rather than one. Affected mask writes now retain helper-lane quad reads where correctness requires them. I did not measure cold compile time or frame-time cost; unaffected shaders keep their prior path.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300; RTX 3080 Ti 12 GB, NVIDIA 621.35; Ryzen 7 9800X3D; Rust 1.99.1 MSVC; DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build, full GPU suite and negative control, reviewed the diff and wrote this report; Codex (GPT-6.2 Astra) independently traced the mask-liveness paths. I did not run a retail smoke on this head.