perf: VICTORY_MERGE_SUBMISSIONS sends consecutive title submissions as one host submission #337

Open
github-bot wants to merge 2 commits from github-bot/gh-337 into main AGit
Owner

@⁠Skyfrye on GitHub · 2026-11-26 06:27 UTC · original
Skyfrye:nep/merge-submissions → main · +1180 −13 · 5 files · 2 commits · draft

Draft: 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. A victory-merge thread 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. =2 also 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 main at c4c93bd, from third_party/victory:

cargo build --locked --release -p victory                                   -> Finished, no new warning
VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib -- --test-threads=1  -> 192 passed, 3 failed

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 does main (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:

Console Switch fps (median of the last minute) Host submissions per frame
Series X (4K) =1 15.4 (machine 82 % loaded), 17.5 28 title submissions in 10.2-10.9 (sent for fence signals 10.1-10.4 a frame)
Series X off 15.7, 17.8 28
Series X =2 17.1; the second run lost the device 28 in 4.6-5.0
Series S (--console series-s, 1280x720) =1 20.8, 21.6
Series S off 20.3, 20.9 28

With =1 the 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

  • The PR covers a single reviewable behaviour (consecutive title submissions sent as one host submission, behind a switch).
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (E_NOTIMPL), never a fake success. (Nothing unimplemented here.)
  • README: not touched.
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: submission counts; no title code.
  • Code taken from another project: none.

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

**@⁠Skyfrye** on GitHub · 2026-11-26 06:27 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/337) `Skyfrye:nep/merge-submissions` → `main` · +1180 −13 · 5 files · 2 commits · draft **Draft: 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. A `victory-merge` thread 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. `=2` also 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 `main` at `c4c93bd`, from `third_party/victory`: ``` cargo build --locked --release -p victory -> Finished, no new warning VICTORY_D3D12_WARP=1 cargo test --locked -p victory-gpu --lib -- --test-threads=1 -> 192 passed, 3 failed ``` 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 does `main` (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: | Console | Switch | fps (median of the last minute) | Host submissions per frame | |---|---|---|---| | Series X (4K) | `=1` | 15.4 (machine 82 % loaded), 17.5 | 28 title submissions in 10.2-10.9 (sent for fence signals 10.1-10.4 a frame) | | Series X | off | 15.7, 17.8 | 28 | | Series X | `=2` | 17.1; the second run lost the device | 28 in 4.6-5.0 | | Series S (`--console series-s`, 1280x720) | `=1` | 20.8, 21.6 | | | Series S | off | 20.3, 20.9 | 28 | With `=1` the 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 - [x] The PR covers a single reviewable behaviour (consecutive title submissions sent as one host submission, behind a switch). - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`E_NOTIMPL`), never a fake success. (Nothing unimplemented here.) - [x] README: not touched. - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: submission counts; no title code. - [x] Code taken from another project: none. 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](https://claude.com/claude-code)
The thread that submits for the title pays fixed work per host submission
(the placed-heap descriptor pass, the write-watch asking, the pass over
copies in the card's memory, the refresh threads' joins, list close and
reset, a send and a signal, a flight for the relay), about 59 times a frame.
With VICTORY_MERGE_SUBMISSIONS=1 a title submission sent ahead
(VICTORY_LATE_WAIT / VICTORY_RELAY) is held back and joins the next ones; they
go to the card as one host submission, in the title's order, with a barrier
(UAV and aliasing barriers on no resource) in front of each submission after
the first.

They are sent at: a fence signal on any queue (=2: the signal is carried
behind them, and the title asking about that fence or a queue waiting for it
sends them), a wait for a memory value that a held submission may write
(one met by a held bottom-of-pipe write lets the part behind it join), a
present, a synchronous submission of ours, a settle, page mappings on a
queue, a next submission that reads what held shaders or flights in the air
write, copies over what a held one brings to the card, or runs code of ours
on title memory, 256 lists or 32 submissions, and 500 us after the first
was held (a thread of its own). Counters per frame on the frame line:
title submissions, host submissions, sends by reason.

Off (the default) every path is as before. The decision logic is in
merge.rs with unit tests; two WARP tests cover the step summary and the
barrier prelude.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:36:39 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/337/head:github-bot/gh-337'
git switch 'github-bot/gh-337'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-337'
git switch 'github-bot/gh-337'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-337'
git switch 'github-bot/gh-337'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-337'
git switch 'main'
git merge --squash 'github-bot/gh-337'
git switch 'main'
git merge --ff-only 'github-bot/gh-337'
git switch 'main'
git merge 'github-bot/gh-337'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.