GPU feed: our send-up list goes first in its submission's own ExecuteCommandLists call (VICTORY_FEED_ONE_CALL=1, off by default) #1137

Open
github-bot wants to merge 1 commit from github-bot/gh-1137 into main AGit
Owner

@⁠exotiquee on GitHub · 2026-11-25 21:23 UTC · original
exotiquee:pr/feed-one-call → main · +253 −16 · 1 files · 1 commits · open

Branch: pr/feed-one-call (1 commit on main 085ee7c)

What it does

Today Host::card_before closes the send-up and hash list (the changed bytes of host copies in the card's memory, sent up and hashed again) and sends it in an ExecuteCommandLists call of its own, ahead of the submission's call.

With the switch it closes the list but does not send it. The list comes back as a SendUp, and submit puts it at the front of the submission's own lists. In timing runs (VICTORY_GPU_TIMING) it goes in the first group, and firsts shifts by one.

The card runs the same commands in the same order:

  • Nothing else reaches the direct queue between the old place and the new one. The copy queue's hold stays ahead of both, and settles and card_results_low come before card_before.
  • With the relay, the queue's order (QUEUE_ORDER) stays held until the call, so a fetch numbered after the send still runs behind it.
  • The send's number for fetches on the copy queue (Second::sent_up) is signalled behind the call: later than before, never earlier.

Off, nothing changes. numbered is factored out of card_before so that both paths signal the same way.

What it saves: one ExecuteCommandLists call and one boundary between calls per submission, 15-17 a frame in the title.

Not in this PR: the feed meter (VICTORY_FEED_METER, our stage F0) that this change was developed and counted with.

  • Its port to main conflicts in 38 places: it decodes barrier origins for our hoisted clamps, runs and gathers.
  • With the meter on by default in one build, the visible window showed only white while the log showed frames rendering. Turning the meter off brought the picture back.
  • We then made the meter an opt-in bitmask (1 counts, +2 timestamps, +4 barrier-group decode), off by default. We never found the cause of the white window, and it did not reproduce offline.

So the meter stays out until it is ported and that is understood.

Switch

VICTORY_FEED_ONE_CALL=1. Off by default.

Tests

  • warp_three_copies_go_up_in_one_list_and_their_writes_come_back, new here:
    • three host copies in the card's memory, title bytes sent up and shader writes declared in every round;
    • run with the switch off and then on, through a per-thread override;
    • checks that the shaders read the title bytes sent up in the same submission, the writes come back, the bytes are the same both ways, and with the switch every round's send-up list went in the submission's call.
    • It runs on the software adapter only (VICTORY_D3D12_WARP=1, diagnostics), where the debug layer checks the barriers. Result there: passed. The queue2 tests on WARP with the switch set in the environment also passed: 10 passed, one skipped for its relay/queue settings.
  • cargo +1.98.1 test --locked -j 4 -p victory-gpu: 184 passed. With --features diagnostics: 201 passed.
  • No new compiler or clippy warnings against main.

What we measured (RTX 5080, Ryzen 7 9800X3D)

  • Bench: a boundary between ExecuteCommandLists calls cost ~15 µs, against 0.09 µs for a boundary between lists inside one call.
  • In the title there is no isolated measurement. These runs were not scene-matched, and later we found that ±2 fps between runs can come from where the player stands:
    • Hidden runs: without this switch and without the clamp switch tested with it, ~11 fps (5.5-14.8, with dips, card 62%). With this switch and the heap and descriptor-slot switches on (but not the clamp switch), ~13.7 fps; this switch was not isolated.
    • A visible run with this switch, the clamp switch (VICTORY_CLAMP_AT_WRITE) and several heap/descriptor switches came out about +2 fps over the same build with all of them off: 13.3-15.3 fps (~14.3) against ~12.2.
  • Crash bisect. A crash showed up in hidden runs with this switch and the clamp switch both on. With this switch alone there was no crash. The crash was the clamp switch: a ~20 s stall in a loading frame.

Risks

  • The send's number for copy-queue fetches is signalled later than before (behind the submission's call). That only makes a fetch count fewer sends as done, never more.
  • If submit returned between card_before and its ExecuteCommandLists with the switch on, the send-up list would be dropped unsent. Today every path from card_before reaches a call: the late path and the group loop both take the SendUp.

🤖 Generated with Claude Code

**@⁠exotiquee** on GitHub · 2026-11-25 21:23 UTC · [original](https://github.com/fxceless/victory-fork/pull/1137) `exotiquee:pr/feed-one-call` → `main` · +253 −16 · 1 files · 1 commits · open Branch: `pr/feed-one-call` (1 commit on `main` 085ee7c) ## What it does Today `Host::card_before` closes the send-up and hash list (the changed bytes of host copies in the card's memory, sent up and hashed again) and sends it in an `ExecuteCommandLists` call of its own, ahead of the submission's call. With the switch it closes the list but does not send it. The list comes back as a `SendUp`, and `submit` puts it at the front of the submission's own lists. In timing runs (`VICTORY_GPU_TIMING`) it goes in the first group, and `firsts` shifts by one. The card runs the same commands in the same order: - Nothing else reaches the direct queue between the old place and the new one. The copy queue's hold stays ahead of both, and settles and `card_results_low` come before `card_before`. - With the relay, the queue's order (`QUEUE_ORDER`) stays held until the call, so a fetch numbered after the send still runs behind it. - The send's number for fetches on the copy queue (`Second::sent_up`) is signalled behind the call: later than before, never earlier. Off, nothing changes. `numbered` is factored out of `card_before` so that both paths signal the same way. What it saves: one `ExecuteCommandLists` call and one boundary between calls per submission, 15-17 a frame in the title. **Not in this PR:** the feed meter (`VICTORY_FEED_METER`, our stage F0) that this change was developed and counted with. - Its port to `main` conflicts in 38 places: it decodes barrier origins for our hoisted clamps, runs and gathers. - With the meter on by default in one build, the visible window showed only white while the log showed frames rendering. Turning the meter off brought the picture back. - We then made the meter an opt-in bitmask (1 counts, +2 timestamps, +4 barrier-group decode), off by default. We never found the cause of the white window, and it did not reproduce offline. So the meter stays out until it is ported and that is understood. ## Switch `VICTORY_FEED_ONE_CALL=1`. **Off by default.** ## Tests - `warp_three_copies_go_up_in_one_list_and_their_writes_come_back`, new here: - three host copies in the card's memory, title bytes sent up and shader writes declared in every round; - run with the switch off and then on, through a per-thread override; - checks that the shaders read the title bytes sent up in the same submission, the writes come back, the bytes are the same both ways, and with the switch every round's send-up list went in the submission's call. - It runs on the software adapter only (`VICTORY_D3D12_WARP=1`, diagnostics), where the debug layer checks the barriers. Result there: passed. The queue2 tests on WARP with the switch set in the environment also passed: 10 passed, one skipped for its relay/queue settings. - `cargo +1.98.1 test --locked -j 4 -p victory-gpu`: 184 passed. With `--features diagnostics`: 201 passed. - No new compiler or clippy warnings against `main`. ## What we measured (RTX 5080, Ryzen 7 9800X3D) - **Bench:** a boundary between `ExecuteCommandLists` calls cost ~15 µs, against 0.09 µs for a boundary between lists inside one call. - **In the title** there is no isolated measurement. These runs were not scene-matched, and later we found that ±2 fps between runs can come from where the player stands: - Hidden runs: without this switch and without the clamp switch tested with it, ~11 fps (5.5-14.8, with dips, card 62%). With this switch and the heap and descriptor-slot switches on (but not the clamp switch), ~13.7 fps; this switch was not isolated. - A visible run with this switch, the clamp switch (`VICTORY_CLAMP_AT_WRITE`) and several heap/descriptor switches came out about +2 fps over the same build with all of them off: 13.3-15.3 fps (~14.3) against ~12.2. - **Crash bisect.** A crash showed up in hidden runs with this switch and the clamp switch both on. With this switch alone there was no crash. The crash was the clamp switch: a ~20 s stall in a loading frame. ## Risks - The send's number for copy-queue fetches is signalled later than before (behind the submission's call). That only makes a fetch count fewer sends as done, never more. - If `submit` returned between `card_before` and its `ExecuteCommandLists` with the switch on, the send-up list would be dropped unsent. Today every path from `card_before` reaches a call: the late path and the group loop both take the `SendUp`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Host::card_before closes the send-up and hash list as before but, with the switch, does not
send it: it comes back as a SendUp that submit puts at the front of the submission's lists
(in timing runs in the first group; `firsts` shifts by one). The card runs the same commands
in the same order; nothing else reaches the direct queue between the old and the new place
(the copy queue's hold stays ahead; settles and card_results_low come before card_before).
With the relay the queue's order (QUEUE_ORDER) stays held until the call, so a fetch
numbered after the send still runs behind it; the send's number for fetches on the copy
queue (Second::sent_up) is signalled behind the call (later, never earlier). Off: unchanged.

What it saves: one ExecuteCommandLists call and one boundary between calls per submission
(15-17 a frame in the title).

Test: warp_three_copies_go_up_in_one_list_and_their_writes_come_back (new here): three
copies in the card's memory with title bytes sent up and shader writes declared in every
round, run with the switch off and on (a per-thread override): the shaders read the title
bytes sent up in the same submission, the writes come back, the same bytes both ways, and
with the switch every round's send-up list went in the submission's call. Software adapter
only (VICTORY_D3D12_WARP=1, diagnostics), where the debug layer checks the barriers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:58:13 +00:00
Author
Owner

@⁠BitWuehler on GitHub · 2026-11-25 23:03 UTC · original · edited 2026-11-25 23:24 UTC

Tested on Linux (GE-Proton + vkd3d-proton, RTX 5080) together with #1078, #1086, #1136, #1138, #1146, and #154:

  • heap buffers: dropped from 200.4 ms median (848 ms max) down to 17–35 ms
  • remapping: ... waiting for readers: 0.0 ms
  • copying back: median improved from 161.6 ms to 130.6 ms (CARD_FETCH_INFLIGHT=1 fetch wait 3.7 ms -> 0.6–1.4 ms)
  • With VICTORY_PIPELINE_WAIT_MS=50, world intervals reached med=252.1 ms (4.0 fps) and max=8.6 fps (116.8 ms/frame) (usual frame: 87–92 ms).

Note: Log analysis and write-up were AI-assisted based on local runtime measurements.

**@⁠BitWuehler** on GitHub · 2026-11-25 23:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/1137#issuecomment-7177088526) · edited 2026-11-25 23:24 UTC Tested on Linux (GE-Proton + vkd3d-proton, RTX 5080) together with #1078, #1086, #1136, #1138, #1146, and #154: - `heap buffers`: dropped from `200.4 ms` median (`848 ms` max) down to `17–35 ms` - `remapping: ... waiting for readers`: `0.0 ms` - `copying back`: median improved from `161.6 ms` to `130.6 ms` (`CARD_FETCH_INFLIGHT=1` fetch wait `3.7 ms -> 0.6–1.4 ms`) - With `VICTORY_PIPELINE_WAIT_MS=50`, world intervals reached `med=252.1 ms (4.0 fps)` and `max=8.6 fps (116.8 ms/frame)` (`usual frame: 87–92 ms`). *Note: Log analysis and write-up were AI-assisted based on local runtime measurements.*
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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