Write-combined title memory: no write-back of shader writes, one mapped copy (switches)

The title's write-combined memory (protection 0x400: 2.2 and 3.2 GB,
0x2404) is what its CPU writes and does not read. Of the gameplay frame's
compares (coolfox-20261126-184458) seven of the eight largest ranges, about
360 of 730 MB a frame, lie in it, and 36 MB a frame of it was fetched and
merged into title memory.

- xmem notes write-combined regions (forgotten when freed or decommitted),
  `victory_gpu::title_memory_write_combined`.
- VICTORY_WC_NO_BACK=1: a copy with two sides of write-combined memory has
  no write-back: no hashes, compare, fetch or merge; what shaders write stays
  on the card. Refreshes still send whole pages.
- VICTORY_WC_BAR=1: a write-combined title buffer gets one copy in card
  memory the CPU maps (GPU upload heap, resizable BAR): refreshes write it
  through the bus, nothing is sent, no CPU side, no write-back. Counted
  with the card sides of copies (card_limits) and made while a fifth of the
  budget is free.

Both off by default. Risks (shadow.rs, wc_no_back): the title's CPU reading
what shaders wrote there reads older bytes; a page the title writes goes up
whole and takes back what shaders wrote in the same 4 KiB page; another
host copy of the same bytes does not see shader writes. The frame line says
how many MB of declared writes were left on the card.

Test: the registry of write-combined regions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
readmet3xt-labandClaude Opus 5.5 committed 2026-11-26 19:14:48 +05:30
1 parent 672442b710
commit 50c15a145a
5 files changed
+230 -3

No files matched your search

+4 -2
View File
@@ -8760,10 +8760,12 @@ impl Meter {
split_line(frames);
{
let [passes, pieces, compares] = [0, 1, 2].map(|i| CARD_PASSES[i].swap(0, Ordering::Relaxed) as f64 / frames);
if passes + compares > 0.0 {
let wc_left = crate::shadow::WC_LEFT.swap(0, Ordering::Relaxed) as f64 / 1e6 / frames;
if passes + compares + wc_left > 0.0 {
tracing::info!(
"our passes over copies in the card's memory per frame: {passes:.0} hash passes over {pieces:.0} pieces after \
ranges were sent up (VICTORY_CARD_REHASH_RUNS=1 joins them: now {}), {compares:.0} compare passes",
ranges were sent up (VICTORY_CARD_REHASH_RUNS=1 joins them: now {}), {compares:.0} compare passes; \
{wc_left:.1} MB declared written in write-combined memory left on the card (VICTORY_WC_NO_BACK)",
if rehash_runs() { "on" } else { "off" }
);
}