The title's bytes go in under shader writes in one pass (VICTORY_UNDER_FUSED, from SlaktarnVI) #3582
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3582"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by banaanpapa on 2026-11-30T01:23:07Z.
A port of an idea from Slaktarn700/SlaktarnVI (GPL-3.0-or-later, as this tree). No game was run here: the figure is a synthetic measurement on one PC (Ryzen 9 9950X3D).
What it is
Shadow::merge_under_writesputs the title's bytes into the CPU's side of a copy while flights may be writing it. For each stale page it found the changed runs (word_runs) and then copied each run on its own, a few bytes at a time. SlaktarnVI's session play-1125-1724 had 190,000 such runs in 400 pages in one frame.The refresh already has a pass that compares and puts in at once (
word_runs_and_update, from03d5f570). This path could not use it: it must stop when the copies of their own run out (runs_left, 512 or 4,096 a submission), and a pass that puts in as it goes cannot stop. SlaktarnVI's answer, taken over here: take the most copies a page can have before the pass, and give back what was not used.goes_as_words), and an unchanged word lies between two runs, so a page ofnbytes hasn / 260 + 1at most. (That is SlaktarnVI's count; one fewer would do, 15 for a page of 4 KiB.)VICTORY_UNDER_WORDS=0,VICTORY_SEND_OWN=0) or withVICTORY_UPCOPY_CHECK=1.word_runs_put) is not taken over:word_runs_and_updatehere is the same pass.On unless
VICTORY_UNDER_FUSED=0(SlaktarnVI's default, and the switch is of thetoggled!kind, so an A/B run can flip it): the bytes held, the runs told to go up and the copies taken are the same either way, and the tests below hold it to that.Measured
shadow::merge_tests::how_long_a_frame_of_small_runs_takes_in_two_passes_and_in_one(ignored; run by name): 400 pages with 190,000 runs of a word each, the median of 31 frames, three runs.About 0.18 ms of the submitting thread at that load: small, and free.
What was run
a_page_merged_in_one_pass_is_the_page_merged_in_two: 400 random pages with short and long runs; the same runs, the same bytes held, the same number taken from what is left; refused and untouched with one copy fewer left than the page can have; the page with the most copies it can have; pages that are not whole words. It fails when what was not used is not given back, and when a refused page keeps what it took.title_bytes_go_in_under_writes_the_same_in_one_pass_and_in_two(needs a host GPU): two copies with a card's side over view memory with the same bytes, one merged with 4,096 copies left (one pass, counted) and one with 15 (two passes): the CPU's side is title memory, exactly the words that changed are told to go up, and two copies are taken in both. It fails when the one pass puts nothing in. 20 runs of it alone and three of theshadowtests pass.usize::MAXfor what is left, which is -1 as the signed count the pages share, so they merge in two passes as before.cargo test -p victory-gpu --release --lib, twice with it on and twice withVICTORY_UNDER_FUSED=0: the same set fails either way, and onmain(shader_cache's key test;card_steps::shared_scratch_eliminates_flight_settle_end_to_endanduav_pool's lifecycle test now and then).Limits
MERGEDcounters' to say; the gain scales with it.f72cec77; it was built and tested merged with41adb551, and the merge is clean.The check
The
checkjob fails here as it does onmain: Clippy stops atcrates/victory-loader/src/crash.rs:804(unwind_copyis never used), a file this branch does not touch. Nothing in the job's log names a line of this change.Measured in play (2026-11-30)
One session in the title's world on an RTX 5080 with a Ryzen 9 9950X3D (driver 621.40, Series X profile, 1440p, DLSS Quality, about 4,800 draws a frame), built on
e1251c31.VICTORY_AB=10,VICTORY_SUBMIT_SPLIT,VICTORY_TELL_ONCE,VICTORY_UNDER_FUSEDflipped the three switches every 10 s through all eight combinations. Each switch's effect is the mean of its four "on" phases minus its four "off" phases, within each full 80-second cycle, over 5 cycles:VICTORY_SUBMIT_SPLIT(upstream's, off by default)VICTORY_TELL_ONCE(#3268)VICTORY_UNDER_FUSED(#3582)The card was 99 to 100 % busy throughout, so in this scene the frame waits on the card, not on the submitting thread. Where the frame is bound by that thread, these gains should show more; this session can't say how much more. Five cycles of one scene is a small sample.
🤖 Generated with Claude Code
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.