The status buffer shrinks to the words it holds: 16 bytes, its bits from 0 with no gaps
The command buffer's ExecutionStatus buffer was 32 bytes. Since the emulated mesh and tessellation stages and the indirect clamp went, words 3 to 6 were never written and status bits 0, 5, 7 and 8 never set. The words and bits nothing writes are gone. Now: ExecutionStatus::BYTES is 16 and WORDS 4. StatusWord::SeqCstFences moves from word 7 to word 3; Status, ResidentMisses and ReplayFaults keep words 0 to 2. StatusBits are the low seven bits: RESIDENT_MISS 0, REPLAY_FAULT 1, INDEX_POOL_OVERFLOW 2, ABSENT_ARGUMENT_READ 3, CUBIC_ARGUMENT_SAMPLER 4, MESH_GRID_PAST_LIMITS 5, MESH_GRID_DISCARDED 6. The comments on the unwritten words and unreported bits go. ReplayFaults keeps its bits as they are. Tests: status_bits_are_distinct also checks that the bits are the low ones, with no unused bit between them. The module's own tests size their bytes by ExecutionStatus::BYTES. The harnesses that held the buffer at 32 bytes now take ExecutionStatus::BYTES: the engine_binder and engine_kernel_stage_in worlds, and the index_bounds, index_rewrite and mesh_arguments tests. In validation, the three executors' expect messages state the size by the constant. SEMANTICS_VERSION 2222 is in this commit (placeholder; main renumbers): the fence's increment reaches word 3, and the absent-argument and cubic-sampler marks set new bit values, so modules' words change. The binder's own modules (replay preprocess, index bounds and rewrite, mesh arguments) change as well. RUNTIME_VERSION 2544 (placeholder): status decoding reads the new layout. ARTIFACT_FORMAT_VERSION stays at 565: no encoded type changes. api_signatures is regenerated; docs/REFUSALS.md regenerates unchanged. The runtime pin is updated. The golden tables are re-blessed on development. Consumer check (consumer-uses.sh, consumer development 12b87d3d6b, 63 refs): ExecutionStatus: 0 hits (code), link-order lists only. StatusBits, StatusWord, SeqCstFences, StatusReport: 0 hits (code). No public item is removed; only the values of BYTES, WORDS, SeqCstFences' index and the seven bits change. Verified: nothing yet (a check job is owed).
This commit is contained in:
1 parent
1fc878dc12
commit
ac854bc6fc
13 files changed
+49
-46
No files matched your search
@@ -1 +1 @@
|
||||
d8894f91aabfd4ef5ccf943d77b5c558a04e5d69ad9e9056e0cdaab139bd8f93
|
||||
fbd9b1f9d90ee4a6a33ef90353594eb13b50388e8ec1ed2cb252829318366ba4
|
||||
@@ -825,7 +825,7 @@ fn execute(
|
||||
let status_bytes: [u8; ExecutionStatus::BYTES] = unsafe { status.buffer.map()? }.bytes
|
||||
[..ExecutionStatus::BYTES]
|
||||
.try_into()
|
||||
.expect("the status buffer holds 32 bytes");
|
||||
.expect("the status buffer holds ExecutionStatus::BYTES bytes");
|
||||
let report = status_verdict(&status_bytes)?;
|
||||
// Each command buffer's records as the host contract decodes them: an encoding fault fails the
|
||||
// run. Then the commands the case executes run, over the run's allocations.
|
||||
|
||||
@@ -406,7 +406,7 @@ fn device_commands<K: Ord + Copy + std::fmt::Debug>(
|
||||
let status_bytes: [u8; ExecutionStatus::BYTES] = unsafe { status.buffer.map()? }.bytes
|
||||
[..ExecutionStatus::BYTES]
|
||||
.try_into()
|
||||
.expect("the status buffer holds 32 bytes");
|
||||
.expect("the status buffer holds ExecutionStatus::BYTES bytes");
|
||||
let report = ExecutionStatus::decode(&status_bytes);
|
||||
if report.replay_fault {
|
||||
return Err(replay_fault_verdict(
|
||||
|
||||
@@ -418,7 +418,7 @@ fn submit_child(
|
||||
let status_bytes: [u8; ExecutionStatus::BYTES] = unsafe { status.buffer.map()? }.bytes
|
||||
[..ExecutionStatus::BYTES]
|
||||
.try_into()
|
||||
.expect("the status buffer holds 32 bytes");
|
||||
.expect("the status buffer holds ExecutionStatus::BYTES bytes");
|
||||
status_verdict(&status_bytes)?;
|
||||
drop(objects);
|
||||
drop(resources);
|
||||
|
||||
@@ -247,7 +247,9 @@ fn a_run_leaves_what_its_draws_passes_leave() {
|
||||
assert!(width <= widest && width * rows >= total && width * (rows - 1) < total);
|
||||
spread |= rows > 1 && width * rows > total;
|
||||
// The overflow happened, and both kinds of draw are among them.
|
||||
let report = ExecutionStatus::decode(&got.2[..32].try_into().expect("status"));
|
||||
let report = ExecutionStatus::decode(
|
||||
&got.2[..ExecutionStatus::BYTES].try_into().expect("status"),
|
||||
);
|
||||
assert!(report.index_pool_overflow, "{case}: no overflow");
|
||||
assert!(got.0.iter().any(|c| c[0] > 0) && got.0.iter().any(|c| c[5] > 0));
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ fn ran(pass: &IndexBoundsPass, arguments: &[u32], indices: &[u8], counter: u32)
|
||||
let after = &planned[0];
|
||||
let bounds = words(&after[0]);
|
||||
let mut pool = words(&after[2]);
|
||||
let status: [u8; 32] = after[3].as_slice().try_into().expect("status");
|
||||
let status: [u8; ExecutionStatus::BYTES] = after[3].as_slice().try_into().expect("status");
|
||||
let report = ExecutionStatus::decode(&status);
|
||||
let groups = bounds[Output::FillDispatch as usize];
|
||||
if groups > 0 {
|
||||
|
||||
@@ -256,7 +256,7 @@ impl Draw {
|
||||
}
|
||||
assert_eq!(ran[0], ran[1], "order independent");
|
||||
let after = &ran[0];
|
||||
let status: [u8; 32] = after[4].as_slice().try_into().expect("status");
|
||||
let status: [u8; ExecutionStatus::BYTES] = after[4].as_slice().try_into().expect("status");
|
||||
let out = words(&after[3]);
|
||||
let (output, counter) = match self.counter {
|
||||
None => (out, None),
|
||||
|
||||
@@ -72,7 +72,7 @@ fn run_pass(
|
||||
0xEEEE_EEEE,
|
||||
"the pass writes its scratch only"
|
||||
);
|
||||
let status: [u8; 32] = b[2].as_slice().try_into().expect("status");
|
||||
let status: [u8; ExecutionStatus::BYTES] = b[2].as_slice().try_into().expect("status");
|
||||
(
|
||||
scratch[..bytes / 4].to_vec(),
|
||||
ExecutionStatus::decode(&status),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//! `ExecutionStatus` buffer layout: word indices and status bits.
|
||||
//!
|
||||
//! One 32-byte buffer per command buffer, shared by every plan in it. The consumer initializes it
|
||||
//! One 16-byte buffer per command buffer, shared by every plan in it. The consumer initializes it
|
||||
//! with [`ExecutionStatus::initial`] before the command buffer's first use and reads it back with
|
||||
//! [`ExecutionStatus::decode`] after the last one (a `SHADER_WRITE -> HOST_READ` barrier first);
|
||||
//! the resident-set miss counter, the device replay's preprocess, the index
|
||||
//! bounds pass, an absent argument's read, a mesh draw's arguments pass, a sample
|
||||
//! through a cubic argument sampler, and a sequentially consistent fence write the
|
||||
//! words named here. Words 3 to 6 are not written.
|
||||
//! words named here.
|
||||
|
||||
/// The `ExecutionStatus` buffer.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
@@ -14,9 +14,9 @@ pub struct ExecutionStatus;
|
||||
|
||||
impl ExecutionStatus {
|
||||
/// Size of the buffer in bytes.
|
||||
pub const BYTES: usize = 32;
|
||||
pub const BYTES: usize = 16;
|
||||
/// Size of the buffer in 32-bit words: up to the last of [`StatusWord::ALL`].
|
||||
pub const WORDS: usize = 8;
|
||||
pub const WORDS: usize = 4;
|
||||
|
||||
/// The buffer's initial bytes: every word 0.
|
||||
pub const fn initial() -> [u8; ExecutionStatus::BYTES] {
|
||||
@@ -112,8 +112,7 @@ impl StatusWord {
|
||||
StatusWord::Status => 0,
|
||||
StatusWord::ResidentMisses => 1,
|
||||
StatusWord::ReplayFaults => 2,
|
||||
// Words 3 to 6 are not written.
|
||||
StatusWord::SeqCstFences => 7,
|
||||
StatusWord::SeqCstFences => 3,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,33 +128,29 @@ pub struct StatusBits(pub u32);
|
||||
|
||||
impl StatusBits {
|
||||
/// An access missed the resident set.
|
||||
pub const RESIDENT_MISS: StatusBits = StatusBits(1 << 1);
|
||||
pub const RESIDENT_MISS: StatusBits = StatusBits(1 << 0);
|
||||
/// The device replay's preprocess refused a command; [`StatusWord::ReplayFaults`] holds why.
|
||||
pub const REPLAY_FAULT: StatusBits = StatusBits(1 << 2);
|
||||
pub const REPLAY_FAULT: StatusBits = StatusBits(1 << 1);
|
||||
/// An index bounds pass found no room in the command buffer's index pool for a draw's
|
||||
/// indices, and the draw drew nothing (`bind::IndexBoundsPass`).
|
||||
pub const INDEX_POOL_OVERFLOW: StatusBits = StatusBits(1 << 3);
|
||||
pub const INDEX_POOL_OVERFLOW: StatusBits = StatusBits(1 << 2);
|
||||
/// A function read an argument its pipeline's function constants removed, a read Metal
|
||||
/// gives no value, and took zero for it (`RuntimeFact::AbsentArgumentRead`).
|
||||
pub const ABSENT_ARGUMENT_READ: StatusBits = StatusBits(1 << 4);
|
||||
// Bit 5 (an emulated mesh draw's records fault) is not reported: a device without
|
||||
// `meshShader` refuses the pipeline.
|
||||
pub const ABSENT_ARGUMENT_READ: StatusBits = StatusBits(1 << 3);
|
||||
/// A function sampled, gathered, or queried through a sampler an argument buffer holds whose
|
||||
/// min or mag filter is `Cubic`, whose bicubic filter it does not emulate there
|
||||
/// (`RuntimeFact::CubicArgumentSampler`): its result is the device's through a nearest
|
||||
/// placeholder, not Metal's.
|
||||
pub const CUBIC_ARGUMENT_SAMPLER: StatusBits = StatusBits(1 << 6);
|
||||
// Bit 8 (an emulated tessellation draw's records fault) is not reported: a device without
|
||||
// `tessellationShader` refuses the pipeline.
|
||||
pub const CUBIC_ARGUMENT_SAMPLER: StatusBits = StatusBits(1 << 4);
|
||||
/// An indirect mesh draw's arguments pass met a grid that Metal draws and the device cannot
|
||||
/// launch: a mesh grid past the mesh stage's limits, an unfolded object grid past the task
|
||||
/// stage's, or a folded one of more pieces than `MeshArguments::OBJECT_PIECES` (only under task
|
||||
/// limits below Vulkan's required least); the draw drew nothing (`bind::MeshArguments`).
|
||||
pub const MESH_GRID_PAST_LIMITS: StatusBits = StatusBits(1 << 9);
|
||||
pub const MESH_GRID_PAST_LIMITS: StatusBits = StatusBits(1 << 5);
|
||||
/// An indirect mesh draw's arguments pass met an object grid of more threadgroups than
|
||||
/// `bind::METAL_OBJECT_GRID_TOTAL`, which Metal's GPU discards; the draw drew nothing
|
||||
/// (`bind::MeshArguments`).
|
||||
pub const MESH_GRID_DISCARDED: StatusBits = StatusBits(1 << 10);
|
||||
pub const MESH_GRID_DISCARDED: StatusBits = StatusBits(1 << 6);
|
||||
/// Every bit in `other` is set in `self`.
|
||||
pub const fn contains(self, other: StatusBits) -> bool {
|
||||
self.0 & other.0 == other.0
|
||||
@@ -259,6 +254,8 @@ mod tests {
|
||||
assert_eq!(all & b.0, 0);
|
||||
all |= b.0;
|
||||
}
|
||||
// The bits are the low ones, none left unused between them.
|
||||
assert_eq!(all, (1 << bits.len()) - 1);
|
||||
assert!(StatusBits(all).contains(StatusBits::REPLAY_FAULT));
|
||||
assert!(!StatusBits::RESIDENT_MISS.contains(StatusBits::REPLAY_FAULT));
|
||||
}
|
||||
@@ -273,19 +270,19 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn decode_reports_every_bit_and_counter() {
|
||||
let mut bytes = [0u8; 32];
|
||||
let mut bytes = [0u8; ExecutionStatus::BYTES];
|
||||
let bits = StatusBits::INDEX_POOL_OVERFLOW.0 | StatusBits::RESIDENT_MISS.0;
|
||||
bytes[0..4].copy_from_slice(&bits.to_le_bytes());
|
||||
bytes[4..8].copy_from_slice(&7u32.to_le_bytes());
|
||||
let r = ExecutionStatus::decode(&bytes);
|
||||
assert!(r.index_pool_overflow && r.resident_miss);
|
||||
assert_eq!(r.resident_misses, 7);
|
||||
bytes = [0u8; 32];
|
||||
bytes = [0u8; ExecutionStatus::BYTES];
|
||||
bytes[0..4].copy_from_slice(&StatusBits::INDEX_POOL_OVERFLOW.0.to_le_bytes());
|
||||
let r = ExecutionStatus::decode(&bytes);
|
||||
assert!(r.index_pool_overflow && !r.resident_miss);
|
||||
assert_eq!(r.resident_misses, 0);
|
||||
bytes = [0u8; 32];
|
||||
bytes = [0u8; ExecutionStatus::BYTES];
|
||||
bytes[0..4].copy_from_slice(&StatusBits::REPLAY_FAULT.0.to_le_bytes());
|
||||
let faults = ReplayFaults::VARIANT.0 | ReplayFaults::RECORD.0;
|
||||
bytes[8..12].copy_from_slice(&faults.to_le_bytes());
|
||||
@@ -295,16 +292,16 @@ mod tests {
|
||||
assert!(r.replay_faults.contains(ReplayFaults::RECORD));
|
||||
assert!(!r.replay_faults.contains(ReplayFaults::ENCODING));
|
||||
assert!(!r.index_pool_overflow);
|
||||
bytes = [0u8; 32];
|
||||
bytes = [0u8; ExecutionStatus::BYTES];
|
||||
bytes[0..4].copy_from_slice(&StatusBits::INDEX_POOL_OVERFLOW.0.to_le_bytes());
|
||||
let r = ExecutionStatus::decode(&bytes);
|
||||
assert!(r.index_pool_overflow && !r.replay_fault);
|
||||
assert!(!r.absent_argument_read);
|
||||
bytes = [0u8; 32];
|
||||
bytes = [0u8; ExecutionStatus::BYTES];
|
||||
bytes[0..4].copy_from_slice(&StatusBits::ABSENT_ARGUMENT_READ.0.to_le_bytes());
|
||||
let r = ExecutionStatus::decode(&bytes);
|
||||
assert!(!r.cubic_argument_sampler);
|
||||
let mut cubic = [0u8; 32];
|
||||
let mut cubic = [0u8; ExecutionStatus::BYTES];
|
||||
cubic[0..4].copy_from_slice(&StatusBits::CUBIC_ARGUMENT_SAMPLER.0.to_le_bytes());
|
||||
let c = ExecutionStatus::decode(&cubic);
|
||||
assert!(c.cubic_argument_sampler && !c.absent_argument_read);
|
||||
|
||||
Vendored
+2
-2
@@ -61,7 +61,7 @@ mod tests;
|
||||
/// unchanged version, and its bless records the version. Independent of the crate's version and of
|
||||
/// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no
|
||||
/// history.
|
||||
pub const SEMANTICS_VERSION: u32 = 2221;
|
||||
pub const SEMANTICS_VERSION: u32 = 2222;
|
||||
|
||||
/// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the
|
||||
/// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another
|
||||
@@ -94,7 +94,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 565;
|
||||
/// changes no behaviour, and then updates that hash alone with the commit saying why, or changes
|
||||
/// behaviour and also bumps this version. The commit that bumps it says what changed; this comment
|
||||
/// keeps no history.
|
||||
pub const RUNTIME_VERSION: u32 = 2543;
|
||||
pub const RUNTIME_VERSION: u32 = 2544;
|
||||
|
||||
/// Writes a digest as lowercase hex.
|
||||
pub(crate) fn write_hex(f: &mut fmt::Formatter<'_>, name: &str, hash: &Hash256) -> fmt::Result {
|
||||
|
||||
@@ -149,7 +149,7 @@ impl Alloc {
|
||||
pub(super) struct World {
|
||||
pub(super) buffers: BTreeMap<u32, Alloc>,
|
||||
used: Vec<(u64, u64, Vec<u8>)>,
|
||||
status: [u8; 32],
|
||||
status: [u8; ExecutionStatus::BYTES],
|
||||
}
|
||||
|
||||
impl World {
|
||||
@@ -421,7 +421,9 @@ pub(super) fn execute_with(
|
||||
let n = world.used[i].2.len();
|
||||
world.used[i].2.copy_from_slice(&bytes[..n]);
|
||||
}
|
||||
Back::Status => world.status.copy_from_slice(&bytes[..32]),
|
||||
Back::Status => world
|
||||
.status
|
||||
.copy_from_slice(&bytes[..ExecutionStatus::BYTES]),
|
||||
Back::Nowhere => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ struct World {
|
||||
buffers: BTreeMap<u32, Alloc>,
|
||||
strides: BTreeMap<u32, u32>,
|
||||
region: Option<StageInRegion>,
|
||||
status: [u8; 32],
|
||||
status: [u8; ExecutionStatus::BYTES],
|
||||
}
|
||||
|
||||
impl World {
|
||||
@@ -434,7 +434,9 @@ fn execute(
|
||||
}
|
||||
}
|
||||
}
|
||||
Back::Status => world.status.copy_from_slice(&bytes[..32]),
|
||||
Back::Status => world
|
||||
.status
|
||||
.copy_from_slice(&bytes[..ExecutionStatus::BYTES]),
|
||||
Back::Nowhere => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,8 +330,8 @@ assoc-const-value metal2vulkan::bind::DrawReplayModule::RECORDS_PUSH 16
|
||||
assoc-const-value metal2vulkan::bind::DrawReplayModule::RESIDENT_PUSH 0
|
||||
assoc-const-value metal2vulkan::bind::DrawReplayModule::STATUS_PUSH 8
|
||||
assoc-const-value metal2vulkan::bind::EtcDecode::ALL [EtcDecode::Rgb8, EtcDecode::Rgb8A1, EtcDecode::Rgba8, EtcDecode::R11Unorm, EtcDecode::R11Snorm, EtcDecode::Rg11Unorm, EtcDecode::Rg11Snorm]
|
||||
assoc-const-value metal2vulkan::bind::ExecutionStatus::BYTES 32
|
||||
assoc-const-value metal2vulkan::bind::ExecutionStatus::WORDS 8
|
||||
assoc-const-value metal2vulkan::bind::ExecutionStatus::BYTES 16
|
||||
assoc-const-value metal2vulkan::bind::ExecutionStatus::WORDS 4
|
||||
assoc-const-value metal2vulkan::bind::GeneratedLayout::INDEX_OFFSET 0
|
||||
assoc-const-value metal2vulkan::bind::GeneratedLayout::PUSH_OFFSET 4
|
||||
assoc-const-value metal2vulkan::bind::IndexBoundsFillModule::INDICES_BINDING 1
|
||||
@@ -413,13 +413,13 @@ assoc-const-value metal2vulkan::bind::ReplayPreprocessModule::STATUS_PUSH 8
|
||||
assoc-const-value metal2vulkan::bind::RewritePhase::ALL [RewritePhase::Count, RewritePhase::Place, RewritePhase::Write]
|
||||
assoc-const-value metal2vulkan::bind::RewriteProgram::ALL [RewriteProgram::LineStrip, RewriteProgram::TriangleStrip, RewriteProgram::LineLoop, RewriteProgram::TriangleFan, RewriteProgram::Quads, RewriteProgram::QuadStrip, RewriteProgram::LineList, RewriteProgram::TriangleList]
|
||||
assoc-const-value metal2vulkan::bind::RootTable::SINK_HOST_OFFSET (SINK_ROOT * ENTRY_BYTES + HOST) as u32
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::ABSENT_ARGUMENT_READ StatusBits(1 <<4)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::CUBIC_ARGUMENT_SAMPLER StatusBits(1 <<6)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::INDEX_POOL_OVERFLOW StatusBits(1 <<3)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::MESH_GRID_DISCARDED StatusBits(1 <<10)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::MESH_GRID_PAST_LIMITS StatusBits(1 <<9)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::REPLAY_FAULT StatusBits(1 <<2)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::RESIDENT_MISS StatusBits(1 <<1)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::ABSENT_ARGUMENT_READ StatusBits(1 <<3)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::CUBIC_ARGUMENT_SAMPLER StatusBits(1 <<4)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::INDEX_POOL_OVERFLOW StatusBits(1 <<2)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::MESH_GRID_DISCARDED StatusBits(1 <<6)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::MESH_GRID_PAST_LIMITS StatusBits(1 <<5)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::REPLAY_FAULT StatusBits(1 <<1)
|
||||
assoc-const-value metal2vulkan::bind::StatusBits::RESIDENT_MISS StatusBits(1 <<0)
|
||||
assoc-const-value metal2vulkan::bind::StatusWord::ALL [StatusWord::Status, StatusWord::ResidentMisses, StatusWord::ReplayFaults, StatusWord::SeqCstFences]
|
||||
assoc-const-value metal2vulkan::bind::StencilBit::ALL [StencilBit(0), StencilBit(1), StencilBit(2), StencilBit(3), StencilBit(4), StencilBit(5), StencilBit(6), StencilBit(7)]
|
||||
assoc-const-value metal2vulkan::bind::StencilSplitModule::DESTINATION_BINDING 1
|
||||
|
||||
|
Can't render this file because it is too large.
|
Reference in new issue
Block a user