Repository navigation
Shaders: the tiled cascade shadow programs translate exactly on 32-lane hosts - #1002
brunofgmag wants to merge 1 commit into
Conversation
|
Reproduced the |
|
Tested in the title on an RTX 5080 16 GB (32-lane waves), driver 621.14, Windows 11, Series X profile: the stepped sunlight along the character's edge is gone. Build: diagnostics build of Translation: Picture: the opening cell shot, the character from behind against the sunlit window, compared across three runs.
Stability: no errors and no device loss in the 10-minute run. One run with the PR, one card. AI-assisted (Claude Code, Claude Opus 5.5). Counts and descriptions only, nothing from the game attached. |
…mits on fork-fast) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Confirmed on Turing: RTX 2080 SUPER 8 GB (32-lane waves, driver 621.01), Ryzen 7 3700X, Windows 11, Series S profile. Tree:
Numbers and text only. AI-assisted (Claude Code). |
|
RX 7900 XTX (RDNA3), Windows 10 + #402, main |
|
Tested on a 32-lane card: on its own on Machine: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, 16 GB RAM with a 32 GB pagefile, Windows 11 26300, Series X profile, diag build. Every run loads the same save at the prison window and is measured from world +120 s to +360 s. Switches:
So on this card, this PR is needed but not sufficient. The steps go away only together with #854/#993's exact 64-lane forms. In that tree the four programs the driver used to refuse with Merge. The merged tree is at
One test of #993 needed a new expectation. Not tested:
|
…less#1033) ir::build fills every instruction's register lists twice. `effects()` collects `Vec<Reg>` (two allocations), and the caller immediately maps each one into `Vec<(Reg, Value)>` (two more), freeing the first pair. For lists that are almost always two to four entries, that is four allocations and two copies per instruction, on every instruction of every program. Have `effects()` and its helpers collect the `(Reg, Value)` pairs directly, with the placeholder the SSA pass fills in. Two allocations per instruction instead of four; `Inst` and everything downstream are unchanged. Measured with the synthetic bench in fxceless#1002 (no game data), ten interleaved rounds per arm, nanoseconds per instruction, at 256/1k/4k/16k instructions: ir::build 308 -> 269, 375 -> 324, 407 -> 340, 402 -> 353 (0.835-0.878) translation 898 -> 872, 898 -> 825, 951 -> 875, 956 -> 912 (0.919-0.971) gfx10::decode, structure, lower and the rest are unchanged. The emitted DXIL is byte-identical at all four sizes. cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored. Both clippy configurations clean; cargo xtask policy ok. Co-authored-by: pes7 <pes7@users.noreply.github.com>
`Instruction::name()` binary-searches the opcode table, and the pipeline asks about every instruction eight times per translation: `ir::build`, `structure`, `resource` (which has the most call sites), `io` and `lower`. The answer cannot change - the encoding and opcode are decoded from the words and never rewritten - so resolve it once when the instruction is built and read the field after that. Measured with the synthetic bench from fxceless#1002 (no game data), sixteen interleaved rounds per arm, best of each, nanoseconds per instruction, at 256/1k/4k/16k instructions: resource 17 -> 9, 15 -> 7, 24 -> 16, 23 -> 15 (0.47-0.67) lower 511 -> 479, 428 -> 411, 440 -> 401, 477 -> 428 (0.90-0.96) io 27 -> 23, 26 -> 21, 26 -> 22, 30 -> 22 (0.73-0.85) whole 926 -> 881, 920 -> 874, 958 -> 921, 1019 -> 939 (0.92-0.96) `decode` pays the one search it used to be spared (112 -> 115 at 16k, inside the run-to-run spread); every stage after it reads a field. The emitted DXIL is byte-identical at all four sizes. cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored. Both clippy configurations clean; cargo xtask policy ok.
`Instruction::name()` binary-searches the opcode table, and the pipeline asks about every instruction eight times per translation: `ir::build`, `structure`, `resource` (which has the most call sites), `io` and `lower`. The answer cannot change - the encoding and opcode are decoded from the words and never rewritten - so resolve it once when the instruction is built and read the field after that. Measured with the synthetic bench from fxceless#1002 (no game data), sixteen interleaved rounds per arm, best of each, nanoseconds per instruction, at 256/1k/4k/16k instructions: resource 17 -> 9, 15 -> 7, 24 -> 16, 23 -> 15 (0.47-0.67) lower 511 -> 479, 428 -> 411, 440 -> 401, 477 -> 428 (0.90-0.96) io 27 -> 23, 26 -> 21, 26 -> 22, 30 -> 22 (0.73-0.85) whole 926 -> 881, 920 -> 874, 958 -> 921, 1019 -> 939 (0.92-0.96) `decode` pays the one search it used to be spared (112 -> 115 at 16k, inside the run-to-run spread); every stage after it reads a field. The emitted DXIL is byte-identical at all four sizes. cargo test --workspace --locked: 342 passed, 0 failed, 7 ignored. Both clippy configurations clean; cargo xtask policy ok. (cherry picked from commit 146dfef)
On a host with 32-lane waves (an RTX 4080 here),
CS_ShadowRenderTiledCascadesAlphaCBPPPC(f133e35efed2a48a) was refused every frame with "a lane mask exchanged where not every lane runs" at 0x1eb4, so alpha-tested geometry cast no cascade shadows. Three programs of the same family (CS_ShadowRenderTiledCascadesCBPPPC20b78ee12ecdb57d,CS_ShadowRenderTiledCascadesPPPCce79e9eba7ae0348 andCS_ShadowRenderTiledMiscAlphaPPPCfa0bd10a35bfef3c) only translated through the approximate local-waves form. In game that drew the sun's light along characters' silhouettes in steps of about 16 pixels.The ballot they need sits under per-lane regions that the retry forms could not remove. There were three reasons, and this PR fixes each one in
ir.rs:without_early_outsandwithout_skipsnow also take ans_cbranch_execnzover a far-jump trampoline (s_getpc_b64,s_add_u32,s_addc_u32,s_setpc_b64) to an end block. These programs are too long for a short branch to reachs_endpgm. A trampoline that does any work is still kept.without_skips, a scalar phi whose arguments all resolve to one value counts as a copy of that value. The arguments are followed through copies and through other such phis. A phi that merges a real change is still a change.unspillalso pairs two lanes per save and restore site, not only per lane. The pairing is checked with reaching definitions, so a 64-bit exec saved into two VGPR lanes comes back as one mask even when one of those lanes holds another scalar elsewhere.With the three fixes the ballot reaches the existing exact
exchange_halves.Measured with
translate --listandVICTORY_HOST_WAVE=32over 3,093 programs from one session:In game the steps along silhouettes are gone and frame time did not get worse (168 to 195 ms a frame in three runs, against about 200 to 240 before). No run lost the device.
The new tests in
wave64_tests.rsare hand-written GFX10 words. One of them runs on the device and checks a gate where exactly one failing lane is in the upper half, which a per-half answer gets wrong. Thevictory-shadertests pass exceptstub_pipeline_is_created, which fails without dxil.dll on this machine as it does on main. Clippy for the workspace still stops at the four warnings that #982 fixes.