Keep refreshes in front across title writes that miss them (VICTORY_KEEP_AHEAD) #388
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/388"
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 TaynanGT/Vice-Tay. Originally posted by SmartIngenieriayDesarrollo on 2026-11-27T23:26:21Z.
Most refreshes in a frame copy nothing. I counted 85 to 89 % of 9,000–11,000 refreshes per frame coming back empty, about 38 ms of the submitting thread. Almost all of that waste starts with one small write.
When a submission copies a few bytes into title memory, either a buffer copy done at submission or a placed copy at its place in the lists,
Batch::title_writtenthrows away every copy thatrefresh_front/refresh_aheadhad already brought up to date. Every later list then adds, flushes and checks those copies again, even though the write touched none of them.With
VICTORY_KEEP_AHEAD=1(off by default), such a write drops only the copies whose refreshed range contains one of its bytes:inplace::shown_bytes) still drops everything, as today;Step::Runwork, which may write anywhere, is unchanged;Measured on a Ryzen 7 5700X3D with one DDR4-3200 module (single channel) and an RX 7800 XT, Series S, Vice-Tay
791648bplus a frame CSV patch: a 120 s cutscene, runs A B B A, 10.94 → 11.98 fps (+9.5 %).I kept it on through the rest of my tuning, but I haven't repeated an alternating A/B on current
main(0148258).On a PC like mine every flush is memory bandwidth taken from the frame. On a high-end PC it is still submitting-thread time handed back.
Two tests cover it:
a_title_write_drops_only_the_ranges_ahead_it_touches(the batch bookkeeping) anda_title_write_refreshes_again_only_the_copies_it_touches. The second runs a real copy over the end of one range and checks that every host copy still matches title memory, with the switch on and off. Checks:cargo clippy -p victory-gpu --all-targets --locked -- -D warningsis clean andcargo test -p victory-gpu --lib --lockedgives 529 passed, 0 failed, the two new tests included (Windows 11, MSVC, the repo toolchain).cargo fmt --checkonly flags files this PR does not touch.— El_Santo
AI-assisted; measured and tested on my machine.
Imported from TaynanGT/Vice-Tay. Originally posted by chatgpt-codex-connector[bot] on 2026-11-27T23:26:33Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
0334d59ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from TaynanGT/Vice-Tay. Originally posted by akimfomin on 2026-11-28T00:04:00Z.
I ran PortBridge’s tree check between #388
0334d59and #379ecc003e. The pair combines without a Git conflict. There is one useful combined control: exercise #379’s mapped alias with KEEP_AHEAD both off and on. Pre-refresh a buffer through view B, write through view A, then verify the refreshed bytes through B and both texture heaps’ notices. #388 already falls back to a full refresh for any mapped portion of the write; the combined check would preserve that guard if the PRs land together. The tree check and source review are from PortBridge, with no new GPU run.Imported from TaynanGT/Vice-Tay. Originally posted by Garu667 on 2026-11-28T02:27:55Z.
Tested on NVIDIA: RTX 3080 10 GB, i5-13600K, 32 GB. Series S, automatic NVIDIA profile. One build,
fe7c6e5+0334d59, switching onlyVICTORY_KEEP_AHEAD. Same boat save each run: prologue recap, then the fishing cutscene. About 4 min of play, one interval per 5 s. Runs in order A B A B.Both "on" runs are above both "off" runs on mean FPS and preparation time. Against the closer off run (225), that is about +6 % mean FPS and -6 % preparation. The log shows the switch doing its job: 1,700–5,100 copies kept and 13–14 dropped per frame.
I saw no picture difference between the two settings in the captures. Caveat: these runs had no
VICTORY_BCPACK_TABLES, so BCPack textures were noise in all four. The workload is the same on both sides, but textures were not checked.🤖 Generated with Claude Code
Imported from TaynanGT/Vice-Tay. Originally posted by Kal0s-design on 2026-11-28T18:53:28Z.
Read through
0334d59for a refresh that could be skipped when it shouldn't be, since the speed side is covered above.title_wrote_keepingdoes whattitle_writtendoes (flush with the write,textures.clear()), and only replacesahead.clear()with a byte overlap filter. The flush still runs before the filter, so a pending refresh of a copy the write overlaps reads the bytes from before the write, then that copy leavesaheadand the next list refreshes it again. That's the same order as without the switch.Batch::addonly skips when the requested range is inside the kept(from, to). A list that later asks for more of a kept copy than was refreshed in front still refreshes it, so keeping a copy whosetoends before the write can't hide a write pastto.shown_bytesfallback. Two shadows over the same addresses are compared by address, so both drop.Step::Runand the non-free placed copies don't change.Natively on Windows (NVIDIA card) the 159
host::tests pass withVICTORY_KEEP_AHEAD=0and with=1. The two new tests passed 100 of 100 repeated runs, and the branch merges cleanly on currentmain(fe7c6e5). It's based on0148258, so a rebase wouldn't hurt before merging.I found nothing to change.
AI-assisted: yes
Imported from TaynanGT/Vice-Tay. Originally posted by SmartIngenieriayDesarrollo on 2026-11-28T20:59:56Z.
Thanks for the independent checks, this is exactly what I hoped for.
Batch::addrefreshes a kept copy when a later list asks past itsto.It merges cleanly on
fe7c6e5. I can rebase it if you'd like a fresh base.— El_Santo
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T11:37:33Z.
Thanks for incorporating the independent checks. Please keep the combined #379 control separate from the isolated KEEP_AHEAD comparison, particularly the pre-refresh and alias-write ordering. The measured gains are encouraging but not a reason to broaden the default before correctness is checked.
Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:10:23Z.
mainhas moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the currentmainand open a new PR; I'll review it there.Pull request closed