perf: transient windows leave out pages that hold what they last sent (VICTORY_WINDOW_SKIP_SAME) #340
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!340
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-340"
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?
@Skyfrye on GitHub · 2026-11-26 08:25 UTC · original
Skyfrye:nep/window-skip-same-pr→main· +582 −7 · 4 files · 1 commits · openChange
VICTORY_WINDOW_SKIP_SAME, a new switch whose default (unset) sends what was sent before. WithVICTORY_CARD_WINDOW_UPLOAD=1(in the launcher's set) a window outside buffers keeps no CPU side, only its card buffer ("transient"). Every page the write watch or the guards call written is copied into pooled upload memory and sent up whole, without comparing it to anything. In the world that is about 70 MB a frame. A page that was written can still hold the same bytes as before: the title rewrites constant data.Each transient window now keeps a 64-bit print per 4 KiB page of the bytes it last sent for that page (
Card::prints, 8 bytes a page, made at the window's first copy: 8 KiB for a 4 MiB window). The print ispage_print, an XXH3-style accumulate over eight lanes with keys that depend on position. It adds no crate (xxh3 is not in the tree, and blake3 is far too slow at 4 KiB) and runs at about 40 GB/s on one core.VICTORY_WINDOW_SKIP_SAME10A new line comes with the frame-rate line, only while
VICTORY_CARD_WINDOW_UPLOAD=1:title memory transient windows took per frame: N MB sent up, L MB left out; of what they took, S MB held the bytes the window last sent for their 4 KiB page, O MB other bytes, U MB nothing to compare with (VICTORY_WINDOW_SKIP_SAME=...). U covers pages never sent before, pages taken only in part, and windows that shaders are said to write. The ram line'swindow upload:part also gives the prints' memory.Why the card side still holds a page that was left out:
Host::card_beforecopies them in the order they were copied. The dirty and masked-patch path, the merges and the copy-backs already skip transient windows.Shadow::transient_written). Such a window compares nothing from then on and sends everything it takes.Remaining risk: two different pages with the same 64-bit print (about 2^-64 per compare) would leave the older bytes on the card until the title writes the page again.
The default does not change. Unset only samples and sends everything as before, and the launcher's set is not touched.
1is for whoever wants to try it.Linked issue: none.
Verification
Windows 11 26300, Rust 1.98.1 (MSVC), on upstream
mainatc4c93bd, fromthird_party/victory:The 3 failures are those of
main:spans_say_the_next_start_and_the_lowest_level_viewed,warp_card_fetch_copies_flagged_pieces_to_their_slots,warp_card_patch_writes_the_masked_bytes_and_no_others. 4 new tests, CPU only (shadow::window_same_tests). None of them builds without this change:a_print_changes_with_any_change_of_the_page: every single-bit flip, word swap, stripe swap and block swap of a page changes its print.a_page_is_the_same_only_after_the_same_bytes_were_taken_whole: same, other, nothing to compare with, and a page taken in part keeps no print.the_card_side_holds_the_titles_bytes_with_the_same_pages_left_out: a model of a window against a fake card side. It runs fixed cases and then 300 random rounds of writes, set-backs and partial ranges, and after each refresh checks that the card side equals title memory over the refreshed range and that only the pages that changed were sent. With the same pages sent again (a temporary mutant inwindow_copy) it fails: 1,048,576 bytes sent where 0 were expected.one_page_in_sixteen_is_compared_and_counted_sixteen_times: the sample without the switch.In the world of GTA VI (my own copy), running as a Series S (
--console series-s, 1280x720), launcher set with #308 andVICTORY_INDIRECT_RAW=3, the same exe both ways, runs of 300 s alternating:VICTORY_WINDOW_SKIP_SAME1Of the bytes the transient windows took per frame, 67-73 MB held what the window last sent for their 4 KiB page, 0.9 MB differed, and 3.6-4.1 MB had nothing to compare with. With
1, those ~70 MB a frame were left out. No exception and no device lost in the 4 runs. With a single trustworthy run without the switch, the frame-rate gain is small (20.1 fps against 20.7 and 21.2). The firm part is the bytes left out.The exe of these runs was built from the branch this PR comes from. That branch has the same skip code on top of a wider counter line and another switch that is off by default (
VICTORY_REFRESH_4K, not set in these runs). This PR carries only the skip and the windows' part of that line.Oracle and test data
No game file. The counts and frame rates come from my own runs of my copy of the game. The tests use generated bytes.
Checklist
E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: written with Claude Code. Claude Opus 5.5 subagents designed and wrote the change and its tests, ported it onto
mainfor this PR and wrote this description. Claude Opus 5.5 (coordinating) ran the game A/B.🤖 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.