GPU: placement by what the card may do: buffers in memory read-only to the card (VICTORY_RO_BAR, RO_TILES, RO_INPLACE; all off) #3401
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3401"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by banaanpapa on 2026-11-29T22:49:12Z.
Stacked on #3268: the first four commits here are that pull request's (its bench is what measures this one). The six after them are new. Everything new is behind switches that are off; with them off the tree behaves as before. No game was run: every figure is from a synthetic bench on one PC (Ryzen 9 9950X3D, RTX 5080 16 GB, driver 621.24).
The idea
The other layers guess which memory comes back from the card. This title says it: memory it asks for with read-only GPU page protection is memory the console's card cannot write (
title_memory_gpu_readonly), andVICTORY_GPU_RO_SKIPalready takes such pages out of what shaders are declared to write. So for such memory nothing is ever found, fetched or merged, and a copy's CPU side has no use left there: it is a second copy of every byte in the PC's memory, a second copy of every changed byte on its way up, and aCopyBufferRegionfor each run. Placement can follow that declaration.What is added (all off)
VICTORY_RO_BAR=1: a title buffer that lies whole in such memory, where its copy would have had two sides, gets one copy in card memory the CPU maps (whatVICTORY_WC_BARmakes for write-combined memory, but from the title's declaration and not from a guess about its CPU).VICTORY_RO_TILES=1: a buffer that lies in such memory in part (the 174 MiB heap: a ring the CPU writes beside pools shaders write) keeps two sides, and its card's side becomes one sparse buffer over two heaps (host/mixed.rs): the read-only stretch in card memory the CPU maps, written by the refresh and never sent. The host is asked once whether a sparse buffer shows what the CPU wrote beside it; where it does not, the copy is made as before.VICTORY_RO_INPLACE=1: such a buffer whose copy would be in the PC's memory is opened in place. WhatVICTORY_INPLACE=2must assume of shader writes, this memory has none of.VICTORY_RO_CENSUS=1: the frame-rate line says how many MB a frame went up to card sides and how many of them lay in such memory.VirtualProtect, and a commit at an address, tell the card first (title_memory_protecting).Figures (
host::placement, a 64 MiB buffer, 16 MiB written by the title before each submission)RO_BAR)RO_TILES)RO_INPLACE)In every round the title's last written page was read back from the card, and what shaders wrote was in title memory.
What was run
host::membench(the title's own calls),memory_bench_reclaims_and_regrows_with_correct_bytes, with its source said read-only by the newVICTORY_MEMBENCH_RO=whole|half: the 32 MiB copied on the card and fetched back match the source withRO_BAR, withRO_TILESand withRO_INPLACE, with and without the relay.cargo test -p victory-gpu --release --lib: 916 pass; the six that fail are those that fail onmainbeside it (three ofpipeline::host,shader_cache's key test, two oftexback). Clippy says nothing of a line this branch writes. The all-features build does not compile onmain(copystat.rs,host.rs:9231), so that gate was not run.Limits and risks
VICTORY_RO_CENSUSare there to say.VICTORY_RO_TILESleans on what Direct3D's documents do not speak of (tiles of a sparse buffer in aGPU_UPLOADheap, written through a second buffer placed in it). It works on the one driver asked. A driver that refuses may remove the device at the first such copy.VICTORY_RO_INPLACEcarries in place's old risk, and the bench now shows it: after the buffer is let go its heap closesVICTORY_BURY_LAGsubmissions later, and aVirtualProtectorVirtualFreeof the title's within that time is still refused. The same holds fortitle_memory_freeing. Section 11.4 of the audit has the measurement.The audit's section 11.4 lists five runs that say what each switch is worth in the title, and the line each is read off.
Merged with
mainagain (2026-11-30,c71899d9)Merged, not rebased; four files conflicted with what
maindid since, and each is fitted tomain's form:shadow.rs):mainnow splits a copy's admission from its making and answers with aBufferHit. This branch's three placements come before the admission, and a copy placed is noted asmainnotes its own (remember_placed). The table isBuffersnow, andro_let_gowalks its map.shader_writes: a copy made for read-only memory leaves beforemain's copy-back by memory class (VICTORY_UNIFIED_BACK). The two rest on the same declaration:main's classgpu-rosays such memory needs no copy-back, and this branch says it then needs no CPU side either.inplace.rs:main'splace_privateis what this branch'splace_if_it_can_bewas;place_read_onlycalls it.host/send.rs:mainplans all copies' runs in one function that does not know the copies; the census is taken before it.xmem.rs:mainlets go of what is in place before the title'sVirtualProtectalready, so this branch's call there is gone.Run again on the merged branch, RTX 5080:
cargo test -p victory-gpu --release --lib, five runs: 1,121 pass and the two that fail aremain's (shader_cache's key test,list::thin::tests::bindings_record_no_work); in two of the five thecard_stepsanduav_pooltiming tests failed as well, and both pass alone. Run with #4115 applied and not committed here.host::placement, 16 MiB written before each submission: read-only whole, two sides 2.94 ms and one mapped copy 1.15 ms; read-only past what shaders write, two sides 3.79 ms and that part in mapped tiles 1.85 ms; in place the preparing 0.04 ms against 0.79.host::membench's byte check passes withRO_BAR,RO_TILESandRO_INPLACE, with and without the relay.What
main's document on memory classes does not say is how much of the title's memory isgpu-ro;VICTORY_UNIFIED_STATS=1and this branch's log line would. Until a run says, these switches stay what they were: off.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:52:37Z.
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed