Hot title memory in VRAM (#772) with live ray tracing (#814): a third less copying #980

Open
github-bot wants to merge 25 commits from github-bot/gh-980 into main AGit
Owner

@⁠gangg111 on GitHub · 2026-11-25 14:36 UTC · original
gangg111:rt-772-vram-residents → main · +12618 −851 · 40 files · 25 commits · open

What

Pull request #772 by @⁠sirrus98 (title memory in place, hot memory kept in VRAM) merged on top of #905 (#814 live ray tracing on current main). With ray tracing on, the processor-side copy of title memory was most of the frame; with VICTORY_INPLACE=4 it drops by about a third.

This branch contains #905's merge commit, so it should go in after #905 (or instead of both). All credit for the in-place and resident work is @⁠sirrus98's, for the ray tracing @⁠staronthehorizon's; this resolves the merge and measures it with ray tracing.

How the conflicts were resolved

  • shadow.rs loose(): #814's version (writable windows, read-only windows in place) is kept. With VICTORY_INPLACE>=3 a window goes to its arena run first, as in #772, and writable asks take it too (the card writes the title's own bytes). Hot windows become residents (hot_window). retarget_tables runs before both tables are read.
  • memory.rs (SLOT_MEMORY directory): copies are Option, with #772's retarget to residents; renumbering also moves #814's dirty-page records to the new number. Directory offsets use entry_offset (the bias of memory in place), including the pages a new copy fills in.
  • inplace.rs place_for: the arena path (level 3 and up) comes before #814's late() guard, which stays for the older levels. place keeps #814's writable argument; #772's callers pass true.
  • xmem.rs: #814's lazy SEC_COMMIT chunks are kept. They are already committed sections, so VICTORY_INPLACE_POOL is not needed here. The section-gone hooks of both sides run (arena::title_memory_section_gone calls the in-place census one).
  • host.rs: flights carry both #814's memory_dirty and #772's in_place; the early-signal landing passes #814's new relay_card_back arguments.
  • pipeline.rs / draw.rs: threads and the store widths both kept; typed-store write-back by width plus mark_uav_dirty.
  • One test is now ignored: warp_committed_section_places_read_only_and_writable_and_promotes opens a section by its handle, which #772 refuses on purpose (commit kept until restart on NVIDIA). VICTORY_ALLOW_SECTION_HEAPS=1 still allows it.

Testing

Hardware: RTX 3080 10 GB, driver 621.01, no Resizable BAR, i9-12900K, 32 GB RAM, Windows 11.

  • cargo build --release: clean (2 dead-code warnings, as before).
  • cargo test --release --workspace -- --test-threads=1: everything passes except xtask repository_passes_policy, which flags emit/lower.rs over 512 KiB (from #814) and a local build directory, nothing from this merge.
  • In the game, --console series-s, VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82, same scene (the first cell):
processor copies frame
#905 200 to 235 ms 278 to 307 ms
this branch, VICTORY_INPLACE=4 135 to 155 ms 238 to 292 ms
  • The cell is lit as with #905; no device loss, no panic.
  • Residents: about 95 alive, 470 MB in video memory; per frame about 100 MB uploaded from arenas, 283 MB compared, 10 MB merged back.
  • Title memory in place without residents (windows and pool sections read over the bus, tried separately) was slower on this card: card time 30 to 55 ms became 145 ms, frame 368 ms. The VRAM copies are what makes it pay.

Known

  • One full run with the switch (a second one ended in the settings menu and is not counted); #772 notes that identical runs vary by up to 15%.
  • The card still waits about 140 ms a frame between submissions (VICTORY_CARD_TIME).

🤖 Generated with Claude Code

**@⁠gangg111** on GitHub · 2026-11-25 14:36 UTC · [original](https://github.com/fxceless/victory-fork/pull/980) `gangg111:rt-772-vram-residents` → `main` · +12618 −851 · 40 files · 25 commits · open ## What Pull request #772 by @⁠sirrus98 (title memory in place, hot memory kept in VRAM) merged on top of #905 (#814 live ray tracing on current `main`). With ray tracing on, the processor-side copy of title memory was most of the frame; with `VICTORY_INPLACE=4` it drops by about a third. This branch contains #905's merge commit, so it should go in after #905 (or instead of both). All credit for the in-place and resident work is @⁠sirrus98's, for the ray tracing @⁠staronthehorizon's; this resolves the merge and measures it with ray tracing. ## How the conflicts were resolved - **`shadow.rs` `loose()`**: #814's version (writable windows, read-only windows in place) is kept. With `VICTORY_INPLACE>=3` a window goes to its arena run first, as in #772, and writable asks take it too (the card writes the title's own bytes). Hot windows become residents (`hot_window`). `retarget_tables` runs before both tables are read. - **`memory.rs` (`SLOT_MEMORY` directory)**: copies are `Option`, with #772's `retarget` to residents; renumbering also moves #814's dirty-page records to the new number. Directory offsets use `entry_offset` (the bias of memory in place), including the pages a new copy fills in. - **`inplace.rs` `place_for`**: the arena path (level 3 and up) comes before #814's `late()` guard, which stays for the older levels. `place` keeps #814's `writable` argument; #772's callers pass `true`. - **`xmem.rs`**: #814's lazy `SEC_COMMIT` chunks are kept. They are already committed sections, so `VICTORY_INPLACE_POOL` is not needed here. The section-gone hooks of both sides run (`arena::title_memory_section_gone` calls the in-place census one). - **`host.rs`**: flights carry both #814's `memory_dirty` and #772's `in_place`; the early-signal landing passes #814's new `relay_card_back` arguments. - **`pipeline.rs` / `draw.rs`**: `threads` and the store widths both kept; typed-store write-back by width plus `mark_uav_dirty`. - One test is now ignored: `warp_committed_section_places_read_only_and_writable_and_promotes` opens a section by its handle, which #772 refuses on purpose (commit kept until restart on NVIDIA). `VICTORY_ALLOW_SECTION_HEAPS=1` still allows it. ## Testing Hardware: RTX 3080 10 GB, driver 621.01, no Resizable BAR, i9-12900K, 32 GB RAM, Windows 11. - `cargo build --release`: clean (2 dead-code warnings, as before). - `cargo test --release --workspace -- --test-threads=1`: everything passes except `xtask` `repository_passes_policy`, which flags `emit/lower.rs` over 512 KiB (from #814) and a local build directory, nothing from this merge. - In the game, `--console series-s`, `VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82`, same scene (the first cell): | | processor copies | frame | |---|---|---| | #905 | 200 to 235 ms | 278 to 307 ms | | this branch, `VICTORY_INPLACE=4` | 135 to 155 ms | 238 to 292 ms | - The cell is lit as with #905; no device loss, no panic. - Residents: about 95 alive, 470 MB in video memory; per frame about 100 MB uploaded from arenas, 283 MB compared, 10 MB merged back. - Title memory in place without residents (windows and pool sections read over the bus, tried separately) was slower on this card: card time 30 to 55 ms became 145 ms, frame 368 ms. The VRAM copies are what makes it pay. ## Known - One full run with the switch (a second one ended in the settings menu and is not counted); #772 notes that identical runs vary by up to 15%. - The card still waits about 140 ms a frame between submissions (`VICTORY_CARD_TIME`). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The tier-3 design (title memory as the GPU's own, one opened heap per
region) rests on driver limits nobody had measured on the card. This adds
the design's probes (inplace_probes.rs), run on a queue and memory of
their own, and a way to run them without the title:

  victory inplace-probe [--small] [--tiles] [--debug-layer] [--mb N]

and `cargo test -p victory-gpu -- --ignored probe_on_hardware`. In game,
VICTORY_INPLACE_PROBE=1 adds the small ones (P2-P6, R9) to the first probe,
now on a thread of its own; =3 also the ones that lock or commit gigabytes
(P1, P2's 4 GiB part, P7).

Measured on the RTX 4090 (debug layer on, no errors except where said):
- P1: 40 bits of GPU VA per resource and per process. Parts of 2 GiB,
  4095 MiB and 4 GiB - 64 KiB open (343/684/672 ms) with a buffer over
  all of it, written at its far end by copy and shader. 4 GiB and 6 GiB
  are refused by the runtime ("must point to a memory region that is 4GiB
  or less"). Committed sections of 2 GiB and 4095 MiB open (89/177 ms);
  6 GiB is refused ("hFileMapping must be 4GiB or less").
- P2: opening private memory locks it: 1 GiB 173 ms +1,024 MB working set,
  4095 MiB 695 ms +4,096 MB; no commit added; the heap goes in 16/68 ms. A
  committed section's pages count in the working set when opened (no
  more when the GPU reads them).
- P3: InterlockedOr/And from a compute shader into a part and a section
  are exact, a byte replaced by And+Or keeps the dword's other bytes, and
  a CPU writing byte 0 of the same dwords all along keeps its last byte
  (32 of 32) while the GPU's bits all land.
- P4: with a part opened, write watching still reports CPU writes
  exactly ([1, 5, 9] -> [1, 5, 9]) and reports none of the GPU's (copy and
  shader: []).
- P5: 512 parts of 64 KiB with a buffer each: 93 ms, none refused, gone in
  41 ms. Two overlapping parts: written through one, UAV barrier, read
  through the other in one list: right, and the CPU sees it.
- P6: a buffer in an opened heap works as vertex and index views, root
  CBV, typed SRV and raw UAV in a table, ExecuteIndirect arguments and
  count, CopyTextureRegion both ways, ResolveQueryData. One buffer used as
  copy source then destination in one list needs an explicit transition
  (implicit promotion is once per list: risk R8).
- P7: commit headroom 63,990 MB; a 6 GiB SEC_RESERVE section adds 0 MB,
  SEC_COMMIT adds 6,156 MB (whole or as six 1 GiB sections, both made at
  once); a 6 GiB section cannot be opened as one heap.
- R9: on pages of an opened part VirtualProtect read-only, MEM_DECOMMIT and
  MEM_RELEASE fail with error 87, also while only a buffer placed in the
  heap is alive; MEM_RESET and an unchanged protection succeed.
- tiles (--tiles, a device of its own): a reserved buffer's tile mapped
  onto a heap in the card's memory works; mapped into an opened heap the
  runtime removes the device (0x887a0001), as on the software adapter.

R9 (count only): with VICTORY_INPLACE_PROBE, VICTORY_INPLACE or
VICTORY_MEMORY_CALLS=1 the title's kernel32 VirtualFree, VirtualProtect
and VirtualAlloc(MEM_RESET) go through wrappers in xmem.rs that call the
host's functions unchanged and count (and log, first 16 and every power
of two) the calls that touch memory XMemVirtualAlloc reserved. Without the
switches the imports go to the host as before.

Tests: victory-gpu 111 passed, 2 ignored (probe_on_hardware, and the one
ignored before); victory-hle 96 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
The two bugs of the tier-3 design (§11), both only with VICTORY_INPLACE.

1. memory.rs (raw-address directory of the BVH builder) wrote each page's
   offset from the title memory's first byte and gave each numbered copy a
   view of `len` bytes from the buffer's start. A copy in place is a
   buffer that begins on the 64 KiB line below the title memory (or, with
   arenas, at the arena's base): every raw access was `bias` bytes off and
   the last `bias` bytes were cut off. The offset is now
   `Shadow::offset(page)` and the view `offset(start) + len` bytes
   (entry_offset, view_bytes).

2. Shader writes to memory in place were not declared at all
   (`Shadow::gpu_writes` returned early), so late wait and the relay could
   let a CPU read of that memory (a title buffer copy, a fill, a texture,
   a step of ours, a value wait) run before the flight that writes it.
   The range is now declared like a copy's; `declared_writes` leaves it
   out of the copy-back (nothing to copy back), and the new
   `in_place_writes` puts it in the flight (`Sent`/`Flight::in_place`) and
   in the line's `written`, which `late_blocked`, `relay_wait`'s
   `blocked_by` and `late_met` read, and which a landing recomputes from
   the flights still in the air.

With this VICTORY_INPLACE=2 (and the coming 3) may be combined with
VICTORY_LATE_WAIT / VICTORY_RELAY: they hold back reads of in-place
writes exactly as of copies' declared ranges, under the same assumption
(shaders write only what is declared) and the same shortcut (another host
copy of the same bytes is not told). The doc's "do not combine" is
replaced by that. Behaviour without VICTORY_INPLACE is unchanged (no copy
is in place, so no range takes the new path).

Tests (software adapter): memory::tests::
warp_raw_addresses_into_memory_in_place_take_the_bias (the directory
offset reads the page's own bytes, the view reaches the last byte);
host::in_place_tests::warp_in_place_writes_reach_the_flights (in-place
ranges come out of a submission's steps joined, a copy's do not).
victory-gpu: 113 passed, 2 ignored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
Stage 1 of the tier-3 design. Levels 1 and 2 open a heap of their own per
window or title buffer (`place_part`); level 3 opens one heap per region
the GPU reaches, an arena, with one buffer placed over all of it, and
every title buffer and window in it is that buffer at an offset
(`inplace::place_for` now returns a view: bias = start - arena base).

arena.rs:
- Parts of private title memory: only memory XMemVirtualAlloc committed
  (xmem reports it, `title_memory_committed`; nothing else, the Rust heap
  included, is ever opened). The runtime refuses a part of 4 GiB or more
  on the card (probe P1), so parts are at most 4 GiB - 64 KiB and a bigger
  region has overlapping parts every 2 GiB (P5: overlap works); a range
  takes the lowest part that holds it whole. Opened on first GPU use: at
  once up to VICTORY_ARENA_SYNC_MB (64, ~11 ms), else on a thread of its
  own (P2: 1 GiB locks in 173 ms), copies until then; a title buffer
  copied before its arena opened is let go at the next sweep when nothing
  holds it (`in_place_upgrade`), so the next ask finds it in place.
- Sections of the physical page pool made committed: view memory that is
  one run of one section is in place in the section's arena (the heap is
  the section; views come and go under it). Windows over view memory are
  the run around the ask (`inplace::run_window`): the census found 1,948
  MB of 4 MiB windows over views with unmapped pages, and the GPU never
  reads a view through a tile mapping (into an opened heap that removes
  the device: probe "tiles", on the card too).
- `resolve(addr, len)` gives resource, offset, GPU address, bytes left
  and kind (InPlace, Section). Budget: VICTORY_INPLACE_MB, by default a
  quarter of the PC's memory (opening locks pages: on this 96 GB PC 24
  GiB), scaled from the queried RAM.
- Free/protect (R9): the runtime's wrappers of the title's VirtualFree,
  VirtualProtect (other than read-write) and xmem's own release of 32-bit
  memory call `title_memory_released` first: the parts over the range are
  retired and what is in place in all of them let go, so the pages are no
  longer locked unless a list still holds the arena's buffer.
- Big buffers keep their copies in the card's memory
  (VICTORY_CARD_BUFFERS_*), as at level 2.

xmem.rs, VICTORY_INPLACE_POOL=1: the page pool is made of SEC_COMMIT
sections of VICTORY_POOL_SECTION_MB (1024; at most 4095: P1/P7 refuse a 6
GiB section as a heap) while the commit has room for the pool and 4 GiB
more (else reserved, as before, with a warning); `commit` does nothing for
a committed section; pages are slices of their chunk's section (`runs` and
mapping already break at sections). A closed section retires its arena.
Off, one reserved section as before.

The in-place line every ten seconds gains an arenas line: parts and
sections open, GiB locked against the budget, opened/refused/retired,
ranges resolved, MB of private and view memory placed in them.

Tests: arena::tests (parts of a region and the lowest that holds a range;
on the software adapter two title buffers resolve into one arena and the
GPU reads and writes their bytes there, retiring unlocks the pages; a run
of a committed section resolves at its section offset and the GPU's
write shows through the view), inplace::tests::
a_window_over_views_is_the_run_around_the_ask, and arena_on_hardware
(ignored; passes on the RTX 4090). victory-gpu 117 passed, 3 ignored;
victory-hle 96 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
In run inplace3-t3 (VICTORY_INPLACE=3) no part ever opened: the title
commits its 3.4 GB private region at 0xd00000000 in steps, with holes and
pages of other protections, and the arena asked for one part over the
whole region ("not private memory committed whole and read-write"); that
one refusal then turned down every range of the region. The pool run
(inplace3-pool-t3) worked: 8 sections open, 6.78 GiB locked, 6,011
windows (575 MB) and 80 title buffers in place, 2,018 MB of view memory
placed, median frame 233.8 ms against 285.5 ms for its control (-18%).

Parts come from runs of committed pages. `runs_of` asks Windows for the
runs of committed read-write private pages of a reported region, one
VirtualQuery per run. The runs are asked when first needed, and again
when the region changes or an opening finds the pages changed. A range is
in place when it lies in one run. Its part is the lowest of the run's
parts on the 2 GiB grid from the run's start (`grid_part`, at most
4 GiB - 64 KiB). An open part that holds the range is always taken
first. So when the title commits more and two runs join, ranges over the
join open a new, longer part beside the older ones, which stay for what
was placed in them until it is let go. A refusal is kept per part, not
per region, and a part refused because its pages changed is not kept at
all. The title's own kernel32 VirtualAlloc(MEM_COMMIT) in memory that
XMemVirtualAlloc reserved is reported too (xmem's wrapper).

Remaps. The pool run let 9,755 in-place windows go in three minutes
because the title remapped their pages. A placement in a section's arena
is now only marked when its pages are remapped. When it is next asked
for, it stays if its range is still the same run of the same section at
the same offset (`still_good`, `inplace::still_run`); otherwise it is let
go and placed again. Both outcomes are counted on the arenas line
(REMAPS: kept / placed again). Placements in private parts, and the
title's own frees and protects, still let go at once.

Why a range is turned down is now counted by kind (arena::Why):
- view memory not one run of a committed section;
- not memory the runtime reported committed;
- spans pages not committed;
- spans another protection;
- longer than a part of its run;
- over the budget;
- refused by the host;
- its arena still being opened.
The counts are given on the arenas line, so the census can be checked
against what placement does.

Off path: `host::in_place_writes` returns before any pass when
VICTORY_INPLACE is off, a closed section tells the arenas nothing below
level 3, and xmem's release of 32-bit memory asks nothing (no lock, no
VirtualQuery) unless the wrappers' switches are on. Everything else was
already behind a switch read once.

Tests:
- arena::tests::a_range_takes_the_lowest_part_of_its_run_that_holds_it
  (the grid; regions joined and cut).
- arena::tests::warp_runs_of_committed_pages_are_parts_of_their_own. A
  reservation is committed in two runs with a hole: a buffer in either run
  is placed in its run's part, and one over the hole is turned down. After
  the hole is committed and reported, a range over it gets a part of the
  joined run beside the older two. A range over a read-only page is turned
  down as another protection. The GPU reads the title's bytes through
  each part.
- shadow::remap_tests::warp_a_placement_in_a_section_outlives_a_remapping_
  to_the_same_pages.
- arena_on_hardware passes on the RTX 4090.
victory-gpu 119 passed, 3 ignored; victory-hle 96 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
A part or section bigger than VICTORY_ARENA_SYNC_MB is opened on the
arenas' thread. That thread read the bytes locked, opened the heap outside
the arenas' lock, and added the bytes only once it was open. So while a
4 GiB part was opening (695 ms on the card, probe P2), a second ask could
pass the same budget test, and both could be opened: VICTORY_INPLACE_MB
was not a bound. The same check-then-act class is open in fork PR #358's
place_for; it must not exist here.

Now the bytes are taken from the budget when the thread is asked
(Arenas::reserve, under the arenas' lock), and the slot remembers them
(Slot::Opening(bytes)):
- opened: they stay with the open part;
- refused by the host, or no host: given back when the thread lands it;
- retired (title_memory_released) or the section closed while it opens:
  given back then, and what the thread opens afterwards stays closed;
- over the budget at the ask: refused at once, and the refusal is kept,
  as a refusal by the thread was before.
Openings on the asking thread take the budget the same way, under the
same lock as before. The open functions no longer test the budget; their
callers do.

Arenas::committed now uses checked ends: a range reported at the top of
the address space is ignored instead of wrapping.

Tests: victory-gpu 120 passed, 3 ignored (was 119);
victory-hle 96 + 1 passed.
- arena::tests::warp_a_part_asked_of_the_thread_holds_its_budget (new).
  A second ask while the first part opens is refused for the budget. The
  thread's refusal gives the bytes back. A part retired while opening gives
  them back, and its late result stays closed. A part the thread opened
  keeps them, and resolves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
In run inplace3-pool the private arenas opened (2 parts, 3.29 GiB
locked, 287 MB placed), but 1,320 placements were turned down "its arena
still being opened": a part is opened at its first GPU use, and a part of
2.2 GB takes about 365 ms to open on the arenas' thread. Meanwhile every
buffer in it gets a copy, and keeps it.

With the switch (off by default; with arenas, VICTORY_INPLACE=3 or more),
a commit of graphics memory the runtime reports (title_memory_committed)
is asked of the arenas' thread at once (Arenas::ask_early), so its part is
usually open before the GPU first uses it:
- the parts are cut from the commit itself, every 2 GiB from its start
  and up to 4 GiB - 64 KiB each, as a run is cut (grid_part), so commits
  made in steps never open parts over each other; a range over two
  commits gets the part of its run at its first use, as before;
- commits of VICTORY_ARENA_SYNC_MB (64) or less are left to their first
  use, which opens them on the asking thread (about 11 ms);
- the budget (VICTORY_INPLACE_MB) is held from the ask on; over it,
  nothing is asked and the first use decides, as before;
- commits reported before the host is up wait for the first range
  resolved (the host is not made for them);
- a range in a part asked early that is still opening is turned down as
  opening, and residents wait for it (resolve_waiting), instead of asking
  for a second, overlapping part of the same run;
- title_memory_released waits (five seconds at most) for a part asked
  early over the range that is still opening: while it opens its pages
  are locked, and the title's decommit or protect would fail (R9).
Without the switch nothing is asked early, the set of parts asked early
stays empty, and resolving and releasing are as before.

Each ask is logged:
"arena: committed graphics memory asked of the arenas' thread as the
runtime reported it (VICTORY_ARENA_EARLY=1)" start=.. mb=..
followed by the opening line as before. The effect shows in the existing
turned-down counts ("its arena still being opened").

Tests: victory-gpu 130 passed, 4 ignored (was 129); victory-hle 96 + 1.
- arena::tests::a_commit_asked_early_is_opened_in_parts_of_its_own (new):
  a 5 GiB commit is asked as two parts (0, 4 GiB - 64 KiB) and (2 GiB,
  3 GiB) with their bytes held; a range held already, a small commit and
  one over the budget are not asked; a range in an opening part is turned
  down as opening without a new ask; a release over it sees it; landed or
  released, it is no longer waited for and its bytes are given back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
On the card's driver a section opened as a heap by its handle
(OpenExistingHeapFromFileMapping) keeps its commit until the PC restarts,
whether it is released in order or not: 256 MB kept in every case in
inplace::tests::section_heap_commit_comes_back (ignored; it runs on the
card). Opened through the address of a view of it
(OpenExistingHeapFromAddress1), none is kept. Every run with
VICTORY_INPLACE_POOL=1 left the pool's commit behind; after a few runs the
system's commit limit was reached.

An arena over a section now maps a view of the whole section of its own
(arena::SectionView) and opens the heap on it: an offset in the heap is the
offset in the section, and the title's views come and go over the same
pages as before. The view stays mapped while anything holds the heap
(arena::Heap holds both), and is unmapped 10 s after the last holder lets
go: a submission still in the air may hold the arena's buffer alone.

Opening by the handle stays possible for the probes with
VICTORY_ALLOW_SECTION_HEAPS=1; the probe line says why it is refused
otherwise.

Measured: the system's shared commit stays flat across runs (21.3 ->
21.4 GB after several runs with the pool), where it grew by the pool's
size every run before.

Tests: arena::tests::section_arena_on_hardware (ignored, on the card:
the commit comes back), warp_a_run_of_a_committed_section_is_in_place
through the same path.
With VICTORY_INPLACE=4 three compute passes that run once a frame took
1-6 ms of card time in the control and 19-67 ms with Tier 3 (timing runs
with VICTORY_GPU_TIMING; 5cf00dc3 3.3 -> 67 ms, cb6adcc6 5.6 -> 41.6 ms,
0a5ecfee 1.2 -> 19 ms). Their code is the same; what changed is where
they write: their buffer atomics go to tiny buffers (52 B, 480 B, 56 KB)
that were copies in system memory in the control and in place, in the
title's memory, with Tier 3. Shaders reach memory in place across the bus.

Title buffers smaller than VICTORY_INPLACE_MIN_KB (1024 by default, 0 for
no floor) now stay copies, as without VICTORY_INPLACE. Windows are not
affected. Such buffers are 42 MB in all (3,376 of them, 3,242 under
64 KiB), so copying them costs little.

Measured (RTX 4090, release, the same exe, the switches equal but this
one; inplace4 with VICTORY_CARD_TIME=1, 120 s after the world):

                          floor off    floor 1024 KiB   control (Tier 3 off)
  frame median            495.0 ms     234.6 ms         240.1 ms
  average fps             1.69         4.30             4.33
  title lists, card time  222-244 ms   100-129 ms       ~111-115 ms

The frame-rate line gets a placement census: title buffers and windows
apart, count and MB in a resident, in place (and of those under 64 KiB),
card copy and system copy; and the buffers the floor kept as copies.

Tests: inplace::min_tests (the default, 0 and bad settings).
Stage 1's pool run (VICTORY_INPLACE=3 VICTORY_INPLACE_POOL=1, per layer,
against its control) took the median frame from 285.5 to 233.8 ms. The
largest layers left are the copies of the big title buffers in the card's
memory (VICTORY_CARD_BUFFERS_MIN_MB=1, _MB=4096):
- the relay's copy-back, 115-127 ms a frame;
- 136-150 MB a frame still going up through staging in the PC's memory;
- 70 MB a frame fetched back;
- the copy engine at 0%.
Reading those buffers in place over the bus instead raised the GPU wait
from 81 to 103 ms: hot data belongs in the card's memory.

New crate::resident (design section 4). A title buffer that would get a
card copy, whose 64 KiB pages lie in an arena (a private part, or a run of
a committed section), becomes a resident:
- R, a buffer in the card's memory that shaders read and write;
- B, its twin.
The Shadow is R at a bias, as a placement is the arena's buffer at a bias,
so every binding path works unchanged.

Per submission, on the one host queue, each in an ExecuteCommandLists of
its own:
1. Upload. The pages the title wrote since they last went up (write
   watching or the guards, at the submission's refreshes:
   Resident::refresh) are copied arena -> R, then R -> B, whole pages.
   There is no CPU copy, no staging and no hash. A page the title wrote
   always goes up: no range is held back because a flight may write it
   (the #1322 class). Whole pages are safe: every earlier submission's
   merge has run on the queue when the copy runs.
2. The title's lists, and the card compare for copies that remain.
3. Merge (resident::MERGE), over the joined ranges the submission
   declared written. It compares R with B per dword. A dword that differs
   goes into the arena and into B: a plain store if all four bytes differ,
   else InterlockedAnd + InterlockedOr on the changed bytes, so the CPU's
   bytes of the same dword survive (probe P3).
Then the host fence is signalled as before. Title fences, events and
bottom-of-pipe writes still go out when the relay lands the flight; for a
resident it has nothing to fetch, compare or merge.

Removed for residents: the relay's fetch, card_merge(_relay), card_back,
snapshots and CARD_COMPARE hashing. They are not carded, and are left out
of declared_writes.

Their shader writes are still declared to the flights
(in_place_writes -> Line::written). So late wait and the relay hold back a
CPU read of them (a title buffer copy, a fill, a texture, a value wait)
until the flight has run. In-place memory and residents work with
VICTORY_LATE_WAIT / VICTORY_RELAY for that reason: their writes are
declared, as copies' are (f5725f4), instead of being kept away from late
waits.

Ordering (risk R8): no resource is a copy source and destination in one
list without an explicit transition. R goes COMMON -> COPY_DEST ->
COPY_SOURCE in the upload. The arena's buffer is only a copy source there,
and only unordered access in the merge. Separate ExecuteCommandLists make
buffers decay to common and flush the title's UAV writes to R before the
merge reads it.

Sharing. A buffer of any size inside a resident's pages is that resident
at its offset. Where two copies of the same memory still differ (a buffer
placed in the arena before the resident existed, or two residents over
the same pages), what one writes reaches the arena by the end of the
submission. Those pages are then marked to go up to the others before the
next submission (cross_mark), never to the writer.

Budget: VICTORY_RESIDENT_MB, R and B counted; by default 60% of the
adapter's local budget at the first ask, and each resident only while the
card's use stays under 80% of it, as card_for. The twin is made with R.
The first use of a big buffer opens its arena on that thread, or waits up
to 5 s for the arenas' thread (arena::resolve_waiting). Otherwise it would
keep a card copy for the run. A buffer not in an arena, an arena that
cannot be opened, or a spent budget keeps today's card copy.

Off path (VICTORY_INPLACE < 4): resident::on() is a OnceLock read. find
returns at once, submit records and runs nothing, sent and line return.
Behaviour is today's.

New line, with the frame-rate line:
residents (VICTORY_INPLACE=4): N alive, X MB in the card's memory and Y MB
of twins (budget Z MB); per frame: a MB uploaded from arenas in b ranges,
c MB compared in d merge passes, e MB merged into arenas (f partial
dwords), g MB marked to go up again after writes through other copies,
h submissions with work for residents

Tests: victory-gpu 126 passed, 4 ignored (was 120 and 3); victory-hle
96 + 1 passed. All new, in resident::tests:
- a_dword_takes_only_the_bytes_the_card_changed, pages_go_up_in_runs:
  the shader's byte mask and And/Or arithmetic, page runs, joins.
- warp_the_pages_the_title_wrote_go_up_from_the_arena (test a): write
  watching names exactly the pages the CPU wrote, and the upload brings
  them into R and B.
- warp_the_merge_stores_only_what_the_card_changed (test b), and
  merge_on_hardware (ignored; passes on the RTX 4090). Whole dwords are
  stored and partial dwords keep the title's other bytes. The CPU's byte
  0, written all along by another thread, survives. A byte only the CPU
  wrote stays. B takes R. Counts are 80 dwords, 64 of them partial.
- warp_a_merge_lands_before_the_next_upload_of_its_page (test c):
  submission 1's GPU dword is merged, the CPU writes a byte of the same
  page, and submission 2's upload carries both into R and B; its merge
  finds nothing.
- warp_a_buffer_outside_arenas_keeps_its_copy_and_nested_ones_share
  (test d): memory not reported committed gets no resident. One in an
  arena does, and a buffer in its pages shares it. Cross-marking marks the
  others and not the writer. forget unregisters.
The tests' title memory stays reserved to the end of the run. The
write-watch journal remembers pages, and a later test given the same
addresses failed (watch::tests::written_pages_are_reported_to_every_asker,
single-threaded).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
A title buffer shares a resident whose pages hold it (the previous commit).
But when an inner big buffer is used before the one around it, the outer
one got a resident of its own beside the inner one. Their bytes stayed in
step only between submissions (cross_mark), and the card's memory held
the overlap twice.

Now a big buffer whose pages no resident holds, but which overlaps
residents, gets one resident over all of them (resident::make_over), if
that lies in one arena within the budget; else one over its own pages, as
before. The new resident takes their places in the registry, and lookup
lets go of the title buffers whose shadows are in a replaced resident, so
their next ask finds the new one. A replaced resident stays alive for the
lists and descriptor slots that still hold it, and keeps receiving the
title's pages and the other copies' writes until they let go.

resident::find now returns Found { resident, bias, replaced }.

Tests: victory-gpu 127 passed, 4 ignored (was 126); victory-hle 96 + 1.
- resident::tests::warp_overlapping_residents_become_one (new). Residents
  over pages 1 and 5 are made first. A buffer over pages 0..3 replaces the
  one over page 1, and its pages find the new resident. One over 2..6
  joins the two remaining into 0..6. A write through the new one marks
  the replaced one's page.
Thirteen runs of the whole victory-gpu suite in a row passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
This is the fence part of the design's Stage 3. It is behind its own
switch and works only with VICTORY_INPLACE=4 and the relay.

With residents and memory in place, a flight's shader writes are in the
title's memory when the host fence reaches it. The card put them there in
the submission, and its writes to an arena's write-back pages are seen by
the CPU once the fence completes. Such a flight has nothing for the relay
to fetch, compare or merge (Flight::covered: no ranges of copies in the
PC's memory, no pieces of copies in the card's memory). But relay_land
lands every flight the card has run in one go, the copy-back of all of
them first. So a covered flight's fence signals, events and bottom-of-pipe
writes waited for the copy-back of the flights after it.

With the switch, a landing first tells the title about the flights ahead
of the first one that still has a copy-back, with what follows each of
them: read-backs, bottom-of-pipe writes, fence signals (told_ahead). The
rest is landed as before. The line's order is kept: nothing behind a
flight with a copy-back is told before that copy-back, a covered flight
behind it included. Flights that still carry copy-back keep today's
behaviour. The telling is one method for both parts (Host::relay_tell).

Measured with the relay, switch on or off, in a new line after the relay
line:
title fence signals set by the relay per frame: N, X ms on average after
it took their flights from the card (the longest Y ms); M flights told
before the copy-back of later ones (VICTORY_EARLY_SIGNAL=1: now on|off)
The time is from the relay taking the landed flights, which is when it
saw the host fence reach them, to each fence signal.

Not done here (the rest of Stage 3): the present still settles, settle
points are as they were, the submission lock is not narrowed, and CBVs
are not bound as SRVs.

Tests: victory-gpu 128 passed, 4 ignored (was 127); victory-hle 96 + 1.
- host::relay_tests::covered_flights_are_told_before_the_copy_back_of_later_ones
  (new). With landable: a covered flight and what follows it go as soon
  as the card has run it. In a landing of three, the flight with a
  copy-back and the covered one behind it wait. A landing that starts with
  a copy-back tells nothing ahead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
In-game Stage 1 (release, VICTORY_INPLACE=3 with and without
VICTORY_INPLACE_POOL=1, against controls first and last) moved the CPU
side as designed:
- preparing: 89.5 -> 79.9 / 75.2 ms;
- buffer copies: 41.6 -> 36.9 / 28.6 ms;
- snapshots compared: 23.7 -> 17.7 / 8.8 MB.
The card pays. With the pool, its waits went 79.5 -> 106.2 ms, the bus
3.5 -> 4.8 GB/s, and the card's shared memory 5.7 -> 14.3 GB: shaders read
the windows in place, sections of the pool above all, over the bus every
frame.

So at level 4, a window outside buffers that is in place, of the size of a
buffer that would get a copy in the card's memory (VICTORY_CARD_BUFFERS_MIN_MB)
or more, becomes a resident once it is asked for in
VICTORY_RESIDENT_HOT_FRAMES frames running (3 by default; frames more than
8 apart start the count anew). This holds for private windows and for runs
of committed sections alike. The window table hands out the resident from
then on. The window in place stays for the lists and slots that hold it;
cross-marking keeps the two in step. A resident's pages go up as any
resident's do, and a remap that changes a section run lets it go, as a
placement is let go. Windows that only ever get a single ask stay in
place, and a resident is attempted once per window.

The heat is two counters on the shadow, read and written only on the
level-4 path. Below it, hot_window returns at once.

Tests: victory-gpu 129 passed, 4 ignored (was 128); victory-hle 96 + 1.
- shadow::heat_tests::a_window_is_hot_in_the_third_frame_running (new):
  asks in one frame count once; a window becomes hot once; a gap of more
  than 8 frames starts anew.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
Stage 2 is measured by layers, and two of them had no number: how many
windows in place became residents for being hot (ff5832c), and how many
big buffers asked for a resident and got none, so kept a copy in the
card's memory (or stayed in place) and with it the relay's copy-back.
The second says directly whether the copy-back can go away: a covered
flight (Flight::covered) has nothing to fetch, compare or merge, and only
buffers that are not residents still bring a copy-back.

Checked on the way (no change needed): a resident has no card plan, no
snapshot, nothing pending and no back ranges (Shadow::in_place is true
for it: declared_writes leaves it out, writing returns before snapshots,
update only notes pages for the upload), so a flight whose writes are all
in residents or in place is covered, and the relay neither fetches nor
merges anything on the CPU for it.

The residents' line (new in this branch, VICTORY_INPLACE=4 only) ends
with two counts since the start:
"...; since the start N hot windows in place handed residents and M asks
for a new resident turned down (not in an arena, or over a budget)"
No other line changes.

Tests: victory-gpu 129 passed, 4 ignored; victory-hle 96 + 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
Stage 2 measured in game (RTX 4090, release @a7aff1a, VICTORY_INPLACE=4,
run 20261125-011526-inplace4-s2) ran 3x slower than the control: median
753 ms (control 267, Stage 1 247), the card 94% busy, 686 ms a frame on the
GPU against 100 in the control. Residents line:
"574.1 MB compared in 82 merge passes, 38.59 MB merged into arenas
(3093758 partial dwords)", i.e. some 10 million dwords merged a frame.
nvidia-smi showed the card at 87-100% SM with the bus nearly idle
(0.5 MB/s .. 4.7 GB/s) and less power than the control: the card was
waiting on the bus, not working.

The cause is the merge's layout. A thread took 16 bytes, so each store of
a group of 64 threads was 64 dwords 16 bytes apart, and every store and
atomic into the arena (the title's memory, over the bus) went as a
scattered partial write. On the card, 16 MB changed in every dword took
167 ms to merge whole and 327 ms in part (about 100 and 50 MB/s). Now a
group covers 1 KiB as four rows of 64 dwords side by side (the same 1 KiB
per group, so dispatches are unchanged): 0.7 and 1.6 ms. The partial-dword
atomics turn out cheap once they are in rows, so they stay (they keep the
CPU's bytes of a dword written while the merge runs, probe P3).

Checked on the way (no change): the 3.1 M partial dwords a frame are not a
stale twin. B is R as the submission's shaders found it (B <- R after
every upload, B <- R for each merged dword), so a partial mask is a dword
the shaders stored whole with some bytes unchanged (small integers, floats
whose high bytes stay). Their merge must not overwrite the other bytes, as
the CPU may have written them; at bus speed that costs 1.6 ms per 4 M.
The compare (574 MB a frame) reads R and B in the card's memory only: about
1 GB of reads a frame, a millisecond or so; the control's card hashes read
17,388 pieces of 64 KiB a frame (1.1 GB). Not a cost worth narrowing.

Expected in game: the card's time back near the control's, the residents
line unchanged in its counts (same bytes compared, merged and partial).

Tests: victory-gpu 130 passed, 5 ignored (was 130 / 4);
victory-hle 96 + 1.
- resident::tests::merge_on_hardware_runs_at_bus_speed (new, ignored: opens
  the card): 16 MB changed whole and in one byte per dword, merged with the
  right counts and the title's memory equal to R, each under 20 ms (0.7 and
  1.6 ms here; the old layout fails it at 167 and 327 ms).
- merge_on_hardware, warp_the_merge_stores_only_what_the_card_changed and
  warp_a_merge_lands_before_the_next_upload_of_its_page pass unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
Stage 2 in game (RTX 4090, release @a7aff1a, run
20261125-011526-inplace4-s2): "202.1 MB uploaded from arenas in 187
ranges ... 196.2 MB marked to go up again after writes through other
copies" per frame. Almost all that went up from the arenas over the bus
was cross-marking, not the title's writes.

Cross-marking (resident::cross_mark) sends up to a resident what another
copy of the same memory wrote in the submission: a buffer or window in
place in the arena (written by shaders directly), or another resident
whose merge wrote the arena (one replaced by a union and still held). It
rounded every declared range out to whole 64 KiB pages. But the title
wrote none of those bytes (its writes go up by write watching, whole
pages, in Resident::refresh, unchanged), so only the bytes the other
copy's shaders may have written can differ from the resident; the rest of
each page went up again for nothing. They now go up on 256 bytes: the
declared range widened to 256, cut at the resident's end. A whole page
held by the arena is no fresher than these bytes of it: the arena holds
the other copy's writes and the title's alike.

Which of the other copies does the writing could not be told from the
line, so it says it at the end (new fields only, the line's other words
unchanged):
"...; of the bytes marked per frame, X MB after writes in place and Y MB
after merges of other residents over the same memory"
X is buffers and windows in place in an arena over a resident's pages
(windows outside buffers looked up by other keys than the hot one that
became the resident, and buffers placed before a resident took their
pages: the tables keep handing those out); Y is residents a union
replaced that something still holds.

Expected in game: "marked" and "uploaded" fall by what the declared ranges
leave of their pages (unknown: 196 MB if they were all whole pages of
4 MiB windows, much less for small ranges); compared, merged and partial
unchanged.

Tests: victory-gpu 130 passed, 5 ignored; victory-hle 96 + 1.
- warp_a_buffer_outside_arenas_keeps_its_copy_and_nested_ones_share:
  a merged write of 8 bytes goes up to the other resident as 256 bytes,
  not its page; a write in place across a 256-byte line takes both units
  in both residents; one at a resident's end stops there; the two kinds
  are counted apart.
- warp_overlapping_residents_become_one: a write through the union goes up
  to the replaced resident as 256 bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SZC5U8SHMXUK5wS4AS2KxT
Stage 2 (VICTORY_INPLACE=4) latency work, behind the same switch; nothing
changes without it.

Card time (VICTORY_CARD_TIME=1, new cardtime.rs): timestamps around our
uploads to residents, the title's lists and the merge, read back each
submission. The frame-rate line says per frame: "upload to residents X ms,
title lists Y ms, merge Z ms, between our calls ..., from one submission's
end to the next one's start ...". Measurement switches that take one part
of the residents' work away, to time it: VICTORY_RESIDENT_PLAIN_STORES,
VICTORY_RESIDENT_NO_CROSS, VICTORY_RESIDENT_NO_MERGE.

Merge by store width (B5). The translator now tells, per pipeline, the
narrowest store its shaders make (pipeline::StoreWidth); it goes with each
declared write (shadow::writer, Step::GpuWrite, resident::Declared). Where
only whole-dword stores write a resident, the merge stores whole dwords;
elsewhere it keeps the atomics that leave the CPU's bytes of a dword alone.
VICTORY_RESIDENT_PARTIAL = flag (default) | atomics | cas | load | plain
picks the way for partial dwords. Merge card time: 165 -> ~10 ms a frame.

One owner per title range (B1; VICTORY_RESIDENT_ONE_OWNER=0 turns it off).
Residents that overlap were made into a union, but buffers still holding
the old ones kept them alive, taking uploads and merges every submission.
Now:
- make_over fails closed;
- resident::retargeted keeps the set of replaced residents and a generation;
- shadow::retarget_tables lets both tables' copies of unregistered residents
  go before an ask;
- HostHeap::mirror remakes descriptor slots that show a replaced buffer;
- the heap-pass cache and memory.rs's numbering follow;
- prepare releases what finished lists held first.
In game: zombies 0, overlap 0, re-uploads 199 -> 24 MB a frame.

Draw-time probes:
- VICTORY_PROBE_PIPELINES=<hashes> logs each probed pipeline's views
  (where each copy lives, Shadow::describe) and its store and atomic counts
  (Translated::store_counts);
- diagnostic timing runs tag commands +R/+W/+S;
- VICTORY_GPU_TIMING_TOP sets how many pipelines are listed;
- the slot-mismatch counter is split by kind.

Tests: victory-gpu 137 passed, 8 ignored (serially): merge with the CPU
writing for each partial way, overlap and retargeting.
With residents on, every bound slot was checked against its view's copy
(HostHeap::shows takes the heap's lock, once per view of every draw), and
every view set the +R/+W/+S tag bits, in every build and run. These are
measuring tools; they now run only with VICTORY_DRAW_PROBES=1 or when
VICTORY_PROBE_PIPELINES names pipelines. Off, the residents' line counts
no mismatched slots (0).
Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Gemini 4 Neon <[email protected]>
Conflicts resolved toward main for the indirect draw path: indirect.rs is
main's (pull request #220 windows, off by default), and HostList::budget /
indirect_scratch are main's, so #814's sub-allocated scratch and barrier
skipping are not in. Everything else of #814 is: ray-tracing and wave32
translation, view addresses, SLOT_MEMORY dirty pages, gpu_copy_from_shadow,
lazy physical pages, texture drop-mips, Series S overlay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#772 by sirrus98: arenas over title memory (VICTORY_INPLACE=3), residents
in video memory with a GPU merge (VICTORY_INPLACE=4). Conflicts with #814:
- shadow.rs loose(): #814's writable windows kept; with INPLACE>=3 windows
  go to their arena run (also for writable asks) and hot ones to residents.
- memory.rs (SLOT_MEMORY directory): copies become Option, retarget to
  residents (#772) also renumbers #814's dirty pages; offsets take the
  bias of memory in place (entry_offset).
- inplace.rs place_for: arenas at level >= 3 ahead of #814's late() guard.
- xmem.rs: #814's lazy SEC_COMMIT chunks kept (already committed, so
  VICTORY_INPLACE_POOL is not needed); both section_gone hooks called.
- host.rs: flights carry both memory_dirty and in_place.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts: copystat/watch take main's new lines and keep is_write_watched
(#814); lib.rs keeps both cardtime (#772) and cardmeter (main);
VICTORY_CARD_REHASH_RUNS follows main (off by default, 1 or alt); the
relay's parallel merge (#814) reports through main's copy_back(); present
keeps #814's overlay plane and main's frame log (a present held behind a
queue passes no overlay). descriptor/host.rs gets main's record_print,
sync_tables and COPIED_TABLED, which its mirror_copied_page needs.

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

@⁠gangg111 on GitHub · 2026-11-25 15:10 UTC · original

Merged current main (a253706, 0b0074e) into the branch; conflicts in copystat, watch, lib and host resolved (main's VICTORY_CARD_REHASH_RUNS default, copy_back() and frame log taken; #814's overlay plane kept, but a present held behind a queue passes no overlay). descriptor/host.rs needed main's record_print, sync_tables and COPIED_TABLED. Workspace tests pass. Rerun in the game with the same switches and VICTORY_INPLACE=4: cell lit, 260 to 290 ms a frame, 0 draws dropped, no device loss.

**@⁠gangg111** on GitHub · 2026-11-25 15:10 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7166424811) Merged current main (a253706, 0b0074e) into the branch; conflicts in copystat, watch, lib and host resolved (main's VICTORY_CARD_REHASH_RUNS default, copy_back() and frame log taken; #814's overlay plane kept, but a present held behind a queue passes no overlay). descriptor/host.rs needed main's record_print, sync_tables and COPIED_TABLED. Workspace tests pass. Rerun in the game with the same switches and VICTORY_INPLACE=4: cell lit, 260 to 290 ms a frame, 0 draws dropped, no device loss.
Author
Owner

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

Tested this branch as published (pr-980 head) on an RTX 3070 8 GB + i9-9900X, Windows 11, Series S, with the switches from your description plus BAKE_TEXTURES_MS=0.

With both parts on (BVH_BUILDER=1 BVH_QUARANTINE=0 CARD_FETCH_INFLIGHT=1 TEXTURE_DROP_MIPS=1 TEXTURE_ROOM_PERCENT=82 INPLACE=4): it crashes during loading, about 110 s in, 2 of 2 launches (cold and warm pipeline cache):
0xc0000005 at <title image>+0x23cf683 (write 0x0).

Each part alone does not crash:

switches result
ray tracing only (as above, without INPLACE=4) no crash; ~914 ms/frame median, preparing 658 ms, copy-back 268 ms, 0 dropped draws
INPLACE=4 without the builder no crash; ~407 ms/frame

So the crash needs the resident/in-place memory and live ray tracing together, at least on an 8 GB card. It may be memory: the title's own null write often follows a failed allocation, and 8 GB with ROOM_PERCENT=82 is tight. On this card, ray tracing alone is about 1 fps for now.

For reference, the same machine runs at ~188-220 ms/frame in steady play with the BVH off, using #917's VICTORY_AMBIENT=0.6 as a stand-in for the bounce light.

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

**@⁠npanu420** on GitHub · 2026-11-25 15:17 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7166602316) Tested this branch as published (`pr-980` head) on an RTX 3070 8 GB + i9-9900X, Windows 11, Series S, with the switches from your description plus `BAKE_TEXTURES_MS=0`. **With both parts on** (`BVH_BUILDER=1 BVH_QUARANTINE=0 CARD_FETCH_INFLIGHT=1 TEXTURE_DROP_MIPS=1 TEXTURE_ROOM_PERCENT=82 INPLACE=4`): it crashes during loading, about 110 s in, 2 of 2 launches (cold and warm pipeline cache): `0xc0000005 at <title image>+0x23cf683 (write 0x0)`. **Each part alone does not crash:** | switches | result | |---|---| | ray tracing only (as above, without `INPLACE=4`) | no crash; **~914 ms/frame** median, preparing 658 ms, copy-back 268 ms, 0 dropped draws | | `INPLACE=4` without the builder | no crash; ~407 ms/frame | So the crash needs the resident/in-place memory and live ray tracing together, at least on an 8 GB card. It may be memory: the title's own null write often follows a failed allocation, and 8 GB with `ROOM_PERCENT=82` is tight. On this card, ray tracing alone is about 1 fps for now. For reference, the same machine runs at ~188-220 ms/frame in steady play with the BVH off, using #917's `VICTORY_AMBIENT=0.6` as a stand-in for the bounce light. (AI-assisted, Claude Code. No game data.)
Author
Owner

@⁠Proudnoob4 on GitHub · 2026-11-25 16:19 UTC · original

Tested rt-772-vram-residents (8685f5b) on an RTX 4080 16 GB (Windows 10, i5-13600K, 32 GB RAM, driver 621.01, Series X profile; local Agility SDK opt-in only for Win10 loading).

1. Shader / BVH pipeline check (VICTORY_HOST_WAVE=32)

  • XboxBvhBuilder.dll: 52 / 52 compute pipelines translated and created.
  • shaders.rpf: 2,682 / 2,682 compute pipelines, 14,199 / 14,247 VS+PS, and 8,762 / 8,765 mesh pipelines created.

2. In-game runs (VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_INPLACE=4 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82)

  • Cold -> Warm (rt980_x, 600 s; rt980_warm2, 400 s):
    • Stable: both runs completed their full duration with no device loss.
    • BVH builder active: the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53, dropped 0 without a host pipeline (0 being made).
    • Warm world performance (rt980_warm2): 2.00 fps / 490.2 ms median (4,874–4,951 draws/frame; preparing 367–406 ms with copies 212–230 ms / ~158 MB; VICTORY_CARD_TIME: title lists 167–170 ms, upload to residents 9.5–10.1 ms, merge 14.6–19.6 ms, from one submission's end to the next 276–331 ms).
    • Residents (VICTORY_INPLACE=4): 124 alive (747 MB / 9,168 MB budget), ~193–203 MB uploaded from arenas, ~480 MB compared in ~110 merge passes, ~31 MB merged back; 0.0 view mismatches. Note the default 1/4 RAM arena cap (8,127 MB on 32 GB) filled (8071 MB locked of 8127 MB, 16 arenas fell back to copies).
    • Visuals (frame-2150, frame-2300): prison cell, HUD prompt, hair, and yard inmates render cleanly, though the bottom-edge blocky artifact from f85101b is still present.

3. Failure mode when adding VICTORY_ASYNC_SUBMIT=1 VICTORY_QUEUE2=1 VICTORY_INPLACE_MB=16384

  • rt980_warm hit DXGI_ERROR_DEVICE_HUNG (0x887A0006) at 168 s right after registering two 4 MB VICTORY_INPLACE=4 residents (start=0xd86400000 and 0xd77000000), so INPLACE=4 + ASYNC_SUBMIT/QUEUE2 is not yet safe together.

Tested with AI assistance (Gemini 4 Hydrogen).

**@⁠Proudnoob4** on GitHub · 2026-11-25 16:19 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7167794470) Tested `rt-772-vram-residents` (`8685f5b`) on an RTX 4080 16 GB (Windows 10, i5-13600K, 32 GB RAM, driver 621.01, Series X profile; local Agility SDK opt-in only for Win10 loading). ### 1. Shader / BVH pipeline check (`VICTORY_HOST_WAVE=32`) - `XboxBvhBuilder.dll`: **52 / 52** compute pipelines translated and created. - `shaders.rpf`: **2,682 / 2,682** compute pipelines, **14,199 / 14,247** VS+PS, and **8,762 / 8,765** mesh pipelines created. ### 2. In-game runs (`VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_INPLACE=4 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82`) - **Cold -> Warm (`rt980_x`, 600 s; `rt980_warm2`, 400 s):** - **Stable:** both runs completed their full duration with no device loss. - **BVH builder active:** `the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53`, `dropped 0 without a host pipeline (0 being made)`. - **Warm world performance (`rt980_warm2`):** **2.00 fps / 490.2 ms** median (4,874–4,951 draws/frame; `preparing` 367–406 ms with `copies` 212–230 ms / ~158 MB; `VICTORY_CARD_TIME`: `title lists` 167–170 ms, `upload to residents` 9.5–10.1 ms, `merge` 14.6–19.6 ms, `from one submission's end to the next` 276–331 ms). - **Residents (`VICTORY_INPLACE=4`):** 124 alive (747 MB / 9,168 MB budget), ~193–203 MB uploaded from arenas, ~480 MB compared in ~110 merge passes, ~31 MB merged back; `0.0` view mismatches. Note the default `1/4` RAM arena cap (`8,127 MB` on 32 GB) filled (`8071 MB locked of 8127 MB`, 16 arenas fell back to copies). - **Visuals (`frame-2150`, `frame-2300`):** prison cell, HUD prompt, hair, and yard inmates render cleanly, though the bottom-edge blocky artifact from `f85101b` is still present. ### 3. Failure mode when adding `VICTORY_ASYNC_SUBMIT=1 VICTORY_QUEUE2=1 VICTORY_INPLACE_MB=16384` - `rt980_warm` hit `DXGI_ERROR_DEVICE_HUNG` (`0x887A0006`) at 168 s right after registering two 4 MB `VICTORY_INPLACE=4` residents (`start=0xd86400000` and `0xd77000000`), so `INPLACE=4` + `ASYNC_SUBMIT`/`QUEUE2` is not yet safe together. *Tested with AI assistance (Gemini 4 Hydrogen).*
Author
Owner

@⁠Zayfway on GitHub · 2026-11-25 16:26 UTC · original

Tested pr-980 head (9156270) on a 12 GB card with 16 GB of RAM, to separate VRAM from host memory in the crash @⁠npanu420 saw. AI-assisted (Claude Code); every number below is from this machine.

Machine: RTX 3060 12 GB (driver 610.88, 32-lane), Ryzen 7 5700X, 16 GB RAM, system-managed pagefile (commit limit ~32 GB), Windows 11 26300, Series X profile, warm shader cache (translate --warm all: 25,707 translated, 278 do not).

1. The head does not build with diagnostics

cargo build --profile diag -p victory --features diagnostics fails:

error[E0599]: no variant ... named `WatchFailed` found for enum `C`   (copystat.rs:1283)
error[E0599]: no variant ... named `WatchKnownView` found for enum `C` (copystat.rs:1284)

The merge kept main's two reads of these counters but dropped their declarations, along with the add in watch::writes that fills them. Putting the two variants back after IndirectBounded in enum C (as on main 0b0074e) makes it build. The counters then read 0 until the watch.rs side comes back.

2. In the game (diag build, same scene: opening cutscene, measured from world +60 s)

ray tracing on (#814's set + LEVELS_ON_DEMAND=1) same build, builder off
builder runs ... pipelines=53 off
frame 1,797 ms median (0.57 fps); GPU 971 ms, preparing 574 ms (copies 448 ms) 1,042 ms median (1.05 fps)
host copies of title memory 6.6 GB 4.0 GB
VRAM, max 8.5 GB of 12 8.8 GB of 12
end world +146 s: no shared buffer error=0x8007000E size=4194304; 3 s later an access violation in nvwgf2umx.dll (read 0x36) under Host::submit → ExecuteCommandLists world +~5 min: the title stops on a breakpoint (0x80000003) with 1.3–1.8 GB of commit left

So on this machine the limit is host commit, not VRAM. The card kept 3+ GB free in both runs, and the first failure is a 4 MB shared (system-memory) buffer. That fits npanu420's "needs both parts together" on 8 GB: ray tracing adds ~2.6 GB of host copies, and the in-place/resident part adds its own. I did not prove that the failed buffer is what the driver tripped on. The callers handle None, so this is a correlation, not a traced cause.

For reference, on the same machine main at 0b0074e (ASYNC_SUBMIT QUEUE2 TEXTURE_NO_WAIT COPY_PLAIN LEVELS_ON_DEMAND) ran 6 world runs without a crash, at 2.1–2.3 fps and 22–25 GB private.

Not tested: VICTORY_INPLACE=4 together with the builder (it would only add host memory here), Series S, a larger pagefile. The two runs above do not reach the lit cell, so I cannot say anything about the picture with ray tracing on this card yet.

**@⁠Zayfway** on GitHub · 2026-11-25 16:26 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7167978535) Tested `pr-980` head (`9156270`) on a 12 GB card with **16 GB of RAM**, to separate VRAM from host memory in the crash @⁠npanu420 saw. *AI-assisted (Claude Code); every number below is from this machine.* **Machine:** RTX 3060 12 GB (driver 610.88, 32-lane), Ryzen 7 5700X, **16 GB RAM**, system-managed pagefile (commit limit ~32 GB), Windows 11 26300, Series X profile, warm shader cache (`translate --warm all`: 25,707 translated, 278 do not). ### 1. The head does not build with diagnostics `cargo build --profile diag -p victory --features diagnostics` fails: ``` error[E0599]: no variant ... named `WatchFailed` found for enum `C` (copystat.rs:1283) error[E0599]: no variant ... named `WatchKnownView` found for enum `C` (copystat.rs:1284) ``` The merge kept main's two reads of these counters but dropped their declarations, along with the `add` in `watch::writes` that fills them. Putting the two variants back after `IndirectBounded` in `enum C` (as on main `0b0074e`) makes it build. The counters then read 0 until the `watch.rs` side comes back. ### 2. In the game (diag build, same scene: opening cutscene, measured from world +60 s) | | ray tracing on (#814's set + `LEVELS_ON_DEMAND=1`) | same build, builder off | |---|---|---| | builder | `runs ... pipelines=53` | off | | frame | **1,797 ms** median (0.57 fps); GPU 971 ms, preparing 574 ms (copies 448 ms) | 1,042 ms median (1.05 fps) | | host copies of title memory | **6.6 GB** | 4.0 GB | | VRAM, max | 8.5 GB of 12 | 8.8 GB of 12 | | end | world +146 s: `no shared buffer error=0x8007000E size=4194304`; 3 s later an access violation in `nvwgf2umx.dll` (read 0x36) under `Host::submit` → `ExecuteCommandLists` | world +~5 min: the title stops on a breakpoint (0x80000003) with 1.3–1.8 GB of commit left | So on this machine **the limit is host commit, not VRAM**. The card kept 3+ GB free in both runs, and the first failure is a 4 MB shared (system-memory) buffer. That fits npanu420's "needs both parts together" on 8 GB: ray tracing adds ~2.6 GB of host copies, and the in-place/resident part adds its own. I did not prove that the failed buffer is what the driver tripped on. The callers handle `None`, so this is a correlation, not a traced cause. For reference, on the same machine `main` at `0b0074e` (`ASYNC_SUBMIT QUEUE2 TEXTURE_NO_WAIT COPY_PLAIN LEVELS_ON_DEMAND`) ran 6 world runs without a crash, at 2.1–2.3 fps and 22–25 GB private. Not tested: `VICTORY_INPLACE=4` together with the builder (it would only add host memory here), Series S, a larger pagefile. The two runs above do not reach the lit cell, so I cannot say anything about the picture with ray tracing on this card yet.
Author
Owner

@⁠Zayfway on GitHub · 2026-11-25 16:49 UTC · original

Follow-up, a correction of my comment above: host commit was a symptom, not the cause.

I raised the pagefile to 32 GB (commit limit ~32 → 48 GB, same 16 GB of RAM) and reran the same pr-980 build with the same ray-tracing switches.

  • The builder starts again (pipelines=53), and 0 draws are dropped.
  • The run ends earlier, at world +~95 s, with 9.6 GB of commit still free: a host command list did not close (0x8007000E).
  • Just before that:
    • title memory by address: shaders touched pages that had no copy ... pages=1609 first=0x10000;
    • loose window budget reached (VICTORY_MEMORY_MB) mb=1536.
  • Frame while it ran: 1,498 ms median (0.66 fps); GPU 660 ms, preparing 703 ms, copy-back 344 ms.

So the traversal reads memory from near-null pointers (0x10000 up), and the copies made for those reads are what fill memory, here as in the earlier run. That matches what #994 describes: dispatches by thread counts that over-run, and the builder then reading pointers out of garbage. #980 converts USE_THREAD_DIMENSIONS counts to groups (draw.rs), but its "without thread-count masking" warning never fired here. I could not confirm the link from the logs, so it is a consistent reading, not a traced cause.

Same machine as above (RTX 3060 12 GB, Ryzen 7 5700X, 16 GB RAM, Windows 11 26300, Series X, diag build with the copystat fix). AI-assisted (Claude Code).

**@⁠Zayfway** on GitHub · 2026-11-25 16:49 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7168591643) **Follow-up, a correction of my comment above:** host commit was a symptom, not the cause. I raised the pagefile to 32 GB (commit limit ~32 → 48 GB, same 16 GB of RAM) and reran the same `pr-980` build with the same ray-tracing switches. - The builder starts again (`pipelines=53`), and 0 draws are dropped. - The run ends **earlier**, at world +~95 s, with **9.6 GB of commit still free**: `a host command list did not close (0x8007000E)`. - Just before that: - `title memory by address: shaders touched pages that had no copy ... pages=1609 first=0x10000`; - `loose window budget reached (VICTORY_MEMORY_MB) mb=1536`. - Frame while it ran: 1,498 ms median (0.66 fps); GPU 660 ms, preparing 703 ms, copy-back 344 ms. So the traversal reads memory from near-null pointers (0x10000 up), and the copies made for those reads are what fill memory, here as in the earlier run. That matches what #994 describes: dispatches by thread counts that over-run, and the builder then reading pointers out of garbage. #980 converts `USE_THREAD_DIMENSIONS` counts to groups (`draw.rs`), but its "without thread-count masking" warning never fired here. I could not confirm the link from the logs, so it is a consistent reading, not a traced cause. Same machine as above (RTX 3060 12 GB, Ryzen 7 5700X, 16 GB RAM, Windows 11 26300, Series X, diag build with the `copystat` fix). *AI-assisted (Claude Code).*
Author
Owner

@⁠loftymocha on GitHub · 2026-11-26 04:59 UTC · original

RTX 5070 12 GB (32-lane), pr-980 head 9156270: live ray tracing runs fully and holds 5 minutes on both profiles, but the cell's light is wrong: dark on Series X, washed out on Series S. This is a 12 GB card with 32 GB of RAM, between the 8 GB and 16 GB reports above. Thanks to gangg111, sirrus98 and staronthehorizon for the branch, and to Zayfway for the build fix.

Setup: RTX 5070 12 GB (driver 32.0.16.1742), Ryzen 7 7800X3D, 32 GB DDR5 + 64 GB page file, Windows 11 Pro 26300. Diag build of the head as published, plus Zayfway's two copystat.rs variants (WatchFailed, WatchKnownView) so --features diagnostics builds; nothing else changed. Your switches: VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82 VICTORY_INPLACE=4, plus VICTORY_SHADER_LOOP_LIMIT=256. No ASYNC_SUBMIT/QUEUE2 (after Proudnoob4's device hang). Its own cache, empty before the first run. One launch per profile, from the prologue checkpoint, played by hand, stopped by my runner 300 s after builder runs. Counts and descriptions only.

--console series-x --console series-s
builder runs ... pipelines=53 at +79 s pipelines=53 at +64 s
end held 306 s; 0 exceptions, no device loss held 304 s; the same
programs refused / untranslated 0 0
draws dropped 0 without a host pipeline, 0 indirect the same
frame (status lines, late) 910-1010 ms (~1.0 fps), up to 5,351 draws 252-290 ms (3.4-4.0 fps), ~4,500 draws
on the GPU / VICTORY_CARD_TIME title lists 726-821 ms / 836 ms 46-84 ms / 216 ms
preparing (copies) ~168 ms (175 ms, 260-307 MB) ~182 ms (170 ms, 168 MB)
residents, card copies 80 buffers + 13 windows; 727 MB card copies 104 + 68; 419 MB
lowest free RAM 0.6 GB 3.2 GB
the cell dark, as with the builder off washed out: the view through the window (fence, yard, a silhouette) is visible, but the rest of the frame is a bright, blurred orange-white haze with no detail
  • Light: neither profile gives the lit cell you got on the 3080. Series S matches your frame times (238-292 ms) but not your picture. With every program created and no draw dropped, I'd guess the traced lighting's values are off on this card (near zero on X, far too high on S, then pushed by the exposure), not that a pass is missing. That's a reading from two runs, not a traced cause.
  • Series X: the card itself is the limit, ~10x the GPU time of Series S at similar draw counts. That's more than the resolution difference alone would explain.
  • Loading on Series X flickered between a picture and none (at ~1 fps, ~1,800 draws). There was no flicker once in the cell.
  • Memory: both runs logged shaders touched pages that had no copy 50 times. Unlike Zayfway's 3060, the first addresses are ordinary (first=0x705fd0000 on X, 0x50c460000 on S), not near-null. Series X also hit loose window budget reached (VICTORY_MEMORY_MB) mb=1538 once. Neither ran out of memory.
  • The driver watch tripped about 5 s in on both launches on the Auto HDR notice (#1077; this branch predates #1255). That's harmless here, since no INDIRECT_WINDOW.

Not tested: VICTORY_INPLACE=4 off; more than one launch per profile; #905 alone.

AI-assisted (Claude Code)

**@⁠loftymocha** on GitHub · 2026-11-26 04:59 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7183074313) **RTX 5070 12 GB (32-lane), `pr-980` head `9156270`: live ray tracing runs fully and holds 5 minutes on both profiles, but the cell's light is wrong: dark on Series X, washed out on Series S.** This is a 12 GB card with 32 GB of RAM, between the 8 GB and 16 GB reports above. Thanks to gangg111, sirrus98 and staronthehorizon for the branch, and to Zayfway for the build fix. **Setup:** RTX 5070 12 GB (driver 32.0.16.1742), Ryzen 7 7800X3D, 32 GB DDR5 + 64 GB page file, Windows 11 Pro 26300. Diag build of the head as published, plus Zayfway's two `copystat.rs` variants (`WatchFailed`, `WatchKnownView`) so `--features diagnostics` builds; nothing else changed. Your switches: `VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82 VICTORY_INPLACE=4`, plus `VICTORY_SHADER_LOOP_LIMIT=256`. No `ASYNC_SUBMIT`/`QUEUE2` (after Proudnoob4's device hang). Its own cache, empty before the first run. One launch per profile, from the prologue checkpoint, played by hand, stopped by my runner 300 s after `builder runs`. Counts and descriptions only. | | `--console series-x` | `--console series-s` | |---|---|---| | builder | `runs ... pipelines=53` at +79 s | `pipelines=53` at +64 s | | end | held 306 s; 0 exceptions, no device loss | held 304 s; the same | | programs refused / untranslated | 0 | 0 | | draws dropped | 0 without a host pipeline, 0 indirect | the same | | frame (status lines, late) | **910-1010 ms** (~1.0 fps), up to 5,351 draws | **252-290 ms** (3.4-4.0 fps), ~4,500 draws | | on the GPU / `VICTORY_CARD_TIME` title lists | 726-821 ms / 836 ms | 46-84 ms / 216 ms | | preparing (copies) | ~168 ms (175 ms, 260-307 MB) | ~182 ms (170 ms, 168 MB) | | residents, card copies | 80 buffers + 13 windows; 727 MB card copies | 104 + 68; 419 MB | | lowest free RAM | 0.6 GB | 3.2 GB | | **the cell** | **dark**, as with the builder off | **washed out**: the view through the window (fence, yard, a silhouette) is visible, but the rest of the frame is a bright, blurred orange-white haze with no detail | - **Light:** neither profile gives the lit cell you got on the 3080. Series S matches your frame times (238-292 ms) but not your picture. With every program created and no draw dropped, I'd guess the traced lighting's *values* are off on this card (near zero on X, far too high on S, then pushed by the exposure), not that a pass is missing. That's a reading from two runs, not a traced cause. - **Series X:** the card itself is the limit, ~10x the GPU time of Series S at similar draw counts. That's more than the resolution difference alone would explain. - **Loading** on Series X flickered between a picture and none (at ~1 fps, ~1,800 draws). There was no flicker once in the cell. - **Memory:** both runs logged `shaders touched pages that had no copy` 50 times. Unlike Zayfway's 3060, the first addresses are ordinary (`first=0x705fd0000` on X, `0x50c460000` on S), not near-null. Series X also hit `loose window budget reached (VICTORY_MEMORY_MB) mb=1538` once. Neither ran out of memory. - The driver watch tripped about 5 s in on both launches on the Auto HDR notice (#1077; this branch predates #1255). That's harmless here, since no `INDIRECT_WINDOW`. **Not tested:** `VICTORY_INPLACE=4` off; more than one launch per profile; #905 alone. AI-assisted (Claude Code)
Author
Owner

@⁠loftymocha on GitHub · 2026-11-26 05:09 UTC · original

Follow-up to my RTX 5070 report above: without VICTORY_INPLACE=4, the same build on Series S shows the cell lit by the traced light. So on this card the washed-out picture comes from the in-place/resident part (#772), not from #814's ray tracing.

The same build (9156270 + the two copystat.rs variants), the same cache, save and Series S profile as the washed-out run. The only change is that VICTORY_INPLACE=4 is left out. Switches: VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82 VICTORY_SHADER_LOOP_LIMIT=256, --console series-s. One launch, stopped 300 s after builder runs. Counts and descriptions only.

Series S VICTORY_INPLACE=4 (run above) without it
builder pipelines=53 at +64 s pipelines=53 at +73 s
end held 304 s, 0 exceptions held 304 s, 0 exceptions
refused / untranslated / draws dropped 0 / 0 / 0 0 / 0 / 0
frame (late status lines) 252-290 ms (3.4-4.0 fps), ~4,500 draws 451-464 ms (2.2 fps, steady), ~5,170 draws
on the GPU 46-84 ms 144-164 ms
preparing: copies ~170 ms, 168 MB ~274 ms, 269-277 MB
lowest free RAM 3.2 GB 1.5 GB
the cell washed out: a bright orange-white haze, only the window view readable lit: sun through the windows lands as patches on the walls and floor, rim light on hair, contact shadows under the table and stools, the ceiling lamps light the room
  • The in-place part does save the third of the copying it claims (~274 → ~170 ms, ~270 → 168 MB). But on this card it also takes about two thirds of the card's time per frame away (144-164 → 46-84 ms). With the picture washed out at the same time, that looks like part of the lighting work being skipped or fed the wrong memory, not like a speed-up. That's a reading of two runs, not a traced cause.
  • What's still wrong in the lit run, by eye: blocky, stair-stepped edges on the sunlit patches (cells of roughly 8-16 px); grain on hair and walls; white sparkles on the floor; one bluish noisy patch at the lower left; glowing outlines on window frames. It looks like the denoise or upscale step getting noisy or mismatched input, but I haven't checked that.
  • The same 50 shaders touched pages that had no copy warnings as before, at ordinary addresses (first=0x50c510000), and loose window budget reached ... mb=1536 once.
  • Series X without VICTORY_INPLACE=4: not run yet, so I can't say whether the dark Series X cell above has the same cause.

AI-assisted (Claude Code)

**@⁠loftymocha** on GitHub · 2026-11-26 05:09 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7183235905) **Follow-up to my RTX 5070 report above: without `VICTORY_INPLACE=4`, the same build on Series S shows the cell lit by the traced light. So on this card the washed-out picture comes from the in-place/resident part (#772), not from #814's ray tracing.** The same build (`9156270` + the two `copystat.rs` variants), the same cache, save and Series S profile as the washed-out run. The only change is that `VICTORY_INPLACE=4` is left out. Switches: `VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_TEXTURE_DROP_MIPS=1 VICTORY_TEXTURE_ROOM_PERCENT=82 VICTORY_SHADER_LOOP_LIMIT=256`, `--console series-s`. One launch, stopped 300 s after `builder runs`. Counts and descriptions only. | Series S | `VICTORY_INPLACE=4` (run above) | without it | |---|---|---| | builder | `pipelines=53` at +64 s | `pipelines=53` at +73 s | | end | held 304 s, 0 exceptions | held 304 s, 0 exceptions | | refused / untranslated / draws dropped | 0 / 0 / 0 | 0 / 0 / 0 | | frame (late status lines) | 252-290 ms (3.4-4.0 fps), ~4,500 draws | **451-464 ms (2.2 fps, steady)**, ~5,170 draws | | on the GPU | 46-84 ms | **144-164 ms** | | preparing: copies | ~170 ms, 168 MB | ~274 ms, 269-277 MB | | lowest free RAM | 3.2 GB | 1.5 GB | | **the cell** | washed out: a bright orange-white haze, only the window view readable | **lit**: sun through the windows lands as patches on the walls and floor, rim light on hair, contact shadows under the table and stools, the ceiling lamps light the room | - **The in-place part does save the third of the copying it claims** (~274 → ~170 ms, ~270 → 168 MB). But on this card it also takes about two thirds of the card's time per frame away (144-164 → 46-84 ms). With the picture washed out at the same time, that looks like part of the lighting work being skipped or fed the wrong memory, not like a speed-up. That's a reading of two runs, not a traced cause. - **What's still wrong in the lit run, by eye:** blocky, stair-stepped edges on the sunlit patches (cells of roughly 8-16 px); grain on hair and walls; white sparkles on the floor; one bluish noisy patch at the lower left; glowing outlines on window frames. It looks like the denoise or upscale step getting noisy or mismatched input, but I haven't checked that. - The same 50 `shaders touched pages that had no copy` warnings as before, at ordinary addresses (`first=0x50c510000`), and `loose window budget reached ... mb=1536` once. - Series X without `VICTORY_INPLACE=4`: not run yet, so I can't say whether the dark Series X cell above has the same cause. AI-assisted (Claude Code)
Author
Owner

@⁠loftymocha on GitHub · 2026-11-26 05:19 UTC · original

Last one from me on this card: Series X without VICTORY_INPLACE=4 is not dark either, so on the RTX 5070 the in-place part causes both bad pictures, dark on X and washed out on S. Without it, Series X shows the traced light but with many more artifacts than Series S.

Same build, cache and save as my two comments above, --console series-x, the same switches without VICTORY_INPLACE=4. One launch, stopped 300 s after builder runs (+61 s). Counts and descriptions only.

All four launches on this card side by side. Each held 300 s with the builder running, with 0 exceptions, 0 device losses, 0 programs refused or untranslated, and 0 draws dropped:

pr-980 on RTX 5070 VICTORY_INPLACE=4 without it
Series X dark; 910-1010 ms (GPU 726-821 ms); lowest free RAM 0.6 GB lit, heavy artifacts; 890-899 ms at ~7,000 draws (GPU 558-579 ms, copies 323-359 ms / ~335 MB, copy-back ~275 ms); lowest free RAM 0.5 GB
Series S washed out; 252-290 ms (GPU 46-84 ms); 3.2 GB lit, mild artifacts; 451-464 ms (GPU 144-164 ms, copies ~274 ms); 1.5 GB

Series X without in-place, by eye:

  • Lit: sun on faces and hair, rim light, the ceiling lamps, the yard through the window.
  • Glowing white and cyan blobs over the floor, bunks and walls, often with pure-black specks inside them. To me that looks like invalid values (NaN/inf) coming out of the lighting and being spread by bloom or denoising, but I haven't checked any buffer.
  • The yard seen through the window is smeared and ghosted, and there are blocky patches at the right of the frame.
  • Series S without in-place shows the same kinds of fault (blocky sunlit edges, grain, sparkles), but far milder.

So on this card I'd separate two things: VICTORY_INPLACE=4 leaving the traced light wrong (dark or blown out), and, without it, noise or invalid values in the lighting that Series X makes much worse. The shaders touched pages that had no copy warnings (50 per run, ordinary addresses, first=0x11a530000 here) and one loose window budget reached ... mb=1536 appear in every run, lit or not.

Not tested: more than one launch per cell; VICTORY_CARD_FETCH_INFLIGHT=0; another driver.

AI-assisted (Claude Code)

**@⁠loftymocha** on GitHub · 2026-11-26 05:19 UTC · [original](https://github.com/fxceless/victory-fork/pull/980#issuecomment-7183388821) **Last one from me on this card: Series X without `VICTORY_INPLACE=4` is not dark either, so on the RTX 5070 the in-place part causes both bad pictures, dark on X and washed out on S. Without it, Series X shows the traced light but with many more artifacts than Series S.** Same build, cache and save as my two comments above, `--console series-x`, the same switches without `VICTORY_INPLACE=4`. One launch, stopped 300 s after `builder runs` (+61 s). Counts and descriptions only. All four launches on this card side by side. Each held 300 s with the builder running, with 0 exceptions, 0 device losses, 0 programs refused or untranslated, and 0 draws dropped: | `pr-980` on RTX 5070 | `VICTORY_INPLACE=4` | without it | |---|---|---| | **Series X** | dark; 910-1010 ms (GPU 726-821 ms); lowest free RAM 0.6 GB | **lit, heavy artifacts**; 890-899 ms at ~7,000 draws (GPU 558-579 ms, copies 323-359 ms / ~335 MB, copy-back ~275 ms); lowest free RAM 0.5 GB | | **Series S** | washed out; 252-290 ms (GPU 46-84 ms); 3.2 GB | **lit, mild artifacts**; 451-464 ms (GPU 144-164 ms, copies ~274 ms); 1.5 GB | **Series X without in-place, by eye:** - Lit: sun on faces and hair, rim light, the ceiling lamps, the yard through the window. - Glowing white and cyan blobs over the floor, bunks and walls, often with **pure-black specks inside them**. To me that looks like invalid values (NaN/inf) coming out of the lighting and being spread by bloom or denoising, but I haven't checked any buffer. - The yard seen through the window is smeared and ghosted, and there are blocky patches at the right of the frame. - Series S without in-place shows the same kinds of fault (blocky sunlit edges, grain, sparkles), but far milder. So on this card I'd separate two things: `VICTORY_INPLACE=4` leaving the traced light wrong (dark or blown out), and, without it, noise or invalid values in the lighting that Series X makes much worse. The `shaders touched pages that had no copy` warnings (50 per run, ordinary addresses, `first=0x11a530000` here) and one `loose window budget reached ... mb=1536` appear in every run, lit or not. **Not tested:** more than one launch per cell; `VICTORY_CARD_FETCH_INFLIGHT=0`; another driver. AI-assisted (Claude Code)
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/copystat.rs
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/inplace.rs
  • crates/victory-gpu/src/pipeline/host.rs
  • crates/victory-gpu/src/shadow.rs
  • crates/victory-gpu/src/texture.rs
  • crates/victory-gpu/src/watch.rs
  • crates/victory-hle/src/modules/xmem.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
  • crates/victory-shader/src/emit/shader.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/980/head:github-bot/gh-980'
git switch 'github-bot/gh-980'

Merge

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