A root constant buffer not 256-byte aligned is copied into scratch memory once for the draws of a list that bind it (from Belobug 84ea9c12, romainhedouin)

Until the list next writes title memory, as for refreshes: up to 64 KiB of
fill less for every repeat. How often this title binds one was not measured.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 15:43:00 -06:00
1 parent ab86ef7f3f
commit c96525dbb2
2 files changed
+20 -3

No files matched your search

+1 -3
View File
@@ -713,9 +713,7 @@ fn root_view(list: &HostList, address: u64, srv: bool) -> Option<u64> {
crate::book::root(gpu, len);
return Some(gpu);
}
let (gpu, to) = list.scratch(len)?;
list.defer_fill(to, address as *const u8, len as usize);
Some(gpu)
list.fill_scratch(address as *const u8, len)
}
macro_rules! once {
+19
View File
@@ -2190,6 +2190,9 @@ struct Deferred {
/// memory (host copy, address, bytes): declaring them again would
/// change nothing.
gpu_written: std::collections::HashSet<(usize, usize, usize), std::hash::BuildHasherDefault<AddressHash>>,
/// Scratch memory [`HostList::fill_scratch`] fills since the list last
/// wrote title memory (source, bytes): its host address.
filled: std::collections::HashMap<(usize, usize), u64, std::hash::BuildHasherDefault<AddressHash>>,
/// Textures whose contents the list brings up to date.
textures: std::collections::HashSet<usize>,
/// Bottom-of-pipe writes, done once the list has run: address, what,
@@ -2230,6 +2233,7 @@ impl Deferred {
fn title_written(&mut self) {
self.refreshed.clear();
self.gpu_written.clear();
self.filled.clear();
}
}
@@ -6676,6 +6680,21 @@ impl HostList {
.push(Step::Fill(dst as usize, src as usize, len, None));
}
/// The host address of `len` bytes of scratch memory that hold the title
/// memory at `src` as of the list's submission: one fill for every ask
/// until the list next writes title memory.
pub(crate) fn fill_scratch(&self, src: *const u8, len: u64) -> Option<u64> {
let key = (src as usize, len as usize);
let known = self.deferred().filled.get(&key).copied();
if known.is_some() {
return known;
}
let (gpu, to) = self.scratch(len)?;
self.defer_fill(to, src, len as usize);
self.deferred().filled.insert(key, gpu);
Some(gpu)
}
/// As [`HostList::defer_fill`], for upload memory that only `slot` (a
/// title heap's address, and the slot) shows.
pub(crate) fn defer_constants(&self, dst: *mut u8, src: *const u8, len: usize, slot: (usize, u32)) {