(Opt-in, +1 fps in light scenes) Prepare the next submission while the last one is sent (VICTORY_SUBMIT_SPLIT, VICTORY_OFF_LINE) #1418

Merged
yeedgrthfgv merged 9 commits from upstream-pr/1418 into main 2026-11-29 08:16:56 +00:00
yeedgrthfgv commented 2026-11-28 19:30:19 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by yeedgrthfgv on 2026-11-28T19:30:19Z.


Reopened from #1066, which was closed because it no longer applied to main. The same 7 commits (the two switches plus the review fixes from wildheathen) are now rebased on the current main 32ecacf. Two conflicts were resolved:

  • card_take / card_record: main's upload_slot (#60, fenced copy-queue uploads) now sits in card_record beside used and looks, where the sends to card copies are recorded. upq takes its own lock and puts its wait on the queue just before the lists that use it, so it keeps its order on the sender thread too.
  • Split / the frame line: main's ASKED_FIRST counter and line (#127) are kept beside the sender's own SEND_SPLIT line.

Checked on the rebased branch: release build, --features diagnostics check, victory-gpu lib tests (477 passed). Both switches stay off by default; with them unset nothing is published and the old path runs.

Test results from #1066 (all with both switches on): about +1 fps in light or static scenes (cxy0072019-sketch, 14600KF), no change at the frame on a 9800X3D indoors (tippythetaidum, wildheathen), and slower in heavy moving scenes on an 8 core 5700X (POMXARK). So it stays opt-in.


On CPU-bound PCs one thread sets the frame: the submitting thread (victory-submit, queue::behind lane, Host::send_late). On a Ryzen 5 9600X + RTX 5080 it is busy for nearly all of a 41 ms frame (a sampling profile puts 90 % of its time in send_late), and making other threads faster (#834, #801, VICTORY_WIDE_THREADS, VICTORY_ASK_EARLY, measured here) did not change the frame rate. Issues #699, #833, #855 and #985 show the same on other PCs.

This PR ports two switches from Biskwit/VIctory-reloaded that take work off that thread. Both are off by default. With them unset every submission takes the old path: nothing is published, the new sender thread is never started, wait_sent returns on an atomic before it takes any lock, and the card steps' slots are written by the same code as before.

VICTORY_SUBMIT_SPLIT=1 (from Biskwit/VIctory-reloaded d5bd9d8)

Two threads in a row. The lane's thread prepares a submission as before, takes what goes up to the copies in the card's memory (card_take, numbered under QUEUE_ORDER), puts the placed copies' bytes into their references, then publishes it under the submission lock: its fence value, and its flight, bottom-of-pipe writes and declared ranges in the line. A new thread, victory-send, then records the sends to card copies and the compare (card_record), waits for the heaps' records, makes the slots that waited for textures, calls ExecuteCommandLists and signals the fence. The lane's thread prepares the next submission meanwhile.

Order and safety (as in Biskwit's commit, checked against this tree):

  • Only the sender sends published submissions, in publishing order. Every other submission (waited for, the present's copy, ours) first waits under the submission lock until everything published was sent (wait_sent), so it gets a higher fence value. The timeline's calibration submission (diagnostics) waits too.
  • A published submission is in the line, so everything that asks what flights write sees it, and waits for it to land where it would have.
  • The sender never takes the submission lock and never waits for the lane's thread, so a holder of that lock can wait for a published flight to land.
  • A failed send or signal, a lost device or a panic on the sender is fail, as on the one thread before. Nothing published is dropped.
  • Needs the relay's second stage, the relay's fetches on the copy queue and send::own (VICTORY_RELAY=2, VICTORY_RELAY_COPY=1, as play-foxhound.ps1 sets them). Without them the switch does nothing.

Changes against Biskwit's commit: off by default (asked_for!), the conflicts resolved against this tree (streamline tags, two-queues plan, texback ranges, Batch reuse, heap_marks timing, span_lists and timeline::sent signatures, AFTER_SEND), the calibration submission waits for published ones, and his late texture read-back test is left out (this tree does not have it).

Biskwit's numbers (i9-12900K + RTX 4090, Series S, in-run A/B): see the commit message.

VICTORY_OFF_LINE=1, with VICTORY_SUBMIT_SPLIT=1 (from Biskwit/VIctory-reloaded 821867c)

The descriptor slots that steps done on the card fill (about 11,000 a frame there, 1.9 ms on the lane) are kept with the published submission and written by the sender, after that submission's heaps' records and before its lists go to the queue. Synchronous submissions still write theirs on the lane, after wait_sent. Only the slots half of that commit is here: its other half (closing host lists at recycle) is already covered in this tree by HostList::leave_open, and its slot-order counter (VICTORY_SLOT_ORDER_COUNT) was a one-off measurement.

Credit and licence

Both changes are Biskwit's (https://github.com/Biskwit/VIctory-reloaded, GPL-3.0-or-later, same licence text as this repo); the commits keep him as author. I found them through Keel62155/VIctoryUnified, which carries them off by default. My part is the port to this tree and the opt-in defaults. I did not find an open or closed PR here with the same change (searched SUBMIT_SPLIT, OFF_LINE, victory-send, split submission, Biskwit, reloaded).

Checks

  • cargo build --release --locked -p victory: ok.
  • cargo test --release --locked -p victory-gpu --lib: 453 passed, 0 failed, 36 ignored.
  • cargo clippy -p victory-gpu -p victory-hle --all-targets, with and without diagnostics: no finding in the changed files (the ones left are in shadow.rs, descriptor.rs and gameinput.rs, as on main).
  • No unit test of the split itself: it needs the relay and a device, which the crate's tests run without.

In the game

Measured with a build of this branch plus one more commit of Biskwit's (thread placement, VICTORY_PLACE_APART / VICTORY_PLACE_LANE, left out of this PR: it overlaps #419 and #475 and changes nothing on a CPU with one kind of core, as here). Ryzen 5 9600X (6 cores) + RTX 5080, Windows 11, Series X 4K output, DLSS Performance, frame generation 2x, THIN=1, JOIN_PARTS=8, ASYNC_SUBMIT=1, RELAY=2, RELAY_COPY=1 (play-foxhound.ps1), opening prison scene, about 4,800 draws a frame, warm cache. One release exe of this branch for every run, only the switches changing, alternating runs of 240 s; frame lines from 30 to 150 s after the world starts, and the settled part from 90 to 150 s.

run fps 30-150 s fps 90-150 s (median) preparing ms (90-150 s) sender worked ms a frame
off 1 25.0 26.5 (26.6) 25.6
split 1 26.1 27.7 (27.7) 23.0 3.5
split + off line 1 25.9 27.5 (27.5) 23.0 4.8
off 2 24.5 26.4 (26.4) 25.6
split 2 25.0 25.8 (26.9) 26.6 3.3
split + off line 2 25.5 27.0 (26.8) 24.2 4.7

Means: off 24.8 / 26.5, split 25.6 / 26.8, split + off line 25.7 / 27.3 (30-150 s / 90-150 s). So about +1 fps (3 to 4 %) on this PC, with the preparing time 1.5 to 2.5 ms shorter. The sender takes 3.3 to 3.5 ms a frame off the lane, 4.7 to 4.8 ms with OFF_LINE (about 15.4 submissions a frame). The two off runs agree within 0.1 fps in the settled part, so the gain is above the spread here, but it is small and two rounds are not many.

"split 2" had three short stalls in its settled part (one 5 s line at 13.9 fps with 54 ms preparing, two at 20 to 21.5 fps); the off runs had none in that part, the other three split runs had none either. I can not tell yet whether that is the split or the scene streaming; worth watching.

Stability: no device removal, no panic and no new warning in the four runs with the split on (16 minutes); the warnings counted in each log were the same kinds as with it off. Nobody watched the screen during these runs, so I can not say anything about the picture yet.

🤖 Generated with Claude Code

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5543813308 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1418). Originally posted by [yeedgrthfgv](https://github.com/yeedgrthfgv) on 2026-11-28T19:30:19Z. --- **Reopened from #1066**, which was closed because it no longer applied to main. The same 7 commits (the two switches plus the review fixes from wildheathen) are now rebased on the current main `32ecacf`. Two conflicts were resolved: - `card_take` / `card_record`: main's `upload_slot` (#60, fenced copy-queue uploads) now sits in `card_record` beside `used` and `looks`, where the sends to card copies are recorded. `upq` takes its own lock and puts its wait on the queue just before the lists that use it, so it keeps its order on the sender thread too. - `Split` / the frame line: main's `ASKED_FIRST` counter and line (#127) are kept beside the sender's own `SEND_SPLIT` line. Checked on the rebased branch: release build, `--features diagnostics` check, victory-gpu lib tests (477 passed). Both switches stay **off by default**; with them unset nothing is published and the old path runs. Test results from #1066 (all with both switches on): about +1 fps in light or static scenes (cxy0072019-sketch, 14600KF), no change at the frame on a 9800X3D indoors (tippythetaidum, wildheathen), and slower in heavy moving scenes on an 8 core 5700X (POMXARK). So it stays opt-in. --- On CPU-bound PCs one thread sets the frame: the submitting thread (`victory-submit`, `queue::behind` lane, `Host::send_late`). On a Ryzen 5 9600X + RTX 5080 it is busy for nearly all of a 41 ms frame (a sampling profile puts 90 % of its time in `send_late`), and making other threads faster (#834, #801, VICTORY_WIDE_THREADS, VICTORY_ASK_EARLY, measured here) did not change the frame rate. Issues #699, #833, #855 and #985 show the same on other PCs. This PR ports two switches from Biskwit/VIctory-reloaded that take work off that thread. Both are **off by default**. With them unset every submission takes the old path: nothing is published, the new sender thread is never started, `wait_sent` returns on an atomic before it takes any lock, and the card steps' slots are written by the same code as before. ## VICTORY_SUBMIT_SPLIT=1 (from Biskwit/VIctory-reloaded d5bd9d8) Two threads in a row. The lane's thread prepares a submission as before, takes what goes up to the copies in the card's memory (`card_take`, numbered under `QUEUE_ORDER`), puts the placed copies' bytes into their references, then publishes it under the submission lock: its fence value, and its flight, bottom-of-pipe writes and declared ranges in the line. A new thread, `victory-send`, then records the sends to card copies and the compare (`card_record`), waits for the heaps' records, makes the slots that waited for textures, calls ExecuteCommandLists and signals the fence. The lane's thread prepares the next submission meanwhile. Order and safety (as in Biskwit's commit, checked against this tree): - Only the sender sends published submissions, in publishing order. Every other submission (waited for, the present's copy, ours) first waits under the submission lock until everything published was sent (`wait_sent`), so it gets a higher fence value. The timeline's calibration submission (diagnostics) waits too. - A published submission is in the line, so everything that asks what flights write sees it, and waits for it to land where it would have. - The sender never takes the submission lock and never waits for the lane's thread, so a holder of that lock can wait for a published flight to land. - A failed send or signal, a lost device or a panic on the sender is `fail`, as on the one thread before. Nothing published is dropped. - Needs the relay's second stage, the relay's fetches on the copy queue and `send::own` (`VICTORY_RELAY=2`, `VICTORY_RELAY_COPY=1`, as play-foxhound.ps1 sets them). Without them the switch does nothing. Changes against Biskwit's commit: off by default (asked_for!), the conflicts resolved against this tree (streamline tags, two-queues plan, texback ranges, Batch reuse, heap_marks timing, span_lists and timeline::sent signatures, AFTER_SEND), the calibration submission waits for published ones, and his late texture read-back test is left out (this tree does not have it). Biskwit's numbers (i9-12900K + RTX 4090, Series S, in-run A/B): see the commit message. ## VICTORY_OFF_LINE=1, with VICTORY_SUBMIT_SPLIT=1 (from Biskwit/VIctory-reloaded 821867c) The descriptor slots that steps done on the card fill (about 11,000 a frame there, 1.9 ms on the lane) are kept with the published submission and written by the sender, after that submission's heaps' records and before its lists go to the queue. Synchronous submissions still write theirs on the lane, after `wait_sent`. Only the slots half of that commit is here: its other half (closing host lists at recycle) is already covered in this tree by `HostList::leave_open`, and its slot-order counter (`VICTORY_SLOT_ORDER_COUNT`) was a one-off measurement. ## Credit and licence Both changes are Biskwit's (https://github.com/Biskwit/VIctory-reloaded, GPL-3.0-or-later, same licence text as this repo); the commits keep him as author. I found them through Keel62155/VIctoryUnified, which carries them off by default. My part is the port to this tree and the opt-in defaults. I did not find an open or closed PR here with the same change (searched SUBMIT_SPLIT, OFF_LINE, victory-send, split submission, Biskwit, reloaded). ## Checks - `cargo build --release --locked -p victory`: ok. - `cargo test --release --locked -p victory-gpu --lib`: 453 passed, 0 failed, 36 ignored. - `cargo clippy -p victory-gpu -p victory-hle --all-targets`, with and without diagnostics: no finding in the changed files (the ones left are in shadow.rs, descriptor.rs and gameinput.rs, as on main). - No unit test of the split itself: it needs the relay and a device, which the crate's tests run without. ## In the game Measured with a build of this branch plus one more commit of Biskwit's (thread placement, VICTORY_PLACE_APART / VICTORY_PLACE_LANE, left out of this PR: it overlaps #419 and #475 and changes nothing on a CPU with one kind of core, as here). Ryzen 5 9600X (6 cores) + RTX 5080, Windows 11, Series X 4K output, DLSS Performance, frame generation 2x, THIN=1, JOIN_PARTS=8, ASYNC_SUBMIT=1, RELAY=2, RELAY_COPY=1 (play-foxhound.ps1), opening prison scene, about 4,800 draws a frame, warm cache. One release exe of this branch for every run, only the switches changing, alternating runs of 240 s; frame lines from 30 to 150 s after the world starts, and the settled part from 90 to 150 s. | run | fps 30-150 s | fps 90-150 s (median) | preparing ms (90-150 s) | sender worked ms a frame | |---|---|---|---|---| | off 1 | 25.0 | 26.5 (26.6) | 25.6 | | | split 1 | 26.1 | 27.7 (27.7) | 23.0 | 3.5 | | split + off line 1 | 25.9 | 27.5 (27.5) | 23.0 | 4.8 | | off 2 | 24.5 | 26.4 (26.4) | 25.6 | | | split 2 | 25.0 | 25.8 (26.9) | 26.6 | 3.3 | | split + off line 2 | 25.5 | 27.0 (26.8) | 24.2 | 4.7 | Means: off 24.8 / 26.5, split 25.6 / 26.8, split + off line 25.7 / 27.3 (30-150 s / 90-150 s). So about +1 fps (3 to 4 %) on this PC, with the preparing time 1.5 to 2.5 ms shorter. The sender takes 3.3 to 3.5 ms a frame off the lane, 4.7 to 4.8 ms with OFF_LINE (about 15.4 submissions a frame). The two off runs agree within 0.1 fps in the settled part, so the gain is above the spread here, but it is small and two rounds are not many. "split 2" had three short stalls in its settled part (one 5 s line at 13.9 fps with 54 ms preparing, two at 20 to 21.5 fps); the off runs had none in that part, the other three split runs had none either. I can not tell yet whether that is the split or the scene streaming; worth watching. Stability: no device removal, no panic and no new warning in the four runs with the split on (16 minutes); the warnings counted in each log were the same kinds as with it off. Nobody watched the screen during these runs, so I can not say anything about the picture yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!1418
No description provided.