Recompiler: use wave32 register width in direct PS mask analysis #3535

Merged
Kalmarv merged 1 commit from upstream-pr/3535 into main 2026-12-01 07:00:24 +00:00
Kalmarv commented 2026-11-30 16:26:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-30T16:26:10Z.


Summary

Fixes the wave32 register-width bug in recomp::ps_masks introduced by #2571 (1183cd437), reported by @CharlyRien.

Root cause: ps_masks::forms() called x64_masks::whole_live_out(insts, false) and x64_masks::uses(d), both of which assume wave64 register pairs (wave64 = true). On wave32 pixel shaders (every non-split pixel shader on wave32 NVIDIA GPUs), a compare writing sN was treated as killing s(N+1) in both liveness and forward taint. An earlier compare writing s(N+1) that is still read whole later (e.g. by s_bcnt1, s_and_saveexec_b32, or a branch/loop) could therefore be misclassified as Form::Own (no WaveActiveBallot) or have its taint prematurely cleared.

Fix:

  • Expose x64_masks::uses_for_width and x64_masks::whole_live_out_for_width.
  • Pass o.wave64 from dxil::kernel into ps_masks::forms(insts, o.wave64).
  • Thread wave64 through ps_masks (vcc_mask, exec_mask, writes, per_lane, subset_after, live_subsets, run) so wave32 compares and SAVEEXEC/WREXEC use single-SGPR widths.
  • Add wave32_compare_does_not_kill_neighbor_sgpr_in_liveness_or_taint covering @CharlyRien's v_cmp -> s21, v_cmp -> s20, s_bcnt1 s21 sequence and s_and_saveexec_b32.

Also a candidate fix for @minimalhipster990's RTX 4090 wave32 world FPS regression reported on #2571 (needs RTX 4090 world re-test to confirm whether this accounts for all of the drop or whether Form::Local on EXEC branches/loops is also involved).

Regression run

Baseline (main):

xcl-smoke v1
commit: 91244db94d2f402237c6a8e428dbe5da07673c48
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1514 (PresentX 1514)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15133 MB

PR head:

xcl-smoke v1
commit: 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1708 (PresentX 1708)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 17453 MB

Tested

  • cargo test -q -p xcl --lib gpu::recomp::ps_masks::tests -- --test-threads=1 (4 passed, 0 failed, including the new wave32_compare_does_not_kill_neighbor_sgpr_in_liveness_or_taint).
  • cargo test -q -p xcl --lib ps_ballot_tests -- --test-threads=1 on Windows 11 + RTX 5070 Ti (8 passed, 0 failed).
  • 60 s title smoke on RTX 5070 Ti (44eeb0c75 vs 91244db94): 1708 frames (61/60/60 per 2 s), 0 device removals, 0 crashes, 17453 MB peak commit.

Not tested

  • 600 s RTX 4090 Series X world replay to verify whether this lifts @minimalhipster990's 0.75 -> 0.20 fps drop.
  • Full cargo test --workspace locally (covered by CI).

AI use

  • Antigravity assisted with auditing ps_masks.rs / x64_masks.rs, implementing the width-aware fix and wave32 unit tests, running local tests and smoke, and writing this description.
<!-- greyfinch-sync:ivall/xcl:issue:5569304467 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-30T16:26:10Z. --- ### Summary Fixes the wave32 register-width bug in `recomp::ps_masks` introduced by #2571 (`1183cd437`), reported by @CharlyRien. **Root cause:** `ps_masks::forms()` called `x64_masks::whole_live_out(insts, false)` and `x64_masks::uses(d)`, both of which assume wave64 register pairs (`wave64 = true`). On wave32 pixel shaders (every non-split pixel shader on wave32 NVIDIA GPUs), a compare writing `sN` was treated as killing `s(N+1)` in both liveness and forward taint. An earlier compare writing `s(N+1)` that is still read whole later (e.g. by `s_bcnt1`, `s_and_saveexec_b32`, or a branch/loop) could therefore be misclassified as `Form::Own` (no `WaveActiveBallot`) or have its taint prematurely cleared. **Fix:** - Expose `x64_masks::uses_for_width` and `x64_masks::whole_live_out_for_width`. - Pass `o.wave64` from `dxil::kernel` into `ps_masks::forms(insts, o.wave64)`. - Thread `wave64` through `ps_masks` (`vcc_mask`, `exec_mask`, `writes`, `per_lane`, `subset_after`, `live_subsets`, `run`) so wave32 compares and `SAVEEXEC`/`WREXEC` use single-SGPR widths. - Add `wave32_compare_does_not_kill_neighbor_sgpr_in_liveness_or_taint` covering @CharlyRien's `v_cmp -> s21`, `v_cmp -> s20`, `s_bcnt1 s21` sequence and `s_and_saveexec_b32`. Also a candidate fix for @minimalhipster990's RTX 4090 wave32 world FPS regression reported on #2571 (needs RTX 4090 world re-test to confirm whether this accounts for all of the drop or whether `Form::Local` on `EXEC` branches/loops is also involved). ### Regression run Baseline (`main`): ``` xcl-smoke v1 commit: 91244db94d2f402237c6a8e428dbe5da07673c48 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1514 (PresentX 1514) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15133 MB ``` PR head: ``` xcl-smoke v1 commit: 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1708 (PresentX 1708) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 17453 MB ``` **Tested** - `cargo test -q -p xcl --lib gpu::recomp::ps_masks::tests -- --test-threads=1` (4 passed, 0 failed, including the new `wave32_compare_does_not_kill_neighbor_sgpr_in_liveness_or_taint`). - `cargo test -q -p xcl --lib ps_ballot_tests -- --test-threads=1` on Windows 11 + RTX 5070 Ti (8 passed, 0 failed). - 60 s title smoke on RTX 5070 Ti (`44eeb0c75` vs `91244db94`): 1708 frames (61/60/60 per 2 s), 0 device removals, 0 crashes, 17453 MB peak commit. **Not tested** - 600 s RTX 4090 Series X world replay to verify whether this lifts @minimalhipster990's 0.75 -> 0.20 fps drop. - Full `cargo test --workspace` locally (covered by CI). **AI use** - Antigravity assisted with auditing `ps_masks.rs` / `x64_masks.rs`, implementing the width-aware fix and wave32 unit tests, running local tests and smoke, and writing this description.
Aniseto commented 2026-11-30 16:57:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-30T16:57:06Z.


Ran the ps_masks module tests and the pixel-shader ballot tests at 44eeb0c7 on an NVIDIA Blackwell desktop part with 16 GB of VRAM; this is a second host for these tests.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib gpu::recomp::ps_masks::tests -- --test-threads=1
4 passed; 0 failed; 0 ignored; 2766 filtered out      (exit 0)

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib ps_ballot_tests -- --test-threads=1
8 passed; 0 failed; 0 ignored; 2762 filtered out      (exit 0)

Both counts match the description at this exact head: the four ps_masks tests, including the new wave32 neighbour-SGPR case, and the eight ps_ballot_tests. This adapter is wave32 only with 16 GB of VRAM and driver 621.40, so the wave32 width path is the one exercised here.

Not tested: the full workspace suite, native wave64 hosts, AMD and Intel GPUs, Wine, release profile, the RTX 4090 world re-test mentioned in the description, title and paired smoke runs, game data.

AI-assisted (OpenCode), model: MiMo-V2.6-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.

<!-- greyfinch-sync:ivall/xcl:comment:7285483776 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7285483776). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-11-30T16:57:06Z. --- Ran the `ps_masks` module tests and the pixel-shader ballot tests at `44eeb0c7` on an NVIDIA Blackwell desktop part with 16 GB of VRAM; this is a second host for these tests. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, `XCL_ADAPTER=NVIDIA`, detached worktree at the exact PR head, no local patches. ``` XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib gpu::recomp::ps_masks::tests -- --test-threads=1 4 passed; 0 failed; 0 ignored; 2766 filtered out (exit 0) XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib ps_ballot_tests -- --test-threads=1 8 passed; 0 failed; 0 ignored; 2762 filtered out (exit 0) ``` Both counts match the description at this exact head: the four `ps_masks` tests, including the new wave32 neighbour-SGPR case, and the eight `ps_ballot_tests`. This adapter is wave32 only with 16 GB of VRAM and driver 621.40, so the wave32 width path is the one exercised here. Not tested: the full workspace suite, native wave64 hosts, AMD and Intel GPUs, Wine, release profile, the RTX 4090 world re-test mentioned in the description, title and paired smoke runs, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-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.
vasanex commented 2026-11-30 17:56:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vasanex on 2026-11-30T17:56:49Z.


Unattended test report. Posted automatically by an AI agent on the account owner's instruction. The owner has not read or checked it. It is not a code review and not a merge-check.

Tested tree: head 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028 on main 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b, in a separate worktree. The PR is based on this main, so the merged tree (fb0db1e8cbfe2f3a36222f3d304c67cc4437696b) is the head's own tree. No XCL_* variables were set.

Hardware and tools: NVIDIA GeForce RTX 3080 10 GB (32-lane waves only), driver 621.40, AMD Ryzen 9 7950X, Windows 11 Pro build 26200, rustc 1.100.0, debug build.

Results

  • cargo build --workspace: ok
  • cargo test --workspace --no-fail-fast -- --test-threads=4
passed failed ignored SKIPPED lines
main with this PR 2886 1 51 25
main without it 2885 1 51 25
  • The same test fails in both runs: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16 ("2D D16 resinfo clobbered v2/v3"). Run alone (cargo test -p xcl --lib -- gpu_direct_image_get_resinfo_d16 --test-threads=1), it fails in 3 of 3 runs with this PR and in 3 of 3 without it. #3513 is about this test.
  • The same tests are skipped in both runs: 22 lines for no wave64, 2 for no heap windows, and 1 because the driver cache could not be disabled. None of them is a ps_masks or ps_ballot_tests test.
  • The test this PR adds (wave32_compare_does_not_kill_neighbor_sgpr_in_liveness_or_taint), the other 3 ps_masks tests and the 8 ps_ballot_tests passed.
  • With the width ignored inside ps_masks::forms() (one added line that sets wave64 to true, removed afterwards), cargo test -p xcl --lib -- ps_masks::tests --test-threads=1 gives 3 passed and 1 failed. The failing test is the new one, at its first assertion.

Outcome: no new test failure with this PR on this wave32-only card.

Not tested:

  • any title run or smoke pair (no frame rate, peak commit or removals were measured), so also not the slowdown reported on #2571
  • the changed call in kernel.rs on its own, and the DXIL of a title's pixel shaders before and after
  • release builds, XCL_HEAP_WINDOWS=1, wave64 and AMD

AI use: Claude Code (Claude Opus 5.5) ran the builds and tests, and wrote and posted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7287083691 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7287083691). Originally posted by [vasanex](https://github.com/vasanex) on 2026-11-30T17:56:49Z. --- **Unattended test report.** Posted automatically by an AI agent on the account owner's instruction. The owner has not read or checked it. It is not a code review and not a `merge-check`. **Tested tree:** head `44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028` on `main` `9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b`, in a separate worktree. The PR is based on this `main`, so the merged tree (`fb0db1e8cbfe2f3a36222f3d304c67cc4437696b`) is the head's own tree. No `XCL_*` variables were set. **Hardware and tools:** NVIDIA GeForce RTX 3080 10 GB (32-lane waves only), driver 621.40, AMD Ryzen 9 7950X, Windows 11 Pro build 26200, rustc 1.100.0, debug build. **Results** - `cargo build --workspace`: ok - `cargo test --workspace --no-fail-fast -- --test-threads=4` | | passed | failed | ignored | `SKIPPED` lines | |---|---|---|---|---| | `main` with this PR | 2886 | 1 | 51 | 25 | | `main` without it | 2885 | 1 | 51 | 25 | - **The same test fails in both runs:** `gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16` ("2D D16 resinfo clobbered v2/v3"). Run alone (`cargo test -p xcl --lib -- gpu_direct_image_get_resinfo_d16 --test-threads=1`), it fails in 3 of 3 runs with this PR and in 3 of 3 without it. #3513 is about this test. - **The same tests are skipped in both runs:** 22 lines for no wave64, 2 for no heap windows, and 1 because the driver cache could not be disabled. None of them is a `ps_masks` or `ps_ballot_tests` test. - The test this PR adds (`wave32_compare_does_not_kill_neighbor_sgpr_in_liveness_or_taint`), the other 3 `ps_masks` tests and the 8 `ps_ballot_tests` passed. - With the width ignored inside `ps_masks::forms()` (one added line that sets `wave64` to true, removed afterwards), `cargo test -p xcl --lib -- ps_masks::tests --test-threads=1` gives 3 passed and 1 failed. The failing test is the new one, at its first assertion. **Outcome:** no new test failure with this PR on this wave32-only card. **Not tested:** - **any title run or smoke pair** (no frame rate, peak commit or removals were measured), so also not the slowdown reported on #2571 - the changed call in `kernel.rs` on its own, and the DXIL of a title's pixel shaders before and after - release builds, `XCL_HEAP_WINDOWS=1`, wave64 and AMD AI use: Claude Code (Claude Opus 5.5) ran the builds and tests, and wrote and posted this report.
minimalhipster990 commented 2026-11-30 19:51:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by minimalhipster990 on 2026-11-30T19:51:30Z.


RTX 4090 world replay of this PR stacked with #3528, as asked on #2571: the world stays at ~0.2 frames/s, the same as without this PR. The PR's code does run (301 of 1,714 pixel shaders come out smaller), but the frame rate does not move. One of the two runs with it lost the device (0x887a0006) at 356 s.

Setup

  • RTX 4090 24 GB, NVIDIA 621.40, 32 GB RAM, Windows 11 build 26300, NVIDIA shader heap at 2048 MB through #2590.
  • main ff0c364b + #3318 f5496479 (without it this card does not reach the world on main) + #3528 49eb78ef, with and without this PR's head 44eeb0c7. All clean merges, release.
  • Retail title, Series X profile, the same save and inputs, 600 s, the switches listed in my #2571 report. For each tree one run to build its XCL cache, then the measured run from that cache. GPU sampled with nvidia-smi every 5 s.

Frames/s per minute, 300–540 s. The world arrives at 117–143 s in all four runs, with 4,500–5,500 draws per present; the GPU is at 100 % and 105–120 W in all of them.

tree run frames/s
+ #3528 + this PR cache build 0.22 · 0.20 · 0.22 · 0.20 · 0.22
+ #3528 + this PR measured 0.19 over 240–350 s, then the device removal at 356 s
+ #3528 cache build 0.20 · 0.18 · 0.20 · 0.18 · 0.20
+ #3528 measured 0.23 · 0.22 · 0.23 · 0.22 · 0.22
for reference: c9aa9f8a (#3499 merged, #2571 not yet) measured 0.73 · 0.75 · 0.75 · 0.72 · 0.63
  • The PR is in effect. The translator id changes (293b2225… with it, 1d4ad792… without). Of the 1,714 pixel shaders translated in both measured runs, 301 come out smaller with this PR (75.10 → 73.31 MB in all) and none larger; the 1,113 compute and 528 vertex shaders keep their sizes.
  • So on this card the wave32 register-width bug is not what holds the world at ~0.2 frames/s. I can run the next step you named (Form::Local gated on EXEC, or #2571 reverted) as soon as there is a commit for it. A revert of #2571 on current main conflicts with #3500 (kernel.rs, lower.rs), so I have no tree without it.

Device removal in the measured run with this PR

  • At 356.6 s, 236 s after the world arrived: 0x887a0006, DRED device state 3, no breadcrumbs, no page fault reported. System commit was at 60.0 of 63.4 GB.
  • From about 120 s on, the xcl-pso-whole worker finished #3528's whole forms one after another, about one every 10 s, with no hang. The last one, for record 6e8798cd… (447,152 B DXIL), finished at 353.8 s, about 3 s before the removal. The same whole form also finished at 435.0 s in the measured run without this PR, and at 328.4 s in a run of d52ff48c + #3528 yesterday, with no hang either time.
  • With #3528's commit, that makes 1 device removal in 6 runs on this card: 1 of 2 with this PR, 0 of 4 without (2 today on ff0c364b, 2 yesterday on d52ff48c). One event is not enough to say whether this PR plays a part. It looks like the hangs throny reported on #3528 (0x887a0006, no breadcrumbs), though throny's came earlier (141–151 s) and had a DRED page fault at VA 0.

Not tested: a second measured run with this PR, this PR without #3528, the change Zippp69 suggested for #3528, AMD or other wave64 GPUs, a GPU profile.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the replays, compared the shader caches and wrote this report. The person running these tests checked it and asked for it to be posted.

<!-- greyfinch-sync:ivall/xcl:comment:7290041297 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7290041297). Originally posted by [minimalhipster990](https://github.com/minimalhipster990) on 2026-11-30T19:51:30Z. --- **RTX 4090 world replay of this PR stacked with #3528, as asked on #2571: the world stays at ~0.2 frames/s, the same as without this PR. The PR's code does run (301 of 1,714 pixel shaders come out smaller), but the frame rate does not move. One of the two runs with it lost the device (`0x887a0006`) at 356 s.** **Setup** - RTX 4090 24 GB, NVIDIA 621.40, 32 GB RAM, Windows 11 build 26300, NVIDIA shader heap at 2048 MB through #2590. - `main` `ff0c364b` + #3318 `f5496479` (without it this card does not reach the world on `main`) + #3528 `49eb78ef`, with and without this PR's head `44eeb0c7`. All clean merges, release. - Retail title, Series X profile, the same save and inputs, 600 s, the switches listed in [my #2571 report](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7283564613). For each tree one run to build its XCL cache, then the measured run from that cache. GPU sampled with `nvidia-smi` every 5 s. **Frames/s per minute, 300–540 s.** The world arrives at 117–143 s in all four runs, with 4,500–5,500 draws per present; the GPU is at 100 % and 105–120 W in all of them. | tree | run | frames/s | |---|---|---| | + #3528 + this PR | cache build | 0.22 · 0.20 · 0.22 · 0.20 · 0.22 | | + #3528 + this PR | measured | 0.19 over 240–350 s, then the device removal at 356 s | | + #3528 | cache build | 0.20 · 0.18 · 0.20 · 0.18 · 0.20 | | + #3528 | measured | 0.23 · 0.22 · 0.23 · 0.22 · 0.22 | | for reference: `c9aa9f8a` (#3499 merged, #2571 not yet) | measured | 0.73 · 0.75 · 0.75 · 0.72 · 0.63 | - **The PR is in effect.** The translator id changes (`293b2225…` with it, `1d4ad792…` without). Of the 1,714 pixel shaders translated in both measured runs, 301 come out smaller with this PR (75.10 → 73.31 MB in all) and none larger; the 1,113 compute and 528 vertex shaders keep their sizes. - So on this card the wave32 register-width bug is not what holds the world at ~0.2 frames/s. I can run the next step you named (`Form::Local` gated on `EXEC`, or #2571 reverted) as soon as there is a commit for it. A revert of #2571 on current `main` conflicts with #3500 (`kernel.rs`, `lower.rs`), so I have no tree without it. **Device removal in the measured run with this PR** - At 356.6 s, 236 s after the world arrived: `0x887a0006`, DRED device state 3, no breadcrumbs, no page fault reported. System commit was at 60.0 of 63.4 GB. - From about 120 s on, the `xcl-pso-whole` worker finished #3528's whole forms one after another, about one every 10 s, with no hang. The last one, for record `6e8798cd…` (447,152 B DXIL), finished at 353.8 s, about 3 s before the removal. The same whole form also finished at 435.0 s in the measured run without this PR, and at 328.4 s in a run of `d52ff48c` + #3528 yesterday, with no hang either time. - With #3528's commit, that makes 1 device removal in 6 runs on this card: 1 of 2 with this PR, 0 of 4 without (2 today on `ff0c364b`, 2 yesterday on `d52ff48c`). One event is not enough to say whether this PR plays a part. It looks like the hangs throny reported on #3528 (`0x887a0006`, no breadcrumbs), though throny's came earlier (141–151 s) and had a DRED page fault at VA 0. **Not tested:** a second measured run with this PR, this PR without #3528, the change Zippp69 suggested for #3528, AMD or other wave64 GPUs, a GPU profile. AI use: Claude Code (Claude Opus 5.5) built the trees, ran the replays, compared the shader caches and wrote this report. The person running these tests checked it and asked for it to be posted.
Gevroska commented 2026-11-30 23:02:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-30T23:02:55Z.


I tested the adjacent-register case on my RTX 3080 (driver 32.0.16.1692) with the same 32×32 pixel shader test on parent 9dfbe3ea and PR head 44eeb0c7. The shader writes a compare mask to s21, runs a second compare, then exports the population count of s21 to the render target. The expected count is 32.

Second compare writes to Parent PR head
s20 (adjacent) All 1,024 pixels returned 1 All 1,024 returned 32
s18 (control) All 1,024 returned 32 All 1,024 returned 32

Pixel coordinates and alpha also matched on both builds. This confirms the fix reaches the rendered pixels on Ampere. I didn’t measure retail-game frame time in this test.

AI disclosure — Codex GPT-6.2 Sol wrote and ran the test. A separate GPT-6.2 Sol agent checked the fixture and GPU readbacks. GPT-6.2 Astra drafted this comment.

I reviewed and approved this comment before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7294644530 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7294644530). Originally posted by [Gevroska](https://github.com/Gevroska) on 2026-11-30T23:02:55Z. --- I tested the adjacent-register case on my RTX 3080 (driver `32.0.16.1692`) with the same 32×32 pixel shader test on parent `9dfbe3ea` and PR head `44eeb0c7`. The shader writes a compare mask to `s21`, runs a second compare, then exports the population count of `s21` to the render target. The expected count is 32. | Second compare writes to | Parent | PR head | |---|---|---| | `s20` (adjacent) | All 1,024 pixels returned **1** | All 1,024 returned **32** | | `s18` (control) | All 1,024 returned **32** | All 1,024 returned **32** | Pixel coordinates and alpha also matched on both builds. This confirms the fix reaches the rendered pixels on Ampere. I didn’t measure retail-game frame time in this test. AI disclosure — Codex GPT-6.2 Sol wrote and ran the test. A separate GPT-6.2 Sol agent checked the fixture and GPU readbacks. GPT-6.2 Astra drafted this comment. I reviewed and approved this comment before posting.
Foniass commented 2026-12-01 03:03:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:03:32Z.


merge-check
base: d0832e614f
head: 44eeb0c75a
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (ps_masks.rs, x64_masks.rs, kernel.rs). The bug is real on main: in a wave32 pixel shader, v_cmp -> s20 kills s21 in both liveness and taint, so an earlier compare into s21 that is read whole later is wrongly given Form::Own. The fix threads wave64 through vcc_mask / exec_mask / writes / per_lane / run, and every helper reduces to the old constants when wave64 is true, so wave64 output is unchanged. The new test fails on main's logic (liveness-only fix gives [Local, Own], not [None, Own]). The kernel.rs change invalidates the direct DXIL cache as it should. Editing x64_masks.rs also invalidates the HLSL translation cache though HLSL output doesn't change (one recompile). Description: AI use names the tool but not the model (CONTRIBUTING asks for the exact model), and the full suite was left to CI, which has no GPU; this run covers the suite on a GPU.
performance: 60 s smoke of a retail title, main d0832e61 vs this merge (40997e6b): 1516 -> 1457 frames shown (96 %, the title presents at 60 per 2 s in both), peak commit 18133 -> 16746 MB, no device removal, no crash.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7299276586 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7299276586). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:03:32Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read the whole diff (ps_masks.rs, x64_masks.rs, kernel.rs). The bug is real on main: in a wave32 pixel shader, `v_cmp -> s20` kills s21 in both liveness and taint, so an earlier compare into s21 that is read whole later is wrongly given `Form::Own`. The fix threads `wave64` through `vcc_mask` / `exec_mask` / `writes` / `per_lane` / `run`, and every helper reduces to the old constants when `wave64` is true, so wave64 output is unchanged. The new test fails on main's logic (liveness-only fix gives [Local, Own], not [None, Own]). The kernel.rs change invalidates the direct DXIL cache as it should. Editing x64_masks.rs also invalidates the HLSL translation cache though HLSL output doesn't change (one recompile). Description: AI use names the tool but not the model (CONTRIBUTING asks for the exact model), and the full suite was left to CI, which has no GPU; this run covers the suite on a GPU. performance: 60 s smoke of a retail title, main d0832e61 vs this merge (40997e6b): 1516 -> 1457 frames shown (96 %, the title presents at 60 per 2 s in both), peak commit 18133 -> 16746 MB, no device removal, no crash. verdict: safe to merge hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
thehollowedone commented 2026-12-01 03:40:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T03:40:00Z.


Following the RTX 4090 world replay, I found one confound in the proposed Form::Local isolation on head 44eeb0c7.

For every compare that keeps the quad form, lower_valu.rs ORs in the lane's own bit whenever ps_masks contains any cheap-form site. ballot_ps_local(own_bit, true) does not issue another WaveActiveBallot, but it does add lane-dependent shift/OR work. An Own or Uniform site is enough to keep that path active even if all Local sites are disabled. A retained compare can then feed S_CBRANCH_VCCZ, which reads the mask directly.

To isolate the world-frame cost, I suggest three otherwise matched wave32 builds: an empty PS form map (the original quad path); Own/Uniform enabled with Local disabled and the retained-compare own-bit OR off; and the same forms with that OR on. Compare generated DXIL and driver/GPU time, then replay the same world segment with isolated caches. If the OR is implicated, check helper-lane and VCCZ/EXEC parity before narrowing its guard; it can be needed when a Local form has changed EXEC. This is a source-derived experiment, not evidence that the OR causes the RTX 4090 regression.

AI use: Codex (GPT-6.2 Sol) checked the current source and public reports; Codex (GPT-6.2 Astra) independently traced the retained-compare path.

<!-- greyfinch-sync:ivall/xcl:comment:7299940042 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7299940042). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T03:40:00Z. --- Following the [RTX 4090 world replay](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7290041297), I found one confound in the proposed `Form::Local` isolation on [head `44eeb0c7`](https://github.com/xcl-dev/xcl/commit/44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028). For every compare that keeps the quad form, [`lower_valu.rs`](https://github.com/xcl-dev/xcl/blob/44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028/crates/xcl/src/gpu/dxil/lower_valu.rs#L1366-L1382) ORs in the lane's own bit whenever `ps_masks` contains **any** cheap-form site. `ballot_ps_local(own_bit, true)` does not issue another `WaveActiveBallot`, but it does add lane-dependent shift/OR work. An `Own` or `Uniform` site is enough to keep that path active even if all `Local` sites are disabled. A retained compare can then feed `S_CBRANCH_VCCZ`, which reads the mask directly. To isolate the world-frame cost, I suggest three otherwise matched wave32 builds: an empty PS form map (the original quad path); `Own`/`Uniform` enabled with `Local` disabled and the retained-compare own-bit OR off; and the same forms with that OR on. Compare generated DXIL and driver/GPU time, then replay the same world segment with isolated caches. If the OR is implicated, check helper-lane and VCCZ/EXEC parity before narrowing its guard; it can be needed when a `Local` form has changed EXEC. This is a source-derived experiment, not evidence that the OR causes the RTX 4090 regression. AI use: Codex (GPT-6.2 Sol) checked the current source and public reports; Codex (GPT-6.2 Astra) independently traced the retained-compare path.
brainhay5 commented 2026-12-01 06:40:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T06:40:17Z.


merge-check claim
head: 44eeb0c75a

<!-- greyfinch-sync:ivall/xcl:comment:7303137749 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7303137749). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T06:40:17Z. --- merge-check claim head: 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028
brainhay5 commented 2026-12-01 06:49:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T06:49:36Z.


merge-check claim
head: 44eeb0c75a

<!-- greyfinch-sync:ivall/xcl:comment:7303324684 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7303324684). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T06:49:36Z. --- merge-check claim head: 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028
throny commented 2026-12-01 06:55:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T06:55:38Z.


merge-check
base: d0832e614f
head: 44eeb0c75a
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; failing: none (25 SKIPPED lines, all GPU tests on this adapter, e.g. no wave64)
review: Read the whole diff (kernel.rs, ps_masks.rs, x64_masks.rs). The pixel-shader mask analysis took wave64 pairs for VCC/EXEC and compare destinations; it now takes the wave width through forms() and uses the width-aware uses helper (exposed from x64_masks), so a wave32 compare no longer kills the neighbouring SGPR in liveness and taint. Wave64 behaviour is unchanged (the existing tests call it with wave64 = true). The new test reproduces the reported pattern for wave32 and checks the forms. Note: this is translator source, so every tester re-translates shaders; no GPU wave32 shader run was done here, only the unit tests.
performance: can change which wave32 pixel shaders get the Local/Own forms (shader code, not frame time by itself); not measured on a title; reasoned only.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report (the diff review is Sonnet's)

<!-- greyfinch-sync:ivall/xcl:comment:7303443452 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7303443452). Originally posted by [throny](https://github.com/throny) on 2026-12-01T06:55:38Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 44eeb0c75acb0b1d55961fbee4c7f6f14e4cf028 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2891 passed, 0 failed, 51 ignored; failing: none (25 SKIPPED lines, all GPU tests on this adapter, e.g. no wave64) review: Read the whole diff (kernel.rs, ps_masks.rs, x64_masks.rs). The pixel-shader mask analysis took wave64 pairs for VCC/EXEC and compare destinations; it now takes the wave width through forms() and uses the width-aware uses helper (exposed from x64_masks), so a wave32 compare no longer kills the neighbouring SGPR in liveness and taint. Wave64 behaviour is unchanged (the existing tests call it with wave64 = true). The new test reproduces the reported pattern for wave32 and checks the forms. Note: this is translator source, so every tester re-translates shaders; no GPU wave32 shader run was done here, only the unit tests. performance: can change which wave32 pixel shaders get the Local/Own forms (shader code, not frame time by itself); not measured on a title; reasoned only. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300; Claude Code, Claude Sonnet 5.5 ran the build and the suite and read the diff; Claude Opus 5.5 checked this report (the diff review is Sonnet's)
throny commented 2026-12-01 07:00:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T07:00:35Z.


Merged at the checked head after a combined trial of #3400, #3386, #3393 and #3535 on main d0832e61 (RTX 4080 16 GB, cargo test --workspace --no-fail-fast -- --test-threads=4: 2896 passed, 0 failed, 51 ignored, 25 SKIPPED lines). Two merge checks: Foniass and ours.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7303537376 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7303537376). Originally posted by [throny](https://github.com/throny) on 2026-12-01T07:00:35Z. --- Merged at the checked head after a combined trial of #3400, #3386, #3393 and #3535 on `main` `d0832e61` (RTX 4080 16 GB, `cargo test --workspace --no-fail-fast -- --test-threads=4`: 2896 passed, 0 failed, 51 ignored, 25 SKIPPED lines). Two merge checks: Foniass and ours. AI use: Claude Code (Claude Opus 5.5).
brainhay5 commented 2026-12-01 11:48:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T11:48:15Z.


merge-check claim withdrawn
Our automated merge-check loop claimed this PR and then stopped before posting a check — two loops were running at once and both are now shut down. No check from us is coming, so this claim is void and the head is free for someone else to take.

AI use: an agent posted this withdrawal.

<!-- greyfinch-sync:ivall/xcl:comment:7310165471 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7310165471). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T11:48:15Z. --- merge-check claim withdrawn Our automated merge-check loop claimed this PR and then stopped before posting a check — two loops were running at once and both are now shut down. No check from us is coming, so this claim is void and the head is free for someone else to take. *AI use: an agent posted this withdrawal.*
minimalhipster990 commented 2026-12-01 11:58:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by minimalhipster990 on 2026-12-01T11:58:41Z.


I ran the three variants suggested in the retained-compare discussion. Disabling Form::Local with the original own-bit OR gave 0.228 fps, against 0.210 fps for the unchanged stack. The three most expensive pixel shaders in this replay are guest wave64 programs running on a wave32 RTX 4090, so I applied each variant to both guest widths.

Direct PS variant Result on the 4090
Empty form map Device hung before world entry at 98.1 and 90.0 s
Own + Uniform, Local disabled, retained OR off Device hung before world entry at 83.7 and 92.2 s
Same forms, original retained OR Both runs reached the world and finished 600 s. Measured run had 54 presents in 236.9 s
Unchanged stack 50 presents in 238.5 s in the measured repeat

Same Series X save and scripted input on driver 621.40. Release builds on ff0c364b + #3318 + #3528 (49eb78ef) + #3535 (44eeb0c7), private XCL caches, same GPU profiler settings. FPS is over 300–540 s. The slowest mesh/PS pair averaged 12.47 ms per two-pass call with Local disabled and 12.62 ms on the unchanged stack. Disabling Local did not restore the historical ~0.75 fps. The OR-off runs ended before the GPU sample, so its in-world timing and helper-lane correctness remain open.

AI use: Codex (GPT-6) prepared the diagnostic variants, ran the replays, checked shader widths and drafted this update.

<!-- greyfinch-sync:ivall/xcl:comment:7310449269 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7310449269). Originally posted by [minimalhipster990](https://github.com/minimalhipster990) on 2026-12-01T11:58:41Z. --- I ran the three variants suggested in the [retained-compare discussion](https://github.com/xcl-dev/xcl/pull/3535#issuecomment-7299940042). Disabling `Form::Local` with the original own-bit OR gave **0.228 fps**, against **0.210 fps** for the unchanged stack. The three most expensive pixel shaders in this replay are guest wave64 programs running on a wave32 RTX 4090, so I applied each variant to both guest widths. | Direct PS variant | Result on the 4090 | |---|---| | Empty form map | Device hung before world entry at 98.1 and 90.0 s | | Own + Uniform, Local disabled, retained OR off | Device hung before world entry at 83.7 and 92.2 s | | Same forms, original retained OR | Both runs reached the world and finished 600 s. Measured run had 54 presents in 236.9 s | | Unchanged stack | 50 presents in 238.5 s in the measured repeat | Same Series X save and scripted input on driver 621.40. Release builds on `ff0c364b` + #3318 + #3528 (`49eb78ef`) + #3535 (`44eeb0c7`), private XCL caches, same GPU profiler settings. FPS is over 300–540 s. The slowest mesh/PS pair averaged 12.47 ms per two-pass call with Local disabled and 12.62 ms on the unchanged stack. Disabling Local did not restore the historical ~0.75 fps. The OR-off runs ended before the GPU sample, so its in-world timing and helper-lane correctness remain open. AI use: Codex (GPT-6) prepared the diagnostic variants, ran the replays, checked shader widths and drafted this update.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3535
No description provided.