The first room renders right: byte-copied descriptor records are mirrored, views off their copy's elements get their own bytes, card room for the first world frame, levels on demand run on the card

- Descriptor records the title copies into its heap as bytes are mirrored
  before each submission (pull request #305 by Flyander, after upstream
  VIctory 86a5ed6), with a per-slot fingerprint so only records that
  changed are mirrored, the page read through the kernel, a switch
  (VICTORY_HEAP_SYNC=0) and a counter: about 40,000 records a frame on the
  test machine.
- A buffer view off its copy's elements gets a copy of its own bytes
  (after upstream 86a5ed6; VICTORY_VIEW_OWN_COPY=0: refused as before).
- Room on the card for the world's first-frame bursts: buffer copies
  (VICTORY_CARD_ROOM_FOR_BUFFERS, now on) and render targets
  (VICTORY_CARD_ROOM_FOR_TARGETS_MB, 3,072); a copy turned down gives its
  room up and is logged; the texture pass asks again every 32 MiB. 98
  buffer copies made (945 MB) where earlier runs made 1; 25 MB compared
  on the processor a frame where it was 550 to 710.
- Levels on demand: the fixes of pull request #747 by AscilCH. First run
  on a card (RTX 4070, VICTORY_LEVELS_ON_DEMAND=1): no device loss, 3.1 GB
  not allocated for levels the title does not hold. Still off by default.
- The guarded blocks under storage writes into physical pages are opened
  by default (VICTORY_PAGE_WRITES=0: counted only).
- Shaders: a program is translated with first-half interpolation pairs
  only if it was refused for one (with it on for every program 8,551
  working pixel programs came out changed); parked lane-mask pairs,
  f64 conversions and sums, lane permutations: 14 more programs translate.
- Counted, not fixed: an indirect compute pass asks for about 77,500
  groups in x and is cut to 65,535.

One five-minute game run of these changes on the test machine: no device
loss, no failed request. This merged tree was built; its test suites
were not run.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
fxcelessandClaude Fable 5.2 committed 2026-11-25 01:46:49 -05:00
1 parent 847a0af35e
commit 6afd80f252
13 files changed
+1188 -58

No files matched your search

+38 -2
View File
@@ -1433,12 +1433,48 @@ pub(crate) fn room() -> bool {
}
match crate::host::host().and_then(|h| h.video_memory()) {
// What is kept for card copies of title buffers not made yet
// counts as used (`crate::shadow::card_room_kept`; 0 by default).
Some([budget, used, ..]) => used + crate::shadow::card_room_kept() < budget / 100 * room_percent(),
// (`crate::shadow::card_room_kept`) and for the render targets a
// world makes in its first frame ([`targets_room_kept`]) counts as
// used.
Some([budget, used, ..]) => {
used + crate::shadow::card_room_kept() + targets_room_kept() < budget / 100 * room_percent()
}
None => filled < WITHOUT_BUDGET,
}
}
/// The bytes of the card's memory the texture queue leaves free for
/// render targets and other host copies the host itself writes that are
/// not made yet: `VICTORY_CARD_ROOM_FOR_TARGETS_MB` (3,072; 0: none, as
/// before) less what such copies hold now.
///
/// Measured (runs 193, 197, 198): 652 MB of them before the world, 2,255
/// to 2,352 MB right after its first frame, 2,800 to 3,100 MB two minutes
/// on, none of them idle (run 198's census). They are made with no room
/// test, in the same frame as the card copies of title buffers (762 MB),
/// after the texture queue has filled the card to its line with textures
/// written while the world loaded (7.3 GB of them at the first world frame
/// of run 193, of which 2.3 GB were let go again within 13 seconds). The
/// card then stood at 99 to 100.5 % of its budget, buffer copies were
/// turned down for good (31 of 95 made: the frame 355 ms where 95 give
/// 238), and the queue was refused from the first world frame on. With
/// their room kept, the queue stops that much earlier while the world
/// loads and gets it back as the targets are made.
#[cfg(windows)]
pub(crate) fn targets_room_kept() -> u64 {
use std::sync::atomic::Ordering::Relaxed;
static MOST: std::sync::OnceLock<u64> = std::sync::OnceLock::new();
let most = *MOST.get_or_init(|| {
std::env::var("VICTORY_CARD_ROOM_FOR_TARGETS_MB")
.ok()
.and_then(|v| v.trim().parse::<u64>().ok())
.map_or(3072 << 20, |mb| mb.min(8192) << 20)
});
// Every host texture's bytes less those of the copies the title fills.
let targets = HOST_TEXTURES[1].load(Relaxed).saturating_sub(KINDS[1].load(Relaxed));
most.saturating_sub(targets)
}
/// [`room`] as it was at most a tenth of a second ago, for a question
/// asked of many textures a frame ([`room`] asks the system each time).
#[cfg(windows)]