Title buffers' copies down to any size in the card's memory (VICTORY_CARD_BUFFERS_MIN_KB), the card's hashes over the buffer's own bytes (both after fxceless c36971b2)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 15:35:09 -06:00
1 parent 2be0515cbe
commit 17c4717b44
2 files changed
+29 -4

No files matched your search

+2 -2
View File
@@ -4234,7 +4234,7 @@ impl Host {
list.SetPipelineState(&work.pso);
list.SetComputeRootUnorderedAccessView(3, work.differs.0.GetGPUVirtualAddress());
for (shadow, ranges) in &dirty {
let Some((_, Some(before), size)) = shadow.card_sides() else {
let (Some((_, Some(before), _)), size) = (shadow.card_sides(), shadow.card_hash_size()) else {
continue;
};
// No twin (it cost the card the copy's size again,
@@ -4364,7 +4364,7 @@ impl Host {
list.SetPipelineState(&work.pso);
list.SetComputeRootUnorderedAccessView(3, work.differs.0.GetGPUVirtualAddress());
for r in plan.ranges.iter().filter(|r| r.compared) {
let Some((_, Some(before), size)) = r.shadow.card_sides() else {
let (Some((_, Some(before), _)), size) = (r.shadow.card_sides(), r.shadow.card_hash_size()) else {
continue;
};
list.SetComputeRootShaderResourceView(1, r.shadow.buffer.GetGPUVirtualAddress());
+27 -2
View File
@@ -224,12 +224,22 @@ fn card_limits() -> (u64, u64) {
env_mb("VICTORY_CARD_BUFFERS_MIN_MB"),
env_mb("VICTORY_CARD_BUFFERS_MB"),
);
// `VICTORY_CARD_BUFFERS_MIN_KB` (after fxceless c36971b2) says the
// least size in KiB, so that it can go under 1 MiB: 64 is every title
// buffer. Copies under 1 MiB are nearly all there are and few bytes;
// in the PC's memory every load, store and atomic a shader does on
// them crosses the bus.
if let Some(kib) = std::env::var("VICTORY_CARD_BUFFERS_MIN_KB").ok().and_then(|v| v.trim().parse::<u64>().ok())
&& kib > 0
{
min_bytes = kib << 10;
}
if card_all() {
min_bytes = 0;
}
tracing::info!(
vram_budget_mb = vram_budget.map(|b| b >> 20),
card_buffers_min_mb = min_bytes >> 20,
card_buffers_min_kb = min_bytes >> 10,
card_buffers_max_mb = max_bytes >> 20,
"card buffer limits"
);
@@ -4225,10 +4235,25 @@ impl Shadow {
/// it in the card's buffer (which may be longer than the copy), widened
/// to 16 bytes.
pub(crate) fn card_hashed(&self, piece: u32) -> (usize, usize) {
let size = self.card.as_ref().map_or(self.len, |c| c.size) as usize;
let size = self.card_hash_size() as usize;
card_hashed_of(self.start as usize, size, piece as usize)
}
/// The bytes of the copy the card's hashes cover: the title buffer's own,
/// rounded up to the hash's 16-byte step. The card's buffer is the title
/// buffer rounded up to 64 KiB, of which a title buffer of 288 bytes can
/// give nothing back but those (after fxceless c36971b2).
/// `VICTORY_CARD_HASH_LEN=0`: the whole buffer.
pub(crate) fn card_hash_size(&self) -> u64 {
static OWN: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
let size = self.card.as_ref().map_or(self.len, |c| c.size);
if *OWN.get_or_init(|| std::env::var_os("VICTORY_CARD_HASH_LEN").is_none_or(|v| v != "0")) {
self.len.next_multiple_of(16).min(size)
} else {
size
}
}
/// The walls trace (`crate::host::walls_trace`): a piece of `fetched`
/// bytes of this copy came back from the card and `written` of them
/// went into title memory. Summed per buffer and logged once a frame: