Structure builder: root views as memory by address, windows of its own on the card, upload memory below 2^37
The ray-tracing structure builder's 52 programs translate, validate and make host pipelines on the 7900 XTX (its waves have 32-64 lanes). What kept it from working, from a first run (light-1, VICTORY_BVH_QUARANTINE=1) and the code: - a root view ends with the host copy (a 4 MiB window); structures of megabytes cross it. Programs with a spilled user-data table now reach what their root views name by address (USER_ROOT_ADDRESS), as upstream VIctory 0f637570 does. - the list's upload memory (instance descriptions) came from the process heap, above 2^40, where shaders' addresses do not reach (upstream 0f637570, 6d021fe3). - the 1,023 numbered copies of 4 MiB ran out in the first frame: pages come in windows of 256 KiB (4 MiB around what a dispatch names), 16,383 at most. - what the builder stores came back to title memory; now only what it stores in small title buffers it names (sizes the title reads). - the directory lay in the PC's memory and every access stored a fault note. - a list without a view heap gets the title's; a dropped stage rests the builder for a frame, not for the run. Off unless VICTORY_BVH_BUILDER=1, as before. VICTORY_UPLOAD_LOW=0, VICTORY_LENT_HEAP=0, VICTORY_MEMORY_WINDOW_KB, VICTORY_MEMORY_CARD_MB. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
ad30f2cb1f
commit
b558934d7b
13 files changed
+727
-177
No files matched your search
@@ -953,10 +953,17 @@ impl State {
|
||||
dword: u32,
|
||||
memory: Option<&crate::memory::Ready>,
|
||||
) -> u32 {
|
||||
use victory_shader::emit::{USER_MEMORY_BASE, USER_VIEW_ADDRESS, USER_VIEW_BIAS};
|
||||
use victory_shader::emit::{USER_MEMORY_BASE, USER_ROOT_ADDRESS, USER_VIEW_ADDRESS, USER_VIEW_BIAS};
|
||||
if kind == USER_MEMORY_BASE {
|
||||
return memory.map_or(0, |m| m.base);
|
||||
}
|
||||
if kind == USER_ROOT_ADDRESS || kind == USER_ROOT_ADDRESS + 1 {
|
||||
return match self.roots_ref(compute).get(usize::from(slot)) {
|
||||
Some(&Root::View(address)) if kind == USER_ROOT_ADDRESS => address as u32,
|
||||
Some(&Root::View(address)) => (address >> 32) as u32,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
if kind == USER_VIEW_BIAS {
|
||||
// The view begins on 16 bytes of the copy the address finds
|
||||
// (`root_uav`, `root_srv_table`).
|
||||
@@ -1014,7 +1021,7 @@ impl State {
|
||||
list: &HostList,
|
||||
t: &crate::pipeline::Translated,
|
||||
compute: bool,
|
||||
writes: bool,
|
||||
use_: crate::memory::Use,
|
||||
) -> Option<crate::memory::Ready> {
|
||||
let heap = match self.heaps[0] {
|
||||
0 => None,
|
||||
@@ -1033,7 +1040,7 @@ impl State {
|
||||
addresses.push(self.view_address(compute, u.slot, u.dword));
|
||||
}
|
||||
}
|
||||
crate::memory::ready(list, heap, &addresses, &constants, writes)
|
||||
crate::memory::ready(list, heap, &addresses, &constants, use_)
|
||||
}
|
||||
|
||||
/// The bound heap holding `handle`.
|
||||
@@ -1154,6 +1161,15 @@ impl State {
|
||||
if crate::host::walls_trace() {
|
||||
self.walls_census(p, compute);
|
||||
}
|
||||
// A list without a view heap: one of the title's for the views the
|
||||
// host itself puts into heap slots.
|
||||
if self.heaps[0] == 0
|
||||
&& p.stages.iter().any(|s| !s.root_uavs.is_empty() || !s.root_srvs.is_empty())
|
||||
&& let Some(heap) = crate::descriptor::lent_heap()
|
||||
{
|
||||
once!("a dispatch without a view heap that needs one gets the title's");
|
||||
self.heaps[0] = heap;
|
||||
}
|
||||
// Heaps first: a root signature with directly indexed heaps must be
|
||||
// set after them.
|
||||
if self.host_heaps != self.heaps {
|
||||
@@ -1221,8 +1237,14 @@ impl State {
|
||||
let memory = if t.host.root_srvs.contains(&victory_shader::emit::SLOT_MEMORY) {
|
||||
// Only through a store by address: what it stores through
|
||||
// views is declared with them.
|
||||
let writes = writes && t.stores_by_address;
|
||||
let Some(ready) = self.memory_ready(list, &t, compute, writes) else {
|
||||
let use_ = if crate::pipeline::is_builder(self.pipeline as This) {
|
||||
crate::memory::Use::Builder { back: writes }
|
||||
} else if writes && t.stores_by_address {
|
||||
crate::memory::Use::Writes
|
||||
} else {
|
||||
crate::memory::Use::Reads
|
||||
};
|
||||
let Some(ready) = self.memory_ready(list, &t, compute, use_) else {
|
||||
once!("a shader that reads title memory by address without a view heap to hold its views: the draw is dropped");
|
||||
return false;
|
||||
};
|
||||
@@ -2317,12 +2339,17 @@ impl State {
|
||||
// A stage of the structure builder that cannot be bound is a
|
||||
// dropped stage: the others stop too.
|
||||
if crate::pipeline::is_builder(self.pipeline as This) {
|
||||
crate::pipeline::builder_off("one of its dispatches could not be bound");
|
||||
crate::pipeline::builder_rests("one of its dispatches could not be bound");
|
||||
}
|
||||
return;
|
||||
}
|
||||
#[cfg(feature = "diagnostics")]
|
||||
list.note_op(|| self.op_text(format!("dispatch {x}x{y}x{z}"), true));
|
||||
#[cfg(feature = "diagnostics")]
|
||||
if crate::pipeline::is_builder(self.pipeline as This) {
|
||||
crate::capture::op(list as *const _ as usize, || format!("builder {}", p.name));
|
||||
self.list_dropped_roots([x, y, z]);
|
||||
}
|
||||
// SAFETY: an open list with everything set.
|
||||
unsafe { list.list.Dispatch(x, y, z) };
|
||||
self.buffers_written();
|
||||
|
||||
Reference in new issue
Block a user