Recompiler: direct PS compares skip the per-quad mask where no helper bit is read #2561

Merged
Kalmarv merged 1 commit from upstream-pr/2571 into main 2026-11-30 04:53:33 +00:00
Kalmarv commented 2026-11-25 23:17:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-25T23:17:55Z.


Since #2083 every pixel-shader compare on the direct DXIL route rebuilds its quad's four bits: quad reads of its VGPR operands and four WaveActiveBallot passes. That is right for masks whose helper-lane bits are read, but it is used for every compare. On the 610 pixel shaders of title ea3b5e4d, it makes the DXIL 1.42× larger than before #2083 (median 1.36×). @MarcosMDev measured +28 % to +81 % driver time on an RTX 4060 in #2083, and found that a mask only v_cndmask reads needs no ballot.

This PR picks the cheapest form each compare's mask allows, from a forward dataflow analysis (recomp/ps_masks.rs):

  • own bit: a mask that is never read whole (x64_masks) takes the lane's own bit, as @MarcosMDev's variant in #2083 did;
  • WaveActiveBallot(c) | own bit (the HLSL path's ballot_px_local): a mask that is read whole, but where nothing reads another lane's helper bit. In this form every lane's copy has the live lanes' bits and its own bit right. So EXEC predication, v_cndmask and carry-ins stay exact in helper lanes, and so do the values they compute for later derivatives. The analysis refuses the form where something reads another lane's bit:
    • a non-bitwise SALU (s_cmp, s_wqm, s_bcnt …), SCC or VCCZ of the mask, or a scalar operand;
    • DPP, ds_swizzle / bpermute or permlane while EXEC carries the mask (they read the source lane's bit of the reader's EXEC);
    • v_readfirstlane under it (waterfall loops);
    • SGPRs, SCC or a widened EXEC that a branch on such an EXEC makes differ between lanes after it.
      A register known to be a subset of the entry EXEC (the live-pixel mask a kill updates) has no helper bits, so it is exact whatever it was computed from;
  • cond ? EXEC : 0: a compare of scalar / constant operands;
  • every other compare keeps #2083's form, and ORs in its own bit, which the quad's other lanes may not have seen in their copy of EXEC.

None of the new forms has a quad op, so #134's AMD constraint holds: the kept compares still quad-read their operands, never the predicate.

On the 610 PS (110,821 compares) the forms split as:

form compares
own bit 43.0 %
ballot | own bit 30.7 %
cond ? EXEC : 0 3.6 %
kept (#2083's form) 22.7 %

The main reasons a compare is kept (shares of the whole-read masks, first reason only):

  • s_cbranch_vccz on the mask: 20 %;
  • s_andn2_wrexec / s_mov exec changes inside a branch on it: 7 %;
  • v_readfirstlane: 4 %;
  • SCC of a non-EXEC mask: 4 %.

Part of #156. Follows #2083.

What is in it

  • crates/xcl/src/gpu/recomp/ps_masks.rs: the analysis (forms), with unit tests.
  • crates/xcl/src/gpu/dxil/lower_valu.rs, lanes.rs: Lw::vopc takes the chosen form; Lw::ballot_ps_local; kept compares OR in their own bit. kernel.rs computes the forms for pixel shaders (not the split form), compact.rs keys blocks on them, and TRANSLATOR_VERSION 10.
  • lanes.rs test: #2083's standalone v_cmp read only by v_cndmask now expects no quad reads.
  • TRANSLATOR_VERSION 10 is also taken by my wave64-split PR; whichever lands second rebases to 11.

Tested

  • RTX 5070 Ti (NVIDIA 610.74), Ryzen 9 9950X, Windows 11 26200, rustc 1.99.0, DXC 1.9.2609, release.
  • DXIL, xcl shaders --direct --windows 4 --split 0 --validate on the 610 PS of title ea3b5e4d (DXC 1.9.2609): 0 errors, all validated on both sides.
    • Total 244.5 MB on main → 191.6 MB (×0.784); per program median ×0.81, best ×0.40.
    • Against before #2083 (e44af706): main is ×1.415 in total, this PR ×1.109.
  • DXIL instructions (dxc -dumpbin, function bodies) on 22 of them (the median and the largest growth under #2083, 20 random): 1,120,934 on main → 824,591 (×0.736); per program median ×0.79, best ×0.39. DXIL bytes on the same 22: 7.65 MB → 5.76 MB.
  • Driver compile time, RTX 5070 Ti: cold CreateGraphicsPipelineState (driver shader cache off with ShaderCacheControl) of each of the 22 PS with a pass-through VS, main and this PR alternating, two repeats (local harness, not in this PR):
    • repeat 1: 174.3 s on main → 128.6 s (−26 %); repeat 2: 164.5 s → 135.4 s (−18 %);
    • driver blob 9.87 MB → 7.94 MB (−20 %);
    • per program the ratio is 0.28 to 1.30 (other builds ran on the machine); 16 of the 22 are faster over both repeats.
  • The title's own pipelines, through the runtime path (XCL_DIRECT_DXIL=all; VS and PS take the non-split direct form there): the 509 PS behind its cold graphics pipelines are 104.4 MiB of DXIL on main and 72.1 MiB here (−31 %), 16.62 M → 11.12 M instructions; VS unchanged; 0 failures.
  • GPU tests (RTX 5070 Ti), lib tests built from this head plus a local xcl shaders reporting patch (CLI only, not in this PR): ps_ballot_tests 4 passed (with #2083's gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges: ddx, ddy and a waterfall loop on triangle edges); XCL_DIRECT_DXIL=all, gpu_ps_: 8 passed; XCL_DIRECT_DXIL=all, gpu_wave64_ps: 2 passed; 0 failed, 0 skipped.
  • cargo test --release --workspace --no-fail-fast -- --test-threads=4 on the RTX 5070 Ti (XCL_DXC_DIR = DXC 1.9.2609): 1426 passed, 0 failed, 46 ignored. SKIPPED (15 tests): the wave64 cases (no wave64 on this GPU) of lower_dxil / lower / kernel tests, gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware; the f16 / f32-conversion per-lane cases (refused forms); heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • The same with no GPU (XCL_ADAPTER=nomatch): 1426 passed, 0 failed, 46 ignored. Two earlier runs of the lib binary ended in an access violation inside tls::tests, which this PR does not touch; those tests pass alone (15 of 15 runs).
  • RTX 2060 (NVIDIA 595.91) under Wine (wine-staging 11.21) + vkd3d-proton 30b0eb9, windows-gnu release lib tests, this head and main e1d84b7d, XCL_DIRECT_DXIL=all:
    • ps_ballot_tests 4/0/0, gpu_ps_ 8/0/0, gpu_wave64_ps 2/0/0 on both, no SKIPPED;
    • gpu::: 700 passed, 3 failed, 22 ignored here, 697/3/22 on main (the 3 more are the new ps_masks tests). The same 3 fail on both (f64 / f16 rounding on that stack) and the same 13 tests print SKIPPED on both.

Regression run

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: f4ee8ac5f934d431b5b112df1f7293027f0ed9ff
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 59
device removals: 0
crashes: 0
peak commit: 15302 MB

Not tested

  • AMD. Thanks to @luckyteagirl for the RX 6800M run (AMD 30.0.13002.13003): gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges exits 0xc0000005 before a result on this head and on an earlier head (#2514, 57853e01); the Windows Application Error events put all three crashes inside amdxc64.dll at the same offset (0x6b097b). So the crash is in the driver and not new here; it does not show whether this PR's shaders reach it more or less often. The new forms add no quad op (#134's constraint).
  • Intel.
  • The split form (wave64 on 32-lane hardware) keeps #2083's form everywhere.
  • The HLSL path is unchanged: it still uses ballot_px for every whole-live mask.

AI use

  • Claude Code, Claude Opus 5.5: wrote the analysis, the lowering and the tests, ran the measurements and wrote this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5500854817 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-25T23:17:55Z. --- Since #2083 every pixel-shader compare on the direct DXIL route rebuilds its quad's four bits: quad reads of its VGPR operands and four `WaveActiveBallot` passes. That is right for masks whose helper-lane bits are read, but it is used for every compare. On the 610 pixel shaders of title ea3b5e4d, it makes the DXIL 1.42× larger than before #2083 (median 1.36×). @MarcosMDev measured +28 % to +81 % driver time on an RTX 4060 in #2083, and found that a mask only `v_cndmask` reads needs no ballot. This PR picks the cheapest form each compare's mask allows, from a forward dataflow analysis (`recomp/ps_masks.rs`): - **own bit**: a mask that is never read whole (`x64_masks`) takes the lane's own bit, as @MarcosMDev's variant in #2083 did; - **`WaveActiveBallot(c) | own bit`** (the HLSL path's `ballot_px_local`): a mask that is read whole, but where nothing reads another lane's helper bit. In this form every lane's copy has the live lanes' bits and its own bit right. So EXEC predication, `v_cndmask` and carry-ins stay exact in helper lanes, and so do the values they compute for later derivatives. The analysis refuses the form where something reads another lane's bit: - a non-bitwise SALU (`s_cmp`, `s_wqm`, `s_bcnt` …), SCC or VCCZ of the mask, or a scalar operand; - DPP, `ds_swizzle` / `bpermute` or permlane while EXEC carries the mask (they read the source lane's bit of the reader's EXEC); - `v_readfirstlane` under it (waterfall loops); - SGPRs, SCC or a widened EXEC that a branch on such an EXEC makes differ between lanes after it. A register known to be a subset of the entry EXEC (the live-pixel mask a kill updates) has no helper bits, so it is exact whatever it was computed from; - **`cond ? EXEC : 0`**: a compare of scalar / constant operands; - every other compare keeps #2083's form, and ORs in its own bit, which the quad's other lanes may not have seen in their copy of EXEC. None of the new forms has a quad op, so #134's AMD constraint holds: the kept compares still quad-read their operands, never the predicate. On the 610 PS (110,821 compares) the forms split as: | form | compares | |---|---:| | own bit | 43.0 % | | ballot \| own bit | 30.7 % | | cond ? EXEC : 0 | 3.6 % | | kept (#2083's form) | 22.7 % | The main reasons a compare is kept (shares of the whole-read masks, first reason only): - `s_cbranch_vccz` on the mask: 20 %; - `s_andn2_wrexec` / `s_mov exec` changes inside a branch on it: 7 %; - `v_readfirstlane`: 4 %; - SCC of a non-EXEC mask: 4 %. Part of #156. Follows #2083. **What is in it** - `crates/xcl/src/gpu/recomp/ps_masks.rs`: the analysis (`forms`), with unit tests. - `crates/xcl/src/gpu/dxil/lower_valu.rs`, `lanes.rs`: `Lw::vopc` takes the chosen form; `Lw::ballot_ps_local`; kept compares OR in their own bit. `kernel.rs` computes the forms for pixel shaders (not the split form), `compact.rs` keys blocks on them, and `TRANSLATOR_VERSION` 10. - `lanes.rs` test: #2083's standalone `v_cmp` read only by `v_cndmask` now expects no quad reads. - `TRANSLATOR_VERSION` 10 is also taken by my wave64-split PR; whichever lands second rebases to 11. **Tested** - RTX 5070 Ti (NVIDIA 610.74), Ryzen 9 9950X, Windows 11 26200, rustc 1.99.0, DXC 1.9.2609, release. - DXIL, `xcl shaders --direct --windows 4 --split 0 --validate` on the 610 PS of title ea3b5e4d (DXC 1.9.2609): 0 errors, all validated on both sides. - Total 244.5 MB on main → 191.6 MB (×0.784); per program median ×0.81, best ×0.40. - Against before #2083 (e44af706): main is ×1.415 in total, this PR ×1.109. - DXIL instructions (`dxc -dumpbin`, function bodies) on 22 of them (the median and the largest growth under #2083, 20 random): 1,120,934 on main → 824,591 (×0.736); per program median ×0.79, best ×0.39. DXIL bytes on the same 22: 7.65 MB → 5.76 MB. - Driver compile time, RTX 5070 Ti: cold `CreateGraphicsPipelineState` (driver shader cache off with `ShaderCacheControl`) of each of the 22 PS with a pass-through VS, main and this PR alternating, two repeats (local harness, not in this PR): - repeat 1: 174.3 s on main → 128.6 s (−26 %); repeat 2: 164.5 s → 135.4 s (−18 %); - driver blob 9.87 MB → 7.94 MB (−20 %); - per program the ratio is 0.28 to 1.30 (other builds ran on the machine); 16 of the 22 are faster over both repeats. - The title's own pipelines, through the runtime path (`XCL_DIRECT_DXIL=all`; VS and PS take the non-split direct form there): the 509 PS behind its cold graphics pipelines are 104.4 MiB of DXIL on main and 72.1 MiB here (−31 %), 16.62 M → 11.12 M instructions; VS unchanged; 0 failures. - GPU tests (RTX 5070 Ti), lib tests built from this head plus a local `xcl shaders` reporting patch (CLI only, not in this PR): `ps_ballot_tests` 4 passed (with #2083's `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges`: ddx, ddy and a waterfall loop on triangle edges); `XCL_DIRECT_DXIL=all`, `gpu_ps_`: 8 passed; `XCL_DIRECT_DXIL=all`, `gpu_wave64_ps`: 2 passed; 0 failed, 0 skipped. - `cargo test --release --workspace --no-fail-fast -- --test-threads=4` on the RTX 5070 Ti (`XCL_DXC_DIR` = DXC 1.9.2609): 1426 passed, 0 failed, 46 ignored. `SKIPPED` (15 tests): the wave64 cases (no wave64 on this GPU) of `lower_dxil` / `lower` / kernel tests, `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`; the f16 / f32-conversion per-lane cases (refused forms); `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - The same with no GPU (`XCL_ADAPTER=nomatch`): 1426 passed, 0 failed, 46 ignored. Two earlier runs of the lib binary ended in an access violation inside `tls::tests`, which this PR does not touch; those tests pass alone (15 of 15 runs). - RTX 2060 (NVIDIA 595.91) under Wine (wine-staging 11.21) + vkd3d-proton 30b0eb9, windows-gnu release lib tests, this head and main e1d84b7d, `XCL_DIRECT_DXIL=all`: - `ps_ballot_tests` 4/0/0, `gpu_ps_` 8/0/0, `gpu_wave64_ps` 2/0/0 on both, no `SKIPPED`; - `gpu::`: 700 passed, 3 failed, 22 ignored here, 697/3/22 on main (the 3 more are the new `ps_masks` tests). The same 3 fail on both (f64 / f16 rounding on that stack) and the same 13 tests print `SKIPPED` on both. **Regression run** `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: f4ee8ac5f934d431b5b112df1f7293027f0ed9ff gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 60 59 device removals: 0 crashes: 0 peak commit: 15302 MB ``` **Not tested** - AMD. Thanks to @luckyteagirl for the RX 6800M run (AMD 30.0.13002.13003): `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges` exits 0xc0000005 before a result on this head and on an earlier head (#2514, 57853e01); the Windows Application Error events put all three crashes inside amdxc64.dll at the same offset (0x6b097b). So the crash is in the driver and not new here; it does not show whether this PR's shaders reach it more or less often. The new forms add no quad op (#134's constraint). - Intel. - The split form (wave64 on 32-lane hardware) keeps #2083's form everywhere. - The HLSL path is unchanged: it still uses `ballot_px` for every whole-live mask. **AI use** - Claude Code, Claude Opus 5.5: wrote the analysis, the lowering and the tests, ran the measurements and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DavidM1911 commented 2026-11-26 00:05:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T23:28:49Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7177617256 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7177617256). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T23:28:49Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 26 ignored. Thanks! — Devin
luckyteagirl commented 2026-11-26 01:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T00:46:47Z.


RX 6800M focused test report for #2571: the helper-lane pixel test starts, then the Windows test process exits with 0xc0000005 (STATUS_ACCESS_VIOLATION) before reporting a pass or failure. I reproduced this on the exact PR head and on an earlier XCL head, so I cannot attribute the crash to this PR.

Setup: Windows 11 Home build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M (driver 30.0.13002.13003), Rust 1.99.0 MSVC, DXC/dxil 1.9.2609.5. XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=wave64, XCL_DIRECT_DXIL=1, with XCL_DXC_DIR set to the pinned DXC folder. Clean detached PR head ad0ded91d9fac08d27631c8c09b2b83c9c923adf, isolated Cargo target.

Tested: cargo test --locked -p xcl --lib -j 1 gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges -- --test-threads=1 --show-output, under a monitor that stops on low free system commit or physical memory. Compilation completed and the harness printed running 1 test, the exact fixture name, and the DXC version. It then exited 0xc0000005 before ok, FAILED, or summary counts. The guard did not stop this run. A no-build direct rerun of the same test binary with --exact --test-threads=1 --nocapture reproduced the same exit. There was no SKIPPED line in either run; neither produced a test result.

Earlier-head control: The same exact test in a previously built clean #2514 binary (57853e017054d715cd46cd3c07cb70e58eddddc8) also exited 0xc0000005 at the same point, with no test result. That head has the same lanes.rs as current main, but other compiler files differ, so this is not an exact-main baseline.

Not tested: exact current main, a title smoke pair, or the full suite. The first cold build attempt stopped at the memory guard before any test ran; it is not counted as a test result. No game files were used.

AI use: Codex (GPT-6) and a Codex Luna subagent ran the guarded test and direct controls, verified commit and binary provenance, and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7179104814 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7179104814). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T00:46:47Z. --- **RX 6800M focused test report for #2571:** the helper-lane pixel test starts, then the Windows test process exits with `0xc0000005 (STATUS_ACCESS_VIOLATION)` before reporting a pass or failure. I reproduced this on the exact PR head and on an earlier XCL head, so I cannot attribute the crash to this PR. **Setup:** Windows 11 Home build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M (driver `30.0.13002.13003`), Rust 1.99.0 MSVC, DXC/dxil `1.9.2609.5`. `XCL_ADAPTER=6800M`, `XCL_REQUIRE_GPU=wave64`, `XCL_DIRECT_DXIL=1`, with `XCL_DXC_DIR` set to the pinned DXC folder. Clean detached PR head `ad0ded91d9fac08d27631c8c09b2b83c9c923adf`, isolated Cargo target. **Tested:** `cargo test --locked -p xcl --lib -j 1 gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges -- --test-threads=1 --show-output`, under a monitor that stops on low free system commit or physical memory. Compilation completed and the harness printed `running 1 test`, the exact fixture name, and the DXC version. It then exited `0xc0000005` before `ok`, `FAILED`, or summary counts. The guard did not stop this run. A no-build direct rerun of the same test binary with `--exact --test-threads=1 --nocapture` reproduced the same exit. There was no `SKIPPED` line in either run; neither produced a test result. **Earlier-head control:** The same exact test in a previously built clean #2514 binary (`57853e017054d715cd46cd3c07cb70e58eddddc8`) also exited `0xc0000005` at the same point, with no test result. That head has the same `lanes.rs` as current `main`, but other compiler files differ, so this is not an exact-main baseline. **Not tested:** exact current `main`, a title smoke pair, or the full suite. The first cold build attempt stopped at the memory guard before any test ran; it is not counted as a test result. No game files were used. **AI use:** Codex (GPT-6) and a Codex Luna subagent ran the guarded test and direct controls, verified commit and binary provenance, and wrote this report.
luckyteagirl commented 2026-11-26 02:08:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T01:14:34Z.


Follow-up to my RX 6800M report above: Windows Application Error (Event ID 1000) records all three focused-test process crashes in amdxc64.dll version 30.0.13002.13003, with exception 0xc0000005 at the same fault offset 0x00000000006b097b. Two events name the exact #2571 test binary under work-pr2571/target; the third names the earlier-head control binary under work-pr2444/target. Their recorded times were 16:43:25, 16:44:57, and 16:45:55 local on 2026-11-25.

This localizes the observed access violation to the AMD shader-compiler module on this machine. The earlier-head control faulted at the same offset, so it still does not establish a regression from #2571. I have no call stack or shader compiler dump and did not rerun the test for this follow-up.

AI use: Codex (GPT-6) read the local Windows Application Error records and prepared this supplemental report.

<!-- greyfinch-sync:ivall/xcl:comment:7179575913 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7179575913). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T01:14:34Z. --- Follow-up to my RX 6800M report above: Windows Application Error (Event ID 1000) records **all three** focused-test process crashes in `amdxc64.dll` version `30.0.13002.13003`, with exception `0xc0000005` at the **same fault offset `0x00000000006b097b`**. Two events name the exact #2571 test binary under `work-pr2571/target`; the third names the earlier-head control binary under `work-pr2444/target`. Their recorded times were 16:43:25, 16:44:57, and 16:45:55 local on 2026-11-25. This localizes the observed access violation to the AMD shader-compiler module on this machine. The earlier-head control faulted at the same offset, so it still does not establish a regression from #2571. I have no call stack or shader compiler dump and did not rerun the test for this follow-up. AI use: Codex (GPT-6) read the local Windows Application Error records and prepared this supplemental report.
rgroenewoudt commented 2026-11-26 19:46:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by rgroenewoudt on 2026-11-26T19:46:50Z.


Test report on AMD RDNA4 for ad0ded91

Tested

  • AMD Radeon RX 9070 (driver 32.0.32029.2010), Ryzen 9 5950X, 32 GB, Windows 11 Pro 26300, rustc 1.100.0, DXC 1.9.2602.17 (Windows Kits 10.0.26100.0), debug.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on ad0ded91: 1424 passed, 2 failed, 46 ignored.
    • The 2 failures are fuzz_validate_and_gpu_1 (seed 722) and fuzz_validate_and_gpu_3 (seed 1599), which also fail on main on this GPU (#2115).
    • SKIPPED: f16_programs_on_the_gpu (4 cases) and f32_programs_on_the_gpu (2 cases), both refused per-lane forms, and heap_window_out_of_memory_falls_back_to_the_switch_form.
  • gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges and gpu_ps_masks_hold_helper_lanes_on_triangle_edges pass on this GPU, with no crash in amdxc64.dll.
  • With XCL_DIRECT_DXIL=all, cargo test -p xcl --lib <filter> on this head and on its base e1d84b7d:
filter this head base
ps_ballot_tests 4 passed 4 passed
gpu_ps_ 8 passed 8 passed
gpu_wave64_ps 2 passed 2 passed
ps_masks 6 passed 3 passed

0 failed and no SKIPPED in any of them.

Not tested

  • A smoke run on a title and the driver compile time on AMD.
  • RDNA2/RDNA3; the RX 6800M crash in the earlier report is not checked here.
  • This head is not rebased onto current main.

AI use

  • Claude Code, Claude Opus 5.5: ran the tests and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7201953258 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7201953258). Originally posted by [rgroenewoudt](https://github.com/rgroenewoudt) on 2026-11-26T19:46:50Z. --- **Test report on AMD RDNA4 for ad0ded91** **Tested** - AMD Radeon RX 9070 (driver 32.0.32029.2010), Ryzen 9 5950X, 32 GB, Windows 11 Pro 26300, rustc 1.100.0, DXC 1.9.2602.17 (Windows Kits 10.0.26100.0), debug. - `cargo test --workspace --no-fail-fast -- --test-threads=4` on `ad0ded91`: 1424 passed, 2 failed, 46 ignored. - The 2 failures are `fuzz_validate_and_gpu_1` (seed 722) and `fuzz_validate_and_gpu_3` (seed 1599), which also fail on main on this GPU (#2115). - `SKIPPED`: `f16_programs_on_the_gpu` (4 cases) and `f32_programs_on_the_gpu` (2 cases), both refused per-lane forms, and `heap_window_out_of_memory_falls_back_to_the_switch_form`. - `gpu_direct_ps_masks_hold_helper_lanes_on_triangle_edges` and `gpu_ps_masks_hold_helper_lanes_on_triangle_edges` pass on this GPU, with no crash in `amdxc64.dll`. - With `XCL_DIRECT_DXIL=all`, `cargo test -p xcl --lib <filter>` on this head and on its base `e1d84b7d`: | filter | this head | base | |---|---|---| | `ps_ballot_tests` | 4 passed | 4 passed | | `gpu_ps_` | 8 passed | 8 passed | | `gpu_wave64_ps` | 2 passed | 2 passed | | `ps_masks` | 6 passed | 3 passed | 0 failed and no `SKIPPED` in any of them. **Not tested** - A smoke run on a title and the driver compile time on AMD. - RDNA2/RDNA3; the RX 6800M crash in the earlier report is not checked here. - This head is not rebased onto current main. **AI use** - Claude Code, Claude Opus 5.5: ran the tests and wrote this report.
Decodere commented 2026-11-26 22:33:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T22:33:41Z.


Independent desktop NVIDIA (Wave32-only Ada) verification of PR #2571 at head ad0ded91d9fac08d27631c8c09b2b83c9c923adf (1 commit; exact parent & merge-base: e1d84b7d9153f86a97d2ec5d209d196046fc0bea, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12, Wave32-only Ada), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2609.5, --release

Targeted release tests & build (ad0ded91)

Command Result
cargo test --release -p xcl --lib masks_read_lane_by_lane_or_restored_before_derivatives_take_the_cheap_forms -- --nocapture 1 passed; 0 failed; 0 ignored; 1326 filtered out (0.00s)
cargo test --release -p xcl --lib masks_read_across_lanes_keep_the_quad_form -- --nocapture 1 passed; 0 failed; 0 ignored; 1326 filtered out (0.00s)
cargo test --release -p xcl --lib a_kill_mask_of_live_lanes_stays_exact -- --nocapture 1 passed; 0 failed; 0 ignored; 1326 filtered out (0.00s)
cargo test --release -p xcl --lib gpu::recomp::ps_masks:: (3 consecutive runs) 3 passed; 0 failed; 0 ignored; 1324 filtered out × 3 (0.00s, 0.00s, 0.00s)
cargo test --release -p xcl --lib gpu::dxil:: 183 passed; 0 failed; 3 ignored; 1141 filtered out (3.41s; dispatch_chain_native_wave64_builds_whole self-skipped on Wave32-only RTX 4060)
cargo test --release -p xcl --lib gpu::recomp:: 395 passed; 0 failed; 19 ignored; 913 filtered out (5.09s; Wave64-only and #1426-refused subcases self-skipped as expected)
cargo build --release -p xcl --bin xcl Clean build (1m 09s, exit 0)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB

PR #2571 (ad0ded91d9fac08d27631c8c09b2b83c9c923adf):

xcl-smoke v1
commit: ad0ded91d9fac08d27631c8c09b2b83c9c923adf
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1605 (PresentX 1605)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13990 MB

Runtime log observations (xcl.log)

  • 9220 log lines, 0 [ERROR] / device-removal / panic lines.
  • Final draw/memory telemetry in log: 19618 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 13990 MB committed by the process; video memory 6116 MB local, 4651 MB non-local.

Limits of coverage

  • Pixel-shader mask classification (ps_masks::, 3×) and full gpu::dxil:: / gpu::recomp:: suites passed on RTX 4060 (with expected Wave64-only skips on Wave32-only Ada and existing #[ignore] dump/fuzz/benchmark tests left ignored).
  • No separate cold retail PS corpus DXIL-size or driver compile-time benchmark (retail_ps_gallery / retail_shader_cost) or visual pixel-diff inspection was performed; the 60 s warm-cache retail smoke confirms clean runtime execution and zero regression on title: 29640639 (frame-count delta vs. cached parent smoke reflects normal single-run startup variance, not this PR).

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

<!-- greyfinch-sync:ivall/xcl:comment:7204787824 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7204787824). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T22:33:41Z. --- Independent desktop NVIDIA (Wave32-only Ada) verification of **PR #2571** at head `ad0ded91d9fac08d27631c8c09b2b83c9c923adf` (`1` commit; exact parent & merge-base: `e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, pre-`#2555` ancestor of `main`). ### Environment - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12, Wave32-only Ada), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6C / 12T), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` (Developer Mode off) - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC, DXC `1.9.2609.5`, `--release` ### Targeted release tests & build (`ad0ded91`) | Command | Result | | --- | --- | | `cargo test --release -p xcl --lib masks_read_lane_by_lane_or_restored_before_derivatives_take_the_cheap_forms -- --nocapture` | `1 passed; 0 failed; 0 ignored; 1326 filtered out` (`0.00s`) | | `cargo test --release -p xcl --lib masks_read_across_lanes_keep_the_quad_form -- --nocapture` | `1 passed; 0 failed; 0 ignored; 1326 filtered out` (`0.00s`) | | `cargo test --release -p xcl --lib a_kill_mask_of_live_lanes_stays_exact -- --nocapture` | `1 passed; 0 failed; 0 ignored; 1326 filtered out` (`0.00s`) | | `cargo test --release -p xcl --lib gpu::recomp::ps_masks::` (3 consecutive runs) | `3 passed; 0 failed; 0 ignored; 1324 filtered out` × 3 (`0.00s`, `0.00s`, `0.00s`) | | `cargo test --release -p xcl --lib gpu::dxil::` | `183 passed; 0 failed; 3 ignored; 1141 filtered out` (`3.41s`; `dispatch_chain_native_wave64_builds_whole` self-skipped on Wave32-only RTX 4060) | | `cargo test --release -p xcl --lib gpu::recomp::` | `395 passed; 0 failed; 19 ignored; 913 filtered out` (`5.09s`; Wave64-only and `#1426`-refused subcases self-skipped as expected) | | `cargo build --release -p xcl --bin xcl` | Clean build (`1m 09s`, exit `0`) | ### Paired quiet 60 s retail smoke (`title: 29640639`) Exact parent & merge-base (`e1d84b7d9153f86a97d2ec5d209d196046fc0bea`, cached baseline on the same machine): ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1531 (PresentX 1531) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13982 MB ``` PR #2571 (`ad0ded91d9fac08d27631c8c09b2b83c9c923adf`): ``` xcl-smoke v1 commit: ad0ded91d9fac08d27631c8c09b2b83c9c923adf gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1605 (PresentX 1605) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13990 MB ``` ### Runtime log observations (`xcl.log`) - `9220` log lines, `0` `[ERROR]` / device-removal / panic lines. - Final draw/memory telemetry in log: `19618 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped)`; last memory sample `13990 MB committed by the process; video memory 6116 MB local, 4651 MB non-local`. ### Limits of coverage - Pixel-shader mask classification (`ps_masks::`, 3×) and full `gpu::dxil::` / `gpu::recomp::` suites passed on RTX 4060 (with expected Wave64-only skips on Wave32-only Ada and existing `#[ignore]` dump/fuzz/benchmark tests left ignored). - No separate cold retail PS corpus DXIL-size or driver compile-time benchmark (`retail_ps_gallery` / `retail_shader_cost`) or visual pixel-diff inspection was performed; the 60 s warm-cache retail smoke confirms clean runtime execution and zero regression on `title: 29640639` (frame-count delta vs. cached parent smoke reflects normal single-run startup variance, not this PR). *AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).*
JJAutoCompare commented 2026-11-27 00:38:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:38:48Z.


Tested: Clean ad0ded91d9fac08d27631c8c09b2b83c9c923adf, Windows 11 build 26200.9974, Ryzen 7 3800X, Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, debug. cargo test --locked -p xcl --lib -j 2 --no-run, then exact test names with --test-threads=1 --nocapture. Eight CPU assertions and six Arc GPU fixtures passed, with zero failures, ignores or skips. The CPU fixtures checked lane-local compare and cross-lane helper reconstruction. HLSL and Direct DXIL triangle edge variants reported zero bad pixels out of 1,024 per draw. The helper ballot, mask and readfirstlane loops and the four EXP VM survival cases also passed.

Not tested: Base comparison, native wave64, full suite, retail smoke and performance.

AI use: T3 Code / Codex (gpt-6.2-sol) ran and reran the fixtures and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7206633301 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7206633301). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-27T00:38:48Z. --- **Tested:** Clean `ad0ded91d9fac08d27631c8c09b2b83c9c923adf`, Windows 11 build 26200.9974, Ryzen 7 3800X, Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, debug. `cargo test --locked -p xcl --lib -j 2 --no-run`, then exact test names with `--test-threads=1 --nocapture`. Eight CPU assertions and six Arc GPU fixtures passed, with zero failures, ignores or skips. The CPU fixtures checked lane-local compare and cross-lane helper reconstruction. HLSL and Direct DXIL triangle edge variants reported zero bad pixels out of 1,024 per draw. The helper ballot, mask and readfirstlane loops and the four `EXP VM` survival cases also passed. **Not tested:** Base comparison, native wave64, full suite, retail smoke and performance. **AI use:** T3 Code / Codex (`gpt-6.2-sol`) ran and reran the fixtures and wrote this report.
CharlyRien commented 2026-11-29 13:09:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CharlyRien on 2026-11-29T13:09:43Z.


A possible wave32 gap in ps_masks::forms(). I found it by reading the code; it is not measured in-game. Could you check it with a wave32 test on your side?

Read (head ad0ded91, and the same code rebased onto main 7a649b0e):

  • crates/xcl/src/gpu/recomp/ps_masks.rs:284: forms() takes its liveness from x64_masks::whole_live_out(insts, false). That function always calls whole_live_out_for_width(.., wave64 = true) (x64_masks.rs:543-545).
  • dxil/kernel.rs:758-759 calls forms() for every pixel program that is not split. That includes console wave32 pixel shaders on any card.
  • In wave64, a V_CMP writes an SGPR pair. In wave32 it writes one SGPR. With the wave64 liveness, a compare into s20 is treated as killing s21 as well.
  • Example (PS, wave32): v_cmp → s21, then v_cmp → s20, then s_bcnt1 s21. In the wave64 view, the first compare is dead at its site, so it gets Form::Own. But in wave32, s21 is still live and is read whole by s_bcnt1, which then counts only the lane's own bit.
  • This looks like the same shape as #2584, which #2781 fixed for the HLSL path ("Wave32 pixel mask writes kill one SGPR, not a pair"), but not for this direct-path analysis.
  • The tests in ps_masks.rs (forms_of, l.457) all build wave64 programs.

Deduced: in wave32 pixel shaders translated by the direct path, a compare whose destination is still read whole could get the per-lane form, giving wrong counts or ballots on helper-lane / triangle-edge pixels. I have not identified any affected program in a run.

Suggested: pass the wave width to forms() and use the width-aware liveness (whole_live_out_for_width, currently private), plus one wave32 test with the sequence above.

Context: we read this while rebasing a test tree onto main 7a649b0e (RTX 3090 24 GB, driver 616.56, Windows 11 22631). Nothing was built or run for this note.

AI use: found by an independent code review run with Claude Code (Claude Opus 5.5), checked and posted by me.

<!-- greyfinch-sync:ivall/xcl:comment:7256333484 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7256333484). Originally posted by [CharlyRien](https://github.com/CharlyRien) on 2026-11-29T13:09:43Z. --- A possible wave32 gap in `ps_masks::forms()`. I found it by reading the code; it is **not measured in-game**. Could you check it with a wave32 test on your side? **Read** (head ad0ded91, and the same code rebased onto main 7a649b0e): - `crates/xcl/src/gpu/recomp/ps_masks.rs:284`: `forms()` takes its liveness from `x64_masks::whole_live_out(insts, false)`. That function always calls `whole_live_out_for_width(.., wave64 = true)` (`x64_masks.rs:543-545`). - `dxil/kernel.rs:758-759` calls `forms()` for every pixel program that is not split. That includes console wave32 pixel shaders on any card. - In wave64, a `V_CMP` writes an SGPR pair. In wave32 it writes one SGPR. With the wave64 liveness, a compare into `s20` is treated as killing `s21` as well. - Example (PS, wave32): `v_cmp → s21`, then `v_cmp → s20`, then `s_bcnt1 s21`. In the wave64 view, the first compare is dead at its site, so it gets `Form::Own`. But in wave32, `s21` is still live and is read whole by `s_bcnt1`, which then counts only the lane's own bit. - This looks like the same shape as #2584, which #2781 fixed for the HLSL path ("Wave32 pixel mask writes kill one SGPR, not a pair"), but not for this direct-path analysis. - The tests in `ps_masks.rs` (`forms_of`, l.457) all build wave64 programs. **Deduced:** in wave32 pixel shaders translated by the direct path, a compare whose destination is still read whole could get the per-lane form, giving wrong counts or ballots on helper-lane / triangle-edge pixels. I have not identified any affected program in a run. **Suggested:** pass the wave width to `forms()` and use the width-aware liveness (`whole_live_out_for_width`, currently private), plus one wave32 test with the sequence above. Context: we read this while rebasing a test tree onto main 7a649b0e (RTX 3090 24 GB, driver 616.56, Windows 11 22631). Nothing was built or run for this note. AI use: found by an independent code review run with Claude Code (Claude Opus 5.5), checked and posted by me.
minimalhipster990 commented 2026-11-30 15:46:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by minimalhipster990 on 2026-11-30T15:46:34Z.


Correction, December 1. The RTX 4090 world replay reproduces the drop from 0.716 to 0.186 fps across an interval containing #3503, #3501, #2123 and #2571. I previously attributed that whole drop to #2571 alone. The comparison does not establish that.

With #3318 applied throughout, the fast tree was da19f00c + #3318 (local merge daab7202). Merging f4ee8ac into that tree also brought its ancestors. The resulting tree (a07ad1b1) differs from the fast one in 14 files. The exact pre-#2571 control is f3bb6649 + #3318 (7ee8201f). Its seven-file diff to the slow tree is byte-identical to the patch for f4ee8ac. That control lost the device at 87.1 s with DXGI_ERROR_DEVICE_HUNG, before world entry, as in the two earlier attempts. The in-world cost of #2571 in isolation remains unknown.

The two measured 600 s runs finished on driver 621.40. The 300-540 s windows covered 170 presents in 237.51 s and 44 in 236.12 s. Three mesh/pixel shader pairs accounted for 68.8% of the summed GPU intervals in the slow four-frame sample (XCL_GPU_TIMES=4,200). For mesh bf5a7665d0c6631a with PS af68da74e05dbb3c, a fast repeat with the full ranking measured 18.34 ms/frame at 267 calls/frame. The slow tree measured 2364.53 ms/frame at 264 calls/frame. These timestamps cover the two-pass draw path, and the sampled frames can differ in geometry.

I then added identical inner timestamps and GPU-side indirect argument readback to both trees. On the slow tree, the mesh/raster dispatch of this pair accounts for 2392 of its 2426 ms/frame across four frames. For draws executing 2 compute groups and 8 mesh groups with 2560×1440 color and depth surfaces, compute measured 0.0345 vs 0.0346 ms/draw. Mesh/raster measured 0.0408 vs 17.0510 ms/draw (188 fast and 209 slow draws). We have yet to measure emitted primitives and pixel-shader invocations, so the specific shader or coverage change responsible is still open.

The fast diagnostic replay finished its 360 s limit. The slow one read all four frames at 245.8 s, then lost the device at 322.2 s (DXGI_ERROR_DEVICE_HUNG, DRED state 3, no breadcrumbs).

Original November 30 measurements, with the tree label corrected below.

Setup

  • RTX 4090 24 GB, NVIDIA 621.40, 32 GB RAM, Windows 11 build 26300, NVIDIA shader heap at 2048 MB through #2590.
  • Every tree is the named commit + #3318 f5496479 (without #3318 this card does not reach the world on main), release.
  • Retail title, Series X profile, the same save and inputs, 600 s. XCL_GFX_PSO_WAIT_MS=50 XCL_CS_PSO_WAIT_MS=200 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_COHERENT_HEAPS=sparse XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=3990 XCL_TWO_PASS_MB=3072.
  • For each tree: one run to warm 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 110–125 s in every tree, with the same 4,600–5,400 draws per present.

tree frames/s GPU
3a8745dc (#3497, before #3499) 2.13 · 3.08 · 3.08 · 3.22 · 3.17 100 %, 135 W
c9aa9f8a (#3499) 0.73 · 0.75 · 0.75 · 0.72 · 0.63 100 %, 110 W
da19f00c (#3502) 0.77 · 0.75 · 0.75 · 0.77 · 0.73 100 %, 110 W
5b3c9a4f (#3503) 0.75 · 0.77 · 0.72 · 0.77 · 0.75 100 %, 110 W
da19f00c + #3318 + merge of f4ee8ac including its ancestors 0.23 · 0.18 · 0.18 · 0.18 · 0.20 100 %, ~110 W
1183cd43 (this PR's merge) 0.18 · 0.17 · 0.18 · 0.20 · 0.20 100 %, ~110 W
d52ff48c 0.17–0.22 (2 runs) 100 %, ~110 W
d52ff48c + #3528's commit 49eb78e 0.18 · 0.20 · 0.22 · 0.22 · 0.23 100 %, ~115 W
  • On d52ff48c, reverting #3499 (e8a36664), reverting it and #2123 (898fa11), or XCL_SPLIT_INDIRECT_ROUNDS=1 all stay at 0.18–0.27 frames/s. #3528 does remove the #3499 work: split slabs per present went from ~1,900 on d52ff48c to ~1,170 with it (~985 before #3499). The frame rate still does not move, which is why I put this here.
  • Reverting this PR on d52ff48c conflicts with #3500 (kernel.rs, lower.rs), so I have no current main without it.

Also seen while bisecting, gone on current main. The merges of #3501 (20e806f3) and then #2123 (f3bb6649) hung the GPU before the world, in 2 of 2 runs each: 82–87 s, 0x887a0006, DRED state 3, no breadcrumbs, nvlddmkm 153. The #3503 merge before them did not, and this PR's merge after them does not.

Not tested: AMD or other wave64 GPUs, isolated in-world frame time for this PR, or this PR on main without #3499.

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

December 1 update: Codex (GPT-6) checked the Git ancestry, ran the follow-up replays and drafted the correction.

<!-- greyfinch-sync:ivall/xcl:comment:7283564613 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7283564613). Originally posted by [minimalhipster990](https://github.com/minimalhipster990) on 2026-11-30T15:46:34Z. --- **Correction, December 1.** The RTX 4090 world replay reproduces the drop from 0.716 to 0.186 fps across an interval containing #3503, #3501, #2123 and #2571. I previously attributed that whole drop to #2571 alone. The comparison does not establish that. With #3318 applied throughout, the fast tree was `da19f00c` + #3318 (local merge `daab7202`). Merging `f4ee8ac` into that tree also brought its ancestors. The resulting tree (`a07ad1b1`) differs from the fast one in 14 files. The exact pre-#2571 control is `f3bb6649` + #3318 (`7ee8201f`). Its seven-file diff to the slow tree is byte-identical to the patch for `f4ee8ac`. That control lost the device at 87.1 s with `DXGI_ERROR_DEVICE_HUNG`, before world entry, as in the two earlier attempts. The in-world cost of #2571 in isolation remains unknown. The two measured 600 s runs finished on driver 621.40. The 300-540 s windows covered 170 presents in 237.51 s and 44 in 236.12 s. Three mesh/pixel shader pairs accounted for 68.8% of the summed GPU intervals in the slow four-frame sample (`XCL_GPU_TIMES=4,200`). For mesh `bf5a7665d0c6631a` with PS `af68da74e05dbb3c`, a fast repeat with the full ranking measured 18.34 ms/frame at 267 calls/frame. The slow tree measured 2364.53 ms/frame at 264 calls/frame. These timestamps cover the two-pass draw path, and the sampled frames can differ in geometry. I then added identical inner timestamps and GPU-side indirect argument readback to both trees. On the slow tree, the mesh/raster dispatch of this pair accounts for 2392 of its 2426 ms/frame across four frames. For draws executing 2 compute groups and 8 mesh groups with 2560×1440 color and depth surfaces, compute measured 0.0345 vs 0.0346 ms/draw. Mesh/raster measured 0.0408 vs 17.0510 ms/draw (188 fast and 209 slow draws). We have yet to measure emitted primitives and pixel-shader invocations, so the specific shader or coverage change responsible is still open. The fast diagnostic replay finished its 360 s limit. The slow one read all four frames at 245.8 s, then lost the device at 322.2 s (`DXGI_ERROR_DEVICE_HUNG`, DRED state 3, no breadcrumbs). **Original November 30 measurements, with the tree label corrected below.** **Setup** - RTX 4090 24 GB, NVIDIA 621.40, 32 GB RAM, Windows 11 build 26300, NVIDIA shader heap at 2048 MB through #2590. - Every tree is the named commit + #3318 `f5496479` (without #3318 this card does not reach the world on `main`), release. - Retail title, Series X profile, the same save and inputs, 600 s. `XCL_GFX_PSO_WAIT_MS=50 XCL_CS_PSO_WAIT_MS=200 XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_COHERENT_HEAPS=sparse XCL_TEXTURE_LEVEL_PAGES=1 XCL_COHERENT_MB=3990 XCL_TWO_PASS_MB=3072`. - For each tree: one run to warm 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 110–125 s in every tree, with the same 4,600–5,400 draws per present. | tree | frames/s | GPU | |---|---|---| | `3a8745dc` (#3497, before #3499) | 2.13 · 3.08 · 3.08 · 3.22 · 3.17 | 100 %, 135 W | | `c9aa9f8a` (#3499) | 0.73 · 0.75 · 0.75 · 0.72 · 0.63 | 100 %, 110 W | | `da19f00c` (#3502) | 0.77 · 0.75 · 0.75 · 0.77 · 0.73 | 100 %, 110 W | | `5b3c9a4f` (#3503) | 0.75 · 0.77 · 0.72 · 0.77 · 0.75 | 100 %, 110 W | | **`da19f00c` + #3318 + merge of `f4ee8ac` including its ancestors** | **0.23 · 0.18 · 0.18 · 0.18 · 0.20** | 100 %, ~110 W | | **`1183cd43` (this PR's merge)** | **0.18 · 0.17 · 0.18 · 0.20 · 0.20** | 100 %, ~110 W | | `d52ff48c` | 0.17–0.22 (2 runs) | 100 %, ~110 W | | `d52ff48c` + #3528's commit `49eb78e` | 0.18 · 0.20 · 0.22 · 0.22 · 0.23 | 100 %, ~115 W | - On `d52ff48c`, reverting #3499 (`e8a36664`), reverting it and #2123 (`898fa11`), or `XCL_SPLIT_INDIRECT_ROUNDS=1` all stay at 0.18–0.27 frames/s. #3528 does remove the #3499 work: split slabs per present went from ~1,900 on `d52ff48c` to ~1,170 with it (~985 before #3499). The frame rate still does not move, which is why I put this here. - Reverting this PR on `d52ff48c` conflicts with #3500 (`kernel.rs`, `lower.rs`), so I have no current `main` without it. **Also seen while bisecting, gone on current `main`.** The merges of #3501 (`20e806f3`) and then #2123 (`f3bb6649`) hung the GPU before the world, in 2 of 2 runs each: 82–87 s, `0x887a0006`, DRED state 3, no breadcrumbs, `nvlddmkm` 153. The #3503 merge before them did not, and this PR's merge after them does not. **Not tested:** AMD or other wave64 GPUs, isolated in-world frame time for this PR, or this PR on `main` without #3499. AI use: Claude Code (Claude Opus 5.5) built the trees, ran the bisection and the replays and wrote this report. The person running these tests checked it and asked for it to be posted. December 1 update: Codex (GPT-6) checked the Git ancestry, ran the follow-up replays and drafted the correction.
Kalmarv commented 2026-11-30 16:26:12 +00:00 (Migrated from github.com)

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


Thank you @CharlyRien and @minimalhipster990 for catching both of these!

Opened #3535 to fix @CharlyRien's wave32 register-width bug in ps_masks::forms() (threading o.wave64 into whole_live_out_for_width, uses_for_width, writes, per_lane, and VCC/EXEC masks). On wave32 NVIDIA GPUs, 100% of non-split pixel shaders hit ps_masks, so a wave32 v_cmp -> sN was wrongly killing s(N+1) in both liveness and forward taint and could misclassify a live mask as Form::Own (no ballot).

@minimalhipster990 — if you have a chance to test #3535 (stacked with #3528) on your RTX 4090 world replay, please let us know if that lifts the 0.75 -> 0.20 fps drop. If it still stays at ~0.20 fps with wave32 liveness fixed, the next suspect is Form::Local making EXEC per-lane (non-uniform) across S_CBRANCH_EXEC branches/loops, and we can either gate Form::Local on EXEC or revert #2571 while isolating it.

<!-- greyfinch-sync:ivall/xcl:comment:7284665951 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7284665951). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-30T16:26:12Z. --- Thank you @CharlyRien and @minimalhipster990 for catching both of these! Opened #3535 to fix @CharlyRien's wave32 register-width bug in `ps_masks::forms()` (threading `o.wave64` into `whole_live_out_for_width`, `uses_for_width`, `writes`, `per_lane`, and `VCC`/`EXEC` masks). On wave32 NVIDIA GPUs, 100% of non-split pixel shaders hit `ps_masks`, so a wave32 `v_cmp -> sN` was wrongly killing `s(N+1)` in both liveness and forward taint and could misclassify a live mask as `Form::Own` (no ballot). @minimalhipster990 — if you have a chance to test #3535 (stacked with #3528) on your RTX 4090 world replay, please let us know if that lifts the 0.75 -> 0.20 fps drop. If it still stays at ~0.20 fps with wave32 liveness fixed, the next suspect is `Form::Local` making `EXEC` per-lane (non-uniform) across `S_CBRANCH_EXEC` branches/loops, and we can either gate `Form::Local` on `EXEC` or revert #2571 while isolating it.
CharlyRien commented 2026-12-01 12:23:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-01T12:23:31Z.


An RTX 3090 data point for the drop minimalhipster990 bisected to this PR on the 4090: we see the same thing, and on NVIDIA this PR seems to hide a GPU hang from #3501 rather than cause the slowdown on its own.

Stack: main 493dbd3d (has #3535) + #3528 (ba8592a4) + #3517 (0b4283d1) + 42 local commits of ours (memory-window, alias-copy and diagnostic switches; none touches recomp/ps_masks.rs, dxil/kernel.rs, lower.rs, lower_valu.rs or lanes.rs). Run settings as in our earlier reports (16 heap windows, XCL_SPARSE_WINDOWS=4, XCL_GPU_WAIT_TIMEOUT_MS=45000). Fresh shader preparation for each build, warm driver cache. Presents/s from world +20 s to +180 s, one setting per run.

Build (same stack) Runs Result
as is (#2571 forms on, #3501 lowering) 1 0.23 presents/s, never left the intro card in 358 s; no removal
#2571 forms off (local switch: lw.ps_masks left empty in dxil/kernel.rs) 2 device hung at 110-121 s, before the playable scene, same mesh + pixel shader draw both times
#2571 forms off + ballot_ps_quad as before #3501 (4 WaveActiveBallot, local switch in dxil/lanes.rs) 2 no hang, playable scene, 0.66 and 1.41 presents/s
same local stack on main 53e85fb1 (before #3499, #3501 and #2571) 2 0.71 and 0.88 presents/s

What we read (not measured):

  • With the map empty, the DXIL is exactly what the parent of #2571 (02202839) produces: the code #2571 added elsewhere (lower_valu.rs, lanes.rs, compact.rs) is skipped when ps_masks is empty. That parent already has #3501 (a50fa7ab), which turned ballot_ps_quad into WaveActiveBit(Or) + QuadReadLaneAt.
  • In the hung pixel shader, the forms-off DXIL goes from 40 to 120 QuadReadLaneAt and from 6 to 44 WaveActiveBit(Or), inside a loop capped at 65536 iterations; the loop exit takes one of those masks. The bodies are otherwise the same (same CFG, resource handles, discard).
  • The removals are hangs, not page faults: DRED device state 3 ("hung"). real.rs prints "DRED page fault at GPU VA 0x0" whenever the page-fault output is readable, even for a hang, so that line is misleading.

What we deduce: on NVIDIA (wave64 split into two wave32 halves) the #3501 ballot_ps_quad lowering can hang this draw. #2571 replaces most of those compares with its forms, so the hang disappears, but the frame rate drops (0.23 here, against 0.66-1.41 with the #3501 lowering reverted instead). That would also match the 82-87 s DRED-3 hangs reported on the 4090 before this PR. We have not found which instruction hangs, nor checked AMD.

The image in the two no-hang runs is not clean either (bald character and half-dark window, as on our earlier trees, see #505 / #3517), so this is a pace and hang result, not a rendering one.

Hardware: RTX 3090 24 GB (driver 616.56, Resizable BAR off), Ryzen 9 5950X, 32 GB, Windows 11 22631. Not tested: AMD, main without our local commits.

AI use: Claude Code (Claude Opus 5.5) ran the builds, preparations and runs, read the logs and wrote this; Antigravity CLI (Gemini 4 Neon) compared the two DXIL dumps (read-only); checked and posted by me.

<!-- greyfinch-sync:ivall/xcl:comment:7311064649 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2571#issuecomment-7311064649). Originally posted by [CharlyRien](https://github.com/CharlyRien) on 2026-12-01T12:23:31Z. --- An RTX 3090 data point for the drop minimalhipster990 bisected to this PR on the 4090: we see the same thing, and on NVIDIA this PR seems to hide a GPU hang from #3501 rather than cause the slowdown on its own. Stack: main 493dbd3d (has #3535) + #3528 (ba8592a4) + #3517 (0b4283d1) + 42 local commits of ours (memory-window, alias-copy and diagnostic switches; none touches `recomp/ps_masks.rs`, `dxil/kernel.rs`, `lower.rs`, `lower_valu.rs` or `lanes.rs`). Run settings as in our earlier reports (16 heap windows, `XCL_SPARSE_WINDOWS=4`, `XCL_GPU_WAIT_TIMEOUT_MS=45000`). Fresh shader preparation for each build, warm driver cache. Presents/s from world +20 s to +180 s, one setting per run. | Build (same stack) | Runs | Result | |---|---|---| | as is (#2571 forms on, #3501 lowering) | 1 | 0.23 presents/s, never left the intro card in 358 s; no removal | | #2571 forms off (local switch: `lw.ps_masks` left empty in `dxil/kernel.rs`) | 2 | device hung at 110-121 s, before the playable scene, same mesh + pixel shader draw both times | | #2571 forms off + `ballot_ps_quad` as before #3501 (4 `WaveActiveBallot`, local switch in `dxil/lanes.rs`) | 2 | no hang, playable scene, 0.66 and 1.41 presents/s | | same local stack on main 53e85fb1 (before #3499, #3501 and #2571) | 2 | 0.71 and 0.88 presents/s | What we read (not measured): - With the map empty, the DXIL is exactly what the parent of #2571 (02202839) produces: the code #2571 added elsewhere (`lower_valu.rs`, `lanes.rs`, `compact.rs`) is skipped when `ps_masks` is empty. That parent already has #3501 (a50fa7ab), which turned `ballot_ps_quad` into `WaveActiveBit(Or)` + `QuadReadLaneAt`. - In the hung pixel shader, the forms-off DXIL goes from 40 to 120 `QuadReadLaneAt` and from 6 to 44 `WaveActiveBit(Or)`, inside a loop capped at 65536 iterations; the loop exit takes one of those masks. The bodies are otherwise the same (same CFG, resource handles, discard). - The removals are hangs, not page faults: DRED device state 3 ("hung"). `real.rs` prints "DRED page fault at GPU VA 0x0" whenever the page-fault output is readable, even for a hang, so that line is misleading. What we deduce: on NVIDIA (wave64 split into two wave32 halves) the #3501 `ballot_ps_quad` lowering can hang this draw. #2571 replaces most of those compares with its forms, so the hang disappears, but the frame rate drops (0.23 here, against 0.66-1.41 with the #3501 lowering reverted instead). That would also match the 82-87 s DRED-3 hangs reported on the 4090 before this PR. We have not found which instruction hangs, nor checked AMD. The image in the two no-hang runs is not clean either (bald character and half-dark window, as on our earlier trees, see #505 / #3517), so this is a pace and hang result, not a rendering one. Hardware: RTX 3090 24 GB (driver 616.56, Resizable BAR off), Ryzen 9 5950X, 32 GB, Windows 11 22631. Not tested: AMD, main without our local commits. AI use: Claude Code (Claude Opus 5.5) ran the builds, preparations and runs, read the logs and wrote this; Antigravity CLI (Gemini 4 Neon) compared the two DXIL dumps (read-only); checked and posted by me.
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!2561
No description provided.