Repository navigation
Recompiler: direct DXIL PS IR cuts (shared float decode, direct quad shuffles, predicate-derived lane masks) - #3501
Conversation
Direct DXIL tests a lane's EXEC (or VCC) bit by shifting the mask word by the lane index. For a mask built from a per-lane predicate (a ballot, or a pixel shader's own/local compare mask) that bit is the predicate itself, and for an and/or/xor/select of such masks word by word (s_and_saveexec, s_andn2, EXEC restores) it is the same operation on the operands' bits. Lw::lanebit now records the predicate of each such ballot and decomposes those operations, so exec-masked writes test an i1 chain instead of a shifted ballot word, and ballots read only that way die. Pixel-shader quad-form compare masks (xcl-dev#134) keep the word test: their own bit also depends on the other quad lanes' copies of EXEC. The split form and generic pixel ballots (helper lanes) are unchanged. Measured on an RTX 5070 Ti: cold driver compile of one graphics pipeline, one thread, driver cache off, median of 3 in each of three runs. The largest pixel shader of a format-load-heavy batch went down 4-6% (2.60 s -> 2.51 s in the last run; DXIL 268 -> 256 KB). Two other pixel shaders that bound the batch were within noise; most of their exec-select conditions come from quad-form masks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
adef6c3 to
0220283
Compare
…, not through quadOp A pixel shader's ballots outside compares (`Lw::ballot_ps`: carry masks and the like) collected their quad's 4 bits through `QuadReadAcrossX/Y/Diagonal` (`quadOp`). An AMD RDNA2 driver (amdxc64 32.0.21030.2001 and 32.0.21045.29003, RX 6700 XT) dies with a null read about 1 ms into the pipeline build of a retail title's pixel shader (record 7381166e806847c9) in which 10 of the 27 such ballots take a value that derives from `WaveReadLaneAt`: the title ends there at its first world load. Found by taking the pipeline apart: without its PS it builds, without blending or in the plain wave64 form it does not; with the ballots below, the same VS and description build in 4.3 s and the run goes on. The ballot now reads its quad with 4 `QuadReadLaneAt`, as the compare path does for the same driver (xcl-dev#134, `lower_valu`): bit `p` is the quad's member `p`, which is what `own << (lane & 3)` relied on too. Both forms record the lane's own bit (`note_own_bit`, xcl-dev#3501). `XCL_PS_BALLOT_QUADOP=1` keeps the `quadOp` form (with `XCL_TRANSLATED_CACHE=0`, a translation on disk keeps its form). Tests: `direct_ps_non_vopc_carry_ballot_reads_its_quad_lane_by_lane` (was `..._uses_quad_op`) checks both forms' DXIL, also with the carry's operand coming through `v_readfirstlane`, and that `v_cndmask` takes the carry itself; `gpu_direct_ps_carry_ballot_draws_the_same_lane_by_lane_as_through_quadop` draws a carry mask, its DPP `ddx` (helper lanes on the triangles' edge) and the mask's bit of the lane to the right in both forms and compares every pixel. The test-only form is handed to the translator's thread like `NO_SELECT_FOLD`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Same report as on #2571 (#2571 (comment)), posted here because it points at this PR's Stack: main 493dbd3 (has #3535) + #3528 (ba8592a) + #3517 (0b4283d) + 42 local commits of ours (memory-window, alias-copy and diagnostic switches; none touches
What we read (not measured):
What we deduce: on NVIDIA (wave64 split into two wave32 halves) the #3501 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. |
…, not through quadOp A pixel shader's ballots outside compares (`Lw::ballot_ps`: carry masks and the like) collected their quad's 4 bits through `QuadReadAcrossX/Y/Diagonal` (`quadOp`). An AMD RDNA2 driver (amdxc64 32.0.21030.2001 and 32.0.21045.29003, RX 6700 XT) dies with a null read about 1 ms into the pipeline build of a retail title's pixel shader (record 7381166e806847c9) in which 10 of the 27 such ballots take a value that derives from `WaveReadLaneAt`: the title ends there at its first world load. Found by taking the pipeline apart: without its PS it builds, without blending or in the plain wave64 form it does not; with the ballots below, the same VS and description build in 4.3 s and the run goes on. The ballot now reads its quad with 4 `QuadReadLaneAt`, as the compare path does for the same driver (xcl-dev#134, `lower_valu`): bit `p` is the quad's member `p`, which is what `own << (lane & 3)` relied on too. Both forms record the lane's own bit (`note_own_bit`, xcl-dev#3501). Only tests can ask for the `quadOp` form: no setting changes the translation outside its cache identity. Tests: `direct_ps_non_vopc_carry_ballot_reads_its_quad_lane_by_lane` (was `..._uses_quad_op`) checks both forms' DXIL, also with the carry's operand coming through `v_readfirstlane`, and that `v_cndmask` takes the carry itself; `gpu_direct_ps_carry_ballot_draws_the_same_lane_by_lane_as_through_quadop` draws a carry mask, its DPP `ddx` (helper lanes on the triangles' edge) and the mask's bit of the lane to the right in both forms and compares every pixel. The test-only form is handed to the translator's thread like `NO_SELECT_FOLD`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On an RTX 4090 (driver 621.40, Windows), the in-world slowdown for one pixel shader first appears at
The host was fixed at Color changes too. In the adjacent-commit test, the two active readbacks differed at 360 and 450 texels on target 1 only. In the function-only test, the two active readbacks had 103 and 104 PS invocations respectively. Restoring the old function changed 60/63/40 texels on targets 0/1/2 in the first draw and 56/60/35 in the second. Targets 3–5 matched. A console reference would be needed to decide which output is correct. The function-only control kept the PR's quad shuffle and predicate changes intact. Both replay processes exited cleanly. The measurements cover this shader's draw time in one save. Whole-game frame rate and the cause of the pre-world hang remain open. AI use: OpenAI Codex (GPT-6) reconstructed the intermediate trees, ran the builds and GPU replays, checked the logs and readbacks, and drafted this comment. |
…, not through quadOp A pixel shader's ballots outside compares (`Lw::ballot_ps`: carry masks and the like) collected their quad's 4 bits through `QuadReadAcrossX/Y/Diagonal` (`quadOp`). An AMD RDNA2 driver (amdxc64 32.0.21030.2001 and 32.0.21045.29003, RX 6700 XT) dies with a null read about 1 ms into the pipeline build of a retail title's pixel shader (record 7381166e806847c9) in which 10 of the 27 such ballots take a value that derives from `WaveReadLaneAt`: the title ends there at its first world load. Found by taking the pipeline apart: without its PS it builds, without blending or in the plain wave64 form it does not; with the ballots below, the same VS and description build in 4.3 s and the run goes on. The ballot now reads its quad with 4 `QuadReadLaneAt`, as the compare path does for the same driver (xcl-dev#134, `lower_valu`): bit `p` is the quad's member `p`, which is what `own << (lane & 3)` relied on too. Both forms record the lane's own bit (`note_own_bit`, xcl-dev#3501). Only tests can ask for the `quadOp` form: no setting changes the translation outside its cache identity. Tests: `direct_ps_non_vopc_carry_ballot_reads_its_quad_lane_by_lane` (was `..._uses_quad_op`) checks both forms' DXIL, also with the carry's operand coming through `v_readfirstlane`, and that `v_cndmask` takes the carry itself; `gpu_direct_ps_carry_ballot_draws_the_same_lane_by_lane_as_through_quadop` draws a carry mask, its DPP `ddx` (helper lanes on the triangles' edge) and the mask's bit of the lane to the right in both forms and compares every pixel. The test-only form is handed to the translator's thread like `NO_SELECT_FOLD`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three direct-DXIL pixel-shader IR cuts that reduce DXIL size and cold driver compile times on heavy pixel shaders.
What is in it
Tested
cargo check -p xcl --tests: passed on this exact head againstorigin/main(91244db94)scripts/smoke.ps1running now and will be pasted below.Regression run
main:PR head:
Not tested
AI use