Frame rate: indirect clamps in runs, landing fetches from card slots, re-check fix (2.5 -> 7.5 fps on a 5070 Ti) #993

Open
tunczzz wants to merge 2 commits from upstream-pr/995 into main
tunczzz commented 2026-11-25 15:26:13 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by tunczzz on 2026-11-25T15:26:13Z.


Frame-rate work on top of 0b0074e, measured on an RTX 5070 Ti (32 GB) in the first prison cutscene and the start of gameplay.

Result: 217-225 ms a frame before the 9376fd6 merge, 133-138 ms (7.2-7.5 fps) with the settings listed in docs/fps-notes.md. The card went from ~117 to ~64 ms a frame; the frame is now bound by the submitting thread, mostly the descriptor heap sync.

Almost everything is behind a switch and off by default, so the default behaviour is unchanged except for the fixes listed below. docs/fps-notes.md has the run table, the exact settings, what was tried and rejected (with the reason), and what is still open.

The big wins

  • Indirect clamp stalls (card 105 -> 64 ms). Each indirect record was clamped by a compute pass between two waits, 7-12 us of card time per call, ~4,700 calls a frame. VICTORY_INDIRECT_BATCH=3 clamps a run of calls in one pass (a run ends only at work that can store to a buffer); VICTORY_MESH_AMPLIFY=1 clamps mesh records inside an amplification stage.
  • Landing fetches. Fetches sat on the main queue behind every later flight (60-105 ms a frame of waiting). VICTORY_CARD_FETCH_INFLIGHT=2 copies each flight's flagged pieces into slots in card memory inside the flight, then copies the slots down on a copy queue at landing. Mode 1 was slow because shader writes into PC memory fall off a cliff on this card (64 MB: ~600 ms, against 0.74 ms into card memory).
  • Windows in GPU upload heaps (VICTORY_GPU_UPLOAD_COPIES=1) and table constants bound to the card copy (VICTORY_TABLE_ON_CARD=1).
  • CPU side: heap-sync skips (VICTORY_HEAP_SYNC_TABLES=2, VICTORY_SYNC_NULL_SKIP=1), wide fills, texture checks and refreshes, and fewer view-memory askings.

Fixes that are on by default

  • Texture re-check: VICTORY_HEAP_RECHECK fingerprinted past a texture's own bytes into the next texture placed in its large levels, and uploaded it again with them; that was the blocky strip at the bottom of the scene. It now stops at the next texture's start. There is also a BTreeMap::range panic fix for textures smaller than the head.
  • Refresh on a full card: VICTORY_REUPLOAD_WHEN_FULL with async texture workers never ran. It is now done in the pass.
  • Stale textures: textures uploaded before a DirectStorage write into their pages are uploaded again.
  • Save containers: they no longer fail when a version folder exists in both layers of a packaged app's virtualised AppData (os error 4395). This is why the settings never saved.
  • Smaller ones: window ghosting is off; the arrow keys also turn the camera (VICTORY_ARROWS_LOOK=0 restores the D-pad); blending is turned off for integer targets, so the wiper-mask pipeline builds.

Not proven / needs a look

  • VICTORY_ASYNC_SUBMIT=1 drew the room without walls here. VICTORY_FLIP_LANDED is the attempted fix and is not measured yet.
  • VICTORY_PICKED_EXACT=1 declares the skinning programs' writes through heap-picked UAVs from their job records. It is not measured yet.
  • Run-to-run differences (window wire mesh, left wall, top colour) track textures held back under the commit floor.
  • Tests: victory-gpu and victory-shader lib tests pass, except indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields, which is flaky on the merged upstream code too.

This is one squashed commit of many smaller ones. Happy to split it if you'd rather take parts of it.

🤖 Generated with Claude Code

Update: merged 3973179 (upstream's frame-rate commit). Where both of us had built the same thing, yours wins: VICTORY_JOIN_PARTS is yours (my own version of it was dropped), and your pace/card-meter diagnostics are kept as they are; the one clash was a field called sked on Fence, mine is unchanged and yours is now pace_asked. After the merge: cargo check is clean with and without diagnostics, ictory-gpu lib tests pass (264), and a five-minute run on the 5070 Ti is 131-136 ms (7.4-7.6 fps) with no device loss.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6607919226 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/995). Originally posted by [tunczzz](https://github.com/tunczzz) on 2026-11-25T15:26:13Z. --- Frame-rate work on top of 0b0074e, measured on an RTX 5070 Ti (32 GB) in the first prison cutscene and the start of gameplay. **Result:** 217-225 ms a frame before the 9376fd6 merge, **133-138 ms (7.2-7.5 fps)** with the settings listed in `docs/fps-notes.md`. The card went from ~117 to ~64 ms a frame; the frame is now bound by the submitting thread, mostly the descriptor heap sync. Almost everything is behind a switch and off by default, so the default behaviour is unchanged except for the fixes listed below. `docs/fps-notes.md` has the run table, the exact settings, what was tried and rejected (with the reason), and what is still open. ### The big wins - **Indirect clamp stalls (card 105 -> 64 ms).** Each indirect record was clamped by a compute pass between two waits, 7-12 us of card time per call, ~4,700 calls a frame. `VICTORY_INDIRECT_BATCH=3` clamps a run of calls in one pass (a run ends only at work that can store to a buffer); `VICTORY_MESH_AMPLIFY=1` clamps mesh records inside an amplification stage. - **Landing fetches.** Fetches sat on the main queue behind every later flight (60-105 ms a frame of waiting). `VICTORY_CARD_FETCH_INFLIGHT=2` copies each flight's flagged pieces into slots in card memory inside the flight, then copies the slots down on a copy queue at landing. Mode 1 was slow because shader writes into PC memory fall off a cliff on this card (64 MB: ~600 ms, against 0.74 ms into card memory). - **Windows in GPU upload heaps** (`VICTORY_GPU_UPLOAD_COPIES=1`) and **table constants bound to the card copy** (`VICTORY_TABLE_ON_CARD=1`). - **CPU side:** heap-sync skips (`VICTORY_HEAP_SYNC_TABLES=2`, `VICTORY_SYNC_NULL_SKIP=1`), wide fills, texture checks and refreshes, and fewer view-memory askings. ### Fixes that are on by default - **Texture re-check:** `VICTORY_HEAP_RECHECK` fingerprinted past a texture's own bytes into the next texture placed in its large levels, and uploaded it again with them; that was the blocky strip at the bottom of the scene. It now stops at the next texture's start. There is also a `BTreeMap::range` panic fix for textures smaller than the head. - **Refresh on a full card:** `VICTORY_REUPLOAD_WHEN_FULL` with async texture workers never ran. It is now done in the pass. - **Stale textures:** textures uploaded before a DirectStorage write into their pages are uploaded again. - **Save containers:** they no longer fail when a version folder exists in both layers of a packaged app's virtualised `AppData` (os error 4395). This is why the settings never saved. - **Smaller ones:** window ghosting is off; the arrow keys also turn the camera (`VICTORY_ARROWS_LOOK=0` restores the D-pad); blending is turned off for integer targets, so the wiper-mask pipeline builds. ### Not proven / needs a look - `VICTORY_ASYNC_SUBMIT=1` drew the room without walls here. `VICTORY_FLIP_LANDED` is the attempted fix and is not measured yet. - `VICTORY_PICKED_EXACT=1` declares the skinning programs' writes through heap-picked UAVs from their job records. It is not measured yet. - Run-to-run differences (window wire mesh, left wall, top colour) track textures held back under the commit floor. - Tests: `victory-gpu` and `victory-shader` lib tests pass, except `indirect::tests::warp_budget_saturates_without_wraparound_and_preserves_draw_fields`, which is flaky on the merged upstream code too. This is one squashed commit of many smaller ones. Happy to split it if you'd rather take parts of it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) **Update:** merged 3973179 (upstream's frame-rate commit). Where both of us had built the same thing, yours wins: VICTORY_JOIN_PARTS is yours (my own version of it was dropped), and your pace/card-meter diagnostics are kept as they are; the one clash was a field called sked on Fence, mine is unchanged and yours is now pace_asked. After the merge: cargo check is clean with and without diagnostics, ictory-gpu lib tests pass (264), and a five-minute run on the 5070 Ti is 131-136 ms (7.4-7.6 fps) with no device loss.
grosterr commented 2026-11-25 19:09:47 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by grosterr on 2026-11-25T18:50:39Z.


A data point on "VICTORY_ASYNC_SUBMIT=1 drew the room without walls here": not reproduced on an RTX 3060 12 GB (Ryzen 7 5700X, 32 GB, Windows 11, Series X profile).

Tree: not this PR. It is the fxceless#770 stack (d034ac1) with main a253706 merged in (grosterr/victory-fork rtx3060), with LEVELS_ON_DEMAND=1 EARLY_TEXTURES_MS=40 TEXTURE_NO_WAIT=1 WIDE_TEXTURES=1 as the base. Same save each time, ~5–10 minutes in the first rooms and corridor:

run switches on top of the base walls / picture
A0a ASYNC_SUBMIT=1 alone walls present, picture clean
A0, A0r ASYNC_SUBMIT=1 QUEUE2=1 INDIRECT_WINDOW=1 COPY_PLAIN=1 walls present in both

No device loss and no errors in any of them. So on this tree the missing walls do not follow from ASYNC_SUBMIT alone. It may depend on something else in this PR (or on 0b0074e's changes), which might help narrow down what VICTORY_FLIP_LANDED has to fix.

For scale, the four switches together took this card from 330 to 243–282 ms a frame (copy-back 216 → 66 ms, most of it from QUEUE2).

AI-assisted (Claude Code); the runs and observations are mine.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7171479022 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/995#issuecomment-7171479022). Originally posted by [grosterr](https://github.com/grosterr) on 2026-11-25T18:50:39Z. --- A data point on "`VICTORY_ASYNC_SUBMIT=1` drew the room without walls here": not reproduced on an RTX 3060 12 GB (Ryzen 7 5700X, 32 GB, Windows 11, Series X profile). Tree: not this PR. It is the fxceless#770 stack (`d034ac1`) with main `a253706` merged in ([`grosterr/victory-fork` `rtx3060`](https://github.com/grosterr/victory-fork/tree/rtx3060)), with `LEVELS_ON_DEMAND=1 EARLY_TEXTURES_MS=40 TEXTURE_NO_WAIT=1 WIDE_TEXTURES=1` as the base. Same save each time, ~5–10 minutes in the first rooms and corridor: | run | switches on top of the base | walls / picture | |---|---|---| | A0a | `ASYNC_SUBMIT=1` alone | walls present, picture clean | | A0, A0r | `ASYNC_SUBMIT=1 QUEUE2=1 INDIRECT_WINDOW=1 COPY_PLAIN=1` | walls present in both | No device loss and no errors in any of them. So on this tree the missing walls do not follow from `ASYNC_SUBMIT` alone. It may depend on something else in this PR (or on `0b0074e`'s changes), which might help narrow down what `VICTORY_FLIP_LANDED` has to fix. For scale, the four switches together took this card from 330 to 243–282 ms a frame (copy-back 216 → 66 ms, most of it from `QUEUE2`). AI-assisted (Claude Code); the runs and observations are mine.
slauko commented 2026-11-26 12:07:19 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by slauko on 2026-11-26T11:31:11Z.


A request for the split you offered, from a Wine line that cannot take the branch as one piece (vkd3d-proton, RTX 3080 Ti, uiliannn's base; the cell at ~4,950 draws a frame, 636 of them indirect, card 144–190 ms of a 262–288 ms frame):

the indirect clamp batching (VICTORY_INDIRECT_BATCH=3) as its own PR, with whatever host.rs/descriptor.rs plumbing it needs.

Why that one first: my line already records the clamps per gather set — a compute pass per set between a UAV barrier on each side (indirect.rs, record_gather_as: uav_barrier, dispatch, uav_barrier + transition) — which is the shape your 105 → 64 ms is about; what it lacks is the run that takes several of them through one pair of waits. The rest of #995 is either not applicable here (VICTORY_GPU_UPLOAD_COPIES: GPU upload heaps ... supported=false under this stack) or too entangled with this line's own state to port from a 31k-line squashed branch.

I can test a split quickly on my side: the cell's frame and the card's time are in every run's log, and m29/m27 give a baseline (270–318 ms and 275–277 ms with and without a translator port today).

If the split is cheap for you, the other piece I would take next is VICTORY_CARD_FETCH_INFLIGHT=2 (the slots-in-card-memory variant) — =1 is measured here: it removes 141 ms of the relay thread's wait and adds ~60 ms on the card, a net loss on this stack, so the =2 geometry is the interesting one.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7190831651 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/995#issuecomment-7190831651). Originally posted by [slauko](https://github.com/slauko) on 2026-11-26T11:31:11Z. --- A request for the split you offered, from a Wine line that cannot take the branch as one piece (vkd3d-proton, RTX 3080 Ti, uiliannn's base; the cell at ~4,950 draws a frame, 636 of them indirect, card 144–190 ms of a 262–288 ms frame): **the indirect clamp batching (`VICTORY_INDIRECT_BATCH=3`) as its own PR, with whatever `host.rs`/`descriptor.rs` plumbing it needs.** Why that one first: my line already records the clamps per gather set — a compute pass per set between a UAV barrier on each side (`indirect.rs`, `record_gather_as`: `uav_barrier`, dispatch, `uav_barrier` + transition) — which is the shape your 105 → 64 ms is about; what it lacks is the run that takes several of them through one pair of waits. The rest of #995 is either not applicable here (`VICTORY_GPU_UPLOAD_COPIES`: `GPU upload heaps ... supported=false` under this stack) or too entangled with this line's own state to port from a 31k-line squashed branch. I can test a split quickly on my side: the cell's frame and the card's time are in every run's log, and `m29`/`m27` give a baseline (270–318 ms and 275–277 ms with and without a translator port today). If the split is cheap for you, the other piece I would take next is `VICTORY_CARD_FETCH_INFLIGHT=2` (the slots-in-card-memory variant) — `=1` is measured here: it removes 141 ms of the relay thread's wait and adds ~60 ms on the card, a net loss on this stack, so the `=2` geometry is the interesting one.
slauko commented 2026-11-26 14:03:30 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by slauko on 2026-11-26T13:29:49Z.


A follow-up to my split request: the piece I asked for landed through Marvisak#3197's window instead, and it works on this stack — the indirect clamps in the cell fall from 1,757 to 1,796 a frame to 295 to 355 (the mesh draws join a table window; only the compute dispatches are left), with the table filled while recording and one pass per run.

So no split needed on my side for the clamp batch. The other items in this PR that still look interesting here are the CPU ones (VICTORY_HEAP_SYNC_TABLES, the wide fills, the texture checks) — this line's copies are 63–74 ms for ~190 MB a frame, write-bandwidth-bound at ~4 GB/s (VICTORY_COPY_PLAIN=1 changes nothing), and its heap pass is 25–45 ms in the descriptor scan.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7193430840 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/995#issuecomment-7193430840). Originally posted by [slauko](https://github.com/slauko) on 2026-11-26T13:29:49Z. --- A follow-up to my split request: the piece I asked for landed through Marvisak#3197's window instead, and it works on this stack — the indirect clamps in the cell fall from 1,757 to 1,796 a frame to **295 to 355** (the mesh draws join a table window; only the compute dispatches are left), with the table filled while recording and one pass per run. So no split needed on my side for the clamp batch. The other items in this PR that still look interesting here are the CPU ones (`VICTORY_HEAP_SYNC_TABLES`, the wide fills, the texture checks) — this line's copies are 63–74 ms for ~190 MB a frame, write-bandwidth-bound at ~4 GB/s (`VICTORY_COPY_PLAIN=1` changes nothing), and its heap pass is 25–45 ms in the descriptor scan.
Filip722 commented 2026-11-26 15:04:07 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Filip722 on 2026-11-26T14:18:39Z.


I backported the device-local flight-slot readback from 7406afb for a matched Series S replay on Bazzite 44 with GE-Proton11-14, vkd3d-proton 3.2.0 and an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08). Both arms used the same executable, stationary prison view and warmed seed, with relay stage 1 and the clamped gathering path from #1171. To exercise actual device-local copies on this GPU, both used a 1 MiB minimum copy size and a 96 MiB buffer budget.

54-second window Flight slots off Device-local flight slots
Unique completed Presents 271 277
FPS 5.017 5.206
Median / p95 Present interval 190 / 246 ms 186 / 221 ms
Median time fetching card pieces 32.3 ms 4.8 ms
Median copy-back phase 117.2 ms 66.6 ms
Minimum free VRAM 1,563 MiB 1,456 MiB

Mode 2 typically read back 295 pieces (~18.4 MiB) per frame, with no old-path landings or slot overflows reported in the measured window. The patched replay responded to camera input. The asset-free fixture read the expected bytes from two ranges on the copy queue after a direct-queue fence, and the fetch pipeline test passed on the hardware adapter. This comparison isolates the readback path on that older compatibility build.

Assisted by Codex (GPT-6.2-Sol High).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7194608062 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/995#issuecomment-7194608062). Originally posted by [Filip722](https://github.com/Filip722) on 2026-11-26T14:18:39Z. --- I backported the device-local flight-slot readback from `7406afb` for a matched Series S replay on Bazzite 44 with GE-Proton11-14, vkd3d-proton 3.2.0 and an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08). Both arms used the same executable, stationary prison view and warmed seed, with relay stage 1 and the clamped gathering path from #1171. To exercise actual device-local copies on this GPU, both used a 1 MiB minimum copy size and a 96 MiB buffer budget. | 54-second window | Flight slots off | Device-local flight slots | | --- | ---: | ---: | | Unique completed Presents | 271 | 277 | | FPS | 5.017 | 5.206 | | Median / p95 Present interval | 190 / 246 ms | 186 / 221 ms | | Median time fetching card pieces | 32.3 ms | 4.8 ms | | Median copy-back phase | 117.2 ms | 66.6 ms | | Minimum free VRAM | 1,563 MiB | 1,456 MiB | Mode 2 typically read back 295 pieces (~18.4 MiB) per frame, with no old-path landings or slot overflows reported in the measured window. The patched replay responded to camera input. The asset-free fixture read the expected bytes from two ranges on the copy queue after a direct-queue fence, and the fetch pipeline test passed on the hardware adapter. This comparison isolates the readback path on that older compatibility build. Assisted by Codex (GPT-6.2-Sol High).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/995:upstream-pr/995'
git switch 'upstream-pr/995'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/995'
git switch 'upstream-pr/995'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/995'
git switch 'upstream-pr/995'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/995'
git switch 'main'
git merge --squash 'upstream-pr/995'
git switch 'main'
git merge --ff-only 'upstream-pr/995'
git switch 'main'
git merge 'upstream-pr/995'
git push origin 'main'
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
fxceless/victory-fork!993
No description provided.