Repository navigation
Conversation
This was referenced Nov 26, 2026
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))
itsSio
force-pushed
the
recomp/wave32-pixel-mask-carry
branch
from
November 26, 2026 10:49
382469c to
e1e5bbf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 xcl-dev#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).