feat(6gb/16gb): RAM-pressure trims, allocator peak-cap, submission toggles, diagnostics

Opt-in, inert-by-default performance work for 6 GB VRAM / 16 GB RAM PCs:
- VICTORY_RAM_PRESSURE_MB: physical-RAM-gated fence-safe idle trims
- VICTORY_LIST_ALLOC_CAP_MB: shed D3D12 command-allocator high-water peak
- VICTORY_TRIM_MIN_MS: hold back zero-yield heavy sweeps to stop frame spikes
- VICTORY_JOIN_FEWER / RELAY_EACH / TABLED_BITS: submission-path latency toggles
- diagnostics-only per-frame refresh/read/dip timers (copystat/dipstat)
- play-6gb.ps1 + play-6gb.cmd launcher preset (OPT=447, INPLACE=0, the above)

The title is referred to only as "the title" throughout.
This commit is contained in:
theme613 committed 2026-12-01 14:09:41 +08:00
1 parent f0d1eb7682
commit 86184c68f3
42 files changed
+4166 -522

No files matched your search

+21 -3
View File
@@ -83,12 +83,26 @@ fn helper_priority() -> Option<i32> {
})
}
/// Effective priority for critical submission/helper threads (`from <= 2`) vs
/// background list-translation workers (`from == 3`): when `VICTORY_HELPER_PRIORITY`
/// is positive (e.g. `1`), critical submit/wide threads run one tier higher (`+2`,
/// `HIGHEST`) than list-translation workers (`+1`, `ABOVE_NORMAL`), which in turn
/// stay ahead of the title's busy-wait threads (`0`, `NORMAL`).
fn effective_priority(from: u32, requested: i32) -> i32 {
if from <= 2 && requested > 0 {
(requested + 1).min(2)
} else {
requested
}
}
fn ask(what: &str, from: u32) {
use windows_sys::Win32::System::Threading::{GetCurrentThread, SetThreadPriority, SetThreadSelectedCpuSets};
if let Some(priority) = helper_priority() {
if let Some(requested) = helper_priority() {
let priority = effective_priority(from, requested);
// SAFETY: this thread's own priority.
let set = unsafe { SetThreadPriority(GetCurrentThread(), priority) } != 0;
tracing::debug!(what, priority, set, "the thread's priority (VICTORY_HELPER_PRIORITY)");
tracing::debug!(what, from, priority, set, "the thread's priority (VICTORY_HELPER_PRIORITY)");
}
if stage() < from {
return;
@@ -152,7 +166,11 @@ impl Priority {
if self.applied == Some(on) {
return;
}
let priority = if on { THREAD_PRIORITY_ABOVE_NORMAL } else { THREAD_PRIORITY_NORMAL };
let priority = if on {
helper_priority().map_or(THREAD_PRIORITY_ABOVE_NORMAL, |p| effective_priority(2, p))
} else {
THREAD_PRIORITY_NORMAL
};
// SAFETY: our own thread.
unsafe { SetThreadPriority(GetCurrentThread(), priority) };
self.applied = Some(on);