Card memory the CPU maps: windows, sends and scratch (VICTORY_WINDOWS_BAR_MB, VICTORY_SEND_BAR, VICTORY_SCRATCH_BAR); the card's own stamps (VICTORY_CARD_SPANS)

GPU_UPLOAD heaps, all off by default. Replayed yard frame (capture
play-1125-0127): 36.3 ms; windows in the card's memory 31.9, sends 32.7.
Replay: --pace, --breadcrumbs, copies counted by the memory they cross.
VICTORY_GPU_LOAD_MS: what the title's GPU timestamps show.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 03:35:03 -06:00
1 parent 0abcb9fd89
commit 26b15e8fe3
9 files changed
+549 -12

No files matched your search

+19 -4
View File
@@ -88,8 +88,19 @@ unsafe impl Send for Memory {}
/// What submissions that have run gave back.
static SPARE: Mutex<Vec<Memory>> = Mutex::new(Vec::new());
/// At most this much is kept.
const KEPT: u64 = 768 << 20;
/// At most this much is kept (of the card's memory, with [`on_card`]).
fn kept() -> u64 {
if on_card() { 256 << 20 } else { 768 << 20 }
}
/// Whether the memory lies in the card's memory, written by the CPU through
/// the bus (`VICTORY_SEND_BAR=1`): the copies on the card's drawing queue, which
/// nothing overlaps, then cross no bus. In a captured frame they took 5.4 ms of
/// the card's 30 (342 copies).
fn on_card() -> bool {
static ON: OnceLock<bool> = OnceLock::new();
*ON.get_or_init(|| std::env::var_os("VICTORY_SEND_BAR").is_some_and(|v| v == "1"))
}
fn memory(host: &Host, size: u64) -> Option<Memory> {
{
@@ -100,7 +111,11 @@ fn memory(host: &Host, size: u64) -> Option<Memory> {
}
}
let size = size.next_multiple_of(8 << 20);
let (buffer, data) = host.upload_buffer(size)?;
let mapped = if on_card() { host.mapped_card_buffer(size, false) } else { None };
let (buffer, data) = match mapped {
Some(made) => made,
None => host.upload_buffer(size)?,
};
name(&buffer, || "bytes a submission sends up".into());
Some(Memory {
buffer,
@@ -114,7 +129,7 @@ pub(super) fn give_back(memory: Memory) {
let mut spare = SPARE.lock().unwrap_or_else(|e| e.into_inner());
spare.push(memory);
spare.sort_by_key(|m| std::cmp::Reverse(m.size));
while spare.iter().map(|m| m.size).sum::<u64>() > KEPT {
while spare.iter().map(|m| m.size).sum::<u64>() > kept() {
spare.remove(0);
}
}