Take a command buffer's tracked uses as its writes, whatever the logs collected

The standing let go of every shadow at each command buffer whose uses the
device's logs of host pages did not collect (`unnoted`), taking that as a
command buffer that may reach memory no use names. But `unnoted` only
says no log or copied host buffer lived to collect them (`note_dirty`):
the tracker's summary of every encoder holds its tracked uses either way.
So on a device with no logs every command buffer let go of every
standing, and none ever held (M3 job m3-max-1916: the second read of the
Private plane skipped no copy in).

Only `State::reaches_unnamed` (a root table, work resolved from records)
lets go of all now. A shadow over a buffer whose own uses are untracked,
whose writes no summary holds, never stands: the plane's texture takes
its descriptor's tracking, not the buffer's. The module docs and the
API.md catalogue entry say both.

Verified: runs next on the M3, with the negative controls.
(cherry picked from commit dcc32875db5aee8a8903ef9443235edce8de97cf)
This commit is contained in:
Anees Iqbal committed 2026-11-05 13:14:47 -08:00
1 parent df8688bd78
commit 66ea975bdb
3 files changed
+18 -16

No files matched your search

@@ -227,7 +227,6 @@ use crate::tracker::{Barrier, Point, Summary};
use crate::work_counts::Begun;
use ash::vk;
use std::collections::BTreeSet;
use std::sync::atomic::Ordering;
use std::sync::Arc;
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
use {crate::tracker::Footprint, std::sync::Mutex};
@@ -1160,7 +1159,7 @@ impl CommandBufferShared {
// (`shadow_standing.rs`): its writes let go of those they meet; then, where it ends the
// command buffer with its last encoder and nothing failed it or reached memory unnamed,
// the shadows its end left holding every texel of their truth stand.
let unnamed = state.reaches_unnamed || self.unnoted.load(Ordering::Relaxed);
let unnamed = state.reaches_unnamed;
let clean = state.failure.is_none()
&& state.fails_from.is_none()
&& state.faulted.is_empty()
@@ -1484,10 +1483,9 @@ impl CommandBufferShared {
/// names.
fn stands(&self, state: &State, encoder: usize, copies: &ShadowCopies) -> bool {
let keys = copies.standing_keys();
let unnamed = state.reaches_unnamed || self.unnoted.load(Ordering::Relaxed);
let wrote =
(state.recorded[..encoder].iter()).any(|recorded| recorded.summary.writes_any(&keys));
!unnamed && !wrote && self.device.shared().standings.stands(copies)
!state.reaches_unnamed && !wrote && self.device.shared().standings.stands(copies)
}
/// Record the decodes into ASTC carriers' second decoded twins (`texture/decoded_twin.rs`) of
@@ -18,9 +18,12 @@
//! key, whatever the range) lets go of the standing: another shadow's copy back over the same
//! bytes, a blit's or a pass's write, a copy in that a command buffer's end did not leave
//! standing. So does any batch of a command buffer whose commands may reach memory no use names
//! (a root table, an execution resolved from records: `State::reaches_unnamed`, or one that
//! noted nothing as it encoded), for every shadow. A shadow over a buffer whose `VkBuffer` was
//! handed out (`Buffer::vk_buffer`), which the caller's own work may write, never stands.
//! (a root table, an execution resolved from records: `State::reaches_unnamed`), for every
//! shadow. Every other command's tracked uses are in its encoder's summary, whether or not the
//! device's logs of host pages collected them (`CommandBuffer::note_dirty`). A shadow over a
//! buffer whose uses are untracked, whose writes no summary holds, never stands; nor does one
//! over a buffer whose `VkBuffer` was handed out (`Buffer::vk_buffer`), which the caller's own
//! work may write.
//! - **The copy in.** A command buffer's first copy in of such a shadow, before any command of
//! its encoder wrote what it reads, goes to its batch's submission (`shadow::GatedCopyIn`), and
//! copies nothing there where the shadow stands and no earlier encoder of the command buffer
@@ -32,7 +35,7 @@ use super::key_hash::KeyMap;
use super::resource::ResourceKey;
use super::shadow::ShadowCopies;
use super::tracker::Summary;
use super::values::StorageMode;
use super::values::{HazardTrackingMode, StorageMode};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, MutexGuard, Weak};
@@ -74,17 +77,18 @@ struct Stood {
impl StandingAcross {
/// The standing of a shadow over `buffer`'s bytes: one that may stand where the buffer is a
/// `Private` or `Memoryless` buffer the runtime made of its own (not a heap's, nor over the
/// caller's memory), until its `VkBuffer` is handed out; none for any other.
/// tracked `Private` or `Memoryless` buffer the runtime made of its own (not a heap's, nor
/// over the caller's memory), until its `VkBuffer` is handed out; none for any other.
pub(super) fn over(buffer: &Buffer) -> StandingAcross {
let private = matches!(
buffer.resource_options().storage_mode(),
Ok(StorageMode::Private | StorageMode::Memoryless)
);
let own = buffer.caller_memory().is_none() && buffer.heap().is_none();
let tracked = buffer.hazard_tracking_mode() == HazardTrackingMode::Tracked;
StandingAcross {
stood: Mutex::new(None),
handed_out: (private && own).then(|| buffer.handed_out()),
handed_out: (private && own && tracked).then(|| buffer.handed_out()),
}
}
+5 -5
View File
@@ -1460,11 +1460,11 @@ bound.
image before each use and back after each write (over a buffer's bytes but a tracked private
buffer's, kept before a write and merged back after it; over a tracked private buffer of the
runtime's own, copied in again only once another command buffer wrote it). That buffer is a
`Private` or `Memoryless` one the runtime made, of no heap and over none of the caller's memory,
whose `VkBuffer` was never handed out; a command buffer whose commands may reach memory no use
names (a function that reaches buffers through their addresses, work resolved from records) also
lets go of every such image, and `WorkCounts::shadow_copies_in_skipped_by_standing` counts each
copy in a standing image saved. A render pass that loads it as an attachment, takes it in no other way and draws under
tracked `Private` or `Memoryless` one the runtime made, of no heap and over none of the caller's
memory, whose `VkBuffer` was never handed out; a command buffer whose commands may reach memory
no use names (a function that reaches buffers through their addresses, work resolved from
records) also lets go of every such image, and `WorkCounts::shadow_copies_in_skipped_by_standing`
counts each copy in a standing image saved. A render pass that loads it as an attachment, takes it in no other way and draws under
scissors copies in only the texels inside them (`WorkCounts::shadow_texels_copied_in`). Over a
buffer's bytes that another writer may
write while a command buffer runs, the image is kept in a scratch buffer before the first command