perf: VICTORY_MERGE_SUBMISSIONS sends consecutive title submissions as one host submission #337
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!337
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-337"
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 06:27 UTC · original
Skyfrye:nep/merge-submissions→main· +1180 −13 · 5 files · 2 commits · merged 2026-11-26 14:21 UTCDraft: a small gain for a large change; for the maintainer to weigh.
Change
VICTORY_MERGE_SUBMISSIONS=1(off by default: unset runs today's code paths): consecutive title submissions in the late/relay path are held and sent to the card as one host submission, so the submitting thread's fixed work per submission (descriptor::sync_heaps,watch::ask_once,shadow::card_dirty,card_before, list close/reset, ExecuteCommandLists + Signal, the relay's bookkeeping) is paid once per group. Each later submission of a group starts with a full barrier, as the boundary between two submissions did. Avictory-mergethread sends a group 500 µs after its first submission.A group is sent at: a fence signal on any queue; a wait for a memory value that held work may write (a held bottom-of-pipe write that meets the wait lets the part behind it join instead); a present, a synchronous submission of ours, a settle, page mappings on a queue; a submission that reads what held or flying shaders write, copies over memory a held one reads, or runs our own code on title memory; 256 lists or 32 submissions held; the 500 µs timer.
=2also carries fence signals behind the group (sent when the fence is queried or waited on): not recommended, see below.A new frame line, "title submissions merged per frame", counts title submissions, host submissions and sends by reason.
Why: in a 30 s Nsight Systems profile of the world (main at
3e258c8), the frame was bound by the title's submitting thread (about 59 submissions a frame), most of its time in that fixed per-submission work.Known risk: a held submission is prepared when it is sent, not when the title gave it, so it can see title memory up to 500 µs newer.
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. 9 new tests: 7 for the decision of what may be held and what sends a group (they do not build without the change), 2 on the software adapter for the host side. Run with several threads, the test binary ends with an access violation about one run in 4 to 8, and so doesmain(1 of 8).In the world, my copy of the game, the same build both ways (this change plus #308,
VICTORY_INDIRECT_RAW=3), runs of 300 s alternating:=1=2--console series-s, 1280x720)=1With
=1the submitting thread's preparing fell from 48-52 to 40-46 ms a frame at 4K, where the card (about 70 % busy) limits the frame too; with the card at about a third busy (Series S) the frame rate went up by about 3 %. No exception and no device lost with=1(6 runs).Oracle and test data
No game file. The counts come from my own runs of my copy of the game.
Checklist
E_NOTIMPL), never a fake success. (Nothing unimplemented here.)AI assistance: written with Claude Code. Claude Opus 5.5 (a subagent) designed and wrote the change and its tests; Claude Opus 5.5 (coordinating) ran the game A/B and wrote this description.
🤖 Generated with Claude Code
@KainanP on GitHub · 2026-11-26 10:32 UTC · original
Test report for #337 on three adapters.
Merges cleanly onto current main. Setup: current
origin/main(c4c93bd) merged with this PR, Windows 11,cargo test --lockedinthird_party/victory. Adapters: RTX 4060 Laptop (DXGI 0), Intel UHD 8086:a78b (16-lane waves, no FP64), WARP. The hardware adapter is picked by name through a local, uncommitted test hook and confirmed in its log; WARP for victory-gpu is--features diagnostics+VICTORY_D3D12_WARP=1. victory-gpu runs with--test-threads=1.victory-gpu --lib"main's 3" =
descriptor::host::tests::spans_say_the_next_start_and_the_lowest_level_viewed,indirect::tests::warp_card_fetch_copies_flagged_pieces_to_their_slots,indirect::tests::warp_card_patch_writes_the_masked_bytes_and_no_others. They fail on all three adapters on main too. The 9 new tests pass everywhere. No new failure.Extra runs on the RTX (same binary):
VICTORY_MERGE_SUBMISSIONS=1gives 192 passed, main's 3 failed, and=2gives the same. Few unit tests go through the late/relay path, so this only shows the switch doesn't break the rest. Run with the default thread count (4 runs), one run ended without a result line (a crash), which matches the access violation you see on main too.Notes from reading
merge.rs:Plan::refusescompares the next submission'sreadwith heldshaderwrites and itswrittenwith heldbrought. It does not compare the next submission'sbrought(refreshes and textures) with heldshaderwrites. A refresh of title bytes that a held submission's shaders write would, prepared in the group, read the CPU side before those writes landed. On its own it would be behind a flight anyway, so this may already be covered by the relay's under-writes merge. If so, a comment inrefuseswould say why the pair isn't checked.late_threads/settle ordering unchanged when the timer thread and the submitting thread race to send the same group? I did not find a test with both.AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.