A timeline of a few frames, with the chain each present came out of (VICTORY_TIMELINE)
Diagnostics only. VICTORY_TIMELINE=<file> records three frames (or VICTORY_TIMELINE_FRAMES) after VICTORY_TIMELINE_AT seconds and writes a Chrome trace and a text summary: spans of our work, the waits and wake-ups of the title's threads (its imports) and of ours (our import table), long kernel calls on the address space, and when each submission ran on the card. The summary walks back from each present through who waited on whom. Nothing is wrapped without the variable. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 008de5f9ffcef132079b1af8b7f4f1c22235cee9)
This commit is contained in:
1 parent
faf5687af9
commit
7c62f5b707
25 files changed
+2506
-7
No files matched your search
@@ -320,6 +320,7 @@ pub(crate) fn release_held(all: bool) {
|
||||
if lock(&WAITING).is_empty() {
|
||||
return;
|
||||
}
|
||||
let _looking = crate::timeline::span("looking at what queues hold");
|
||||
let _one = lock(&RELEASING);
|
||||
loop {
|
||||
let queues = lock(&WAITING).clone();
|
||||
@@ -549,6 +550,9 @@ extern "system" fn execute(this: This, count: u32, lists: *const This) {
|
||||
if lists.is_null() {
|
||||
return;
|
||||
}
|
||||
let _called = crate::timeline::span("the title's ExecuteCommandLists");
|
||||
#[cfg(all(windows, feature = "diagnostics"))]
|
||||
crate::timeline::title_thread();
|
||||
#[cfg(windows)]
|
||||
if let Some(host) = crate::host::host() {
|
||||
// SAFETY: the title passes `count` lists.
|
||||
@@ -650,6 +654,7 @@ extern "system" fn signal(this: This, fence: This, value: u64) -> HRESULT {
|
||||
if fence.is_null() {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
let _called = crate::timeline::span("the title's queue Signal");
|
||||
#[cfg(windows)]
|
||||
if behind::on() && !this.is_null() {
|
||||
behind::signal(this, fence, value);
|
||||
@@ -680,6 +685,7 @@ extern "system" fn wait(this: This, fence: This, value: u64) -> HRESULT {
|
||||
if fence.is_null() {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
let _called = crate::timeline::span("the title's queue Wait");
|
||||
#[cfg(windows)]
|
||||
if !this.is_null() {
|
||||
let now = crate::fence::completed(fence);
|
||||
@@ -767,6 +773,8 @@ impl Written {
|
||||
}
|
||||
Written::SystemTimestamp => system_timestamp(),
|
||||
};
|
||||
#[cfg(all(windows, feature = "diagnostics"))]
|
||||
crate::timeline::told("written when its list had run", at as usize, value);
|
||||
// SAFETY: the title names writable GPU memory (unified with ours).
|
||||
unsafe {
|
||||
if bytes == 4 {
|
||||
@@ -837,6 +845,9 @@ extern "system" fn present(
|
||||
let _ = this;
|
||||
#[cfg(all(windows, feature = "diagnostics"))]
|
||||
crate::copystat::present_begins();
|
||||
let called = crate::timeline::span("the title's Present");
|
||||
#[cfg(all(windows, feature = "diagnostics"))]
|
||||
crate::timeline::title_thread();
|
||||
// Submissions sent to the card and not waited for are settled first,
|
||||
// and what that frees runs in its own order, before anything is forced.
|
||||
#[cfg(windows)]
|
||||
@@ -917,6 +928,9 @@ extern "system" fn present(
|
||||
};
|
||||
let resource = texture.as_ref().map_or(0, |t| t.0);
|
||||
behind::present(this, texture.map(|(_, copy, state)| (copy, state)), Shown { frame, resource });
|
||||
called.end();
|
||||
#[cfg(feature = "diagnostics")]
|
||||
frame_ends();
|
||||
return S_OK;
|
||||
}
|
||||
#[cfg(windows)]
|
||||
@@ -939,8 +953,23 @@ extern "system" fn present(
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
let _ = (planes, plane_parameters);
|
||||
called.end();
|
||||
#[cfg(all(windows, feature = "diagnostics"))]
|
||||
frame_ends();
|
||||
S_OK
|
||||
}
|
||||
|
||||
/// Diagnostics: the title's present is over.
|
||||
#[cfg(all(windows, feature = "diagnostics"))]
|
||||
fn frame_ends() {
|
||||
crate::timeline::presented();
|
||||
crate::ab::presented(|switch, was, will| {
|
||||
if switch == "VICTORY_ASYNC_SUBMIT" && was && !will {
|
||||
behind::leave();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// The frame a present shows, and the title's resource it shows.
|
||||
#[cfg(windows)]
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -1037,6 +1066,7 @@ extern "system" fn copy_page_mappings(
|
||||
if batches.is_null() && count > 0 {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
let _called = crate::timeline::span("the title's CopyPageMappings");
|
||||
let batches = (count > 0).then(|| {
|
||||
// SAFETY: the title passes `count` batches.
|
||||
unsafe { std::slice::from_raw_parts(batches, count as usize) }
|
||||
|
||||
Reference in new issue
Block a user