Conformance: no case declares a notice the runtime never announces

The runtime's side announces only the codes of the precision notes its states, textures and
sampler states carry (Degradation::from_precision_note). 66 Degradation kinds had no precision
note behind them: they were the deleted runtime's notices. A case that named one declared a
notice nothing can announce, and a value it loosened by one stayed loosened on no run.

What goes:
- every declaration of those 66 kinds, in 70 case files and the native-note set (six of its
  members were among them: float-tininess-after-rounding, unorm-depth-rounding,
  signed-depth-test, ycbcr-filter-not-exact, device-line-ties, device-subpixel-snap);
- the value tolerances justified by one: astc's and etc's compact-twin bounds
  (decoded-texel-precision), visibility's Boolean words (device-boolean-visibility),
  rotated-planes' unreached rotation-4 bands (rotated-load-tiles), sample-fills' wide depth
  digest (drawn-depth-copy), texture-fills' 32-bit float depth digests and fresh-contents'
  Depth32Float fresh site (restricted-depth-upload, fresh-pattern-zeroed);
- the replay helpers staged_records_notice, interlocked_split_notice and
  set_past_layout_notice, and every call of them;
- the 66 variants, their ALL entries and their codes;
- what only they used: the mesh pass notice list, the sparse notice lists, the GPU-time list,
  the buffer-blits and sparse-mappings rows' notices fields, buffer-target-clears' kept_image,
  buffer-texture-blits' copies_shared_bytes and its two tests, render-draw-forms'
  bounds-pass helpers, rotated-planes' band_is_reached and surface::stored_at,
  rotated-targets' reads_destination_alpha_in_color, visibility's boolean_words, and the
  module prose that described those notices.

The one backed kind whose name was not its note's, ImplementationDefinedReconvergence, is now
DeviceReconvergence with the code metal2vulkan-degrade-device-reconvergence, the note's kebab
name, and docs/API.md section 9 gains its entry. shared-in-system-memory stays for the next
commit. The tests that used a deleted kind as a stand-in use a backed one. Every case keeps
its shared-in-system-memory declaration; tests that count a case's declarations count what is
left. pass_start_reads no longer cites the deleted cost::the_creation_prediction.
docs/CONFORMANCE-COVERAGE.md is regenerated.

A case whose values the deleted tolerances held is now compared exactly; whether the runtime
differs there shows on the venues' replays.

Verified: cargo fmt --all. The gate runs once over this and the following commits.
This commit is contained in:
Anees Iqbal committed 2026-11-20 09:13:39 -08:00
1 parent a4540b3913
commit a7320ad3f9
84 files changed
+510 -3022

No files matched your search

@@ -222,26 +222,20 @@ impl Row {
}
/// What a **four-sample** row with an alpha output announced: the coverage of a clipped edge split
/// per sample (`clipped-coverage-split`), the sample outputs written in a loop
/// (`looped-sample-outputs`) and the resolve done by a draw rather than the store
/// (`shader-resolve`), with `alphaToCoverage` on or off. With it on, the device's own conversion
/// of the alpha into the attachment (`device-color-conversion`) and its own coverage of the alpha
/// (`device-alpha-coverage`) fire too, which the suite declares for every case
/// ([`crate::replay::NATIVE_NOTES`]).
/// per sample (`clipped-coverage-split`) and the sample outputs written in a loop
/// (`looped-sample-outputs`), with `alphaToCoverage` on or off. With it on, the device's own
/// conversion of the alpha into the attachment (`device-color-conversion`) and its own coverage of
/// the alpha (`device-alpha-coverage`) fire too, which the suite declares for every case
/// ([`crate::replay::NATIVE_NOTES`]). A four-sample row whose fragment writes **no alpha** names
/// none: nothing narrows the coverage, so neither the split nor the looped outputs fire.
///
/// Measured on the RTX 5080 Laptop (615.71.09) for all ten such rows, each divergent on the
/// notices site and nothing else (replay-nvidia.log).
const ALPHA_MULTISAMPLE: &[Degradation] = &[
Degradation::ClippedCoverageSplit,
Degradation::LoopedSampleOutputs,
Degradation::ShaderResolve,
];
/// A four-sample row whose fragment writes **no alpha**: nothing narrows the coverage, so neither
/// the split nor the looped outputs fire, and what is left is the resolve. Measured on the 5080 and
/// on llvmpipe for both such rows.
const NO_ALPHA_MULTISAMPLE: &[Degradation] = &[Degradation::ShaderResolve];
/// A single-sample row, whose store announces nothing but the device's own answers, which the suite
/// declares for every case ([`crate::replay::NATIVE_NOTES`]): the device's conversion of an alpha
/// under `alphaToCoverage` or of a blend whose factors read the source alpha
@@ -323,13 +317,11 @@ const ROWS: &[Row] = &[
Row {
name: "a2c-on-4-no-alpha-output",
report: Report::NoAlpha,
notices: NO_ALPHA_MULTISAMPLE,
..Row::sweep("a2c-on-4-no-alpha-output", true, 0.5)
},
Row {
name: "a2c-off-4-no-alpha-output",
report: Report::NoAlpha,
notices: NO_ALPHA_MULTISAMPLE,
..Row::sweep("a2c-off-4-no-alpha-output", false, 0.5)
},
// Alpha-to-one, and the blend that says what it fed.
@@ -548,16 +548,7 @@ impl Case for ArgumentEncoderCase {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// A case that dispatches samples the texture and the sampler its encoder wrote through
// the kernel's heap set, which MoltenVK's layout query refuses
// ([`crate::replay::set_past_layout_notice`]): announced by both dispatching cases on the
// M3 Max under MoltenVK 1.4.2, by none on lavapipe.
let mut allowances = vec![crate::replay::shared_memory_notice()];
if self.dispatches {
allowances.push(crate::replay::set_past_layout_notice());
}
allowances
vec![crate::replay::shared_memory_notice()]
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
@@ -117,12 +117,6 @@ const TEXEL_BYTES: usize = 16;
/// texture of its own, so a diff names which blocks moved.
const ROUNDS: [&str; 2] = ["zero-blocks", "seeded-blocks"];
/// The most a compact linear channel may be off Metal's value, as the `decoded-texel-precision`
/// notice states it (docs/API.md): the 8-bit code nearest Metal's 12-bit value is at most half an
/// 8-bit step away, which is 1/510. It is the notice's number, so a run that exceeds it fails
/// rather than being re-fitted to whatever a device answers.
const LEDGERS_COMPACT_BOUND: f64 = 1.0 / 510.0;
/// The most a linear channel of the device's own decode of an ASTC LDR block may be off Metal's
/// value, as the `compressed-texel-decode` catalogue entry states it (docs/API.md): 1/2048, the
/// largest difference measured over the fourteen footprints' random blocks, plus the `float`
@@ -436,13 +430,11 @@ impl AstcTextures {
TextureRequest::read_2d(self.format().format.as_raw(), SIDE, SIDE).loaded(uploads)
}
/// How far a compact texel of this format may be off Metal's value, where that is not zero:
/// a linear format's half 8-bit step. `None` for an sRGB form, whose twin holds Metal's own
/// codes and whose slots read the device's decode of them, which loosens no value, and
/// `None` for an HDR form, whose twin holds Metal's halves exactly.
fn compact_bound(&self) -> Option<f64> {
/// Whether this format's channels are linear LDR ones, the only ones the device's decode
/// may move (`compressed-texel-decode`); an sRGB or HDR form's texels compare exactly.
fn linear(&self) -> bool {
let decode = self.decode();
(!decode.srgb && !decode.hdr).then_some(LEDGERS_COMPACT_BOUND)
!decode.srgb && !decode.hdr
}
/// The layout a round's texels read back under: one row of the layout per row of texels, four
@@ -480,19 +472,6 @@ impl Case for AstcTextures {
}
fn allowances(&self) -> Vec<Allowance> {
// A device with no ASTC block keeps the blocks in a carrier image and reads them through a
// decoded twin, which the runtime announces once per device. Metal announces nothing, so
// the notice has to be declared by its code or the comparison cannot be made at all. The
// declaration loosens no value: the only site it covers is the set of notices, which Metal
// holds empty, and it fails the case if the notice did not fire.
// A CPU copy that fills such a texture (`replaceRegion`) is decoded on the CPU into that
// twin and copied in, announced as `cpu-block-decode`: the host-copy arm of the very
// mechanism the line above names, measured on lavapipe for every format of this family. It
// is a declaration and not a tolerance -- every texel the case reads still compares
// exactly with Metal.
// Measured on lavapipe for every format of this family, the HDR ones among them. A device
// that holds a format's ASTC block natively announces neither: nothing of ours sits between
// the blocks and the texels there.
// Every row that runs reads its texels back through a `Shared` buffer, so on a device
// without unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the notices
@@ -510,31 +489,11 @@ impl Case for AstcTextures {
// HDR form's compare exactly.
let mut all = vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::CarriedDecodedTwin.code()),
crate::replay::notice_allowance(Degradation::CpuBlockDecode.code()),
crate::replay::notice_allowance(Degradation::CompressedTexelDecode.code()),
];
// An sRGB form's twin holds Metal's own 8-bit codes, which its slots decode through Metal's
// table, so its texels compare exactly and it names nothing further. A linear format's
// compact twin holds the 8-bit code nearest Metal's 12-bit value, which the runtime
// announces as `decoded-texel-precision`, whose catalogue entry bounds it at 1/510. The
// bound here is the notice's number, so a run that exceeds it is the notice's claim
// failing.
if let Some(bound) = self.compact_bound() {
all.push(crate::replay::notice_allowance(
Degradation::DecodedTexelPrecision.code(),
));
for round in ROUNDS {
all.push(Allowance::new(
format!("case/{round}/texels"),
Loosening::Absolute(bound),
Justification::notice(Degradation::DecodedTexelPrecision),
));
}
// `metal2vulkan-runtime` keeps no twin: where the device holds the format's block, a
// linear channel is the device's decode of it, the static note
// `compressed-texel-decode`, whose catalogue entry bounds an ASTC LDR channel at
// 1/2048.
// A linear channel is the device's decode of the block, the static note
// `compressed-texel-decode`, whose catalogue entry bounds an ASTC LDR channel at 1/2048.
if self.linear() {
for round in ROUNDS {
all.push(Allowance::new(
format!("case/{round}/texels"),
@@ -773,11 +732,11 @@ mod tests {
}
/// Only the linear formats name a tolerance, and each names the bound the
/// `decoded-texel-precision` notice states.
/// `compressed-texel-decode` entry states.
///
/// This is the ruling that a notice declaration is not a tolerance, held as a test: the
/// `carried-decoded-twin` declaration is on every case and loosens no value, while the one
/// allowance that loosens a texel is named only where the notice says a texel moves.
/// `compressed-texel-decode` declaration is on every case and loosens no value, while the one
/// allowance that loosens a texel is named only where the entry says a texel moves.
#[test]
fn only_the_linear_formats_loosen_a_texel() {
let mut loosened = 0;
@@ -789,15 +748,13 @@ mod tests {
.filter(|allowance| allowance.path.ends_with("/texels"))
.map(|allowance| allowance.loosening)
.collect();
// An sRGB form's twin holds Metal's own codes and an HDR format's Metal's halves, so
// neither loosens a texel; only the fourteen linear ones do, each round by the compact
// twin's bound and by the device decode's.
if case.compact_bound().is_none() {
// An sRGB or HDR form loosens no texel; only the fourteen linear ones do, each round
// by the device decode's bound.
if !case.linear() {
assert!(bounds.is_empty(), "{}: {bounds:?}", format.name);
continue;
}
let mut expected = vec![Loosening::Absolute(LEDGERS_COMPACT_BOUND); ROUNDS.len()];
expected.extend(vec![Loosening::Absolute(DEVICE_DECODE_BOUND); ROUNDS.len()]);
let expected = vec![Loosening::Absolute(DEVICE_DECODE_BOUND); ROUNDS.len()];
assert_eq!(bounds, expected, "{}", format.name);
loosened += 1;
}
@@ -40,9 +40,7 @@
//! our own leg**: the runtime keeps a managed buffer's host copy apart from the device's, and
//! nothing but this call copies the device's writes back into it. The buffer is given a known
//! byte and synchronized once before the fill the case is about, so the bytes outside that fill
//! are bytes the case wrote. It is the one case of the family that **announces** anything, and
//! the only one that declares a notice, and the run that measured it is written at the
//! declaration's own constant.
//! are bytes the case wrote.
//! - [`synchronized_managed_texture`]: `synchronizeTexture:slice:level:` of a `Managed` texture,
//! read by the host with `getBytes:` at a pitch six times its row — so the answer holds the
//! padding between the rows and after the last one, which no device write may touch.
@@ -808,7 +806,11 @@ static SYNCHRONIZED_BUFFER: Row = Row {
words.push(value);
words
},
notices: SPLIT_FILL,
// The one row of the family that reads its answer back out of a **`Managed`** buffer rather
// than a `Shared` one, so [`NOTICES`]'s venue notice is not its: on the RTX 5080 Laptop
// (615.71.09) it was the only row of the family that did not announce
// `shared-in-system-memory`, and it compared justified there (replay-nvidia.log).
notices: &[],
};
/// The managed texture's extent, and the pitch the host reads it at: six times its row, so the
@@ -1022,20 +1024,6 @@ static FENCED_ENCODERS: Row = Row {
/// form and the one that makes the next real notice visible.
const NOTICES: &[Degradation] = &[Degradation::SharedInSystemMemory];
/// The notice [`synchronized_managed_buffer`] announces, **measured** rather than argued.
///
/// Its second fill is `[37, 107)` of the managed buffer — neither end a multiple of four — so a
/// device whose transfer fill writes whole words splits it. Verified on an Apple M3 Max
/// (MoltenVK, API 1.2, Metal level 27.0.1): the first replay of this case reported
/// `case/notices` divergent with `metal2vulkan-degrade-split-buffer-fill` announced and nothing
/// declared, and the declaration is that run's answer. It loosens the notices site alone; every
/// byte of the buffer still compares exactly, which is the point of the case.
/// It is the one row of the family that reads its answer back out of a **`Managed`** buffer
/// rather than a `Shared` one, so [`NOTICES`]'s venue notice is not its: on the RTX 5080 Laptop
/// (615.71.09) it was the only row of the family that did not announce
/// `shared-in-system-memory`, and it compared justified there (replay-nvidia.log).
const SPLIT_FILL: &[Degradation] = &[Degradation::SplitBufferFill];
/// The case of `copyFromTexture:toTexture:`.
pub fn whole_texture_copy() -> BlitEncoderCommands {
BlitEncoderCommands {
@@ -1175,12 +1163,11 @@ mod tests {
/// Every case loosens the notices site and nothing else: no byte of these cases is ever
/// loosened, whatever form a device's copy or fill takes.
///
/// And the declaration is held to the one case it was measured on. A code named on a case no
/// venue was measured announcing it for is a declaration nothing checks, and the replay would
/// report it as an unfired allowance rather than failing — which is the quiet direction, so it
/// is pinned here instead.
/// And the venue's memory notice is declared only where it was measured: on every row that
/// reads its answer back through a `Shared` buffer, and not on the one that reads it out of a
/// `Managed` buffer.
#[test]
fn only_the_measured_case_declares_a_notice() {
fn only_the_shared_read_backs_declare_a_notice() {
for case in all() {
for allowance in case.allowances() {
assert_eq!(
@@ -1191,8 +1178,6 @@ mod tests {
);
}
}
// Every row declares the venue's memory notice except the one that reads its answer back
// out of a `Managed` buffer, which declares its own measured notice instead.
assert_eq!(NOTICES, [Degradation::SharedInSystemMemory]);
let declaring: Vec<&str> = EVERY_ROW
.iter()
@@ -1200,20 +1185,7 @@ mod tests {
.map(|row| row.case)
.collect();
assert_eq!(declaring, [SYNCHRONIZED_BUFFER.case]);
assert_eq!(SYNCHRONIZED_BUFFER.notices, SPLIT_FILL);
}
/// The fill the declaring case makes really is the shape the notice is about: neither end of
/// its range is a multiple of four, so a device whose fill writes whole words has to split it.
///
/// Without this the declaration would rest on a sentence in a doc comment, and a later edit
/// that aligned the range would leave a code declared that nothing provokes.
#[test]
fn the_declaring_cases_fill_is_unaligned_at_both_ends() {
let (offset, length, _) = MANAGED_FILL;
assert_ne!(offset % 4, 0, "the fill starts on a word boundary");
assert_ne!((offset + length) % 4, 0, "the fill ends on a word boundary");
assert!(offset + length <= MANAGED);
assert!(SYNCHRONIZED_BUFFER.notices.is_empty());
}
/// Assert that `origin` plus `size` lies inside `extent` on every axis, naming the step.
@@ -71,7 +71,6 @@
use crate::allowance::Allowance;
use crate::case::{made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::indirect_commands::{ComputeCommandStep, EncodedCommand, IcbDescriptor};
use crate::recording::ShaderRef;
@@ -182,23 +181,6 @@ impl Call {
matches!(self, Call::Copy)
}
/// Whether the call writes a buffer's records on the GPU, which makes the runtime replay a
/// later execution of them through its host step and announce it once.
///
/// The optimize call records nothing, so it alone does not.
const fn replays_on_the_host(self) -> bool {
matches!(self, Call::Reset | Call::Copy)
}
/// Whether the call's GPU write is the first use of the buffer it writes: the copy's
/// destination, which the case makes and touches nowhere before the copy. On a device that
/// places records by their first use, that write places them in device-local memory, where the
/// host step of the execution after it reads them through copies. The reset's buffer is the
/// CPU's first, so its records lie in host memory; the optimize writes nothing.
const fn places_its_records_on_the_gpu(self) -> bool {
matches!(self, Call::Copy)
}
/// The piece of work the call encodes over `leg`, out of the leg's source buffer and, where
/// the call has one, its destination.
fn work(self, source: Handle, destination: Handle, leg: Leg) -> RenderWork {
@@ -343,15 +325,6 @@ impl Case for BlitIndirectCommands {
// Every byte of every leg's output compares exactly, on this venue and under this
// declaration: the only site loosened is the set of notices, which Metal holds empty.
//
// Measured on this Apple M3 Max through MoltenVK 1.4.2: the reset and the copy cases
// announce `host-replayed-indirect-commands`, because the runtime replays an execution of
// commands the **GPU** wrote through its host step, and these two calls write a buffer's
// records on the GPU as the command buffer runs. The optimize case records nothing on the
// GPU, so it announces nothing and declares nothing — a declaration no run was measured
// provoking is a declaration nobody checked.
//
// The allowance fails the case if the notice did not fire, so a call that stops replaying
// on the host has to drop this line rather than carry a stale excuse.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -363,26 +336,7 @@ impl Case for BlitIndirectCommands {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// On a device that places records by their first use, the copy case announces
// `staged-indirect-records` (`crate::replay::staged_records_notice` holds the whole
// reason). Measured on the RX 7900 XTX (RADV NAVI31), the case alone at 45e6784e91's
// runtime (`conformance cost --show --runs 1`): host_steps_recorded 3 and
// icb_records_staged_accesses 3 for the copy, the three executions after a copy of at
// least one command, each reading the records the copy wrote into device-local memory;
// the leg that copies none reads its never-written records in place. The reset read
// host_steps_recorded 3 and no staged access, its buffer the CPU's first, so it declares
// nothing. On unified memory, the M3 Max's included, it cannot fire.
let mut named = vec![crate::replay::shared_memory_notice()];
if self.call.replays_on_the_host() {
named.push(crate::replay::notice_allowance(
Degradation::HostReplayedIndirectCommands.code(),
));
}
if self.call.places_its_records_on_the_gpu() {
named.push(crate::replay::staged_records_notice());
}
named
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -45,7 +45,6 @@
use crate::allowance::Allowance;
use crate::case::{call, Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::transcript::{ByteLayout, Element, Negative, Node, Observed, Sites, Value};
use crate::work::{Resource, Step, Storage, Work};
@@ -131,13 +130,6 @@ struct Row {
sites: fn(&crate::work::Done) -> Vec<Node>,
/// What the row sets that is not a buffer's bytes, as its input fingerprint.
parameters: fn() -> Vec<u8>,
/// The degrade notices this row's commands announce on a device whose copy or fill cannot take
/// the form Metal's does. Metal announces none, so the notices site is the only field of these
/// rows that may differ at all — every byte compares exactly — and each kind here is what
/// justifies that one difference. A row that announced a kind not listed fails until the kind
/// is added, which is the model working: an announced difference nobody named is not an
/// announced difference.
notices: &'static [Degradation],
}
/// A case of the family: one row.
@@ -166,14 +158,7 @@ impl Case for BufferBlits {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
std::iter::once(crate::replay::shared_memory_notice())
.chain(
self.row
.notices
.iter()
.map(|kind| crate::replay::notice_allowance(kind.code())),
)
.collect()
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -257,9 +242,6 @@ static ANY_RANGE: Row = Row {
]
},
parameters: || b"fill 1+62 5a; copy 3->21+10; fill 41+2 ee; fill 48+5 11".to_vec(),
// Three of the four fills cover bytes that are not whole 4-byte words at multiples of 4,
// which is the whole point of the row.
notices: &[Degradation::SplitBufferFill],
};
/// Overlapping ranges of one buffer, forwards and backwards, in shared memory and in private.
@@ -302,9 +284,6 @@ static OVERLAPPING: Row = Row {
]
},
parameters: || b"copy 1->7+4000; copy 9->2+4000; copy private 5->6+4093".to_vec(),
// Every copy of the row is between two overlapping ranges of one buffer, which Vulkan's copy
// forbids outright.
notices: &[Degradation::OverlappingBufferCopy],
};
/// A copy of no bytes and a fill of no bytes, inside the buffer and past its end.
@@ -345,8 +324,6 @@ static EMPTY_RANGES: Row = Row {
]
},
parameters: || b"copy 0->0+0; copy 0->64+0; fill 4+0; fill 64+0".to_vec(),
// Nothing is copied and nothing is filled, so nothing takes another form.
notices: &[],
};
/// The 600 KiB [`EVERY_FILL_SIZE`] fills.
@@ -410,8 +387,6 @@ static EVERY_FILL_SIZE: Row = Row {
})
.collect()
},
// Four of the five fills start or end inside a word.
notices: &[Degradation::SplitBufferFill],
};
/// The case of one blit encoder's fills and copies of any range.
@@ -511,13 +486,6 @@ mod tests {
);
}
}
// The empty-range row copies and fills nothing, so it declares no notice of its own --
// only the venue's, which every row of the family declares.
assert_eq!(
empty_ranges().allowances().len(),
1,
"the empty-range row copies and fills nothing, so it loosens nothing of its own"
);
}
/// The cases name distinct rows and distinct sites.
@@ -24,12 +24,9 @@
//! (wholly past it), copies rows 240 to 255 into a texture of its own, and reads every one of
//! those back, with the buffer's bytes.
//!
//! Every byte compares exactly. What differs is the announcing: where the device makes no image
//! over the buffer's memory on Metal's layout, the runtime keeps the texture as a shadow image and
//! announces `shadowed-texture`, which Metal never does, and a device without unified memory
//! Every byte compares exactly. What differs is the announcing: a device without unified memory
//! announces `shared-in-system-memory` for the `Shared` buffers the answers are read back
//! through. Nothing here can fault a GPU: one small texture, one thread a
//! texel, no loop.
//! through. Nothing here can fault a GPU: one small texture, one thread a texel, no loop.
use crate::allowance::Allowance;
use crate::case::{
@@ -86,15 +83,9 @@ fn written(n: u64, set: u64) -> Vec<u8> {
/// What both cases loosen: the notices, and nothing else.
fn allowances() -> Vec<Allowance> {
// Where the device makes no image over the buffer's memory on Metal's layout, the runtime
// keeps the texture as a shadow image of the buffer's bytes, and announces
// `shadowed-texture`, which Metal never does.
// Every case reads its answers back through `Shared` buffers, so a device without unified
// memory announces `shared-in-system-memory` (`crate::replay::shared_memory_notice`).
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(crate::degradation::Degradation::ShadowedTexture.code()),
]
vec![crate::replay::shared_memory_notice()]
}
/// The numbers that place the texture in the buffer, for both cases' inputs.
@@ -103,32 +103,6 @@
//! of, the `DontCare` row is the only thing distinguishing a pass that wrote nothing from one that
//! wrote the clear.
//!
//! # The two venues run different code of ours, and neither sees both halves
//!
//! Metal's answer above is one answer. **Our own side reaches it two different ways**, and which
//! way depends on the device, so the second venue here is not breadth over the first — it is cover
//! for a path the first never takes.
//!
//! Our runtime renders a target whose rows the device's own linear image cannot lay out
//! as Metal does into a **shadow** image and copies back (`shadowed-texture`). Where the image
//! really does lie over the buffer's bytes and the pass stores nothing of it, it renders into a
//! **kept image** instead so the buffer keeps its bytes (`kept_bytes`, `dont-care-stand-in`). The
//! two are exclusive: `kept_bytes` skips an attachment that already has a shadow, and it is reached
//! only by an attachment the pass does not store.
//!
//! Measured on both:
//!
//! - **MoltenVK on this M3 Max**: all six rows shadow, so all six announce `shadowed-texture` and
//! **no row reaches the kept-image path at all**.
//! - **lavapipe**: the tight pitch of 16 aliases the buffer rather than shadowing, so
//! `shadowed-texture` fires for five of the six and not for `pitch-16-stored`, and
//! `pitch-16-dont-care` takes the kept-image path and announces `dont-care-stand-in` — a code
//! MoltenVK never announces for any row of this family.
//!
//! So a one-venue run of this family leaves one of our own two implementations of the answer
//! unexercised, whichever venue it is. That is the reason to run both, and it is why the
//! declarations name two codes where no single run announces more than one of them.
//!
//! Nothing here faults a GPU, hangs one or trips a watchdog: one 4 x 4 target a case, one clear and
//! no draw, over two kilobytes of shared memory, committed once and read back.
@@ -201,20 +175,6 @@ struct Row {
/// `bytesPerRow`: how far apart the target's rows lie in the buffer.
pitch: u64,
store: StoreAction,
/// Whether a venue has been **measured** announcing the kept-image notice
/// (`dont-care-stand-in`) for this row, which is what the row must declare.
///
/// Measured rather than reasoned, and narrow on purpose. The path is reachable only by a row
/// the pass does not store, so a `Store` row can never need it -- but of the three `DontCare`
/// rows only the tight pitch has been seen to take it, on lavapipe, where its target aliases
/// the buffer instead of being shadowed. On MoltenVK no row of this family takes it, and on
/// lavapipe the two padded pitches are shadowed and do not either.
///
/// So the padded rows declare nothing here. A declaration no run of the suite can check is the
/// noise the unfired tally exists to show, and the failure direction is the better one: a
/// device that does announce it for a padded row fails loudly as an undeclared notice, and
/// whoever sees that adds the declaration with the measurement that earned it.
kept_image: bool,
}
/// The six rows: three pitches, each stored and each thrown away.
@@ -223,37 +183,31 @@ const ROWS: [Row; 6] = [
case: "buffer-target-clears-pitch-32-stored",
pitch: 32,
store: StoreAction::Store,
kept_image: false,
},
Row {
case: "buffer-target-clears-pitch-32-dont-care",
pitch: 32,
store: StoreAction::DontCare,
kept_image: false,
},
Row {
case: "buffer-target-clears-pitch-256-stored",
pitch: 256,
store: StoreAction::Store,
kept_image: false,
},
Row {
case: "buffer-target-clears-pitch-256-dont-care",
pitch: 256,
store: StoreAction::DontCare,
kept_image: false,
},
Row {
case: "buffer-target-clears-pitch-16-stored",
pitch: 16,
store: StoreAction::Store,
kept_image: false,
},
Row {
case: "buffer-target-clears-pitch-16-dont-care",
pitch: 16,
store: StoreAction::DontCare,
kept_image: true,
},
];
@@ -365,26 +319,7 @@ impl Case for BufferTargetClear {
// One set of bytes is loosened: a `DontCare` row's texels, which Apple's page lets the GPU
// replace with arbitrary data (`DONT_CARE_TEXELS`, `dont_care_texels`). The padding and the
// bytes before and after the target compare exactly, Metal's against ours.
// The rest is the **announcing**. Our runtime keeps a target
// whose rows the device's own linear image does not lay out as Metal does as a shadow
// image the pass renders into and the encoders copy back, and it announces that once per
// device (`shadowed-texture`); Metal announces nothing, ever, because nothing of the kind
// is a thing Metal has to do.
//
// **One declaration per code the case announces, measured on both venues.** A code a case
// announces and declares nowhere is a divergence at the notices site
// (`DivergenceKind::UndeclaredNotice`), so this list is a measured set and not a guess.
// On this M3 Max through MoltenVK all six rows announce `shadowed-texture` and nothing
// else. On lavapipe the tight pitch of 16 announces it for no row at all and the
// `DontCare` one announces `dont-care-stand-in` instead, so the union is two codes and
// neither venue sees both.
//
// `dont-care-stand-in` is declared on the one row a venue has been **measured**
// announcing it for (`Row::kept_image`), not on every row that could in principle take the
// path. The first shape of this declared it on all three `DontCare` rows, and the M3 Max
// replay reported three declarations fired on no venue of which three "name nothing this
// run justifies either, so no run of this suite has checked them" -- two of them true of
// lavapipe as well, since the padded pitches are shadowed there too.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -396,17 +331,7 @@ impl Case for BufferTargetClear {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
let mut named = vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(
crate::degradation::Degradation::ShadowedTexture.code(),
),
];
if self.row.kept_image {
named.push(crate::replay::notice_allowance(
crate::degradation::Degradation::DontCareStandIn.code(),
));
}
let mut named = vec![crate::replay::shared_memory_notice()];
named.extend(self.row.dont_care_texels());
named
}
@@ -158,37 +158,6 @@ impl Row {
matches!(self.blit, Blit::IntoBuffer | Blit::OutOfBuffer)
}
/// Whether the row's copy reads and writes **the same bytes of the buffer**, which is what
/// `overlapping-texel-copy` names: Vulkan's copy forbids it, so our side takes the rows through
/// a scratch buffer.
///
/// This is the shape that decides the row's `overlapping-texel-copy` declaration, and nothing
/// else. It is read off the row's own numbers rather than its key, so a row added to a table,
/// or an offset moved, changes what the case declares by itself.
///
/// A copy with an ordinary texture on one side shares nothing: that texture is not over the
/// buffer. Between two textures over the one buffer, the bytes are shared where the textures'
/// own byte ranges meet. Within one texture, a row of it holds its texels and nothing else, so
/// the bytes are shared only where the source and destination rectangles share a row **and** a
/// column: `onto-itself-disjoint` reads rows 0..2 and writes rows 2..4 and shares none.
fn copies_shared_bytes(&self) -> bool {
// The half-open byte range a texture at `at` covers: its last row's texels end it, not its
// pitch, so the bytes past the last row belong to neither texture.
let span = |at: u64| at..at + (SIDE - 1) * PITCH + ROW_BYTES;
match self.blit {
Blit::IntoBuffer | Blit::OutOfBuffer => false,
Blit::WithinBuffer { other, .. } => {
let (one, two) = (span(OFFSET), span(other));
one.start < two.end && two.start < one.end
}
Blit::OntoItself => {
let meet = |from: u64, to: u64, size: u64| from < to + size && to < from + size;
meet(self.from[1], self.to[1], self.size[1])
&& meet(self.from[0], self.to[0], self.size[0])
}
}
}
/// The buffer's bytes before the row's program runs.
fn buffer_bytes(&self) -> Vec<u8> {
let bytes = pattern(LEN as usize);
@@ -500,30 +469,8 @@ impl Case for Blits {
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// Every byte of every one of these programs compares exactly, Metal's against ours. What
// differs is the announcing: a texture whose rows lie further apart than a row is wide is
// kept as a shadow image, and a copy whose source and destination texels are the same
// bytes is done in a way the device announces. Metal announces neither, because neither
// is a thing Metal has to do, so the notices site differs and the notice itself is what
// justifies it.
// Every byte of every one of these programs compares exactly, Metal's against ours.
//
// One declaration per code, and a code is declared only where a row of this case can
// announce it. A declaration fires on its own code, so a code a case announces and declares
// nowhere is a divergence for an undeclared notice, and a code it declares but no row can
// announce is an allowance that fires on no venue — the noise a real difference hides in.
// Both halves matter, which is why the second code is read off the rows rather than named
// for the whole family.
//
// `shadowed-texture` is every row's: each row's pitch is wider than its row, so the texture
// over the buffer is kept as a shadow image.
//
// `overlapping-texel-copy` is only the rows whose copy reads and writes the same bytes of
// the buffer ([`Row::copies_shared_bytes`]), which Vulkan's copy forbids and our side takes
// through a scratch buffer. The `to-and-from` table has no such row — both its sides are an
// ordinary texture and a texture over the buffer, which share nothing — so that case
// declares only the first code. Measured on Apple M3 Max: `buffer-texture-blits-overlapping`
// announced `overlapping-texel-copy` and declared it nowhere, while `to-and-from` compared
// justified in the same run.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -535,18 +482,7 @@ impl Case for Blits {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
let mut named = vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(
crate::degradation::Degradation::ShadowedTexture.code(),
),
];
if self.rows.iter().any(Row::copies_shared_bytes) {
named.push(crate::replay::notice_allowance(
crate::degradation::Degradation::OverlappingTexelCopy.code(),
));
}
named
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -637,137 +573,6 @@ mod tests {
}
}
/// The rows of the overlapping case that say they overlap do, and the ones that say they do not
/// do not — as [`Row::copies_shared_bytes`] reads them, which is what decides the case's
/// `overlapping-texel-copy` declaration.
///
/// The point of those rows is that the source and destination bytes are the same bytes, so a
/// row whose offsets had drifted apart would look like a passing overlap case while asking
/// nothing. Its failure mode was exercised while writing it: pointing the second texture at
/// `ELSEWHERE` instead of one pitch on fails here.
///
/// The expectation is computed **independently of the method**, which is the whole value of the
/// test: the method intersects ranges, while this enumerates the actual buffer byte each texel
/// of the source and destination rectangles occupies and intersects the two sets. A test that
/// called the method to work out what to expect would pass whatever the method did. Every
/// variant of [`Blit`] is covered, not only the two textures over one buffer, because a copy
/// with an ordinary texture on one side must read as sharing nothing for the `to-and-from` case
/// to declare only the one code.
#[test]
fn the_overlapping_rows_bytes_overlap_and_the_disjoint_ones_do_not() {
// The buffer bytes a texel of the texture at `at` occupies, as the row pitch lays them.
let texel_bytes = |at: u64, x: u64, y: u64| {
let start = at + y * PITCH + x * (ROW_BYTES / SIDE);
start..start + ROW_BYTES / SIDE
};
let rect = |at: u64, origin: [u64; 2], size: [u64; 2]| {
let mut bytes = std::collections::BTreeSet::new();
for y in origin[1]..origin[1] + size[1] {
for x in origin[0]..origin[0] + size[0] {
bytes.extend(texel_bytes(at, x, y));
}
}
bytes
};
for row in OVERLAPPING_ROWS.iter().chain(&TO_AND_FROM_ROWS) {
// What the row's two sides really occupy. Only a side that is a texture **over the
// buffer** occupies any of it, so a side that is an ordinary texture contributes none.
let (read, written) = match row.blit {
Blit::IntoBuffer => (
std::collections::BTreeSet::new(),
rect(OFFSET, row.to, row.size),
),
Blit::OutOfBuffer => (
rect(OFFSET, row.from, row.size),
std::collections::BTreeSet::new(),
),
Blit::WithinBuffer { other, reverse } => {
let (from_at, to_at) = match reverse {
false => (OFFSET, other),
true => (other, OFFSET),
};
(
rect(from_at, row.from, row.size),
rect(to_at, row.to, row.size),
)
}
Blit::OntoItself => (
rect(OFFSET, row.from, row.size),
rect(OFFSET, row.to, row.size),
),
};
let shares = read.intersection(&written).next().is_some();
assert_eq!(
row.copies_shared_bytes(),
shares,
"{}: the copy's bytes {} really shared, which is not what the row reads as, so the \
case would declare the wrong set of notices",
row.key,
if shares { "are" } else { "are not" }
);
}
// And the family is not all of one kind, or the comparison above would hold vacuously.
let sharing = OVERLAPPING_ROWS
.iter()
.chain(&TO_AND_FROM_ROWS)
.filter(|row| row.copies_shared_bytes())
.count();
assert!(
sharing > 0 && sharing < OVERLAPPING_ROWS.len() + TO_AND_FROM_ROWS.len(),
"{sharing} rows share bytes: the tables must hold both kinds for this to check anything"
);
}
/// Each case declares exactly the notice codes a row of it can announce: both, where a row's
/// copy reads and writes the same bytes of the buffer, and the shadow alone where none does.
///
/// The second direction is the one that costs a run its meaning. A declaration fires on its own
/// code, so a code declared where no row can announce it fires on no venue and names nothing
/// the run justifies — an allowance that sits in every report as noise a real difference can
/// hide in. So this asserts the whole set, equal, rather than that the codes are present.
#[test]
fn each_case_declares_exactly_the_notices_a_row_of_it_can_announce() {
use crate::allowance::Justification;
use crate::degradation::Degradation;
for case in table() {
let codes: Vec<String> = case
.allowances()
.iter()
.map(|allowance| {
assert_eq!(
allowance.path,
format!("case/{}/*", crate::replay::NOTICES_SITE),
"{}: an allowance outside the notices site",
case.name()
);
match &allowance.justified_by {
Justification::Degradation(code) => code.clone(),
other => panic!("{}: an unexpected tolerance: {other:?}", case.name()),
}
})
.collect();
// The venue's own notice leads the set: both cases declare it, because both read
// their answer back through a `Shared` buffer and a card without unified memory holds
// that buffer in system memory.
let mut wanted = vec![
Degradation::SharedInSystemMemory.code().to_owned(),
Degradation::ShadowedTexture.code().to_owned(),
];
if case.rows.iter().any(Row::copies_shared_bytes) {
wanted.push(Degradation::OverlappingTexelCopy.code().to_owned());
}
assert_eq!(codes, wanted, "{}", case.name());
}
// The two cases must not declare the same set, or the row-shaped test above is decoration.
let sets: Vec<usize> = table().iter().map(|case| case.allowances().len()).collect();
assert_eq!(
sets,
vec![2, 3],
"one case declares the venue's notice and the shadow image, the other those two and \
the overlapping copy"
);
}
/// Every texel of every set names itself, so no two texels of a program share a value.
///
/// A copy that moved the right number of bytes from the wrong place is only visible if the
@@ -75,17 +75,9 @@ const READ_WRITE: TextureUsage = TextureUsage::SHADER_READ.union(TextureUsage::S
/// The buffer every making row is laid over: 4096 bytes, as the lane's is.
const BUFFER: u64 = 4096;
/// What the two recorded cases loosen, and what justifies it.
///
/// A 2D texture over a buffer whose rows the device's own linear image does not lay out as Metal
/// does is an image the encoders copy the texels into and back — a **shadow** — and the runtime
/// announces that once per device (`shadowed-texture`). Metal announces nothing, ever, so the
/// notices site differs for every case of this family that holds a 2D row, and the notice is what
/// justifies the difference. Measured on this M3 Max: the texture buffers alias their bytes and
/// announce nothing, and it is the 2D rows that take the shadow.
///
/// Nothing else is loosened. Every fact and every byte of both cases compares exactly.
fn shadow_allowances() -> Vec<crate::allowance::Allowance> {
/// What the two recorded cases loosen: the notices, and nothing else. Every fact and every byte of
/// both cases compares exactly.
fn allowances() -> Vec<crate::allowance::Allowance> {
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -97,10 +89,7 @@ fn shadow_allowances() -> Vec<crate::allowance::Allowance> {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(crate::degradation::Degradation::ShadowedTexture.code()),
]
vec![crate::replay::shared_memory_notice()]
}
/// Every case of the family.
@@ -214,7 +203,7 @@ impl Case for MadeOverBuffer {
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
shadow_allowances()
allowances()
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -618,7 +607,7 @@ impl Case for CpuAccess {
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
shadow_allowances()
allowances()
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -34,8 +34,7 @@
//! two textures of the format off the pairs, and four copies into a texture of `GBGR422`,
//! `BGRG422`, `RG8Unorm` and `R16Uint`. Each read-back's bytes are recorded whole under a layout
//! that names the row and the texel, so a diff says which texel of which sub-case moved. Every
//! byte compares exactly; the case's allowances are on the notices site alone, for the kinds the
//! runtime announces while it keeps a 4:2:2 texture's decoded twin beside the bytes it moves.
//! byte compares exactly; the case's allowances are on the notices site alone.
//!
//! [`ChromaTexels`] is the lane's texel table, over a 16 x 16 texture of the format holding the
//! lane's pattern, reached two ways through the owned fixture `fpv_swizzled_reads`:
@@ -45,11 +44,7 @@
//! sampling is the operation its feature tables grant it and a nearest sample at a centre is
//! defined to be that texel, while whether Metal defines `read()` for these formats is what the
//! recording answers rather than assumes. Comparison is exact and each case's allowances are on the
//! notices site alone: the runtime reaches these texels through the texture's decoded twin and
//! announces `carried-decoded-twin`, and where the device converts the format itself the twin holds
//! the device's own conversion and it announces `decoded-texel-precision` too. Metal announces
//! neither, and those notices are what justify the notices site differing. Every texel still
//! compares bit for bit.
//! notices site alone. Every texel compares bit for bit.
//!
//! # Why nothing here can fault a GPU
//!
@@ -65,10 +60,8 @@ use crate::case::{
made, Abort, Bindings, Case, Failure, Input, MetalSource, SamplerSpec, Side, TextureRole,
TextureSpec,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::replay::notice_allowance;
use crate::transcript::{ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites, Value};
use crate::work::{Plane, Rect, Resource, Step, TextureSpec as WorkTexture, Work};
use metal2vulkan::metal::{PixelFormat, SamplerAddressMode, SamplerMinMagFilter};
@@ -580,12 +573,8 @@ impl Case for ChromaCopies {
fn allowances(&self) -> Vec<Allowance> {
// Every byte of every read-back compares exactly; what differs is the notices site, which
// Metal records empty. A device whose own driver does not decode 4:2:2 texels as Metal
// does reaches them through the texture's decoded twin, decodes a host copy's rows on the
// CPU where it does not run a pass for them, and stages a copy between two such textures
// -- three kinds, each announced once per device. Each is named here, so the difference is
// justified only while that notice really fires; on a device that needs none of them, none
// of the three fires and the report counts them as unused.
// Metal records empty.
//
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -597,21 +586,7 @@ impl Case for ChromaCopies {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// A copy moves the carrier's bytes and reads no twin, so the twin's precision
// (`decoded-texel-precision`, announced at a command's first read of the twin) is not
// declared here.
std::iter::once(crate::replay::shared_memory_notice())
.chain(
[
Degradation::CarriedDecodedTwin,
Degradation::CpuBlockDecode,
Degradation::StagedTextureCopy,
]
.into_iter()
.map(|kind| notice_allowance(kind.code())),
)
.collect()
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -752,16 +727,9 @@ impl Case for ChromaTexels {
}
fn allowances(&self) -> Vec<Allowance> {
// On a device whose own driver does not decode these texels as Metal does, the runtime
// reads them through the texture's decoded twin and announces it once. Metal announces
// nothing, so the notices site differs and that notice is what justifies it; every texel
// still compares exactly. On a device that needs no twin the allowance simply does not
// fire, which the report counts.
// Every texel compares exactly; what differs is the notices site, which Metal records
// empty.
//
// The host copy that fills the texture (`replaceRegion`) is decoded on the CPU into that
// twin, which announces `cpu-block-decode` -- the same kind, for the same reason, that
// this file's blit case names. It is a declaration and not a tolerance: every texel the
// case reads still compares exactly.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -773,30 +741,7 @@ impl Case for ChromaTexels {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// Where the device converts the format itself with Metal's reconstruction, the twin holds
// the device's own Y′CbCr conversion of the pairs, its native answer (AGENTS.md rule 1):
// each chroma channel the nearest 8-bit code to the device's 3:1 sum of the pair's code
// and the code beside it, ties to even, where Metal's `(3 c + n + 2) >> 2` rounds them up.
// The runtime announces `decoded-texel-precision` at the case's read or sample, the
// twin's first. It is declared at the notices site alone and loosens no texel. Measured on the M3 Max
// (MoltenVK 1.4.2, which samples through Metal's own `GBGR422` and `BGRG422` texture
// unit): it fired for all 4 texel rows, and each was divergent on that field and nothing
// else, every texel Metal's bit for bit. The lane's pattern holds no tie to round: a
// pair's chroma code and the one beside it are 4 apart (mod 256), or equal at a row's
// clamped edge, so every `3 c + n` is a multiple of 4. Where the twin holds Metal's decode
// it does not fire, which the report counts.
std::iter::once(crate::replay::shared_memory_notice())
.chain(
[
Degradation::CarriedDecodedTwin,
Degradation::CpuBlockDecode,
Degradation::DecodedTexelPrecision,
]
.into_iter()
.map(|kind| notice_allowance(kind.code())),
)
.collect()
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -9,9 +9,9 @@
//! # The timings are the subject, and they are read as orderings
//!
//! Nothing in this tree held an implementation to the shape of `GPUStartTime`, `GPUEndTime`,
//! `kernelStartTime` and `kernelEndTime`. The runtime builds all four from its own clocks and
//! announces three different degradations over them, and the only thing watching was a lane
//! assertion that one of them eventually stops being zero. This case states the contract instead:
//! `kernelStartTime` and `kernelEndTime`. The runtime builds all four from its own clocks, and the
//! only thing watching was a lane assertion that one of them eventually stops being zero. This
//! case states the contract instead:
//! zero before the work, positive after, and each interval ordered, with the GPU's interval not
//! beginning or ending before the kernel's.
//!
@@ -37,33 +37,11 @@
use crate::allowance::Allowance;
use crate::case::{made, Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::replay::notice_allowance;
use crate::transcript::Sites;
/// The case's name.
pub const COMMAND_BUFFER_FACTS: &str = "command-buffer-facts";
/// The notices the runtime can announce over the GPU times, and the whole of what this case takes.
///
/// `UncalibratedGpuTimes` is here because a venue announces it. The RX 7900 XTX (RADV NAVI31)
/// announced it for this case on 2026-11-07: its calibrated timestamps placed each of the case's
/// two timed command buffers outside the command buffer's life
/// (`WorkCounts::calibration_disagreements` 2 in each of three `cost` runs). So the runtime
/// placed their times as it does on an uncalibrated device (`gpu_time.rs`), and every value of
/// the case still compared exactly. The Radeon 780M (RADV PHOENIX) in the same machine agreed
/// with its calibration in the same runs (0) and announced nothing.
///
/// `LooselyCalibratedGpuTimes` is here because a loaded host makes it: a calibration pair whose
/// readings each state the time the reading thread spent off the CPU stays beyond 20 us after
/// the runtime's four readings (the RX 7900 XTX stated 93 and 125 us in full parallel suites),
/// and its times, still inside the command buffer's life, are announced as such (`gpu_time.rs`).
const GPU_TIME_NOTICES: [Degradation; 3] = [
Degradation::GpuTimesFromHost,
Degradation::UncalibratedGpuTimes,
Degradation::LooselyCalibratedGpuTimes,
];
/// A case over one command buffer's own answers.
pub struct CommandBufferFactsCase {
name: &'static str,
@@ -109,17 +87,6 @@ impl Case for CommandBufferFactsCase {
}
fn allowances(&self) -> Vec<Allowance> {
// The runtime builds `GPUStartTime` and `GPUEndTime` from its own clocks and announces how
// on the venues that need it. The case takes the notice and compares every value exactly;
// what it may not do is take a different *number* because of one, and it does not.
// `GpuTimesFromHost`: the runtime answers the GPU times from the host clock where the
// driver's own timestamps wait for every queue's (MoltenVK on Apple's GPUs).
// `UncalibratedGpuTimes`: it places them without calibrated timestamps where the device
// offers none, or where the device's calibration disagrees with the command buffer's life
// (the RX 7900 XTX, `GPU_TIME_NOTICES`). `LooselyCalibratedGpuTimes`: it places them by a
// calibration a loaded host left beyond 20 us. The orderings this case compares do not
// depend on any of them, which is why the case can take the notice and still compare every
// value exactly.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -131,13 +98,7 @@ impl Case for CommandBufferFactsCase {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
std::iter::once(crate::replay::shared_memory_notice())
.chain(
GPU_TIME_NOTICES
.iter()
.map(|code| notice_allowance(code.code())),
)
.collect()
vec![crate::replay::shared_memory_notice()]
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
@@ -156,22 +117,22 @@ impl Case for CommandBufferFactsCase {
mod tests {
use super::*;
/// The case states its inputs, names itself once, and declares the three notices the runtime
/// can announce over the GPU times, the venue's own memory notice, and nothing else.
/// The case states its inputs, names itself once, declares the venue's own memory notice and
/// nothing else.
///
/// A fifth notice slipping in would be a value the case took for a reason nobody wrote down,
/// A second notice slipping in would be a value the case took for a reason nobody wrote down,
/// which is what this count is for.
#[test]
fn the_case_states_its_inputs_and_only_the_gpu_time_notices() {
fn the_case_states_its_inputs_and_only_the_venue_notice() {
let cases = all();
assert_eq!(cases.len(), 1);
let case = &cases[0];
assert_eq!(case.name(), COMMAND_BUFFER_FACTS);
assert!(!case.inputs().expect("the inputs").is_empty());
let allowed = case.allowances();
// The three GPU-time notices, and the one a card without unified memory announces for the
// `Shared` buffer the case reads its answer back through.
assert_eq!(allowed.len(), GPU_TIME_NOTICES.len() + 1);
// The one a card without unified memory announces for the `Shared` buffer the case reads
// its answer back through.
assert_eq!(allowed.len(), 1);
// And the case records more than one run, because two of its booleans read a clock.
assert!(case.record_runs() > 1);
}
@@ -1,16 +1,12 @@
//! Blits through a losslessly compressed texture, ported from `runtime_lane::compressed_blits`.
//! Blits through a losslessly compressed texture.
//!
//! Metal keeps a texture losslessly compressed where `allowGPUOptimizedContents` holds, the shorter
//! side of its level 0 is at least 16 texels, and its usage has neither `ShaderWrite` nor
//! `PixelFormatView`. A GPU blit that reads or writes such a texture moves its texels **through**
//! that compression, so for three families the bytes the blit writes are not the bytes it read:
//! the same value in its canonical encoding. The runtime's answer is the device's copy, which keeps
//! the bytes, announced by the note of the encoding it keeps (`compressed_blit.rs`): where the
//! device's own copy of the compressed image is not Metal's blit, those sites are `known-gaps.tsv`
//! rows that name the note. `BGRA10_XR` and its sRGB twin have an exact form: under the suite's
//! `Policy::Exact` (`ExtendedRangeBlitPolicy::Canonical`) the runtime writes Metal's encoding, so
//! their sites hold Metal's bytes and announce nothing; their note's declaration covers a
//! `--default-policy` run, where the device's copy keeps the bytes.
//! the bytes, announced by the note of the encoding it keeps where the format has one
//! ([`kept_encoding_notice`]).
//!
//! Record mode runs the whole program on this M3 Max, because every call it makes is public Metal:
//! a texture of any descriptor, a texture over a buffer, the blit copies, `replaceRegion:` and
@@ -70,11 +66,11 @@ const OVER_PAST: u64 = 256;
/// One format whose blits through the compression change bytes: the case's name, the raw
/// `MTLPixelFormat`, and the note a blit through it announces where the device's copy keeps the
/// bytes.
/// bytes, where it announces one.
struct Format {
name: &'static str,
format: PixelFormat,
note: Degradation,
note: Option<Degradation>,
}
/// Every format whose blits through the compression change bytes.
@@ -82,22 +78,22 @@ const FORMATS: [Format; 4] = [
Format {
name: "compressed-blits-bgra10xr",
format: PixelFormat::BGRA10XR,
note: Degradation::ExtendedRangeBitsKept,
note: None,
},
Format {
name: "compressed-blits-bgra10xr-srgb",
format: PixelFormat::BGRA10XRSRGB,
note: Degradation::ExtendedRangeBitsKept,
note: None,
},
Format {
name: "compressed-blits-rg11b10f",
format: PixelFormat::RG11B10Float,
note: Degradation::DeviceNanEncoding,
note: Some(Degradation::DeviceNanEncoding),
},
Format {
name: "compressed-blits-rgb9e5f",
format: PixelFormat::RGB9E5Float,
note: Degradation::SharedExponentKept,
note: Some(Degradation::SharedExponentKept),
},
];
@@ -114,19 +110,17 @@ const COMPRESSED_SITES: [&str; 7] = [
];
/// The declaration of the note a blit through a texture of the raw `MTLPixelFormat` `format` that
/// Metal keeps losslessly compressed announces (the runtime's `compressed_blit.rs`: the device's
/// copy keeps the bytes Metal's compression rewrites), where that note is not one of the device's
/// native notes the suite declares for every case (`crate::replay::NATIVE_NOTES`):
/// `extended-range-bits-kept` for `BGRA10_XR` and its sRGB twin, `shared-exponent-kept` for
/// Metal keeps losslessly compressed announces (the device's copy keeps the bytes Metal's
/// compression rewrites), where that note is not one of the device's native notes the suite
/// declares for every case (`crate::replay::NATIVE_NOTES`): `shared-exponent-kept` for
/// `RGB9E5Float`. Every case whose program blits through such a texture declares it, at the
/// notices site alone: each value still compares against Metal's. Under `Policy::Exact` the
/// `BGRA10_XR` formats' note does not fire (`ExtendedRangeBlitPolicy::Canonical` writes Metal's
/// encoding), and the report counts its declaration as unfired.
/// notices site alone: each value still compares against Metal's. A `BGRA10_XR` format has no
/// such note.
pub(crate) fn kept_encoding_notice(format: u32) -> Option<Allowance> {
FORMATS
.iter()
.find(|f| f.format.as_raw() == format)
.map(|f| f.note)
.and_then(|f| f.note)
.filter(|note| !crate::replay::NATIVE_NOTES.contains(note))
.map(|note| crate::replay::notice_allowance(note.code()))
}
@@ -620,41 +614,9 @@ impl Case for CompressedBlits {
}
fn allowances(&self) -> Vec<Allowance> {
// Our side's padded copies go through a tightly packed scratch buffer, a performance
// notice the runtime announces once per device, and one that leaves the bytes exactly
// Metal's: the only site loosened is the set of notices, which Metal holds empty, and the
// allowance fails the case if the notice did not fire.
// Every byte of all four rows compares exactly with Metal's; the declarations cover the
// notices site alone.
//
// `shadowed-texture`, which every row of this family announces: its texture over a buffer
// reaches the buffer's bytes through a shadow image rather than an image aliasing them.
//
// This comment used to leave the code undeclared and the rows divergent on purpose, on the
// grounds that naming an unexamined mechanism makes a permanent excuse of it, and it asked
// whoever took it to decide whether a shadow image is the right answer for these formats
// and then declare or change the runtime. The decision, and what it rests on:
//
// It is the right answer, because there is no other exact one. A texture over a buffer
// aliases the buffer's bytes with a linear image where the device can make one
// (`texture.rs`, `alias_image`); where it cannot, the only remaining way to reach those
// bytes exactly is to copy them into an image and back, which is this notice. These four
// are the formats the device makes no linear image of -- `BGRA10XR`, its sRGB twin,
// `RG11B10Float` and `RGB9E5Float`, whose linear tiling the device does not list
// (`linear_lack`) -- and Metal makes a texture over a buffer in all four, so refusing them
// is not open to us either. A cheaper exact form would have to come from the device
// gaining linear tiling for the format, not from a choice of ours.
//
// It is also the answer the suite has already made for this mechanism, not a new one: five
// cases across four other families declare `shadowed-texture` for a texture whose bytes no
// image can alias -- `two-plane-row-blits`, `texture-fills-heap-run-550-b5` and `-551-b5`,
// `surface-fills-over-planes-and-buffers`, and `buffer-texture-blits-to-and-from`. Leaving
// these four undeclared made them divergent at `case/notices` on every run while the same
// code was justified elsewhere, which is noise rather than an open question.
//
// It loosens no value. Every byte of all four rows compares exactly with Metal's; the whole
// difference the declaration covers is the announcement, which Metal holds empty because
// the copy is not a thing Metal has to do. Measured announced by all four rows on Apple
// M3 Max in the whole-set run this declaration was taken from; the earlier reading recorded
// the same code on lavapipe.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -668,11 +630,7 @@ impl Case for CompressedBlits {
// recording of this suite declares it.
//
// The note of the encoding the device's copy keeps ([`kept_encoding_notice`]).
let mut allowances = vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::StagedTextureCopy.code()),
crate::replay::notice_allowance(Degradation::ShadowedTexture.code()),
];
let mut allowances = vec![crate::replay::shared_memory_notice()];
allowances.extend(kept_encoding_notice(self.format().format.as_raw()));
// On a venue that presents no texture compression no texture is compressed: Metal's own
// uncompressed texture keeps its bytes through every blit, so each site a blit reaches
@@ -734,9 +692,9 @@ mod tests {
assert_eq!(named.len(), FORMATS.len());
}
/// Every case of the family declares exactly the notice codes it announces: the same three
/// for every format, because every row reaches its bytes the same way, and the note of the
/// encoding its blits keep where that note is not a native one the suite declares itself.
/// Every case of the family declares exactly the notice codes it announces: the venue's own
/// for every format, and the note of the encoding its blits keep where it has one that is not
/// a native one the suite declares itself.
///
/// Stated as the whole set rather than as "the codes are present", because a declaration fires
/// on its own code: a code announced and declared nowhere is a divergence at the notices site,
@@ -750,11 +708,9 @@ mod tests {
// The venue's own: a card without unified memory holds the `Shared` buffer each
// row reads its answer back through in system memory.
Degradation::SharedInSystemMemory.code().to_owned(),
Degradation::StagedTextureCopy.code().to_owned(),
Degradation::ShadowedTexture.code().to_owned(),
];
let note = case.format().note;
if !crate::replay::NATIVE_NOTES.contains(&note) {
if let Some(note) = note.filter(|note| !crate::replay::NATIVE_NOTES.contains(note)) {
wanted.push(note.code().to_owned());
}
let allowances = case.allowances();
@@ -106,7 +106,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -483,20 +482,12 @@ impl Case for DepthFilters {
fn allowances(&self) -> Vec<Allowance> {
// No value is loosened: every resolved depth Metal leaves is a depth we must leave. What is
// declared is the notice set, because a device without a `MIN` or `MAX` depth resolve mode
// reaches Metal's answer through a draw after the pass rather than through the store, and
// the runtime announces that. On MoltenVK the modes are the device's and nothing fires; on
// a device that lacks them the notice is what says the exact path ran.
// One more, a declaration at the notices site that touches no resolved depth: a device
// declared is a notice at the notices site that touches no resolved depth: a device
// without unified memory holds the `Shared` buffer each row reads its answer back through
// in system memory (`crate::replay::shared_memory_notice`). Measured on the RTX 5080
// Laptop (615.71.09), where both rows announced it with the case declaring it nowhere
// (replay-nvidia.log).
vec![
crate::replay::notice_allowance(Degradation::ShaderResolve.code()),
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
crate::replay::shared_memory_notice(),
]
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -116,7 +116,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -977,15 +976,7 @@ impl Case for DepthCompares {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// `dont-care-store` with it: a pass whose depth attachment is `DontCare` on store is kept
// by our side where Metal may drop it. Announced by this row on the 5080 **and** on
// llvmpipe (Mesa 26.2.4) with the case declaring it nowhere; a declaration only, so the
// texels stay strict.
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
]
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1181,17 +1172,7 @@ impl Case for DepthCodes {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// One more, a declaration: a `DontCare` depth store our side keeps where Metal may drop
// it (`dont-care-store`, announced by this row on the 5080 and on llvmpipe, Mesa 26.2.4,
// with the case declaring it nowhere). It loosens no depth code. A normalized depth the
// device converts where it is not measured to store Metal's code
// (`unorm-depth-rounding`) is the device's own answer, which the suite declares for every
// case (`crate::replay::NATIVE_NOTES`).
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
]
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1719,17 +1700,8 @@ const MATRIX_ROW: u32 = 3;
///
/// **This is the one case of the module whose pass attaches a depth and a stencil as two separate
/// textures**, which is the shape Metal takes (a `Depth32Float` beside a `Stencil8`, of identical
/// dimensions, which its validation requires) and which a Vulkan subpass has no counterpart for:
/// the runtime renders such a pass into a scratch image of the combined format and copies each
/// aspect in and out. Nothing else in the suite compares that path against Metal.
///
/// Measured on an Apple M3 Max (macOS 27.0.1, MoltenVK): **every value the case reads is Metal's
/// own**, and the one difference is that our side announces
/// `metal2vulkan-degrade-separate-depth-stencil`, which the case therefore names. That notice is a
/// `Performance` degradation -- Metal's answer at a cost Metal does not pay, the two copies a
/// single-sampled aspect takes through a staging buffer -- so the values stay exact and nothing but
/// the notice site is loosened. The allowance fails the case if the notice stops firing, so it
/// cannot outlive its reason.
/// dimensions, which its validation requires). Nothing else in the suite compares that shape
/// against Metal.
pub struct DepthSlot;
impl DepthSlot {
@@ -1949,10 +1921,9 @@ impl Case for DepthSlot {
}
fn allowances(&self) -> Vec<Allowance> {
// Only the notice set is loosened. A pass whose depth and stencil attachments are two
// textures renders through a scratch image of the combined format, which the runtime
// announces; it is a `Performance` degradation, so it buys the copies and not the answer,
// and every texel and every stencil byte of this case still compares exactly.
// Only the notice set is loosened: every texel and every stencil byte of this case
// compares exactly.
//
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -1964,10 +1935,7 @@ impl Case for DepthSlot {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::SeparateDepthStencil.code()),
]
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -2911,10 +2879,7 @@ mod tests {
case.name()
);
}
// Every row declares the venue's memory notice. Three declare more: the depth-slot row
// the separate depth and stencil attachments it is the only case to take, and the two
// depth rows what a driver that is not Metal announced for their `DontCare` store (their
// normalized depth is the device's own answer, the suite's to declare).
// Every row declares the venue's memory notice, and nothing else.
let named: std::collections::BTreeSet<&str> = allowed
.iter()
.filter_map(|allowance| match &allowance.justified_by {
@@ -2923,17 +2888,11 @@ mod tests {
})
.collect();
assert!(
named.contains(Degradation::SharedInSystemMemory.code()),
named.contains(crate::degradation::Degradation::SharedInSystemMemory.code()),
"{}",
case.name()
);
let wanted: usize = match case.name() {
name if name == DepthSlot.name() => 2,
"depthstencil-depth-compares" => 2,
"depthstencil-depth-codes" => 2,
_ => 1,
};
assert_eq!(named.len(), wanted, "{}", case.name());
assert_eq!(named.len(), 1, "{}", case.name());
}
// The six programs between them attach every combination the family needs: depth alone,
// stencil alone, and the two together as separate textures.
@@ -18,11 +18,8 @@
//! no loop, no mapping; every status a handler reads is sent on a channel read with a bound, and
//! every wait is for work that ends on its own.
use crate::allowance::Allowance;
use crate::case::{Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::empty_command_buffers::{EMPTY, FILL, FILL_BYTES};
use crate::replay::notice_allowance;
use crate::transcript::{Node, Observed, Sites};
/// The case's name.
@@ -65,25 +62,6 @@ impl Case for EmptyCommandBuffersCase {
5
}
fn allowances(&self) -> Vec<Allowance> {
// `GpuTimesFromHost`: the runtime answers the fill's GPU times from the host clock where
// the driver's own timestamps wait for every queue's (MoltenVK on Apple's GPUs), and says
// so once. `UncalibratedGpuTimes`: it places them without the device's calibration where
// that calibration disagrees with the command buffer's life (`gpu_time.rs`). The RX 7900
// XTX (RADV NAVI31) announced that on 2026-11-07, where its calibrated pair placed the
// fill outside its life (`WorkCounts::calibration_disagreements` 1 in each of three `cost`
// runs); the Radeon 780M in the same machine agreed with its calibration (0). The orderings
// this case compares hold for every source, so every value still compares exactly; the
// notice site alone takes each notice. `LooselyCalibratedGpuTimes`: it places them by a
// calibration pair a loaded host left beyond 20 us after its four readings, inside the
// command buffer's life (`gpu_time.rs`).
vec![
notice_allowance(Degradation::GpuTimesFromHost.code()),
notice_allowance(Degradation::UncalibratedGpuTimes.code()),
notice_allowance(Degradation::LooselyCalibratedGpuTimes.code()),
]
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
match side.empty_command_buffers() {
Ok(facts) => sites.push(facts.node(AT)),
@@ -98,16 +76,16 @@ impl Case for EmptyCommandBuffersCase {
mod tests {
use super::*;
/// The case states its inputs, names itself once, takes the three GPU-time notices alone, and
/// records more than one run.
/// The case states its inputs, names itself once, takes no allowance, and records more than
/// one run.
#[test]
fn the_case_states_its_inputs_and_only_the_gpu_time_notices() {
fn the_case_states_its_inputs_and_takes_no_allowance() {
let cases = all();
assert_eq!(cases.len(), 1);
let case = &cases[0];
assert_eq!(case.name(), EMPTY_COMMAND_BUFFERS);
assert!(!case.inputs().expect("the inputs").is_empty());
assert_eq!(case.allowances().len(), 3);
assert!(case.allowances().is_empty());
assert!(case.record_runs() > 1);
}
}
@@ -54,7 +54,7 @@
//! Nothing here can fault a GPU: one compute pass a read, one read-only texture, one buffer, one
//! thread a texel inside the texture, no loop and no sampling.
use crate::allowance::{Allowance, Justification, Loosening};
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Bindings, Case, Failure, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
@@ -89,15 +89,6 @@ const BLOCKS: u32 = SIDE / 4;
/// texture of its own, so a diff names which blocks moved.
const ROUNDS: [&str; 2] = ["zero-blocks", "seeded-blocks"];
/// The most a compact unsigned 11-bit texel may be off Metal's value: half a 16-bit step, as the
/// `decoded-texel-precision` notice states it (docs/API.md). It is the notice's number, so a run
/// that exceeds it fails rather than being re-fitted to whatever a device answers.
const LEDGERS_UNSIGNED_BOUND: f64 = 1.0 / 131_070.0;
/// The same for a signed 11-bit texel, whose twin holds a 16-bit **signed** normalized code, so
/// half a step is twice as wide ([`LEDGERS_UNSIGNED_BOUND`]).
const LEDGERS_SIGNED_BOUND: f64 = 1.0 / 65_534.0;
/// One format the lane reads: the case's name and the `MTLPixelFormat`. How its blocks decode and
/// whether its colour is sRGB follow from the format ([`EtcDecode::of`], [`srgb_raw_twin`]), so
/// there is no second spelling of either to keep in step.
@@ -257,18 +248,6 @@ impl EtcTextures {
TextureRequest::read_2d(self.format().format.as_raw(), SIDE, SIDE).loaded(uploads)
}
/// How far a compact texel of this format may be off Metal's value, where that is not zero:
/// an EAC 11-bit channel's half 16-bit step, by the format's own signedness. `None` for the
/// 8-bit formats, whose twin holds its codes exactly under either value, so they name no
/// tolerance.
fn compact_bound(&self) -> Option<f64> {
match self.format().format {
PixelFormat::EACR11Snorm | PixelFormat::EACRG11Snorm => Some(LEDGERS_SIGNED_BOUND),
PixelFormat::EACR11Unorm | PixelFormat::EACRG11Unorm => Some(LEDGERS_UNSIGNED_BOUND),
_ => None,
}
}
/// The layout a round's texels read back under: one row of the layout per row of texels, four
/// `float` channels a texel, so a diff names the texel and the channel rather than an offset.
fn layout() -> ByteLayout {
@@ -304,16 +283,6 @@ impl Case for EtcTextures {
}
fn allowances(&self) -> Vec<Allowance> {
// A device with no ETC2 format keeps the blocks in a carrier image and reads them through
// a decoded twin, which the runtime announces once per device. Metal announces nothing, so
// the notice has to be declared by its code or the comparison cannot be made at all. The
// declaration loosens no value: the only site it covers is the set of notices, which Metal
// holds empty, and it fails the case if the notice did not fire.
// A CPU copy that fills such a texture (`replaceRegion`) is decoded on the CPU into that
// twin and copied in, announced as `cpu-block-decode`: the host-copy arm of the very
// mechanism the line above names, measured on lavapipe for every format of this family. It
// is a declaration and not a tolerance -- every texel the case reads still compares
// exactly with Metal.
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -329,34 +298,10 @@ impl Case for EtcTextures {
// an image of it and reads the device's decode of them, the static note it announces as
// `compressed-texel-decode` for every block-compressed texture it makes. A declaration
// and not a tolerance: no ETC2 or EAC bound is stated, so every texel still compares exactly.
let mut all = vec![
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::CarriedDecodedTwin.code()),
crate::replay::notice_allowance(Degradation::CpuBlockDecode.code()),
crate::replay::notice_allowance(Degradation::CompressedTexelDecode.code()),
];
// An 8-bit format's twin holds Metal's own codes, and the `float` the function answers is
// the **device's** conversion of a code (`device-texel-conversion`; lavapipe multiplies by
// the reciprocal) or its sRGB decode (`srgb-texel-decode`): native notes the suite
// declares for every case, which loosen no texel.
//
// An EAC 11-bit format's compact twin holds the 16-bit normalized code nearest Metal's
// value, which the runtime announces as `decoded-texel-precision`, whose catalogue entry
// bounds it at half a 16-bit step. The bound here is the notice's number for this
// format's signedness, so a run that exceeds it is the notice's claim failing.
if let Some(bound) = self.compact_bound() {
all.push(crate::replay::notice_allowance(
Degradation::DecodedTexelPrecision.code(),
));
for round in ROUNDS {
all.push(Allowance::new(
format!("case/{round}/texels"),
Loosening::Absolute(bound),
Justification::notice(Degradation::DecodedTexelPrecision),
));
}
}
all
]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -530,70 +475,23 @@ mod tests {
}
}
/// Each format loosens the texel its own notice's bound names, and nothing else.
/// No format loosens a texel.
///
/// This is the ruling that a notice declaration is not a tolerance, held as a test: the
/// `carried-decoded-twin` declaration is on every case and loosens no value, while an
/// allowance that loosens a texel is named only where the emulation's own precision stands
/// between Metal's value and the twin's code. Two groups, each format named in its own, so a
/// format moving between them fails here:
///
/// - the six **8-bit** formats, linear and sRGB, whose twin holds Metal's codes and whose
/// value is the device's conversion or decode of them, a native note that loosens no value:
/// **nothing at all**;
/// - the four EAC **11-bit** formats, read from a compact 16-bit twin: half a 16-bit step by
/// the format's signedness.
/// `compressed-texel-decode` declaration is on every case and loosens no value, and no ETC2 or
/// EAC bound is stated, so every texel of every format compares exactly.
#[test]
fn each_format_loosens_the_texel_its_ledger_row_names() {
let mut loosened = Vec::new();
let mut exact = Vec::new();
fn no_format_loosens_a_texel() {
for (at, format) in FORMATS.iter().enumerate() {
let case = EtcTextures { at };
let bounds: Vec<Loosening> = case
let loosened: Vec<String> = case
.allowances()
.into_iter()
.filter(|allowance| allowance.path.ends_with("/texels"))
.map(|allowance| allowance.loosening)
.map(|allowance| allowance.path)
.collect();
let decode = case.decode();
if !decode.eleven_bit() {
assert!(bounds.is_empty(), "{}: {bounds:?}", format.name);
exact.push(format.name);
continue;
}
let signed = matches!(decode, EtcDecode::R11Snorm | EtcDecode::Rg11Snorm);
let bound = match signed {
true => LEDGERS_SIGNED_BOUND,
false => LEDGERS_UNSIGNED_BOUND,
};
assert_eq!(
bounds,
vec![Loosening::Absolute(bound); ROUNDS.len()],
"{}",
format.name
);
loosened.push(format.name);
assert!(loosened.is_empty(), "{}: {loosened:?}", format.name);
}
assert_eq!(
exact,
[
"etc2-rgb8",
"etc2-rgb8-srgb",
"etc2-rgb8a1",
"etc2-rgb8a1-srgb",
"eac-rgba8",
"eac-rgba8-srgb"
]
);
assert_eq!(
loosened,
[
"eac-r11-unorm",
"eac-r11-snorm",
"eac-rg11-unorm",
"eac-rg11-snorm"
]
);
}
/// A round's texels as a transcript, every channel the `f32` word `word`.
@@ -241,21 +241,11 @@ impl Case for ExtendedRangeBlend {
// what this M3 Max and lavapipe both show -- and one that does not shows the code. The
// allowance fails the case if the notice stops firing, so it cannot outlive its reason.
//
// The pass loads and stores an extended-range colour attachment, so its draw announces
// `extended-range-bits-kept`: the device's store keeps the bits the codes leave unused in
// the texels the draw does not write, where Metal's pass makes them canonical. The
// difference it names cannot reach this case: the draw is one full-screen triangle over
// the whole 128 x 64 target under every channel, so it writes every texel, and every
// stored code compares exactly. So this is a declaration of what our side announced and
// not a tolerance -- no code is loosened.
//
// The function blends the `half4` fill into the extended-range target in the shader, in
// the device's arithmetic, so every row announces `extended-range-blend-source`, a native
// note the suite declares for every case (`crate::replay::NATIVE_NOTES`); the codes still
// compare exactly, and a site the device's arithmetic moves is a known gap.
// `extended-range-blends-stored-codes` is deliberately **not** named here: it fired on no
// venue, and an allowance no run justified is a claim without evidence. A venue that
// needs it adds it with the run that shows it.
//
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -267,16 +257,10 @@ impl Case for ExtendedRangeBlend {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
std::iter::once(crate::replay::shared_memory_notice())
.chain(
[
Degradation::HalfOutputFastMathBlend,
Degradation::ExtendedRangeBitsKept,
]
.into_iter()
.map(|kind| crate::replay::notice_allowance(kind.code())),
)
.collect()
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::HalfOutputFastMathBlend.code()),
]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -149,26 +149,13 @@ fn fill(pipeline: Handle, values: Handle, extent: Handle) -> [RenderStep; 4] {
/// The notices every case of the family may announce, each with the reason it cannot loosen a
/// code: `shared-in-system-memory` (the read-back buffer is `Shared`; a device without unified
/// memory announces it), the kept encoding of a blit through a `BGRA10_XR` texture Metal keeps
/// compressed (a draw stores canonical codes, so the blit moves the same bytes either way),
/// `half-output-fast-math-blend` (the fixture is a fast-math module whose `half4` fill a pipeline
/// stores), and `extended-range-bits-kept` (a draw in a pass over such a color; every texel here is
/// written by a Metal write first, so its bytes are canonical). Every value still compares
/// exactly.
fn notices(format: &Format) -> Vec<Allowance> {
let mut named = vec![crate::replay::shared_memory_notice()];
named.extend(super::compressed_blits::kept_encoding_notice(
format.format.as_raw(),
));
named.extend(
[
Degradation::HalfOutputFastMathBlend,
Degradation::ExtendedRangeBitsKept,
]
.into_iter()
.map(|kind| crate::replay::notice_allowance(kind.code())),
);
named
/// memory announces it) and `half-output-fast-math-blend` (the fixture is a fast-math module whose
/// `half4` fill a pipeline stores). Every value still compares exactly.
fn notices() -> Vec<Allowance> {
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::HalfOutputFastMathBlend.code()),
]
}
/// Read `target` (one sample, `format`) back into a buffer after `work`, and record its texels.
@@ -327,41 +314,9 @@ impl Case for GamutDraw {
MetalSource::Run
}
/// Beside the family's notices, `extended-range-blends-stored-codes` (the second draw blends
/// over the codes the first stored, where Metal's tile holds `half`s through the pass, on a
/// device whose passes hold no `half` shadow, `framebuffer_fetch::holds_extended_shadows`:
/// each venue of the suite holds it, in the pixel interlock or, on lavapipe, beside the input
/// attachment), and at four samples what the pass's shape announces: `shader-resolve` and
/// `extended-range-resolve` (no device's resolve averages the codes, so the runtime's own
/// resolve does, `BGRA10_XR`'s alpha and an sRGB twin's color from the codes where Metal
/// averages finer values), `dont-care-store` (the multisampled attachment of
/// `MultisampleResolve`, and the depth and stencil stored `DontCare`, on a driver measured to
/// keep one of Metal's answers), and on a device without multisampled storage images
/// `sample-planes` and `fetch-through-scratch` (the interlocked blend reads and writes the
/// samples as planes, through a scratch image the target's usage needs). And
/// `render-pass-split` (`crate::replay::interlocked_split_notice`): the second draw blends in
/// the pixel interlock over what the first wrote there. None loosens a code: every texel still
/// compares exactly.
/// The family's notices, and nothing else: every texel compares exactly.
fn allowances(&self) -> Vec<Allowance> {
let mut named = notices(&self.format);
named.push(crate::replay::notice_allowance(
Degradation::ExtendedRangeBlendsStoredCodes.code(),
));
named.push(crate::replay::interlocked_split_notice());
if self.samples > 1 {
named.extend(
[
Degradation::ShaderResolve,
Degradation::ExtendedRangeResolve,
Degradation::DontCareStore,
Degradation::SamplePlanes,
Degradation::FetchThroughScratch,
]
.into_iter()
.map(|kind| crate::replay::notice_allowance(kind.code())),
);
}
named
notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -577,17 +532,9 @@ impl Case for UnwrittenDraw {
MetalSource::Run
}
/// Beside the family's notices, for the pipeline that writes depth alone, `dont-care-store`:
/// the pass stores its depth `DontCare`, which a driver measured to keep one of Metal's
/// answers (lavapipe) leaves to the device. It loosens no code.
/// The family's notices, and nothing else: every texel compares exactly.
fn allowances(&self) -> Vec<Allowance> {
let mut named = notices(&self.format);
if self.shape == Unwritten::DepthOnly {
named.push(crate::replay::notice_allowance(
Degradation::DontCareStore.code(),
));
}
named
notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -788,27 +735,9 @@ impl Case for MaskedDraw {
MetalSource::Run
}
/// Beside the family's notices, for the blended write, `extended-range-blends-stored-codes`:
/// it blends over the codes the first draw stored on a device whose passes hold no `half`
/// shadow (`framebuffer_fetch::holds_extended_shadows`); on lavapipe the shadow is held beside
/// the input attachment. And `render-pass-split` (`crate::replay::interlocked_split_notice`):
/// a blended write, and a masked one into `BGR10_XR`'s shared word, reads and writes in the
/// pixel interlock what the first draw wrote there. It loosens no code.
/// The family's notices, and nothing else: every texel compares exactly.
fn allowances(&self) -> Vec<Allowance> {
let mut named = notices(&self.format);
if self.blend.is_some() {
named.push(crate::replay::notice_allowance(
Degradation::ExtendedRangeBlendsStoredCodes.code(),
));
}
let shared_word = matches!(
self.format.format,
PixelFormat::BGR10XR | PixelFormat::BGR10XRSRGB
);
if self.blend.is_some() || shared_word {
named.push(crate::replay::interlocked_split_notice());
}
named
notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -243,50 +243,13 @@ impl Case for GradientDraw {
/// The notices a draw into such a target may announce, none of which loosens a code (every
/// texel still compares exactly): `shared-in-system-memory` (the read-back buffer is `Shared`;
/// a device without unified memory announces it), the kept encoding of a blit through a
/// `BGRA10_XR` texture Metal keeps compressed (a draw stores canonical codes, so the blit
/// moves the same bytes either way), `half-output-fast-math-blend` (the fixture is a
/// fast-math module whose `half4` gradient a pipeline blends), `extended-range-bits-kept` (a
/// draw in a pass over such a color; every texel is written by a clear or a draw first), and
/// `extended-range-blends-stored-codes` (the second draw blends over the first's color where
/// the pass cannot hold its `half` shadow). At four samples, what the pass's shape announces:
/// `shader-resolve` and `extended-range-resolve` (the runtime's own resolve averages the
/// codes), `dont-care-store` (the multisampled attachment of `MultisampleResolve`, on a driver
/// measured to keep one of Metal's answers), and on a device without multisampled storage
/// images `sample-planes` and `fetch-through-scratch` (the interlocked blend reads and writes
/// the samples as planes, through a scratch image the target's usage needs). A blended row also
/// declares `render-pass-split` (`crate::replay::interlocked_split_notice`): its second draw
/// blends in the pixel interlock over what the first wrote there.
/// a device without unified memory announces it) and `half-output-fast-math-blend` (the
/// fixture is a fast-math module whose `half4` gradient a pipeline blends).
fn allowances(&self) -> Vec<Allowance> {
let mut named = vec![crate::replay::shared_memory_notice()];
named.extend(super::compressed_blits::kept_encoding_notice(
self.format.format.as_raw(),
));
let mut kinds = vec![
Degradation::HalfOutputFastMathBlend,
Degradation::ExtendedRangeBitsKept,
];
if self.blended {
kinds.push(Degradation::ExtendedRangeBlendsStoredCodes);
}
if self.samples > 1 {
kinds.extend([
Degradation::ShaderResolve,
Degradation::ExtendedRangeResolve,
Degradation::DontCareStore,
Degradation::SamplePlanes,
Degradation::FetchThroughScratch,
]);
}
named.extend(
kinds
.into_iter()
.map(|kind| crate::replay::notice_allowance(kind.code())),
);
if self.blended {
named.push(crate::replay::interlocked_split_notice());
}
named
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::HalfOutputFastMathBlend.code()),
]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -605,15 +605,6 @@ impl Case for TargetDraw {
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
let mut named = vec![crate::replay::shared_memory_notice()];
// A copying format's target is read back by a blit, through the compression Metal keeps
// a `BGRA10_XR` texture in: the note of the encoding the device's copy keeps
// (`compressed_blits::kept_encoding_notice`). The draw stores each field in its canonical
// encoding, so every value still compares exactly.
if self.format.copies {
named.extend(super::compressed_blits::kept_encoding_notice(
self.format.format.as_raw(),
));
}
if !self.half {
return named;
}
@@ -1062,13 +1053,7 @@ impl Case for ClearRoutes {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// The shapes Metal keeps compressed are read back by a blit through that compression:
// the note of the encoding the device's copy keeps, as the draws declare it.
let mut named = vec![crate::replay::shared_memory_notice()];
named.extend(super::compressed_blits::kept_encoding_notice(
self.format.format.as_raw(),
));
// On a venue that presents no texture compression the blit that reads `plain-16` back,
// through the texture the recording's Mac compressed, keeps the device's encoding where
// the recording holds the compressor's canonical one, and the runtime rewrites none
@@ -363,15 +363,7 @@ impl Case for ExtendedSwizzles {
/// arithmetic of that filter (`bicubic-filter-arithmetic`).
///
/// Each op reads every lane of its sweep in one dispatch, in groups of at most 64 threads, and
/// no lane count here is a whole number of such groups. That shape used to make our side run
/// the interior and the partial edge as dispatches of their own, announcing
/// `metal2vulkan-degrade-split-dispatch`, and the family declared the code for it. It does not
/// any more: a ragged `dispatchThreads:` on a kernel that cannot observe its threadgroup
/// partition runs as Metal's single dispatch, and `Degradation::SplitDispatch` fires on more
/// than one region. Measured on this M3 Max, 8 runs of the whole 1,103-case set: every row of
/// this family announced no notice at all, where the recordings taken before that landing hold
/// `metal2vulkan-degrade-split-dispatch` in their cost record's `degraded` set. So the
/// declaration is gone, and a split here reads as an undeclared notice at once.
/// no lane count here is a whole number of such groups.
///
/// The loosening that is left reaches `case/notices/*` alone. Every texel this family records
/// is still compared bit for bit, which is the point of the family: a swizzle moves channels
@@ -253,14 +253,10 @@ impl Case for FetchOrdered {
}
fn allowances(&self) -> Vec<Allowance> {
// Both loosen the **notice set** alone: how a venue reaches the attachment is a route,
// and a route that costs more announces itself. Reading it through the pixel interlock may
// mean rendering the pass into a scratch image (`fetch-through-scratch`, MoltenVK here), a
// performance notice, so it says nothing about the texels -- every byte still compares
// exactly, which is the owner's rule for this family: if Metal allows it we must allow it,
// so a byte that differs is a bug and a refusal is a bug, and neither gets a tolerance
// here. A venue that reads through an input attachment announces no route at all, so the
// declaration is reported as having fired on no venue of that run, which is honest.
// Every declaration loosens the **notice set** alone: every byte still compares exactly,
// which is the owner's rule for this family: if Metal allows it we must allow it, so a
// byte that differs is a bug and a refusal is a bug, and neither gets a tolerance here.
//
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -273,22 +269,15 @@ impl Case for FetchOrdered {
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// Every row fetches in the pixel interlock draw after draw, so on a driver whose such draws
// race under load each draw after the first begins a render pass instance of its own
// (`crate::replay::interlocked_split_notice` holds the reason and the run it rests on).
//
// A venue with neither ordered fetch form (no rasterization-order attachment access, no
// pixel interlock) reads the input attachment ordered between draws alone and announces
// `unordered-fetch-within-draw`, a precision note of what it leaves unordered: overlapping
// fragments of one draw. Each draw here is one fullscreen triangle, which overlaps itself
// nowhere, so every byte still compares exactly.
std::iter::once(crate::replay::shared_memory_notice())
.chain([
crate::replay::notice_allowance(Degradation::FetchThroughScratch.code()),
crate::replay::interlocked_split_notice(),
crate::replay::notice_allowance(Degradation::UnorderedFetchWithinDraw.code()),
])
.collect()
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::UnorderedFetchWithinDraw.code()),
]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -314,20 +314,7 @@ impl Case for FormatCopies {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// A `Depth32Float` side's words reach its depth image by an upload, which a device without
// `VK_EXT_depth_range_unrestricted` (MoltenVK on the M3 Max, ANV) clamps into [0, 1] and
// announces (`restricted-depth-upload`). Every word this family moves lies in [0, 1], so
// the clamp leaves it as it is: measured on the M3 Max, the notices site is the whole of
// the difference of each of the six rows with a depth side.
let mut allowances = vec![crate::replay::shared_memory_notice()];
let pair = self.pair();
if pair.from == PixelFormat::Depth32Float || pair.to == PixelFormat::Depth32Float {
allowances.push(crate::replay::notice_allowance(
crate::degradation::Degradation::RestrictedDepthUpload.code(),
));
}
allowances
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -165,10 +165,8 @@
use crate::allowance::{Allowance, Justification, Loosening};
use crate::case::{Abort, Case, Input, MetalSource, Side, TextureRole, TextureSpec};
use crate::degradation::Degradation;
use crate::texture_query::{HeapTextureQuery as Q, Storage};
use crate::transcript::{Aspect, ByteLayout, Element, Gaps, Node, Observed, Region, Sites, Value};
use metal2vulkan::bind::AstcDecode;
use metal2vulkan::metal::{PixelFormat, TextureType};
/// The two storage modes every case of the family sweeps.
@@ -572,29 +570,10 @@ impl Case for FootprintCase {
}
fn allowances(&self) -> Vec<Allowance> {
// An ASTC 4x2 or 8x4 texture lies in a carrier image with a decoded twin on every device
// (no Vulkan format holds such a block), announced `carried-decoded-twin`; the round
// trip's `replaceRegion` decodes its blocks into the twin on the CPU (`cpu-block-decode`).
// An LDR form's twin holds 8-bit codes, whose `decoded-texel-precision` is announced at a
// command's first read of the twin, which the case never makes. Metal announces nothing,
// so the notices are declared by their codes. They loosen the notices site alone: the
// case reads bytes, every one compared with Metal's exactly. Measured: lavapipe announced
// both, MoltenVK over an M3 Max the first, and every other field was Metal's on both.
let astc = self
.round_trips
.iter()
.any(|&pf| AstcDecode::of(pf).is_some());
let mut named = Vec::new();
if astc {
named.extend(
[Degradation::CarriedDecodedTwin, Degradation::CpuBlockDecode]
.into_iter()
.map(|kind| crate::replay::notice_allowance(kind.code())),
);
}
// A `Shared` texture buffer's own buffer, on a device without unified memory
// (`crate::replay::shared_memory_notice` holds the whole reason). It loosens the notices
// site alone, like the two above.
// site alone: the case reads bytes, every one compared with Metal's exactly.
if self.shared_texture_buffers {
named.push(crate::replay::shared_memory_notice());
}
@@ -51,18 +51,7 @@
//! [`crate::replay::shared_memory_notice`] carries, the notice a device without unified memory
//! announces for the `Shared` buffer each row reads its answer back through.
//!
//! The lane also carries a branch for a device that **cannot** write Metal's pattern and so reads
//! zero, announcing `fresh-pattern-zeroed`. Two rows take it on one venue: `Depth32Float`'s
//! pattern is a NaN, a depth outside `[0, 1]`, which a device without
//! `VK_EXT_depth_range_unrestricted` takes into no depth image by a copy (MoltenVK on the M3 Max,
//! replayed: the `fresh` site reads zero, announced). That format's texture row and pattern row
//! alone declare the zeroing at their `fresh` site, and the texture row the
//! `restricted-depth-upload` its [`OLD`] write announces. Elsewhere
//! MoltenVK and lavapipe write Metal's pattern exactly, in every other format and patterned shape,
//! so the other rows hold our side to Metal's pattern and name no allowance for the zeroing: an
//! allowance that fires on no venue is a claim no run has checked, which the suite counts and
//! which this family deliberately does not add.
//!
//! # Why one process is the right place for this, and more than the lane had
//!
//! The lane's header describes a probe across *three fresh processes* and one after 768 MiB of
@@ -1102,15 +1091,7 @@ impl Case for FreshTexture {
if self.row.storage == Storage::Private {
allowances.push(crate::replay::without_compression("fresh"));
}
// The `Depth32Float` row on a device without `VK_EXT_depth_range_unrestricted`: its
// pattern zeroed ([`zeroed_depth_pattern`]), and its `OLD` write of 0.5 an upload such a
// device clamps and announces, which leaves 0.5 as it is.
if self.row.shape.format == DEPTH32FLOAT.format {
allowances.extend(zeroed_depth_pattern());
allowances.push(crate::replay::notice_allowance(
crate::degradation::Degradation::RestrictedDepthUpload.code(),
));
}
// A shape of blocks more than one texel square (`BC1_RGBA`) is a block-compressed
// texture, whose device decode the runtime announces where it makes it
// (`compressed-texel-decode`). At the notices site alone: the case reads bytes.
@@ -1347,24 +1328,6 @@ impl Pattern {
}
}
/// What a `Depth32Float` row declares (the module docs): Metal's pattern for it is a NaN, a depth
/// outside `[0, 1]`, which a device without `VK_EXT_depth_range_unrestricted` takes into no depth
/// image by a copy, so the runtime zeroes the new texture and announces `fresh-pattern-zeroed`.
/// Its `fresh` site goes unchecked, named, counted and reported, with that notice as the
/// justification, and the notice is declared; measured on the M3 Max (MoltenVK), the zeroed
/// texel is the whole of the difference beside the notices.
fn zeroed_depth_pattern() -> [Allowance; 2] {
let zeroed = crate::degradation::Degradation::FreshPatternZeroed.code();
[
Allowance::new(
"case/fresh/*",
crate::allowance::Loosening::Unchecked,
crate::allowance::Justification::Degradation(zeroed.to_owned()),
),
crate::replay::notice_allowance(zeroed),
]
}
/// A pattern row of the family: one format.
pub struct FreshPattern {
row: &'static Pattern,
@@ -1393,9 +1356,6 @@ impl Case for FreshPattern {
allowances.extend(super::compressed_blits::kept_encoding_notice(
self.row.format,
));
if self.row.format == DEPTH32FLOAT.format {
allowances.extend(zeroed_depth_pattern());
}
allowances
}
@@ -2100,20 +2060,15 @@ mod tests {
/// Every row names [`shared_memory_notice`], which is the venue's memory model and not the
/// row's; every `Private` texture row and every pattern row names the value declaration at its
/// `fresh` site, and no `Shared` or `Managed` row, buffer row or texture over a buffer does;
/// **only** the three pattern rows whose read blits out of a texture Metal keeps compressed in
/// a format whose canonical encoding the device's copy may keep apart from Metal's
/// (`BGRA10_XR`, its sRGB twin, `RGB9E5Float`; the notes lavapipe announced) name a further
/// notice. The two `Depth32Float` rows apart: each also leaves its `fresh` site unchecked under
/// `fresh-pattern-zeroed` and declares that notice ([`zeroed_depth_pattern`]), and the texture
/// row declares `restricted-depth-upload` too, the notices MoltenVK announced; and a
/// block-compressed texture row declares `compressed-texel-decode`, which `metal2vulkan-runtime`
/// announces for every such texture. A row whose notices were a guess would show here as a
/// row loosening a site nothing needed.
/// **only** the pattern row whose read blits out of a texture Metal keeps compressed in a
/// format whose canonical encoding the device's copy may keep apart from Metal's
/// (`RGB9E5Float`) names a further notice, and a block-compressed texture row declares
/// `compressed-texel-decode`, which `metal2vulkan-runtime` announces for every such texture. A row
/// whose notices were a guess would show here as a row loosening a site nothing needed.
#[test]
fn a_row_loosens_the_notices_site_and_a_private_texture_s_fresh_site() {
let notices = format!("case/{}/*", crate::replay::NOTICES_SITE);
let fresh = crate::replay::without_compression("fresh");
let [zeroed, _] = zeroed_depth_pattern();
let shared = crate::degradation::Degradation::SharedInSystemMemory
.code()
.to_owned();
@@ -2121,7 +2076,7 @@ mod tests {
let allowances = case.allowances();
for allowance in &allowances {
assert!(
allowance.path == notices || *allowance == fresh || *allowance == zeroed,
allowance.path == notices || *allowance == fresh,
"{}: {allowance:?}",
case.name()
);
@@ -2137,12 +2092,11 @@ mod tests {
}
for row in TEXTURES {
let private = row.storage == Storage::Private;
let depth = row.shape.format == DEPTH32FLOAT.format;
let compressed = row.shape.block.1 > 1;
let allowances = FreshTexture { row }.allowances();
assert_eq!(
allowances.len(),
1 + usize::from(private) + 3 * usize::from(depth) + usize::from(compressed),
1 + usize::from(private) + usize::from(compressed),
"{}",
row.case
);
@@ -2155,7 +2109,6 @@ mod tests {
row.case
);
assert_eq!(allowances.contains(&fresh), private, "{}", row.case);
assert_eq!(allowances.contains(&zeroed), depth, "{}", row.case);
}
// Everything else is held to Metal exactly, the venue's own notice apart.
for (case, storage) in BUFFERS {
@@ -2173,20 +2126,10 @@ mod tests {
);
}
for row in PATTERNS {
let kept = matches!(
row.case,
"fresh-pattern-552" | "fresh-pattern-553" | "fresh-pattern-93"
);
let depth = row.format == DEPTH32FLOAT.format;
let kept = row.case == "fresh-pattern-93";
let allowances = FreshPattern { row }.allowances();
assert_eq!(
allowances.len(),
2 + usize::from(kept) + 2 * usize::from(depth),
"{}",
row.case
);
assert_eq!(allowances.len(), 2 + usize::from(kept), "{}", row.case);
assert!(allowances.contains(&fresh), "{}", row.case);
assert_eq!(allowances.contains(&zeroed), depth, "{}", row.case);
}
}
@@ -300,17 +300,6 @@ impl Case for HalfStorageWrites {
}
fn allowances(&self) -> Vec<Allowance> {
// The sweep's grid is 1,024 by 65 threads at 32 by 32 a threadgroup, so 65 is not a whole
// number of threadgroups. That used to make the runtime run the dispatch as more than one
// Vulkan dispatch and announce `metal2vulkan-degrade-split-dispatch`, and the family
// declared the code for it. It does not any more: a ragged `dispatchThreads:` on a kernel
// that cannot observe its threadgroup partition runs as Metal's single dispatch, and
// `Degradation::SplitDispatch` fires on more than one region. Measured on this M3 Max, 8
// runs of the whole 1,103-case set: every row of this family announced no notice at all,
// where the recordings taken before that landing hold the code in their cost record's
// `degraded` set. So the declaration is gone, and a split here reads as an undeclared
// notice at once.
//
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the
@@ -322,15 +311,7 @@ impl Case for HalfStorageWrites {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
//
// The held form writes a texture held in an argument buffer, whose heap set MoltenVK's
// layout query refuses ([`crate::replay::set_past_layout_notice`]): announced by the three
// held rows on the M3 Max under MoltenVK 1.4.2, by none on lavapipe.
let mut allowances = vec![crate::replay::shared_memory_notice()];
if self.form == Form::Held {
allowances.push(crate::replay::set_past_layout_notice());
}
allowances
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -345,20 +345,6 @@ fn block_writes_only() -> HeapSizeCase {
}
}
/// The rows a driver that is not Metal answers a **larger** heap texture size or alignment for,
/// which the runtime announces as `heap-texture-larger-than-metal`.
///
/// Measured on the RTX 5080 Laptop (615.71.09) and on llvmpipe (Mesa 26.2.4):
/// `heap-sizes-x32-stencil8` announced it on both and `heap-sizes-block-writes-only` on the 5080,
/// each with the case declaring it nowhere; the other five rows were exact on both
/// (replay-nvidia.log, replay-llvmpipe.log).
///
/// The declaration is at the notices site alone, which matters here more than elsewhere: both rows
/// also answer **sizes and alignments** that are not Metal's -- `X32_Stencil8` aligns at 1024
/// where Metal aligns at 128 -- and those values stay compared exactly, so the rows stay divergent
/// on them. That difference is the finding; the undeclared notice was only hiding it.
const LARGER_THAN_METALS: [&str; 2] = [X32_STENCIL8, BLOCK_WRITES_ONLY];
impl Case for HeapSizeCase {
fn name(&self) -> &'static str {
self.name
@@ -373,22 +359,19 @@ impl Case for HeapSizeCase {
// alignment -- so the notice a card without unified memory announces for a `Shared` buffer
// cannot reach it, and no row declares one. Measured: five of the seven rows were exact on
// both the 5080 and llvmpipe.
let mut named = match LARGER_THAN_METALS.contains(&self.name) {
true => vec![crate::replay::notice_allowance(
crate::degradation::Degradation::HeapTextureLargerThanMetal.code(),
)],
false => Vec::new(),
};
//
// The runtime's answers are the device's own, held by their property and not by
// Metal's numbers (`texture_query::DEVICE_OWN_SIZES`).
named.extend(self.queries.iter().map(|query| {
Allowance::new(
format!("case/{}/{}/Ok/*", query.site(), site::QUERY),
Loosening::Unchecked,
Justification::accepted(crate::texture_query::DEVICE_OWN_SIZES),
)
}));
named
self.queries
.iter()
.map(|query| {
Allowance::new(
format!("case/{}/{}/Ok/*", query.site(), site::QUERY),
Loosening::Unchecked,
Justification::accepted(crate::texture_query::DEVICE_OWN_SIZES),
)
})
.collect()
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -444,14 +444,6 @@ impl Case for HostPageWrite {
// vertex function, which is the fixture, not this family's subject) is the suite's
// (`crate::replay::NATIVE_NOTES`), declared by no row.
//
// `copied-host-pages` is the read-only rows' alone, declared from `Row::read_only`, which
// is the bit it is about. On macOS a no-copy buffer with bit 24 announces nothing: the
// runtime imports the pages through a read-only view of them. Off macOS no import keeps
// the GPU's writes out, so the buffer is made over a copy of the pages whose GPU writes are
// dropped at each batch's completion (the runtime's `copied.rs`), and that copy is
// announced. It never fires on MoltenVK, which is why it is declared rather than relied
// on.
//
// `shared-in-system-memory` is every row's and belongs to the venue, not to this family:
// each row reads its pages back through a `Shared` buffer
// (`crate::replay::shared_memory_notice`). Announced by all four on the 5080.
@@ -459,13 +451,7 @@ impl Case for HostPageWrite {
// **None of these loosens a byte**, and that matters most here: the read-only rows' pages,
// and what a later command buffer reads of them, are this family's whole subject. Those
// bytes stay compared exactly.
let mut named = vec![crate::replay::shared_memory_notice()];
if self.row.read_only {
named.push(crate::replay::notice_allowance(
crate::degradation::Degradation::CopiedHostPages.code(),
));
}
named
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -629,16 +629,14 @@ impl Case for PatchDraws {
///
/// Taken from [`super::tessellation_sweeps`], whose own documentation says why each is named:
/// `tessellation-winding` and `tessellation-factor-edge-cases` are announced unconditionally by
/// the control stage, and `tessellation-triangle-order` and `emulated-tessellation-draws` by the
/// venues whose tessellator is not Apple's or which have no `tessellationShader` at all. None can
/// move a mark, because a mark is a set member and not a position in a triangle stream; they are
/// named because a notice our run announces that no case names is a divergence.
/// the control stage, and `tessellation-triangle-order` by the venues whose tessellator is not
/// Apple's. None can move a mark, because a mark is a set member and not a position in a triangle
/// stream; they are named because a notice our run announces that no case names is a divergence.
fn tessellation_notices() -> Vec<Allowance> {
[
crate::degradation::Degradation::TessellationWinding,
crate::degradation::Degradation::TessellationFactorEdgeCases,
crate::degradation::Degradation::TessellationTriangleOrder,
crate::degradation::Degradation::EmulatedTessellationDraws,
]
.into_iter()
.map(|notice| crate::replay::notice_allowance(notice.code()))
@@ -24,21 +24,10 @@
//! | [`RENDER_DRAWN`] | two render commands that **rasterize**, each with a vertex and a fragment buffer of its own, into one 8 by 8 target, one of them behind a barrier |
//! | [`LEFT_RENDER_STATES`] | nine descriptors, one property each, whose buffers are made and never executed |
//!
//! # What the rows announce, and on which venue
//! # What Metal's own API validation says
//!
//! Measured on this Apple M3 Max through MoltenVK 1.4.2 and on lavapipe, replaying each row
//! against its recording: **one** row announces notices, and five announce nothing at all.
//!
//! - [`RENDER_DRAWN`] announces `render-pass-split` on both venues, for the barrier its command 1
//! keeps: the runtime draws an indirect render command with a barrier in a render pass instance
//! of its own. Every texel of the row compared exactly on both venues, so the notice is the whole
//! difference the row has and its declaration loosens no value.
//! - The five other rows announced nothing on either venue, and **declare nothing**. A declaration
//! no run was measured provoking is a declaration nobody checked, so none of them carries one,
//! however plausible the note would be for its shape.
//!
//! Metal's own API validation is the other axis, and it disagrees with plain Metal twice here —
//! which is the whole reason the recording keeps it:
//! Metal's own API validation disagrees with plain Metal twice here, which is the whole reason
//! the recording keeps it:
//!
//! - [`RENDER_DRAWN`]: `setBarrier` and `clearBarrier` on a buffer without mesh draws are
//! reported ("requires DrawMeshThreadgroups or DrawMeshThreads") while plain Metal takes them
@@ -89,7 +78,7 @@
//! - **`gpuResourceID`** and the rows a kernel encodes are [`super::mesh_commands`]' gap, named
//! there.
use crate::allowance::{Allowance, Justification, Loosening};
use crate::allowance::Allowance;
use crate::case::STAGE_OBJECT;
use crate::case::{
call, made, Abort, Case, Failure, Handle, Input, MeshFunctions, MetalSource, Side,
@@ -1847,22 +1836,6 @@ fn drawn_layout() -> ByteLayout {
/// The row whose two render commands rasterize into a target.
pub struct DrawnCommands;
/// The notices this family was measured announcing, and the row each was measured on.
///
/// One, [`RENDER_DRAWN`]'s, and **every texel of the row still compared exactly** — the notice is
/// the whole difference the row has, so the declaration names a code and loosens no value.
///
/// - **`render-pass-split`**, announced on **both** venues: the runtime draws the barrier
/// command 1 of the row keeps in a render pass instance of its own.
///
/// The row's `RGBA8Unorm` store is the device's own conversion, a native note the suite declares
/// for every case ([`crate::replay::NATIVE_NOTES`]).
///
/// The other five rows were measured announcing **nothing** on either venue, and **declare
/// nothing**: a declaration no run was measured provoking is a declaration nobody checked.
const DRAWN_NOTICES: [crate::degradation::Degradation; 1] =
[crate::degradation::Degradation::RenderPassSplit];
impl Case for DrawnCommands {
fn name(&self) -> &'static str {
RENDER_DRAWN
@@ -1884,15 +1857,7 @@ impl Case for DrawnCommands {
// nothing else (replay-nvidia.log). On MoltenVK, where
// the chip's GPU shares the CPU's memory, it cannot fire at all, which is why no
// recording of this suite declares it.
std::iter::once(crate::replay::shared_memory_notice())
.chain(DRAWN_NOTICES.iter().map(|kind| {
Allowance::new(
format!("case/{}/*", crate::replay::NOTICES_SITE),
Loosening::Unchecked,
Justification::notice(*kind),
)
}))
.collect()
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -78,7 +78,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -895,20 +894,7 @@ impl Case for LayeredTargets {
// (`crate::replay::shared_memory_notice`). Measured on the RTX 5080 Laptop (615.71.09),
// where all five rows announced it with the case declaring it nowhere and each was
// divergent on that field and nothing else (replay-nvidia.log).
//
// `shader-resolve` is the resolve row's alone, and it is the one declaration this family
// **removed** once for firing on no venue. It has a venue now, and two: the RTX 5080 and
// llvmpipe (Mesa 26.2.4) both announced it for `layered-resolve-places` and for no other
// row, and on both every texel of that row compared exactly -- the whole difference was
// the announcement (replay-nvidia.log, replay-llvmpipe.log). A device whose resolve is the
// store's rather than a draw's announces nothing and the declaration simply does not fire.
let mut named = vec![crate::replay::shared_memory_notice()];
if matches!(self.cross, Cross::Resolves) {
named.push(crate::replay::notice_allowance(
Degradation::ShaderResolve.code(),
));
}
named
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -34,14 +34,12 @@
//! belong to a later batch, and one of their rows is a grid Metal's GPU discards — a recovery
//! victim, which this round must not run.
use crate::allowance::{Allowance, Justification, Loosening};
use crate::allowance::Allowance;
use crate::case::{
Abort, Case, Failure, Handle, Input, MeshFunctions, MeshStep, MetalSource, Side, TARGET_TEXEL,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, Loaded, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::replay::NOTICES_SITE;
use crate::transcript::{
Aspect, ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites, Value,
};
@@ -355,53 +353,13 @@ const PAST_LIMITS: &str = "mesh-object-draws-past-limits";
/// The fragment function every case's pipeline writes its attachments through.
const FRAGMENT: &str = "mesh_draws_fragment";
/// The degrade notices a mesh render pass may announce, each of which a mesh case loosens its
/// notices site by, because Metal announces none and a notice our side announced is the one field
/// that may then differ.
///
/// It is a list and not a device query, because a case never branches on the device: a case asks
/// by running and reads what came back. A venue that announces a kind not here fails the case
/// until its kind is added, which is the model working: an announced difference nobody named is
/// not an announced difference.
pub const MESH_PASS_NOTICES: &[Degradation] = &[
// The pass drew through the mesh-draw emulation, on a device without `VK_EXT_mesh_shader`.
Degradation::EmulatedMeshDraws,
// The notes the barrier and draw path makes: a fragment stage ordered before a later draw's
// earlier stages, a pass split at a barrier, and the bytes of draws the pass does not order.
Degradation::FragmentsBeforeGeometry,
Degradation::RenderPassSplit,
Degradation::UnorderedDrawBytes,
];
/// The allowances a mesh case keeps: one over its notices site per kind of
/// [`MESH_PASS_NOTICES`], so a device that announced one may hold it in its set and a device that
/// announced none compares the set exactly against Metal's empty one.
/// The allowance a mesh case keeps: the notice a device's own memory model provokes. These passes
/// read their payloads, draw arguments and attachments back through `Shared` buffers
/// ([`crate::replay::shared_memory_notice`]). Every row of the three mesh families but
/// `mesh-object-draws-past-limits` was measured announcing it on the RTX 5080; that row stops
/// before it allocates one, so it declares nothing ([`MeshDraws::allowances`]).
pub fn mesh_notice_allowances() -> Vec<Allowance> {
let mut allowances = vec![
// These passes read their payloads, draw arguments and attachments back through `Shared`
// buffers ([`crate::replay::shared_memory_notice`]). Every row of the three mesh families
// but `mesh-object-draws-past-limits` was measured announcing it on the RTX 5080; that row
// stops before it allocates one, so it declares nothing
// ([`MeshDraws::allowances`]).
crate::replay::shared_memory_notice(),
];
allowances.extend(plain_mesh_notice_allowances());
allowances
}
/// The same list without the notice a device's own memory model provokes, for the one case that
/// never reaches a `Shared` buffer.
fn plain_mesh_notice_allowances() -> Vec<Allowance> {
MESH_PASS_NOTICES
.iter()
.map(|kind| {
Allowance::new(
format!("case/{NOTICES_SITE}/*"),
Loosening::Unchecked,
Justification::notice(*kind),
)
})
.collect()
vec![crate::replay::shared_memory_notice()]
}
impl MeshDraws {
@@ -629,7 +587,7 @@ impl Case for MeshDraws {
// one: the RTX 5080 announced the notice for every other row of the three mesh families
// and not for this one, and a declaration no run justifies is one nobody is checking.
match self.name == PAST_LIMITS {
true => plain_mesh_notice_allowances(),
true => Vec::new(),
false => mesh_notice_allowances(),
}
}
@@ -40,7 +40,6 @@ use crate::case::{
};
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::replay::notice_allowance;
use crate::transcript::{Aspect, ByteLayout, Element, Gaps, Node, Observed, Region, Sites, Value};
use metal2vulkan::metal::PixelFormat;
@@ -364,13 +363,8 @@ impl Case for NanIntegerConversions {
fn allowances(&self) -> Vec<Allowance> {
// Every word compares exactly. Both answers come back through `Shared` buffers, so a
// device without unified memory announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). The fragment fill's pass
// loads nothing into the tile, which MoltenVK announced on the M3 Max (job
// m3-max-55436), as `rgb10a2_srgb`'s fills do.
let mut allowances = vec![
crate::replay::shared_memory_notice(),
notice_allowance(crate::degradation::Degradation::DontCareLoadTiles.code()),
];
// (`crate::replay::shared_memory_notice` holds the whole reason).
let mut allowances = vec![crate::replay::shared_memory_notice()];
// A `long` of either infinity, the one answer past a range where Metal on the M3 Max
// (job m3-max-55436) does not saturate: it answers 0, and the translator the bound. MSL
// states no answer past the range, so the two elements of each `long` column hold either,
@@ -458,16 +458,10 @@ impl Case for NormStorageWrites {
}
fn allowances(&self) -> Vec<Allowance> {
// Two declarations and no tolerance: the buffer each dispatch reads its words back through
// is `Shared`, which is what [`crate::replay::shared_memory_notice`] is for, and the held
// route writes a texture held in an argument buffer, whose heap set MoltenVK's layout
// query refuses ([`crate::replay::set_past_layout_notice`]: announced by all 7 cases on
// the M3 Max under MoltenVK 1.4.2, by none on lavapipe). Each loosens the notices site
// alone, so every value this case reads still compares exactly.
vec![
crate::replay::shared_memory_notice(),
crate::replay::set_past_layout_notice(),
]
// One declaration and no tolerance: the buffer each dispatch reads its words back through
// is `Shared`, which is what [`crate::replay::shared_memory_notice`] is for. It loosens the
// notices site alone, so every value this case reads still compares exactly.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -286,22 +286,15 @@ impl Case for PaddedBlend {
}
fn allowances(&self) -> Vec<Allowance> {
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// Every row reads its answer back through a `Shared` buffer, so on a device without unified
// memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason); it loosens the notices
// site alone. The pass loads and stores a padded colour attachment, so its draw announces
// `extended-range-bits-kept`: the device's store keeps the bits the codes leave unused in
// the texels the draw does not write, where Metal's pass makes them canonical. The draw is
// one full-screen triangle over the whole target, so a texel it does not write is one its
// mask leaves channels of, and every stored word still compares exactly. `rt6_samples` is
// a fast-math module, so a pipeline that blends its `half4` fill announces
// `half-output-fast-math-blend`. The blend in the device's arithmetic announces
// `extended-range-blend-source`, a native note the suite declares for every case
// (`crate::replay::NATIVE_NOTES`); a word the device's arithmetic moves is a known gap.
let mut named = vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::ExtendedRangeBitsKept.code()),
];
// site alone. Every stored word compares exactly. `rt6_samples` is a fast-math module, so a
// pipeline that blends its `half4` fill announces `half-output-fast-math-blend`. The blend
// in the device's arithmetic announces `extended-range-blend-source`, a native note the
// suite declares for every case (`crate::replay::NATIVE_NOTES`); a word the device's
// arithmetic moves is a known gap.
let mut named = vec![crate::replay::shared_memory_notice()];
if self.draw == Draw::PremulHalf {
named.push(crate::replay::notice_allowance(
Degradation::HalfOutputFastMathBlend.code(),
@@ -34,7 +34,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::recording::ShaderRef;
use crate::render::{
ColorState, PassColor, Plane, ReadAt, RenderPass, RenderPipelineSpec, RenderStep, RenderWork,
@@ -233,26 +232,9 @@ impl Case for PaddedFetch {
fn allowances(&self) -> Vec<Allowance> {
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). A pass that loads and
// stores a padded colour attachment announces `extended-range-bits-kept` (color 0's words
// are not compared). A read after a clear or an earlier draw of the pass announces
// `extended-range-blends-stored-codes`, and a draw that reads in the interlock what the
// fill wrote may split the pass (`render-pass-split`, the venue's). Each loosens the
// notices site alone: every value read still compares exactly, and a read the stored codes
// move is a known gap.
let mut named = vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(Degradation::ExtendedRangeBitsKept.code()),
];
if self.leg != Leg::Load {
named.push(crate::replay::notice_allowance(
Degradation::ExtendedRangeBlendsStoredCodes.code(),
));
}
if self.leg == Leg::Draw {
named.push(crate::replay::interlocked_split_notice());
}
named
// (`crate::replay::shared_memory_notice` holds the whole reason). It loosens the notices
// site alone: every value read still compares exactly.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -84,7 +84,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -690,26 +689,13 @@ impl Case for AttachmentPairs {
}
fn allowances(&self) -> Vec<Allowance> {
// **No value is loosened**: every texel Metal leaves is one we must leave, and every
// declared code is a notice. The resolves case stores an attachment `DontCare` in two of
// its four cells, and a device whose `DontCare` store is not Metal's announces that it took
// the near-equivalent; the loads case stores every attachment and declares nothing.
// **No value is loosened**: every texel Metal leaves is one we must leave.
//
// Both cases read their attachments back through a `Shared` buffer, and a device with no
// unified memory keeps a `Shared` allocation in system memory because that is the only
// memory both sides can reach. That belongs to the venue's memory model rather than to
// either crossing, so both declare it.
let mut allowances = vec![crate::replay::shared_memory_notice()];
if self.cross == Cross::Resolves {
allowances.extend([
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
// A device whose own `AVERAGE` resolve is not measured to be Metal's draws the
// colour resolve after the pass by Metal's rules instead. Every sample of every
// covered pixel carries one value here, so either path reaches the same texel.
crate::replay::notice_allowance(Degradation::ShaderResolve.code()),
]);
}
allowances
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -129,10 +129,8 @@
//!
//! `DontCare` is **not** swept, in either position. A `DontCare` **load** of an attachment the pass
//! stores keeps its texels only in the tiles no primitive touched, and which tiles those are
//! depends on where the GPU places the vertices — our runtime reaches Metal's answer in the tiles
//! a draw reaches and announces a near-equivalent for the rest
//! (`Degradation::DontCareLoadTiles`), so a cell over it would compare a device's rasterizer. A
//! `DontCare` **store** leaves the attachment undefined on both sides.
//! depends on where the GPU places the vertices, so a cell over it would compare a device's
//! rasterizer. A `DontCare` **store** leaves the attachment undefined on both sides.
//!
//! # Why this family is safe
//!
@@ -83,15 +83,13 @@
//!
//! # What is not asked, and why
//!
//! - **`MTLLoadActionDontCare` as pass B's load.** Metal keeps the texels of the tiles no
//! primitive of the pass touched; which tiles those are is the GPU's placement of the vertices,
//! and our runtime clears the render area instead and announces the near-equivalent
//! (`Degradation::DontCareLoadTiles`). A cell over it would compare two rasterizers rather than
//! Metal's rule, which is the reading `pass_bound_pairs` and `pass_attachment_pairs` both
//! reached. `MTLStoreActionDontCare` as pass A's **store** is a different matter and is swept:
//! Metal's answer there is the earlier texels, measured over 926 passes on an M3 Max, and the
//! eight runs of each cell are what say
//! whether it held.
//! - **`MTLLoadActionDontCare` as pass B's load.** Metal keeps the texels of the tiles no primitive
//! of the pass touched; which tiles those are is the GPU's placement of the vertices. A cell over
//! it would compare two rasterizers rather than Metal's rule, which is the reading
//! `pass_bound_pairs` and `pass_attachment_pairs` both reached. `MTLStoreActionDontCare` as pass
//! A's **store** is a different matter and is swept: Metal's answer there is the earlier texels,
//! measured over 926 passes on an M3 Max, and the eight runs of each cell are what say whether it
//! held.
//! - **A resolving store followed by a load.** `MTLStoreActionMultisampleResolve` writes the
//! resolve texture and keeps nothing of the multisampled one, and
//! `MTLStoreActionStoreAndMultisampleResolve` keeps both — so a pass B that loads the
@@ -112,7 +110,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -863,41 +860,13 @@ impl Case for SequenceActions {
// (`DONT_CARE_TEXELS`). Apple's page for `MTLStoreAction.dontCare` lets the GPU replace the
// attachment's contents with arbitrary data: Metal's answer on the M3 Max (the texels it
// held before pass A) is one outcome of that, the runtime's (what pass A rendered)
// another. Every other texel compares exactly. Two notices are declared and neither is a
// difference.
//
// `DontCareStore`: every cell of both cases stores an attachment `DontCare` somewhere. Under
// the suite's exact policy (`DontCareColorPolicy::Kept`) a colour stored `DontCare` keeps
// its earlier texels through a backing of its queue's and announces nothing
// (`kept_bytes.rs`), so in the colour case it fires only where no backing could be made;
// under the default policy the colour is stored as the driver stores it and announced. A
// depth or stencil aspect stored `DontCare` on a device whose `DontCare` store is not
// Metal's own announces that it took the near-equivalent under either. It fires on no
// venue whose driver stores `DONT_CARE` as Metal does (MoltenVK on this M3 Max among
// them), which is why it is declared rather than relied on.
// another. Every other texel compares exactly.
//
// `SharedInSystemMemory`: both cases read their attachments back through a `Shared`
// buffer, and a device with no unified memory keeps a `Shared` allocation in system memory
// because that is the only memory both sides can reach. It belongs to the venue's memory
// model rather than to a load or a store action.
let mut allowances = vec![
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
crate::replay::shared_memory_notice(),
];
// `SeparateDepthStencil`: the aspect case's two attachments are a `Depth32Float` beside a
// `Stencil8`, which the runtime renders through a scratch image of a combined format,
// copying each loaded aspect in and each stored one back. That route is the whole point of
// the case -- it is where an aspect's own action can reach the wrong half -- and it is a
// performance notice, not a value.
// `ShaderSideStencil`: the same scratch route makes the stencil reference and the stencil
// test the shader's work on a device whose own separate-aspect path is not Metal's, which
// is a statement about how the aspect was reached and not about the aspect's value.
if self.cross == Cross::Aspects {
allowances.extend([
crate::replay::notice_allowance(Degradation::SeparateDepthStencil.code()),
crate::replay::notice_allowance(Degradation::ShaderSideStencil.code()),
]);
}
let mut allowances = vec![crate::replay::shared_memory_notice()];
if self.cross == Cross::Color {
for cell in color_cells() {
let site = cell.site();
@@ -43,34 +43,20 @@
//! scissor's edges is a few rows of a few runs each, where its runs of texels alone would be two a
//! row (1,042 for each of the chain's targets, 1.46 MB of recording for the three).
//!
//! **What the runtime announces, and the case declares.** The rows whose read follows a solid draw
//! behind the barrier announce `render-pass-split`: the draw that reads the target records into a
//! Vulkan render pass instance after the one the solid draw ran in, behind a copy of what it wrote
//! (`texture/attached_reads.rs`). Every other row with a barrier reads the clear before any draw
//! of its pass, through a copy cleared to it before the pass, in the pass's one instance, and
//! announces nothing for it (`WorkCounts::attachment_read_clears`). The display row announces two
//! more, from the parts of its shape the compositor gave it: `dont-care-load-tiles` for the earlier
//! pass's `DontCare` load, whose draws cover the whole target before the read's pass clears it, and
//! `shadowed-texture` for the mask over a buffer's bytes. Measured on the Apple M3 Max (MoltenVK),
//! on lavapipe (LLVM 23.1.1) and on the RTX 5080 Laptop, under the exact policy and the runtime's
//! defaults alike, with every texel and every other field of the transcripts compared. The RTX 5080
//! Laptop announces `shared-in-system-memory` on every row. RADV (the RX 7900 XTX and the Radeon 780M, 2026-11-07) announces `shadowed-texture` on
//! the small rows over a buffer instead: no linear image of its aliases the 32x32 target over
//! the buffer's 128-byte rows, so the runtime renders and reads the target through a shadow image
//! (`texture.rs`), and every texel of those rows still compares exactly there.
//! **What the runtime announces, and the case declares.** Every row reads its answer back through a
//! `Shared` buffer, which a device without unified memory announces as `shared-in-system-memory`
//! (the RTX 5080 Laptop announces it on every row). The declaration loosens the notices site alone.
use crate::allowance::{Allowance, Justification, Loosening};
use crate::case::{
call, made, Abort, Case, Failure, Handle, Input, MetalSource, PlaneTexture, Side,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
Blend, ColorState, OverBuffer, PassColor, Plane, ReadAt, RenderPass, RenderPipelineSpec,
RenderStep, RenderWork, ScissorBox, TargetSpec,
};
use crate::replay::notice_allowance;
use crate::transcript::{Digest, Node, Observed, Sites, Value};
use metal2vulkan::metal::{BarrierScope, BlendFactor, PixelFormat, PrimitiveType, RenderStages};
@@ -499,8 +485,8 @@ impl Row {
}
/// The fragment functions of [`FUNCTIONS`] the row draws with, in that order: the pipelines it
/// makes. A pipeline made and never drawn with would cost its creation's prediction for nothing
/// (`cost::the_creation_prediction`), and no row asks a question of one.
/// makes. A pipeline made and never drawn with would cost its creation for nothing, and no row
/// asks a question of one.
fn functions(&self) -> Vec<&'static str> {
let drawn: &[&str] = match self.shape {
Shape::Small {
@@ -860,30 +846,6 @@ impl Case for PassStartRead {
Justification::accepted(DRAWN_WITHOUT_BARRIER),
));
}
// The notices the runtime announces for the row's shape (the module docs). Each loosens
// the notices site alone, so every texel still compares.
if matches!(
self.row.shape,
Shape::Small {
read: Small::DrawBarrierRead,
..
}
) {
allowances.push(notice_allowance(Degradation::RenderPassSplit.code()));
}
if matches!(self.row.shape, Shape::Display) {
allowances.push(notice_allowance(Degradation::DontCareLoadTiles.code()));
allowances.push(notice_allowance(Degradation::ShadowedTexture.code()));
}
if matches!(
self.row.shape,
Shape::Small {
over_buffer: true,
..
}
) {
allowances.push(notice_allowance(Degradation::ShadowedTexture.code()));
}
// Every row reads its answer back through a `Shared` buffer, so on a device without
// unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason): the RTX 5080 Laptop's
@@ -429,11 +429,6 @@ impl Case for PixelDownscales {
// The buffer each pass writes its sampled texels into is `Shared`
// ([`crate::replay::shared_memory_notice`]).
crate::replay::shared_memory_notice(),
// A downscale through an argument buffer's texture and sampler takes the heap set,
// which MoltenVK's layout query refuses ([`crate::replay::set_past_layout_notice`]):
// announced by all 7 cases of the family on the M3 Max under MoltenVK 1.4.2, by none
// on lavapipe.
crate::replay::set_past_layout_notice(),
]
}
@@ -552,11 +552,6 @@ impl Case for PixelSamplers {
// The buffer each pass writes its sampled texels into is `Shared`
// ([`crate::replay::shared_memory_notice`]).
crate::replay::shared_memory_notice(),
// The `arg` source samples a texture and a sampler held in an argument buffer, whose
// heap set MoltenVK's layout query refuses
// ([`crate::replay::set_past_layout_notice`]): announced by all 16 cases of the family
// on the M3 Max under MoltenVK 1.4.2, by none on lavapipe.
crate::replay::set_past_layout_notice(),
])
.collect()
}
@@ -33,8 +33,7 @@
//! of them: a placement that is wrong in both directions by the same permutation would round-trip
//! and tell us nothing.
//!
//! **One case per format**, as the rest of the compressed families. A device with no Vulkan format
//! for this one keeps the blocks in a carrier image and announces `carried-decoded-twin` once.
//! **One case per format**, as the rest of the compressed families.
//!
//! **Not ported, and why.** The lane's `replaceRegion:`/`getBytes:` of a region **other than** a
//! whole level, and of a whole level at a *padded* pitch, which our runtime refuses typed
@@ -49,7 +48,6 @@
use crate::allowance::Allowance;
use crate::case::{made, Abort, Case, Failure, Input, MetalSource, Side};
use crate::cases::pvrtc_rows::{blocks, Linear, BEFORE, BLOCK};
use crate::degradation::Degradation;
use crate::transcript::{ByteLayout, Element, Observed, Sites, Value};
use crate::work::{Plane, Rect, Resource, Step, TextureSpec, Work};
use metal2vulkan::metal::PixelFormat;
@@ -287,21 +285,9 @@ impl Case for PvrtcCpuOrder {
}
fn allowances(&self) -> Vec<Allowance> {
// A device with no Vulkan format for this one keeps the blocks in a carrier image and its
// reads through a decoded twin, announced once per device; Metal announces nothing. Every
// block still compares exactly: the only site loosened is the set of notices, and the
// allowance fails the case if the notice did not fire.
//
// Two more. A device with no Vulkan format for a PVRTC one decodes its blocks on the CPU
// to answer a host read of them (`cpu-block-decode`), which is a route to the same texels
// and not a texel of its own; the RTX 5080 announced it for all six rows. And the buffer
// each row reads its blocks back through is `Shared`
// ([`crate::replay::shared_memory_notice`]).
vec![
crate::replay::notice_allowance(Degradation::CarriedDecodedTwin.code()),
crate::replay::notice_allowance(Degradation::CpuBlockDecode.code()),
crate::replay::shared_memory_notice(),
]
// Every block compares exactly. The buffer each row reads its blocks back through is
// `Shared` ([`crate::replay::shared_memory_notice`]).
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -29,17 +29,13 @@
//! [`crate::cases::pvrtc_cpu_order`].
//!
//! **One case per format**, so a venue that holds no texture of one answers its typed refusal there
//! and counts as lacking that format rather than taking the other seven down. A device without the
//! Vulkan format keeps the blocks in a carrier image — half as wide for a 2-bit format, whose block
//! is 8 x 4 texels — which is the mechanism these rows exist to check, and it announces
//! `carried-decoded-twin` once.
//! and counts as lacking that format rather than taking the other seven down.
//!
//! Nothing here can fault a GPU: blit copies between textures and buffers the program makes, no
//! dispatch, no draw, no loop, every region block-aligned and inside its level.
use crate::allowance::Allowance;
use crate::case::{made, Abort, Case, Failure, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::transcript::{ByteLayout, Element, Node, Observed, Sites, Value};
use crate::work::{Plane, Rect, Resource, Step, TextureSpec, Work};
use metal2vulkan::metal::PixelFormat;
@@ -553,18 +549,11 @@ impl Case for PvrtcRows {
}
fn allowances(&self) -> Vec<Allowance> {
// A device with no Vulkan format for this PVRTC format keeps the blocks in a carrier image
// and its reads through a decoded twin, which the runtime announces once per device. Metal
// announces nothing. Every block still compares exactly: the only site loosened is the set
// of notices, which Metal holds empty, and the allowance fails the case if the notice did
// not fire.
// The buffer each pass reads its blocks back through is `Shared`, which a device with no
// unified memory keeps in system memory because that is the only memory both sides can
// reach: the venue's memory model, not this family's subject.
vec![
crate::replay::notice_allowance(Degradation::CarriedDecodedTwin.code()),
crate::replay::shared_memory_notice(),
]
// Every block compares exactly. The buffer each pass reads its blocks back through is
// `Shared`, which a device with no unified memory keeps in system memory because that is
// the only memory both sides can reach: the venue's memory model, not this family's
// subject.
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -773,16 +773,6 @@ impl Case for ReadThrough {
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// A read through an argument buffer's sampler or texture takes the handle heap, whose set
// MoltenVK's layout query refuses though it runs it: measured on the M3 Max through
// MoltenVK, where every plane case that reads one, the two argument-buffer texture cases
// among them, announced `set-past-layout-support` and nothing else.
let heap = self.reads.iter().any(|read| {
matches!(
read.through,
Through::Table(..) | Through::HeapTexture | Through::HeapTextureSlot(..)
)
});
// Every read binds its positions and its output in `Shared` buffers, so on a device
// without unified memory the runtime announces `shared-in-system-memory`
// (`crate::replay::shared_memory_notice` holds the whole reason). It declares the notices
@@ -790,11 +780,7 @@ impl Case for ReadThrough {
// RX 7900 XTX (RADV NAVI31, the round's replay at 6898863f3f): it fired for all 13 cases,
// each divergent at the notices site and nothing else; on MoltenVK and lavapipe, whose
// GPU shares the CPU's memory, it cannot fire.
let mut named = vec![crate::replay::shared_memory_notice()];
if heap {
named.push(crate::replay::set_past_layout_notice());
}
named
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -444,20 +444,13 @@ impl Case for ReadWriteDescriptors {
}
fn allowances(&self) -> Vec<Allowance> {
// The tables name block-compressed formats, which a device with no Vulkan format for one
// makes through a decoded twin carried beside the blocks, and the runtime says so: a
// performance notice at the notices site alone, every answer of the tables still
// compared. Measured firing on llvmpipe (LLVM 21.1.8). A texture of such a format the
// device holds itself announces the device's decode of its blocks
// (`compressed-texel-decode`), at the notices site alone too: the tables read no texel.
vec![
crate::replay::notice_allowance(
crate::degradation::Degradation::CarriedDecodedTwin.code(),
),
crate::replay::notice_allowance(
crate::degradation::Degradation::CompressedTexelDecode.code(),
),
]
// The tables name block-compressed formats: a texture of such a format the device holds
// itself announces the device's decode of its blocks (`compressed-texel-decode`), at the
// notices site alone: the tables read no texel, and every answer of the tables is still
// compared.
vec![crate::replay::notice_allowance(
crate::degradation::Degradation::CompressedTexelDecode.code(),
)]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -890,22 +883,8 @@ impl Case for HeldReadWrite {
fn allowances(&self) -> Vec<Allowance> {
// The venue's memory model for the `Shared` read-back ([`crate::replay::shared_memory_notice`]),
// and the notice a device announces for a held texture whose format its heap array cannot
// view (`unnamed-texture-unviewable`): the array holds the class's neutral at the
// texture's ID. It fired on lavapipe and the RTX 5080 for the two sRGB formats and
// `BGR10A2Unorm` until the heap viewed them through their storage aliases
// (`bind::heap::storage_conversions`); it stays declared for a device whose alias for a
// swept format the heap's formatless declaration cannot serve. Both sit at the notices
// site alone: every texel is still compared. And the held textures' heap set,
// which MoltenVK's layout query refuses ([`crate::replay::set_past_layout_notice`]):
// announced on the M3 Max under MoltenVK 1.4.2, not on lavapipe.
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(
crate::degradation::Degradation::UnnamedTextureUnviewable.code(),
),
crate::replay::set_past_layout_notice(),
]
// at the notices site alone: every texel is still compared.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -43,7 +43,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -182,23 +181,16 @@ fn read_target(texture: Handle, into: Handle) -> RenderWork {
}
}
/// The shader reference both texts of `fixture` give, under `entries`.
/// The notices every row of the family declares, both measured firing for all three rows.
/// The notice every row of the family declares, measured firing for all three rows on the 5080:
/// the buffer each pass reads its colour target back through is `Shared`
/// ([`crate::replay::shared_memory_notice`]).
///
/// Neither loosens a value: both sit at the notices site, so a texel that differs still fails the
/// case. The depth-bias row declares a third of its own ([`DepthBias::allowances`]).
/// It loosens no value: it sits at the notices site, so a texel that differs still fails the case.
fn pass_notices() -> Vec<Allowance> {
vec![
// The depth attachment nothing reads is stored `DontCare`, and a device whose `DontCare`
// store is not Metal's announces that it took the near-equivalent. Measured on llvmpipe
// and on the RTX 5080.
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
// The buffer each pass reads its colour target back through is `Shared`
// ([`crate::replay::shared_memory_notice`], measured on the 5080).
crate::replay::shared_memory_notice(),
]
vec![crate::replay::shared_memory_notice()]
}
/// The shader reference both texts of `fixture` give, under `entries`.
fn shader_refs(fixture: &'static str, entries: &str) -> Result<Vec<ShaderRef>, String> {
let held = Fixture::new(fixture);
[RUNTIME_TEXT, METAL_TEXT]
@@ -532,17 +524,9 @@ impl Case for DepthBias {
fn allowances(&self) -> Vec<Allowance> {
// **Nothing is loosened.** A texel is four ones or the pass's clear, both of which a
// `RGBA32Float` attachment stores exactly, and the fragment function does no arithmetic a
// device's float bounds could reach.
//
// The family's two declarations ([`pass_notices`]), and one more this case alone earns:
// a device that clamps a depth bias outside the unit range where Metal does not says so,
// and only this case states a bias. Measured firing for this row on llvmpipe and for
// neither of the other two.
let mut named = pass_notices();
named.push(crate::replay::notice_allowance(
Degradation::BiasedDepthPastUnitRange.code(),
));
named
// device's float bounds could reach. The family's declaration ([`pass_notices`]) sits at
// the notices site.
pass_notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1515,17 +1499,10 @@ mod tests {
for case in all() {
assert_eq!(case.record_runs(), RUNS);
assert!(matches!(case.metal_source(), MetalSource::Run));
// Every case declares the family's two notices, the depth-bias case one more, and
// none of them loosens a value, so each allowance sits at the notices site: a value
// tolerance added later fails here.
// Every case declares the family's notice, and it loosens no value, so each allowance
// sits at the notices site: a value tolerance added later fails here.
let allowances = case.allowances();
let states_a_bias = case.name() == "render-state-depth-bias";
assert_eq!(
allowances.len(),
pass_notices().len() + usize::from(states_a_bias),
"{}",
case.name()
);
assert_eq!(allowances.len(), pass_notices().len(), "{}", case.name());
for allowance in &allowances {
assert_eq!(allowance.path, format!("case/{NOTICES_SITE}/*"));
assert_eq!(allowance.loosening, Loosening::Unchecked);
@@ -126,25 +126,6 @@ const RUN_STRIDE: u64 = 16;
/// to fold into one outcome, and asking for more makes the recording say so on evidence.
const RUNS: u32 = 8;
/// The notice the two cases that make an **indexed indirect** draw declare, and the lines case
/// does not.
///
/// MoltenVK does not enable `robustBufferAccess2` and its driver is not measured to read index 0
/// past the bound range, so an indexed indirect draw's index fetch is nothing Vulkan bounds: the
/// GPU reads `indexCount` out of the argument buffer, and a count the index buffer cannot hold
/// would read past it. The runtime therefore bounds the indices on the GPU **before the pass** and
/// announces the cost, which is work Metal does not do. The declaration loosens no value -- it says
/// the announcement is this case's -- so the case still fails on any texel that moves.
///
/// Measured on an Apple M3 Max (macOS 27.0.1, build 26A434, MoltenVK, API 1.2): both cases
/// announce `metal2vulkan-degrade-indirect-index-bounds-pass` once, and the runtime's own counts
/// say which path fired -- `bounded_run_draws 1` and `cmd_draw_indexed_indirect 2`, the two
/// indirect draws the degradation's own text says one becomes. Every texel of both cases, and
/// every other field of their transcripts, compared exactly.
///
/// `render-draw-forms-lines` is the control, and it is a case rather than an argument: its
/// indexed draw is the eight-argument direct form, so it reaches no bounds pass, moves neither
/// count, declares no bounds-pass notice and replays **exact** on the same venue in the same run.
/// The degrade notices a case of the family whose draws are `rows` may announce for the primitives
/// they draw, whatever draw form each uses. A list rather than a device query, because a case never
/// branches on the device: it runs and reads what came back, and a venue that announces a kind not
@@ -177,14 +158,6 @@ fn pass_notices() -> Vec<Allowance> {
allowances
}
fn bounds_pass_notice() -> Vec<Allowance> {
let mut allowances = pass_notices();
allowances.push(crate::replay::notice_allowance(
Degradation::IndirectIndexBoundsPass.code(),
));
allowances
}
/// Every case of the family, in the order the report lists them.
pub fn all() -> Vec<Box<dyn Case>> {
vec![
@@ -862,9 +835,9 @@ impl Case for Points {
fn allowances(&self) -> Vec<Allowance> {
// No value is loosened. An `RGBA32Uint` texel is the `uint4` the fragment function
// returned: there is no conversion, no interpolation and no arithmetic of the shader's in
// the path, so every channel is an exact answer or it is a bug. What is declared is the one
// notice this case's own indexed indirect draw provokes ([`bounds_pass_notice`]).
bounds_pass_notice()
// the path, so every channel is an exact answer or it is a bug. What is declared is the
// family's notices ([`pass_notices`]).
pass_notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1022,9 +995,8 @@ impl Case for Triangles {
}
fn allowances(&self) -> Vec<Allowance> {
// No value loosened, for the reason the points case states, and the same one notice: this
// case makes an indexed indirect draw too ([`bounds_pass_notice`]).
bounds_pass_notice()
// No value loosened, for the reason the points case states, and the same notices.
pass_notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1162,11 +1134,10 @@ impl Case for Lines {
}
fn allowances(&self) -> Vec<Allowance> {
// Nothing loosened, for the reason the points case states, and no bounds-pass notice:
// this case's indexed draw is the eight-argument direct form, so it reaches no bounds
// pass. A line's covered set is a rasterization rule rather than arithmetic, so the module
// test holds this case to what any rule implies and the comparison holds both legs to the
// same bytes: a coverage rule that differs is a finding, not a tolerance.
// Nothing loosened, for the reason the points case states. A line's covered set is a
// rasterization rule rather than arithmetic, so the module test holds this case to what any
// rule implies and the comparison holds both legs to the same bytes: a coverage rule that
// differs is a finding, not a tolerance.
pass_notices()
}
@@ -1319,10 +1290,8 @@ impl Case for Empty {
}
fn allowances(&self) -> Vec<Allowance> {
// This case makes an indexed indirect draw, so it declares the same one notice the points
// and triangles cases do ([`bounds_pass_notice`]) -- the runtime bounds the indices before
// the pass whatever the count turns out to be. No value is loosened.
bounds_pass_notice()
// No value is loosened; the case declares the family's notices ([`pass_notices`]).
pass_notices()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -2051,26 +2020,6 @@ mod tests {
assert_eq!(calls.len(), 8, "the family reaches {calls:?}");
}
/// Whether `case` makes **no** indexed indirect draw, read off its own table rather than off
/// its name: a case that grew one would start announcing the bounds pass, and this is what
/// makes the declaration follow the draws.
fn line_rows_hold_no_indexed_indirect(case: &str) -> bool {
!rows_of(case)
.iter()
.any(|row| matches!(row.form, Form::IndexedIndirect { .. }))
}
/// The draws of `case`, a case of this family.
fn rows_of(case: &str) -> Vec<Row> {
match case {
"render-draw-forms-points" => point_rows(),
"render-draw-forms-triangles" => triangle_rows(),
"render-draw-forms-lines" => line_rows(),
"render-draw-forms-empty" => empty_rows(),
other => panic!("{other} is not a case of this family"),
}
}
/// **Every case of the family names itself once**, and the names are the ones the recordings
/// are keyed by.
#[test]
@@ -2086,21 +2035,12 @@ mod tests {
// returned, so every allowance any case names sits over the notices site.
//
// Every case declares the family's list ([`pass_kinds`]), `device-point-size`
// among it, whatever it draws: a static note of the state. On top of it, the
// notice an **indexed indirect** draw provokes is declared by exactly the cases that
// make one -- which is the falsification of that declaration rather than a
// restatement of it, because the lines case reaches the same code with the direct
// indexed form and announces nothing.
// among it, whatever it draws: a static note of the state.
let declared = case.allowances();
for allowance in &declared {
assert!(allowance.path.starts_with("case/notices"), "{allowance:?}");
assert_eq!(allowance.loosening, Loosening::Unchecked, "{allowance:?}");
}
let bounds_pass =
Justification::Degradation(Degradation::IndirectIndexBoundsPass.code().to_owned());
let names_bounds_pass = declared
.iter()
.any(|allowance| allowance.justified_by == bounds_pass);
let point_size =
Justification::Degradation(Degradation::DevicePointSize.code().to_owned());
assert!(
@@ -2108,18 +2048,10 @@ mod tests {
"{} declares no point-size notice",
case.name()
);
let indirect = line_rows_hold_no_indexed_indirect(case.name());
assert_eq!(
names_bounds_pass,
!indirect,
"{} and its bounds-pass declaration disagree",
case.name()
);
assert_eq!(
declared.len(),
// The family's own list, the notice a device's own memory model provokes, and the
// bounds-pass notice where the draw is an indexed indirect one.
pass_kinds().len() + 1 + usize::from(!indirect),
// The family's own list and the notice a device's own memory model provokes.
pass_kinds().len() + 1,
"{} declares the wrong number of notices",
case.name()
);
@@ -50,7 +50,6 @@ use crate::allowance::Allowance;
use crate::case::{
call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side, TextureRole, TextureSpec,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -451,25 +450,10 @@ impl Case for RenderBarriers {
// texel read at integer coordinates takes no device's float bounds, so every texel here is
// an exact answer or a bug.
//
// One notice is declared, and it is what the barrier calls themselves cost. **A Metal
// memory barrier between draws of one pass orders the draws after it behind the draws
// before it, which Vulkan gives across render pass instances**, so the runtime ends the
// instance at the barrier and begins another. Metal does not split its pass, so the
// runtime announces the difference in work.
//
// Measured on an Apple M3 Max (macOS 27.0.1, build 26A434), under the exact policy and
// under the runtime's own defaults alike: our leg announces
// `metal2vulkan-degrade-render-pass-split` once, its notice reading "memory barriers
// between its draws end 1 of its Vulkan render pass instances", while every texel of both
// halves of the target and every other field of the transcript compared exactly.
//
// One more is declared, and it is the venue's rather than this case's: the buffer the
// One notice is declared, and it is the venue's rather than this case's: the buffer the
// pass reads its target back through is `Shared`, which a device with no unified memory
// keeps in system memory because that is the only memory both sides can reach.
vec![
crate::replay::notice_allowance(Degradation::RenderPassSplit.code()),
crate::replay::shared_memory_notice(),
]
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -591,9 +575,8 @@ impl Case for HeapResidency {
}
fn allowances(&self) -> Vec<Allowance> {
// Nothing loosened, for the reason the barrier case states, and no pass-split notice:
// this case encodes no barrier. What is declared is the one notice the venue's own memory
// model provokes for the `Shared` read-back buffer.
// Nothing loosened, for the reason the barrier case states. What is declared is the one
// notice the venue's own memory model provokes for the `Shared` read-back buffer.
vec![crate::replay::shared_memory_notice()]
}
@@ -823,21 +806,20 @@ mod tests {
assert_eq!(case.record_runs(), RUNS);
assert!(matches!(case.metal_source(), MetalSource::Run));
// Both cases declare the notice the venue's own memory model provokes for the
// `Shared` read-back buffer, and the barrier case declares the pass split besides. No
// value of either is loosened, so every declaration sits at the notices site.
// `Shared` read-back buffer, and nothing else. No value of either is loosened, so
// every declaration sits at the notices site.
let declared = case.allowances();
for allowance in &declared {
assert!(allowance.path.starts_with("case/notices"), "{allowance:?}");
}
let codes: Vec<&Justification> =
declared.iter().map(|held| &held.justified_by).collect();
let shared =
Justification::Degradation(Degradation::SharedInSystemMemory.code().to_owned());
let split = Justification::Degradation(Degradation::RenderPassSplit.code().to_owned());
match case.name() {
"render-state-render-barriers" => assert_eq!(codes, vec![&split, &shared]),
_ => assert_eq!(codes, vec![&shared], "{}", case.name()),
}
let shared = Justification::Degradation(
crate::degradation::Degradation::SharedInSystemMemory
.code()
.to_owned(),
);
assert_eq!(codes, vec![&shared], "{}", case.name());
}
// The barriers name the stage whose writes the next draw reads, on both sides of each.
assert_eq!(FRAGMENT, RenderStages::FRAGMENT);
@@ -45,7 +45,6 @@ use crate::case::{
call, made, Abort, Case, Failure, Handle, Input, MetalSource, SamplerSpec, Side, TextureRole,
TextureSpec,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -735,29 +734,9 @@ impl Case for Facing {
fn allowances(&self) -> Vec<Allowance> {
// No value is loosened, for the reason `render-state-boxes` states: every texel this case
// reads compared exactly. What is declared is one notice, and this case's own shape is
// what provokes it.
//
// **Metal's triangle fill mode is encoder state and Vulkan's polygon mode is pipeline
// state**, so the draw after `setTriangleFillMode:MTLTriangleFillModeLines` needs a
// pipeline the pass had not made, and a draw whose pipeline is being made cannot record
// into an instance that recorded inline: it records into a new render pass instance after
// it. A mid-pass fill-mode change therefore splits the Vulkan render pass, which is work
// Metal does not do, and the runtime announces it.
//
// Measured on an Apple M3 Max (macOS 27.0.1, build 26A434), under the exact policy and
// under the runtime's own defaults alike: our leg announces
// `metal2vulkan-degrade-render-pass-split` once, its notice naming a pass of one color
// attachment in two instances, while every texel this case reads and every other field of
// its transcript compared exactly. The declaration loosens no value -- it says the
// announcement is this case's -- so the case still fails on any byte that moves.
//
// The notice the venue's own memory model provokes for the `Shared` read-back buffer is
// declared beside it.
vec![
crate::replay::notice_allowance(Degradation::RenderPassSplit.code()),
crate::replay::shared_memory_notice(),
]
// reads compared exactly. What is declared is the notice the venue's own memory model
// provokes for the `Shared` read-back buffer.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1386,22 +1365,20 @@ mod tests {
assert_eq!(case.record_runs(), RUNS);
assert!(matches!(case.metal_source(), MetalSource::Run));
// Every case declares the notice the venue's own memory model provokes for the
// `Shared` read-back buffer, and exactly one -- the facing case -- declares the pass
// split besides. No value of any case is loosened, so every declaration sits at the
// notices site.
// `Shared` read-back buffer, and nothing else. No value of any case is loosened, so
// every declaration sits at the notices site.
let declared = case.allowances();
for allowance in &declared {
assert!(allowance.path.starts_with("case/notices"), "{allowance:?}");
}
let codes: Vec<&Justification> =
declared.iter().map(|held| &held.justified_by).collect();
let shared =
Justification::Degradation(Degradation::SharedInSystemMemory.code().to_owned());
let split = Justification::Degradation(Degradation::RenderPassSplit.code().to_owned());
match case.name() {
"render-state-facing" => assert_eq!(codes, vec![&split, &shared]),
_ => assert_eq!(codes, vec![&shared], "{}", case.name()),
}
let shared = Justification::Degradation(
crate::degradation::Degradation::SharedInSystemMemory
.code()
.to_owned(),
);
assert_eq!(codes, vec![&shared], "{}", case.name());
}
}
}
@@ -737,10 +737,9 @@ impl Case for Rgb10A2Srgb {
.collect()
}
/// What a store case's pass announced on MoltenVK, measured: a pass that loads nothing into
/// the tile, and the `half` fragment's output conversion; and what a linear sample case's
/// pipeline announced on every venue run, its module's filter of the decoded taps. The read and write
/// cases name no notice of their own.
/// What a store case's pass announced on MoltenVK, measured: the `half` fragment's output
/// conversion; and what a linear sample case's pipeline announced on every venue run, its
/// module's filter of the decoded taps. The read and write cases name no notice of their own.
fn allowances(&self) -> Vec<Allowance> {
use crate::degradation::Degradation as D;
// Every question reads its answer back through a `Shared` buffer, and a device with no
@@ -748,13 +747,9 @@ impl Case for Rgb10A2Srgb {
// memory both sides can reach: the venue's memory model rather than this format's answer.
let mut named = vec![crate::replay::shared_memory_notice()];
match &self.question {
Question::Stores {
lanes: Lanes::Float,
} => named.push(notice_allowance(D::DontCareLoadTiles.code())),
Question::Stores { lanes: Lanes::Half } => named.extend([
notice_allowance(D::DontCareLoadTiles.code()),
notice_allowance(D::HalfOutputFastMathBlend.code()),
]),
Question::Stores { lanes: Lanes::Half } => {
named.push(notice_allowance(D::HalfOutputFastMathBlend.code()))
}
// A linear sample filters the decoded taps in the module, and that filter's sum is the
// device's arithmetic (`bicubic-filter-arithmetic`, announced for the two linear
// cases on the M3 Max, the RTX 5080 and lavapipe), as `two_plane_samples` declares for
@@ -49,22 +49,19 @@
//! Two questions a rotation, over two frames:
//!
//! - **store**: a pass that clears the frame and draws every texel of a source texture
//! whose texels name themselves, so each plane byte names the pass texel Metal stored there. That
//! is `stored_at` measured directly.
//! whose texels name themselves, so each plane byte names the pass texel Metal stored there.
//! - **load**: the plane's texels each named with their own stored position, then a pass
//! that loads and draws only the top-left 8x4 pass texels. What the undrawn texels keep is the
//! answer, and at rotation 4 it is the one place our runtime is known to differ from Metal.
//! answer.
//!
//! The frames are 64x16, whose turned plane is 16x64 and so spans **two 32x32 plane tiles**, and
//! 32x32, which is one tile. The two-tile frame is deliberate: measured here, at rotation 4 Metal
//! mirrors the loaded texels left to right in the tile the draw reached (480 of 480 undrawn texels)
//! and **keeps every texel of the tile it did not reach** (512 of 512), while the runtime mirrors
//! every tile and announces `RotatedLoadTiles`. A one-tile frame cannot tell those apart, which is
//! why the lane's own 32x32 test never did.
//! and **keeps every texel of the tile it did not reach** (512 of 512). A one-tile frame cannot
//! tell that from mirroring every tile, which is why the lane's own 32x32 test never did.
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::recording::ShaderRef;
use crate::render::{
ColorState, PassColor, RenderPass, RenderPipelineSpec, RenderStep, RenderWork, TargetSpec,
@@ -254,23 +251,6 @@ impl RotatedPlane {
bands
}
/// Whether the draw reaches any texel of the band starting at row `first`.
///
/// Derived from where the draw's own pass texels are stored
/// ([`crate::surface::stored_at`]), so it is a structural answer rather than a band index
/// written down for one rotation.
fn band_is_reached(&self, first: u32, rows: u32) -> bool {
if self.ask == Ask::Store {
return true;
}
(0..DRAWN[1]).any(|y| {
(0..DRAWN[0]).any(|x| {
let [_, sy] = crate::surface::stored_at(self.rotation, self.frame, [x, y]);
sy >= first && sy < first + rows
})
})
}
/// The layout one band of the plane is read under: its own rows at the plane's stride, so a
/// diff names the plane texel that moved **and the gaps between the rows are compared** -- a
/// case of this family asserts the bytes between the rows stayed as they were, which is half of
@@ -318,63 +298,11 @@ impl Case for RotatedPlane {
}
fn allowances(&self) -> Vec<Allowance> {
// A load at rotation 4 is the one shape where the runtime differs from Metal, and it says
// so: Metal mirrors the loaded texels only in each 32x32 tile the draw reached, and the
// runtime mirrors every tile, announced once as `RotatedLoadTiles`.
//
// The allowance is only taken by the frame where the difference can actually appear. A
// 32x32 frame is one tile, so there is no unreached tile and nothing to loosen -- naming
// the allowance there would be a claim with no evidence, and the allowance machinery would
// rightly fail it if the notice did not fire.
// Every case of this family announces one notice Metal has no counterpart for: the runtime
// reads and renders a rotated texture through shadows (`ShadowedTexture`). Metal announces
// nothing, because Metal has no notices at all, so the notice set is loosened for the
// family -- and only the notice set, so every plane byte still compares exactly.
// The buffer every case reads its plane back through is `Shared`, which a device with no
// unified memory keeps in system memory because that is the only memory both sides can
// reach (`shared-in-system-memory`): the venue's memory model, not a rotation.
let mut allowances = vec![
crate::replay::notice_allowance(Degradation::ShadowedTexture.code()),
crate::replay::shared_memory_notice(),
];
if self.ask == Ask::Load && self.rotation == 4 {
// The notice is announced wherever rotation 4 loads, whatever the frame, so its code
// is **declared** here for every such frame: Metal announces none, and a notice our
// side announces that the case names nowhere is a difference with nothing accounting
// for it. The declaration loosens no byte. It is not the tolerance below, which stays
// held to the bands where the difference can appear -- and that is why a 32x32 frame
// needs this line: it has no unreached band to loosen, and announced the notice all
// the same.
allowances.push(crate::replay::notice_allowance(
Degradation::RotatedLoadTiles.code(),
));
// The one place the runtime is known to differ from Metal, and the allowance is held to
// exactly where it differs.
//
// MEASURED on this M3 Max, from Metal's own recorded plane bytes: a rotation-4 load
// leaves the loaded texels mirrored left to right in the 32x32 plane tile the draw
// reached (480 of 480 undrawn texels) and **keeps every texel of the tile it did not
// reach** (512 of 512). The runtime mirrors every tile and announces
// `RotatedLoadTiles`.
//
// So only the bands the draw does not reach are loosened. The reached band still
// compares byte for byte, which is where the mirror itself is checked, and a frame of
// one band (32x32) has nothing to loosen at all -- naming an allowance there would be a
// claim with no evidence.
allowances.extend(
self.bands()
.iter()
.filter(|&&(first, rows)| !self.band_is_reached(first, rows))
.map(|&(first, _)| {
crate::allowance::Allowance::new(
format!("case/plane/rows-{first}"),
crate::allowance::Loosening::Unchecked,
crate::allowance::Justification::notice(Degradation::RotatedLoadTiles),
)
}),
);
}
allowances
// Every plane byte compares exactly. The buffer every case reads its plane back through is
// `Shared`, which a device with no unified memory keeps in system memory because that is
// the only memory both sides can reach (`shared-in-system-memory`): the venue's memory
// model, not a rotation.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -43,7 +43,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::recording::ShaderRef;
use crate::render::{
Blend, BlendColorChannels, ColorState, PassColor, Plane, ReadAt, RenderPass,
@@ -182,21 +181,6 @@ struct State {
blend: Option<[(BlendFactor, BlendFactor, BlendOperation); 2]>,
}
impl State {
/// Whether a colour factor of the state's blend reads the destination alpha, which no Vulkan
/// factor reads from the rotated image ([`destination_alpha`]).
fn reads_destination_alpha_in_color(&self) -> bool {
self.blend.is_some_and(|[(source, destination, _), _]| {
[source, destination].iter().any(|f| {
matches!(
f,
BlendFactor::DestinationAlpha | BlendFactor::OneMinusDestinationAlpha
)
})
})
}
}
/// The thirteen states the lane sweeps: every write mask and blend it measured, in its order.
fn states() -> Vec<State> {
use BlendFactor as F;
@@ -516,19 +500,7 @@ impl Case for RotatedTarget {
// from it: a difference stays a mismatch for review". Loosening a texel here would be this
// suite overruling that, so the blended states stay divergent on lavapipe and are a
// per-venue divergence to carry, not a tolerance to write.
//
// The state whose colour factor reads the destination alpha ([`destination_alpha`]) has
// the fragment function read its texel. A venue that orders that read through the pixel
// interlock may render the pass into a scratch image (`fetch-through-scratch`, MoltenVK
// here), a performance notice that loosens the notices site alone, as `fetch_ordered`'s
// does.
let mut allowances = vec![crate::replay::shared_memory_notice()];
if self.state.reads_destination_alpha_in_color() {
allowances.push(crate::replay::notice_allowance(
Degradation::FetchThroughScratch.code(),
));
}
allowances
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -17,18 +17,15 @@
//! cosmetic: lavapipe does not render 2 samples, which Vulkan leaves optional, and the lane's own
//! loop prints a line and carries on, leaving nothing compared and nothing counted.
//!
//! **The honest gap.** `d32-wide-4` fills a depth texture with the 16-byte pattern, so its samples
//! are depths outside `[0, 1]`. On a device whose depth copies go by a draw, the draw announces
//! that it changes such values (`drawn-depth-copy`), and the probe's lines are not what comes back
//! — so the lane committed that row's digest alone and compares the digest where the notice fired.
//! The ported case keeps that shape exactly: a digest-only site, with the notice named as what
//! justifies leaving it unchecked. It is not recoverable on this host and the port does not pretend
//! otherwise.
//! **The digest-only row.** `d32-wide-4` fills a depth texture with the 16-byte pattern, so its
//! samples are depths outside `[0, 1]`, and the lane committed that row's digest alone. The ported
//! case keeps that shape exactly: a digest-only site, compared by its digest. Its lines are not
//! recoverable on this host and the port does not pretend otherwise.
//!
//! Metal's answer is **carried** and re-recording is **forbidden**: Metal fills a texture through
//! private API.
use crate::allowance::{Allowance, Justification, Loosening};
use crate::allowance::Allowance;
use crate::case::{answered, call, Abort, Case, Failure, Input, MetalSource, Side};
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::measured::{hex_bytes, public_fixture};
@@ -66,7 +63,7 @@ const P32: &str = "00112233445566778899aabbccddeeff102132435465768798a9bacbdcedf
/// Depths in `[0, 1]`, one a sample: a denormal, 1, 0 and 0.25.
const DEPTHS: &str = "010000000000803f000000000000803e";
/// The one case whose depths lie outside `[0, 1]`, so a drawn depth copy changes them.
/// The one case whose depths lie outside `[0, 1]`, whose lines the lane kept as a digest alone.
const WIDE_DEPTH: &str = "d32-wide-4";
/// The digest the probe printed of `d32-wide-4`'s lines, which is all the lane keeps of it.
@@ -434,46 +431,15 @@ impl Case for SampleFills {
}
fn allowances(&self) -> Vec<Allowance> {
let mut allowances = Vec::new();
if self.digest_only() {
// The depths outside [0, 1]: where the device's depth copies go by a draw, the draw
// announces that it changes such values, and the probe's lines are not what comes
// back. The lane keeps the digest alone there, and so does this case: the site goes
// unchecked, named, counted and reported, with that notice as the justification.
allowances.push(Allowance::new(
format!("case/{}", site(self.row.name)),
Loosening::Unchecked,
Justification::Degradation(
crate::degradation::Degradation::DrawnDepthCopy
.code()
.to_owned(),
),
));
}
// What a multisample fill and its read-back announce on a device that needs them: the
// drawn depth copy, a shadowed texture view, and shared storage in system memory. Metal
// announces none of them, so the notices site differs on such a device, and the
// difference is justified where one of these fired. A depth texture's denormals and a
// `Depth32Float` target's signed test (`depth-denormals`, `signed-depth-test`) are the
// device's own answers, which the suite declares for every case
// A multisample fill and its read-back announce shared storage in system memory on a
// device without unified memory. Metal announces none, so the notices site differs on such
// a device, and the difference is justified where it fired. A depth texture's denormals
// and a `Depth32Float` target's signed test (`depth-denormals`, `signed-depth-test`) are
// the device's own answers, which the suite declares for every case
// (`crate::replay::NATIVE_NOTES`); every depth word still compares exactly.
use crate::degradation::Degradation as D;
for kind in [
D::DrawnDepthCopy,
D::SharedInSystemMemory,
D::ShadowedTextureView,
] {
allowances.push(notice_allowance(kind.code()));
}
// A 32-bit float depth row's fill reaches its depth image by an upload, which a device
// without `VK_EXT_depth_range_unrestricted` (MoltenVK on the M3 Max) clamps into [0, 1]
// and announces (`restricted-depth-upload`); measured there, the notices site is the
// whole of the difference of each of the four such rows, and the wide row's digest is
// unchecked above.
if matches!(self.row.format, 252 | 260) {
allowances.push(notice_allowance(D::RestrictedDepthUpload.code()));
}
allowances
vec![notice_allowance(
crate::degradation::Degradation::SharedInSystemMemory.code(),
)]
}
fn carried_transcript(&self) -> Result<Option<(u32, Transcript)>, String> {
@@ -247,16 +247,6 @@ const PASS_NOTICES: &[Degradation] = &[
// static note `PrecisionNote::DevicePointSize`, which the runtime's side announces as the
// pipeline state is made (the Iris Xe and lavapipe). Naming it loosens no byte.
Degradation::DevicePointSize,
// A device that resolves the multisampled attachment through a pass of its own rather than in
// the store. Announced on lavapipe, where the whole resolve is emulated; MoltenVK resolves in
// the store and announces nothing.
Degradation::ShaderResolve,
// The multisampled attachment of a `MultisampleResolve` store is Vulkan's `DONT_CARE`, which
// Apple's GPU is measured to leave at the earlier texels unless its tiler overflows. Announced
// on MoltenVK, where that driver fact holds. Nothing of this case reads the multisampled
// attachment -- the resolved texel is the whole answer, and it compares exactly -- so naming
// the kind declares what our side announced and loosens no byte.
Degradation::DontCareStore,
];
/// The three vertices of the probe's triangle, which covers what lies left of `edge`.
@@ -166,12 +166,8 @@ const FILL: u8 = 0xab;
///
/// Nothing a sampler does depends on the group size, and each family's is a **divisor of its lane
/// count** for one reason: a grid that is a whole number of threadgroups is one dispatch on every
/// device, whatever the runtime can do with a ragged one. A ragged grid takes Metal's single
/// dispatch where the kernel cannot observe its threadgroup partition and the exact split — a
/// `VkPipeline` and a barrier per region, announcing `metal2vulkan-degrade-split-dispatch` —
/// otherwise, and that is a notice about the dispatch rather than about the sampler. Dividing
/// exactly leaves every case here declaring no notice at all, so a notice from any row reads as
/// divergent at once.
/// device, whatever the runtime can do with a ragged one, so nothing about the dispatch stands
/// between a case and its sampler.
const AXIS_GROUP: u32 = 5;
/// The threads a group of the mip-filter family's dispatch: 16 lanes are four groups of four.
@@ -984,10 +980,9 @@ impl Case for SamplerCrossings {
allowances.push(crate::replay::swizzled_border_notice());
}
if matches!(self.family, Family::CompareFilters) {
use crate::degradation::Degradation as D;
for kind in [D::RestrictedDepthUpload, D::RestrictedDepthRange] {
allowances.push(crate::replay::notice_allowance(kind.code()));
}
allowances.push(crate::replay::notice_allowance(
crate::degradation::Degradation::RestrictedDepthRange.code(),
));
}
allowances
}
@@ -889,19 +889,12 @@ impl Case for SamplerFiltering {
Degradation::BicubicFilterArithmetic.code(),
));
}
// A `compare` row's `Depth32Float` texture: on a device without
// `VK_EXT_depth_range_unrestricted` (MoltenVK on the M3 Max) its upload clamps into
// [0, 1] (`restricted-depth-upload`) and the comparing stage records that its texels hold
// no value outside it (`restricted-depth-range`). Every texel of the family lies in
// [0, 1], so neither moves a sample: measured there, the notices site is the whole of the
// difference of each of the eight rows.
// A `compare` row's comparing stage records that its texels hold no value outside
// [0, 1] (`restricted-depth-range`). Every texel of the family lies in [0, 1], so it moves
// no sample: measured on the M3 Max, the notices site is the whole of the difference of
// each of the eight rows.
if matches!(self.family, Family::Compare(_)) {
for kind in [
Degradation::RestrictedDepthUpload,
Degradation::RestrictedDepthRange,
] {
named.push(notice_allowance(kind.code()));
}
named.push(notice_allowance(Degradation::RestrictedDepthRange.code()));
}
named
}
@@ -38,7 +38,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -240,21 +239,10 @@ impl Case for ShaderStencil {
}
fn allowances(&self) -> Vec<Allowance> {
// Exact: every stencil byte Metal leaves is a byte we must leave. A device without
// `VK_EXT_shader_stencil_export` runs the shader-side stencil instead, which is a route
// and not a difference -- it must still answer Metal's bytes, so it gets no loosening
// here. The route is **declared** rather than loosened, which is what lets the case be
// read on a device that takes it.
//
// All three were measured firing for both rows on the RTX 5080: the shader-side stencil
// itself (`shader-side-stencil`), the render pass that route splits
// (`render-pass-split`), and the `Shared` buffer the pass reads its stencil back through
// ([`crate::replay::shared_memory_notice`]).
vec![
crate::replay::notice_allowance(Degradation::ShaderSideStencil.code()),
crate::replay::notice_allowance(Degradation::RenderPassSplit.code()),
crate::replay::shared_memory_notice(),
]
// Exact: every stencil byte Metal leaves is a byte we must leave. The one declaration is
// the `Shared` buffer the pass reads its stencil back through
// ([`crate::replay::shared_memory_notice`]), measured firing for both rows on the RTX 5080.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -159,9 +159,9 @@ impl Case for Lockstep {
// [`crate::replay::shared_memory_notice`] is for. And both kernels hold simdgroup-scoped
// accesses inside divergent loops, so on a device whose answer lacks maximal reconvergence
// (`shaderMaximalReconvergence`, the SIMD groups' query form) the stage carries its static
// note, `DeviceReconvergence`, which the sides announce as
// `implementation-defined-reconvergence`. The device's answer decides it: a device with
// maximal reconvergence announces nothing, and this declaration then holds nowhere.
// note, `DeviceReconvergence`, which the sides announce as `device-reconvergence`. The
// device's answer decides it: a device with maximal reconvergence announces nothing, and
// this declaration then holds nowhere.
vec![
Allowance::new(
"case/output",
@@ -172,7 +172,7 @@ impl Case for Lockstep {
),
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(
crate::degradation::Degradation::ImplementationDefinedReconvergence.code(),
crate::degradation::Degradation::DeviceReconvergence.code(),
),
]
}
@@ -46,8 +46,6 @@
//! `EXCLUDED` constant's own documentation.
use crate::case::{Abort, Case, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::replay::notice_allowance;
use crate::sparse_query::{SparseHeapSpec, SparseTextureSpec as T};
use crate::transcript::{Node, Observed, Sites, Value};
use metal2vulkan::metal::{PixelFormat, TextureType};
@@ -333,22 +331,6 @@ mod site {
pub const TEXTURE: &str = "texture";
}
/// The degrade notices a device may announce as it makes a sparse heap or a sparse texture.
///
/// Each gets an allowance over the notices site, so a venue that announced one may hold it in its
/// set while a venue that announced none compares the set exactly against Metal's empty one. The
/// set is genuinely per-venue and measured, not guessed: MoltenVK binds no sparse memory, so it
/// makes ordinary images and announces `emulated-sparse-texture`; lavapipe makes **real** sparse
/// images but is not `residencyNonResidentStrict`, so it announces `non-strict-residency`. Several
/// allowances on one path is the shape the suite already uses for this, and a difference is
/// justified where **any** of them holds.
const SPARSE_NOTICES: [Degradation; 4] = [
Degradation::EmulatedSparseTexture,
Degradation::NonStrictResidency,
Degradation::FirstSparseResourceWait,
Degradation::HostReadMappingArguments,
];
impl Case for SparseHeapCase {
fn name(&self) -> &'static str {
self.name
@@ -376,13 +358,6 @@ impl Case for SparseHeapCase {
])
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
SPARSE_NOTICES
.iter()
.map(|kind| notice_allowance(kind.code()))
.collect()
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
// The heap is the one call of the family that can stop the run: a device that cannot make
// a sparse heap refuses it typed, and every texture of the case would be a texture of a
@@ -90,8 +90,6 @@
use crate::allowance::Allowance;
use crate::case::{Abort, Case, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::replay::notice_allowance;
use crate::sparse_mapping::{MappingMode, MappingStep, SparseMappingProgram, TileGrid, TileRect};
use crate::sparse_query::{SparseHeapSpec, SparseTextureSpec};
use crate::transcript::{ByteLayout, Element, Node, Observed, Sites};
@@ -151,28 +149,6 @@ const FILL: u8 = 0xc3;
/// so "this tile lost its mapping" and "this tile is as it was" are two readings and not one.
const SLICE_FILLS: [u8; 4] = [0xc3, 0x3c, 0xa5, 0x5a];
/// The notices **every** row of the family takes.
///
/// A sparse texture is emulated wherever the device offers no sparse residency of its own — which
/// on this oracle's MoltenVK is every sparse texture — and the runtime announces that once per
/// texture. It is a device gap, announced honestly, so each row declares it and then compares
/// every number exactly; a venue with native sparse residency announces nothing and the
/// declaration simply does not fire there.
///
/// A device that *has* sparse residency announces the other of the pair instead:
/// `non-strict-residency` says the device does not guarantee that a read of an unmapped tile
/// answers zero, where Metal's sparse texture does. Both are the device's own and neither loosens
/// a number: every row still compares each texel and each count with Metal's exactly, so a texel
/// a non-strict read moved would be this family's finding and not its tolerance.
///
/// Measured on llvmpipe (LLVM 23.1.1, 256 bits, Mesa 26.2.4) in a whole-suite replay: all nine
/// rows announce `non-strict-residency`, and eight of them announce no
/// `emulated-sparse-texture` at all, which is the declaration that leaves the other unfired.
const EVERY_ROWS_NOTICES: [Degradation; 2] = [
Degradation::EmulatedSparseTexture,
Degradation::NonStrictResidency,
];
/// A single-sampled 2D sparse texture of [`WIDTH`] by [`WIDTH`].
fn plain() -> SparseTextureSpec {
SparseTextureSpec::texture_2d(FORMAT, [WIDTH, WIDTH], LEVELS)
@@ -221,10 +197,6 @@ struct Row {
case: &'static str,
/// The program the row runs, built with no device at all so a guard can read it.
program: fn() -> SparseMappingProgram,
/// The notices the row takes **beyond** [`EVERY_ROWS_NOTICES`], each a degradation the
/// runtime announces on the path this row alone drives. Empty for every row but the indirect
/// one.
notices: &'static [Degradation],
}
/// The program a row states, over `textures`, with `buffers`, `fences` and `steps`.
@@ -267,7 +239,6 @@ fn update(mode: MappingMode, region: TileRect, level: u64, slice: u64) -> Vec<Ma
/// sweep a measurement rather than five encodings of one answer.
static MODES_AND_SIZES: Row = Row {
case: "sparse-mapping-modes-and-region-sizes",
notices: &[],
program: || {
let mut steps = Vec::new();
for mode in MappingMode::ALL {
@@ -298,7 +269,6 @@ static MODES_AND_SIZES: Row = Row {
/// our side refuses it and an abort there would leave every number below uncompared.
static LEVELS_AND_THE_TAIL: Row = Row {
case: "sparse-mapping-levels-and-the-tail",
notices: &[],
program: || {
let mut steps = Vec::new();
for level in [0, 1, 2] {
@@ -347,7 +317,6 @@ static LEVELS_AND_THE_TAIL: Row = Row {
/// of [`LEVELS_AND_THE_TAIL`].
static A_LEVEL_PAST_THE_TEXTURES: Row = Row {
case: "sparse-mapping-a-level-past-the-textures",
notices: &[],
program: || {
program(
vec![plain()],
@@ -392,7 +361,6 @@ static A_LEVEL_PAST_THE_TEXTURES: Row = Row {
/// still of a tile the program itself mapped.
static A_SLICE_PAST_THE_TEXTURES: Row = Row {
case: "sparse-mapping-a-slice-past-the-textures",
notices: &[],
program: || {
// The two tiles of level 0 each real slice holds mapped: the second is the one the
// out-of-bounds `Unmap` names.
@@ -463,7 +431,6 @@ static A_SLICE_PAST_THE_TEXTURES: Row = Row {
/// slice 0 for both reads the first rise twice and the case moves.
static SLICES_OF_AN_ARRAY: Row = Row {
case: "sparse-mapping-slices-of-an-array",
notices: &[],
program: || {
let mut steps = Vec::new();
for slice in 0..SLICES as u64 {
@@ -484,7 +451,6 @@ static SLICES_OF_AN_ARRAY: Row = Row {
/// over one element is the shape a side is most likely to read as a range of none.
static PLURAL_UPDATES: Row = Row {
case: "sparse-mapping-plural-updates",
notices: &[],
program: || {
let regions = vec![
(whole_level(0), 0, 0),
@@ -528,10 +494,6 @@ static PLURAL_UPDATES: Row = Row {
/// offset are both swept, and a count of 0 is the negative fact beside them.
static INDIRECT_UPDATES: Row = Row {
case: "sparse-mapping-indirect-updates",
// The runtime reads the indirect regions on the **host**, once the work before the update
// completed, and announces that it did. The case takes the notice and compares every number
// exactly; what it may not do is take a different number because of one, and it does not.
notices: &[Degradation::HostReadMappingArguments],
program: || {
let steps = vec![
// A count of 0 at offset 0: nothing maps.
@@ -622,7 +584,6 @@ fn indirect_arguments() -> Vec<u8> {
/// a mapped tile is the one that would raise it if an implementation took a page for it.
static MOVES: Row = Row {
case: "sparse-mapping-moves",
notices: &[],
program: || {
let one = [1, 1, 1];
let steps = vec![
@@ -839,7 +800,6 @@ fn move_of(from: [u64; 2], size: [u64; 2], to: [u64; 2]) -> MappingStep {
/// exactly that region, so the two agree here and the rows past an edge are where the run shows.
static MOVE_INSIDE_THE_LEVEL: Row = Row {
case: "sparse-mapping-move-inside-the-level",
notices: &[],
program: || {
moved(
&[(SOURCE, TileRect::new([0, 0], [2, 2]))],
@@ -874,7 +834,6 @@ static MOVE_INSIDE_THE_LEVEL: Row = Row {
/// another implementation doing it.
static MOVE_PAST_THE_DESTINATIONS_ROW: Row = Row {
case: "sparse-mapping-move-past-the-destinations-row",
notices: &[],
program: || {
moved(
&[(SOURCE, TileRect::new([0, 0], [4, 1]))],
@@ -909,7 +868,6 @@ static MOVE_PAST_THE_DESTINATIONS_ROW: Row = Row {
/// maps a destination tile ahead of a move.
static MOVE_OF_A_SOURCE_PAST_THE_LEVEL: Row = Row {
case: "sparse-mapping-move-of-a-source-past-the-level",
notices: &[],
program: || {
moved(
&[
@@ -947,7 +905,6 @@ static MOVE_OF_A_SOURCE_PAST_THE_LEVEL: Row = Row {
/// the runtime and nothing held it; this row is what holds it.
static MOVE_OF_A_CLIPPED_SOURCE: Row = Row {
case: "sparse-mapping-move-of-a-clipped-source",
notices: &[],
program: || {
moved(
&[(SOURCE, TileRect::new([2, 2], [2, 2]))],
@@ -972,7 +929,6 @@ static MOVE_OF_A_CLIPPED_SOURCE: Row = Row {
/// after it, [`mapped_tiles_hold_their_texels`], is where a mapping's effect is actually read.
static FENCES: Row = Row {
case: "sparse-mapping-fences",
notices: &[],
program: || {
let steps = vec![
MappingStep::One {
@@ -1008,7 +964,6 @@ static FENCES: Row = Row {
/// nobody here has measured.
static MAPPED_TEXELS: Row = Row {
case: "sparse-mapping-mapped-tiles-hold-their-texels",
notices: &[],
program: || {
let region = TileRect::one([0, 0]);
let steps = vec![
@@ -1075,27 +1030,15 @@ impl Case for SparseMappings {
fn allowances(&self) -> Vec<Allowance> {
// **No value is loosened**: every number and every byte of every row compares exactly. The
// only declarations are the notices a row's own path announces, which the runtime must be
// allowed to say; a notice a row does not declare reads as `UndeclaredNotice`, naming the
// code and the case, which is the loud form.
//
// Two kinds are declared beyond a row's own. A device that keeps a sparse texture's
// residency less strictly than Metal says so (`non-strict-residency`), which llvmpipe
// announced for every row of the family. And the `Shared` buffer a row that reads texels
// back carries ([`crate::replay::shared_memory_notice`]), which the RTX 5080 announced for
// the two rows that read any -- `sparse-mapping-mapped-tiles-hold-their-texels` and
// one declaration is the `Shared` buffer a row that reads texels back carries
// ([`crate::replay::shared_memory_notice`]), which the RTX 5080 announced for the two rows
// that read any -- `sparse-mapping-mapped-tiles-hold-their-texels` and
// `sparse-mapping-indirect-updates`. The rest answer mappings and numbers alone, so they
// allocate no such buffer and declare nothing for one.
let mut named: Vec<Allowance> = EVERY_ROWS_NOTICES
.iter()
.chain(self.row.notices)
.chain(std::iter::once(&Degradation::NonStrictResidency))
.map(|code| notice_allowance(code.code()))
.collect();
if reaches_a_shared_buffer(&(self.row.program)()) {
named.push(crate::replay::shared_memory_notice());
match reaches_a_shared_buffer(&(self.row.program)()) {
true => vec![crate::replay::shared_memory_notice()],
false => Vec::new(),
}
named
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -1281,22 +1224,15 @@ mod tests {
.inputs()
.unwrap_or_else(|why| panic!("{}: {why}", case.name()));
assert!(!inputs.is_empty(), "{}", case.name());
// Every row declares the notices every row takes and the one a device's own sparse
// residency provokes; the indirect row adds its own, and the two rows that reach a
// `Shared` buffer add the one a device's own memory model provokes. No value
// tolerance appears anywhere in this family.
// The two rows that reach a `Shared` buffer declare the one a device's own memory
// model provokes, and no other row declares anything. No value tolerance appears
// anywhere in this family.
let allowed = case.allowances();
let expects = EVERY_ROWS_NOTICES.len()
+ 1
+ match case.name() == INDIRECT_UPDATES.case {
true => INDIRECT_UPDATES.notices.len(),
false => 0,
}
+ usize::from(reaches_a_shared_buffer(&(EVERY_ROW
.iter()
.find(|row| row.case == case.name())
.expect("a row of the family")
.program)()));
let expects = usize::from(reaches_a_shared_buffer(&(EVERY_ROW
.iter()
.find(|row| row.case == case.name())
.expect("a row of the family")
.program)()));
assert_eq!(allowed.len(), expects, "{}", case.name());
for allowance in &allowed {
assert!(
@@ -221,36 +221,17 @@ impl Case for SrgbFetch {
}
fn allowances(&self) -> Vec<Allowance> {
// The notice set alone, never a texel: how a venue reaches the attachment is a route, and
// a route that costs more announces itself -- a scratch image through the pixel interlock
// (MoltenVK), a performance notice. Every byte compares exactly, which is the owner's rule
// for this family.
//
// A third route the same pass takes on lavapipe: an attachment it does not store back is
// Vulkan's `DONT_CARE` where the driver is measured to leave the earlier texels there,
// announced as `dont-care-store`. Measured on both rows of this module and on neither row
// of `super::fetch_ordered`, so it is named here and not there. It says nothing about the
// texels either -- every byte still compares exactly.
// The notice set alone, never a texel: every byte compares exactly, which is the owner's
// rule for this family.
//
// A venue with neither ordered fetch form reads the input attachment ordered between draws
// alone, announced `unordered-fetch-within-draw`; each draw is one fullscreen triangle,
// which overlaps itself nowhere, so every byte still compares exactly.
[
Degradation::FetchThroughScratch,
Degradation::DontCareStore,
Degradation::UnorderedFetchWithinDraw,
]
.iter()
.map(|notice| crate::replay::notice_allowance(notice.code()))
.chain([
// The buffer each pass reads its target back through is `Shared`
// ([`crate::replay::shared_memory_notice`]).
// which overlaps itself nowhere, so every byte still compares exactly. The buffer each
// pass reads its target back through is `Shared` ([`crate::replay::shared_memory_notice`]).
vec![
crate::replay::notice_allowance(Degradation::UnorderedFetchWithinDraw.code()),
crate::replay::shared_memory_notice(),
// Each draw after the first fetches in the pixel interlock what the one before
// wrote there ([`crate::replay::interlocked_split_notice`]).
crate::replay::interlocked_split_notice(),
])
.collect()
]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -25,7 +25,6 @@ use crate::case::{
call, made, Abort, Bindings, Case, Failure, Handle, Input, MetalSource, Side, StageInAttribute,
StageInLayout, StageInRegion, StageInput,
};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::transcript::{ByteLayout, Digest, Element, Gaps, Node, Observed, Region, Sites, Value};
@@ -501,19 +500,11 @@ impl Case for StageInRegions {
}
fn allowances(&self) -> Vec<Allowance> {
// The one row that sets its region indirectly reads that region on the host, because it is
// GPU memory the work before the dispatch may write, and the runtime announces that. The
// notice is a performance one: the words the row writes still compare exactly, and the
// only site loosened is the set of notices, which Metal holds empty. The allowance fails
// the case if the notice did not fire, so a row that stops reading the region on the host
// has to drop this line rather than carry a stale excuse.
// The second is the venue's own: the buffers this dispatch reads its arguments and writes
// its answer through are `Shared`, which a device with no unified memory keeps in system
// memory because that is the only memory both sides can reach.
vec![
crate::replay::notice_allowance(Degradation::HostReadDispatchArguments.code()),
crate::replay::shared_memory_notice(),
]
// The words the rows write compare exactly. The one declaration is the venue's own: the
// buffers this dispatch reads its arguments and writes its answer through are `Shared`,
// which a device with no unified memory keeps in system memory because that is the only
// memory both sides can reach.
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -84,13 +84,8 @@
//! sweep of either store action cannot make that claim.
//!
//! `resolve-stencil-under-depth-filters` states `MultisampleResolve` on both aspects and **not**
//! `StoreAndMultisampleResolve`, deliberately: a separate depth texture stored beside a separate
//! stencil one renders through a combined scratch image whose multisampled aspects are copied back
//! after the pass, and on a device whose fragment depth does not store a value unchanged that copy
//! is an announced near-equivalent (`Degradation::DrawnDepthCopy`). A resolving store that keeps
//! no samples needs no copy back, so
//! the cell asks about the resolve and nothing else. The store-action pair is already answered by
//! the case above it and by `resolve-depth-filters-4`.
//! `StoreAndMultisampleResolve`, deliberately: the cell asks about the resolve and nothing else.
//! The store-action pair is already answered by the case above it and by `resolve-depth-filters-4`.
//!
//! # What is not asked, and why
//!
@@ -122,7 +117,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -659,36 +653,10 @@ impl Case for StencilResolves {
fn allowances(&self) -> Vec<Allowance> {
// **No value is loosened**: every resolved byte and every resolved depth Metal leaves is
// one we must leave, and the whole declared set is notices. Each is a `Performance`
// degradation — a structurally different path to the same bits — and each is named with
// the shape of this case that provokes it, so a reader can tell a notice this family
// earns from one copied in.
let mut named = vec![
// The colour attachment nothing reads is stored `DontCare`, and a device whose
// `DontCare` store is not Metal's announces that it took the near-equivalent.
// Measured not to fire on MoltenVK, where the store is the device's own.
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
// The buffer each pass reads its resolved aspects back through is `Shared`
// ([`crate::replay::shared_memory_notice`], measured firing on the 5080).
crate::replay::shared_memory_notice(),
];
if self.has_depth() {
named.extend([
// The pair case's depth and stencil are **two textures**, which renders through a
// scratch image of the combined format: announced on every venue, and measured
// firing on MoltenVK.
crate::replay::notice_allowance(Degradation::SeparateDepthStencil.code()),
// And their two aspects resolve into two textures, which resolves one aspect at a
// time: announced on every venue, and measured firing on MoltenVK.
crate::replay::notice_allowance(Degradation::OneAspectResolve.code()),
// A device with no `MIN` or `MAX` depth resolve mode reaches Metal's depth
// through a draw after the pass rather than through the store. On MoltenVK the
// modes are the device's and this does not fire; on a device that lacks them the
// notice is what says the exact path ran.
crate::replay::notice_allowance(Degradation::ShaderResolve.code()),
]);
}
named
// one we must leave. The one declaration is the buffer each pass reads its resolved
// aspects back through, which is `Shared` ([`crate::replay::shared_memory_notice`],
// measured firing on the 5080).
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -127,7 +127,6 @@
use crate::allowance::Allowance;
use crate::case::{call, made, Abort, Case, Failure, Handle, Input, MetalSource, Side};
use crate::degradation::Degradation;
use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT};
use crate::recording::ShaderRef;
use crate::render::{
@@ -574,29 +573,10 @@ impl Case for ResolvedSample {
fn allowances(&self) -> Vec<Allowance> {
// **No value is loosened**: every resolved byte and every resolved depth Metal leaves is
// one we must leave, and the whole declared set is notices. Each is a `Performance`
// degradation — a structurally different path to the same bits — and each is named with
// the shape of this case that provokes it, so a reader can tell a notice this case earns
// from one copied in.
vec![
// The colour attachment nothing reads is stored `DontCare`, and a device whose
// `DontCare` store is not Metal's announces that it took the near-equivalent.
// Measured not to fire on MoltenVK, where the store is the device's own.
crate::replay::notice_allowance(Degradation::DontCareStore.code()),
// The stencil of the depth-picked sample, which no Vulkan resolve mode states: the
// `DepthResolvedSample` cells after `Min` and `Max` reach it on **every** venue,
// through the draws after the pass, and this notice firing is what says the exact
// path ran rather than only that the run passed. Measured firing on MoltenVK.
//
// `one-aspect-resolve` is deliberately **not** named: it is what a pass whose two
// aspects resolve into two textures earns, and this case's one attachment resolves
// both into one, so a run that announced it would be a finding rather than a notice
// this case justifies.
crate::replay::notice_allowance(Degradation::ShaderResolve.code()),
// The buffer the pass reads its resolved aspects back through is `Shared`
// ([`crate::replay::shared_memory_notice`], measured firing on the 5080).
crate::replay::shared_memory_notice(),
]
// one we must leave. The one declaration is the buffer each pass reads its resolved
// aspects back through, which is `Shared` ([`crate::replay::shared_memory_notice`],
// measured firing on the 5080).
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -26,9 +26,8 @@
//! four bytes (a texture-buffer fill pattern over 32752 bytes, which ends Metal's process, is a
//! case this round must not run).
use crate::allowance::{Allowance, Justification, Loosening};
use crate::allowance::Allowance;
use crate::case::{Abort, Case, Fill, Input, MetalSource, PlaneTexture, Side};
use crate::degradation::Degradation;
use crate::recording::ShaderRef;
use crate::replay::NOTICES_SITE;
use crate::transcript::{
@@ -453,31 +452,10 @@ impl Case for SurfaceFills {
}
fn allowances(&self) -> Vec<Allowance> {
// Metal announces nothing, so the notices site is the one field that may differ. A texture
// over a buffer's padded rows is kept as an exact shadow copy, which the device announces;
// a color packed in a format Metal packs no color in fills the command buffer's last
// packed texel, which it announces too. Each names its own kind, and only the one that
// fired on a run justifies that run's difference.
[
Degradation::ShadowedTexture,
Degradation::ShadowedTextureView,
Degradation::UnnamedShadowedTexture,
Degradation::UnpackedFillColor,
]
.into_iter()
.map(|kind| {
Allowance::new(
format!("case/{NOTICES_SITE}/*"),
Loosening::Unchecked,
Justification::notice(kind),
)
})
.chain([
// The buffer the case reads the filled surfaces back through is `Shared`
// ([`crate::replay::shared_memory_notice`]).
crate::replay::shared_memory_notice(),
])
.collect()
// Metal announces nothing, so the notices site is the one field that may differ: the
// buffer the case reads the filled surfaces back through is `Shared`
// ([`crate::replay::shared_memory_notice`]).
vec![crate::replay::shared_memory_notice()]
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -229,21 +229,7 @@ impl Case for SurfaceTextures {
fn allowances(&self) -> Vec<Allowance> {
// The GPU read lands in a `Shared` buffer, which is what
// [`crate::replay::shared_memory_notice`] is for; it loosens the notices site alone.
//
// The old runtime lays the plane's texture over a buffer, and where the device's own
// linear image does not lie at the plane's pitch it reads and writes the texels through
// a copy, which it announces once per device (`shadowed-texture`). Metal announces
// nothing, so the notices site differs wherever the copy is taken, and the notice is
// what justifies it; it too loosens the notices site alone. Measured on the Radeon 780M
// (RADV PHOENIX, 53559): the four plane cases, whose rows are 64 and 128 bytes, take the
// copy and the two with 256- and 512-byte rows do not; lavapipe takes it for none.
// metal2vulkan-runtime announces neither: it counts its surface forms instead.
vec![
crate::replay::shared_memory_notice(),
crate::replay::notice_allowance(
crate::degradation::Degradation::ShadowedTexture.code(),
),
]
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -56,11 +56,10 @@
//! three readings now have a measurement behind them — the answers these cases recorded are
//! Metal's own, on the venue they were recorded on.
//!
//! `tessellation-triangle-order` and `emulated-tessellation-draws` are named too, for the venues
//! that announce them: a device whose tessellator is not Apple's orders a patch's triangles its own
//! way, and a device without `tessellationShader` draws the emulation's. Neither can move a mark,
//! because a mark is a set member and not a position in a triangle stream; they are named because
//! a notice our run announces that no case names is a divergence. Neither fired on MoltenVK over an
//! `tessellation-triangle-order` is named too, for the venues that announce it: a device whose
//! tessellator is not Apple's orders a patch's triangles its own way. It cannot move a mark,
//! because a mark is a set member and not a position in a triangle stream; it is named because a
//! notice our run announces that no case names is a divergence. It did not fire on MoltenVK over an
//! Apple M3 Max, which is what says that venue draws a patch through Metal's own tessellator.
//!
//! # What the recorded answers settle
@@ -329,12 +328,11 @@ fn marks_layout(offset: u64) -> ByteLayout {
/// The notices every tessellation pipeline of ours can announce, which every case here names.
///
/// The first two are unconditional on a tessellation pipeline. The last two are a venue's: a device
/// whose tessellator is not Apple's announces `tessellation-triangle-order`, and one without
/// `tessellationShader` announces `emulated-tessellation-draws`. Neither fires on MoltenVK over an
/// Apple GPU (verified: the replay of `tessellation-patch-indices` on an Apple M3 Max fired two of
/// the declarations and no other), and both are named so a run on a venue that does announce one
/// reads it as declared rather than as an undeclared divergence.
/// The first two are unconditional on a tessellation pipeline. The third is a venue's: a device
/// whose tessellator is not Apple's announces `tessellation-triangle-order`. It does not fire on
/// MoltenVK over an Apple GPU (verified: the replay of `tessellation-patch-indices` on an Apple M3
/// Max fired two of the declarations and no other), and it is named so a run on a venue that does
/// announce it reads it as declared rather than as an undeclared divergence.
///
/// `tessellation-factor-instance` is **not** here: only a per-instance factor step provokes it, and
/// only [`FactorSteps`] sets one, so naming it everywhere else would be a declaration no case could
@@ -344,7 +342,6 @@ pub(super) fn tessellation_notices() -> Vec<Allowance> {
Degradation::TessellationWinding,
Degradation::TessellationFactorEdgeCases,
Degradation::TessellationTriangleOrder,
Degradation::EmulatedTessellationDraws,
]
.into_iter()
.map(|notice| crate::replay::notice_allowance(notice.code()))
@@ -523,17 +523,9 @@ impl Case for ByteFills {
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// The fills whose last copy of the pattern is cut at the texel read the bytes past it and
// write them as zeros, as Metal's do, and the device announces it once. Metal announces
// nothing, so the notices site differs, and the notice is what justifies it.
vec![
crate::replay::notice_allowance(
crate::degradation::Degradation::TextureBufferFillLeftover.code(),
),
// The texture buffer these fills write into is backed by a `Shared` buffer
// ([`crate::replay::shared_memory_notice`]).
crate::replay::shared_memory_notice(),
]
// The texture buffer these fills write into is backed by a `Shared` buffer
// ([`crate::replay::shared_memory_notice`]).
vec![crate::replay::shared_memory_notice()]
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
@@ -662,17 +654,9 @@ impl Case for LongFills {
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// The fills whose last copy of the pattern is cut at the texel read the bytes past it and
// write them as zeros, as Metal's do, and the device announces it once. Metal announces
// nothing, so the notices site differs, and the notice is what justifies it.
vec![
crate::replay::notice_allowance(
crate::degradation::Degradation::TextureBufferFillLeftover.code(),
),
// The texture buffer these fills write into is backed by a `Shared` buffer
// ([`crate::replay::shared_memory_notice`]).
crate::replay::shared_memory_notice(),
]
// The texture buffer these fills write into is backed by a `Shared` buffer
// ([`crate::replay::shared_memory_notice`]).
vec![crate::replay::shared_memory_notice()]
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
@@ -576,26 +576,12 @@ impl Case for DescriptorPairs {
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// **No value is loosened**: every footprint and every getter of every row compares
// exactly with Metal's, and each allowance below sits at the notices site alone.
//
// `heap-texture-larger-than-metal`, for every row of the four: a heap texture the device
// lays out its own way needs more of the heap's bytes than Metal's does, and the runtime
// says so rather than reporting Metal's number for its own image. Measured firing for all
// four rows on llvmpipe and on the RTX 5080.
let mut named = vec![crate::replay::notice_allowance(
crate::degradation::Degradation::HeapTextureLargerThanMetal.code(),
)];
// exactly with Metal's, and each notice below sits at the notices site alone.
let mut named = Vec::new();
if self.name == USAGE {
// The usage table names compressed formats, which a device with no Vulkan format for
// one reads through a decoded twin carried beside the blocks. Measured firing for this
// row alone, on both venues. It sits at the notices site alone. The row reads no twin,
// so a twin's precision (`decoded-texel-precision`, announced at a command's first
// read of it) is not declared.
named.push(crate::replay::notice_allowance(
crate::degradation::Degradation::CarriedDecodedTwin.code(),
));
// A compressed texture the device holds itself announces the device's decode of its
// blocks (`compressed-texel-decode`), which the row never reads either.
// The usage table names compressed formats: a compressed texture the device holds
// itself announces the device's decode of its blocks (`compressed-texel-decode`),
// which the row never reads.
named.push(crate::replay::notice_allowance(
crate::degradation::Degradation::CompressedTexelDecode.code(),
));
@@ -606,30 +592,6 @@ impl Case for DescriptorPairs {
// firing for this row alone, on the 5080.
named.push(crate::replay::shared_memory_notice());
}
// A table that asks for a texture of a memoryless TEXTURE BUFFER descriptor, which plain
// Metal makes: its texels are a buffer's bytes, and no Vulkan buffer takes memory lazily,
// so the runtime lies over a `Private` buffer of the row's bytes and says so. Metal
// announces nothing, because the memory is its own business, so the notice is a difference
// and this declaration is what accounts for it.
//
// It loosens no value. Every getter of the row compares exactly with Metal's -- the
// texture answers the descriptor's memoryless mode as Metal's does -- and the whole of
// what the declaration covers is the announcement. The cost is bytes nothing reaches: a
// command that uses a memoryless texture fails its command buffer, as plain Metal's does.
//
// Selected by the table's own descriptors and not by the case's name, so a table that
// gains such a row declares it and one that loses it stops declaring it.
let memoryless_texture_buffer = self.asks == Asks::FootprintAndGetters
&& (self.queries.iter()).any(|query| {
query.texture_type == TextureType::TextureBuffer
&& query.storage == Storage::Memoryless
});
if memoryless_texture_buffer {
named.push(crate::replay::notice_allowance(
crate::degradation::Degradation::MemorylessTextureBuffer.code(),
));
}
// The runtime's answers are the device's own, held by their property and not by
// Metal's numbers (`texture_query::DEVICE_OWN_SIZES`).
named.extend(self.queries.iter().map(|query| {
@@ -785,46 +747,6 @@ impl Case for HeapTextureGetters {
MetalSource::Run
}
fn allowances(&self) -> Vec<crate::allowance::Allowance> {
// `heap-texture-lossless-layout` is announced as each of these textures is made: Metal
// lays a heap texture it keeps losslessly compressed out in the heap's bytes in a way the
// device's image does not reproduce, so the runtime places the texture's own tiles
// otherwise and says so. Metal announces nothing, because the layout is Metal's own, so
// the notice is a difference and the declaration is what accounts for it.
//
// It loosens no value. Every `MTLResource` getter of every row compares exactly with
// Metal's, and the whole of what the declaration covers is the announcement: this case
// reads where a texture lives and what may be done to it, never a byte of its contents,
// so a layout of the heap's bytes is not something any site of it can observe. A case that
// reads a heap texture's texels is a case of its own and would have to compare them.
//
// The notice is announced once per device per kind, so which case of a whole-set run
// provokes it depends on what ran before; measured announced by this case on an Apple M3
// Max under macOS 27.0.1, in the run this declaration was taken from.
//
// Two more, both measured firing for this row on llvmpipe and on the RTX 5080 and both
// about the same layout rather than about a value: a heap texture the device lays out its
// own way needs more of the heap's bytes than Metal's does
// (`heap-texture-larger-than-metal`), and it is laid out untiled where Metal tiles it
// (`heap-texture-untiled-layout`).
//
// A fourth, `shadowed-texture`, is the end of the same layout: where the device's image
// cannot lie over the heap's bytes at all, the texture's texels are copied into an image
// before each use and back after each write. It is a cost rather than a value -- this
// case still reads only where a texture lives and what may be done to it -- and it was
// measured firing for this row on llvmpipe (LLVM 23.1.1, 256 bits, Mesa 26.2.4) in a
// whole-suite replay.
[
crate::degradation::Degradation::HeapTextureLosslessLayout,
crate::degradation::Degradation::HeapTextureLargerThanMetal,
crate::degradation::Degradation::HeapTextureUntiledLayout,
crate::degradation::Degradation::ShadowedTexture,
]
.iter()
.map(|kind| crate::replay::notice_allowance(kind.code()))
.collect()
}
fn inputs(&self) -> Result<Vec<Input>, String> {
let mut words = Vec::new();
for heap in heaps() {
@@ -26,7 +26,7 @@
//! private API. The digests were measured on **an Apple M4**, not on this M3 Max, which the
//! recording's provenance says in words.
use crate::allowance::{Allowance, Justification, Loosening};
use crate::allowance::Allowance;
use crate::case::{answered, made, Abort, Case, Failure, Input, MetalSource, Side};
use crate::replay::{notice_allowance, NOTICES_SITE};
use crate::transcript::{
@@ -713,49 +713,17 @@ impl Case for TextureFills {
}
fn allowances(&self) -> Vec<Allowance> {
let mut allowances = Vec::new();
if matches!(self.raw, 252 | 260) {
// A 32-bit float depth's patterns may be depth outside [0, 1]
// (`Depth32Float_Stencil8`'s are). Where the device's uploads announce that it may
// store such a value clamped, the format's bytes are not Metal's to match: the lane
// skips the format there, and here the digest goes unchecked, named, counted and
// reported, with that notice as the justification.
allowances.push(Allowance::new(
format!("case/{}", site(self.raw)),
Loosening::Unchecked,
Justification::Degradation(
crate::degradation::Degradation::RestrictedDepthUpload
.code()
.to_owned(),
),
));
}
// What this work announces on a device that needs it, which is the lane's own list: a
// fill of a color packed where fills ignore the color, a carried texture's twin, a
// two-plane texture shadowed in a heap's bytes and a mipmapped one whose later levels lie
// apart from the shadow, the combined format's clamp, and shared storage in system memory.
// Metal announces none of them, so the notices site differs on such a device, and the
// difference is justified where one of these fired. A fill and its read-back by copies
// move a carried texture's blocks and read no twin, so its precision
// (`decoded-texel-precision`, announced at a command's first read of the twin) is not
// among them. A block-compressed texture's device decode, announced where the runtime
// makes it (`compressed-texel-decode`), is among them too: the fill reads bytes. A float
// depth's denormals are the device's own answer, which the suite declares for every case
// (`crate::replay::NATIVE_NOTES`). The format's own digest still compares, and only the
// 32-bit float depth formats' go unchecked, above.
// What this work announces on a device that needs it: a block-compressed texture's device
// decode, announced where the runtime makes it (`compressed-texel-decode`), and shared
// storage in system memory. Metal announces neither, so the notices site differs on such a
// device, and the difference is justified where one of these fired. A float depth's
// denormals are the device's own answer, which the suite declares for every case
// (`crate::replay::NATIVE_NOTES`). The format's own digest still compares.
use crate::degradation::Degradation as D;
for kind in [
D::UnpackedFillColor,
D::ShadowedTexture,
D::HeapTwoPlaneLayout,
D::RestrictedDepthUpload,
D::CarriedDecodedTwin,
D::CompressedTexelDecode,
D::SharedInSystemMemory,
] {
allowances.push(notice_allowance(kind.code()));
}
allowances
[D::CompressedTexelDecode, D::SharedInSystemMemory]
.into_iter()
.map(|kind| notice_allowance(kind.code()))
.collect()
}
fn carried_transcript(&self) -> Result<Option<(u32, Transcript)>, String> {
@@ -884,17 +852,11 @@ impl Case for TwoPlaneHeapFill {
MetalSource::Run
}
/// What the work announced on MoltenVK, measured: the two-plane texture is shadowed in the
/// heap's bytes, which is the whole point of the case. Metal announces nothing, so the notices
/// site differs and this is what names it; every byte of the heap still compares exactly.
/// What the work declares: every byte of the heap compares exactly, and the buffer this case
/// reads the filled planes back through is `Shared`, which a device with no unified memory
/// keeps in system memory because that is the only memory both sides can reach.
fn allowances(&self) -> Vec<Allowance> {
// The second is the venue's own: the buffer this case reads the filled planes back
// through is `Shared`, which a device with no unified memory keeps in system memory
// because that is the only memory both sides can reach.
vec![
notice_allowance(crate::degradation::Degradation::ShadowedTexture.code()),
crate::replay::shared_memory_notice(),
]
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -104,12 +104,6 @@ const EVEN_SHAPES: &[&[[u32; 2]]] = &[
/// answers, such as the NaN encoding it copies the blur's `RGBA16Float` attachment with
/// (`device-nan-encoding`), are the suite's to declare ([`crate::replay::NATIVE_NOTES`]).
pub const TILE_PASS_NOTICES: &[Degradation] = &[
// The attachments a tile dispatch stages are copied into its scratch before the dispatch and
// back after it (`render/tile_dispatch.rs`), which is what a tile dispatch costs on a device
// whose imageblock is not Metal's.
Degradation::TileDispatchScratch,
// The pass is split at the barrier the tile dispatch's scratch needs.
Degradation::RenderPassSplit,
// A device that splits a fragment quad at a clipped edge where Metal keeps it whole. Announced
// on lavapipe. Nothing of these cases reads a quad's grouping -- the tile order is the answer,
// and it compares exactly -- so the kind is declared and no value is loosened.
@@ -39,7 +39,7 @@
use crate::allowance::Allowance;
use crate::case::{answered, call, Abort, Case, Input, MetalSource, Side};
use crate::measured::hex_bytes;
use crate::replay::{notice_allowance, NOTICES_SITE};
use crate::replay::NOTICES_SITE;
use crate::transcript::{Digest, DigestKind, Node, Observed, Sites, Transcript, Value};
use crate::work::{Plane, Rect, Resource, Step, Storage, TextureSpec, Work};
@@ -424,28 +424,11 @@ impl Case for RowBlits {
}
fn allowances(&self) -> Vec<Allowance> {
// Every case declares the notice the venue's own memory model provokes: the buffer it
// reads the copied planes back through is `Shared`, which a device with no unified memory
// keeps in system memory because that is the only memory both sides can reach.
let shared = crate::replay::shared_memory_notice();
if !self.announced {
// Three of the blits place their texture in a placement heap, where this device keeps
// the two-plane texture's texels in the heap's bytes and announces it. Metal announces
// nothing, so the notices site differs and that notice is what justifies it. Every
// word still compares exactly.
return vec![
notice_allowance(crate::degradation::Degradation::ShadowedTexture.code()),
shared,
];
}
// Into the texture, where rows meet and Metal's own order varies from run to run, the
// device says which row's bytes it kept. Metal announces nothing, so the notices site
// differs; the two notices are what justify it. The words still compare exactly.
vec![
notice_allowance(crate::degradation::Degradation::TwoPlaneBufferBlit.code()),
notice_allowance(crate::degradation::Degradation::TwoPlaneBufferBlitOrder.code()),
shared,
]
// Every word compares exactly. Every case declares the notice the venue's own memory model
// provokes: the buffer it reads the copied planes back through is `Shared`, which a device
// with no unified memory keeps in system memory because that is the only memory both sides
// can reach.
vec![crate::replay::shared_memory_notice()]
}
fn carried_transcript(&self) -> Result<Option<(u32, Transcript)>, String> {
@@ -670,16 +653,9 @@ impl Case for PadFills {
}
fn allowances(&self) -> Vec<Allowance> {
// A fill into a two-plane texture's planes goes through the device's two-plane buffer
// blit, which it announces. Metal announces nothing, so the notices site differs and that
// notice is what justifies it; every digest still compares exactly. The sibling row blits
// name this notice for the same reason, and the order notice besides, which a fill of
// whole rows never meets.
vec![
notice_allowance(crate::degradation::Degradation::TwoPlaneBufferBlit.code()),
// The venue's own, for the `Shared` read-back buffer, as the row blits state.
crate::replay::shared_memory_notice(),
]
// Every digest compares exactly. The venue's own, for the `Shared` read-back buffer, as
// the row blits state.
vec![crate::replay::shared_memory_notice()]
}
fn inputs(&self) -> Result<Vec<Input>, String> {
@@ -42,7 +42,7 @@
use crate::allowance::Allowance;
use crate::case::{call, Abort, Case, Input, MetalSource, Side};
use crate::measured::public_fixture;
use crate::replay::{notice_allowance, NOTICES_SITE};
use crate::replay::NOTICES_SITE;
use crate::transcript::{Digest, DigestKind, Node, Observed, Sites, Transcript, Value};
use crate::work::{Resource, Step, Storage, TextureSpec, Work};
@@ -574,27 +574,9 @@ impl Case for HeapBlits {
}
fn allowances(&self) -> Vec<Allowance> {
// A copy whose alpha bytes land past the destination's alpha plane, on the heap's other
// bytes, and in `end255` past the heap's end, is what Metal's blit writes and what the
// device announces. Metal announces nothing, so the notices site differs and that notice
// is what justifies it.
//
// These textures are also shadowed, and the notice's own definition names this exact
// shape: a heap's 2D texture of one level of `RGB10A8_2P_XR10` or its sRGB twin has an
// image that is a shadow of its two planes in the heap's bytes, where Metal lays them out.
// Declaring it loosens no byte -- every heap byte the case reads compares exactly.
[
crate::degradation::Degradation::TwoPlaneTextureCopy,
crate::degradation::Degradation::ShadowedTexture,
]
.into_iter()
.map(|kind| notice_allowance(kind.code()))
.chain([
// The buffer the case reads the blitted planes back through is `Shared`
// ([`crate::replay::shared_memory_notice`]).
crate::replay::shared_memory_notice(),
])
.collect()
// Every heap byte the case reads compares exactly. The buffer the case reads the blitted
// planes back through is `Shared` ([`crate::replay::shared_memory_notice`]).
vec![crate::replay::shared_memory_notice()]
}
fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> {
@@ -13,12 +13,8 @@
//! the recordings against the lane's words, which is the evidence the port owes the lane. A fresh
//! answer that disagrees with the lane is a finding about one of the two chips, not a nuisance.
//!
//! Every word compares exactly but a `Boolean` result's: the M3 Max writes 1 where a sample
//! passed, and the runtime the device's own nonzero value, which it announces
//! (`device-boolean-visibility`), whose documentation states the bound the comparison holds: zero
//! exactly where Metal's word is zero ([`Loosening::Nonzero`] at that word alone, `boolean_words`).
//! Not a native note of the suite's set: the note's bound is exact, so a case names it at the
//! words it loosens.
//! Every word compares exactly, a `Boolean` result's included: the M3 Max writes 1 where a sample
//! passed.
//!
//! The shapes, each its own case so a device that lacks precise occlusion queries loses only the
//! counted rows:
@@ -80,7 +76,6 @@ use crate::transcript::{ByteLayout, Digest, Element, Node, Observed, Sites, Valu
use crate::values::{StoreAction, VisibilityResultMode, VisibilityResultType};
use metal2vulkan::metal::state::DepthStencilDescriptor;
use metal2vulkan::metal::{CompareFunction, PixelFormat, PrimitiveType};
use std::collections::BTreeSet;
/// The owned fixture the lane draws with: `rt6_full` takes a depth and a slope as one `float2` at
/// vertex buffer 0, and `rt6_white` returns white.
@@ -535,42 +530,8 @@ pub fn all() -> Vec<Visibility> {
const PASS_NOTICES: &[Degradation] = &[
// A `Shared` buffer the device keeps in system memory, which the visibility buffer is.
Degradation::SharedInSystemMemory,
// The multisampled attachment of a `MultisampleResolve` store, and a `DontCare` store, are
// Vulkan's `DONT_CARE` on a driver measured to leave the earlier texels there. Nothing of
// these cases reads a colour attachment -- the visibility result is the answer, and it is
// compared exactly -- so naming the kind declares what our side announced and loosens no byte.
Degradation::DontCareStore,
];
/// Each read's `Boolean` results, as (the pass's index, the result's offset): the offsets whose
/// last mode set, in that pass or one before it, is `Boolean`, which the pass's `words` site holds,
/// at each pass the words are read after ([`groups`]).
fn boolean_words(shape: &Shape) -> Vec<(usize, u64)> {
let read: Vec<usize> = groups(shape)
.iter()
.filter_map(|g| g.last().copied())
.collect();
let mut held: BTreeSet<u64> = BTreeSet::new();
let mut out = Vec::new();
for (index, acts) in shape.passes.iter().enumerate() {
for act in *acts {
match act {
Act::Mode(BOOL, offset) => {
held.insert(*offset);
}
Act::Mode(COUNT, offset) => {
held.remove(offset);
}
Act::Mode(..) | Act::Draw { .. } | Act::DrawIndirect => {}
}
}
if read.contains(&index) {
out.extend(held.iter().map(|&offset| (index, offset)));
}
}
out
}
/// The shape's passes by command buffer, as indices: all in one where it is `joined`, else one
/// each.
fn groups(shape: &Shape) -> Vec<Vec<usize>> {
@@ -834,10 +795,9 @@ impl Case for Visibility {
}
fn allowances(&self) -> Vec<Allowance> {
// The notices site, and each `Boolean` result's word by its contract (the module docs): a
// visibility result is a number Metal wrote, and any other number that differs is a bug,
// not a near-equivalent. Nothing else here is loosened.
let mut all: Vec<Allowance> = PASS_NOTICES
// The notices site alone: a visibility result is a number Metal wrote, and any number
// that differs is a bug, not a near-equivalent.
PASS_NOTICES
.iter()
.map(|kind| {
Allowance::new(
@@ -846,21 +806,7 @@ impl Case for Visibility {
Justification::notice(*kind),
)
})
.collect();
let booleans = boolean_words(self.shape);
if !booleans.is_empty() {
all.push(crate::replay::notice_allowance(
Degradation::DeviceBooleanVisibility.code(),
));
}
for (index, offset) in booleans {
all.push(Allowance::new(
format!("case/pass-{index}/words/{offset}"),
Loosening::Nonzero,
Justification::notice(Degradation::DeviceBooleanVisibility),
));
}
all
.collect()
}
fn shaders(&self) -> Result<Vec<ShaderRef>, String> {
@@ -1266,13 +1212,12 @@ mod tests {
}
/// Every case of the family is in the table, states its inputs, and loosens **only** its
/// notices site and its `Boolean` results' words, each by its contract alone.
/// notices site.
///
/// A visibility result is a number Metal wrote; a number that differs is a bug, never a
/// near-equivalent, but that a `Boolean` result's nonzero value is the device's. A case that
/// ever loosened another word, or a `Boolean` one by more than its contract, would fail here.
/// near-equivalent. A case that ever loosened a word would fail here.
#[test]
fn every_case_is_tabled_and_loosens_its_notices_and_boolean_words_alone() {
fn every_case_is_tabled_and_loosens_its_notices_alone() {
for case in all() {
assert!(
TABLE.iter().any(|(name, _)| *name == case.name()),
@@ -1287,33 +1232,16 @@ mod tests {
);
assert_eq!(case.metal_source(), MetalSource::Run);
case.shaders().unwrap();
let words: Vec<String> = boolean_words(case.shape)
.iter()
.map(|(index, offset)| format!("case/pass-{index}/words/{offset}"))
.collect();
for allowance in case.allowances() {
if words.contains(&allowance.path) {
assert_eq!(allowance.loosening, Loosening::Nonzero, "{}", case.name());
assert_eq!(
allowance.justified_by,
Justification::notice(Degradation::DeviceBooleanVisibility),
"{}",
case.name()
);
continue;
}
assert_eq!(
allowance.path,
format!("case/{NOTICES_SITE}/*"),
"{}: an allowance outside the notices site and the Boolean words",
"{}: an allowance outside the notices site",
case.name()
);
match &allowance.justified_by {
Justification::Degradation(code) => assert!(
PASS_NOTICES
.iter()
.chain([&Degradation::DeviceBooleanVisibility])
.any(|kind| kind.code() == code),
PASS_NOTICES.iter().any(|kind| kind.code() == code),
"{}: {code} is not a visibility-pass notice",
case.name()
),
@@ -27,11 +27,9 @@
//! # The GPU pair is a `Result`, because one side may have no answer
//!
//! `GPUStartTime` and `GPUEndTime` need the device to write timestamps. The runtime refuses them
//! typed where its queue family writes none, and answers them from the host — announcing
//! `Degradation::GpuTimesFromHost` — where the driver's own timestamps wait for every queue's.
//! So [`CommandBufferFacts::gpu`] holds either the flags or the refusal, and a venue with no
//! timestamps records the refusal rather than four booleans derived from zeros. The kernel pair
//! needs no device at all and is always flags.
//! typed where its queue family writes none. So [`CommandBufferFacts::gpu`] holds either the flags
//! or the refusal, and a venue with no timestamps records the refusal rather than four booleans
//! derived from zeros. The kernel pair needs no device at all and is always flags.
//!
//! # Why the two owners are booleans too
//!
@@ -11,156 +11,24 @@ use metal2vulkan::pipeline::PrecisionNote;
/// A kind of degrade notice, by its code ([`Degradation::code`]).
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum Degradation {
/// `metal2vulkan-degrade-shadowed-texture`.
ShadowedTexture,
/// `metal2vulkan-degrade-unordered-draw-bytes`.
UnorderedDrawBytes,
/// `metal2vulkan-degrade-unorm-depth-rounding`.
UnormDepthRounding,
/// `metal2vulkan-degrade-biased-depth-past-unit-range`.
BiasedDepthPastUnitRange,
/// `metal2vulkan-degrade-fragments-before-geometry`.
FragmentsBeforeGeometry,
/// `metal2vulkan-degrade-indirect-index-bounds-pass`.
IndirectIndexBoundsPass,
/// `metal2vulkan-degrade-emulated-mesh-draws`.
EmulatedMeshDraws,
/// `metal2vulkan-degrade-emulated-tessellation-draws`.
EmulatedTessellationDraws,
/// `metal2vulkan-degrade-overlapping-buffer-copy`.
OverlappingBufferCopy,
/// `metal2vulkan-degrade-split-buffer-fill`.
SplitBufferFill,
/// `metal2vulkan-degrade-staged-texture-copy`.
StagedTextureCopy,
/// `metal2vulkan-degrade-overlapping-texel-copy`.
OverlappingTexelCopy,
/// `metal2vulkan-degrade-split-dispatch`.
SplitDispatch,
/// `metal2vulkan-degrade-separate-depth-stencil`.
SeparateDepthStencil,
/// `metal2vulkan-degrade-one-aspect-resolve`.
OneAspectResolve,
/// `metal2vulkan-degrade-shader-resolve`.
ShaderResolve,
/// `metal2vulkan-degrade-shader-color-conversion`.
ShaderColorConversion,
/// `metal2vulkan-degrade-render-pass-split`.
RenderPassSplit,
/// `metal2vulkan-degrade-memoryless-texture-buffer`.
MemorylessTextureBuffer,
/// `metal2vulkan-degrade-fetch-through-scratch`.
FetchThroughScratch,
/// `metal2vulkan-degrade-sample-planes`.
SamplePlanes,
/// `metal2vulkan-degrade-shader-side-stencil`.
ShaderSideStencil,
/// `metal2vulkan-degrade-tile-dispatch-scratch`.
TileDispatchScratch,
/// `metal2vulkan-degrade-host-replayed-indirect-commands`.
HostReplayedIndirectCommands,
/// `metal2vulkan-degrade-staged-indirect-records`.
StagedIndirectRecords,
/// `metal2vulkan-degrade-uncalibrated-gpu-times`.
UncalibratedGpuTimes,
/// `metal2vulkan-degrade-loosely-calibrated-gpu-times`.
LooselyCalibratedGpuTimes,
/// `metal2vulkan-degrade-gpu-times-from-host`.
GpuTimesFromHost,
/// `metal2vulkan-degrade-device-rounded-resolve`.
DeviceRoundedResolve,
/// `metal2vulkan-degrade-extended-range-resolve`.
ExtendedRangeResolve,
/// `metal2vulkan-degrade-dont-care-store`.
DontCareStore,
/// `metal2vulkan-degrade-dont-care-load-tiles`.
DontCareLoadTiles,
/// `metal2vulkan-degrade-fresh-pattern-zeroed`.
FreshPatternZeroed,
/// `metal2vulkan-degrade-implementation-defined-reconvergence`.
ImplementationDefinedReconvergence,
/// `metal2vulkan-degrade-restricted-depth-upload`.
RestrictedDepthUpload,
/// `metal2vulkan-degrade-host-read-dispatch-arguments`.
HostReadDispatchArguments,
/// `metal2vulkan-degrade-non-strict-residency`.
NonStrictResidency,
/// `metal2vulkan-degrade-host-read-mapping-arguments`.
HostReadMappingArguments,
/// `metal2vulkan-degrade-emulated-sparse-texture`.
EmulatedSparseTexture,
/// `metal2vulkan-degrade-device-reconvergence`.
DeviceReconvergence,
/// `metal2vulkan-degrade-shared-in-system-memory`.
SharedInSystemMemory,
/// `metal2vulkan-degrade-device-filtered-mipmaps`.
DeviceFilteredMipmaps,
/// `metal2vulkan-degrade-shadowed-texture-view`.
ShadowedTextureView,
/// `metal2vulkan-degrade-capped-lod-bias`.
CappedLodBias,
/// `metal2vulkan-degrade-unnamed-texture-unviewable`.
UnnamedTextureUnviewable,
/// `metal2vulkan-degrade-unnamed-shadowed-texture`.
UnnamedShadowedTexture,
/// `metal2vulkan-degrade-drawn-depth-copy`.
DrawnDepthCopy,
/// `metal2vulkan-degrade-heap-two-plane-layout`.
HeapTwoPlaneLayout,
/// `metal2vulkan-degrade-two-plane-texture-copy`.
TwoPlaneTextureCopy,
/// `metal2vulkan-degrade-extended-range-bits-kept`.
ExtendedRangeBitsKept,
/// `metal2vulkan-degrade-snorm-minimum-kept`.
SnormMinimumKept,
/// `metal2vulkan-degrade-shared-exponent-kept`.
SharedExponentKept,
/// `metal2vulkan-degrade-two-plane-buffer-blit`.
TwoPlaneBufferBlit,
/// `metal2vulkan-degrade-two-plane-buffer-blit-order`.
TwoPlaneBufferBlitOrder,
/// `metal2vulkan-degrade-set-past-layout-support`.
SetPastLayoutSupport,
/// `metal2vulkan-degrade-ycbcr-filter-not-exact`.
YCbCrFilterNotExact,
/// `metal2vulkan-degrade-rotated-load-tiles`.
RotatedLoadTiles,
/// `metal2vulkan-degrade-heap-texture-lossless-layout`.
HeapTextureLosslessLayout,
/// `metal2vulkan-degrade-heap-texture-untiled-layout`.
HeapTextureUntiledLayout,
/// `metal2vulkan-degrade-extended-range-blends-stored-codes`.
ExtendedRangeBlendsStoredCodes,
/// `metal2vulkan-degrade-compressed-texel-decode`.
CompressedTexelDecode,
/// `metal2vulkan-degrade-cpu-block-decode`.
CpuBlockDecode,
/// `metal2vulkan-degrade-carried-decoded-twin`.
CarriedDecodedTwin,
/// `metal2vulkan-degrade-decoded-texel-precision`.
DecodedTexelPrecision,
/// `metal2vulkan-degrade-heap-texture-larger-than-metal`.
HeapTextureLargerThanMetal,
/// `metal2vulkan-degrade-dont-care-stand-in`.
DontCareStandIn,
/// `metal2vulkan-degrade-copied-host-pages`.
CopiedHostPages,
/// `metal2vulkan-degrade-depth-denormals`.
DepthDenormals,
/// `metal2vulkan-degrade-signed-depth-test`.
SignedDepthTest,
/// `metal2vulkan-degrade-first-sparse-resource-wait`.
FirstSparseResourceWait,
/// `metal2vulkan-degrade-unpacked-fill-color`.
UnpackedFillColor,
/// `metal2vulkan-degrade-texture-buffer-fill-leftover`.
TextureBufferFillLeftover,
/// `metal2vulkan-degrade-device-line-ties`.
DeviceLineTies,
/// `metal2vulkan-degrade-device-subpixel-snap`.
DeviceSubpixelSnap,
/// `metal2vulkan-degrade-device-boolean-visibility`.
DeviceBooleanVisibility,
/// `metal2vulkan-degrade-float-tininess-after-rounding`.
FloatTininessAfterRounding,
/// `metal2vulkan-degrade-f16-fma-double-rounding`.
F16FmaDoubleRounding,
/// `metal2vulkan-degrade-f16-int-conv-double-rounding`.
@@ -326,81 +194,15 @@ pub enum Degradation {
impl Degradation {
/// Every kind, in declaration order.
pub const ALL: &'static [Degradation] = &[
Degradation::ShadowedTexture,
Degradation::UnorderedDrawBytes,
Degradation::UnormDepthRounding,
Degradation::BiasedDepthPastUnitRange,
Degradation::FragmentsBeforeGeometry,
Degradation::IndirectIndexBoundsPass,
Degradation::EmulatedMeshDraws,
Degradation::EmulatedTessellationDraws,
Degradation::OverlappingBufferCopy,
Degradation::SplitBufferFill,
Degradation::StagedTextureCopy,
Degradation::OverlappingTexelCopy,
Degradation::SplitDispatch,
Degradation::SeparateDepthStencil,
Degradation::OneAspectResolve,
Degradation::ShaderResolve,
Degradation::ShaderColorConversion,
Degradation::RenderPassSplit,
Degradation::MemorylessTextureBuffer,
Degradation::FetchThroughScratch,
Degradation::SamplePlanes,
Degradation::ShaderSideStencil,
Degradation::TileDispatchScratch,
Degradation::HostReplayedIndirectCommands,
Degradation::StagedIndirectRecords,
Degradation::UncalibratedGpuTimes,
Degradation::LooselyCalibratedGpuTimes,
Degradation::GpuTimesFromHost,
Degradation::DeviceRoundedResolve,
Degradation::ExtendedRangeResolve,
Degradation::DontCareStore,
Degradation::DontCareLoadTiles,
Degradation::FreshPatternZeroed,
Degradation::ImplementationDefinedReconvergence,
Degradation::RestrictedDepthUpload,
Degradation::HostReadDispatchArguments,
Degradation::NonStrictResidency,
Degradation::HostReadMappingArguments,
Degradation::EmulatedSparseTexture,
Degradation::DeviceReconvergence,
Degradation::SharedInSystemMemory,
Degradation::DeviceFilteredMipmaps,
Degradation::ShadowedTextureView,
Degradation::CappedLodBias,
Degradation::UnnamedTextureUnviewable,
Degradation::UnnamedShadowedTexture,
Degradation::DrawnDepthCopy,
Degradation::HeapTwoPlaneLayout,
Degradation::TwoPlaneTextureCopy,
Degradation::ExtendedRangeBitsKept,
Degradation::SnormMinimumKept,
Degradation::SharedExponentKept,
Degradation::TwoPlaneBufferBlit,
Degradation::TwoPlaneBufferBlitOrder,
Degradation::SetPastLayoutSupport,
Degradation::YCbCrFilterNotExact,
Degradation::RotatedLoadTiles,
Degradation::HeapTextureLosslessLayout,
Degradation::HeapTextureUntiledLayout,
Degradation::ExtendedRangeBlendsStoredCodes,
Degradation::CompressedTexelDecode,
Degradation::CpuBlockDecode,
Degradation::CarriedDecodedTwin,
Degradation::DecodedTexelPrecision,
Degradation::HeapTextureLargerThanMetal,
Degradation::DontCareStandIn,
Degradation::CopiedHostPages,
Degradation::DepthDenormals,
Degradation::SignedDepthTest,
Degradation::FirstSparseResourceWait,
Degradation::UnpackedFillColor,
Degradation::TextureBufferFillLeftover,
Degradation::DeviceLineTies,
Degradation::DeviceSubpixelSnap,
Degradation::DeviceBooleanVisibility,
Degradation::FloatTininessAfterRounding,
Degradation::F16FmaDoubleRounding,
Degradation::F16IntConvDoubleRounding,
Degradation::GradFromBias,
@@ -486,121 +288,15 @@ impl Degradation {
/// The kind's code, `metal2vulkan-degrade-<kind>`.
pub const fn code(self) -> &'static str {
match self {
Degradation::ShadowedTexture => "metal2vulkan-degrade-shadowed-texture",
Degradation::UnorderedDrawBytes => "metal2vulkan-degrade-unordered-draw-bytes",
Degradation::UnormDepthRounding => "metal2vulkan-degrade-unorm-depth-rounding",
Degradation::BiasedDepthPastUnitRange => {
"metal2vulkan-degrade-biased-depth-past-unit-range"
}
Degradation::FragmentsBeforeGeometry => {
"metal2vulkan-degrade-fragments-before-geometry"
}
Degradation::IndirectIndexBoundsPass => {
"metal2vulkan-degrade-indirect-index-bounds-pass"
}
Degradation::EmulatedMeshDraws => "metal2vulkan-degrade-emulated-mesh-draws",
Degradation::EmulatedTessellationDraws => {
"metal2vulkan-degrade-emulated-tessellation-draws"
}
Degradation::OverlappingBufferCopy => "metal2vulkan-degrade-overlapping-buffer-copy",
Degradation::SplitBufferFill => "metal2vulkan-degrade-split-buffer-fill",
Degradation::StagedTextureCopy => "metal2vulkan-degrade-staged-texture-copy",
Degradation::OverlappingTexelCopy => "metal2vulkan-degrade-overlapping-texel-copy",
Degradation::SplitDispatch => "metal2vulkan-degrade-split-dispatch",
Degradation::SeparateDepthStencil => "metal2vulkan-degrade-separate-depth-stencil",
Degradation::OneAspectResolve => "metal2vulkan-degrade-one-aspect-resolve",
Degradation::ShaderResolve => "metal2vulkan-degrade-shader-resolve",
Degradation::ShaderColorConversion => "metal2vulkan-degrade-shader-color-conversion",
Degradation::RenderPassSplit => "metal2vulkan-degrade-render-pass-split",
Degradation::MemorylessTextureBuffer => {
"metal2vulkan-degrade-memoryless-texture-buffer"
}
Degradation::FetchThroughScratch => "metal2vulkan-degrade-fetch-through-scratch",
Degradation::SamplePlanes => "metal2vulkan-degrade-sample-planes",
Degradation::ShaderSideStencil => "metal2vulkan-degrade-shader-side-stencil",
Degradation::TileDispatchScratch => "metal2vulkan-degrade-tile-dispatch-scratch",
Degradation::HostReplayedIndirectCommands => {
"metal2vulkan-degrade-host-replayed-indirect-commands"
}
Degradation::StagedIndirectRecords => "metal2vulkan-degrade-staged-indirect-records",
Degradation::UncalibratedGpuTimes => "metal2vulkan-degrade-uncalibrated-gpu-times",
Degradation::LooselyCalibratedGpuTimes => {
"metal2vulkan-degrade-loosely-calibrated-gpu-times"
}
Degradation::GpuTimesFromHost => "metal2vulkan-degrade-gpu-times-from-host",
Degradation::DeviceRoundedResolve => "metal2vulkan-degrade-device-rounded-resolve",
Degradation::ExtendedRangeResolve => "metal2vulkan-degrade-extended-range-resolve",
Degradation::DontCareStore => "metal2vulkan-degrade-dont-care-store",
Degradation::DontCareLoadTiles => "metal2vulkan-degrade-dont-care-load-tiles",
Degradation::FreshPatternZeroed => "metal2vulkan-degrade-fresh-pattern-zeroed",
Degradation::ImplementationDefinedReconvergence => {
"metal2vulkan-degrade-implementation-defined-reconvergence"
}
Degradation::RestrictedDepthUpload => "metal2vulkan-degrade-restricted-depth-upload",
Degradation::HostReadDispatchArguments => {
"metal2vulkan-degrade-host-read-dispatch-arguments"
}
Degradation::NonStrictResidency => "metal2vulkan-degrade-non-strict-residency",
Degradation::HostReadMappingArguments => {
"metal2vulkan-degrade-host-read-mapping-arguments"
}
Degradation::EmulatedSparseTexture => "metal2vulkan-degrade-emulated-sparse-texture",
Degradation::DeviceReconvergence => "metal2vulkan-degrade-device-reconvergence",
Degradation::SharedInSystemMemory => "metal2vulkan-degrade-shared-in-system-memory",
Degradation::DeviceFilteredMipmaps => "metal2vulkan-degrade-device-filtered-mipmaps",
Degradation::ShadowedTextureView => "metal2vulkan-degrade-shadowed-texture-view",
Degradation::CappedLodBias => "metal2vulkan-degrade-capped-lod-bias",
Degradation::UnnamedTextureUnviewable => {
"metal2vulkan-degrade-unnamed-texture-unviewable"
}
Degradation::UnnamedShadowedTexture => "metal2vulkan-degrade-unnamed-shadowed-texture",
Degradation::DrawnDepthCopy => "metal2vulkan-degrade-drawn-depth-copy",
Degradation::HeapTwoPlaneLayout => "metal2vulkan-degrade-heap-two-plane-layout",
Degradation::TwoPlaneTextureCopy => "metal2vulkan-degrade-two-plane-texture-copy",
Degradation::ExtendedRangeBitsKept => "metal2vulkan-degrade-extended-range-bits-kept",
Degradation::SnormMinimumKept => "metal2vulkan-degrade-snorm-minimum-kept",
Degradation::SharedExponentKept => "metal2vulkan-degrade-shared-exponent-kept",
Degradation::TwoPlaneBufferBlit => "metal2vulkan-degrade-two-plane-buffer-blit",
Degradation::TwoPlaneBufferBlitOrder => {
"metal2vulkan-degrade-two-plane-buffer-blit-order"
}
Degradation::SetPastLayoutSupport => "metal2vulkan-degrade-set-past-layout-support",
Degradation::YCbCrFilterNotExact => "metal2vulkan-degrade-ycbcr-filter-not-exact",
Degradation::RotatedLoadTiles => "metal2vulkan-degrade-rotated-load-tiles",
Degradation::HeapTextureLosslessLayout => {
"metal2vulkan-degrade-heap-texture-lossless-layout"
}
Degradation::HeapTextureUntiledLayout => {
"metal2vulkan-degrade-heap-texture-untiled-layout"
}
Degradation::ExtendedRangeBlendsStoredCodes => {
"metal2vulkan-degrade-extended-range-blends-stored-codes"
}
Degradation::CompressedTexelDecode => "metal2vulkan-degrade-compressed-texel-decode",
Degradation::CpuBlockDecode => "metal2vulkan-degrade-cpu-block-decode",
Degradation::CarriedDecodedTwin => "metal2vulkan-degrade-carried-decoded-twin",
Degradation::DecodedTexelPrecision => "metal2vulkan-degrade-decoded-texel-precision",
Degradation::HeapTextureLargerThanMetal => {
"metal2vulkan-degrade-heap-texture-larger-than-metal"
}
Degradation::DontCareStandIn => "metal2vulkan-degrade-dont-care-stand-in",
Degradation::CopiedHostPages => "metal2vulkan-degrade-copied-host-pages",
Degradation::DepthDenormals => "metal2vulkan-degrade-depth-denormals",
Degradation::SignedDepthTest => "metal2vulkan-degrade-signed-depth-test",
Degradation::FirstSparseResourceWait => {
"metal2vulkan-degrade-first-sparse-resource-wait"
}
Degradation::UnpackedFillColor => "metal2vulkan-degrade-unpacked-fill-color",
Degradation::TextureBufferFillLeftover => {
"metal2vulkan-degrade-texture-buffer-fill-leftover"
}
Degradation::DeviceLineTies => "metal2vulkan-degrade-device-line-ties",
Degradation::DeviceSubpixelSnap => "metal2vulkan-degrade-device-subpixel-snap",
Degradation::DeviceBooleanVisibility => {
"metal2vulkan-degrade-device-boolean-visibility"
}
Degradation::FloatTininessAfterRounding => {
"metal2vulkan-degrade-float-tininess-after-rounding"
}
Degradation::F16FmaDoubleRounding => "metal2vulkan-degrade-f16-fma-double-rounding",
Degradation::F16IntConvDoubleRounding => {
"metal2vulkan-degrade-f16-int-conv-double-rounding"
@@ -832,7 +528,7 @@ impl Degradation {
PrecisionNote::DeviceRoundedResolve => Degradation::DeviceRoundedResolve,
PrecisionNote::CompressedTexelDecode => Degradation::CompressedTexelDecode,
PrecisionNote::SharedExponentKept => Degradation::SharedExponentKept,
PrecisionNote::DeviceReconvergence => Degradation::ImplementationDefinedReconvergence,
PrecisionNote::DeviceReconvergence => Degradation::DeviceReconvergence,
}
}
}
+20 -100
View File
@@ -369,9 +369,7 @@ pub fn shared_memory_notice() -> crate::allowance::Allowance {
/// static note of a sample whose sampler may state pixel coordinates, which the translator then
/// divides by the texture's size for the device's normalized sampler. The function does not know
/// the bound state, and under the identity domains of `metal2vulkan-runtime` no binder specializes the
/// slot by it, so the note is recorded for every such sample, nearest ones included; the old
/// runtime specializes a slot bound with a nearest pixel sampler and records it for none of
/// them.
/// slot by it, so the note is recorded for every such sample, nearest ones included.
///
/// A declaration, like every [`notice_allowance`]: it loosens the notices site alone, and every
/// value still compares exactly. Measured on lavapipe (Mesa 26.2.4) through the rt side: it fired
@@ -383,49 +381,6 @@ pub fn pixel_sampler_scaling_notice() -> crate::allowance::Allowance {
notice_allowance(crate::degradation::Degradation::PixelSamplerScaling.code())
}
/// The declaration a case needs for the second notice a **venue's memory model** provokes:
/// `staged-indirect-records`, which the runtime announces on a device without unified memory that
/// places an indirect command buffer's records by their first use, where a GPU write was the first
/// use, so the records lie in device-local memory, and a host step then reads them while the
/// command buffer that wrote them holds them, through the device's staging queue
/// ([`crate::degradation::Degradation::StagedIndirectRecords`]).
///
/// **Why it is the venue's and not ours**, as [`shared_memory_notice`] is: every recording here
/// was taken on an Apple chip, whose GPU and CPU hold one memory, so there is no device-local
/// memory to place the records in and the notice cannot fire; MoltenVK on the same chip announces
/// nothing either. A discrete card keeps the records a GPU write placed in its own memory, which
/// the host reaches only through copies, and a host step must read what the GPU wrote. The
/// notice is the runtime reporting that cost honestly.
///
/// **It is a declaration and never an excuse.** Like every [`notice_allowance`] it loosens the
/// notices site alone: every value still compares against Metal's exactly. A case names it only
/// where a run on such a device announced it for the case's own work, and says in a comment which
/// run, and which counts showed the staged accesses were its host steps' reads of GPU-written
/// records; a staged access of records the GPU never wrote is a runtime defect, not this.
pub fn staged_records_notice() -> crate::allowance::Allowance {
notice_allowance(crate::degradation::Degradation::StagedIndirectRecords.code())
}
/// The declaration a case needs for the split a **venue's driver** makes the runtime take between
/// two draws that read and write a color in the pixel interlock: `render-pass-split`, which the
/// runtime announces where a draw that reaches interlocked storage an earlier draw of its
/// instance wrote begins a render pass instance of its own, on a driver whose such draws race
/// under load (`DriverFact::InterlockedDrawsRaceUnderLoad`: MoltenVK on Apple's GPUs, which
/// encodes no Metal barrier inside a render pass there).
///
/// **Why it is the venue's and not ours.** Metal runs the case's draws in one pass, ordered by its
/// tile, and records no split; a driver that orders such draws by the interlock or by a barrier
/// inside the instance runs them in one instance too. The split is the runtime ordering them on a
/// driver that does neither, and the notice is it reporting the cost. Like every
/// [`notice_allowance`] it loosens the notices site alone: every value still compares exactly.
///
/// **Its evidence.** Measured on the M3 Max (MoltenVK 1.4.2, macOS 27.0.1): it fired for every row
/// of `fetch-ordered-*` (its sRGB rows among them), `xr-gamut-*`, `xr-masked-*` whose second draw blends or writes a
/// `BGR10_XR` word under a mask, and `xr-gradient-*-blended-*`, the families that name it.
pub fn interlocked_split_notice() -> crate::allowance::Allowance {
notice_allowance(crate::degradation::Degradation::RenderPassSplit.code())
}
/// The slug of `docs/API.md`'s accepted difference that says what a device presenting a Mac that
/// keeps no texture compressed answers, as a Mac with an Intel or AMD GPU does
/// ([`without_compression`]): "A device answers as the class of Mac it presents".
@@ -460,34 +415,12 @@ pub fn without_compression(site: &str) -> crate::allowance::Allowance {
)
}
/// The declaration a case needs where its kernel reaches a texture or a sampler through an
/// **argument buffer**: `set-past-layout-support`, which the runtime announces where it makes a
/// descriptor set layout its driver's `vkGetDescriptorSetLayoutSupport` refuses though the driver
/// runs it ([`crate::degradation::Degradation::SetPastLayoutSupport`]).
///
/// **Why it is the venue's and the case's shape.** Such a kernel takes the handle heap, set 1,
/// whose arrays hold the device's update-after-bind capacity (65536 descriptors each on the M3
/// Max). MoltenVK answers the layout query by the sum of the bindings' counts against
/// `maxPerSetDescriptors` (1212 there), ignoring the update-after-bind limits it reports, so it
/// refuses every such set though it makes and runs it; Vulkan's validation layer reports each one
/// (`VUID-vkCreateDescriptorSetLayout-support-09582`), and the notice says so. lavapipe supports
/// the same layouts and announces nothing; Metal recorded nothing. The query is not ours to answer
/// otherwise: it is asked of the create info the layout is made from.
///
/// **It is a declaration and never an excuse**, like [`shared_memory_notice`]: it loosens the
/// notices site alone, so every value of a case that names it still compares exactly. A case names
/// it from its own shape (a texture or sampler in an argument buffer that a dispatch reads), never
/// from the venue, and says in a comment which run it rests on.
pub fn set_past_layout_notice() -> crate::allowance::Allowance {
notice_allowance(crate::degradation::Degradation::SetPastLayoutSupport.code())
}
/// The declaration a case needs where it samples through a sampler that reads an opaque-black
/// border ([`reads_opaque_black_border`]): `swizzled-opaque-black-border`
/// ([`crate::degradation::Degradation::SwizzledOpaqueBlackBorder`]), the static note the new
/// runtime records for such a sampler state, and for a pipeline whose function samples through
/// such a constexpr sampler, on every device. Through a view whose component mapping is not the
/// identity, the border texel is the device's answer where the device does not report
/// ([`crate::degradation::Degradation::SwizzledOpaqueBlackBorder`]), the static note the runtime
/// records for such a sampler state, and for a pipeline whose function samples through such a
/// constexpr sampler, on every device. Through a view whose component mapping is not the identity,
/// the border texel is the device's answer where the device does not report
/// `borderColorSwizzleFromImage`.
///
/// A declaration, like every [`notice_allowance`]: it loosens the notices site alone, and every
@@ -526,24 +459,20 @@ pub fn reads_opaque_black_border(spec: &crate::case::SamplerSpec) -> bool {
/// in the translator, or the runtime's own `Degradation`'s) says the answer is the device's own
/// native form of an operation rule 1 names, and that no other form is built:
///
/// - **maths**: the native-maths class (`native-transcendentals`, `native-division`,
/// `native-fma`, `native-dot`, `native-mix`, `native-min-max`, `native-nan-encoding`), the
/// device's functions and precision bounds (`device-transcendentals`, `device-arithmetic`), the
/// device's denormals and NaN bits (`device-denormals`, `device-nan-encoding`), the device's
/// rounding of a tiny product (`float-tininess-after-rounding`), and the device's compiler's
/// grouping and fusion of the fast-math arithmetic the AIR's flags let it rewrite
/// (`fast-math-rewrites`: the module states each operation in the AIR's order and reproduces no
/// grouping of Metal's);
/// - **maths**: the native-maths class (`native-transcendentals`, `native-division`, `native-fma`,
/// `native-dot`, `native-mix`, `native-min-max`, `native-nan-encoding`), the device's functions
/// and precision bounds (`device-transcendentals`, `device-arithmetic`), the device's denormals
/// and NaN bits (`device-denormals`, `device-nan-encoding`), and the device's compiler's grouping
/// and fusion of the fast-math arithmetic the AIR's flags let it rewrite (`fast-math-rewrites`:
/// the module states each operation in the AIR's order and reproduces no grouping of Metal's);
/// - **rounding**: the native-half class (`native-half-conversion`, `native-half-quantize`), and
/// the device's own depth conversion and depth test (`unorm-depth-rounding`, `depth-denormals`,
/// `signed-depth-test`);
/// the device's own depth denormals (`depth-denormals`);
/// - **texel, vertex and colour conversions**: `device-texel-conversion`,
/// `half-texel-conversion`, `srgb-texel-decode`, the device's fixed-function conversion of a
/// normalized vertex attribute (`device-vertex-conversion`), `device-color-conversion`;
/// - **sampling and filtering**: `device-sampling`, `device-sample-level`, the device's filter of a
/// generated mipmap chain (`device-filtered-mipmaps`), and Metal's own sampler filtering a
/// two-plane texture on MoltenVK (`half-sample-filter`, `float-sample-filter`,
/// `ycbcr-filter-not-exact`);
/// two-plane texture on MoltenVK (`half-sample-filter`, `float-sample-filter`);
/// - **blending**: the device's arithmetic of the blend a function computes into an extended-range
/// attachment, whose raw codes no blend unit reads (`extended-range-blend-source`,
/// `extended-range-float-blend-source`: `S·Fs op D·Fd` in `float`, where Metal's compiler rounds
@@ -556,19 +485,16 @@ pub fn reads_opaque_black_border(spec: &crate::case::SamplerSpec) -> bool {
/// reads and stores a signed lowest code as the code above it);
/// - **resolves**: `device-rounded-resolve`;
/// - **coverage**: the device's own conversion of a fragment's alpha to its coverage under
/// alpha-to-coverage (`device-alpha-coverage`), its choice of the pixel a width-1 line covers
/// at a vertex two pixels' diamonds share (`device-line-ties`), and its rasterizer's snap of a
/// line band's corner half a step off its subpixel grid (`device-subpixel-snap`).
/// alpha-to-coverage (`device-alpha-coverage`).
///
/// **What is not here**, and stays each case's to declare: a note of what the device **lacks**
/// (`device-signed-zero-inf-nan`, `device-anisotropic-filter`, `device-point-size`,
/// `restricted-depth-range`), of an emulation's own precision (`decoded-texel-precision`,
/// `grad-from-bias`, `pixel-sampler-scaling`, `bicubic-filter-arithmetic`), of a Metal form not
/// measured or not built (`blended-write-rounding`, `unmeasured-resolve`, `device-interpolation`,
/// `reduction-order`), a native answer whose catalogue entry states the bound the cases that
/// read it hold it to (the device's decode of a block-compressed texture's blocks,
/// `compressed-texel-decode`, which only a case that makes such a texture can announce), and every
/// performance or validity notice.
/// `restricted-depth-range`), of an emulation's own precision (`grad-from-bias`,
/// `pixel-sampler-scaling`, `bicubic-filter-arithmetic`), of a Metal form not measured or not built
/// (`blended-write-rounding`, `unmeasured-resolve`, `device-interpolation`, `reduction-order`), a
/// native answer whose catalogue entry states the bound the cases that read it hold it to (the
/// device's decode of a block-compressed texture's blocks, `compressed-texel-decode`, which only a
/// case that makes such a texture can announce), and every performance or validity notice.
///
/// **It declares the notice, and nothing about a value.** Each entry loosens the notices site
/// alone, exactly as a case's own [`notice_allowance`] does, so every value of every case still
@@ -591,13 +517,10 @@ pub const NATIVE_NOTES: &[crate::degradation::Degradation] = {
D::DeviceArithmetic,
D::DeviceDenormals,
D::DeviceNanEncoding,
D::FloatTininessAfterRounding,
D::FastMathRewrites,
D::NativeHalfConversion,
D::NativeHalfQuantize,
D::UnormDepthRounding,
D::DepthDenormals,
D::SignedDepthTest,
D::DeviceTexelConversion,
D::HalfTexelConversion,
D::SrgbTexelDecode,
@@ -608,15 +531,12 @@ pub const NATIVE_NOTES: &[crate::degradation::Degradation] = {
D::DeviceFilteredMipmaps,
D::HalfSampleFilter,
D::FloatSampleFilter,
D::YCbCrFilterNotExact,
D::ExtendedRangeBlendSource,
D::ExtendedRangeFloatBlendSource,
D::NativeFloat8,
D::NativeLogicOperation,
D::DeviceRoundedResolve,
D::DeviceAlphaCoverage,
D::DeviceLineTies,
D::DeviceSubpixelSnap,
]
};
@@ -118,20 +118,3 @@ pub const fn plane_extent(rotation: u32, frame: [u32; 2]) -> [u32; 2] {
_ => frame,
}
}
/// Where Metal stores the pass texel `(x, y)` of a `frame`-sized texture of `rotation`.
///
/// **Measured on the oracle**: all five rotations over an 8x4 frame, every texel, on an Apple M3
/// Max under macOS 27.0.1 (`probes/rotated_surface_planes.m`). The same rule an Apple M4 gave,
/// re-measured here rather than carried, because a number from a chip this tree no longer has can
/// never be checked against the oracle again.
pub const fn stored_at(rotation: u32, frame: [u32; 2], at: [u32; 2]) -> [u32; 2] {
let [width, height] = frame;
let [x, y] = at;
match rotation {
1 | 4 => [height - 1 - y, x],
2 => [width - 1 - x, height - 1 - y],
3 => [y, width - 1 - x],
_ => [x, y],
}
}
+16 -14
View File
@@ -1036,13 +1036,13 @@ fn a_notice_we_announce_and_metal_does_not_is_divergent_until_it_is_named() {
}
/// **The lockstep cases declare the SIMD groups' static note.** A device whose answer lacks maximal
/// reconvergence announces `implementation-defined-reconvergence` for both kernels, as Intel's
/// reconvergence announces `device-reconvergence` for both kernels, as Intel's
/// Windows driver on the UHD 630 does through the rt side; with Metal's own words that is each case
/// announced, by that notice, where it read divergent at its notices site before the cases declared
/// it. A device with maximal reconvergence announces nothing, and the words still compare exactly.
#[test]
fn the_lockstep_cases_declare_the_reconvergence_note() {
let code = Degradation::ImplementationDefinedReconvergence.code();
let code = Degradation::DeviceReconvergence.code();
for case in crate::cases::simdgroup_lockstep::all() {
let recording = crate::recording::read(case.name())
.unwrap_or_else(|why| panic!("{}: {why}", case.name()));
@@ -1054,8 +1054,7 @@ fn the_lockstep_cases_declare_the_reconvergence_note() {
let Value::Bytes(words) = &output.observed.value else {
panic!("{}: the recording holds no bytes", case.name());
};
let mut side = StubSide::new(words.clone())
.announcing(&[Degradation::ImplementationDefinedReconvergence]);
let mut side = StubSide::new(words.clone()).announcing(&[Degradation::DeviceReconvergence]);
let replayed = replay_against(case.as_ref(), &mut side, &recording).unwrap();
let Verdict::Announced { fields } = &replayed.verdict else {
panic!("{}: not announced: {}", case.name(), replayed.verdict);
@@ -1081,10 +1080,13 @@ fn the_lockstep_cases_declare_the_reconvergence_note() {
/// names nowhere, one of them unrelated to the one it declares.
#[test]
fn a_declared_notice_does_not_excuse_an_undeclared_one() {
let declared = Degradation::CarriedDecodedTwin;
let declared = Degradation::GradFromBias;
// Neither is one of the device's native answers, which the suite declares for every case
// ([`crate::replay::NATIVE_NOTES`]).
let undeclared = [Degradation::CpuBlockDecode, Degradation::ShaderResolve];
let undeclared = [
Degradation::PixelSamplerScaling,
Degradation::BicubicFilterArithmetic,
];
let bytes = words(&[1, 2]);
let case = WordsCase {
allowances: vec![crate::replay::notice_allowance(declared.code())],
@@ -1163,7 +1165,7 @@ fn a_native_note_is_declared_for_every_case() {
#[test]
fn a_native_note_declares_no_value_and_excuses_no_other_notice() {
let native = Degradation::NativeNanEncoding;
let other = Degradation::CarriedDecodedTwin;
let other = Degradation::GradFromBias;
let case = WordsCase::new("words", 2);
let recording = recording_of(&case, case.transcript(words(&[1, 2]), "Completed", &[]), 3);
let mut side = StubSide::new(words(&[1, 7])).announcing(&[native, other]);
@@ -1200,7 +1202,7 @@ fn a_native_note_declares_no_value_and_excuses_no_other_notice() {
/// differing, and is not told that it loosens the site with a declaration nothing justified.
#[test]
fn an_unannounced_native_note_is_no_unjustified_loosening() {
let other = Degradation::CarriedDecodedTwin;
let other = Degradation::GradFromBias;
let case = WordsCase::new("words", 2);
let recording = recording_of(&case, case.transcript(words(&[1, 2]), "Completed", &[]), 3);
let mut side = StubSide::new(words(&[1, 2])).announcing(&[other]);
@@ -1706,7 +1708,7 @@ fn an_accepted_difference_in_the_document_justifies_a_loosened_field() {
/// beside it, still diverges.
#[test]
fn a_nonzero_allowance_at_an_element_loosens_that_element_alone() {
let kind = Degradation::DeviceBooleanVisibility;
let kind = Degradation::GradFromBias;
let case = WordsCase {
allowances: vec![
crate::replay::notice_allowance(kind.code()),
@@ -4259,19 +4261,19 @@ fn an_allowance_no_site_needed_is_counted_and_named_rather_than_silently_kept()
Allowance::new(
"case/output",
Loosening::Absolute(8.0),
Justification::notice(Degradation::ShadowedTexture),
Justification::notice(Degradation::GradFromBias),
),
];
let bytes = words(&[1, 2]);
// The notice the second allowance names is announced, so it is justified; the run is
// byte-identical, so neither allowance fires.
let announced = [Degradation::ShadowedTexture.code()];
let announced = [Degradation::GradFromBias.code()];
let recording = recording_of(
&case,
case.transcript(bytes.clone(), "Completed", &announced),
3,
);
let mut side = StubSide::new(bytes).announcing(&[Degradation::ShadowedTexture]);
let mut side = StubSide::new(bytes).announcing(&[Degradation::GradFromBias]);
let replayed = replay_against(&case, &mut side, &recording).unwrap();
// Report-only: the run is still exact, and still compliant.
@@ -5031,11 +5033,11 @@ fn a_divergence_that_is_a_notice_names_the_notice_each_side_announced() {
let case = WordsCase::new("ledger-notice-only", 2);
// Metal announces nothing; the case names no tolerance.
let recording = recording_of(&case, case.transcript(words(&[1, 2]), "Completed", &[]), 3);
let code = Degradation::ShaderColorConversion.code();
let code = Degradation::PixelSamplerScaling.code();
let mut side = StubSide::new(words(&[1, 2]))
.on("llvmpipe (LLVM 21.1.8, 128 bits)")
.announcing(&[Degradation::ShaderColorConversion]);
.announcing(&[Degradation::PixelSamplerScaling]);
let replayed = replay_against(&case, &mut side, &recording).unwrap();
assert_eq!(replayed.verdict.word(), "divergent");
let Verdict::Divergent { found, .. } = &replayed.verdict else {
@@ -292,9 +292,8 @@ pub enum VisibilityResultMode {
/// `MTLVisibilityResultModeDisabled`: the draws write no result.
#[default]
Disabled,
/// `MTLVisibilityResultModeBoolean`: nonzero when any sample passed, else 0. The nonzero value
/// is the device's occlusion query's, where an Apple M3 Max writes 1
/// (`Degradation::DeviceBooleanVisibility`).
/// `MTLVisibilityResultModeBoolean`: nonzero when any sample passed, else 0. An Apple M3 Max
/// writes 1.
Boolean,
/// `MTLVisibilityResultModeCounting`: the samples that passed.
Counting,
+7
View File
@@ -2447,6 +2447,13 @@ bound.
for a NaN bias is not measured. The translator states the same difference as the sampler state's
static note, `PrecisionNote::CappedLodBias` (`DeviceLodBias::note`), which no pipeline stage
records.
- `metal2vulkan-degrade-device-reconvergence` (precision). `DeviceReconvergence`: A stage holds a
tangled instruction (a simdgroup or quad operation, or a barrier whose lanes depend on
reconvergence) on a device without maximal reconvergence (`shaderMaximalReconvergence`): after
divergent control flow the device decides which lanes run it together, where Metal's lanes
reconverge maximally, so such an operation may see other lanes active than Metal's. Under
subgroup-uniform control flow (`shaderSubgroupUniformControlFlow`) the lanes reconverge where
control flow is uniform. Static per stage: recorded for any tangled instruction in the entry.
- `metal2vulkan-degrade-snorm-minimum-kept` (precision). `SnormMinimumKept`: A draw in a render pass
that loads a single-sampled color attachment of a signed normalized format (`R8Snorm`, `RG8Snorm`,
`RGBA8Snorm`, `R16Snorm`, `RG16Snorm`, `RGBA16Snorm`) and does not discard it at the store. Cost:
+14 -14
View File
@@ -36,8 +36,8 @@ Its limits, measured rather than asserted:
| of the reachable, exercised by the suite's Metal leg | 518 |
| of the reachable, not exercised | 73 |
| share of the reachable exercised | 88% |
| of those exercised, no case reaching it loosens anything | 290 |
| of those exercised, a case reaching it loosens some site | 228 |
| of those exercised, no case reaching it loosens anything | 295 |
| of those exercised, a case reaching it loosens some site | 223 |
| case modules | 179 |
| committed recordings | 1319 |
| distinct SDK items the Metal leg reaches, of any status | 804 |
@@ -506,10 +506,10 @@ An implemented container no case's Metal leg touches. These are the families of
| cases whose Metal answer is `metal_run` | 1235 |
| cases whose Metal answer is `carried` | 80 |
| cases whose Metal answer is `never_returned` | 4 |
| modules that loosen a measured value | 23 |
| tolerances in all | 28 |
| modules declaring a notice (loosening no value) | 145 |
| loosenings used | `Unchecked`, `AnyOf`, `Absolute`, `Nonzero` |
| modules that loosen a measured value | 17 |
| tolerances in all | 19 |
| modules declaring a notice (loosening no value) | 142 |
| loosenings used | `Unchecked`, `AnyOf`, `Absolute` |
| justifications named | `Degradation`, `AcceptedDifference`, `WithoutCompression` |
| modules forbidding a re-record | 8 |
| `Side` methods (the suite's whole device vocabulary) | 133 |
@@ -530,7 +530,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
| `alpha_coverage_pairs` | 17 | 17 | every field | 113 |
| `argument_encoder_crossings` | 4 | 4 | every field | 41 |
| `argument_encoders` | 5 | 5 | every field | 57 |
| `astc_textures` | 42 | 42 | 2 tolerance(s): `Degradation` | 41 |
| `astc_textures` | 42 | 42 | 1 tolerance(s): `Degradation` | 41 |
| `attribute_formats` | 2 | 2 | every field | 48 |
| `attribute_strides` | 4 | 4 | every field | 46 |
| `bicubic_texel_classes` | 1 | 1 | every field | 31 |
@@ -570,8 +570,8 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
| `draw_state_changes` | 1 | 1 | every field | 137 |
| `dynamic_libraries` | 3 | 3 | every field | 6 |
| `empty_command_buffers` | 1 | 1 | every field | 20 |
| `etc_textures` | 10 | 10 | 1 tolerance(s): `Degradation` | 41 |
| `event_orders` | 5 | 5 | 4 tolerance(s): `AcceptedDifference` | 27 |
| `etc_textures` | 10 | 10 | every field | 41 |
| `event_orders` | 5 | 5 | 2 tolerance(s): `AcceptedDifference` | 27 |
| `extended_range_blends` | 18 | 18 | every field | 124 |
| `extended_range_gamut` | 39 | 39 | every field | 115 |
| `extended_range_gradients` | 8 | 8 | every field | 116 |
@@ -585,7 +585,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
| `format_footprints` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 19 |
| `fragment_imageblock_reflection` | 1 | 1 | every field | 74 |
| `frame_chains` | 1 | 1 | every field | 138 |
| `fresh_contents` | 87 | 87 | 1 tolerance(s): `Degradation` | 41 |
| `fresh_contents` | 87 | 87 | every field | 41 |
| `function_bindings` | 15 | 15 | every field | 64 |
| `function_constants_half3` | 1 | 1 | every field | 27 |
| `function_facts` | 15 | 15 | every field | 32 |
@@ -649,9 +649,9 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
| `resolve_then_load` | 1 | 1 | every field | 123 |
| `resource_facts` | 4 | 4 | every field | 23 |
| `rgb10a2_srgb` | 8 | 8 | every field | 76 |
| `rotated_planes` | 20 | 20 | 1 tolerance(s): `Degradation` | 114 |
| `rotated_planes` | 20 | 20 | every field | 114 |
| `rotated_targets` | 14 | 14 | every field | 117 |
| `sample_fills` | 17 | 0 | 1 tolerance(s): `Degradation` | 0 |
| `sample_fills` | 17 | 0 | every field | 0 |
| `sample_positions` | 19 | 16 | every field | 115 |
| `sampler_crossings` | 8 | 8 | every field | 59 |
| `sampler_filtering` | 15 | 15 | every field | 59 |
@@ -681,7 +681,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
| `texture_buffer_fills` | 3 | 0 | every field | 0 |
| `texture_buffer_tails` | 1 | 1 | every field | 49 |
| `texture_descriptor_pairs` | 5 | 5 | 1 tolerance(s): `AcceptedDifference` | 27 |
| `texture_fills` | 54 | 2 | 1 tolerance(s): `Degradation` | 42 |
| `texture_fills` | 54 | 2 | every field | 42 |
| `texture_view_casts` | 5 | 5 | every field | 77 |
| `texture_views` | 4 | 4 | every field | 37 |
| `textures` | 76 | 76 | every field | 10 |
@@ -699,7 +699,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many
| `vertex_fetch_reach` | 1 | 1 | every field | 103 |
| `vertex_formats` | 4 | 4 | every field | 102 |
| `vertex_step_rate` | 1 | 1 | every field | 102 |
| `visibility` | 16 | 16 | 1 tolerance(s): `Degradation` | 127 |
| `visibility` | 16 | 16 | every field | 127 |
| `visible_tables` | 18 | 18 | every field | 38 |
| `wide_int_attributes` | 2 | 2 | every field | 102 |
| `wide_points` | 1 | 1 | every field | 116 |