A write through one view of a page is seen at its other views; page writes counted; levels on demand (off); warm-up; card memory numbers

Memory sync:
- The guard over every view of a physical page (code by myokex, victory-amd
  c6dc4d8, after pull request #115 by Spexivus, its correction by joroyt and
  a part of VIctory #1122 by tightfall): the title shows one page at several
  addresses and a copy was guarded at one only. 0.8 to 1.0 million writes
  through another view in a five-minute run on the test machine.
  VICTORY_VIEW_GUARD=0 turns it off.
- Kernel reads into title memory are read beside and copied in (Joshua Odom,
  10ea38e).
- Writes of the storage layer into physical pages are counted where the
  title has the pages mapped and can open the guards there
  (VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads
  are retried.

Card memory:
- Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the
  title fills takes card memory for the levels the title holds; held levels
  get memory only while the card has room and are asked for again. Its test
  runs on the software adapter; not run on a card yet.
- Refused texture slots are held back so a pass reaches the slots behind
  them; room can be kept for card copies of title buffers (off).

Tools: translate --warm all; the shader cache is keyed on the translator's
source; counters for copy-back races, page writes and the copies the
texture sweep never lets go; a walls trace.

Game runs of these changes on an RTX 4070: five five-minute runs without a
device loss or a failed request. This merged tree was built; its test
suites were run on the tree the changes come from (gpu 129, hle 97).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
fxcelessandClaude Fable 5.2 committed 2026-11-25 00:44:25 -05:00
1 parent 310c6eb6c1
commit 8dd30ab472
25 files changed
+4218 -240

No files matched your search

+24 -2
View File
@@ -679,7 +679,7 @@ fn create() -> windows::core::Result<Host> {
/// DXGI may return hardware for `EnumWarpAdapter` (notably under Proton).
/// Reject it before creating a device in diagnostics' software-only mode.
fn warp_adapter() -> windows::core::Result<IDXGIAdapter> {
pub(crate) fn warp_adapter() -> windows::core::Result<IDXGIAdapter> {
// SAFETY: plain DXGI adapter queries.
unsafe {
let factory: IDXGIFactory4 = CreateDXGIFactory2(DXGI_CREATE_FACTORY_FLAGS(0))?;
@@ -2698,7 +2698,8 @@ fn declared_writes(runs: &[&HostList]) -> Vec<Declared> {
/// ([`read_backs`]), the frame's main pass by scissor rectangle with its
/// culling dispatches (`draw.rs`, `walls_census`), the shader-written
/// buffers merged into title memory (`shadow.rs`, `walls_merged`), host
/// copies found stale after their refresh (`shadow.rs`), and, in the
/// copies found stale after their refresh (`shadow.rs`; only with
/// `VICTORY_REFRESH_CHECK=1` as well: it costs about 100 ms a frame), and, in the
/// runtime, the read requests that fail (with 2: every request).
pub(crate) fn walls_trace() -> bool {
static ON: OnceLock<bool> = OnceLock::new();
@@ -5607,6 +5608,13 @@ fn for_pieces(start: usize, len: usize, step: usize, mut f: impl FnMut(usize, us
}
impl Host {
/// The queue everything of ours runs on, for a call that must go to it
/// in order with the lists (`crate::tiles`: a texture's levels are
/// given memory ahead of the list that uploads them).
pub(crate) fn queue(&self) -> &ID3D12CommandQueue {
&self.queue
}
/// A buffer in the upload heap, mapped for writing.
/// A buffer of `size` bytes the card writes and we read (a read back),
/// in the state copies into it need.
@@ -5854,6 +5862,7 @@ impl Meter {
"placed texture views: {} writes of another view of the texture a slot showed (it kept the old view until the new was made)",
crate::descriptor::host::KEPT_VIEWS.load(Ordering::Relaxed)
);
crate::tiles::status();
{
let [queued, due, away, partly, oldest] =
[0, 1, 2, 3, 4].map(|i| crate::draw::HEAP_TEXTURES_QUEUE[i].load(Ordering::Relaxed));
@@ -5877,6 +5886,19 @@ impl Meter {
crate::descriptor::host::STALE[4].load(Ordering::Relaxed)
);
}
{
let mode = crate::watch::page_writes();
let [writes, bytes, guarded, plain] = [0, 1, 2, 3].map(|i| crate::watch::WRITTEN[i].load(Ordering::Relaxed));
let [kept, dropped, slots, uploaded] =
[0, 1, 2, 3].map(|i| crate::descriptor::host::PAGE_WRITES[i].load(Ordering::Relaxed));
tracing::info!(
"writes behind the guards, since the start: {writes} DirectStorage writes into physical pages at addresses the title had mapped ({} MB); {guarded} guarded 64 KiB blocks of host copies lay under them ({}); {plain} reads to plain addresses finished ({}); {kept} ranges under texture views kept for the texture pass ({dropped} dropped); {slots} slots of placed textures held their bytes, {uploaded} of them uploaded before the write ({}) (VICTORY_PAGE_WRITES: unset counts, 1 acts, guards, slots, all)",
bytes >> 20,
if mode & 1 != 0 { "opened, taken again" } else { "left as they were" },
if mode & 4 != 0 { "told as well" } else { "counted only" },
if mode & 2 != 0 { "made due again" } else { "left as they were" }
);
}
#[cfg(feature = "diagnostics")]
tracing::info!(
"write-watch askings of a millisecond or more: {:.1} a frame, {:.1} ms a frame; the longest asking {:.1} ms",