Indirect executions joined (VICTORY_INDIRECT_MERGE=1, off) and counted
An execution of one record that follows another on the same host list is recorded with it as one ExecuteIndirect of more records when nothing could tell them apart: no title call that records into the list between, binding calls between that set what was set (State::rebinds), no count buffer and one record each, same kind and host pipeline, no clamp pass recorded for it (batch slot or window hit), the run's last binding left the list's epoch where it found it, and the record lies next to the run's last in the same scratch buffer at the run's step (batch slot or window step; the run is recorded with a signature of that stride). The run's execution is held back on the HostList and recorded before anything else: every title call that may record (list::host_list), the clamp passes and bindings of later executions, and the list's close. Calls that only change the binding (pipeline, heaps, tables, views, constants, vertex and index buffers) no longer count as title calls and record nothing; they count their real changes instead. A release frame line counts every indirect execution by verdict, with the switch off too: how many could join the one before them, how many were joined, and what kept the others apart (first on the list, a title call that records, count buffer or more records, kept alone, other kind or pipeline, clamped, binding changed, root constants only changed, binding that changed the list, record apart). Tests: the merge rules (11), a HostList test that records held runs at a title call and at close and runs each record once on the card, and two new variants of the ignored bare_command_cost measurement (each draw an indirect execution of one record; all records in one execution). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c0f627e4b5
commit
28f6e25210
5 files changed
+825
-68
No files matched your search
@@ -1210,6 +1210,13 @@ pub(crate) struct HostList {
|
||||
/// depends on ([`HostList::changed_something`]); no two lists have the
|
||||
/// same.
|
||||
epoch: std::sync::atomic::AtomicU64,
|
||||
/// The title calls that may record into the list ([`HostList::title_call`]).
|
||||
title_calls: std::sync::atomic::AtomicU64,
|
||||
/// The run of indirect executions the list's last one belongs to
|
||||
/// ([`crate::indirect::merge`]), and its execution if it is held back.
|
||||
indirect_run: Mutex<Option<(crate::indirect::merge::Run, Option<crate::indirect::merge::Held>)>>,
|
||||
/// Whether an execution is held back.
|
||||
holding: std::sync::atomic::AtomicBool,
|
||||
/// Counts the list in [`ALIVE`] while it lives.
|
||||
_alive: Counted,
|
||||
/// The texts of the markers `note_op` set, in order (for device-removed
|
||||
@@ -4118,6 +4125,9 @@ impl Host {
|
||||
batch_args: Mutex::default(),
|
||||
coming: Mutex::default(),
|
||||
epoch: std::sync::atomic::AtomicU64::new(next_epoch()),
|
||||
title_calls: std::sync::atomic::AtomicU64::new(0),
|
||||
indirect_run: Mutex::default(),
|
||||
holding: std::sync::atomic::AtomicBool::new(false),
|
||||
_alive: Counted::new(),
|
||||
#[cfg(feature = "diagnostics")]
|
||||
notes,
|
||||
@@ -6279,6 +6289,7 @@ impl HostList {
|
||||
|
||||
pub(crate) fn close(&self) {
|
||||
let _closing = crate::timeline::span("closing a host list");
|
||||
self.flush_indirect();
|
||||
self.twins_to_depth();
|
||||
self.textures_back();
|
||||
let scratch = self.indirect_args.lock().unwrap_or_else(|e| e.into_inner()).clone();
|
||||
@@ -6331,6 +6342,8 @@ impl HostList {
|
||||
/// for).
|
||||
pub(crate) fn reset(&self) {
|
||||
self.changed_something();
|
||||
self.holding.store(false, Ordering::Relaxed);
|
||||
*self.indirect_run.lock().unwrap_or_else(|e| e.into_inner()) = None;
|
||||
#[cfg(feature = "diagnostics")]
|
||||
let started = std::time::Instant::now();
|
||||
let _resetting = crate::timeline::span("resetting a host list");
|
||||
@@ -6378,6 +6391,53 @@ impl HostList {
|
||||
self.epoch.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// A title call that may record into the list (all but indirect
|
||||
/// executions and calls that only change what the next draw or dispatch
|
||||
/// binds, `crate::list`): the indirect execution held back, if one is,
|
||||
/// is recorded first ([`crate::indirect::merge`]).
|
||||
pub(crate) fn title_call(&self) {
|
||||
self.title_calls.fetch_add(1, Ordering::Relaxed);
|
||||
self.flush_indirect();
|
||||
}
|
||||
|
||||
/// The title calls recorded into the list so far.
|
||||
pub(crate) fn title_calls(&self) -> u64 {
|
||||
self.title_calls.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// Records the indirect execution held back, if one is: before
|
||||
/// anything else is recorded into the list.
|
||||
pub(crate) fn flush_indirect(&self) {
|
||||
if self.holding.load(Ordering::Relaxed) {
|
||||
self.record_held(&mut self.indirect_run());
|
||||
}
|
||||
}
|
||||
|
||||
/// As [`HostList::flush_indirect`], with the list's run in hand.
|
||||
pub(crate) fn record_held(
|
||||
&self,
|
||||
run: &mut Option<(crate::indirect::merge::Run, Option<crate::indirect::merge::Held>)>,
|
||||
) {
|
||||
if let Some((run, held)) = run.as_mut()
|
||||
&& let Some(held) = held.take()
|
||||
{
|
||||
self.holding.store(false, Ordering::Relaxed);
|
||||
held.record(&self.list, run);
|
||||
}
|
||||
}
|
||||
|
||||
/// The list's run of indirect executions ([`crate::indirect::merge`]).
|
||||
pub(crate) fn indirect_run(
|
||||
&self,
|
||||
) -> std::sync::MutexGuard<'_, Option<(crate::indirect::merge::Run, Option<crate::indirect::merge::Held>)>> {
|
||||
self.indirect_run.lock().unwrap_or_else(|e| e.into_inner())
|
||||
}
|
||||
|
||||
/// The list's run holds its execution back from here on.
|
||||
pub(crate) fn hold_indirect(&self) {
|
||||
self.holding.store(true, Ordering::Relaxed);
|
||||
}
|
||||
|
||||
/// Whether any deferred steps or texture state transitions have been
|
||||
/// recorded into this list since creation or its last [`HostList::reset`].
|
||||
pub(crate) fn has_recorded_work(&self) -> bool {
|
||||
@@ -8754,6 +8814,7 @@ impl Meter {
|
||||
tracing::info!(
|
||||
"indirect mesh dispatches: the largest group count asked for {mesh_largest} (run: at most 65535), {mesh_groups:.0} groups asked per frame; {refused:.2} indirect records a frame ran empty for want of their list's budget (2^27), the largest cost of one {biggest} (0: under 2^22)"
|
||||
);
|
||||
crate::indirect::merge::line(frames);
|
||||
crate::shadow::exact_line(frames);
|
||||
crate::descriptor::sync_line(frames);
|
||||
late_line(frames);
|
||||
|
||||
Reference in new issue
Block a user