GPU: a refresh on several threads without its two contended locks; benches of placements and of one sparse buffer by address; audit section 11 #3268
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3268"
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-29T21:11:01Z.
Four commits, on
f72cec77. One changes what the layer does; the others are two benches, one probe of the card, and a section of the audit. No game was run: every figure is from a synthetic bench on one PC (Ryzen 9 9950X3D, RTX 5080 16 GB, driver 621.24, Windows 11 26300).The change: a refresh on several threads (
shadow.rs)A refresh of 1 MiB or more is cut into parts for the helper threads (
Shadow::take_all). For 14 MiB of scattered pages that was 2,754 parts, and each took two locks of the copy:card.dirty, to tell the card's side of its bytes: 8 to 12 ms of the helpers' summed time a refresh, waiting;landings, to look at the pages a landing noted: 6.5 ms.(Timers added for the measurement and taken out.) Now the parts are grouped into tasks of 256 KiB, a task's marks are kept on its thread and told under one lock when it ends (
telling_once), and the noted pages are an atomic bitmap. A mark still appears only after its bytes are in the copy and before the refresh returns.host::placement::placements, 64 MiB copy, the title writes 16 MiB before each submission, three alternating runs each:With 1 MiB written, and in
frame_of_refreshes, nothing changes (14.8 against 14.7 ms): a refresh under 1 MiB stays on one thread.Test:
a_refresh_on_several_threads_tells_the_cards_side_of_all_it_took(write-watched memory, a view, and write-watched memory that landings write too). It passes on the code as it was, and fails if the kept marks are dropped, if the noted bits are never set, or if they are never read.Benches and the probe (all
#[ignore])host::placement::placements: what one submission costs by where a title buffer's copy lies (one side in the PC's memory, two sides, two sides with writes left on the card, one side in card memory the CPU maps), through the real paths (shadow::register,refresh,gpu_writes,execute_own,settle_now), with the host's ownSPLITandsend::STATS. At 16 MiB written: prepared and sent 1.23 / 2.42 / 2.27 / 0.89 ms, run and landed 4.57 / 1.17 / 0.63 / 0.18 ms.host::bus::one_buffer_by_address: a sparse buffer of 4 GiB whose tiles lie in aGPU_UPLOADheap, written by the CPU through a buffer placed in the same heap. On this card: shaders read 939 GB/s and store 300 GB/s through it (as through a buffer of its own), the CPU copies in at 31.8 GB/s, all 16,384 threads read what the CPU wrote and the CPU reads what they stored, and 4 MiB is hidden or shown in 0.1 ms. Direct3D's documents neither allow nor forbid tiles in such a heap; this is one driver, without the debug layer.The audit, section 11
How Xenia, shadPS4, RPCS3, Ryujinx, yuzu, Vita3K and Dolphin hold the console's one memory, read from their source; what they have in common that this tree has not (most leave shader writes on the card unless asked; the two nearest in kind hold one sparse buffer by address; books by page); what the probe above means for section 3.6, which had turned the sparse buffer down because it cannot be mapped; a PC of 16 GB with a card of 8 GB; and one change tried and not kept.
What was run
cargo test -p victory-gpu --release --lib --locked, on this branch and onmainbeside it: the same tests fail on both. Deterministically,shader_cache::tests::every_switch_of_the_translator_is_in_the_key:1b4b6cd4putVICTORY_SCALAR_SPLITS(and the fourVICTORY_ORACLE_*names) back intoshader_cache.rswhile what read them stays reverted (a1fe8350). This branch leaves that to you: the name is hashed into every key whether it is set or not. In the full run only, on both: three ofpipeline::host::tests(out of memory making a pipeline) and one or two oftexback::tests; and now and thencard_steps::tests::places_written_after_sending_are_learnedanduav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue. Each of those passes run alone.cargo clippy -p victory-gpu --all-targets --locked: nothing in the lines this branch writes.The check
checkfails here at the Clippy step, atcrates\victory-loader\src\crash.rs:804(unwind_copyis never used withoutdiagnostics). This branch does not touchvictory-loader. The same step fails at the same line on every push tomaintoday (f72cec77, this branch's base, among them) and on the other pull requests that ran it. Run here without-D warnings, the step has 36 findings onmain, none in a line this branch writes. #2792 and #2682 put that line right (and the key test above); this branch leaves the gate to them so as not to be a third.Limits
CopyBufferRegioncalls for 14 MiB.Merged with
mainagain (2026-11-30,c71899d9)The branch holds two merges of
main(no rewrite of what was pushed): the first resolved the one conflict there was, inShadow::take_all(main'swide_each_scopedand this branch's tasks told once, both kept); the second, with the 494 commits since, was clean.Measured again on that
mainwith the same bench, the binary withmain'sshadow.rsand the one with this branch's run in turn three times, 16 MiB written before each submission to a copy with two sides: a submission 4.62 to 4.78 ms before and 3.72 to 3.79 after; of it the preparing 3.24 to 3.34 ms before and 2.31 to 2.39 after. With 1 MiB written nothing changes, as intended (such a refresh does not take the path).cargo test -p victory-gpu --release --libon the merged branch: 1,115 pass; the two that fail aremain's (list::thin::tests::bindings_record_no_work,shader_cache's key test). The crate's tests compile only with #4115 (two calls onmainmiss an argumentcard_passgained); they were run with it applied and not committed here.The audit has a new section, 11.8: what the public forks (Foxhound, neonbyte1, SlaktarnVI) have that this tree has not, what was taken over from them, and what was measured and left.
Measured in play (2026-11-30)
VICTORY_TELL_ONCEis new in this pull request: the grouping of a refresh into tasks of about 256 KiB, which used to be always on, can now be turned off (=0, as before) and so weighed in play. The refresh tests pass both ways. The branch is merged withe1251c31.One session in the title's world on an RTX 5080 with a Ryzen 9 9950X3D (driver 621.40, Series X profile, 1440p, DLSS Quality, about 4,800 draws a frame), built on
e1251c31.VICTORY_AB=10,VICTORY_SUBMIT_SPLIT,VICTORY_TELL_ONCE,VICTORY_UNDER_FUSEDflipped the three switches every 10 s through all eight combinations. Each switch's effect is the mean of its four "on" phases minus its four "off" phases, within each full 80-second cycle, over 5 cycles:VICTORY_SUBMIT_SPLIT(upstream's, off by default)VICTORY_TELL_ONCE(#3268)VICTORY_UNDER_FUSED(#3582)The card was 99 to 100 % busy throughout, so in this scene the frame waits on the card, not on the submitting thread. Where the frame is bound by that thread, these gains should show more; this session can't say how much more. Five cycles of one scene is a small sample.
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.