Fix the world-entry crash the table-slot skip causes; coalesce refreshes; opt-in readable-range copies #827

Open
github-bot wants to merge 11 commits from github-bot/gh-827 into main AGit
Owner

@⁠traidy2222 on GitHub · 2026-11-25 09:21 UTC · original
traidy2222:tabled-window-copy-coalesce → main · +540 −20 · 7 files · 11 commits · draft

What this is

Three small, behaviour-preserving changes to the processor side of the frame,
written while running the title on a 16 GB / RTX 3080 box, plus the one thing
they found: the descriptor-sync skip window crashes the title at world entry,
and the window is the cause, not the skipping.

Measured on: i7-12700F, 16 GB DDR4, RTX 3080 10 GB, Windows 11, Series X
profile, build 9376fd6 + these changes. Same scene (frames with >= 1500
draws), medians:

configuration frame copies copy rate GPU fps
a26859f + the README's speed switches 2885 ms 709 ms / 216 MB 305 MB/s 131 ms 0.35
9376fd6 + switches + VICTORY_HEAP_SYNC_TABLES=1 2101 ms 581 ms / 380 MB 654 MB/s 100 ms 0.48
+ this branch (coalesced refreshes, COPY_FAST) 1261-1376 ms 244 ms / 210 MB 861 MB/s 94 ms 0.73-0.79

Loading into the world: 232 s (cold shader cache) -> 84 s (warm cache + these).

1. The world-entry crash: tabled_lately's 240-frame window

Three runs of 9376fd6 with no switches died at the same place, reproducibly:

unhandled exception 0xc0000005 at victory-image-<hash>.dll+0x23cf683
(write 0x0: nothing mapped there)          frames 2112, 2253, 2573

HostHeap::tabled_lately leaves a slot to its draws if it was a table's within
TABLED_FRAMES (240) frames, and does not ask whether a draw read it through
a table. A slot the title stops reading through a table keeps being skipped for
eight seconds, so a draw that now reads it directly gets a record no pass made.

VICTORY_TABLED_SKIP_FRAMES=<n> asks the stricter question: skip only if a
draw read the slot through a table within n frames (the read bit is
already in tabled). With =2: two clean runs through the world, no
exception; with the shipped window: three crashes. Unset keeps today's
behaviour exactly.

Note for the maintainer: the OOM report of the crash carries
memory.load_percent 94-97-99, so a slower run survives by reaching the wall
later; the window is still the thing that decides whether a skipped slot is
ever made.

2. Refreshes of one title buffer, coalesced

Batch::flush hands Shadow::update 25,000-90,000 ranges a frame of 11-21 KB
each (the new copies moved per frame line). Ranges of the same copy within
64 KB now become one call; the bytes between them are title memory as well, and
Shadow::update still cuts the merged range around what shaders write.
Result: 60-90k calls -> 24-50k for the same bytes.

3. VICTORY_COPY_FAST: a memcpy when the range is readable

copy_mapped reads title memory with ReadProcessMemory (600 MB/s here).
With the flag, a range the kernel reports readable is moved with the CPU:
700-1,300 MB/s measured. Off by default: the title can unmap a page between
the question and the copy (the page pool's pages move when streaming replaces
them) and a fault there kills the process. It needs a guarded copy (vectored
handler) before it can default on; until then it is an experiment, and it is
not needed by the crash fix.

4. watch::forgot, and one more thing it showed

The layer's own write-back into title memory sets the kernel's write-watch
dirty bits, so the next refresh reports them as the title's writes and copies
the same bytes up again. forgot resets them after the layer's write.
Measured: title-memory copies through this path are only 0.5-2.5 MB a frame,
so this is small; the 460-1,530 MB a frame of copies are in the texture queue.

Not in this PR, and the biggest number left

The pass over the heap still mirrors 34,483 records a frame at ~25 us each
(~250-800 ms). Skipping more of them is what makes it 3 ms and kills the
title; the window above only makes the skipping safe. Making a mirror cheap
(batch the view creation, cache by resource+description) is the next step, and
I have not written it.

The texture queue is the other: 18,333 slots due a frame against a 2 GB card
budget, uploaded, evicted, due again. Capping the stage
(VICTORY_TEXTURE_STAGE_MB=64) took a 1.5 s frame to 0.44-0.48 s; ordering the
queue by last use is the fix I would write next.

cargo test -p victory-gpu --lib: 142 passed, 2 failed
(pipeline::host::tests::a_mesh_pipeline_loads_from_the_library,
...::depth_bounds_pipeline_loads_and_filters_draws), both asserting the
pipeline library is loaded from rather than compiled again - they touch nothing
in this diff and fail the same way here on 9376fd6 without it.

**@⁠traidy2222** on GitHub · 2026-11-25 09:21 UTC · [original](https://github.com/fxceless/victory-fork/pull/827) `traidy2222:tabled-window-copy-coalesce` → `main` · +540 −20 · 7 files · 11 commits · draft ## What this is Three small, behaviour-preserving changes to the processor side of the frame, written while running the title on a 16 GB / RTX 3080 box, plus the one thing they found: **the descriptor-sync skip window crashes the title at world entry, and the window is the cause, not the skipping.** Measured on: i7-12700F, 16 GB DDR4, RTX 3080 10 GB, Windows 11, Series X profile, build `9376fd6` + these changes. Same scene (frames with >= 1500 draws), medians: | configuration | frame | copies | copy rate | GPU | fps | |---|---|---|---|---|---| | `a26859f` + the README's speed switches | 2885 ms | 709 ms / 216 MB | 305 MB/s | 131 ms | 0.35 | | `9376fd6` + switches + `VICTORY_HEAP_SYNC_TABLES=1` | 2101 ms | 581 ms / 380 MB | 654 MB/s | 100 ms | 0.48 | | + this branch (coalesced refreshes, `COPY_FAST`) | **1261-1376 ms** | 244 ms / 210 MB | **861 MB/s** | 94 ms | **0.73-0.79** | Loading into the world: 232 s (cold shader cache) -> 84 s (warm cache + these). ## 1. The world-entry crash: `tabled_lately`'s 240-frame window Three runs of `9376fd6` with no switches died at the same place, reproducibly: ``` unhandled exception 0xc0000005 at victory-image-<hash>.dll+0x23cf683 (write 0x0: nothing mapped there) frames 2112, 2253, 2573 ``` `HostHeap::tabled_lately` leaves a slot to its draws if it was a table's within `TABLED_FRAMES` (240) frames, and does not ask whether a draw *read* it through a table. A slot the title stops reading through a table keeps being skipped for eight seconds, so a draw that now reads it directly gets a record no pass made. `VICTORY_TABLED_SKIP_FRAMES=<n>` asks the stricter question: skip only if a draw read the slot **through a table** within `n` frames (the read bit is already in `tabled`). With `=2`: two clean runs through the world, no exception; with the shipped window: three crashes. Unset keeps today's behaviour exactly. Note for the maintainer: the OOM report of the crash carries `memory.load_percent` 94-97-99, so a slower run survives by reaching the wall later; the window is still the thing that decides whether a skipped slot is ever made. ## 2. Refreshes of one title buffer, coalesced `Batch::flush` hands `Shadow::update` 25,000-90,000 ranges a frame of 11-21 KB each (the new `copies moved per frame` line). Ranges of the same copy within 64 KB now become one call; the bytes between them are title memory as well, and `Shadow::update` still cuts the merged range around what shaders write. Result: 60-90k calls -> 24-50k for the same bytes. ## 3. `VICTORY_COPY_FAST`: a `memcpy` when the range is readable `copy_mapped` reads title memory with `ReadProcessMemory` (600 MB/s here). With the flag, a range the kernel reports readable is moved with the CPU: 700-1,300 MB/s measured. **Off by default**: the title can unmap a page between the question and the copy (the page pool's pages move when streaming replaces them) and a fault there kills the process. It needs a guarded copy (vectored handler) before it can default on; until then it is an experiment, and it is not needed by the crash fix. ## 4. `watch::forgot`, and one more thing it showed The layer's own write-back into title memory sets the kernel's write-watch dirty bits, so the next refresh reports them as the title's writes and copies the same bytes up again. `forgot` resets them after the layer's write. Measured: title-memory copies through this path are only 0.5-2.5 MB a frame, so this is small; the 460-1,530 MB a frame of copies are in the texture queue. ## Not in this PR, and the biggest number left The pass over the heap still mirrors **34,483 records a frame** at ~25 us each (~250-800 ms). Skipping more of them is what makes it 3 ms and kills the title; the window above only makes the skipping safe. Making a mirror cheap (batch the view creation, cache by resource+description) is the next step, and I have not written it. The texture queue is the other: 18,333 slots due a frame against a 2 GB card budget, uploaded, evicted, due again. Capping the stage (`VICTORY_TEXTURE_STAGE_MB=64`) took a 1.5 s frame to 0.44-0.48 s; ordering the queue by last use is the fix I would write next. `cargo test -p victory-gpu --lib`: 142 passed, 2 failed (`pipeline::host::tests::a_mesh_pipeline_loads_from_the_library`, `...::depth_bounds_pipeline_loads_and_filters_draws`), both asserting the pipeline library is loaded from rather than compiled again - they touch nothing in this diff and fail the same way here on `9376fd6` without it.
tabled_lately leaves a slot to its draws for 240 frames without asking whether a draw read it through a table. A slot the title stops reading through a table keeps being skipped, and a draw that reads it directly gets a record no pass made: the title dies at victory-image+0x23cf683 (write 0x0), reproducibly, at world entry (frames 2112/2253/2573 on this box). VICTORY_TABLED_SKIP_FRAMES=<n> asks the stricter question (read through a table within n frames); =2 gave two clean runs through the world where the shipped window gave three crashes. Unset keeps today's behaviour.

Batch::flush coalesced 25,000-90,000 refreshes of 11-21 KB a frame into 24,000-50,000 calls: ranges of one copy within 64 KB become one, and Shadow::update still cuts the merged range around what shaders write.

VICTORY_COPY_FAST=1 (off by default): copy_mapped moves a range the kernel reports readable with memcpy (700-1,300 MB/s measured) instead of ReadProcessMemory (600 MB/s). Off until the unmap race has a guarded copy.

watch::forgot resets the write-watch bits the layer's own write-back sets.

Measured on i7-12700F/16 GB/RTX 3080: 2885 ms -> 1261-1376 ms a frame in the world (0.35 -> 0.73-0.79 fps), loading 232 s -> 84 s.
A title that commits more than the PC holds (19.5 GB against 15.8 GB here) reaches an allocation that fails and this title writes through the null it gets back: 0xc0000005 at victory-image+0x23cf683 at world entry, memory.load_percent 94-99. With the valve at 512 MB a run that died on 3 of 4 attempts reached the world with no exception (24 firings); at 256 MB, 15 s apart, it fired 4 times and the same run stayed up. Off by default: it is a valve, not a fix, and every page faulted out is faulted back in.
copy_back_with wrote title memory once per 64 KiB piece that differed (back_piece: one kernel read and one kernel write of the piece). Neighbouring pieces within 64 KiB are now one stretch, cut at 4 MiB: back_piece already reads and writes from the first differing byte to the last and writes only what the GPU wrote, so the bytes between cost a read and no write. Same scene, same config, A/B: control 5875 ms a frame (copies 2850 ms/148 MB at 52 MB/s, back 437 ms) against 558 ms (copies 131 ms/177 MB at 1357 MB/s, back 247 ms) with it, 0 crashes both.
The title reads its assets through fread, and every call allocated and zeroed up to 1 MiB beside the destination before reading into it. A thread keeps its buffer now. Front end, same config, 95 s: worst frame 1,313-1,902 ms before, 259 ms after, median 34 ms both, 0 crashes.
A 27 s frame at a loading screen had 46 ms of the layer's GPU work in it, so the read path was the first suspect. With these lines in, a 150 s run that reached gameplay (3,635 draws) logged none: the loader's synchronous reads are not where the seconds go. Kept for the next stall.
Measured: the NVMe (Kingston SN2S1000G) delivers 20-40 MB/s to the title's 200-400 queued reads while the page file lives on the same drive, and the asset stream was evicting the title's own pages. Opened without the file cache, each read widened to whole sectors in a 4 KiB-aligned buffer (read_uncached), the request copied out of it; a path the flag is refused for opens as before. VICTORY_DSTORAGE_UNBUFFERED=0 reads through the cache, as before.

Same config, same scene (frames >= 1000 draws): off 3211 ms median (copies 581 ms/252 MB at 434 MB/s), on 1409 ms (copies 161 ms/226 MB at 1404 MB/s); time to world 83.5 s against 84.5 s; no crash either way. The copies are where it shows: with the asset stream out of the file cache the title's pages stay resident, so the copies stop faulting.
40,000-113,000 views are created a frame (and as many deferred), most of them by draws reading slots through tables - the largest single cost measured here (0.3-2.8 s at 7-25 us a view), and every one also appends to the descriptor registry, which frees an entry only when the title releases a resource: 5-13 MB a frame that never comes back, a candidate for the memory climb that ends at 0xc0000005 victory-image+0x23cf683.
40,000-113,000 host views are made a frame and the same records come back every frame as draws read their tables. Each distinct record is now made once into a non-shader-visible heap of ours and copied into the slot with CopyDescriptorsSimple afterwards (32 bytes, no driver work); the model keeps the view's resource alive. VICTORY_VIEW_CACHE=0 makes every view as before.

Measured: 24,565-38,985 of 42,966-78,878 slot makes a frame are now copies. Same config: world median 676 ms against 754 ms, time to world 62.7 s against 78.7 s, 0 crashes.
The registry does not grow with play: 5,320 to 8,923 entries over a run with 16-77 freed for reuse, against 40,000-113,000 slot makes a frame - Views::entry already dedups by view, so the worry of 5-13 MB a frame never coming back was wrong, and the memory climb to 19.5 GB is the title's own. Kept the line: it answers the question for good.

The model cache now keys on the view rather than the record key. Same scene: world median 518 ms against 676 ms, copies 1,393 MB/s against 1,090, 0 crashes either way; the copied share stays around 40-50% of slot makes because the rest are genuinely new addresses each frame.
Which of the 40,000-113,000 creations a frame they are: in the heavy samples placed textures are 2,214 against 84 placed buffers and 162 shader views, so the placed-texture path is where the next change goes (defer their creation to the draw that reads them, as the waiting-texture case already does).
coalesce joined two refreshes of one copy within 64 KiB: for a copy the write watch answers, Shadow::copy_stale then copies only the pages the kernel reported, so the gap is free. For a copy without a watch, update_free falls through to copying the whole envelope, so each join read up to 16 title pages nobody asked for and dirtied as many of our own. VICTORY_COALESCE_UNWATCHED sets a gap for such copies (bytes, 0 by default).

Same scene (frames >= 1000 draws): 418 ms median against 518 ms, 188 MB a frame against 209, copy-back 243 ms against 305, GPU 113 against 124, 0 crashes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:52:00 +00:00
Author
Owner

@⁠Lancito01 on GitHub · 2026-11-25 09:26 UTC · original · edited 2026-11-25 09:33 UTC

One data point on the +0x23cf683 crash from my own test runs (same card: RTX 3080 10 GB, 32 GB RAM, Windows 11), in case it helps separate the window from memory pressure. One run, so a lead, not a result.

I got the same exception at the same offset on a tree that has no tabled_lately window at all: fork 310c6eb + #571, the #115 line, #51, #606, #112, #25, #644, #294, #646, #186, #648, #691, #544, #640, #489, #683, #220, launched with VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=1.

unhandled exception 0xc0000005 at victory-image-<hash>.dll+0x23cf683 (write 0x0: nothing mapped there)

Context of that run:

  • It never left loading (12m45s, ~10 draws a frame, at "Prestream Metadata").
  • Right before it, the PC was out of commit: RAM 93% in use and only ~2.4 GB of ~73 GB commit left; the card's VRAM budget fell from 9.3 to 7.6 GB about 25 s earlier.
  • The same build without the builder (and a retry with the builder after freeing memory) got into the world without this crash.

So on this machine +0x23cf683 also appears with no skip window, at the point the system runs out of commit, which fits your note about memory.load_percent 94-99. It looks like the title's own reaction to a failed allocation, which the window can bring on, but not something only the window causes. That doesn't argue against VICTORY_TABLED_SKIP_FRAMES=2: your 3-crashes vs 2-clean comparison is on the same tree. It may just be worth logging commit headroom next to these crash reports.

**@⁠Lancito01** on GitHub · 2026-11-25 09:26 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7158328992) · edited 2026-11-25 09:33 UTC One data point on the `+0x23cf683` crash from my own test runs (same card: RTX 3080 10 GB, 32 GB RAM, Windows 11), in case it helps separate the window from memory pressure. One run, so a lead, not a result. I got the **same exception at the same offset** on a tree that has **no `tabled_lately` window** at all: fork `310c6eb` + #571, the #115 line, #51, #606, #112, #25, #644, #294, #646, #186, #648, #691, #544, #640, #489, #683, #220, launched with `VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=1`. ``` unhandled exception 0xc0000005 at victory-image-<hash>.dll+0x23cf683 (write 0x0: nothing mapped there) ``` Context of that run: - It never left loading (12m45s, ~10 draws a frame, at "Prestream Metadata"). - Right before it, the PC was out of commit: RAM 93% in use and only ~2.4 GB of ~73 GB commit left; the card's VRAM budget fell from 9.3 to 7.6 GB about 25 s earlier. - The same build without the builder (and a retry with the builder after freeing memory) got into the world without this crash. So on this machine `+0x23cf683` also appears with no skip window, at the point the system runs out of commit, which fits your note about `memory.load_percent` 94-99. It looks like the title's own reaction to a failed allocation, which the window can bring on, but not something only the window causes. That doesn't argue against `VICTORY_TABLED_SKIP_FRAMES=2`: your 3-crashes vs 2-clean comparison is on the same tree. It may just be worth logging commit headroom next to these crash reports.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 09:54 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head f681125 into main 9376fd6 in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings fails, with the same two errors as main itself on this machine (function placed_filler_twins is never used, field depth_written is never read, victory-gpu): this PR adds none and removes none. cargo test --workspace --locked: 540 passed, 0 failed, 10 ignored, two runs (main alone: 540 passed). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 09:54 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7158951162) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head `f681125` into `main` `9376fd6` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings` fails, with the same two errors as `main` itself on this machine (`function placed_filler_twins is never used`, `field depth_written is never read`, `victory-gpu`): this PR adds none and removes none. `cargo test --workspace --locked`: 540 passed, 0 failed, 10 ignored, two runs (`main` alone: 540 passed). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠sagouindupm on GitHub · 2026-11-25 11:33 UTC · original

Tested this PR (f681125) together with #824 (9dae0a7) on Windows 11 Pro (Intel i5-12400F, 32 GB RAM, NVIDIA GeForce RTX 3050 8 GB) under --console series-s, compared against the same local base (9376fd6 + #188 + #518 + #610 + VICTORY_LITE=1280x5120, 20 window-title samples taken every ~10 s starting at 100 s):

  • Baseline (bench_k0): entered 3D draws (926 draws) at sample 10/20, peak frame time 2,357.9 ms/frame (sample 17/20), ended at 234.3 ms/frame (2711 draws, sample 20/20), interior walls intact.
  • With #827 + #824 combined (bench_k1): entered 3D draws (965 draws) at sample 2/20, max frame-time spike across all 20 samples dropped to 628.3 ms/frame (zero multi-second spikes), and the last 5 samples stabilized at 211.9–225.8 ms/frame (mean 218.5 ms/frame, ~4.6 FPS; log peak 4.9 fps / 205.2 ms/frame), interior walls intact.

(Note: #827 and #824 were measured together in the same build, so the speedup and spike reduction reflect their combined effect on 8 GB Windows hardware.)

AI-assisted: benchmark analysis and write-up prepared with AI assistance.

**@⁠sagouindupm** on GitHub · 2026-11-25 11:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7161207384) Tested this PR (`f681125`) together with #824 (`9dae0a7`) on Windows 11 Pro (Intel i5-12400F, 32 GB RAM, NVIDIA GeForce RTX 3050 8 GB) under `--console series-s`, compared against the same local base (`9376fd6` + #188 + #518 + #610 + `VICTORY_LITE=1280x5120`, 20 window-title samples taken every ~10 s starting at 100 s): - **Baseline** (`bench_k0`): entered 3D draws (`926 draws`) at sample 10/20, peak frame time **2,357.9 ms/frame** (sample 17/20), ended at **234.3 ms/frame** (`2711 draws`, sample 20/20), interior walls intact. - **With #827 + #824 combined** (`bench_k1`): entered 3D draws (`965 draws`) at sample 2/20, max frame-time spike across all 20 samples dropped to **628.3 ms/frame** (zero multi-second spikes), and the last 5 samples stabilized at **211.9–225.8 ms/frame** (mean **218.5 ms/frame**, ~4.6 FPS; log peak **4.9 fps / 205.2 ms/frame**), interior walls intact. *(Note: #827 and #824 were measured together in the same build, so the speedup and spike reduction reflect their combined effect on 8 GB Windows hardware.)* AI-assisted: benchmark analysis and write-up prepared with AI assistance.
Author
Owner

@⁠npanu420 on GitHub · 2026-11-25 12:41 UTC · original

Data point on VICTORY_COPY_FAST=1, from an RTX 3070 8 GB + i9-9900X (Windows 11, Series S profile). This PR and #154 were merged onto ExoCalibra's d034ac1 (fork main f85101b), plus #809, #95 and #108.

The race your doc comment describes does happen in practice. In 1 of 3 launches with COPY_FAST=1, about 160 s in, during the first world frames:

unhandled exception 0xc0000005 at VCRUNTIME140.dll (memcpy) (read 0xa3b827240: reserved, never committed), length 0x378dc0, inside copy_mapped's fast branch.

The page passed the committed(src, len) check and was gone at the copy. There were no crashes in 7 launches without it.

Speed when it survives, median over world frames 60-400 (same build, single runs):

switches median latest frame preparing copies
defaults (DIRECT_COPY on) 277-295 ms ~190 ms ~32 ms / 81 MB
COPY_FAST=1 231-236 ms ~177 ms ~43 ms

So the fast path is worth about 50 ms here, but it needs fault-tolerant reads (or a guard against pages moving) before it can be on by default. Merging this PR alone (fast path off) already took our copies from 76 to about 32 ms a frame. Thanks!

(AI-assisted, Claude Code. No game data.)

**@⁠npanu420** on GitHub · 2026-11-25 12:41 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7162714019) Data point on `VICTORY_COPY_FAST=1`, from an RTX 3070 8 GB + i9-9900X (Windows 11, Series S profile). This PR and #154 were merged onto ExoCalibra's `d034ac1` (fork main `f85101b`), plus #809, #95 and #108. The race your doc comment describes does happen in practice. In 1 of 3 launches with `COPY_FAST=1`, about 160 s in, during the first world frames: `unhandled exception 0xc0000005 at VCRUNTIME140.dll (memcpy) (read 0xa3b827240: reserved, never committed)`, length `0x378dc0`, inside `copy_mapped`'s fast branch. The page passed the `committed(src, len)` check and was gone at the copy. There were no crashes in 7 launches without it. Speed when it survives, median over world frames 60-400 (same build, single runs): | switches | median | latest frame | preparing copies | |---|---|---|---| | defaults (`DIRECT_COPY` on) | 277-295 ms | ~190 ms | ~32 ms / 81 MB | | `COPY_FAST=1` | 231-236 ms | ~177 ms | ~43 ms | So the fast path is worth about 50 ms here, but it needs fault-tolerant reads (or a guard against pages moving) before it can be on by default. Merging this PR alone (fast path off) already took our copies from 76 to about 32 ms a frame. Thanks! (AI-assisted, Claude Code. No game data.)
Author
Owner

@⁠ofc0urse on GitHub · 2026-11-25 12:50 UTC · original

An A/B where this PR changed what reaches the screen, in case it helps narrow it down.

RTX 4060 Ti 8 GB (driver 621.24), i5-14400F, 32 GB, Windows 11, diagnostics build, --console series-s, VICTORY_TEXTURE_DROP_MIPS=1, VICTORY_TEXTURE_NO_WAIT=1, same automated walk into the first room, 13 minutes each. Both trees are f85101b + #610 + #802 + #798 + #834 + #823; the only difference is this PR's commits (5ff1ffb..0e2d5ab, clean cherry-picks).

with this PR without
textures picked by index, uploaded so far 18,402 (6,120 MB) 63,338 (27,235 MB)
still waiting 14,548 7,699
card in use / budget 4,962 / 7,181 MB 4,717 / 7,181 MB
settled ms/frame ~196 ~198

The card is well under budget in both, so room is not what holds the uploads back. In the captures with this PR the yard through the cell window has untextured ground, tables and chairs, and the cell stays dark; without it they are textured. On Series X the same pair gave 20,232 after 17 minutes with it against 48,803 after 10 minutes without.

I did not bisect inside the branch. My guess is 44694f4 (each view made once and copied into the slots that show it again) or the skip window, since both change which slots the by-index texture pass sees, but that is a guess.

🤖 Generated with Claude Code

**@⁠ofc0urse** on GitHub · 2026-11-25 12:50 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7162933631) An A/B where this PR changed what reaches the screen, in case it helps narrow it down. RTX 4060 Ti 8 GB (driver 621.24), i5-14400F, 32 GB, Windows 11, diagnostics build, `--console series-s`, `VICTORY_TEXTURE_DROP_MIPS=1`, `VICTORY_TEXTURE_NO_WAIT=1`, same automated walk into the first room, 13 minutes each. Both trees are `f85101b` + #610 + #802 + #798 + #834 + #823; the only difference is this PR's commits (`5ff1ffb`..`0e2d5ab`, clean cherry-picks). | | with this PR | without | |---|---:|---:| | textures picked by index, uploaded so far | 18,402 (6,120 MB) | 63,338 (27,235 MB) | | still waiting | 14,548 | 7,699 | | card in use / budget | 4,962 / 7,181 MB | 4,717 / 7,181 MB | | settled ms/frame | ~196 | ~198 | The card is well under budget in both, so room is not what holds the uploads back. In the captures with this PR the yard through the cell window has untextured ground, tables and chairs, and the cell stays dark; without it they are textured. On Series X the same pair gave 20,232 after 17 minutes with it against 48,803 after 10 minutes without. I did not bisect inside the branch. My guess is `44694f4` (each view made once and copied into the slots that show it again) or the skip window, since both change which slots the by-index texture pass sees, but that is a guess. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠npanu420 on GitHub · 2026-11-25 14:01 UTC · original

On the texture question above, a counter-point from a different tree. RTX 3070 8 GB, Series S, TEXTURE_NO_WAIT=1, without TEXTURE_DROP_MIPS.

The tree is ExoCalibra's d034ac1 + #809, #95, #108 + a port of #523 + fork main 0b0074e, with this PR and #154 merged or not. Six-minute runs, "textures picked by index" at the end:

uploaded so far waiting
without this PR (cand-7) 34,786 (16.9 GB) 16,215
with this PR (+#154) 38,120-44,678 (19.7-25.5 GB) 11,266-15,823

With this PR, the yard through the cell window is textured in our captures (ground, tables, chairs) and so is the window glass. So on this tree it does not starve the by-index pass.

Our tree has neither #610 nor TEXTURE_DROP_MIPS, and that may be the difference in yours: #610 changes which mips a slot's texture holds, and the view reuse in 44694f4 keys on the view.

(AI-assisted, Claude Code. No game data.)

**@⁠npanu420** on GitHub · 2026-11-25 14:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7164632148) On the texture question above, a counter-point from a different tree. RTX 3070 8 GB, Series S, `TEXTURE_NO_WAIT=1`, without `TEXTURE_DROP_MIPS`. The tree is ExoCalibra's `d034ac1` + #809, #95, #108 + a port of #523 + fork main `0b0074e`, with this PR and #154 merged or not. Six-minute runs, "textures picked by index" at the end: | | uploaded so far | waiting | |---|---:|---:| | without this PR (cand-7) | 34,786 (16.9 GB) | 16,215 | | with this PR (+#154) | 38,120-44,678 (19.7-25.5 GB) | 11,266-15,823 | With this PR, the yard through the cell window is textured in our captures (ground, tables, chairs) and so is the window glass. So on this tree it does not starve the by-index pass. Our tree has neither #610 nor `TEXTURE_DROP_MIPS`, and that may be the difference in yours: #610 changes which mips a slot's texture holds, and the view reuse in `44694f4` keys on the view. (AI-assisted, Claude Code. No game data.)
Author
Owner

@⁠LeonardoS11 on GitHub · 2026-11-25 17:11 UTC · original

Two things from carrying this PR on an RTX 3080 Ti (12 GB, 64 GB RAM), in case they are useful.

What VICTORY_TABLED_SKIP_FRAMES costs here. Series S profile, the first room standing still, one build (f85101b with this PR and others), 300 s a run:

VICTORY_TABLED_SKIP_FRAMES ms a frame heap buffer pass buffer slots looked at a frame
unset 132 38 ms 15,044
16 166 85 ms 36,608
2 165 87 ms 39,265

With the switch the per-draw tables the title rewrites every frame are mirrored again and become marks for the buffer pass, so that pass more than doubles: about 33 ms a frame. It is the same with a pass that looks only at marked slots (#467). I am not arguing against the switch — only giving the price on a machine where the crash is rare.

How often the crash shows without it. On 64 GB: once, the same 0xc0000005 at +0x23cf683, in a few dozen launches into the world; none in the last 40 or so. #959 says that address is the title's own watchdog, firing about 30 s after the submitting thread is stuck on a fence that never comes — so a stale slot would be one cause of it among others (anything that hangs or loses the card silently). With #959's bounded wait in, the log should name the cause the next time; I will add it here if it comes back.

(Runs by me on the hardware above; read from the logs and written with Claude Code.)

**@⁠LeonardoS11** on GitHub · 2026-11-25 17:11 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7169131970) Two things from carrying this PR on an RTX 3080 Ti (12 GB, 64 GB RAM), in case they are useful. **What `VICTORY_TABLED_SKIP_FRAMES` costs here.** Series S profile, the first room standing still, one build (f85101b with this PR and others), 300 s a run: | `VICTORY_TABLED_SKIP_FRAMES` | ms a frame | heap buffer pass | buffer slots looked at a frame | |---|---|---|---| | unset | 132 | 38 ms | 15,044 | | 16 | 166 | 85 ms | 36,608 | | 2 | 165 | 87 ms | 39,265 | With the switch the per-draw tables the title rewrites every frame are mirrored again and become marks for the buffer pass, so that pass more than doubles: about 33 ms a frame. It is the same with a pass that looks only at marked slots (#467). I am not arguing against the switch — only giving the price on a machine where the crash is rare. **How often the crash shows without it.** On 64 GB: once, the same `0xc0000005` at `+0x23cf683`, in a few dozen launches into the world; none in the last 40 or so. #959 says that address is the title's own watchdog, firing about 30 s after the submitting thread is stuck on a fence that never comes — so a stale slot would be one cause of it among others (anything that hangs or loses the card silently). With #959's bounded wait in, the log should name the cause the next time; I will add it here if it comes back. (Runs by me on the hardware above; read from the logs and written with Claude Code.)
Author
Owner

@⁠slauko on GitHub · 2026-11-26 15:39 UTC · original

The coalescing item in this PR, measured on a Linux/Wine line (RTX 3080 Ti, vkd3d-proton ec20719, uiliannn's base), in the cell at ~5,000 draws:

  • 34,282 watch::writes calls a frame — 18,887 answered from the journal, 16,395 by the kernel — 40.6–41.2 ms, and the copies 166–173 MB/17 ms for what the write watch named.
  • Of the pages the kernel's calls report: 4.6 million a frame (18 GB of address space) against 69,000 the journal names and ~203 MB actually copied. Most of what the watch reports as written was written long ago and its bits were never consumed.
  • With Batch::flush updating a copy's touching ranges in one pass instead of one pass per recorded range: 8,965 calls, 5.9–6.4 ms asking, 52–57 MB/5.9 ms copied, preparing 100–110 → 57–63 ms.
  • VICTORY_COPY_SAMPLE=1 on this line: 83–85% of the words sampled in those copies were already equal — the writes inside the named pages are sparse.

So the count is the lever, not the copy: 193 MB at 9.4–10.3 GB/s is 19–21 ms, the asking around it was 38–43.

**@⁠slauko** on GitHub · 2026-11-26 15:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7196582793) The coalescing item in this PR, measured on a Linux/Wine line (RTX 3080 Ti, vkd3d-proton `ec20719`, uiliannn's base), in the cell at ~5,000 draws: - **34,282 `watch::writes` calls a frame** — 18,887 answered from the journal, 16,395 by the kernel — 40.6–41.2 ms, and the copies 166–173 MB/17 ms for what the write watch named. - Of the pages the kernel's calls report: **4.6 million a frame** (18 GB of address space) against **69,000** the journal names and ~203 MB actually copied. Most of what the watch reports as written was written long ago and its bits were never consumed. - With `Batch::flush` updating a copy's touching ranges in one pass instead of one pass per recorded range: **8,965 calls, 5.9–6.4 ms asking, 52–57 MB/5.9 ms copied**, preparing 100–110 → 57–63 ms. - `VICTORY_COPY_SAMPLE=1` on this line: **83–85% of the words sampled in those copies were already equal** — the writes inside the named pages are sparse. So the count is the lever, not the copy: 193 MB at 9.4–10.3 GB/s is 19–21 ms, the asking around it was 38–43.
Author
Owner

@⁠slauko on GitHub · 2026-11-26 17:05 UTC · original

A correction to my numbers above, for the coalescing item: the merged run keeps the title on its prologue card.

  • 8,965 calls, 5.9-6.4 ms asking, 52-57 MB and preparing 57-63 ms were a prologue frame; with the change in, no run reached the cell (m66-m79: 3,000-3,100 draws on the prologue's card).
  • The pre-merge binary reaches the cell (m76: 4,976 draws, 209.8-214.8 ms); sorted, in recording order and capped at 4 MiB all do not.
  • With the merge out and the rest kept: cell 205.1 ms median (m80, 4,968-5,000 draws), asking 34.3-34.6 ms at ~34,000 calls.

So: coalescing the ~34,000 refreshes a frame is the right target (34 ms of asking), but merging the ranges changes something the intro's transition needs on this stack. A coalescing that keeps each range's own update (one asking ahead, many updates) would be the shape to try, not one update per merged span.

**@⁠slauko** on GitHub · 2026-11-26 17:05 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7198476464) A correction to my numbers above, for the coalescing item: **the merged run keeps the title on its prologue card.** - 8,965 calls, 5.9-6.4 ms asking, 52-57 MB and preparing 57-63 ms were a prologue frame; with the change in, no run reached the cell (`m66`-`m79`: 3,000-3,100 draws on the prologue's card). - The pre-merge binary reaches the cell (`m76`: 4,976 draws, 209.8-214.8 ms); sorted, in recording order and capped at 4 MiB all do not. - With the merge out and the rest kept: cell **205.1 ms** median (`m80`, 4,968-5,000 draws), asking 34.3-34.6 ms at ~34,000 calls. So: coalescing the ~34,000 refreshes a frame is the right target (34 ms of asking), but merging the ranges changes something the intro's transition needs on this stack. A coalescing that keeps each range's own `update` (one asking ahead, many updates) would be the shape to try, not one update per merged span.
Author
Owner

@⁠slauko on GitHub · 2026-11-26 18:03 UTC · original

Closing the coalescing item with the measurement from my line (Linux/Wine, RTX 3080 Ti, vkd3d-proton ec20719):

  • one asking per copy per submission (one GetWriteWatch for everything the submission refreshes of it, each range's update served from that answer, order unchanged): cell 193.7/200.3 ms against 205.1 (m80), the copies 20-22 ms for 156-167 MB against 55-60 for 170-180 — but one of the two runs is visibly broken (floating polygons, garbage geometry, black clipping on the character).
  • reverted (0360aad5); with the merged-range variant (34 ms of asking saved, title stays on its prologue card) four shapes of this lever are now measured and rejected. The asking stays per range, and the ~34 ms it costs are not reachable by moving or widening it.
**@⁠slauko** on GitHub · 2026-11-26 18:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/827#issuecomment-7200004124) Closing the coalescing item with the measurement from my line (Linux/Wine, RTX 3080 Ti, vkd3d-proton `ec20719`): - one asking per copy **per submission** (one `GetWriteWatch` for everything the submission refreshes of it, each range's update served from that answer, order unchanged): cell **193.7/200.3 ms** against **205.1** (`m80`), the copies **20-22 ms for 156-167 MB** against 55-60 for 170-180 — but one of the two runs is **visibly broken** (floating polygons, garbage geometry, black clipping on the character). - reverted (`0360aad5`); with the merged-range variant (34 ms of asking saved, title stays on its prologue card) four shapes of this lever are now measured and rejected. The asking stays per range, and the ~34 ms it costs are not reachable by moving or widening it.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • 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/827/head:github-bot/gh-827'
git switch 'github-bot/gh-827'

Merge

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