Recompiler: run through execz skips over regions that only narrow EXEC #3785

Open
CharlyRien wants to merge 6 commits from upstream-pr/3785 into main
CharlyRien commented 2026-12-03 12:41:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-03T12:41:40Z.


Stacked on #3591 and #3798: only the commits after eb352ba1 belong here (#3591's f4413ddb and #3798's eb352ba1 show in the diff until they are merged).

Follow-up to #3591, as @Royalflamejlh asked there (comment and the reply below it). It should be merged after #3786 (the #3772 workaround): on #3591 alone, the extra run-throughs make one 17-program family of the sweep below worse on NVIDIA through #3772, and with #3786 under them the whole family is identical to HLSL. One other pixel shader was still worse on the RTX 3090 with #3786; the same DXIL is right on WARP, and the last commit keeps the skip involved (see the rule and Tested).

What is in it

The fix of subset_after's EXEC bounds (Recompiler: fix the EXEC bounds of the pixel-shader subset check, eb352ba1), which was this PR's first commit, is now #3798, under this PR: it changes forms on every adapter, and the rule below follows its bounds. Its changes and tests are described there.

This PR's own commits, after eb352ba1 (3 files, +673 / −77, git diff --shortstat eb352ba1 a2a8389c; about 540 of the added lines are tests: recomp/tests.rs +243 and the ps_masks.rs test module). Apart from TRANSLATOR_VERSION, all of its non-test code is in flat_skips / flat_region, which run only where #3591 runs skips through (NVIDIA, or XCL_PS_SKIP_RUN_THROUGH=1):

  1. Recompiler: run through execz skips over regions that only narrow EXEC: the rule below.
  2. Recompiler: GPU test of a skip run through a nested if that narrows EXEC: gpu_direct_ps_skips_run_through_nested_ifs_that_narrow_exec (below), and a test-only override of ps_skip_run_through (kernel::PS_SKIP_IN_TEST, like IDIOMS_IN_TEST) so that it runs the same on every adapter.
  3. Recompiler: the nested-if GPU test also samples a texture in the inner block: a sixth form of that test, where the inner block is an implicit-derivative image_sample (below).
  4. Recompiler: keep the skip over a whole-quad-mode EXEC write before a cross-lane read: the one refusal added after the sweep (below), with a CPU test, and TRANSLATOR_VERSION 14.

#3591 runs a pixel shader's s_cbranch_execz through on NVIDIA when the skipped region writes no EXEC. In my test report on #3591, most of the skips it keeps in the retail title's shaders are kept for one reason: the region writes EXEC. That is the usual if inside the region: a saveexec or v_cmpx that narrows EXEC, then the restore at its end. This PR runs those regions through too.

The rule

With EXEC 0 at the skip, any EXEC computed as a subset of the entry EXEC is 0 too. So a region can run through when each EXEC write in it keeps EXEC a subset of its entry EXEC. flat_region follows that bound with subset_after (the module's existing "subset of a reference mask" step, with the EXEC bounds fixed in #3798), from the region's entry, forward along every path, intersected at joins.

Accepted (each has a test in wave64 and one in wave32):

  • the console's nested if: s_mov_b64 s[22:23], exec ; v_cmpx ; s_cbranch_execz L ; ... ; L: s_mov_b64 exec, s[22:23] (both skips are run through);
  • s_and_saveexec, s_andn1_saveexec, v_cmpx, and a VOP3 v_cmp that writes EXEC;
  • s_and exec, s, exec and s_andn2 exec, exec, s;
  • s_or / s_xor / s_cselect to EXEC when both operands are bounded; s_or / s_xor / s_andn2_saveexec when S0 is bounded; s_andn1_wrexec; s_andn2_wrexec with a bounded S0;
  • v_cmp to VCC, then s_mov_b64 exec, vcc;
  • the inline constant 0 (s_mov_b64 exec, 0).

Refused (the branch is kept; each has a test in wave64 and one in wave32, except the join and the wave64 halves, tested in wave64 only):

  • any EXEC write from a mask that is not bounded on every path: s_mov_b64 exec, s[24:25], s_mov_b64 exec, 1, s_andn2_b64 exec, s[24:25], exec, s_or / s_xor / s_andn2_saveexec or s_andn2_wrexec with VCC, a restore whose saved mask comes from an unknown register on one incoming path, or from a write that no path of the region reaches;
  • the saveexecs that invert S0 or EXEC (s_nand, s_nor, s_xnor, s_orn1, s_orn2_saveexec), even of 0;
  • a saveexec whose SDST is EXEC (s_or_saveexec_b64 exec, vcc, s_nand_saveexec_b64 exec, 0), even an AND one: it bounds nothing (#3798);
  • a SALU of the other width: in wave64, s_mov_b32 exec_lo, s22 or s_mov_b32 exec_hi, 0; in wave32, a 64-bit SALU to EXEC;
  • a region that writes EXEC when EXEC at the skip may hold helper lanes (whole quad mode: after s_wqm, not known to be a subset of the live lanes) and an instruction after the region reads other lanes (DPP, ds_swizzle, ds_permute / ds_bpermute, permlane). Running it through gives the same result, but the RTX 3090 drew one such pixel shader wrong while WARP drew the same DXIL right (Tested). v_readfirstlane and derivatives after the region do not count: the 17-program family has both and is right. Tested in wave64 (execz_skips_keep_a_region_that_writes_a_whole_quad_mode_exec_before_other_lanes_are_read: kept with ds_swizzle or DPP after it, run through with nothing, v_readfirstlane or a sample after it, or without s_wqm);
  • a bound that an SGPR write clears (s_mov_b32 s23, -1), including the extra SGPRs the operand tables list beyond what writes returns;
  • everything #3591 already refuses: exports and v_writelane, s_sendmsg, float-mode changes, s_movrelsd_2_b32, scalar stores and atomics, indirect, backward or outgoing branches, a program end, and an SGPR (VCC included) or SCC written in the region and read after it (tested here for a saveexec's SDST and SCC, and a compare's VCC read by v_cndmask or s_cbranch_vccz).

Why the result is the same

  • At the skip, EXEC is 0. Every EXEC the region writes is a subset of that, so EXEC stays 0 in the whole region: no vector instruction writes a lane, and no vector memory or LDS access runs for any lane. What still runs is scalar: SALU, scalar loads, and the scalar results of vector instructions (a compare writes its mask, 0, to VCC or an SGPR; v_readlane / v_readfirstlane and a VOP3 carry-out write an SGPR). The next point covers all of them.
  • Scalar writes are checked as in #3591: no SGPR or SCC the region writes is read after it before being written again.
  • At the region's end, EXEC is 0, the same value as after the skip. So code after the region that reads EXEC sees the same value. EXEC is the one register the read-after check leaves out.
  • This relies on the lowered compares giving 0 under EXEC 0 in each form Lw::vopc can pick: the local form (c & act()), the per-quad form (lanebit_at(el, eh, ..)) and cond ? EXEC : 0. The new GPU test checks each of them.

Code

  • ps_masks.rs (and TRANSLATOR_VERSION in kernel.rs, since ps_masks.rs is in no source hash). flat_skips calls a new flat_region, which returns either Ok or the first rule the region breaks and the instruction that breaks it. The tests check that rule and that instruction.
  • No new switch: XCL_PS_SKIP_RUN_THROUGH from #3591 turns it all off (=0) or on (=1).
  • The GPU test (recomp/tests.rs), next to #3591's: a wave64 pixel shader with the nested if inside a block that s_cbranch_execz skips. Pixels inside a disc take the outer block; in it s_mov_b64 s[22:23], exec (or a saveexec) and a compare narrow EXEC to the pixels left of the centre, an inner skip passes over a write of v12, and s_mov_b64 exec, s[22:23] ends the block. Waves with no pixel in the disc enter the block with EXEC 0 when it is run through, so a narrowing compare that did not give 0 there would write v12 in their left pixels. The compare takes each lowered form: v_cmpx and v_cmp + s_and_saveexec_b64 in the local form and in the per-quad form (the mask also read as data under the narrowed EXEC), and a VOP3 v_cmp to EXEC with scalar operands. A sixth form puts an implicit-derivative image_sample (after the program's s_wqm) in the inner block, with a v_cmpx in the local form, the shape where NVIDIA lost whole waves in #3574. For each, it checks that flat_skips runs both skips through, that the compare has that form, that the DXIL differs from the one that keeps the skips, and every pixel on the GPU. A region that widens EXEC (s_mov_b64 exec, s[24:25], all ones) keeps its outer skip; drawn with that skip replaced by s_nop, its block writes a channel in every pixel outside the disc, which shows the image tells a wrong run-through apart. With the skips kept, the test only prints the count of wrong pixels (NVIDIA can leave such waves unwritten, #3574); with them run through, it requires 0 in every form.

Tested

  • RTX 3090 24 GB (driver 621.47, Resizable BAR off), Ryzen 9 5950X, 32 GB, Windows 11 22631, Rust 1.100.0, DXC 1.9.2602.17.
  • CPU, release, on this head (a2a8389c): gpu::recomp::ps_masks + gpu::recomp::lane_masks, 36 passed (the new refusal's test among them).
  • GPU, release, with XCL_REQUIRE_GPU=mesh: #3591's GPU test, the PS mask / helper-lane GPU tests and the new test, run together with the CPU tests above: 47 passed on this head (46 on a8330f03); the new test run 3 times on each of the two heads: 3/3 passed on a8330f03, 0 wrong pixels with the skips run through in each of the 6 forms, and the same on this head; gpu::dxil (at 62e66d8a; the later commits add a test and a refusal in ps_masks.rs, not in gpu/dxil): 355 passed, 4 ignored, 0 failed (one test reports SKIPPED: no wave64, expected on this card). With the skips kept, all 6 forms gave 0 wrong pixels in each run as well: the sampling form does not show #3574 on this card. The widening region drawn with s_nop wrote its channel in all 2,832 pixels outside the disc.
  • Release build of this head with its named tests, without and with XCL_PS_SKIP_RUN_THROUGH=1: built, 40 passed in each pass (0 failed), no SKIPPED line.
  • A CPU probe translated the 119 programs of the sweep below and compared their direct DXIL byte for byte. With XCL_PS_SKIP_RUN_THROUGH=0 (the path every adapter but NVIDIA takes), the DXIL is the same for 119 of 119 at #3591's head f4413ddb, at 62e66d8a and at this head (#3798's own comparison, at eb352ba1, is in #3798). With =1, 17 programs change against #3591's head and against #3798's head eb352ba1, which changes none of the 119, all through the skips this PR's first commit adds (at 62e66d8a, before the last commit: 18; the last commit changes only the one other pixel shader, back to its DXIL at f4413ddb).
  • Offline sweep, the same probe and the same 119 programs as in my #3591 report: each pixel shader is drawn both ways (HLSL + DXC, direct DXIL) with one triangle on a 128×128 target and 3 synthetic input sets, XCL_PS_SKIP_RUN_THROUGH=1, RTX 3090, driver 621.47. The middle three columns were swept in one job, the left one a job earlier, the right one (this head) in a later job, all on the same driver. "First two commits" is #3798's commit and this PR's first commit (the branch before its last commit):
#3591 alone + first two commits #3591 + #3786 #3591 + #3786 + first two commits #3591 + #3786 + this PR
programs identical to HLSL 4 3 21 20 21
unwritten pixels, all 119 3,282,856 3,240,616 3,095,686 3,095,878 3,095,686
the 17-program family, total 187,170 144,738 0 0 0
the 95-program family, total 3,035,782 3,035,782 3,035,782 3,035,782 3,035,782
the blur program 47,616 47,616 47,616 47,616 47,616
programs worse than #3591 alone / than #3591 + #3786 — 2 — 1 0 (against #3591 + #3786)

On #3591 alone, the first two commits make two programs worse: one of the 17-program family (4,055 → 8,514 unwritten pixels; its #3591 side is not stable, the same DXIL gave 12,704 in an earlier run) and one other pixel shader (identical → 192). With #3786 under them, the whole 17-program family is identical to HLSL: that one came from #3772 (live lanes lost from the entry ballot on NVIDIA, the same DXIL is right on WARP), made visible by the extra run-throughs.
The other pixel shader stayed at 192 unwritten pixels with #3786 (two runs, the same count). It has one more skip run through: its region writes EXEC under whole quad mode (the nested if with a VOP3 v_cmpx), and a ds_swizzle reads other lanes later. The direct DXIL with and without that skip differs only by the branch: the same instructions and the same selects under the same lane conditions. Drawn on WARP (warp 1.0.23, Agility 1.621) the same DXIL is identical to HLSL; on the 3090 it leaves 96 pixels per target unwritten. So it is the driver, not the translation, but this PR made the default NVIDIA path worse for that program, so the last commit keeps such skips (the rule above). With it, the probe changes only that program back (8,820 → 8,892 bytes, its DXIL at f4413ddb), and the sweep gives it identical to HLSL again, the 17-program family still identical, and every program's unwritten pixels the same as with #3591 + #3786.

  • Sweep stack: main 817eb1fc + the local probe commits (tests only) + #3591 at 8ca2df9d + #3591's later ps_masks refusals (from f4413ddb) + the first two commits + a local commit that copies this branch's ps_masks.rs (byte for byte the same as at e82669f6, or at this head for the right column), and for the #3786 columns its commit 95c5f6e8 cherry-picked on top (#3786's later commit adds a switch whose default translates the same). The 95-program family and the blur program need more than this rule: a backward branch whose condition comes from a zero mask, and a kill branch.

Regression run
scripts/smoke.ps1, 60 s each, the same title, the same machine and driver (621.47), a fresh shader cache on both sides; main first, then this head:

xcl-smoke v1
commit: 16c2fd082ae2e96967a2ab553bc2e1032e491f70
gpu: NVIDIA GeForce RTX 3090
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 488 (PresentX 488)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 16164 MB
xcl-smoke v1
commit: a2a8389cd9ebc9c1f1e6a1006f21ecef9e81ffae
gpu: NVIDIA GeForce RTX 3090
title: 16b5e5d4
seconds: 60
exit: 0x0
frames shown: 556 (PresentX 556)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15628 MB

Frames 556 / 488 (114 %), peak commit 15,628 / 16,164 MB (97 %), no device removal, no crash.

Not tested

  • AMD and Intel GPUs. This PR's code runs only where #3591 runs skips through (NVIDIA, or XCL_PS_SKIP_RUN_THROUGH=1); the change that reaches every adapter (forms) is #3798's. Nothing was run on an AMD or Intel GPU.
  • Other NVIDIA cards and drivers.
  • A game run beyond the 60 s smoke above.
    AI use
  • AI use: Claude Code (Claude Opus 5.5) wrote the rule, its CPU and GPU tests, had them reviewed by a second Claude Code agent and by Antigravity (gemini-4-neon-high), fixed what the reviews found, ran the tests, the CPU comparison, the sweeps and the WARP comparison, wrote the whole-quad-mode refusal after them, and wrote this description; checked and posted by me.
<!-- greyfinch-sync:ivall/xcl:issue:5626694880 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3785). Originally posted by [CharlyRien](https://github.com/CharlyRien) on 2026-12-03T12:41:40Z. --- Stacked on #3591 and #3798: only the commits after `eb352ba1` belong here (#3591's `f4413ddb` and #3798's `eb352ba1` show in the diff until they are merged). Follow-up to #3591, as @Royalflamejlh asked there ([comment](https://github.com/xcl-dev/xcl/pull/3591#issuecomment-7371235707) and the reply below it). It should be merged after #3786 (the #3772 workaround): on #3591 alone, the extra run-throughs make one 17-program family of the sweep below worse on NVIDIA through #3772, and with #3786 under them the whole family is identical to HLSL. One other pixel shader was still worse on the RTX 3090 with #3786; the same DXIL is right on WARP, and the last commit keeps the skip involved (see the rule and Tested). **What is in it** The fix of `subset_after`'s EXEC bounds (`Recompiler: fix the EXEC bounds of the pixel-shader subset check`, `eb352ba1`), which was this PR's first commit, is now #3798, under this PR: it changes `forms` on every adapter, and the rule below follows its bounds. Its changes and tests are described there. This PR's own commits, after `eb352ba1` (3 files, +673 / −77, `git diff --shortstat eb352ba1 a2a8389c`; about 540 of the added lines are tests: `recomp/tests.rs` +243 and the `ps_masks.rs` test module). Apart from `TRANSLATOR_VERSION`, all of its non-test code is in `flat_skips` / `flat_region`, which run only where #3591 runs skips through (NVIDIA, or `XCL_PS_SKIP_RUN_THROUGH=1`): 1. `Recompiler: run through execz skips over regions that only narrow EXEC`: the rule below. 2. `Recompiler: GPU test of a skip run through a nested if that narrows EXEC`: `gpu_direct_ps_skips_run_through_nested_ifs_that_narrow_exec` (below), and a test-only override of `ps_skip_run_through` (`kernel::PS_SKIP_IN_TEST`, like `IDIOMS_IN_TEST`) so that it runs the same on every adapter. 3. `Recompiler: the nested-if GPU test also samples a texture in the inner block`: a sixth form of that test, where the inner block is an implicit-derivative `image_sample` (below). 4. `Recompiler: keep the skip over a whole-quad-mode EXEC write before a cross-lane read`: the one refusal added after the sweep (below), with a CPU test, and `TRANSLATOR_VERSION` 14. #3591 runs a pixel shader's `s_cbranch_execz` through on NVIDIA when the skipped region writes no EXEC. In [my test report on #3591](https://github.com/xcl-dev/xcl/pull/3591#issuecomment-7371235707), most of the skips it keeps in the retail title's shaders are kept for one reason: the region writes EXEC. That is the usual `if` inside the region: a saveexec or `v_cmpx` that narrows EXEC, then the restore at its end. This PR runs those regions through too. **The rule** With EXEC 0 at the skip, any EXEC computed as a subset of the entry EXEC is 0 too. So a region can run through when each EXEC write in it keeps EXEC a subset of its entry EXEC. `flat_region` follows that bound with `subset_after` (the module's existing "subset of a reference mask" step, with the EXEC bounds fixed in #3798), from the region's entry, forward along every path, intersected at joins. Accepted (each has a test in wave64 and one in wave32): - the console's nested `if`: `s_mov_b64 s[22:23], exec ; v_cmpx ; s_cbranch_execz L ; ... ; L: s_mov_b64 exec, s[22:23]` (both skips are run through); - `s_and_saveexec`, `s_andn1_saveexec`, `v_cmpx`, and a VOP3 `v_cmp` that writes EXEC; - `s_and exec, s, exec` and `s_andn2 exec, exec, s`; - `s_or` / `s_xor` / `s_cselect` to EXEC when both operands are bounded; `s_or` / `s_xor` / `s_andn2_saveexec` when S0 is bounded; `s_andn1_wrexec`; `s_andn2_wrexec` with a bounded S0; - `v_cmp` to VCC, then `s_mov_b64 exec, vcc`; - the inline constant 0 (`s_mov_b64 exec, 0`). Refused (the branch is kept; each has a test in wave64 and one in wave32, except the join and the wave64 halves, tested in wave64 only): - any EXEC write from a mask that is not bounded on every path: `s_mov_b64 exec, s[24:25]`, `s_mov_b64 exec, 1`, `s_andn2_b64 exec, s[24:25], exec`, `s_or` / `s_xor` / `s_andn2_saveexec` or `s_andn2_wrexec` with VCC, a restore whose saved mask comes from an unknown register on one incoming path, or from a write that no path of the region reaches; - the saveexecs that invert S0 or EXEC (`s_nand`, `s_nor`, `s_xnor`, `s_orn1`, `s_orn2_saveexec`), even of 0; - a saveexec whose SDST is EXEC (`s_or_saveexec_b64 exec, vcc`, `s_nand_saveexec_b64 exec, 0`), even an AND one: it bounds nothing (#3798); - a SALU of the other width: in wave64, `s_mov_b32 exec_lo, s22` or `s_mov_b32 exec_hi, 0`; in wave32, a 64-bit SALU to EXEC; - a region that writes EXEC when EXEC at the skip may hold helper lanes (whole quad mode: after `s_wqm`, not known to be a subset of the live lanes) and an instruction after the region reads other lanes (DPP, `ds_swizzle`, `ds_permute` / `ds_bpermute`, permlane). Running it through gives the same result, but the RTX 3090 drew one such pixel shader wrong while WARP drew the same DXIL right (Tested). `v_readfirstlane` and derivatives after the region do not count: the 17-program family has both and is right. Tested in wave64 (`execz_skips_keep_a_region_that_writes_a_whole_quad_mode_exec_before_other_lanes_are_read`: kept with `ds_swizzle` or DPP after it, run through with nothing, `v_readfirstlane` or a sample after it, or without `s_wqm`); - a bound that an SGPR write clears (`s_mov_b32 s23, -1`), including the extra SGPRs the operand tables list beyond what `writes` returns; - everything #3591 already refuses: exports and `v_writelane`, `s_sendmsg`, float-mode changes, `s_movrelsd_2_b32`, scalar stores and atomics, indirect, backward or outgoing branches, a program end, and an SGPR (VCC included) or SCC written in the region and read after it (tested here for a saveexec's SDST and SCC, and a compare's VCC read by `v_cndmask` or `s_cbranch_vccz`). **Why the result is the same** - At the skip, EXEC is 0. Every EXEC the region writes is a subset of that, so EXEC stays 0 in the whole region: no vector instruction writes a lane, and no vector memory or LDS access runs for any lane. What still runs is scalar: SALU, scalar loads, and the scalar results of vector instructions (a compare writes its mask, 0, to VCC or an SGPR; `v_readlane` / `v_readfirstlane` and a VOP3 carry-out write an SGPR). The next point covers all of them. - Scalar writes are checked as in #3591: no SGPR or SCC the region writes is read after it before being written again. - At the region's end, EXEC is 0, the same value as after the skip. So code after the region that reads EXEC sees the same value. EXEC is the one register the read-after check leaves out. - This relies on the lowered compares giving 0 under EXEC 0 in each form `Lw::vopc` can pick: the local form (`c & act()`), the per-quad form (`lanebit_at(el, eh, ..)`) and `cond ? EXEC : 0`. The new GPU test checks each of them. **Code** - `ps_masks.rs` (and `TRANSLATOR_VERSION` in `kernel.rs`, since `ps_masks.rs` is in no source hash). `flat_skips` calls a new `flat_region`, which returns either `Ok` or the first rule the region breaks and the instruction that breaks it. The tests check that rule and that instruction. - No new switch: `XCL_PS_SKIP_RUN_THROUGH` from #3591 turns it all off (`=0`) or on (`=1`). - The GPU test (`recomp/tests.rs`), next to #3591's: a wave64 pixel shader with the nested `if` inside a block that `s_cbranch_execz` skips. Pixels inside a disc take the outer block; in it `s_mov_b64 s[22:23], exec` (or a saveexec) and a compare narrow EXEC to the pixels left of the centre, an inner skip passes over a write of v12, and `s_mov_b64 exec, s[22:23]` ends the block. Waves with no pixel in the disc enter the block with EXEC 0 when it is run through, so a narrowing compare that did not give 0 there would write v12 in their left pixels. The compare takes each lowered form: `v_cmpx` and `v_cmp` + `s_and_saveexec_b64` in the local form and in the per-quad form (the mask also read as data under the narrowed EXEC), and a VOP3 `v_cmp` to EXEC with scalar operands. A sixth form puts an implicit-derivative `image_sample` (after the program's `s_wqm`) in the inner block, with a `v_cmpx` in the local form, the shape where NVIDIA lost whole waves in #3574. For each, it checks that `flat_skips` runs both skips through, that the compare has that form, that the DXIL differs from the one that keeps the skips, and every pixel on the GPU. A region that widens EXEC (`s_mov_b64 exec, s[24:25]`, all ones) keeps its outer skip; drawn with that skip replaced by `s_nop`, its block writes a channel in every pixel outside the disc, which shows the image tells a wrong run-through apart. With the skips kept, the test only prints the count of wrong pixels (NVIDIA can leave such waves unwritten, #3574); with them run through, it requires 0 in every form. **Tested** - RTX 3090 24 GB (driver 621.47, Resizable BAR off), Ryzen 9 5950X, 32 GB, Windows 11 22631, Rust 1.100.0, DXC 1.9.2602.17. - CPU, release, on this head (`a2a8389c`): `gpu::recomp::ps_masks` + `gpu::recomp::lane_masks`, 36 passed (the new refusal's test among them). - GPU, release, with `XCL_REQUIRE_GPU=mesh`: #3591's GPU test, the PS mask / helper-lane GPU tests and the new test, run together with the CPU tests above: 47 passed on this head (46 on `a8330f03`); the new test run 3 times on each of the two heads: 3/3 passed on `a8330f03`, 0 wrong pixels with the skips run through in each of the 6 forms, and the same on this head; `gpu::dxil` (at `62e66d8a`; the later commits add a test and a refusal in `ps_masks.rs`, not in `gpu/dxil`): 355 passed, 4 ignored, 0 failed (one test reports `SKIPPED: no wave64`, expected on this card). With the skips kept, all 6 forms gave 0 wrong pixels in each run as well: the sampling form does not show #3574 on this card. The widening region drawn with `s_nop` wrote its channel in all 2,832 pixels outside the disc. - Release build of this head with its named tests, without and with `XCL_PS_SKIP_RUN_THROUGH=1`: built, 40 passed in each pass (0 failed), no `SKIPPED` line. - A CPU probe translated the 119 programs of the sweep below and compared their direct DXIL byte for byte. With `XCL_PS_SKIP_RUN_THROUGH=0` (the path every adapter but NVIDIA takes), the DXIL is the same for 119 of 119 at #3591's head `f4413ddb`, at `62e66d8a` and at this head (#3798's own comparison, at `eb352ba1`, is in #3798). With `=1`, 17 programs change against #3591's head and against #3798's head `eb352ba1`, which changes none of the 119, all through the skips this PR's first commit adds (at `62e66d8a`, before the last commit: 18; the last commit changes only the one other pixel shader, back to its DXIL at `f4413ddb`). - Offline sweep, the same probe and the same 119 programs as in my #3591 report: each pixel shader is drawn both ways (HLSL + DXC, direct DXIL) with one triangle on a 128×128 target and 3 synthetic input sets, `XCL_PS_SKIP_RUN_THROUGH=1`, RTX 3090, driver 621.47. The middle three columns were swept in one job, the left one a job earlier, the right one (this head) in a later job, all on the same driver. "First two commits" is #3798's commit and this PR's first commit (the branch before its last commit): | | #3591 alone | + first two commits | #3591 + #3786 | #3591 + #3786 + first two commits | #3591 + #3786 + this PR | |---|---|---|---|---|---| | programs identical to HLSL | 4 | 3 | 21 | 20 | 21 | | unwritten pixels, all 119 | 3,282,856 | 3,240,616 | 3,095,686 | 3,095,878 | 3,095,686 | | the 17-program family, total | 187,170 | 144,738 | 0 | 0 | 0 | | the 95-program family, total | 3,035,782 | 3,035,782 | 3,035,782 | 3,035,782 | 3,035,782 | | the blur program | 47,616 | 47,616 | 47,616 | 47,616 | 47,616 | | programs worse than #3591 alone / than #3591 + #3786 | — | 2 | — | 1 | 0 (against #3591 + #3786) | On #3591 alone, the first two commits make two programs worse: one of the 17-program family (4,055 → 8,514 unwritten pixels; its #3591 side is not stable, the same DXIL gave 12,704 in an earlier run) and one other pixel shader (identical → 192). With #3786 under them, the whole 17-program family is identical to HLSL: that one came from #3772 (live lanes lost from the entry ballot on NVIDIA, the same DXIL is right on WARP), made visible by the extra run-throughs. The other pixel shader stayed at 192 unwritten pixels with #3786 (two runs, the same count). It has one more skip run through: its region writes EXEC under whole quad mode (the nested `if` with a VOP3 `v_cmpx`), and a `ds_swizzle` reads other lanes later. The direct DXIL with and without that skip differs only by the branch: the same instructions and the same selects under the same lane conditions. Drawn on WARP (warp 1.0.23, Agility 1.621) the same DXIL is identical to HLSL; on the 3090 it leaves 96 pixels per target unwritten. So it is the driver, not the translation, but this PR made the default NVIDIA path worse for that program, so the last commit keeps such skips (the rule above). With it, the probe changes only that program back (8,820 → 8,892 bytes, its DXIL at `f4413ddb`), and the sweep gives it identical to HLSL again, the 17-program family still identical, and every program's unwritten pixels the same as with #3591 + #3786. - Sweep stack: `main` `817eb1fc` + the local probe commits (tests only) + #3591 at `8ca2df9d` + #3591's later `ps_masks` refusals (from `f4413ddb`) + the first two commits + a local commit that copies this branch's `ps_masks.rs` (byte for byte the same as at `e82669f6`, or at this head for the right column), and for the #3786 columns its commit `95c5f6e8` cherry-picked on top (#3786's later commit adds a switch whose default translates the same). The 95-program family and the blur program need more than this rule: a backward branch whose condition comes from a zero mask, and a kill branch. **Regression run** `scripts/smoke.ps1`, 60 s each, the same title, the same machine and driver (621.47), a fresh shader cache on both sides; `main` first, then this head: ``` xcl-smoke v1 commit: 16c2fd082ae2e96967a2ab553bc2e1032e491f70 gpu: NVIDIA GeForce RTX 3090 title: 16b5e5d4 seconds: 60 exit: 0x0 frames shown: 488 (PresentX 488) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 16164 MB ``` ``` xcl-smoke v1 commit: a2a8389cd9ebc9c1f1e6a1006f21ecef9e81ffae gpu: NVIDIA GeForce RTX 3090 title: 16b5e5d4 seconds: 60 exit: 0x0 frames shown: 556 (PresentX 556) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15628 MB ``` Frames 556 / 488 (114 %), peak commit 15,628 / 16,164 MB (97 %), no device removal, no crash. **Not tested** - AMD and Intel GPUs. This PR's code runs only where #3591 runs skips through (NVIDIA, or `XCL_PS_SKIP_RUN_THROUGH=1`); the change that reaches every adapter (`forms`) is #3798's. Nothing was run on an AMD or Intel GPU. - Other NVIDIA cards and drivers. - A game run beyond the 60 s smoke above. **AI use** - AI use: Claude Code (Claude Opus 5.5) wrote the rule, its CPU and GPU tests, had them reviewed by a second Claude Code agent and by Antigravity (gemini-4-neon-high), fixed what the reviews found, ran the tests, the CPU comparison, the sweeps and the WARP comparison, wrote the whole-quad-mode refusal after them, and wrote this description; checked and posted by me.
Foniass commented 2026-12-03 12:49:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T12:49:52Z.


Review of e82669f6 (code reading only, not a merge-check; draft, PR description red) · 1 high, 2 medium

In short: This PR builds on #3591 and contains its commit. Its first commit tightens the EXEC bounds in ps_masks::subset_after. Its second lets a pixel-shader s_cbranch_execz run through regions whose EXEC writes keep EXEC within the region's entry EXEC. The rule and its CPU tests look right on reading. What holds it back: the PR's own sweep shows worse output on NVIDIA with a cause that is only inferred, and the first commit changes the default path on every adapter.

High

  1. The PR's own sweep shows worse output on NVIDIA's default path, and the cause is not shown.

    • With this PR, one pixel shader goes from identical to HLSL to 192 unwritten pixels, and another from 4,055 to 8,514.
    • NVIDIA runs skips through by default (ps_skip_run_through_for, dxil/kernel.rs ~124-130), so both reach users with no switch set.
    • The description puts both on #3772, but for the first program that is inferred, not shown, and the #3772 workaround was never measured with this PR.

    Fix: sweep this PR on top of #3786 (which fixes #3772) and show both programs come back identical, or show with the marker value that the 192 pixels are lanes missing from the entry ballot. Until then, stack it after #3786.

Medium

  1. The first commit changes every adapter's default path and belongs in its own PR.

    • subset_after (recomp/ps_masks.rs ~112) is already on main. live_subsets and forms (~192, ~275) call it for every direct pixel shader, outside the ps_skip_run_through() check (kernel.rs ~900-901).
    • So the wave64 half / parity changes, the saveexec-into-EXEC change and the new S_ANDN1_WREXEC bound affect AMD too. That contradicts "Not tested: AMD (the rule only runs where #3591 runs skips through)".
    • The only check that commit 1 leaves =0 output unchanged (byte-identical DXIL) was made before the review fixes.

    Fix: open it separately with its tests, and repeat the =0 byte comparison at this head, or list AMD under Not tested for it.

  2. No GPU test runs a skip through a region that narrows EXEC.

    • The new tests check only the analysis (flat_region). The rule is only right if the lowered compare, v_cmpx and saveexec produce 0 with EXEC 0: the local form's c & act() and the quad form's lanebit_at(el, eh, ..) in dxil/lower_valu.rs ~1354-1400.
    • #3591's GPU test (recomp/tests.rs ~4076, ~4127) only has regions that write no EXEC.

    Fix: add a variant with a nested s_mov_b64 s[x], exec ; v_cmpx ; s_cbranch_execz ; ... ; s_mov_b64 exec, s[x] inside a skipped block.

Checked and fine
  • The first commit f4413ddb is #3591's head, unchanged, and the two after it merge cleanly onto main.
  • subset_after's bounds match the ISA:
    • S_ANDN1_WREXEC and S_ANDN2_WREXEC;
    • the saveexec family;
    • a saveexec whose SDST is EXEC bounds nothing;
    • the even-pair check and the parity rule for 32-bit SALU in wave64.
  • flat_region runs forward, intersects at joins, and starts from EXEC. Extra SGPRs from sgpr_uses lose their bound. Any EXEC write that is not bounded, including VALU ones, is refused, and S_WQM, S_NOT, S_ORN2 and S_CMOV to EXEC are refused.
  • Leaving EXEC out of the read-after set is sound, since EXEC is 0 at the region's end either way.
  • Lanes whose copy of EXEC is 0 read no other lane's bits from a compare.
  • TRANSLATOR_VERSION 12 → 13 is needed, since ps_masks.rs is in no source hash. The one flipped #3591 test expectation is the intended change.
  • Each accepted and refused form in the description has a test; the commit 1 tests fail on the old check.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7378902904 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3785#issuecomment-7378902904). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T12:49:52Z. --- **Review** of `e82669f6` (code reading only, not a merge-check; draft, `PR description` red) · 1 high, 2 medium **In short:** This PR builds on #3591 and contains its commit. Its first commit tightens the EXEC bounds in `ps_masks::subset_after`. Its second lets a pixel-shader `s_cbranch_execz` run through regions whose EXEC writes keep EXEC within the region's entry EXEC. The rule and its CPU tests look right on reading. What holds it back: the PR's own sweep shows worse output on NVIDIA with a cause that is only inferred, and the first commit changes the default path on every adapter. #### High 1. **The PR's own sweep shows worse output on NVIDIA's default path, and the cause is not shown.** - With this PR, one pixel shader goes from identical to HLSL to 192 unwritten pixels, and another from 4,055 to 8,514. - NVIDIA runs skips through by default (`ps_skip_run_through_for`, `dxil/kernel.rs` ~124-130), so both reach users with no switch set. - The description puts both on #3772, but for the first program that is inferred, not shown, and the #3772 workaround was never measured with this PR. Fix: sweep this PR on top of #3786 (which fixes #3772) and show both programs come back identical, or show with the marker value that the 192 pixels are lanes missing from the entry ballot. Until then, stack it after #3786. #### Medium 2. **The first commit changes every adapter's default path and belongs in its own PR.** - `subset_after` (`recomp/ps_masks.rs` ~112) is already on `main`. `live_subsets` and `forms` (~192, ~275) call it for every direct pixel shader, outside the `ps_skip_run_through()` check (`kernel.rs` ~900-901). - So the wave64 half / parity changes, the saveexec-into-EXEC change and the new `S_ANDN1_WREXEC` bound affect AMD too. That contradicts "Not tested: AMD (the rule only runs where #3591 runs skips through)". - The only check that commit 1 leaves `=0` output unchanged (byte-identical DXIL) was made before the review fixes. Fix: open it separately with its tests, and repeat the `=0` byte comparison at this head, or list AMD under **Not tested** for it. 3. **No GPU test runs a skip through a region that narrows EXEC.** - The new tests check only the analysis (`flat_region`). The rule is only right if the lowered compare, `v_cmpx` and saveexec produce 0 with EXEC 0: the local form's `c & act()` and the quad form's `lanebit_at(el, eh, ..)` in `dxil/lower_valu.rs` ~1354-1400. - #3591's GPU test (`recomp/tests.rs` ~4076, ~4127) only has regions that write no EXEC. Fix: add a variant with a nested `s_mov_b64 s[x], exec ; v_cmpx ; s_cbranch_execz ; ... ; s_mov_b64 exec, s[x]` inside a skipped block. <details><summary>Checked and fine</summary> - The first commit `f4413ddb` is #3591's head, unchanged, and the two after it merge cleanly onto `main`. - `subset_after`'s bounds match the ISA: - `S_ANDN1_WREXEC` and `S_ANDN2_WREXEC`; - the saveexec family; - a saveexec whose SDST is EXEC bounds nothing; - the even-pair check and the parity rule for 32-bit SALU in wave64. - `flat_region` runs forward, intersects at joins, and starts from EXEC. Extra SGPRs from `sgpr_uses` lose their bound. Any EXEC write that is not bounded, including VALU ones, is refused, and `S_WQM`, `S_NOT`, `S_ORN2` and `S_CMOV` to EXEC are refused. - Leaving EXEC out of the read-after set is sound, since EXEC is 0 at the region's end either way. - Lanes whose copy of EXEC is 0 read no other lane's bits from a compare. - `TRANSLATOR_VERSION` 12 → 13 is needed, since `ps_masks.rs` is in no source hash. The one flipped #3591 test expectation is the intended change. - Each accepted and refused form in the description has a test; the commit 1 tests fail on the old check. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
CharlyRien commented 2026-12-03 14:57:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-03T14:57:38Z.


Thanks for the review.

  1. The two worse programs. You were right about one of them. I swept the first two commits on top of #3786 (its commit 95c5f6e8 cherry-picked on the same sweep tree), in one job with #3591 + those commits and #3591 + #3786, same driver (621.47):
    • the 17-program family (the one at 8,514) is identical to HLSL with #3786 under them, all 17 programs: that one was #3772 made visible by the extra run-throughs;
    • the other pixel shader stayed at 192 unwritten pixels with #3786 (two runs, the same count), while #3591 + #3786 alone draws it right. It has one more skip run through: a region that writes EXEC under whole quad mode (the nested if, with a VOP3 v_cmpx), and a ds_swizzle after it. The direct DXIL with and without that skip differs only by the branch (same instructions, same selects under the same lane conditions), and WARP draws the same DXIL identical to HLSL, while the 3090 leaves 96 pixels per target unwritten. So the translation is right and the driver is not, but the PR still made the NVIDIA default path worse for that program.
      So I added a refusal (a2a8389c): a region that writes EXEC while EXEC may hold helper lanes (after s_wqm) keeps its skip when something after it reads other lanes (DPP, ds_swizzle, permute, permlane), with a CPU test of that shape. On the 119 programs it takes back only that skip (only that program's DXIL changes, back to #3591's), and the sweep with #3786 gives that program identical again, the 17-program family still identical, and every program's unwritten pixels the same as with #3591 + #3786. The description has the table, and says to merge after #3786.
  2. The first commit on every adapter. Right: forms uses subset_after for every direct pixel shader. I kept it in this PR (the rule depends on it) but repeated the =0 comparison at this head: with XCL_PS_SKIP_RUN_THROUGH=0, the direct DXIL of the 119 programs is byte for byte the same (119 of 119) at #3591's head f4413ddb and at 62e66d8a (CPU, every DXIL compared, not only sizes). With =1, 18 programs changed at 62e66d8a, all through the added skips; at a2a8389c, 17 (the other pixel shader is back to its f4413ddb DXIL). AMD and Intel are now under Not tested for the first commit. If you or the maintainer prefer it as its own PR, I'll split it.
  3. GPU test. Added gpu_direct_ps_skips_run_through_nested_ifs_that_narrow_exec (62e66d8a): the nested s_mov_b64 s[22:23], exec ; v_cmpx ; s_cbranch_execz ; ... ; s_mov_b64 exec, s[22:23] inside a skipped block, with the narrowing compare in each lowered form (local and per-quad v_cmpx, local and per-quad v_cmp + s_and_saveexec, and cond ? EXEC : 0). It checks that flat_skips takes both skips, the compare's form, that the DXIL differs from the kept one, and every pixel (0 wrong pixels required with the skips run through); waves outside the disc enter with EXEC 0, so a compare that did not give 0 there would write their left pixels. A widening region is refused, and drawn with its skip replaced by s_nop it changes every pixel outside the disc, so the image catches a wrong run-through. A sixth form (a8330f03) samples a texture in the inner block, with implicit derivatives after s_wqm: the shape where NVIDIA lost whole waves in #3574. A test-only kernel::PS_SKIP_IN_TEST makes it run the same on any adapter. RTX 3090, 621.47: passed 3 times out of 3 at a8330f03, 0 wrong pixels in each of the 6 forms with the skips run through (the same at a2a8389c). With the skips kept it only prints the count, and it was 0 in all 6 forms too: this small shader does not reproduce #3574 on this card.

Also fixed the description for the PR check (Tested / Not tested / AI use sections, xcl-smoke blocks of main 16c2fd08 and this head: 556 / 488 frames, peak commit 15,628 / 16,164 MB).

AI use: Claude Code (Claude Opus 5.5) wrote the test and the refusal, ran the sweeps, the WARP comparison and the CPU probe, and wrote this reply; checked and posted by me.

<!-- greyfinch-sync:ivall/xcl:comment:7382323568 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3785#issuecomment-7382323568). Originally posted by [CharlyRien](https://github.com/CharlyRien) on 2026-12-03T14:57:38Z. --- Thanks for the review. 1. **The two worse programs.** You were right about one of them. I swept the first two commits on top of #3786 (its commit `95c5f6e8` cherry-picked on the same sweep tree), in one job with #3591 + those commits and #3591 + #3786, same driver (621.47): - the 17-program family (the one at 8,514) is identical to HLSL with #3786 under them, all 17 programs: that one was #3772 made visible by the extra run-throughs; - the other pixel shader stayed at 192 unwritten pixels with #3786 (two runs, the same count), while #3591 + #3786 alone draws it right. It has one more skip run through: a region that writes EXEC under whole quad mode (the nested `if`, with a VOP3 `v_cmpx`), and a `ds_swizzle` after it. The direct DXIL with and without that skip differs only by the branch (same instructions, same selects under the same lane conditions), and WARP draws the same DXIL identical to HLSL, while the 3090 leaves 96 pixels per target unwritten. So the translation is right and the driver is not, but the PR still made the NVIDIA default path worse for that program. So I added a refusal (`a2a8389c`): a region that writes EXEC while EXEC may hold helper lanes (after `s_wqm`) keeps its skip when something after it reads other lanes (DPP, `ds_swizzle`, permute, permlane), with a CPU test of that shape. On the 119 programs it takes back only that skip (only that program's DXIL changes, back to #3591's), and the sweep with #3786 gives that program identical again, the 17-program family still identical, and every program's unwritten pixels the same as with #3591 + #3786. The description has the table, and says to merge after #3786. 2. **The first commit on every adapter.** Right: `forms` uses `subset_after` for every direct pixel shader. I kept it in this PR (the rule depends on it) but repeated the `=0` comparison at this head: with `XCL_PS_SKIP_RUN_THROUGH=0`, the direct DXIL of the 119 programs is byte for byte the same (119 of 119) at #3591's head `f4413ddb` and at `62e66d8a` (CPU, every DXIL compared, not only sizes). With `=1`, 18 programs changed at `62e66d8a`, all through the added skips; at `a2a8389c`, 17 (the other pixel shader is back to its `f4413ddb` DXIL). AMD and Intel are now under **Not tested** for the first commit. If you or the maintainer prefer it as its own PR, I'll split it. 3. **GPU test.** Added `gpu_direct_ps_skips_run_through_nested_ifs_that_narrow_exec` (`62e66d8a`): the nested `s_mov_b64 s[22:23], exec ; v_cmpx ; s_cbranch_execz ; ... ; s_mov_b64 exec, s[22:23]` inside a skipped block, with the narrowing compare in each lowered form (local and per-quad `v_cmpx`, local and per-quad `v_cmp` + `s_and_saveexec`, and `cond ? EXEC : 0`). It checks that `flat_skips` takes both skips, the compare's form, that the DXIL differs from the kept one, and every pixel (0 wrong pixels required with the skips run through); waves outside the disc enter with EXEC 0, so a compare that did not give 0 there would write their left pixels. A widening region is refused, and drawn with its skip replaced by `s_nop` it changes every pixel outside the disc, so the image catches a wrong run-through. A sixth form (`a8330f03`) samples a texture in the inner block, with implicit derivatives after `s_wqm`: the shape where NVIDIA lost whole waves in #3574. A test-only `kernel::PS_SKIP_IN_TEST` makes it run the same on any adapter. RTX 3090, 621.47: passed 3 times out of 3 at `a8330f03`, 0 wrong pixels in each of the 6 forms with the skips run through (the same at `a2a8389c`). With the skips kept it only prints the count, and it was 0 in all 6 forms too: this small shader does not reproduce #3574 on this card. Also fixed the description for the PR check (Tested / Not tested / AI use sections, `xcl-smoke` blocks of `main` `16c2fd08` and this head: 556 / 488 frames, peak commit 15,628 / 16,164 MB). AI use: Claude Code (Claude Opus 5.5) wrote the test and the refusal, ran the sweeps, the WARP comparison and the CPU probe, and wrote this reply; checked and posted by me.
Foniass commented 2026-12-03 15:01:47 +00:00 (Migrated from github.com)

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


Follow-up review of a2a8389c, since e82669f6 (code reading only, not a merge-check; draft) · 1 medium

In short: The PR has three new commits since the last review:

  • the GPU test the review asked for, which runs both skips of a nested if that narrows EXEC in every lowered compare form, plus a variant that samples a texture;
  • a refusal that keeps the skip when a region writes EXEC under whole quad mode and other lanes are read after it, with a CPU test;
  • the NVIDIA sweep, now shown on top of #3786 with nothing worse. The description says to merge after #3786.

The one point still open is the subset_after fix, which changes every adapter's default path and is still in this PR.

Medium

  1. The first commit still changes every adapter's default path, and it is still not split out (still open, in part).

    • subset_after (recomp/ps_masks.rs ~112) is reached from forms (~275, ~308) for every direct pixel shader, outside the ps_skip_run_through() check (dxil/kernel.rs ~916-918). So AMD and Intel get the changed bounds too.
    • The =0 byte comparison was repeated (119 of 119 the same), and AMD / Intel are now under Not tested.
    • The PR's own part, everything after #3591's f4413ddb, is now 812+/100-, about 910 changed lines. That is over the ~800 lines at which CONTRIBUTING.md asks the description to say why the PR cannot be split. The description says only that the rule depends on the fix, which is a reason to stack the fix underneath, not to keep it here.

    Fix: open eb352ba1 as its own PR with its tests, and stack this one on it (Stacked on #N).

Checked and fine
  • Earlier finding fixed: the NVIDIA sweep's cause was only inferred.

    • With #3786's 95c5f6e8 underneath, the 17-program family is identical to HLSL.
    • The other pixel shader draws correctly on WARP from the same DXIL, which puts its 192 pixels on the driver.
    • The new refusal (a2a8389c, ps_masks.rs ~566-589) puts that program back to its DXIL at #3591's head.
    • The description now says to merge after #3786.
  • Earlier finding fixed: no GPU test ran a skip through a region that narrows EXEC. gpu_direct_ps_skips_run_through_nested_ifs_that_narrow_exec (recomp/tests.rs ~4305) covers every lowered compare form:

    • local and per-quad v_cmpx;
    • local and per-quad v_cmp + s_and_saveexec_b64;
    • VOP3 v_cmp to EXEC;
    • an image_sample in the inner block.

    For each one it checks that both skips are taken, the compare's form, that the DXIL differs from the kept one, and every pixel. Waves wholly outside the disc enter with EXEC 0, so a compare that did not give 0 would show up as a written v12. The Widen control is refused by the rule, and when it is forced through, the image shows the wrong result.

  • PS_SKIP_IN_TEST (dxil/kernel.rs ~114-127) works like IDIOMS_IN_TEST. It exists only under #[cfg(test)] and is copied into the translator thread.

  • The new refusal is checked only when the region writes EXEC and EXEC at the skip is not known to be a subset of the live lanes. It can only keep skips, never add run-throughs. Its CPU test fails without it (ds_swizzle and DPP after the region), and it also checks the accepted cases: v_readfirstlane, a sample, nothing after the region, and no s_wqm.

  • TRANSLATOR_VERSION 13 → 14 is needed, because ps_masks.rs is in no source hash.

  • Commits 1-3 are unchanged, and the head merges cleanly onto the current main.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7382441034 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3785#issuecomment-7382441034). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T15:01:47Z. --- **Follow-up review** of `a2a8389c`, since `e82669f6` (code reading only, not a merge-check; draft) · 1 medium **In short:** The PR has three new commits since the last review: - the GPU test the review asked for, which runs both skips of a nested `if` that narrows EXEC in every lowered compare form, plus a variant that samples a texture; - a refusal that keeps the skip when a region writes EXEC under whole quad mode and other lanes are read after it, with a CPU test; - the NVIDIA sweep, now shown on top of #3786 with nothing worse. The description says to merge after #3786. The one point still open is the `subset_after` fix, which changes every adapter's default path and is still in this PR. #### Medium 1. **The first commit still changes every adapter's default path, and it is still not split out (still open, in part).** - `subset_after` (`recomp/ps_masks.rs` ~112) is reached from `forms` (~275, ~308) for every direct pixel shader, outside the `ps_skip_run_through()` check (`dxil/kernel.rs` ~916-918). So AMD and Intel get the changed bounds too. - The `=0` byte comparison was repeated (119 of 119 the same), and AMD / Intel are now under **Not tested**. - The PR's own part, everything after #3591's `f4413ddb`, is now 812+/100-, about 910 changed lines. That is over the ~800 lines at which CONTRIBUTING.md asks the description to say why the PR cannot be split. The description says only that the rule depends on the fix, which is a reason to stack the fix underneath, not to keep it here. Fix: open `eb352ba1` as its own PR with its tests, and stack this one on it (`Stacked on #N`). <details><summary>Checked and fine</summary> - Earlier finding fixed: the NVIDIA sweep's cause was only inferred. - With #3786's `95c5f6e8` underneath, the 17-program family is identical to HLSL. - The other pixel shader draws correctly on WARP from the same DXIL, which puts its 192 pixels on the driver. - The new refusal (`a2a8389c`, `ps_masks.rs` ~566-589) puts that program back to its DXIL at #3591's head. - The description now says to merge after #3786. - Earlier finding fixed: no GPU test ran a skip through a region that narrows EXEC. `gpu_direct_ps_skips_run_through_nested_ifs_that_narrow_exec` (`recomp/tests.rs` ~4305) covers every lowered compare form: - local and per-quad `v_cmpx`; - local and per-quad `v_cmp` + `s_and_saveexec_b64`; - VOP3 `v_cmp` to EXEC; - an `image_sample` in the inner block. For each one it checks that both skips are taken, the compare's form, that the DXIL differs from the kept one, and every pixel. Waves wholly outside the disc enter with EXEC 0, so a compare that did not give 0 would show up as a written `v12`. The `Widen` control is refused by the rule, and when it is forced through, the image shows the wrong result. - `PS_SKIP_IN_TEST` (`dxil/kernel.rs` ~114-127) works like `IDIOMS_IN_TEST`. It exists only under `#[cfg(test)]` and is copied into the translator thread. - The new refusal is checked only when the region writes EXEC and EXEC at the skip is not known to be a subset of the live lanes. It can only keep skips, never add run-throughs. Its CPU test fails without it (`ds_swizzle` and DPP after the region), and it also checks the accepted cases: `v_readfirstlane`, a sample, nothing after the region, and no `s_wqm`. - `TRANSLATOR_VERSION` 13 → 14 is needed, because `ps_masks.rs` is in no source hash. - Commits 1-3 are unchanged, and the head merges cleanly onto the current `main`. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
CharlyRien commented 2026-12-03 16:48:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CharlyRien on 2026-12-03T16:48:30Z.


Thanks. Split as you suggested: eb352ba1 (the EXEC bounds fix in subset_after, with its four CPU tests) is now #3798, stacked on #3591, and this PR is stacked on it ("Stacked on #3591 and #3798" at the top of the description).

  • This branch is unchanged: its head is still a2a8389c, with eb352ba1 under it. Its own part is now eb352ba1..a2a8389c: 3 files, +673 / −77 (750 lines, about 540 of the added lines are tests). Apart from TRANSLATOR_VERSION, all of its non-test code is in flat_skips / flat_region, which run only where #3591 runs skips through.
  • #3798 has its own Tested section for that commit alone: the CPU and GPU tests on its head, the =0 / =1 byte comparison of the 119 programs against #3591's head (119 of 119 the same both ways), a release build and a smoke run on its head. AMD and Intel are under Not tested there.
  • This description now points to #3798 for that commit and no longer describes it. Merge order: #3591, #3798, then this PR (after #3786).

AI use: Claude Code (Claude Opus 5.5) split the branch, ran the tests, the CPU comparison and the smoke run of the new PR, and wrote both descriptions and this reply; checked and posted by me.

<!-- greyfinch-sync:ivall/xcl:comment:7385480441 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3785#issuecomment-7385480441). Originally posted by [CharlyRien](https://github.com/CharlyRien) on 2026-12-03T16:48:30Z. --- Thanks. Split as you suggested: `eb352ba1` (the EXEC bounds fix in `subset_after`, with its four CPU tests) is now #3798, stacked on #3591, and this PR is stacked on it ("Stacked on #3591 and #3798" at the top of the description). - This branch is unchanged: its head is still `a2a8389c`, with `eb352ba1` under it. Its own part is now `eb352ba1..a2a8389c`: 3 files, +673 / −77 (750 lines, about 540 of the added lines are tests). Apart from `TRANSLATOR_VERSION`, all of its non-test code is in `flat_skips` / `flat_region`, which run only where #3591 runs skips through. - #3798 has its own Tested section for that commit alone: the CPU and GPU tests on its head, the `=0` / `=1` byte comparison of the 119 programs against #3591's head (119 of 119 the same both ways), a release build and a smoke run on its head. AMD and Intel are under Not tested there. - This description now points to #3798 for that commit and no longer describes it. Merge order: #3591, #3798, then this PR (after #3786). AI use: Claude Code (Claude Opus 5.5) split the branch, ran the tests, the CPU comparison and the smoke run of the new PR, and wrote both descriptions and this reply; checked and posted by me.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3785:upstream-pr/3785'
git switch 'upstream-pr/3785'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3785'
git switch 'upstream-pr/3785'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3785'
git switch 'upstream-pr/3785'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3785'
git switch 'main'
git merge --squash 'upstream-pr/3785'
git switch 'main'
git merge --ff-only 'upstream-pr/3785'
git switch 'main'
git merge 'upstream-pr/3785'
git push origin 'main'
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!3785
No description provided.