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.
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com> (cherry picked from commit 4fd34fdd6634372b9f9a1ac791cdc86be329c0ad)
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 [cool/play-2: picked onto cool_fox f4b48ad + Marvisak#66 + Marvisak#142; wave64_tests.rs conflicted only because both sides add tests at its end: resolved by hand, both kept.] Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com>
|
Second NVIDIA data point: RTX 3080 10 GB, merged onto
|
…VICTORY_CASCADE_EXACT=0 goes back) On a host of 32-lane waves a console wave64 compute program that stops where not every lane runs is translated again with its early-outs left out, then its skips (`deep`: also the skips whose scalars come back the same). Three things kept the tiled cascade shadow programs from those exact forms and left them on the approximate one (each host wave on its own, which counts the lanes of its half alone: 136 of 1,024 thread results wrong in the synthetic gate of the new test): - A program too long for a branch to reach its end has the early-out as `s_cbranch_execnz` over a far jump (`s_getpc_b64`, an add, `s_setpc_b64`) to a block that only ends the program. That is an early-out too now; the far jump that nothing reaches any more is emptied, so that no code of the program before is left in the program after. A jump that does any work, or work between its target and the end, stays what it is. - A scalar phi whose arguments all come to one value (the join of inner branches that left it alone) is a copy of that value in `deep`. - The check that a skipped region cannot revive a lane (a restore of EXEC from a mask saved outside the region would) only counted masks saved by the region itself. A mask the region copies, or joins from masks it saved, is as empty: the check follows them through copies and phis. A mask with a path from outside the region still fails it. Offline, as a 32-lane host: 2 of the 4 cascade programs of the saved set now take the exact form; the other two still have the wave-wide OR idiom's `s_or_saveexec_b64 -1` in the region (not changed here). On a 64-lane host nothing changes. Adapted from avatarmanz/VIctory-7900XTX#82 (sawetco), after fxceless/victory-fork#1002 (Bruno Magalhaes); the closure of the check is new. This tree's `without_skips` and `walks_with_empty_exec` differ from that fork's (a region must keep EXEC empty), so the far form goes through the same checks as the near one. Its pair-parking tests are not ported (this tree's `unspill` does not pair by lifetime); the one that applies is. Co-authored-by: sawetco <44127741+sawetco@users.noreply.github.com> Co-authored-by: Bruno Magalhaes <19572425+brunofgmag@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on an RTX 5080 16 GB (32-lane waves), Ryzen 7 5800X, 32 GB RAM, Windows 11. Diagnostics build of
That's one machine and one run per side, so take it as a data point. AI-assisted (Claude Code). Counts and observations only, no game data. |
|
Additional RTX 3060 validation for A newer retail game:
Commands: Combined workspace: AI use: Codex, GPT-6 (exact serving variant not exposed), performed integration and the local tests above. Original PR authors retained. These measurements are from this machine. |
|
Visual confirmation in the prologue cell (RTX 3080, |
… + avm fxceless#109 to fork-nv) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapt the far early-out and deep scalar-copy parts of fxceless#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless@eaeb8f1 Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com> (cherry picked from commit 4fd34fd)
…e), 4 KiB dirty tracking, gather segments, the black-face texture fixes, shadow and translator fixes from pull requests Measured in in-run on/off splits on an RTX 4070 (diagnostics builds, the same switches for every run): - VICTORY_CARD_HASH_WIDE=1|alt: the card's hashes of copies' pieces by a group of 64 threads a piece, alternating per submission: card -10 ms a frame (86.5 vs 96.5), world frames -5 ms. - VICTORY_GATHER_SEGMENTS=1|alt (after flipflop877 c69bff1): one clamp pass per segment once a list stops gathering: ~30 records a pass, neutral to slightly faster at equal draws. - VICTORY_DIRTY_4K=1|alt: refreshes copy only the written 4 KiB pages of a stale write-watched page: -45 % of those bytes; faster in loading, no world gain. Fixes: - Textures under a DirectStorage write or a landed plain read are made due again (VICTORY_PAGE_WRITES default 1|2|8): textures uploaded before their data landed kept zeros (black faces); VICTORY_HEAP_RECHECK_EVERY=<frames> keeps looking at uploaded textures after the schedule (after RyanCase94). - Pull requests #646 (builder dispatches count threads), #1002 (alpha-tested geometry casts cascade shadows), #1314, #1324, #589, #702, #1112 (mesh triangle corners masked 9 bits, cube-map levels, two-sampler branches, split 64-lane masks); upstream #3198 (textures without card room retried). - VICTORY_WAVE_WIDE_ONLY=<hashes>: listed refused programs may take the wave-wide form (after #823's a416e39; the water's colour, with dark patches still under investigation). - VICTORY_MERGE_RUNS_ALT, VICTORY_CLAMP_LEAN, VICTORY_CLAMP_WINDOW, VICTORY_OCCLUSION: measured, no gain; off. The shader translator changed: delete both shader caches before the first run.
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com> (cherry picked from commit 4fd34fdd6634372b9f9a1ac791cdc86be329c0ad)
- VICTORY_PAGE_WRITES default 1|2|8 (after fxceless/victory-fork e4245f3): placed textures uploaded before a read into their pages landed are made due again (the black faces of the opening cutscene); 'guards' is the old default. - From fxceless/victory-fork PR fxceless#1002 (GPL-3.0-or-later): without_early_outs and without_skips take an s_cbranch_execnz over a far-jump trampoline to the end, and a scalar phi of one value counts as a copy of it. The four tiled cascade shadow programs (f133e35efed2a48a, 20b78ee12ecdb57d, ce79e9eba7ae0348, fa0bd10a35bfef3c) translate in the exact 'without skips, scalars followed' form where they took the approximate local waves (light along silhouettes in 16-pixel steps). Our own spill-lane pairing is kept. Offline: 4 of 2,123 translations change, none lost; 281 shader tests pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… measuring Staged the same evening, compiled and passing the tests, none measured: the original's fxceless#1002 (exact cascade shadows on 32 lanes), fxceless#1324 and fxceless#1333 (descriptor heaps), three more ray-only skips with a count of such programs, fxceless#1341 (VICTORY_ALT_FLIP) and VICTORY_RAM_TRIM. Why nothing of it has a figure: the process holds about 16.5 GB private in the first room (the layer's own account of one session), the lab's runner waits for 20 GiB free, and six readings between 18:47 and 19:11 local time gave 16.1 to 18.0 GiB free. The switches that make the layer hold less (VICTORY_WINDOW_KB, VICTORY_WINDOW_TAILS, VICTORY_INPLACE, all in main and off) go first. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Apply fork PR fxceless#1002 (eaeb8f1), whose IR hunks match upstream e4245f3. Retain guarded far exits, unchanged scalar phis and reaching-definition spill-pair recovery with the original regression tests.
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 Ported from edsuuu/VI-BR-PORT a06da66 (by edsuuu).
…ams translate exactly on 32-lan) head eaeb8f1
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com> (cherry picked from commit 4fd34fdd6634372b9f9a1ac791cdc86be329c0ad)
…CT, on by default The three changes of the previous commit (pairs of parked lanes by site, an `s_cbranch_execnz` over a far jump to the end taken as an early-out, a scalar phi of one value taken as a copy in the deep form of `without_skips`) change the translation of the tiled cascade shadow programs on 32-lane hosts. They stay on; `VICTORY_SHADER_CASCADE_EXACT=0` turns all three off, which gives back the translation from before exactly, so the shadows can be compared with one build. The name is a `VICTORY_*` string in this crate, so `build.rs` lists it and its value joins the shader cache key. Our shared-slots test expects the pair by site only with the switch on. The PR's tests in wave64_tests.rs expect the forms on and fail with it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… part 2) 9613092 alone does not build (its second deep-skips form call lacks the label 93db653 adds), so the fifth merge goes on to e4245f3, the commit it was meant to bring; nothing after it (fxceless#1320, fxceless#1321, fxceless#1353, fxceless#1336, fxceless#1324 of 13:05 are left for later). - 93db653: build fix for 9613092 (VICTORY_WAVE_WHY form label). - e4245f3: VICTORY_CARD_HASH_WIDE=alt (1 was already there; default still a thread a piece), VICTORY_GATHER_SEGMENTS and VICTORY_GATHER_DISPATCHES (off), VICTORY_DIRTY_4K (off), VICTORY_MERGE_RUNS_ALT (unset), VICTORY_HEAP_RECHECK_EVERY (0), VICTORY_WAVE_WIDE_ONLY (empty); VICTORY_PAGE_WRITES default now guards+slots+plain reads' textures (1|2|8; "guards" is the old one); host callbacks check due textures first; textures without card room asked again (upstream VIctory #3198); a released view heap forgets its title-memory run (fxceless#589); shader fixes: mesh corners masked 9 bits, two immediate samplers behind a uniform branch, sampleLevel log2 and _cl clamp, split wave64 mask moves (fxceless#1112, fxceless#702). Conflicts, our structure kept: HostList hunks moved to host/host_list.rs; image hunks to emit/image_buffer.rs; copy_stale takes both COLD_SKIP marks and DIRTY_4K pieces; Journal keeps cold_skip::Written plus the 4K map; translate_listed wraps translate_counted; MERGE_RUNS_ALT before our card_steps split. Duplicates kept once (ours): fxceless#1324 (HEAP_IDENTITY), fxceless#1002 (SHADER_CASCADE_EXACT), and fxceless#646: upstream's DispatchX thread counts (USER_DISPATCH_THREADS, same code 0x106) dropped for our port of fxceless#1292 (USER_THREAD_LIMIT, which also covers the paired 64-lane form). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ure fixes), cascade shadows, render-target snapshots, and switches for rays, memory and input Twenty-two commits, tested as fe2ede8 (cargo check of the workspace with diagnostics clean; victory-gpu --lib 356 passed, 0 failed) and built by Codex as fe2ede8-diagnostics. On by default, each with a way back: - the original's fifth merge up to e4245f3 with 93db653: VICTORY_PAGE_WRITES now also sends back to pending the textures written by slots and by plain reads (1|2|8; =guards is the default of before), textures without room on the card are asked for again (VIctory #3198), a released view heap forgets its run of title memory (fxceless#589), shader fixes (fxceless#1112, fxceless#702, mesh corners, samplers behind a uniform branch, sampleLevel); - fxceless#1002: exact cascade shadows on cards of 32 lanes (VICTORY_SHADER_CASCADE_EXACT=0 goes back); - fxceless#1371: render targets replayed from a copy taken at SetRenderTargets (VICTORY_RT_SNAPSHOT=0 goes back). Off by default: VICTORY_RT_SKIN_SKIP, VICTORY_RT_RESOLVE_SKIP, VICTORY_ACTIVATE_RAYS_SKIP, VICTORY_HAIR_VB_SKIP (with a census of such programs), VICTORY_ALT_FLIP (fxceless#1341), VICTORY_RAM_TRIM, VICTORY_WINDOW_REUSE (fxceless#1362), VICTORY_COLD_SKIP (fxceless#1358), the worker chain of fxceless#1290, VICTORY_KEYS_FILE, VICTORY_NULL_SAMPLES, and the merge's CARD_HASH_WIDE=alt, GATHER_SEGMENTS, GATHER_DISPATCHES, DIRTY_4K, MERGE_RUNS_ALT, HEAP_RECHECK_EVERY and WAVE_WIDE_ONLY. The profiler test walks only modules that never unload. Left out: diagnostics/translate-water-5dc3-6f22-2026-11-26.txt, a translation diagnostic of the original's run that lists offsets and instructions of two of the title's shaders. Measured by Codex on fe2ede8, the ten switches of Status, screenshots every second, one pair of sessions of 480 s, the same binary: in the opening's cafeteria two faces were drawn with their features with the new default, and one of them came out without features and the background washed out with VICTORY_PAGE_WRITES=guards, at different moments and poses; in the reverse pair a face came out almost all black with the new default (the guards session was stopped by the memory guard at 391 s), so these fixes are not the whole answer to black faces. Not measured for frame rate yet. Neither session crashed; frames of a second or more between 150 and 450 s: 49 (longest 5.7 s) with guards, 52 (6.8 s) with the default. A first session with a cold shader cache was ended at 388 s by the title itself after a frame of 21.5 s spent waiting for the runtime's remapping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com>
Adapt the far early-out and deep scalar-copy parts of fxceless/victory-fork#1002. This tree already tracks parked scalar pairs by lifetime. Retain that implementation and bring across the synthetic regressions, including the hardware gate. Adapted from fxceless/victory-fork@eaeb8f1 Co-authored-by: Bruno Magalhães <19572425+brunofgmag@users.noreply.github.com>
|
Test report (Linux/Proton, RTX 4070 Ti): this PR fixes the stair-stepped shoulder/neck rim in the opening prison-cell scene. Setup: the PR's commit cherry-picked onto a local branch (fork main PR only, against the same base without it:
Supporting context, a different build: the PR combined with a separate local change of ours (a reserved texture budget for one material input, not part of this PR). Smooth rim in 6/6 launches vs 0/6 on the base without either change; wall head shadow 2/6 vs 0/6; timing within noise. This shows the shoulder result holds when stacked with other work, but it is not a clean test of the PR alone; the table above is. A pale-blue block at the collar remains in all arms and is unrelated to this PR. Measured and written with AI assistance (Claude Code with Claude Opus 5.5 and Claude Mythos 5.2; Codex with gpt-6.2-sol for the build and the blind scoring). |
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.