|
@@ -889,6 +889,9 @@ pub(crate) struct HostList {
|
|
|
prelude: OnceLock<Option<Prelude>>,
|
|
prelude: OnceLock<Option<Prelude>>,
|
|
|
/// The pipelines the list binds, for reports of slow submissions.
|
|
/// The pipelines the list binds, for reports of slow submissions.
|
|
|
pipelines: std::sync::Arc<Mutex<std::collections::BTreeSet<String>>>,
|
|
pipelines: std::sync::Arc<Mutex<std::collections::BTreeSet<String>>>,
|
|
|
|
|
+ /// What its indirect executions ran, for the report of a removed device.
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
|
|
+ indirects: indirects::Shared,
|
|
|
/// The work its indirect executions may still do (`indirect`): a
|
|
/// The work its indirect executions may still do (`indirect`): a
|
|
|
/// shader-writable word, zeroed when the list is submitted, and after
|
|
/// shader-writable word, zeroed when the list is submitted, and after
|
|
|
/// it what the clamp notes about mesh records. In memory the CPU maps.
|
|
/// it what the clamp notes about mesh records. In memory the CPU maps.
|
|
@@ -1404,7 +1407,14 @@ pub(crate) fn dred_faults() -> bool {
|
|
|
#[cfg(feature = "diagnostics")]
|
|
#[cfg(feature = "diagnostics")]
|
|
|
#[allow(clippy::type_complexity)]
|
|
#[allow(clippy::type_complexity)]
|
|
|
static LIST_NOTES: Mutex<
|
|
static LIST_NOTES: Mutex<
|
|
|
- std::collections::BTreeMap<u32, (std::sync::Weak<Mutex<Vec<Note>>>, std::sync::Weak<Mutex<std::collections::BTreeSet<String>>>)>,
|
|
|
|
|
|
|
+ std::collections::BTreeMap<
|
|
|
|
|
+ u32,
|
|
|
|
|
+ (
|
|
|
|
|
+ std::sync::Weak<Mutex<Vec<Note>>>,
|
|
|
|
|
+ std::sync::Weak<Mutex<std::collections::BTreeSet<String>>>,
|
|
|
|
|
+ std::sync::Weak<Mutex<indirects::Indirects>>,
|
|
|
|
|
+ ),
|
|
|
|
|
+ >,
|
|
|
> = Mutex::new(std::collections::BTreeMap::new());
|
|
> = Mutex::new(std::collections::BTreeMap::new());
|
|
|
|
|
|
|
|
/// The number in the name of a list of ours ("victory host list 7", which the
|
|
/// The number in the name of a list of ours ("victory host list 7", which the
|
|
@@ -3155,6 +3165,7 @@ fn late_line(frames: f64) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
mod card_steps;
|
|
mod card_steps;
|
|
|
|
|
+pub(crate) mod indirects;
|
|
|
mod place;
|
|
mod place;
|
|
|
mod send;
|
|
mod send;
|
|
|
mod torn;
|
|
mod torn;
|
|
@@ -3522,6 +3533,8 @@ impl Host {
|
|
|
let notes = std::sync::Arc::<Mutex<Vec<Note>>>::default();
|
|
let notes = std::sync::Arc::<Mutex<Vec<Note>>>::default();
|
|
|
let pipelines = std::sync::Arc::<Mutex<std::collections::BTreeSet<String>>>::default();
|
|
let pipelines = std::sync::Arc::<Mutex<std::collections::BTreeSet<String>>>::default();
|
|
|
#[cfg(feature = "diagnostics")]
|
|
#[cfg(feature = "diagnostics")]
|
|
|
|
|
+ let indirects = indirects::Shared::default();
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
if dred_on() || dred_light() {
|
|
if dred_on() || dred_light() {
|
|
|
static NUMBER: AtomicU32 = AtomicU32::new(0);
|
|
static NUMBER: AtomicU32 = AtomicU32::new(0);
|
|
|
let number = NUMBER.fetch_add(1, Ordering::Relaxed);
|
|
let number = NUMBER.fetch_add(1, Ordering::Relaxed);
|
|
@@ -3530,7 +3543,14 @@ impl Host {
|
|
|
if number.is_multiple_of(256) {
|
|
if number.is_multiple_of(256) {
|
|
|
all.retain(|_, l| l.0.strong_count() > 0);
|
|
all.retain(|_, l| l.0.strong_count() > 0);
|
|
|
}
|
|
}
|
|
|
- all.insert(number, (std::sync::Arc::downgrade(¬es), std::sync::Arc::downgrade(&pipelines)));
|
|
|
|
|
|
|
+ all.insert(
|
|
|
|
|
+ number,
|
|
|
|
|
+ (
|
|
|
|
|
+ std::sync::Arc::downgrade(¬es),
|
|
|
|
|
+ std::sync::Arc::downgrade(&pipelines),
|
|
|
|
|
+ std::sync::Arc::downgrade(&indirects),
|
|
|
|
|
+ ),
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
Ok(HostList {
|
|
Ok(HostList {
|
|
|
allocator,
|
|
allocator,
|
|
@@ -3541,6 +3561,8 @@ impl Host {
|
|
|
twins: Mutex::default(),
|
|
twins: Mutex::default(),
|
|
|
prelude,
|
|
prelude,
|
|
|
pipelines,
|
|
pipelines,
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
|
|
+ indirects,
|
|
|
budget: OnceLock::new(),
|
|
budget: OnceLock::new(),
|
|
|
card_budget: OnceLock::new(),
|
|
card_budget: OnceLock::new(),
|
|
|
indirect_args: Mutex::default(),
|
|
indirect_args: Mutex::default(),
|
|
@@ -5271,7 +5293,12 @@ impl Host {
|
|
|
#[cfg(feature = "diagnostics")]
|
|
#[cfg(feature = "diagnostics")]
|
|
|
let by_name = list_number(&named).and_then(|n| {
|
|
let by_name = list_number(&named).and_then(|n| {
|
|
|
let all = LIST_NOTES.lock().unwrap_or_else(|e| e.into_inner());
|
|
let all = LIST_NOTES.lock().unwrap_or_else(|e| e.into_inner());
|
|
|
- all.get(&n).map(|(notes, pipelines)| (notes.upgrade(), pipelines.upgrade()))
|
|
|
|
|
|
|
+ all.get(&n).map(|(notes, pipelines, _)| (notes.upgrade(), pipelines.upgrade()))
|
|
|
|
|
+ });
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
|
|
+ let indirects = run.map(|r| r.indirects.clone()).or_else(|| {
|
|
|
|
|
+ let n = list_number(&named)?;
|
|
|
|
|
+ LIST_NOTES.lock().unwrap_or_else(|e| e.into_inner()).get(&n)?.2.upgrade()
|
|
|
});
|
|
});
|
|
|
#[cfg(not(feature = "diagnostics"))]
|
|
#[cfg(not(feature = "diagnostics"))]
|
|
|
#[allow(clippy::type_complexity)]
|
|
#[allow(clippy::type_complexity)]
|
|
@@ -5301,6 +5328,10 @@ impl Host {
|
|
|
if done > 0 {
|
|
if done > 0 {
|
|
|
text.push_str(&in_flight(history, &markers, done as usize));
|
|
text.push_str(&in_flight(history, &markers, done as usize));
|
|
|
}
|
|
}
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
|
|
+ if let Some(indirects) = indirects {
|
|
|
|
|
+ text.push_str(&indirects_around(history, done as usize, &indirects));
|
|
|
|
|
+ }
|
|
|
// (Without markers a list that stopped midway says what
|
|
// (Without markers a list that stopped midway says what
|
|
|
// it may have been at only by what it binds.)
|
|
// it may have been at only by what it binds.)
|
|
|
if (done == 0 || markers.is_empty())
|
|
if (done == 0 || markers.is_empty())
|
|
@@ -5498,6 +5529,8 @@ impl HostList {
|
|
|
self.twins.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
self.twins.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
|
self.pipelines.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
self.pipelines.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
|
#[cfg(feature = "diagnostics")]
|
|
#[cfg(feature = "diagnostics")]
|
|
|
|
|
+ self.indirects.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
self.notes.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
self.notes.lock().unwrap_or_else(|e| e.into_inner()).clear();
|
|
|
{
|
|
{
|
|
|
let mut scratch = self.scratch.lock().unwrap_or_else(|e| e.into_inner());
|
|
let mut scratch = self.scratch.lock().unwrap_or_else(|e| e.into_inner());
|
|
@@ -5904,6 +5937,15 @@ impl HostList {
|
|
|
&& self.twins.lock().unwrap_or_else(|e| e.into_inner()).is_empty()
|
|
&& self.twins.lock().unwrap_or_else(|e| e.into_inner()).is_empty()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// Notes an indirect execution, while device-removed data is kept
|
|
|
|
|
+ /// ([`indirects`]).
|
|
|
|
|
+ #[cfg(feature = "diagnostics")]
|
|
|
|
|
+ pub(crate) fn ran_indirect(&self, pipeline: usize, name: &str, kind: u32, count: u32, user: &[u32]) {
|
|
|
|
|
+ if dred_on() || dred_light() {
|
|
|
|
|
+ self.indirects.lock().unwrap_or_else(|e| e.into_inner()).note(pipeline, name, kind, count, user);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// Notes a pipeline the list binds.
|
|
/// Notes a pipeline the list binds.
|
|
|
pub(crate) fn used_pipeline(&self, name: &str) {
|
|
pub(crate) fn used_pipeline(&self, name: &str) {
|
|
|
let mut pipelines = self.pipelines.lock().unwrap_or_else(|e| e.into_inner());
|
|
let mut pipelines = self.pipelines.lock().unwrap_or_else(|e| e.into_inner());
|
|
@@ -6025,6 +6067,15 @@ impl HostList {
|
|
|
Some((unsafe { buffer.GetGPUVirtualAddress() } + at, data))
|
|
Some((unsafe { buffer.GetGPUVirtualAddress() } + at, data))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// [`HostList::scratch`] and the buffer it lies in, for a descriptor
|
|
|
|
|
+ /// slot to hold: the slot outlives the list's use of it.
|
|
|
|
|
+ pub(crate) fn scratch_held(&self, len: u64) -> Option<(ID3D12Resource, u64, *mut u8)> {
|
|
|
|
|
+ let (buffer, at, data) = self.scratch_at(len)?;
|
|
|
|
|
+ // SAFETY: a live buffer.
|
|
|
|
|
+ let gpu = unsafe { buffer.GetGPUVirtualAddress() } + at;
|
|
|
|
|
+ Some((buffer, gpu, data))
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// [`HostList::scratch`]: the buffer, the offset in it and the CPU
|
|
/// [`HostList::scratch`]: the buffer, the offset in it and the CPU
|
|
|
/// pointer.
|
|
/// pointer.
|
|
|
fn scratch_at(&self, len: u64) -> Option<(ID3D12Resource, u64, *mut u8)> {
|
|
fn scratch_at(&self, len: u64) -> Option<(ID3D12Resource, u64, *mut u8)> {
|
|
@@ -7977,6 +8028,34 @@ fn fault_in(va: u64, (start, bytes): (u64, u64)) -> String {
|
|
|
/// barriers overlaps on the GPU), by kind, and what the markers just
|
|
/// barriers overlaps on the GPU), by kind, and what the markers just
|
|
|
/// before them say (`HostList::note_op`: diagnostics builds with
|
|
/// before them say (`HostList::note_op`: diagnostics builds with
|
|
|
/// device-removed data on).
|
|
/// device-removed data on).
|
|
|
|
|
+/// For a list that stopped at command `done`: what the indirect executions
|
|
|
|
|
+/// there ran, from the one before it to the next barrier (four at most), and
|
|
|
|
|
+/// what the heap slots their user data names hold now.
|
|
|
|
|
+#[cfg(feature = "diagnostics")]
|
|
|
|
|
+fn indirects_around(history: &[D3D12_AUTO_BREADCRUMB_OP], done: usize, all: &indirects::Shared) -> String {
|
|
|
|
|
+ let indirect = |op: &D3D12_AUTO_BREADCRUMB_OP| *op == D3D12_AUTO_BREADCRUMB_OP_EXECUTEINDIRECT;
|
|
|
|
|
+ let all = all.lock().unwrap_or_else(|e| e.into_inner());
|
|
|
|
|
+ let mut text = String::new();
|
|
|
|
|
+ let mut shown = 0;
|
|
|
|
|
+ for (at, op) in history.iter().enumerate().skip(done.saturating_sub(1)) {
|
|
|
|
|
+ if shown == 4 || (at > done && *op == D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ if !indirect(op) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ shown += 1;
|
|
|
|
|
+ let Some((what, words)) = all.nth(indirects::before(history, at, indirect)) else {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ };
|
|
|
|
|
+ text.push_str(&format!("; command {at} ran {what}"));
|
|
|
|
|
+ for (word, slot, what) in crate::descriptor::host::describe_slots(words) {
|
|
|
|
|
+ text.push_str(&format!(", word {word} slot {slot}: {what}"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ text
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
fn in_flight(history: &[D3D12_AUTO_BREADCRUMB_OP], markers: &[(u32, String)], done: usize) -> String {
|
|
fn in_flight(history: &[D3D12_AUTO_BREADCRUMB_OP], markers: &[(u32, String)], done: usize) -> String {
|
|
|
let barrier = |op: &D3D12_AUTO_BREADCRUMB_OP| *op == D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER;
|
|
let barrier = |op: &D3D12_AUTO_BREADCRUMB_OP| *op == D3D12_AUTO_BREADCRUMB_OP_RESOURCEBARRIER;
|
|
|
let from = history[..done].iter().rposition(barrier).map_or(0, |b| b + 1);
|
|
let from = history[..done].iter().rposition(barrier).map_or(0, |b| b + 1);
|