Shaders: the console's waterfall over a first-lane table offset is proven by its shape where the per-lane form can't follow it (a decal pass: 149 group barriers to 41; frames 2.5 to 4 ms shorter where the card is the limit) #458
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!458
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-458"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@KyleS98 on GitHub · 2026-11-27 22:48 UTC · original
KyleS98:waterfall-shape→main· +346 −1 · 1 files · 1 commits · draftWhat
The console compiler loops over a per-lane descriptor like this (wave64 shown):
resource::trackturns such a loop into one per-lane load (non-uniform handle) whenTracer::waterfallproves it, but on the title's programs it mostly can't. Unproven, the loop stays a loop. On a host with 32-lane waves, a console wave of 64 runs as two host waves, and every pass of the loop exchanges the first lane's value and the masks between the halves: four group barriers a pass.This adds
Tracer::waterfall_shape, tried only wherewaterfallrefused a table-offset loop. It proves the loop by its exact shape:s_cbranch_execnz), containing nothing but:v_cmpx_eq_u32/_i32of each read with that same lane value, without modifiers;s_waitcntands_nop;buffer_load_*,image_load*,image_sample*,image_gather*), under the compares' EXEC;s_andn2_wrexecof a mask T with itself.s_movof the very EXEC value the loop is entered with; on the back edge, both are what the ones_andn2_wrexecwrote.Anything else in the loop, a store or atomic, another compare, or T not coming from EXEC means no proof, and the loop stays as it is now.
How much it finds
victory translateover the title's 25,760 programs that are emitted, with a temporary print of each refusal (not in this PR):waterfall: compares not shown to select the access's lanesThe same programs are emitted as without it (14,259 / 2,736 / 8,765), and
translate --validategives the same results as without it for all of them (the 27 + 92 that fail validation fail the same way onmain).Measured
RTX 3090 Ti (driver 616.92), Ryzen 9 9950X3D, Windows 11,
victory play, standing in the prologue's cell (4,300 to 4,700 draws a frame), medians of the 5-second frame lines over the last two thirds of a 9-minute run, one build without and one with this commit each time. The first row ismainand this PR alone; the other two are my branch, which also has #67, #68 and #69 andmainmerged:main0cef07ealone,--series-s --dlss off --no-framegen-ready--series-s --dlss quality --framegen 2 --fg-type fsr(#68 steps aside here)FG: 52.8FG: 62.2It helps only where the card is the limit. On
mainalone without DLSS, the Series S profile runs the title's FSR 4 path through the translator, and the thread preparing submissions takes 27 to 28 ms a frame, so the card's savings don't show (28.5 → 28.7). With the title's own upscaler (#68), or with DLSS and frame generation, the card is the limit and the frame gets 2.5 to 4 ms shorter.A
VICTORY_GPU_TIMING=1run had one program at 4.1 ms of the card's ~27 ms a frame:vfx_proj_decal_vbuffer:CS_ProjDecalReduceClassification_Scalarized. It has 27 of these loops. Its DXIL goes from 149 group barriers, 32WaveReadLaneFirstand 34WaveActiveBallotto 41, 5 and 7.The picture in the cell and the opening cutscene looks the same in screenshots: hair, the print on the shirt, the walls, the window, the poster.
Tests
resource.rs:waterfallas it is);waterfall_shapeaccepting the console's loop in wave32 and wave64;cargo test -p victory-shader: 294 passed.cargo test --workspace: everything passes except the twoindirect::teststhat fail onmaintoo (#67 fixes them).cargo clippy -p victory-shader --all-targetswith and without--all-features: no messages.rustfmt --checkonresource.rs: the same 9 differences as onmain, none in the new code.Not done
waterfall's per-lane form fails on these loops. In a synthetic wave64 copy of the existing test it succeeds; in the title's programs these loops sit inside per-lane branches, and the solver cannot relate T and EXEC around the loop there. The shape check sidesteps that rather than fixing it.resource.rshas moved on since this tree took it; I have not checked whether its current proof accepts these loops. Marvisak/VIctory#1253 is related (table loads before the loop), but a different case.AI-assisted (Claude Code, Claude Opus 5.5); runs on my machine; no game data in the change or the tests.
@KyleS98 on GitHub · 2026-11-27 23:00 UTC · original
Don't merge this yet: it changes the picture. I found it after opening the PR, and I'm putting it in draft.
With this commit, the wall to the left of the character in the prologue's cell shows a dark patch with stair-stepped, tile-aligned edges. It comes in some runs and not in others. Measured as the mean brightness of that wall area over the last 12 screenshots of each 9-minute run (the same values in all 12, so it holds for the whole run):
main, and my branch with #67, #68 and #69, with and without DLSS / FSR 3)main+ this PR aloneThe edges look like the work of an 8x8-tile classification. That fits the shader this mostly speeds up (
CS_ProjDecalReduceClassification_Scalarized), but I haven't shown that it's that one. Two explanations I can see, not yet told apart:I'll come back with which one it is, or close this. The measurements in the description stand for the frame rate, not for the picture.
AI-assisted (Claude Code, Claude Opus 5.5).
@KyleS98 on GitHub · 2026-11-27 23:35 UTC · original
Correction to my comment above: the dark patch also appears without this PR. A later run of my branch without this commit (
--series-s --dlss quality, DLSS frame generation at 6x) shows the same tile-edged patch on the same wall, wall brightness about 40 against about 64, for the whole run.So it is a fault that already exists and shows up in some runs, not one this PR creates. Counted over every run where that wall is visible:
That may mean this PR makes it more likely (faster passes, a different order somewhere), or it may be chance: with this few runs I can't tell (p ≈ 0.08). I'm keeping this in draft until I have enough runs to say which, and until I know more about the patch itself. As it stands, "this PR breaks the picture" was too strong, and I'm saying so here.
AI-assisted (Claude Code, Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.