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
0abcb9fd89
commit
87eb9f2449
13 files changed
+727
-177
No files matched your search
@@ -114,7 +114,7 @@ struct List {
|
||||
/// Ours, after the console layout: memory handed out by
|
||||
/// [`allocate_upload`], kept until the list is reset; the host list the
|
||||
/// calls record into (decision 0007), and the draw state the title set.
|
||||
uploads: std::sync::Mutex<Vec<Vec<u8>>>,
|
||||
uploads: std::sync::Mutex<Vec<Upload>>,
|
||||
#[cfg(windows)]
|
||||
host: Option<crate::host::HostList>,
|
||||
#[cfg(windows)]
|
||||
@@ -187,7 +187,7 @@ pub(crate) fn host_list<'a>(this: This) -> Option<&'a crate::host::HostList> {
|
||||
#[cfg(windows)]
|
||||
pub(crate) struct Detached {
|
||||
host: crate::host::HostList,
|
||||
_uploads: Vec<Vec<u8>>,
|
||||
_uploads: Vec<Upload>,
|
||||
_state: crate::draw::State,
|
||||
}
|
||||
|
||||
@@ -1481,6 +1481,23 @@ extern "system" fn reset_x(this: This, allocator: This, pipeline: This, _flags:
|
||||
reset(this, allocator, pipeline)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
use crate::upload::Upload;
|
||||
|
||||
/// The memory of [`allocate_upload`] where no host GPU reads it by address.
|
||||
#[cfg(not(windows))]
|
||||
struct Upload(Vec<u8>);
|
||||
|
||||
#[cfg(not(windows))]
|
||||
impl Upload {
|
||||
fn new(len: usize) -> Option<Upload> {
|
||||
Some(Upload(vec![0; len]))
|
||||
}
|
||||
fn start(&mut self) -> *mut u8 {
|
||||
self.0.as_mut_ptr()
|
||||
}
|
||||
}
|
||||
|
||||
/// Newer lists' 0x4a0 `(size, alignment) -> pointer`: memory the list
|
||||
/// owns until it is reset, which the CPU writes and the GPU reads at the
|
||||
/// same address; null on failure. The title's BVH builder puts
|
||||
@@ -1494,13 +1511,14 @@ extern "system" fn allocate_upload(this: This, size: u64, alignment: u64) -> *mu
|
||||
if this.is_null() || !align.is_power_of_two() {
|
||||
return std::ptr::null_mut();
|
||||
}
|
||||
let mut block = vec![0u8; len];
|
||||
let start = block.as_mut_ptr();
|
||||
let Some(mut block) = Upload::new(len) else {
|
||||
return std::ptr::null_mut();
|
||||
};
|
||||
let start = block.start();
|
||||
// SAFETY: the offset is below `align`, so `size` bytes fit after it.
|
||||
let at = unsafe { start.add(start.align_offset(align)) };
|
||||
// SAFETY: the title passes one of our lists.
|
||||
let uploads = unsafe { &(*this.cast::<List>()).uploads };
|
||||
// Moving the vector keeps its heap block where it is.
|
||||
uploads.lock().unwrap_or_else(|e| e.into_inner()).push(block);
|
||||
at
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user