From 653014c2789e6ca85197d13b13bc4afd1587c315 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Thu, 19 Nov 2026 20:19:32 -0800 Subject: [PATCH] conformance: the heap cases name their size allowance where the coverage document reads it docs/CONFORMANCE-COVERAGE.md derives each case module's tolerances from the Allowance::new calls in its own text, so the helper in texture_query.rs left the four heap modules reading 'every field' while they loosen both numbers of every answer on the new runtime. Each module now names the allowance itself (the same path, loosening and justification); texture_query keeps the entry's slug, DEVICE_OWN_SIZES, with the rule in its doc. The document is regenerated: the four heap modules, pass_sequence_actions and astc_textures each read one more tolerance, 26 in all. --- .../src/cases/format_footprints.rs | 17 ++++++----- .../src/cases/heap_metal_sizes.rs | 14 +++++---- .../src/cases/texture_descriptor_pairs.rs | 16 ++++++---- .../src/cases/ycbcr_textures.rs | 17 +++++++---- .../src/rt_side/heap_sizes.rs | 2 +- crates/metal2vulkan-conformance/src/tests.rs | 2 +- .../src/texture_query.rs | 29 +++++-------------- docs/CONFORMANCE-COVERAGE.md | 22 +++++++------- 8 files changed, 61 insertions(+), 58 deletions(-) diff --git a/crates/metal2vulkan-conformance/src/cases/format_footprints.rs b/crates/metal2vulkan-conformance/src/cases/format_footprints.rs index 21441f478..d4e13e985 100644 --- a/crates/metal2vulkan-conformance/src/cases/format_footprints.rs +++ b/crates/metal2vulkan-conformance/src/cases/format_footprints.rs @@ -163,7 +163,7 @@ //! the point: the gap was a number in a generated document and it is now a row of the report //! naming the format, the descriptor and both answers. -use crate::allowance::Allowance; +use crate::allowance::{Allowance, Justification, Loosening}; use crate::case::{Abort, Case, Input, MetalSource, Side, TextureRole, TextureSpec}; use crate::texture_query::{HeapTextureQuery as Q, Storage}; use crate::transcript::{Aspect, ByteLayout, Element, Gaps, Node, Observed, Region, Sites, Value}; @@ -598,12 +598,15 @@ impl Case for FootprintCase { if self.shared_texture_buffers { named.push(crate::replay::shared_memory_notice()); } - // The new runtime's footprints are the device's own, held by their property and not by - // Metal's numbers (`texture_query::device_own_sizes`). - named.extend(crate::texture_query::device_own_sizes( - &self.queries, - site::QUERY, - )); + // The new 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::new_runtime_accepted(crate::texture_query::DEVICE_OWN_SIZES), + ) + })); named } diff --git a/crates/metal2vulkan-conformance/src/cases/heap_metal_sizes.rs b/crates/metal2vulkan-conformance/src/cases/heap_metal_sizes.rs index a0c8226d9..beff9c0e7 100644 --- a/crates/metal2vulkan-conformance/src/cases/heap_metal_sizes.rs +++ b/crates/metal2vulkan-conformance/src/cases/heap_metal_sizes.rs @@ -36,6 +36,7 @@ //! the runtime first, where an `Invalid` answer is a recorded value and nothing else, and only a //! table that answers no `Invalid` anywhere is ever handed to Metal. +use crate::allowance::{Allowance, Justification, Loosening}; use crate::case::{Abort, Case, Input, MetalSource, Side}; use crate::texture_query::{HeapTextureQuery as Q, Storage}; use crate::transcript::{Node, Observed, Sites, Value}; @@ -379,11 +380,14 @@ impl Case for HeapSizeCase { false => Vec::new(), }; // The new 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(crate::texture_query::device_own_sizes( - &self.queries, - site::QUERY, - )); + // 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::new_runtime_accepted(crate::texture_query::DEVICE_OWN_SIZES), + ) + })); named } diff --git a/crates/metal2vulkan-conformance/src/cases/texture_descriptor_pairs.rs b/crates/metal2vulkan-conformance/src/cases/texture_descriptor_pairs.rs index 12d086e0a..c22727c07 100644 --- a/crates/metal2vulkan-conformance/src/cases/texture_descriptor_pairs.rs +++ b/crates/metal2vulkan-conformance/src/cases/texture_descriptor_pairs.rs @@ -160,6 +160,7 @@ //! for it on any format but `R32Uint` (measured again this round on `RGBA8Unorm`), and the formats //! are the plain ones this tree already makes textures of. +use crate::allowance::{Allowance, Justification, Loosening}; use crate::case::{made, Abort, Case, Input, MetalSource, Side}; use crate::heap_query::{HeapSpec, QueriedResource}; use crate::sparse_query::SparseTextureSpec; @@ -629,12 +630,15 @@ impl Case for DescriptorPairs { metal2vulkan_runtime::Degradation::MemorylessTextureBuffer.code(), )); } - // The new runtime's footprints are the device's own, held by their property and not by - // Metal's numbers (`texture_query::device_own_sizes`). - named.extend(crate::texture_query::device_own_sizes( - &self.queries, - site::QUERY, - )); + // The new 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::new_runtime_accepted(crate::texture_query::DEVICE_OWN_SIZES), + ) + })); named } diff --git a/crates/metal2vulkan-conformance/src/cases/ycbcr_textures.rs b/crates/metal2vulkan-conformance/src/cases/ycbcr_textures.rs index fb89170a3..f7ebfe727 100644 --- a/crates/metal2vulkan-conformance/src/cases/ycbcr_textures.rs +++ b/crates/metal2vulkan-conformance/src/cases/ycbcr_textures.rs @@ -50,7 +50,7 @@ //! and one dispatch of 960 threads, and the one pair it hands Metal — format 500 over a `420v` //! surface — is the pair the committed probe already ran on this machine. -use crate::allowance::Allowance; +use crate::allowance::{Allowance, Justification, Loosening}; use crate::case::{made, Abort, Bindings, Case, Failure, Input, MetalSource, PlaneTexture, Side}; use crate::fixture::{Fixture, METAL_TEXT, RUNTIME_TEXT}; use crate::recording::ShaderRef; @@ -139,11 +139,16 @@ impl Case for FormatDescriptors { fn allowances(&self) -> Vec { // The new runtime's answers are the device's own, held by their property and not by - // Metal's numbers (`texture_query::device_own_sizes`). - let queries: Vec = (self.queries().into_iter()) - .map(|(query, _)| query) - .collect(); - crate::texture_query::device_own_sizes(&queries, site::QUERY) + // Metal's numbers (`texture_query::DEVICE_OWN_SIZES`). + (self.queries().into_iter()) + .map(|(query, _)| { + Allowance::new( + format!("case/{}/{}/Ok/*", query.site(), site::QUERY), + Loosening::Unchecked, + Justification::new_runtime_accepted(crate::texture_query::DEVICE_OWN_SIZES), + ) + }) + .collect() } fn inputs(&self) -> Result, String> { diff --git a/crates/metal2vulkan-conformance/src/rt_side/heap_sizes.rs b/crates/metal2vulkan-conformance/src/rt_side/heap_sizes.rs index 8988031a5..8cd73c578 100644 --- a/crates/metal2vulkan-conformance/src/rt_side/heap_sizes.rs +++ b/crates/metal2vulkan-conformance/src/rt_side/heap_sizes.rs @@ -3,7 +3,7 @@ //! The runtime answers the device's own size and alignment, not Metal's (`docs/API.md` section 10, //! "The new runtime's heap texture size and alignment are the device's own"), so the cases that //! ask it do not compare the two numbers with Metal's on its run -//! ([`crate::texture_query::device_own_sizes`]). This side holds each answer to what a consumer +//! ([`crate::texture_query::DEVICE_OWN_SIZES`]). This side holds each answer to what a consumer //! places by before it answers it, and answers the failure where it does not hold: //! //! 1. the alignment is a power of two, for every query; diff --git a/crates/metal2vulkan-conformance/src/tests.rs b/crates/metal2vulkan-conformance/src/tests.rs index 1e1472376..17fe615a1 100644 --- a/crates/metal2vulkan-conformance/src/tests.rs +++ b/crates/metal2vulkan-conformance/src/tests.rs @@ -1349,7 +1349,7 @@ fn every_accepted_difference_a_case_names_is_an_entry() { /// Every answer Metal recorded to `heapTextureSizeAndAlignWithDescriptor:` is loosened on the new /// runtime's run, both of its numbers, by the entry saying they are the device's own -/// (`texture_query::device_own_sizes`); the new runtime's side holds them to their property +/// (`texture_query::DEVICE_OWN_SIZES`); the new runtime's side holds them to their property /// instead. An answer the allowances missed would compare the device's numbers with Metal's, which /// the entry says they are not; one they reach past would excuse a site that is no answer. #[test] diff --git a/crates/metal2vulkan-conformance/src/texture_query.rs b/crates/metal2vulkan-conformance/src/texture_query.rs index ad848577d..4ea00171a 100644 --- a/crates/metal2vulkan-conformance/src/texture_query.rs +++ b/crates/metal2vulkan-conformance/src/texture_query.rs @@ -16,7 +16,6 @@ //! private formats (`Unspecialized`, the 4:2:2 pair, the two-plane extended-range pair) and one of //! Apple's private usage bits as readily as a public one. -use crate::allowance::{Allowance, Justification, Loosening}; use metal2vulkan::metal::{PixelFormat, TextureType, TextureUsage}; /// The storage mode a case asks a resource for: three of Metal's four modes, and the suite's one @@ -334,25 +333,13 @@ impl SizeAndAlign { /// `docs/API.md` section 10's entry for the new runtime's answer to /// `heapTextureSizeAndAlignWithDescriptor:`: the device's own size and alignment, not Metal's. +/// +/// Each case that records the answer of a query at `case//size-and-align` names it at +/// `case//size-and-align/Ok/*`, `Unchecked`: on the new runtime's run the two numbers are +/// not compared with Metal's, and the runtime's side holds each to a property instead, answering +/// the failure where it does not hold (the alignment a power of two; a Private query's texture +/// placed at `align` in a heap of `align + size` bytes, and its first slice read back where the +/// runtime moves the format's bytes). On the old runtime's run nothing is loosened. A refusal is +/// not an answer, so a site where one side answers and the other refuses still diverges. pub const DEVICE_OWN_SIZES: &str = "the-new-runtime-s-heap-texture-size-and-alignment-are-the-device-s-own"; - -/// The allowances of a case that records the answer to `heapTextureSizeAndAlignWithDescriptor:` -/// of each of `queries` at its `leaf` (`case//`): on the new runtime's run the two -/// numbers of an answer are not compared with Metal's ([`DEVICE_OWN_SIZES`]), and the runtime's -/// side holds each to a property instead, answering the failure where it does not hold (the -/// alignment a power of two; a Private query's texture placed at `align` in a heap of -/// `align + size` bytes, and its first slice read back where the runtime moves the format's -/// bytes). On the old runtime's run nothing is loosened. A refusal is not an answer, so a site -/// where one side answers and the other refuses still diverges. -pub fn device_own_sizes(queries: &[HeapTextureQuery], leaf: &str) -> Vec { - (queries.iter()) - .map(|query| { - Allowance::new( - format!("case/{}/{leaf}/Ok/*", query.site()), - Loosening::Unchecked, - Justification::new_runtime_accepted(DEVICE_OWN_SIZES), - ) - }) - .collect() -} diff --git a/docs/CONFORMANCE-COVERAGE.md b/docs/CONFORMANCE-COVERAGE.md index 005ccfe65..b6479e88c 100644 --- a/docs/CONFORMANCE-COVERAGE.md +++ b/docs/CONFORMANCE-COVERAGE.md @@ -38,8 +38,8 @@ Its limits, measured rather than asserted: | of the reachable, exercised by the suite's Metal leg | 815 | | of the reachable, not exercised | 163 | | share of the reachable exercised | 83% | -| of those exercised, no case reaching it loosens anything | 556 | -| of those exercised, a case reaching it loosens some site | 259 | +| of those exercised, no case reaching it loosens anything | 523 | +| of those exercised, a case reaching it loosens some site | 292 | | case modules | 177 | | committed recordings | 1317 | | distinct SDK items the Metal leg reaches, of any status | 822 | @@ -536,11 +536,11 @@ An implemented container no case's Metal leg touches. These are the families of | cases whose Metal answer is `metal_run` | 1233 | | cases whose Metal answer is `carried` | 80 | | cases whose Metal answer is `never_returned` | 4 | -| modules that loosen a measured value | 18 | -| tolerances in all | 20 | +| modules that loosen a measured value | 23 | +| tolerances in all | 26 | | modules declaring a notice (loosening no value) | 143 | | loosenings used | `Unchecked`, `AnyOf`, `Absolute`, `Nonzero` | -| justifications named | `Degradation`, `AcceptedDifference`, `NewRuntimeAccepted`, `WithoutCompression`, `NewRuntimeNotice` | +| justifications named | `Degradation`, `NewRuntimeAccepted`, `AcceptedDifference`, `NewRuntimeNotice`, `WithoutCompression` | | modules forbidding a re-record | 8 | | `Side` methods (the suite's whole device vocabulary) | 132 | | `Side` methods the Metal leg reaches an SDK item through | 126 | @@ -560,7 +560,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `alpha_coverage_pairs` | 17 | 17 | every field | 121 | | `argument_encoder_crossings` | 4 | 4 | every field | 58 | | `argument_encoders` | 5 | 5 | every field | 85 | -| `astc_textures` | 42 | 42 | 1 tolerance(s): `Degradation` | 43 | +| `astc_textures` | 42 | 42 | 2 tolerance(s): `Degradation`, `NewRuntimeNotice` | 43 | | `attribute_formats` | 2 | 2 | every field | 48 | | `attribute_strides` | 4 | 4 | every field | 51 | | `binary_archives` | 6 | 6 | every field | 41 | @@ -611,7 +611,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `fence_orders` | 6 | 6 | 1 tolerance(s): `NewRuntimeAccepted` | 27 | | `fetch_ordered` | 6 | 6 | every field | 124 | | `format_copies` | 16 | 16 | every field | 48 | -| `format_footprints` | 6 | 6 | every field | 21 | +| `format_footprints` | 6 | 6 | 1 tolerance(s): `NewRuntimeAccepted` | 21 | | `fragment_imageblock_reflection` | 1 | 1 | every field | 74 | | `frame_chains` | 1 | 1 | every field | 148 | | `fresh_contents` | 87 | 87 | 1 tolerance(s): `Degradation` | 50 | @@ -624,7 +624,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `half_write_nans` | 7 | 7 | every field | 33 | | `handler_waits` | 3 | 0 | every field | 0 | | `heap_facts` | 5 | 5 | every field | 35 | -| `heap_metal_sizes` | 7 | 7 | every field | 15 | +| `heap_metal_sizes` | 7 | 7 | 1 tolerance(s): `NewRuntimeAccepted` | 15 | | `host_detach` | 1 | 1 | every field | 18 | | `host_page_writes` | 4 | 4 | every field | 132 | | `indirect_command_depth` | 6 | 6 | every field | 199 | @@ -649,7 +649,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `pass_attachment_pairs` | 2 | 2 | every field | 124 | | `pass_bound_pairs` | 1 | 1 | every field | 125 | | `pass_bytes` | 4 | 4 | every field | 26 | -| `pass_sequence_actions` | 2 | 2 | every field | 140 | +| `pass_sequence_actions` | 2 | 2 | 1 tolerance(s): `NewRuntimeAccepted` | 140 | | `pass_start_reads` | 14 | 14 | 2 tolerance(s): `AcceptedDifference` | 130 | | `pipeline_descriptors` | 3 | 3 | every field | 77 | | `pipeline_facts` | 9 | 9 | every field | 77 | @@ -708,7 +708,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `texture_accesses` | 1 | 1 | every field | 20 | | `texture_buffer_fills` | 3 | 0 | every field | 0 | | `texture_buffer_tails` | 1 | 1 | every field | 58 | -| `texture_descriptor_pairs` | 5 | 5 | every field | 57 | +| `texture_descriptor_pairs` | 5 | 5 | 1 tolerance(s): `NewRuntimeAccepted` | 57 | | `texture_fills` | 54 | 2 | 1 tolerance(s): `Degradation` | 53 | | `texture_view_casts` | 5 | 5 | every field | 89 | | `texture_views` | 4 | 4 | every field | 48 | @@ -733,7 +733,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `wide_points` | 1 | 1 | every field | 124 | | `ycbcr_gathers` | 4 | 4 | every field | 52 | | `ycbcr_minify` | 2 | 2 | every field | 52 | -| `ycbcr_textures` | 2 | 2 | every field | 41 | +| `ycbcr_textures` | 2 | 2 | 1 tolerance(s): `NewRuntimeAccepted` | 41 | ## Every implemented item