Files
VIctory-NVIDIA-2/docs/unified-memory-audit.md
banaanpapa dbc8f236d1 Docs: where a small submission's refreshes go, measured
The audit's synthetic frame, with a timer round each phase for one run: 117 us asking the write watch and 253 us in the flushes of each of the 29 small submissions, and neither moves with the helpers kept awake or with one thread.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-28 21:27:19 +01:00

65 KiB

Audit: the road to a console-level experience (2026-11-28)

An audit of this tree at 32ecacf. Most of what it proposes is not built; section 8 says what the branch that carries this file has done of it, and section 10 what was run. Line numbers are of 32ecacf. The branch was moved onto 923e38c, 205 commits on, before it was sent; 10.4 says what was run again there. The target is the console's experience: the title's own 30 frames a second held without stalls at the Series X profile, a correct picture, and a PC of 16 to 32 GB of RAM with a 12 to 16 GB card. 60 comes after that.

The question it started from was a five-point plan that circulates for upstream VIctory (lazy copy-back, asynchronous submission, tiled video memory, shaders without write marks, detiling on the card). Section 2 holds that plan against this tree. Section 3 is the long one: the console's one memory on a PC with two, which is where most of what is left to gain lies.

0. Summary

Where this tree stands. It is not the 1 to 10 fps tree the plan describes. By its own measurements it renders 26 to 30 fps on an RTX 5070 and about 35 fps on an RTX 5080 at 2560x1440 (README.md, findings.md). On the fast card the frame is bound by one CPU thread, the one that prepares submissions, with the card idle 8 to 9 ms of a 28 ms frame. What separates that from a console is the tail, not the median: frames of 70 to 930 ms while pipelines compile and the world streams in, the cost of moving compared with standing, draws that are dropped, ray tracing that is off, and 30 to 46 GB of committed memory.

The five-point plan against this tree.

Plan In this tree Verdict
1. Lazy copy-back on a read fault Not built. Three partial stand-ins exist: write-combined copies never come back, in-place buffers, structure-builder arenas The one missing piece, but the two projects that built it did not get a faster frame from it alone (3.3)
2. No wait per submission Built and on by default: flights, a relay thread that lands them, the present sent ahead Done. Eight narrower waits remain (section 4)
3. Buffers in video memory, tiled resources Buffers' copies in video memory: on by default. Reserved textures level by level: written, off, and probably unreachable through a defect (5.1) Half done
4. Shaders without write marks This tree never had them. It finds shader writes with a hash pass on the card Does not apply
5. Detiling on the card Written and tested, off, and it uses more memory than the CPU path, not less (5.2) Needs work before it helps

What to do, in order of evidence. Each is taken up in the section named.

  1. Measure before building: a read watch, the refusal reasons of the card's steps, a bus throughput bench on the host (3.6, step U0). Every design choice below depends on three numbers nobody has for this tree.
  2. Make the layer's own readers read the card, not title memory (3.6, U1). In the one count that exists, the title's code touches 2.5 to 5.5 % of the pages shaders write; the layer's own reads touch 30 to 44 %. The layer is its own worst reader.
  3. Lower the 500 ms a frame may wait for a pipeline, and stop retranslating everything for a test's edit (section 7). These are the stalls a player sees first.
  4. Fix the levels-on-demand short circuit and measure it (5.1): 2.2 to 3.0 GB of video memory by its own account.
  5. Keep allocator trimming on in code, not only in the launchers (section 6). The trim of spare chunks already has its floor here.
  6. Single-sided copies in card memory the CPU maps, for write-combined memory and for windows (3.6, U3): removes the system-memory side of the largest copies.
  7. Ownership by class, then by fault (3.6, U2): never land what the title never reads; land on first touch only where the data from step 1 says it pays.
  8. A second stage for the submitting thread (4.3): the only item that can take 21 ms of preparing toward 10, and the riskiest.
  9. Present on the frame clock (4.4), for a locked 30 instead of an unlocked 35.

What this audit does not claim. No frame rate is promised. The figures "45 to 60 fps on an RTX 3080 Ti, 80 to 120 on higher cards, in 16 GB" have no measurement behind them in this repository, upstream, or any fork read for this audit. The nearest evidence points the other way for the first of them: on a 12 GB card the copies that must stay in system memory cost the card tens of milliseconds a pass (shadow.rs:180-187).

1. Method and limits

  • Read. crates/victory-gpu/src (118,000 lines by wc), the parts of victory-hle, victory-shader and apps/victory that bear on it, and every file in docs/. Six parallel read passes by area, then the findings that carry a recommendation were checked against the code by hand. Statements below are from the code unless marked inferred.
  • Built and run, on Windows 11 26300, RTX 5080 16 GB (driver 617.42), Rust 1.98.1: the workspace builds in 1 min 13 s; results are in section 10.
  • Not done: the title was not run. There is no dump on this PC. Nothing here is an in-game measurement of this audit's own; in-game figures are quoted from this repository's documents and comments, or from upstream threads, each with its source. Upstream figures are of other trees and are marked so.
  • victory.exe does not start on this PC. Windows answers "An Application Control policy has blocked this file" (error 4551) for the built victory.exe, and for the test programs of victory-loader and xtask. That is a security setting of the PC and was left alone. It rules out victory replay, victory upscaler-check and the in-place probe here until the program is allowed or signed.
  • Reddit could not be read: both the search tool and the browser refuse the site. The outside sources are GitHub: Marvisak/VIctory issues and pull requests 407, 1905, 2583, 2584, 3028, 3102, 3118, 3312, 3703, and the READMEs and histories of fever308/victory-corgi and readmet3xt-lab/foxhound.

2. The plan's premises, checked

The plan is upstream issue 3703, written against Marvisak's main at 63bcca4. That is a different tree from this one, which stands on foxhound (README.md, "The base since 2026-11-26"). Three of its premises are true of upstream and not of this tree.

"Host::execute waits with WaitForSingleObject(INFINITE) after every submission." Not on the path a player runs. late_stage() (host.rs:2916-2931) is 3 whenever the relay is on, and the relay is on unless the build is a test (shadow.rs:989). At stage 3 a submission is sent and joins a line of flights; a thread of its own lands each flight when the card has run it; the present's copy flies too (host.rs:2864-3044). The waits that still stop the submitting thread are listed in section 4. A reply on the plan's own thread, from an RTX 5080, says the same of a similar tree: "the per-submission wait isn't the limit any more. The submit thread stands idle for 0.3-3 ms a frame indoors" (3703, Ym1r1710).

docs/findings.md:174 still says VICTORY_LATE_WAIT is off by default, and so do the comments at host.rs:2974 and shadow.rs:968. They are stale (section 9).

"Dirty-mark atomics are injected into shaders." Upstream marks pages in a bitmap from inside translated shaders (pull request 2958 there). This tree does not. Nothing in crates/victory-shader emits write tracking; the only mention is a comment that names the idea as not built (shadow.rs:3553). Here a range is declared when a draw binds a writable view (Shadow::gpu_writes, shadow.rs:3556), and a compute pass of the layer's own hashes each 64 KiB piece of the card's copy and flags the pieces whose hash changed (CARD_COMPARE, host.rs:2544-2623). So there is nothing to delete, and no "30 to 50 % faster shaders" to collect. findings.md:74-78 measured the shader-side levers that do exist at "nothing to 0.1 ms each".

What translated shaders do carry beyond the title's own work is listed in section 7; none of it is write tracking.

"Most shadow buffers still live in system memory." Partly. Every title buffer's copy starts in system memory (shared_buffer: a custom heap, write-back pages, pool L0, host.rs:11083-11121), and gets a second side in the card's memory when there is room (card_for, shadow.rs:386-474). VICTORY_CARD_BUFFERS is on by default and both launchers lower the floor to 64 KiB, "every title buffer" (shadow.rs:242). What stays in system memory is what does not fit the card's share (3.2), and the 4 MiB windows over title memory that is no buffer.

"The CPU detiles textures and commit reaches 33 GB." True. Detiling on the card exists and is off (5.2). Commit is 30 to 32 GB on the 32 GB test PC (windows-memory.md:56,84) and 40 to 46 GB on the 64 GB one (findings.md:95), but textures' staging is one pool among seven (section 6).

3. Unified memory

3.1 The bridge, as it is

On the console the CPU and the graphics processor read and write the same bytes. Here title memory is Windows pages and the card sees host copies of them. findings.md names the four costs, and they are still the right frame: noticing what the title wrote, noticing what shaders wrote, moving both, and waiting until an order is safe.

Noticing title writes. Memory reserved by XMemVirtualAlloc is write watched (xmem.rs:140-142); one grouped GetWriteWatch per submission asks for the written pages (watch.rs:318-370), at "30-70 microseconds whatever the range" plus "some 1.4 microseconds each, and the title writes 7,000 a frame" (watch.rs:316, 402-403). Views of the title's physical pages cannot be watched; there each 64 KiB block a copy took is left read-only and the first write faults into on_write (watch.rs:3166), which opens every view of that page (cover, open, watch.rs:2273, 2455). "321 to 1,017 blocks made read-only and 323 to 331 guard faults a frame" (watch.rs:1740).

Noticing shader writes. For a copy with a card side: the hash pass above, one group of 64 threads a piece. For a copy in system memory only: a snapshot of the whole copy before the submission and a compare after it (shadow.rs:3659, find_all, shadow.rs:1989).

Moving. Up: changed runs are copied from title memory to the copy's CPU side, then again into memory of the submission's own (host/send.rs:16-20), from which the card copies. Down: flagged pieces are fetched with CopyBufferRegion on the copy queue (relay_card_back, host.rs:5247) and merged three ways, card now against card before against title (safecopy::merge, safecopy.rs:238), on up to four landing threads.

Waiting. A step of the next submission that reads title memory a flight may still write waits for that flight to land (section 4).

What it costs, each figure from the run it was measured in:

Cost Figure Source
Landing, per frame "some 1,500 pieces of 64 KiB, 98 MB" fetched; "16 MB a frame put as dwords" land.rs:5-7, findings.md:24
Landing on the RTX 5080 copying back 5.2 ms, merging 1.6 ms, waiting 1.1 ms findings.md:215-217
Landing on the laptop 5070 Ti copying back 57-85 ms findings.md:123
A settle for one small fill 226-326 ms of a 400 ms frame findings.md:125
Asking the write watch 5 ms of a 55 ms frame findings.md:17
Title bytes under shader writes 4-7 ms findings.md:43

Two things stand out. The card fetches 98 MB to put 16: a piece is 64 KiB and one changed dword flags it. And the largest single wait on the slow machine is not the title reading shader output at all; it is the layer filling 0x20 bytes of upload memory from a heap that eleven skinning dispatches are declared to write across 174 MB (findings.md:127-128, card_steps.rs:16-21).

3.2 Where each byte lives today

Title memory Host copy Shaders read and write CPU side Shader writes come back
A buffer, room on the card Two sides Card memory System memory, same size Hash pass, fetch, merge
A buffer, no room One side System memory, across the bus The same buffer Snapshot, compare, merge
Write-combined, 1 MiB or more (launchers) Two sides Card memory System memory Never (VICTORY_WC_NO_BACK)
Outside any buffer A 4 MiB window, L0; a card side within 9 % of the budget System memory mostly The same buffer Shaders write none
Structure-builder arenas 64 MiB title + 64 MiB L0 + 64 MiB card Card memory System memory "stay on the card" (memory.rs:45-48)
In place (VICTORY_INPLACE, off) None: title memory opened as a heap System memory, across the bus Title memory itself Nothing to move

The card's share for buffers is set from the DXGI budget (default_card_limits_mb, shadow.rs:193-207): up to 12 GiB, copies of 16 MiB and more within 18 % of the budget (512 to 2,048 MiB); 12 to 20 GiB, from 4 MiB within 2,048 MiB; 20 GiB and more, from 1 MiB within a quarter of the budget. The launchers' 64 KiB floor overrides the size floor, not the total.

Three properties of this table matter for everything after it.

  • A carded buffer is committed three times: the title's pages, the CPU side, and the card. On an RTX 4070 SUPER at one setting that was "592 MB of copies on the card and 5.7 GB in the PC's memory" (shadow.rs:183).
  • A refusal is for good: "a copy turned down is not asked for again" (shadow.rs:291). A buffer that met a full card at its first use stays on the bus for the rest of the session, whatever is freed later.
  • Reads across the bus are the cost that scales with the card. The same comment: with too small a share the 4070 SUPER's passes took "42, 32, 27, 22, 19 and 19 ms ... 3 fps"; with a larger one "0.19, 0.25 and 0.41 ms ... 21-25 fps" (shadow.rs:180-187).

3.3 What the wider project has measured

These are other trees and other machines. They are quoted because they are the only experiments on the questions this section has to answer.

The bus. Card reads from system memory against card reads from its own: about 13 against 71 GB/s on an RX 6600 XT (407, qntic); about 23 against 720 GB/s on an RTX 5070 Ti (3102). The repository held no such figure; host/bus.rs now measures it, and on the RTX 5080 of this audit (10.2):

Where the buffer lies Shaders read Shaders store CPU copies in CPU copies out
The PC's memory (a host copy, pool L0) 32 GB/s 2.0 GB/s 31 GB/s 10 GB/s
The card's memory 932 GB/s 300 GB/s
Card memory the CPU maps (GPU_UPLOAD) 937 GB/s 301 GB/s 32 GB/s 0.09 GB/s

Three things follow, for this card. A shader's store into a copy in the PC's memory is 150 times slower than into the card's: a pass that writes 16 MB there takes 8 ms for the stores alone. Card memory the CPU maps is, to shaders, the card's memory, and the CPU writes it as fast as it writes its own: for what the CPU only writes, the second side of a copy and the send between the two buy nothing (3.6, U3). And the CPU cannot read that mapping, at 90 MB/s: whatever comes back from it must be copied down by the card, as now.

In place loses to an image in video memory on a discrete card. Pull request 3102 ran one synthetic submission of 200 dispatches over 320 MiB through the real copy paths: copies in system memory 58 to 74 ms, title memory in place 43.7 ms, copies in video memory 29 to 39 ms. Its author therefore leaves in place off on discrete cards and on by default only where the host really has one pool. A project that reads PS5 title memory in place found the same from the other side: the copies went away and the bus traffic became 49 of 106 ms of card time, until the read-mostly ranges were given copies in video memory (407, Astronaut10).

Video memory helps NVIDIA and not AMD. 3102 again: on an RX 7900 XTX in the title, no gain (415 ms a frame against 431); written copies in video memory lowered card time and raised copy-back by as much. On an RTX 4090 the same change took card time from about 0.5 s to about 0.15 s once upstream's write-mark bitmap was itself in video memory.

Not all card time is the bridge. Issue 3028, RTX 5070 Ti: ordinary draws of 45 to 120 ms each, and moving 5.2 GB of copies into video memory "does not change these numbers". Where a single draw takes 61 ms the cause is the translated shader or what it indexes, not where its buffers lie.

Lazy copy-back, built twice.

  • Pull request 3118 sealed marked pages no-access and brought each back at its first touch. It was closed by its own author as a null result: 1.7 to 2.0 times the eager cost on a synthetic frame of 2,250 marked pages. The reasons are instructive. Every page still armed was drained at the next submission, so the copy was paid a frame late and not saved; each page cost two protection changes, one VirtualProtect a page and not a run; each title read added a fault and a 64 KiB service. The author's conclusion: "the next submission would have to drop armed pages it is about to overwrite instead of servicing all of them, which is a different design".
  • fever308/victory-corgi carries VICTORY_LAZY_BACK=1 with a batched fetch on the copy queue. Its history is a list of what the idea runs into: a self-deadlock in merge_under_writes, a deadlock with fills ahead, fence stalls, a pin on the card's sent list. Its README gives no frame times.

How often the title reads what shaders wrote. One count exists (2583, Fran-co-F: upstream main under Wine, one scene, about 2 fps). Copy-back ran as usual and the declared pages were then armed to record first touches:

  • the title's code touches 2.5 to 5.5 % of declared pages a frame (about 65 of 1,900), more writes than reads, and three code sites make half of them;
  • about a third of those touches are of neighbouring bytes in the same 64 KiB page, outside the declared range;
  • the layer's own reads touch 30 to 44 % of declared pages, almost all through copy_mapped.

The other title's census (407, Astronaut10) found about 96 % of the card's stores overwritten before any CPU read.

What laziness can and cannot buy. On an RTX 5080 with copy-back already on threads of its own: "about 36 MB a frame and roughly 30 ms of CPU on those threads. The submit thread waits on it only 1-2 ms a frame. So the lazy GPU_OWNED idea would mostly free CPU time on other cores, not frame time directly" (3703, Ym1r1710). The same machine is at 12 of 16 logical processors busy, and outdoors its frame is the list threads' time divided by eight, so freed processors are worth something, but through a second door.

Remaps are the unowned problem of in place. Issue 1905: an import covers one committed run; a protection change inside it splits it; the other project re-imported about 1 GB with the card idle for a second. This title refreshes one 174 MB view about 20 times a frame.

3.4 The routes, compared

Route Removes Costs Evidence Fits
A. Title memory opened in place Copies, snapshots, compares, landing for that memory Every shader access crosses the bus; pages locked; the title cannot free or protect them (error 87); section pool is SEC_RESERVE and refused 43.7 ms against 29 to 39 (3102) Hosts with one pool; memory that would stay in system memory anyway
B. An image in video memory, kept coherent The bus on the card's side Two or three copies; the bridge itself stays The base of this tree; 3102; shadow.rs:180-187 Discrete NVIDIA cards with room
C. One side, in card memory the CPU maps (GPU_UPLOAD) The system-memory side and the send CPU reads of it cross the bus a few bytes at a time; needs a resizable BAR and driver support Written here (VICTORY_WC_BAR, VICTORY_WINDOWS_BAR_MB), both off, no result recorded What the CPU writes and does not read
D. One 4 GiB tiled buffer per window, tiles given as the title commits Per-buffer copies and their bookkeeping Tiled buffers cannot be mapped; uploads through a staging ring; aliasing needs tile sharing Another layer's design, menus only on this title (407, itsRevela) A rewrite, not a step
E. Never bring back, or bring back on touch Fetch, merge, their threads Stale reads where the guess is wrong; faults where it is right 3118 (null), 2583 (counts), shadow.rs:2507 (near-black cutscenes) By class first, by fault where measured

No single route wins. A is right for hosts with one pool and wrong for the cards this fork is for. D discards what this tree has made work. The target that the measurements support for a discrete NVIDIA card is B for what shaders read, C for what only the CPU writes, E for what comes back, and A only for what cannot leave system memory, with the choice made per 64 KiB block from data and not per buffer from a size threshold.

3.5 What stands in the way of lazy landing here

The fault handler is the place: on_write already takes read faults for views kept in the books alone (watch.rs:3185-3195) and for memory that came back (watch.rs:2830). A branch for owed blocks belongs right after the soft-view branch and before the exit for the layer's own copies (watch.rs:3195-3200). What a design has to answer, each from the code:

  1. Our own reads fail instead of faulting. safecopy::copy sends a fault in title memory to its failing exit, so a reader of ours would see an owed page as "not there" and take zeros. Every reader behind host::read, read_into, copy_mapped and read_there (host.rs:9572, 9525, 9377) needs the owed check first.
  2. The kernel does not fault either. Its accesses to a no-access page fail with an error. Writes are hooked today (kernel_writing, watch.rs:2551; ReadFile, fread, DirectStorage in files.rs:538,573 and dstorage.rs:1606-1637). Reads are not hooked at all, because a read-only guard never needed it: WriteFile or a socket send from an owed page would fail. The soft-views work lists the calls and admits the gap: "Not covered: another call of the host's that the title makes itself with such memory as an argument" (xmem.rs:2281).
  3. One page, many addresses. Every view of the page must be sealed (inplace::pages_of, inplace.rs:414), new views hooked (views_mapped, watch.rs:2667), and a remap "resets their protection" (watch.rs:13). A page shown in more than 64 places is not guarded together today (MANY_VIEWS, watch.rs:2253); such a page has no safe lazy form and must land eagerly.
  4. Private memory has no second view. Landing into a view goes through a view of the layer's own, beside the guards, with no protection change (VICTORY_LAND_BESIDE, land.rs:60). Write-watched private memory has no such second view (inplace::beside is for views, inplace.rs:580), so a lazy landing there would open the page while other title threads read it half landed. Inferred: keep it eager.
  5. Protection changes are the known expensive thing. "5,000 changes of protection a frame ... the frame went from 105 to 140 ms" (land.rs:472-479). Sealing 1,500 pieces a frame one by one would repeat that. Runs must be sealed in one call, and a block must stay sealed across frames to pay.
  6. The merge needs a memory. The compare stores the new hash, so a piece is flagged once; an owed piece needs a bit that outlives the landing it skipped. Its reference bytes must not advance, refreshes must stay off it, and the runs sent up meanwhile, which relay_fetched forgets (host.rs:5494), must be kept for it.
  7. A fault may have to wait for the card. Landing from the handler means a fetch and a fence wait on a title thread, possibly for a flight that has not run.
  8. Mixed blocks thrash. The title's own command memory shares the 174 MB heap that shaders write (shadow.rs:3713). A block both sides write every frame would seal and fault every frame.

Point 8 and the count in 3.3 say the same: block-granular laziness helps blocks that only the card writes and nobody reads, and those can be found without a fault at all.

3.6 The route proposed for this tree

Each step is a switch that is off until measured, in the house style, and each names how it is checked without the title.

U0. Measure three things. Nothing below should be built before them.

  • A read watch. After a landing, sample landed blocks to no-access (Notes::flush, land.rs:537, is where they are known); in on_write, reopen and count by code address through the fault book, the title's code apart from the layer's. This is the 2583 count for this tree, per copy and per frame. VICTORY_READ_WATCH is named in texback.rs:7 as if it existed; it does not. Risk is low if ranges the kernel is known to touch are left out. Check: tests in the style of watch.rs mod tests and land/tests.rs:259.
  • The refusal lines. When a step is not done on the card the log already says why ("; not done on the card: {why}", host.rs:3468-3477; card_steps.rs:1028). findings.md reports the blocked fill and not the reason. One run's log settles which gap to close first.
  • The bus. A bench that reads and writes one buffer from a compute pass in each placement (system memory, card, card memory the CPU maps) and prints GB/s and whether GPUUploadHeapSupported is set (host.rs:11155). It is the number that sizes U3 and U4 on each card. Done: host/bus.rs, an ignored test; its first result is the table in 3.3.

U1. The layer's readers read the card. This is where the frame time is. VICTORY_CARD_STEPS already does a fill or a copy on the card, behind the flights in their order, instead of on the CPU after a wait (host/card_steps.rs:1-45). It refuses, and the wait comes back, for:

  • "a fill of memory the card cannot be given the bytes of": root constant buffers that are not 256-aligned go through fill_scratch (host.rs:7774-7791, draw.rs:1139);
  • "a texture reads it";
  • sources more than 4 MiB apart, more than 12,288 steps, pages not mapped, two host copies (card_steps.rs:362-453, 834-894).

Close them in the order U0's refusal lines give. Then extend the same idea to the other kinds blocked_by lists (host.rs:3496-3565): texture staging, planes, placed copies, and the descriptor reads. Table constants at 256-aligned addresses can view the copy directly as root views already do (draw.rs:1130); today they always fill (draw.rs:4735-4746). Risk: stale constants (card_steps.rs:184-190). Check: plan unit tests (card_steps.rs:1065), and the ignored a_copy_behind_a_flight_reads_what_the_flight_wrote.

U2. Ownership by class, then by fault. VICTORY_WC_NO_BACK is a class rule: what shaders write into write-combined memory stays on the card. It ships with a 1 MiB floor because without one "the 4070 SUPER's cutscenes went near black ... small results the title reads back, such as exposure, came back stale" (shadow.rs:2507-2509). U0's read watch turns that guess into a table: per copy, how many landed blocks the title read.

  • Copies with no title read in the sample: never land. Keep the rule's known losses in view: a page the CPU writes goes up whole and takes back what shaders wrote in it, and another copy of the same bytes does not see them (shadow.rs:2493-2499).
  • Copies the title reads every frame: land eagerly, as now. These are the read-back rings; faulting on them every frame is 3118's result.
  • What is left, and only section views: land on first touch, sealed in runs, kept sealed across frames, and dropped unlanded when a later flight's declaration covers the block whole. That last clause is the design 3118's author said was missing.

Risk: high for the third class (3.5); low for the first two. Check: VICTORY_UPCOPY_CHECK at rest (host/upcheck.rs), and an extension of land/tests.rs:259.

U3. One side for what the CPU only writes. VICTORY_WC_BAR=1 gives a write-combined buffer one copy in card memory the CPU maps: "no CPU's side, no send of what changed ... no hashes and no compare" (shadow.rs:2521-2543). VICTORY_WINDOWS_BAR_MB does the same for windows, of which "Shaders write none" (shadow.rs:482, 551). Together they remove the system-memory side of the 2.2 and 3.2 GB write-combined regions (shadow.rs:2486) and of 3.3 GB of windows of which 1.6 GB was ever asked for (shadow.rs:5654). Both are written and off, with no result recorded. Needs a resizable BAR; competes with textures for the card. A fork enables the equivalent by default on NVIDIA and not on AMD (3102). Check: the ignored on-card tests; U0's bench says whether the host has the heap type.

U4. Promote and retry. Let a refused copy ask again when room appears, and move a copy that many passes read from system memory to the card (card_room_for, lookup). A finer grid for windows and tails (VICTORY_WINDOW_KB, VICTORY_WINDOW_TAILS, shadow.rs:5672, 5702): "782 windows ... 3,236 MB, 1,988 MB were ever copied" (shadow.rs:5690). Risk: contention with textures on a full card. Check: tests at shadow.rs:6080-6207.

U5. In place where it cannot lose. Windows that stay in system memory today gain nothing from a copy; opened in place they lose the copy and its commit and read at the same speed (VICTORY_INPLACE=1, loose, shadow.rs:5896). Before that: the title's VirtualFree reaches title_memory_freed (xmem.rs:2798, watch.rs:2962), which does not tell inplace that the memory is going; only remaps do (watch.rs:3023). With a heap open on it the free fails with error 87 (inplace.rs:33-36). And in place on a host with one pool (3102's default there; 2584 proposes the Radeon 680M) wants a host check that this tree does not make: nothing reads D3D12_FEATURE_ARCHITECTURE. Check: the WARP tests at inplace.rs:1445, 1469; the census.

U6. Finer hashes. 98 MB fetched for 16 MB put. A piece of 64 KiB with 4 KiB sub-hashes would fetch what changed. It costs card time in a pass whose time is "the time of one piece however few its pieces are" (host.rs:2659), so it wants victory replay --skip-hash-passes as the judge. While there: both launchers set VICTORY_RELAY_COPY=1, and host/torn.rs:9-13 describes a piece fetched on the copy queue keeping "the bytes from in between"; VICTORY_FETCH_CHECK is off. Either the check is cheap enough to be on ("3-4 ms for 96 MB", torn.rs:33) or the window should be argued closed in a comment.

What is deliberately not proposed: tiled buffers that mirror the console's page aliasing one to one. The runtime refuses tile mappings into heaps opened from title memory and removes the device (inplace.rs:32); a tiled buffer cannot be mapped; and this tree's own tiled path for textures has not yet run by default (5.1).

4. The submitting thread

On the RTX 5080 "the frame is the submitting thread's": preparing 20 to 22 ms of a 26 to 29 ms frame (findings.md:186-200). Outdoors, on a similar tree, the list threads take over: 450 to 1,200 ms of translation on 8 threads, two thirds of it descriptor tables (3703, Ym1r1710).

4.1 Where it still waits

With the launchers' settings (stage 3, relay stage 2, the copy queue, card steps 2, thin lists):

Wait For Trigger
A step reads title memory flights may write The flights that declared it Card steps refused the step (host.rs:6179-6188)
A title copy done by code of ours Everything in the air Step::Run (host.rs:3550, 6190)
A refresh under flights' writes Declaring flights, three tries, then everything Memory not watched, or more than 4,096 runs (host.rs:6098-6113, 3614)
256 host lists in the air Until fewer VICTORY_LATE_WAIT_LISTS (host.rs:5867)
The sweep of idle objects Everything, every 1.5 s host.rs:6243
A wait for a memory value Everything settle_now(WHY_VALUE) (host.rs:3731-3736)
The heaps' records One thread's round, 2.7 to 5.8 ms a frame host.rs:6395, heap_marks.rs:8
Dynamic descriptor slots run out Everything draw.rs:2243, 2317, 4652

Flights run in order on one queue. Waiting for an early flight of the newest frame is, in effect, waiting for the card's whole backlog (inferred), which is why the first row dominates the slow machine.

4.2 What serialises two frames

  • One lock from preparation to send: "One submission at a time from preparation to copy-back" (host.rs:6131). relay_wait sleeps holding it (host.rs:3969).
  • One thread serves the line of submissions, with a 1 ms poll (queue/behind.rs:314, 278).
  • One relay thread and one fetch. It takes everything landable in one batch and rebuilds the list of written ranges only after the whole batch (host.rs:4056-4062, 5614-5625), so whoever waits for the first flight waits for the batch (inferred).
  • QUEUE_ORDER held from the taking of dirty ranges until their list is on the queue, and around a fetch (host.rs:4891-5042, 5402-5405).
  • One present ahead: VICTORY_SUBMIT_FRAMES is 1 (queue/behind.rs:738).

4.3 Candidates

  1. Close the card steps' gaps (3.6, U1). The first row of the table.
  2. Sweep without a settle. let_go_idle already requires that only the table holds a copy (shadow.rs:3340-3346); if flights hold references the stop every 1.5 s is not needed for buffers (inferred; textures' and resources' sweeps were not audited for it). Check: refresh_tests (host.rs:11589).
  3. Value waits for declaring flights only, as reads do. Low risk. Check: a unit test on late_met_known; the lane tests (queue/behind.rs:970).
  4. Land in smaller batches when someone waits (relay_worker, host.rs:4056). Trades fetch round trips for latency. Check: landable tests.
  5. Summaries per list, made when the list closes. Every submission walks all its steps five or six times (blocked_by, copy_spans, refresh_front, run_deferred, declared_writes, joinable): "20,000 refreshes of some 4,500 copies" (host.rs:3582), "5.8 to 18.5 ms of planning" (watch.rs:561). The spans, write ranges, fill sources and a has-copy flag can be made once on the list threads. Low to medium risk. Check: written_spans_tests (host.rs:8880) and equivalence tests.
  6. A second stage. Split Host::submit after the bytes are taken (send::take): the recording of the layer's own list, the wait for the heap round, ExecuteCommandLists, the noting of the flight and the reset of landed lists go to a second thread, while the first begins the next submission. findings.md names this as what is next. It is blocked by PREPARED, CARD_WORK and the lock (shadow.rs:992, host.rs:2526) and is the highest risk in this audit. It should follow items 1 to 5, which shrink what has to be split.
  7. Fewer fork-joins. Refreshes, fills, textures and snapshots each wake the wide pool; "2 to 4 ms a frame of 'woken, not running yet'" (shadow.rs:1672). The launcher sets VICTORY_PASSES_HOT=1; the relay's merges share the same pool (shadow.rs:1831) and could have their own. Check: the ignored pass_overhead and frame_of_refreshes.
  8. Per draw, on the list threads: vertex and index buffer binds, root constants and root views are not filtered for repeats (draw.rs:1819-1834, 2024-2029, 2119-2126); each draw hashes its table's records and allocates a vector (draw.rs:4564-4600). With two thirds of outdoor translation in descriptor tables, this is the list threads' first lever.

No test drives Host::submit end to end. victory replay sends recorded host lists and times the card; it does not prepare anything (docs/replay.md:44-47). A bench on the software adapter with Shadow::unbacked and host.new_list(), reading the split counters (host.rs:8493), would be the first tool that can judge items 5 to 7 without the title (inferred).

4.4 Pacing

The frame clock runs free and paces the title's thread (frame.rs:9-10); the host Present(0, ALLOW_TEARING) happens whenever the line reaches it (host.rs:10743). Jitter in preparing therefore reaches the screen even when the average is over 30. For a locked 30: present on the clock, and cap flights by frames, not lists (inferred from the code; not measured). Check: frame.rs tests; VICTORY_TIMER_LOG=1.

5. Textures and video memory

5.1 Levels on demand is probably switched off by another switch

VICTORY_LEVELS_ON_DEMAND=1 makes a streamed texture a reserved resource that takes tiles only for the levels the title holds. Its own account: "2.2 to 3.0 GB of 4.3 to 5.5 GB of host copies in levels whose title memory was not mapped" (tiles.rs:10-14).

host_texture_as(.., reserved = true) tries the texture pool first and returns a placed texture from a 64 MiB block if the pool gives one (resource.rs:3056-3073). The reserved branch is below that (resource.rs:3075-3089) and is not reached. Tiled::make then asks GetResourceTiling of a texture that is not reserved, gets no tiles, and the caller falls back to "both or neither" (resource.rs:1743-1752). The pool is on by default (pool.rs:88-91) and the launcher sets it.

So with the pool on, the switch is likely without effect for every texture the pool can place. This was found by reading and has not been shown by a run: the on-card test builds its own reserved textures (Rig::reserved) and does not go through hosted. The launcher sets the switch to 0 with the comment "levels not on demand (sharp)", and README-fxceless.md says both that it "ran on the card for the first time" and that "it has not run on a card yet" (lines 68-71 against 104).

Shown and fixed. A test asks for a BC7 1024x1024 texture without memory of its own and has Tiled::make cut it (a_texture_asked_for_without_memory_is_not_cut_from_a_block, resource.rs). On the RTX 5080 it failed before the change, "one placed in a block has none", and passes with !reserved on the pool branch. So the switch has in fact never taken effect in a run with the pool on, and what VICTORY_LEVELS_ON_DEMAND=1 does in the title is now, for the first time, there to be measured: the launchers still set it to 0. Check on the card: cargo test -p victory-gpu --release -- --ignored levels_on_demand --nocapture with VICTORY_TILES_TEST_CARD=1, which wants the D3D12 debug layer.

5.2 Detiling on the card does not save memory yet

VICTORY_GPU_DETILE=1 moves the address arithmetic to a compute pass and is exact against the CPU on the software adapter (the_card_detiles_as_the_cpu_does, gpudetile.rs:598). As written:

  • The PC still asks the watch, reads, hashes and makes "one plain copy" (gpudetile.rs:11-13).
  • Memory goes up: the raw staging is the layout's size plus mask and tables and is never pooled (texture.rs:2399), and a device-local buffer rounded up to a power of two is added (gpudetile.rs:135-152).
  • It covers only stagings that start at level 0 (texture.rs:2381), so the streamed textures that hold a few levels stay on the CPU, and it is shut out of the uploads sent ahead (texture/ahead.rs:128).

The plan's fifth point, "drops RAM from 33 to 14-16 GB", is not what this code does. To become that it needs pooled or transient buffers, stagings that start above level 0, and a place in the uploads ahead.

5.3 The staging buffers are the textures' memory cost

A staging buffer is system memory the size of the texture, kept after the upload "so that an unchanged texture is not uploaded again" (texture.rs:601-606): "2,246 of them, 2.1 GB, at the end of run 24"; "run crash-1 held 5.2 GB" of staging blocks (pool.rs:35-36). They are let go after 2 to 10 s on a PC of 32 GB or less and after 300 s above (host.rs:386-399). The digest that says "unchanged" already lives apart from the bytes, so a staging could be dropped after a clean upload and made again on a write. Check: the ignored allocation_costs (texture.rs:2658).

And "a change detiles the whole texture, not the pages written" (texture.rs:13), although watch::writes returns the pages. Per-level or per-page detile is the streaming stall's lever: "3,000 uploads a second, every one through a staging buffer made for it and detiled whole" (draw.rs:5962-5964).

5.4 A full card

Past its line the texture gate holds new copies back and the player sees "black faces, the phone's screen empty" (resource.rs:1999-2000), "2-3 minutes of black surfaces" (draw.rs:3184). Render targets are "made with no room test" (resource.rs:1903), and over budget "the system moves the card's memory into the PC's, which ended runs 20 and 24" (resource.rs:1862). There is no Evict, no SetResidencyPriority and no SetVideoMemoryReservation anywhere in the crate; residency.rs is about the PC's memory. Tiles of a reserved texture are never taken back while its copy lives (tiles.rs:41).

Other copies a console does not make: a depth target with unordered access has a colour twin copied whole, "not the mips and slices written", and "every depth target bound for a draw counts as written" (resource.rs:348, host.rs:7301); a view in another format over a texture the card writes gets a second texture and a copy of every level per use (texture.rs:205-239).

6. The PC's memory

Commit, by pool:

Pool Size Given back
Command allocators No formula; "never gives back the memory" (host.rs:1449); 512 idle lists and 256 preludes pooled; 9 GB on the 64 GB PC Only with VICTORY_ALLOCATOR_TRIM=1, off in code, set by the launchers
Windows over title memory 4 MiB each; 3.3 GB held where 1.6 GB was asked for After 2 to 300 s idle
CPU sides of carded copies The copy's size again With the copy
Snapshots of uncarded copies The whole copy; pool to 512 MiB Pool
Texture staging The texture's size, in 64 MiB blocks After 2 to 300 s idle
List scratch and upload pools Spares to 1 GiB (128 MiB on 32 GB); 1,024 MiB per kind, two kinds Under pressure only
Buffers made ahead 4,096 x 64 KiB in system memory, the same on the card Never
Upload arenas 4 MiB each, "lives as long as the process" Never

Candidates, by evidence:

  1. The trim has its floor already. One fork found itself in memory pressure from 10 s into the world for good, freeing every spare chunk once a second and making them again: 28 ms of translator time a frame, and p99 147 to 120 ms once 256 MB of spares were kept (3703, Ym1r1710). This tree found the same and keeps 128 MiB of each kind under pressure wherever 8 GiB of the PC's memory is free (keeps_under_pressure, host.rs: "12,925 chunks, 13.5 GB and 7.7 s of waits in a 5-minute session" before), and frees them all only where memory itself is short, which it measured too (40 ms a frame of waits on a 16 GB PC with them kept). Nothing to do; a first reading of this audit had it as open.
  2. Allocator trimming in code, not only in the launcher, with smaller idle pools on 32 GB.
  3. U3 and U4 of section 3: the CPU sides and the windows are the bridge's share of commit.
  4. Staging dropped after a clean upload (5.3).
  5. The title is told the wrong budget. XMemGetWorkingSetStatistics reports the whole process's commit as the title's use: "27 GB ... against a limit of 13.5 GB" (xmem.rs:2746-2758). A title that manages streaming by that figure believes it is 13 GB over. Reporting the title's own memory may change what it streams, for better or worse; it needs a run. Check: transfers_shrink_the_title_budget (xmem.rs:2939).

16 GB of RAM is not in reach by any of these. The title's own pages are the console's 13.5 GB before the layer adds a byte.

7. Shaders and pipelines

7.1 What translated shaders carry

Beyond the title's own computation, always on unless noted:

  • a loop counter and limit on every back edge (pixel 128, vertex and mesh 256, compute 4,096; emit/lower.rs:13600-13641);
  • index clamps on the view heap, samplers, raw twins and the stride table, the last with an extra load (emit/lower.rs:8288, 8512-8524);
  • a compare and select on each LDS access (VICTORY_LDS_BOUNDS=0 turns it off);
  • for memory by address: a directory load, a clamp, a guarded branch that notes a fault, and a non-uniform heap handle per access (Lower::memory, emit/lower.rs:3630-3709). The fault store is in a branch on purpose: "a store there with every node of every ray would be most of what a trace does";
  • the NaN scrub on written colours, which the launcher turns on;
  • the emulation of 64-lane waves on a 32-lane card: retries in forms of rising cost, meetings by spinning on a counter up to 4,096 polls, group barriers. One program in its first form cost "11.9 ms a frame" and is left out by the launcher; the water's tiled light cost "about 15 ms of the card a frame" on an RTX 5070 and is left out there too.

None of it is cheap to remove safely, and the document's own experiments found the cheap ones worthless. The 64-lane forms are where card time is, and they are a correctness minefield (emit/mod.rs:713-717).

7.2 The stalls

"270-660 s of a session were full of frames over 200 ms, almost all while new pipelines were made" (findings.md:90-91). Four causes can be read from the code.

  1. Pipelines with static samplers skip the pipeline library. They are never loaded from or stored in it (with_static_samplers, pipeline/library.rs:263-287), because the driver bakes each sampler's place in a table of its own into the compiled pipeline, and a pipeline loaded in another process read its colour-grading tables through the wrong sampler. This is a smaller matter than a first reading made it: pipeline/samplers.rs now gives the driver the samplers in one order in every process, and with that the driver's own cache on disk finds these pipelines again ("13.6 s the first time, 0.6 s again in the same order", lines 10-12). What is left is a look-up in the driver's cache where the library would have loaded. Letting the library keep them (VICTORY_LIBRARY_STATIC_SAMPLERS=1 exists) is only safe while the list of samplers and the library are of one age; the gain does not justify the posterised picture if they are not. Not recommended before a measurement says the driver's cache is slow.
  2. A frame may wait 500 ms for pipelines (wait_budget, pipeline/make.rs:380-390), and 10 s for screen passes. By construction that is a frame over 200 ms whenever pipelines are pending. A budget of a frame or less for ordinary draws, with the long one kept for screen passes, trades a stall for a draw that appears a frame late. Risk: one-off passes lost (make.rs:15-16).
  3. Any change to the translator retranslates everything. build.rs hashes every file under victory-shader/src, tests included, with Cargo.lock and rust-toolchain.toml (build.rs:23-43). A test edit voids every cached translation and victory warm's list of what is done. And the list of switches in the cache's key was kept by hand and omitted VICTORY_LOOPS_WAVE, VICTORY_LDS_FIRST_INIT and VICTORY_LDS_INIT_HOIST, so a run with one of them set was served what a run without it had cached. Fixed: they are in the key while set, and a test now fails for any switch the translator reads that no list of the key's names (shader_cache.rs). Moved onto 923e38c that test failed at once, for three switches merged since: VICTORY_HDR_CLAMP, VICTORY_DEFRAG and VICTORY_SAMPLED_MARKS. VICTORY_DEFRAG=0 in particular did nothing wherever the program it leaves out was in the cache already. They are keyed the same way.
  4. Refusals are not cached. A program the translator refuses is run through the whole retry cascade again on every start (shader_cache.rs, victory-pipeline/src/cache.rs:57-59).

7.3 Ray tracing was served the wrong shaders

Found while fixing the key, and worse than a stall. victory play sets VICTORY_BVH_MISS=1 in every run: rays miss every node, because without the title's structure builder there are no structures to walk. The F1 menu's RAY TRACING sets VICTORY_BVH_BUILDER=1 beside it, and the translator then turns the misses off (emit/intersect.rs, bvh_miss). The cache's key held the switch's value, which is 1 in both runs, and not what the translator makes of it. So:

  • a player who turned RAY TRACING on was served the shaders cached without it: every ray missing structures that were now built;
  • a player who turned it off again was served whatever the run with it had translated meanwhile: walks of memory nothing built.

The menu calls the option "SLOW, BROKEN", and findings.md describes "blown-out light and black patches, more broken than without the builder". That run used the script launcher, which does not set the switch, so this is not shown to be its cause; but for victory.exe it is a cause, and no picture taken with the builder from that program can be trusted.

Fixed: where the switch is set, the key says which of the two the translator does (victory_shader::emit::bvh_miss). A start of victory.exe therefore translates its shaders once more, as after any change to the translator. Test: the_builder_beside_bvh_miss_changes_the_shader_cache_key.

8. The road, in phases

Each phase ends in something that can be judged. Phases 1 and 2 need no title to build and unit-test; all of them need a title run to accept.

Phase 0, instruments. The read watch; the refusal lines read from one run; the bus bench; the bench that drives Host::submit. A fix for victory.exe on PCs with Application Control (signing, or a documented exception) so that replay works where the title is not.

Phase 1, what is nearly free. The levels-on-demand guard (5.1). The pipeline wait (7.2). Allocator trimming in code (section 6). The freeing hook for in place (3.6, U5). The shader cache's key (7.2, 7.3). The stale comments (section 9).

Done on the branch audit/phase-0-1 (nothing below changes what a run with the launchers' settings does, but for the shader cache's key under VICTORY_BVH_MISS=1):

What Where Shown by
A texture asked for without memory is reserved, not cut from the pool resource.rs host_texture_as A test that failed on the RTX 5080 before and passes after
Ray tracing on and off have keys of their own in the shader cache shader_cache.rs build; victory_shader::emit::bvh_miss A test over five settings, each in a process of its own
Six switches of the translator are in the key while set; a new one cannot be forgotten shader_cache.rs Two tests. The second found three of the six by itself, on 923e38c: VICTORY_HDR_CLAMP, VICTORY_DEFRAG, VICTORY_SAMPLED_MARKS
The fallbacks of a present let go of the lock they hold host.rs present_planes By reading (below)
A free lets go of what is in place there watch.rs title_memory_freed; inplace.rs, port.rs The crate's tests still pass; no test of its own (below)
The bus bench host/bus.rs Its figures, 3.3
Stale comments host.rs, shadow.rs, watch.rs, tiles.rs

Left of these two phases, and why:

  • The lock in present_planes came with 923e38c, not with the audited tree. Where the composer of two planes cannot be made, or cannot record, the function means to show the base plane alone and calls itself. It let go of presenter first, which is a reference into the guard of Host::presenter and not the guard: drop of a reference does nothing (clippy says so, three times), the guard lived on, and the call locked the same mutex again, which waits for ever. The guard is dropped now. No test: the path needs a composer that fails.
  • The read watch. It goes into the fault handler and makes title memory no-access. Even as a diagnostic it can fail a kernel call the title makes on a sampled page (3.5, point 2). It wants its own change, read slowly, and a run of the title to accept it.
  • The pipeline wait. It is one number, and it changes what a player sees. It should not move without a run: VICTORY_PIPELINE_WAIT_MS is there to try.
  • The freeing hook is half a fix. The tables now forget what is in place when the title frees the memory. The heap itself goes when the last list and slot that hold it do, and until then the title's VirtualFree still fails as it did. Waiting for the flights there belongs with turning VICTORY_INPLACE on, which nothing does yet.
  • scripts/play.ps1 was left as it is. It holds the settings findings.md was measured with; a comment now says what the other launchers set beyond it.
  • findings.md and the two READMEs were not corrected: they are dated accounts of runs. Section 9 lists what in them no longer holds.

Phase 2, unified memory. U1, then U3 and U4, then U2's first two classes, each behind its switch and each judged by the frame line and by VICTORY_UPCOPY_CHECK. U2's third class and U6 only if Phase 0's counts say they pay.

Phase 3, the submitting thread. Summaries per list; the sweep and the value wait; then the second stage.

Phase 4, the console's picture and 60. The structure builder's cost is on the CPU on a fast card: +10 ms of landing and copies on the RTX 5080 (findings.md:203-225), which Phases 2 and 3 are aimed at. Present on the clock. 60 needs a frame of 16 ms where preparing alone is 21 today; it is the far side of Phase 3 and nothing here shows it is reachable.

9. Defects and stale text found on the way

Line numbers are of 32ecacf. "Fixed" means on the branch of section 8.

  • resource.rs:3056: the pool branch runs for reserved textures (5.1). Fixed.
  • shader_cache.rs: one key for ray tracing on and off under VICTORY_BVH_MISS=1; three switches of the translator not in the key (7.2, 7.3). Fixed.
  • watch.rs:2962: a free does not release in-place heaps (3.6, U5). The tables' half fixed.
  • texback.rs:7: names VICTORY_READ_WATCH, which does not exist.
  • findings.md:174, host.rs:2974, shadow.rs:968: the relay and the late wait described as off; they are on. The two comments fixed.
  • shadow.rs:1524 (VICTORY_WIDE_BACK), watch.rs:517 (VICTORY_ASK_ONCE): "off by default", on in code. Fixed.
  • shadow.rs:118-121, 191: the card's "before" described as bytes and as "up to 2x"; it is 16 bytes of hash per 64 KiB. Fixed.
  • findings.md:73: VICTORY_SHADER_OPT=127 given for the wide loads; 127 now also drops two later passes. Unset is 447.
  • findings.md:96: VICTORY_MEMORY_MAP=1 "lists it"; it is on by default in diagnostics builds and =0 leaves it out (copystat.rs:553).
  • findings.md:148: a striped mapping lock; no such code is in crates/.
  • README-fxceless.md:68-71 against 104: levels on demand both has and has not run on a card.
  • tiles.rs:24: refers to make_whole; the function is card_writes (texture.rs:1360). Fixed.
  • cores.rs:78-83 against 127: VICTORY_HELPER_PRIORITY read both as on/off and as a number from -2 to 2.
  • cores.rs:36-40: on a CPU whose cores are all of one class nothing is placed at all (inferred); there is no awareness of SMT or cache.

10. What was run here

Windows 11 26300, RTX 5080 16 GB, driver 617.42, Rust 1.98.1, release.

cargo test --workspace --locked --release --no-fail-fast:

Crate Passed Failed Ignored
victory (unit) 28 0 0
victory (tests/census.rs) 0 2 0
victory-core 16 0 0
victory-formats 47 0 5
victory-game 4 0 0
victory-gpu 477 0 37
victory-hle 192 0 3
victory-loader (unit) not run
victory-loader (integration) 3 0 0
victory-pe 36 0 0
victory-pipeline 7 0 0
victory-shader 336 0 6
xtask not run

The two failures and the two programs not run are one cause: Windows refused to start victory.exe and the two test programs (error 4551, an Application Control policy). They are not failures of the code. The asset-policy test lives in xtask and so did not run.

The replay tests report 0 tests without the diagnostics feature.

10.1 The repository's own benches, on this PC

Ryzen 9 9950X3D, 32 GB, RTX 5080. Each is an ignored test of victory-gpu, run once, by name, from the test program of the run above. They are synthetic: none of them is the title.

Detiling against copying against hashing (gpudetile::tests::cpu_costs):

Texture Detile on the PC Plain copy blake3
2048x2048 format 98, 5.6 MB 0.42 ms (13.4 GB/s) 0.24 ms (23.7 GB/s) 0.51 ms (11.1 GB/s)
2048x2048 format 71, 2.8 MB 0.22 ms (12.7 GB/s) 0.12 ms (24.0 GB/s) 0.26 ms (11.1 GB/s)
1024x1024 format 28, 5.6 MB 0.55 ms (10.3 GB/s) 0.23 ms (24.1 GB/s) 0.51 ms (11.0 GB/s)

This sizes section 5.2. Detiling on the card replaces the first column with the second; the third stays. Per texture the PC's work goes from about 0.93 ms to about 0.75 ms for 5.6 MB: a fifth, not the whole. The digest costs as much as the detile it guards, so a cheaper digest, or none where the write watch already answers, is worth as much as moving the detile.

A frame's refreshes (host::refresh_tests::frame_of_refreshes, modelled on run record-1: 30 submissions, 4,400 ranges, a 174 MB copy, a thread landing beside): 14.5 ms a frame in the mean; 3.6 ms for the submission with every copy and 10.9 ms for the 29 others; the landing thread's puts 15.4 ms. On the fastest desktop processor of its year the refreshes of a synthetic frame are still half of a 33 ms frame, on one thread. That is section 4 in one number, and the 29 small submissions cost three times the large one: the per-submission overhead, not the bytes.

Indirect draws (indirect::bench, 3,200 one-record draws, medians of 9):

Way Card Recording
Clamped one at a time 13.41 ms (4.19 us a draw) 2.83 ms
Windows of 32 0.66 ms (0.21 us a draw) 0.28 ms
One at a time, arguments in card memory 10.86 ms 2.80 ms
Windows of 32, arguments in card memory 0.55 ms 0.28 ms

The bench's 3,200 is the title's count of indirect executions in a gameplay frame (indirect/bench.rs). Clamped one at a time they would be 13 ms of the card; batches (on by default) and windows (VICTORY_INDIRECT_WINDOW=1, set by the launchers) are what keep that from being paid. The last two rows are the bus again, in small: the same work is 18 % shorter with its arguments in the card's memory.

Making resources (texture::allocation_costs): a committed staging buffer, mapped, 246 to 380 us each on one thread and 144 to 275 us on four; a texture placed in a 64 MB heap, 2 to 5 us. At the "3,000 uploads a second" of draw.rs:5962 a committed staging each would be a whole thread; this is why the pools exist and why 5.3's "drop the staging and make it again" has to mean a piece of a pooled block.

Memory that was trimmed (texture::allocation_costs::pass_costs): asking whether 16 MB is in the working set takes 54 us when it is and 2,529 us just after a trim; 4 MB, 14 against 693 us. That is the mechanism behind section 6's first candidate: what a trim gives back is paid for at about 160 us a megabyte the next time it is touched.

Waking the helpers (shadow::wide_tests::pass_overhead): 26.5 us a pass beyond the work with the helpers asleep, 10.6 us with them kept awake; 0.64 against 0.25 ms for 24 passes.

Hashing textures once a submission (host::batch::texture_checks): 576 hashes in 220 ms as it was, 48 in 18 ms as it is.

Levels on demand (tiles::tests::levels_on_demand_on_the_card): all steps pass on the software adapter (tier 3; 57 UpdateTileMappings calls in 383 us). The run on the card did not happen: it wants the D3D12 debug layer, the Windows optional feature "Graphics Tools", which is not installed here.

10.2 The bus (host::bus, added on the branch)

cargo test -p victory-gpu --release --lib host::bus -- --ignored --nocapture. Each of 4,194,304 threads reads, or stores, 64 bytes of its own of a 256 MiB buffer, four times over, between two timestamps of the card; the median of seven runs; two runs of the whole agreed within 1 %. The host says of itself: the card has memory of its own; card memory the CPU maps (a resizable BAR), yes.

Where the buffer lies Shaders read Shaders store CPU copies in CPU copies out
The PC's memory (shared_buffer, pool L0) 32.2 GB/s 2.0 GB/s 30.8 GB/s 10.1 GB/s
The card's memory (uav_buffer) 931.7 GB/s 300.1 GB/s
Card memory the CPU maps (mapped_card_buffer) 940.0 GB/s 300.1 GB/s 31.8 GB/s 0.09 GB/s

The card's memory against the PC's: reads 29 times, stores 152 times. The figures for the card's own memory are lower bounds: there the threads, not the memory, may be what takes the time. The CPU's figures are one copy of 256 MiB in, after one that made the pages, and one copy of 8 MiB out.

10.3 After the changes, still on 32ecacf

After the changes of section 8, the whole workspace again: victory-gpu 481 passed, 0 failed, 38 ignored (four tests and one measurement more than before); every other crate as in the table above, and this time Windows let victory.exe and victory-loader's tests start, so tests/census.rs passed 2 of 2 and victory-loader 46 of 46.

Then, with Smart App Control turned off on this PC by its owner, the three steps of CI as CI runs them (.github/workflows/ci.yml):

Step Result
cargo clippy --workspace --all-targets --locked -- -D warnings passes
the same with --all-features passes
cargo test --workspace --locked every test passes but one: xtask repository_passes_policy

That one is not of the branch: cargo xtask policy names bindings.ini: file type not on the allowlist, a file of the repository's root that apps/victory/src/play.rs includes. It fails on 32ecacf the same way. An exception in xtask/src/policy.rs is the project owner's to enter (docs/asset-policy.md), so the branch leaves it.

cargo clippy --workspace --all-targets --locked -- -D warnings, the first step of CI, did not pass on 32ecacf itself with the pinned toolchain: shadow.rs:1742 (manual_is_multiple_of), victory-shader emit/mod.rs:2854 (let_and_return), victory-hle gameinput.rs:1448, and with all features descriptor.rs:1234. The branch puts the four right, each as the lint asks and with no change of what the code does.

Not run: anything through victory.exe (blocked, as above), and a second build of the tests alone (cargo test -p victory-gpu --lib makes another program, which Windows also refused).

10.4 On 923e38c, where the branch now stands

cargo test --workspace --locked, with Smart App Control off:

Crate Passed Failed Ignored
victory 29 and 2 0 0
victory-core 16 0 0
victory-formats 57 0 5
victory-game 4 0 0
victory-gpu 554 0 44
victory-hle 200 0 3
victory-loader 46 and 3 0 0
victory-pe 36 0 0
victory-pipeline 7 0 0
victory-shader 348 0 8
xtask 6 1 0

The one failure is repository_passes_policy, and not of the branch: crates/victory-shader/src/emit/lower.rs: 667523 bytes exceeds the 655360-byte limit, as on 923e38c itself.

Where a small submission's refreshes go (frame_of_refreshes again, on 923e38c, with a timer round each phase of its submission for the run and then taken out): the 29 small submissions of the frame take 10.5 to 10.9 ms together, 0.37 ms each. Of that, 117 us is the one asking of the write watch and 253 us the three flushes of refreshes; adding the ranges is 3 us. Keeping the helpers awake (VICTORY_PASSES_HOT=1) changes neither figure, and one thread in place of the pool makes the flushes 278 us: this is work in a row, not threads waking. So the per-submission cost that section 4 calls the wall is, in this model of a frame, a third the kernel's answer and two thirds the copies' own bookkeeping, and neither is there to be had by spreading it wider. Fewer submissions, or fewer ranges asked again by each (4.3, item 5), is what would move it.

cargo clippy --workspace --all-targets --locked -- -D warnings does not pass on 923e38c, and so not on the branch: two findings in victory-shader emit/lower.rs and some dozen in victory-gpu, all of the commits since 32ecacf, none in a line the branch writes. The branch puts right the four that 32ecacf had, and the three of host.rs that were the lock above. The others are left to whoever merged them: dead code and long argument lists ask for a decision, not a rewrite.

11. Sources

In this repository: README.md, docs/findings.md, docs/windows-memory.md, docs/README-foxhound.md, docs/README-fxceless.md, docs/replay.md, and the comments of the files named.

Upstream, Marvisak/VIctory: 407 one address space; 1905 remaps under in-place memory; 2583 copy back on touch, with the first-touch count; 2584 hosts with one pool; 3028 card time in ordinary draws; 3102 the shared pool simulated in video memory; 3118 lazy copy-back, closed as a null result; 3312 copies in video memory; 3703 the five-track plan and its replies.

Forks: fever308/victory-corgi (VICTORY_LAZY_BACK, VICTORY_REBAR), readmet3xt-lab/foxhound (this tree's base; 0.2.0-pre.5 of 2026-11-28 is newer than what is merged here).