From 3d9d7c5885013a41c82898a584bf47d5a71b2ea5 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Fri, 23 Oct 2026 15:06:36 +0300 Subject: [PATCH] Make the ledger hold a divergence and a venue, not refusals alone The steps this packet landed as, in order: - Adopt the fragment quad's lavapipe divergence, scoped to that venue - Name the device's own gap where the vocabulary could not, and the notice in a notice-only difference - Pin the sparse sample-count chain as the device's gap, with lavapipe's measurement - Recompute the runtime-sources pin after the rebase Content: the tree of `development` at fb88ec8599, unchanged. --- .github/workflows/ci.yml | 9 +- crates/metal2vulkan-conformance/README.md | 75 +- .../metal2vulkan-conformance/known-gaps.tsv | 68 ++ .../known-refusals.tsv | 33 - .../src/bin/conformance.rs | 37 +- crates/metal2vulkan-conformance/src/case.rs | 7 + .../src/cases/textures.rs | 2 +- .../src/cases/tile_threadgroups.rs | 2 +- .../metal2vulkan-conformance/src/compare.rs | 58 ++ crates/metal2vulkan-conformance/src/diff.rs | 31 +- .../src/known_gaps.rs | 378 ++++++++++ .../src/known_refusals.rs | 204 ------ crates/metal2vulkan-conformance/src/lib.rs | 13 +- crates/metal2vulkan-conformance/src/report.rs | 8 +- crates/metal2vulkan-conformance/src/tests.rs | 677 ++++++++++++++++-- .../src/transcript.rs | 43 +- .../metal2vulkan-conformance/src/verdict.rs | 88 ++- .../src/sparse/texture.rs | 57 +- .../metal2vulkan-runtime/src/tests/sparse.rs | 77 +- .../runtime-sources.sha256 | 2 +- crates/metal2vulkan/src/cache/mod.rs | 2 +- crates/metal2vulkan/src/error/mod.rs | 31 + crates/metal2vulkan/src/error/tests.rs | 4 +- docs/REFUSALS.md | 42 +- scripts/refusal-surface/refusal_surface.py | 9 +- 25 files changed, 1556 insertions(+), 401 deletions(-) create mode 100644 crates/metal2vulkan-conformance/known-gaps.tsv delete mode 100644 crates/metal2vulkan-conformance/known-refusals.tsv create mode 100644 crates/metal2vulkan-conformance/src/known_gaps.rs delete mode 100644 crates/metal2vulkan-conformance/src/known_refusals.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb204b231..2177047e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,10 +170,11 @@ jobs: # The conformance suite's replay leg on lavapipe: it reads the committed recordings, runs the # runtime side and compares, with no Metal present. Its exit status is 0 only where the run - # holds no surprise: no divergence, no unrecorded case, no stale recording, and exactly the - # refusals crates/metal2vulkan-conformance/known-refusals.tsv expects. A refusal that ledger - # does not list fails here, and so does a row it lists that is no longer refused, so closing - # a gap forces the ledger edit. A venue that lacks a feature a case needs does not spoil it. + # holds no surprise: no unrecorded case, no stale recording, and exactly the gaps + # crates/metal2vulkan-conformance/known-gaps.tsv expects on this venue. A refusal or a + # divergence that ledger does not list fails here, and so does a row it lists that the run no + # longer holds, so closing a gap forces the ledger edit. A venue that lacks a feature a case + # needs does not spoil it. - name: Replay the conformance suite on the CPU Vulkan ICD (Linux) if: runner.os == 'Linux' env: diff --git a/crates/metal2vulkan-conformance/README.md b/crates/metal2vulkan-conformance/README.md index 8111284e6..0b2a70e98 100644 --- a/crates/metal2vulkan-conformance/README.md +++ b/crates/metal2vulkan-conformance/README.md @@ -22,26 +22,73 @@ the runtime's own defaults instead — the fast form of every speed-for-accuracy what a consumer runs — so the suite can say whether a difference is the policy's or the implementation's. -## The known-refusals ledger +## The known-gaps ledger -`known-refusals.tsv` holds the refusals we have written down as open gaps. Each row is an **open -bug with a todo behind it** — not an accepted difference, not permission for anything. It exists so -that one case holding a known gap visible does not make every run red, because a report that is -always red is a report nobody reads, and that would cost us the next real refusal. +`known-gaps.tsv` holds the gaps we have written down as open. Each row is an **open bug with a todo +behind it** — not an accepted difference, not permission for anything. It exists so that one case +holding a known gap visible does not make every run red, because a report that is always red is a +report nobody reads, and that would cost us the next real gap. -It changes the **exit status** and nothing else. Every row is still printed as a `Refused` row, with -our error and with Metal's own words where its API validation refuses the call too, and still -counted in the `refused` number. +It changes the **exit status** and nothing else. Every row is still printed as a `Refused` or +`Divergent` row, with our answer and Metal's, with Metal's own words where its API validation +refuses the call too, and still counted in the suite's own numbers. -It is an expectation, not an allowlist, and `replay` holds it in **both** directions: +A row names the verdict it expects: -- a refusal the ledger does not list fails the run — a new gap appeared; -- a row the ledger lists that is no longer refused **also** fails the run, saying the gap looks +- **`refused`** — a call plain Metal answered and we returned a typed error for; +- **`divergent`** — a field that differs with nothing we announced to justify it. + +Both are bugs of ours by the owner's standing rule, both have to stay visible, and both need the +same discipline, so they share one file and one mechanism. Nothing else is ever written down: an +unrecorded case and a stale recording must fail loudly, and a venue that honestly lacks a feature +the case needs is not a gap of ours at all — that is its own verdict, per site. + +A row may also name the **venue** it is expected on, because a gap can be one venue's and not +another's: a pipeline the runtime refuses on MoltenVK for a structural reason can translate on +lavapipe, and a global row would then fail the lavapipe run for existing. The field is held, without +case, against the venue's own description — its device name, driver, API version and Metal level — +so a row can name one device (`Apple M3 Max`), one implementation (`llvmpipe`) or a family of them, +and a venue that joins later needs no new vocabulary. `*` means every venue, and it is the +**stronger** claim rather than the looser one: the row is then held on every venue the run selected +its case on, so widening a row's scope makes it harder to satisfy. That is what stops a +venue-scoped row from becoming a way to silence a venue. A venue pattern that matches nothing holds +the row nowhere, so its gap reads as unlisted and the run fails — a typo is loud. + +It is an expectation, not an allowlist, and `replay` holds it in **both** directions, per venue: + +- a refusal or a divergence the ledger does not list fails the run — a new gap appeared; +- a row the ledger lists that the run no longer holds **also** fails the run, saying the gap looks fixed and the row must go. That second direction is the point: closing a gap forces the ledger edit, so a row cannot outlive -the bug it stands for and the file cannot rot into a silencer. A row is held only against the cases -a run selected, so replaying one case does not read every other row as fixed. +the bug it stands for and the file cannot rot into a silencer. It has already earned its keep twice +in this round — a product fix landed and the replay named four stale rows before anybody reasoned +about the fix. A row is held only against the cases a run selected and the venues it ran on, so +replaying one case does not read every other row as fixed, and a run on one venue does not read +another venue's rows as fixed. + +A row's identity is its case, the verdict it expects, the site and the answer there, so a gap that +changed into another gap at the same site is a new gap and not the old one. Where the difference +**is** a notice — our side announces a degrade code and Metal announces nothing, every other field +bit-exact — the row's answer names what each side announced, because that is the whole difference +and a row that did not name it would record a gap without saying what it waits on. Such a site is a +divergence and not a tolerance: where the product's own degrade note says validation derives no +explanation from it, loosening the site here would be this suite overruling the product's stated +contract. A case that both diverges and refuses holds its refused sites in the `Divergent` verdict alongside +the differences, so neither row can go unchecked behind the other: a divergence never launders a +refusal. + +## A site the venue honestly lacks + +A device's honest gap must never read as a refusal of ours. Where a typed error names capabilities +a device could enable, or a driver measured to run the thing wrong, the site is the **venue's** gap +and not ours: it is never a refusal, never a ledger row, and the rest of the case still compares, +so a divergence anywhere else in the same case still fails. The case's verdict is then +`lacks-feature`, which is neither a pass nor a failure and is never counted as coverage. + +Two shapes reach that verdict: the case **stopping** at such a call, and a case carrying on past +one, which is recorded per site. The second matters because until it existed a case that did not +have to stop could not say the venue lacked anything, and the site read as a gap of ours. ## Two Metal oracles @@ -218,7 +265,7 @@ edits one. | `cost` | The cost half: the counts our side moved, their regions, their bounds and the three cost verdicts | | `work`, `runtime_work`, `metal_work` | The copy-and-fill vocabulary a case states as data, and the two sides that run it | | `measured` | The committed Metal measurements a ported case reads, under the public fixtures | -| `known_refusals` | The ledger of open gaps, held in both directions; it sets the exit status, never a verdict | +| `known_gaps` | The ledger of open gaps — a refusal or a divergence, per venue — held in both directions; it sets the exit status, never a verdict | | `cases` | The case set itself, one module per family | ## The case set diff --git a/crates/metal2vulkan-conformance/known-gaps.tsv b/crates/metal2vulkan-conformance/known-gaps.tsv new file mode 100644 index 000000000..11cc3614f --- /dev/null +++ b/crates/metal2vulkan-conformance/known-gaps.tsv @@ -0,0 +1,68 @@ +# Known gaps: our open bugs, each one with a todo behind it. +# +# READ THIS BEFORE ADDING A ROW. A row here is not an accepted difference and it is not permission +# for anything. It is a gap of ours -- a call plain Metal answers and we refuse, or a field that +# differs with nothing announced to justify it -- which, by the owner's standing rule that what +# Metal allows we must allow, is a bug of ours, written down so the one case that holds it visible +# does not make every run red and teach everyone to stop reading the report. An accepted difference +# lives in `docs/API.md` section 10 and is justified; a degradation lives in the degrade catalogue +# and is announced. This file is neither. Nothing here is resolved by being listed. +# +# It is an EXPECTATION, NOT AN ALLOWLIST, and `conformance replay` holds it to that in both +# directions, per venue: +# +# - a refusal or a divergence that is not listed here fails the run: a new gap appeared; +# - a row listed here that the run no longer holds ALSO fails the run, saying the gap looks +# fixed and the row must go. +# +# That second direction is the whole point. Closing a gap forces the ledger edit, so a row cannot +# outlive the bug it stands for and this file cannot rot into a silencer. It also means a row is +# checked by execution rather than by discipline, which is the standard the rest of the suite is +# held to. It has already earned its keep twice in this round: a product fix landed and the replay +# named four stale rows before anyone reasoned about the fix. +# +# The ledger changes the exit status and nothing else. The report still prints each of these as a +# `Refused` or `Divergent` row, with our answer and Metal's, with Metal's own words where its API +# validation refuses the call too, and counted in the suite's own numbers. Nothing is laundered. +# +# A row is held only against the cases a run selected and the venues it ran on, so replaying one +# case does not read every other row as fixed, and a run on one venue does not read another +# venue's rows as fixed. +# +# Tab-separated, SIX fields. Blank lines and lines from `#` are ignored. +# +# case the case's name. +# venue `*` for every venue, or words held (without case, as a substring) against the +# venue's own description: its device name, driver, API version and Metal level. +# `*` is the STRONGER claim, not the looser one -- the second direction then holds +# the row on every venue the run selected the case on -- so widening a row's scope +# makes it harder to satisfy, which is what stops a venue-scoped row from becoming a +# way to silence a venue. A pattern that matches nothing holds the row nowhere, so +# its gap reads as unlisted and the run fails: a typo is loud. +# expects `refused`, a call plain Metal answered and we did not; or `divergent`, a field that +# differs with nothing announced to justify it. Nothing else is ever written down: +# an unrecorded case and a stale recording must fail loudly, and a venue that +# honestly lacks a feature is not a gap of ours at all. +# site the site, as node names from the root, exactly as the report prints it. +# answer what the run answers there, exactly as the report prints it after the site. For a +# refusal that is our typed error. For a divergence it is the one leaf fact that +# moved, which names Metal's value and ours. Part of the row's identity, so a gap +# that changed into another gap at the same site is a new gap and not this one. +# waiting on the open bug, in words: what Metal does, what we do instead, and where the fix +# belongs. Not matched -- it is what a reader needs -- but a row must carry one. +# +# A row whose case is not in the tree yet is left here as a comment for the stream that owns the +# case to make real, because the parser ignores a `#` line and a test holds every live row to a +# case that exists. One is waiting: +# +# - the sparse mip tail: Metal's `tailSizeInBytes` exceeds our sparse model on extreme aspect +# ratios, 13 descriptors of one case, symmetric in the axes and a different page count per +# format, the rule unidentified. We believe both Metal's answer and our model have to move +# before a row can state the gap, so the row's `answer` field must come from the run. +# +# case venue expects site answer waiting on +mesh-object-draws-partial-threadgroup-6-by-4 * refused case/object-threads-6-by-4/buffer/calls/2-drawMeshThreads Err(Error::Bind("the bind state was refused: Unsupported(Unsupported { feature: MeshShading, needs: NotImplemented, location: None, symbol: None })")) The runtime refuses `drawMeshThreads` where the threads leave a partial object threadgroup, `Unsupported(MeshShading, NotImplemented)` out of the bind state (crates/metal2vulkan/src/bind/graphics.rs, `mesh_draw`'s `threads[i].is_multiple_of(lo[i])` test), while Metal draws it and runs the threads left over. Not a device gap: this M3 Max has mesh shading and draws every other row of the same probe. Measured on it (macOS 27.0.1, plain Metal, our probe gaps/mesh/obj, one shape per process): the draw launches ceil(threads/L) object threadgroups, `threads_per_grid` is the threads asked for, and the last threadgroup on an axis runs with the threads left over as a non-uniform threadgroup exactly as `dispatchThreads:` does for compute - `threads_per_threadgroup` is min(L, threads - group*L) per axis (6 of 64 reports 6), `thread_position_in_threadgroup` and `thread_index_in_threadgroup` run over that reduced size, `simdgroups_per_threadgroup` is ceil of it over 32, and a threadgroup barrier synchronizes the threads left over alone. The cause is that Vulkan has no partial workgroup: the exact form is the one compute already uses, a region per edge dispatched at its own local size, which for a draw means several draws of several pipeline specializations and, on a grid with more than one whole threadgroup on a higher axis, a primitive order that is not Metal's; the alternative is one draw of ceil groups with the object entry reading its reduced size from its `DispatchRegion` record (`MultiRegion` 1 already carries the grid and L, and already reports ceil threadgroups and the asked-for threads), deriving the thread position and index from `lin` over that size and returning before the body past it, which is exact for everything but a threadgroup barrier and so needs a pipeline variant whose compile refuses an object function that synchronizes. Neither is built. On the orchestrator's todo list as runtime work. +mesh-object-draws-partial-threadgroup-5x3-by-4x2 * refused case/object-threads-5x3-by-4x2/buffer/calls/2-drawMeshThreads Err(Error::Bind("the bind state was refused: Unsupported(Unsupported { feature: MeshShading, needs: NotImplemented, location: None, symbol: None })")) The runtime refuses `drawMeshThreads` where the threads leave a partial object threadgroup, `Unsupported(MeshShading, NotImplemented)` out of the bind state (crates/metal2vulkan/src/bind/graphics.rs, `mesh_draw`'s `threads[i].is_multiple_of(lo[i])` test), while Metal draws it and runs the threads left over. Not a device gap: this M3 Max has mesh shading and draws every other row of the same probe. Measured on it (macOS 27.0.1, plain Metal, our probe gaps/mesh/obj, one shape per process): the draw launches ceil(threads/L) object threadgroups, `threads_per_grid` is the threads asked for, and the last threadgroup on an axis runs with the threads left over as a non-uniform threadgroup exactly as `dispatchThreads:` does for compute - `threads_per_threadgroup` is min(L, threads - group*L) per axis (6 of 64 reports 6), `thread_position_in_threadgroup` and `thread_index_in_threadgroup` run over that reduced size, `simdgroups_per_threadgroup` is ceil of it over 32, and a threadgroup barrier synchronizes the threads left over alone. The cause is that Vulkan has no partial workgroup: the exact form is the one compute already uses, a region per edge dispatched at its own local size, which for a draw means several draws of several pipeline specializations and, on a grid with more than one whole threadgroup on a higher axis, a primitive order that is not Metal's; the alternative is one draw of ceil groups with the object entry reading its reduced size from its `DispatchRegion` record (`MultiRegion` 1 already carries the grid and L, and already reports ceil threadgroups and the asked-for threads), deriving the thread position and index from `lin` over that size and returning before the body past it, which is exact for everything but a threadgroup barrier and so needs a pipeline variant whose compile refuses an object function that synchronizes. Neither is built. On the orchestrator's todo list as runtime work. +discard-quad-sum-placement llvmpipe divergent case/counted_atomic/texels element [image 0, row 0, 0] (I32, byte 0): Metal 1, ours 0 Metal counts the quads the discard drops whole in a simdgroup sum that sits ahead of the discard for a measured reason -- the discard's condition reads the sum (`counted_dependent`), or a device store (`counted_store`) or an atomic (`counted_atomic`) lies between them -- so the kept quad's first channel, `before > after`, is 1. On llvmpipe it is 0: our run's sum saw the same lane count before and after the discard. MoltenVK on this M3 Max answers Metal's 1 exactly, with no notice, so this is one venue's difference and not the module's rule being wrong (verified: a whole-set replay on each venue, 2026-10-23). The cause is NOT established, and the case as written cannot establish it: the four numbers it records are identical under both candidates -- the device's fragment simdgroup holding only the kept quad, so the dropped quads were never in it (the target is 8 by 4, exactly one 32-lane simdgroup if the device packs it that way), and the device's compiler moving the reduction past the discard although `canon/discard_sink.rs` placed it ahead on purpose. Both give before == after and so (0, 0, 0, 0). The next step is the case's: record the simdgroup's own size and the raw `before` and `after` beside the four derived numbers, which separates the two at no cost, then fix whichever it is -- a device whose reduction does not see the dropped lanes needs the active set computed in the module rather than taken from the device's implicit one (crates/metal2vulkan/src/lower/simd/group.rs with crates/metal2vulkan-air/src/canon/discard_sink.rs), and a device whose fragment simdgroup is smaller than Metal's is a different answer again. Open: on the orchestrator's todo list for the discard-hoist stream. +discard-quad-sum-placement llvmpipe divergent case/counted_dependent/texels element [image 0, row 0, 0] (I32, byte 0): Metal 1, ours 0 Metal counts the quads the discard drops whole in a simdgroup sum that sits ahead of the discard for a measured reason -- the discard's condition reads the sum (`counted_dependent`), or a device store (`counted_store`) or an atomic (`counted_atomic`) lies between them -- so the kept quad's first channel, `before > after`, is 1. On llvmpipe it is 0: our run's sum saw the same lane count before and after the discard. MoltenVK on this M3 Max answers Metal's 1 exactly, with no notice, so this is one venue's difference and not the module's rule being wrong (verified: a whole-set replay on each venue, 2026-10-23). The cause is NOT established, and the case as written cannot establish it: the four numbers it records are identical under both candidates -- the device's fragment simdgroup holding only the kept quad, so the dropped quads were never in it (the target is 8 by 4, exactly one 32-lane simdgroup if the device packs it that way), and the device's compiler moving the reduction past the discard although `canon/discard_sink.rs` placed it ahead on purpose. Both give before == after and so (0, 0, 0, 0). The next step is the case's: record the simdgroup's own size and the raw `before` and `after` beside the four derived numbers, which separates the two at no cost, then fix whichever it is -- a device whose reduction does not see the dropped lanes needs the active set computed in the module rather than taken from the device's implicit one (crates/metal2vulkan/src/lower/simd/group.rs with crates/metal2vulkan-air/src/canon/discard_sink.rs), and a device whose fragment simdgroup is smaller than Metal's is a different answer again. Open: on the orchestrator's todo list for the discard-hoist stream. +discard-quad-sum-placement llvmpipe divergent case/counted_store/texels element [image 0, row 0, 0] (I32, byte 0): Metal 1, ours 0 Metal counts the quads the discard drops whole in a simdgroup sum that sits ahead of the discard for a measured reason -- the discard's condition reads the sum (`counted_dependent`), or a device store (`counted_store`) or an atomic (`counted_atomic`) lies between them -- so the kept quad's first channel, `before > after`, is 1. On llvmpipe it is 0: our run's sum saw the same lane count before and after the discard. MoltenVK on this M3 Max answers Metal's 1 exactly, with no notice, so this is one venue's difference and not the module's rule being wrong (verified: a whole-set replay on each venue, 2026-10-23). The cause is NOT established, and the case as written cannot establish it: the four numbers it records are identical under both candidates -- the device's fragment simdgroup holding only the kept quad, so the dropped quads were never in it (the target is 8 by 4, exactly one 32-lane simdgroup if the device packs it that way), and the device's compiler moving the reduction past the discard although `canon/discard_sink.rs` placed it ahead on purpose. Both give before == after and so (0, 0, 0, 0). The next step is the case's: record the simdgroup's own size and the raw `before` and `after` beside the four derived numbers, which separates the two at no cost, then fix whichever it is -- a device whose reduction does not see the dropped lanes needs the active set computed in the module rather than taken from the device's implicit one (crates/metal2vulkan/src/lower/simd/group.rs with crates/metal2vulkan-air/src/canon/discard_sink.rs), and a device whose fragment simdgroup is smaller than Metal's is a different answer again. Open: on the orchestrator's todo list for the discard-hoist stream. diff --git a/crates/metal2vulkan-conformance/known-refusals.tsv b/crates/metal2vulkan-conformance/known-refusals.tsv deleted file mode 100644 index 202aa6b7f..000000000 --- a/crates/metal2vulkan-conformance/known-refusals.tsv +++ /dev/null @@ -1,33 +0,0 @@ -# Known refusals: our open gaps, each one an OPEN BUG with a todo behind it. -# -# READ THIS BEFORE ADDING A ROW. A row here is not an accepted difference and it is not permission -# for anything. It is a refusal of something plain Metal does — which, by the owner's standing rule -# that what Metal allows we must allow, is a bug of ours — written down so the one case that holds -# it visible does not make every run red and teach everyone to stop reading the report. An accepted -# difference lives in `docs/API.md` section 10 and is justified; a degradation lives in the degrade -# catalogue and is announced. This file is neither. Nothing here is resolved by being listed. -# -# It is an EXPECTATION, NOT AN ALLOWLIST, and `conformance replay` holds it to that in both -# directions: -# -# - a refusal that is not listed here fails the run: a new gap appeared; -# - a row listed here that is NOT refused any more ALSO fails the run, saying the gap looks -# fixed and the row must go. -# -# That second direction is the whole point. Closing a gap forces the ledger edit, so a row cannot -# outlive the bug it stands for and this file cannot rot into a silencer. It also means a row is -# checked by execution rather than by discipline, which is the standard the rest of the suite is -# held to. -# -# The ledger changes the exit status and nothing else. The report still prints each of these as a -# `Refused` row, with our error, with Metal's own words where its API validation refuses the call -# too, and counted in the suite's own `refused` number. Nothing is laundered. -# -# A row is held only against the cases a run selected, so replaying one case does not read every -# other row as fixed. -# -# Tab-separated. Blank lines and lines from `#` are ignored. -# -# case site our error the gap it is waiting on -mesh-object-draws-partial-threadgroup-6-by-4 case/object-threads-6-by-4/buffer/calls/2-drawMeshThreads Err(Error::Bind("the bind state was refused: Unsupported(Unsupported { feature: MeshShading, needs: NotImplemented, location: None, symbol: None })")) The runtime refuses `drawMeshThreads` where the threads leave a partial object threadgroup, `Unsupported(MeshShading, NotImplemented)` out of the bind state (crates/metal2vulkan/src/bind/graphics.rs, `mesh_draw`'s `threads[i].is_multiple_of(lo[i])` test), while Metal draws it and runs the threads left over. Not a device gap: this M3 Max has mesh shading and draws every other row of the same probe. Measured on it (macOS 27.0.1, plain Metal, our probe gaps/mesh/obj, one shape per process): the draw launches ceil(threads/L) object threadgroups, `threads_per_grid` is the threads asked for, and the last threadgroup on an axis runs with the threads left over as a non-uniform threadgroup exactly as `dispatchThreads:` does for compute - `threads_per_threadgroup` is min(L, threads - group*L) per axis (6 of 64 reports 6), `thread_position_in_threadgroup` and `thread_index_in_threadgroup` run over that reduced size, `simdgroups_per_threadgroup` is ceil of it over 32, and a threadgroup barrier synchronizes the threads left over alone. The cause is that Vulkan has no partial workgroup: the exact form is the one compute already uses, a region per edge dispatched at its own local size, which for a draw means several draws of several pipeline specializations and, on a grid with more than one whole threadgroup on a higher axis, a primitive order that is not Metal's; the alternative is one draw of ceil groups with the object entry reading its reduced size from its `DispatchRegion` record (`MultiRegion` 1 already carries the grid and L, and already reports ceil threadgroups and the asked-for threads), deriving the thread position and index from `lin` over that size and returning before the body past it, which is exact for everything but a threadgroup barrier and so needs a pipeline variant whose compile refuses an object function that synchronizes. Neither is built. On the orchestrator's todo list as runtime work. -mesh-object-draws-partial-threadgroup-5x3-by-4x2 case/object-threads-5x3-by-4x2/buffer/calls/2-drawMeshThreads Err(Error::Bind("the bind state was refused: Unsupported(Unsupported { feature: MeshShading, needs: NotImplemented, location: None, symbol: None })")) The runtime refuses `drawMeshThreads` where the threads leave a partial object threadgroup, `Unsupported(MeshShading, NotImplemented)` out of the bind state (crates/metal2vulkan/src/bind/graphics.rs, `mesh_draw`'s `threads[i].is_multiple_of(lo[i])` test), while Metal draws it and runs the threads left over. Not a device gap: this M3 Max has mesh shading and draws every other row of the same probe. Measured on it (macOS 27.0.1, plain Metal, our probe gaps/mesh/obj, one shape per process): the draw launches ceil(threads/L) object threadgroups, `threads_per_grid` is the threads asked for, and the last threadgroup on an axis runs with the threads left over as a non-uniform threadgroup exactly as `dispatchThreads:` does for compute - `threads_per_threadgroup` is min(L, threads - group*L) per axis (6 of 64 reports 6), `thread_position_in_threadgroup` and `thread_index_in_threadgroup` run over that reduced size, `simdgroups_per_threadgroup` is ceil of it over 32, and a threadgroup barrier synchronizes the threads left over alone. The cause is that Vulkan has no partial workgroup: the exact form is the one compute already uses, a region per edge dispatched at its own local size, which for a draw means several draws of several pipeline specializations and, on a grid with more than one whole threadgroup on a higher axis, a primitive order that is not Metal's; the alternative is one draw of ceil groups with the object entry reading its reduced size from its `DispatchRegion` record (`MultiRegion` 1 already carries the grid and L, and already reports ceil threadgroups and the asked-for threads), deriving the thread position and index from `lin` over that size and returning before the body past it, which is exact for everything but a threadgroup barrier and so needs a pipeline variant whose compile refuses an object function that synchronizes. Neither is built. On the orchestrator's todo list as runtime work. diff --git a/crates/metal2vulkan-conformance/src/bin/conformance.rs b/crates/metal2vulkan-conformance/src/bin/conformance.rs index 5a6d12946..9de5305d8 100644 --- a/crates/metal2vulkan-conformance/src/bin/conformance.rs +++ b/crates/metal2vulkan-conformance/src/bin/conformance.rs @@ -17,13 +17,14 @@ //! fast form of every speed-for-accuracy choice, which is what a consumer runs. Comparing a case //! under both is how the suite says whether a difference is the policy's or the implementation's. //! -//! The command's exit status is 0 only where the selection holds no surprise: no divergence, no -//! unrecorded case, no stale recording, and exactly the refusals `known-refusals.tsv` expects — a -//! refusal it does not list, and a row it lists that is no longer refused, each fail the run. A -//! venue that lacks a feature a case needs does not spoil it. +//! The command's exit status is 0 only where the selection holds no surprise: no unrecorded case, +//! no stale recording, and exactly the gaps `known-gaps.tsv` expects — a refusal or a divergence +//! it does not list, and a row it lists that the run no longer holds on a venue it names, each +//! fail the run. A venue that lacks a feature a case needs does not spoil it. //! -//! The ledger never changes a verdict. A refusal it expects is still printed as `Refused` and -//! still counted, because its rows are open bugs rather than accepted differences. +//! The ledger never changes a verdict. A gap it expects is still printed as `Refused` or +//! `Divergent`, with our answer and Metal's, and still counted, because its rows are open bugs +//! rather than accepted differences. //! //! `cost` is the other half ([`metal2vulkan_conformance::cost`]): it runs our side alone and says //! what the runtime did to answer each case, by count. `--runs N` runs the whole selection N times @@ -99,11 +100,11 @@ fn command() -> Result { "replay" => { let report = run::replay_on_under(venues, policy, &cases)?; print!("{}", report.render()); - // The known-refusals ledger decides the exit status and nothing else: each of its rows - // is still printed above as a `Refused` row and still counted there. It is held in - // both directions, so a new refusal fails the run and a row that is no longer refused - // fails it too. - let ledger = metal2vulkan_conformance::known_refusals::ledger()?; + // The known-gaps ledger decides the exit status and nothing else: each of its rows + // is still printed above as a `Refused` or `Divergent` row and still counted there. + // It is held in both directions and per venue, so a new gap fails the run and a row + // the run no longer holds fails it too. + let ledger = metal2vulkan_conformance::known_gaps::ledger()?; let unexpected = report.unexpected(&ledger); // The cost half is a gate of its own, so it has its own line in the exit status: a // count going over its bound is never a conformance difference, and a conformance @@ -119,19 +120,25 @@ fn command() -> Result { if unexpected.is_empty() && within { let expected = ledger .iter() - .filter(|known| report.rows().iter().any(|row| row.case == known.case)) + .filter(|known| { + report + .rows() + .iter() + .any(|row| row.case == known.case && known.covers_venue(&row.venue)) + }) .count(); if expected > 0 { println!( - "\nthe {expected} refusal(s) above are exactly the open gaps \ - known-refusals.tsv expects, each one a bug with a todo behind it" + "\nthe {expected} row(s) above are exactly the open gaps \ + known-gaps.tsv expects on this venue, each one a bug with a todo behind \ + it" ); } return Ok(true); } println!(); for why in &unexpected { - println!("not what known-refusals.tsv expects: {why}"); + println!("not what known-gaps.tsv expects: {why}"); } Ok(false) } diff --git a/crates/metal2vulkan-conformance/src/case.rs b/crates/metal2vulkan-conformance/src/case.rs index f83d251e0..a47ab5a7e 100644 --- a/crates/metal2vulkan-conformance/src/case.rs +++ b/crates/metal2vulkan-conformance/src/case.rs @@ -1833,6 +1833,13 @@ pub fn call( } Err(failure) => { sites.push(Node::leaf(at, Observed::value(failure.value.clone()))); + // A device's honest gap is recorded at the site, not only where it stops the case. + // The whole-case `LacksFeature` verdict comes from an abort, so without this a case + // that carries on past an unsupported call would have that site read as a refusal of + // ours — the one thing the verdict exists to prevent. + if let Some(needs) = &failure.lacks { + sites.device_gap(at, needs.clone()); + } Err(Abort { at: at.to_owned(), failure, diff --git a/crates/metal2vulkan-conformance/src/cases/textures.rs b/crates/metal2vulkan-conformance/src/cases/textures.rs index 9d0717f28..b6bea6be5 100644 --- a/crates/metal2vulkan-conformance/src/cases/textures.rs +++ b/crates/metal2vulkan-conformance/src/cases/textures.rs @@ -240,7 +240,7 @@ impl TextureRoundTrip { /// answering `Ok` against our `Err`, which the comparison reads as /// [`Refused`](crate::verdict::Verdict::Refused) — never a pass, and never buried in a count. /// -/// What it costs: our typed error is not in the record, so a `known-refusals.tsv` row for such a +/// What it costs: our typed error is not in the record, so a `known-gaps.tsv` row for such a /// format reads `Err(NotMade)` and cannot tell one refusal of ours from another at the same site. /// The reason is one call away in the runtime and the lane keeps it, so the cost is a reader's /// convenience rather than a fact nobody holds — and it buys the alternative's absence: an error diff --git a/crates/metal2vulkan-conformance/src/cases/tile_threadgroups.rs b/crates/metal2vulkan-conformance/src/cases/tile_threadgroups.rs index a94271140..eccd66454 100644 --- a/crates/metal2vulkan-conformance/src/cases/tile_threadgroups.rs +++ b/crates/metal2vulkan-conformance/src/cases/tile_threadgroups.rs @@ -1028,7 +1028,7 @@ mod tests { /// run a case must be its own outcome rather than a failure or a pass. /// /// The other direction is the half that keeps the fix honest: what the bind stage has **not - /// built** stays ours to answer for, so the two mesh rows of `known-refusals.tsv`, whose + /// built** stays ours to answer for, so the two mesh rows of `known-gaps.tsv`, whose /// errors are `Error::Bind(Unsupported(MeshShading, NotImplemented))`, remain refusals. #[test] fn a_dispatch_the_device_cannot_take_is_the_devices_gap() { diff --git a/crates/metal2vulkan-conformance/src/compare.rs b/crates/metal2vulkan-conformance/src/compare.rs index ae87e00c6..851c5b68d 100644 --- a/crates/metal2vulkan-conformance/src/compare.rs +++ b/crates/metal2vulkan-conformance/src/compare.rs @@ -55,6 +55,35 @@ pub struct Refusal { pub documented_by: Option, } +/// A site where plain Metal answered a call and we returned a typed error that is the **venue's** +/// honest gap rather than ours ([`crate::verdict::device_gap`]). +/// +/// Neither a pass nor a failure, and never a [`Refusal`]: the typed error names capabilities a +/// device could enable, or a driver measured to run the thing wrong, so the device truly lacks it +/// and the owner's rule about refusing what Metal allows does not reach it. It is counted apart, +/// printed with what it lacks, and the rest of the case still compares — which is what the +/// whole-case [`LacksFeature`](crate::verdict::Verdict::LacksFeature) verdict cannot do, since +/// that one comes from the case stopping. +#[derive(Clone, Debug, PartialEq)] +pub struct DeviceGap { + /// The site, as node names from the root. + pub path: String, + /// What the venue lacks, in words. + pub needs: String, + /// Our typed error, as the report prints it. + pub ours: String, +} + +impl std::fmt::Display for DeviceGap { + fn fmt(&self, out: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + out, + "{}: the venue lacks {} ({})", + self.path, self.needs, self.ours + ) + } +} + /// A site where Metal did not return from the call and we gave a typed error. /// /// Its own outcome, because it is neither of the two it would otherwise be squeezed into. It is not @@ -126,6 +155,9 @@ pub struct Comparison { pub announced: Vec, pub divergences: Vec, pub refusals: Vec, + /// Sites the venue honestly cannot run ([`DeviceGap`]). Compliant, counted apart, and never + /// among the refusals. + pub device_gaps: Vec, /// Sites where Metal did not return from the call and we gave a typed error. pub never_returned: Vec, /// Allowances whose justification is gone. Each of these fails the case on its own: a @@ -158,10 +190,14 @@ impl Comparison { } /// Whether every field matched exactly and every allowance held unused. + /// + /// A site the venue honestly lacks is not exact: Metal answered the call and we did not, so + /// the case did not compare there. It is compliant, which is a different question. pub fn is_exact(&self) -> bool { self.announced.is_empty() && self.divergences.is_empty() && self.refusals.is_empty() + && self.device_gaps.is_empty() && self.never_returned.is_empty() && self.bad_allowances.is_empty() } @@ -216,6 +252,7 @@ pub fn compare_run( allowances, offered, stopped, + device_gaps: &ours.device_gaps, fired: &mut fired, found: &mut found, }; @@ -260,6 +297,9 @@ struct Walk<'a> { offered: Offered<'a>, /// Whether the run stopped before the end: a site only Metal reached is then no divergence. stopped: bool, + /// The sites our side said the venue honestly lacks ([`Transcript::device_gaps`]), so a + /// refusal there is read as the device's gap and not as ours. + device_gaps: &'a [(String, String)], /// One flag per allowance: whether the walk used it to justify a difference, or named it as /// what documents a refusal. What stays false is an allowance this run never needed. fired: &'a mut [bool], @@ -477,6 +517,12 @@ impl Walk<'_> { DivergenceKind::Negative { metal: fact(metal), ours: fact(ours), + // The side that observed a value, printed, so the site names what it was. + observed: match (fact(metal), fact(ours)) { + (Some(_), None) => Some(crate::diff::print(ours)), + (None, Some(_)) => Some(crate::diff::print(metal)), + _ => None, + }, }, )); } @@ -590,6 +636,18 @@ impl Walk<'_> { /// of its own, because a case must not claim an explanation it cannot show. What a /// justification cannot do is remove the row from [`Comparison::refusals`]. fn refusal(&mut self, path: &str, ours: &Value) { + // A device's honest gap is settled before anything else, and consults no allowance: the + // typed error names capabilities a device could enable or a driver measured to run the + // thing wrong, so the venue truly cannot run the call. It is not ours to answer for and + // it is not a tolerance either. + if let Some((_, needs)) = self.device_gaps.iter().find(|(site, _)| site == path) { + self.found.device_gaps.push(DeviceGap { + path: path.to_owned(), + needs: needs.clone(), + ours: crate::diff::print(ours), + }); + return; + } let mut documented_by = None; let mut first_unjustified = None; for (at, allowance) in self diff --git a/crates/metal2vulkan-conformance/src/diff.rs b/crates/metal2vulkan-conformance/src/diff.rs index c5e547241..f974d1442 100644 --- a/crates/metal2vulkan-conformance/src/diff.rs +++ b/crates/metal2vulkan-conformance/src/diff.rs @@ -79,6 +79,14 @@ pub enum DivergenceKind { Negative { metal: Option, ours: Option, + /// What the side that observed a value observed, in one line, where exactly one side did. + /// + /// It is here because the notices site is this shape: Metal announces nothing and we + /// announce a code, so without the value the difference reads "we observed a value" and + /// names no notice — although at that site **the notice is the whole difference**. A + /// known-gaps row's answer is that printed line, so the row would record a difference + /// without saying which notice it was waiting on. + observed: Option, }, /// The digest both sides took differs, where the recording carries no value to diff. Digest { metal: String, ours: String }, @@ -174,12 +182,23 @@ impl std::fmt::Display for DivergenceKind { DivergenceKind::Kind { metal, ours } => { write!(out, "Metal observed a {metal}, we observed a {ours}") } - DivergenceKind::Negative { metal, ours } => match (metal, ours) { - (Some(fact), None) => write!(out, "Metal recorded {fact:?}, we observed a value"), - (None, Some(fact)) => write!(out, "we recorded {fact:?}, Metal observed a value"), - (Some(metal), Some(ours)) => write!(out, "Metal {metal:?}, ours {ours:?}"), - (None, None) => write!(out, "a negative fact"), - }, + DivergenceKind::Negative { + metal, + ours, + observed, + } => { + let value = observed.as_deref().unwrap_or("a value"); + match (metal, ours) { + (Some(fact), None) => { + write!(out, "Metal recorded {fact:?}, we observed {value}") + } + (None, Some(fact)) => { + write!(out, "we recorded {fact:?}, Metal observed {value}") + } + (Some(metal), Some(ours)) => write!(out, "Metal {metal:?}, ours {ours:?}"), + (None, None) => write!(out, "a negative fact"), + } + } DivergenceKind::Digest { metal, ours } => { write!(out, "the digest is {metal} on Metal and {ours} here") } diff --git a/crates/metal2vulkan-conformance/src/known_gaps.rs b/crates/metal2vulkan-conformance/src/known_gaps.rs new file mode 100644 index 000000000..161c8361c --- /dev/null +++ b/crates/metal2vulkan-conformance/src/known_gaps.rs @@ -0,0 +1,378 @@ +//! The known-gaps ledger: our open gaps, each one an open bug with a todo behind it. +//! +//! A gap is never compliant — a refusal is [`Verdict::Refused`] and a difference nobody announced +//! is [`Verdict::Divergent`] — and this module does not change that. What it changes is the **exit +//! status** of a replay run, and only that: a case that holds a known gap visible would otherwise +//! make every run red, and a report that is always red is a report nobody reads, which would cost +//! us the next real gap. +//! +//! # It is an expectation, not an allowlist +//! +//! `AGENTS.md` is explicit that an allowlist resolves no gap, and this must not become one. Two +//! things keep it from becoming one, and both are mechanical rather than a matter of discipline: +//! +//! - **A gap the ledger does not list fails the run** ([`Expectation::Unlisted`]): a new gap +//! appeared and somebody has to look at it. +//! - **A listed row the run no longer holds also fails the run** ([`Expectation::NoLongerHeld`]), +//! saying the gap looks fixed and the row must go. +//! +//! That second direction is the point. Closing a gap forces the ledger edit, so a row cannot +//! outlive the bug it stands for. A one-directional check would quietly keep passing after the fix +//! and the file would drift into permission for whatever happened to be in it. It has already +//! earned its keep: a product fix landed in this round and the replay named four stale rows before +//! anybody reasoned about the fix. +//! +//! # Two kinds of gap, one file +//! +//! A row names the verdict it expects ([`Expects`]). **A refusal** is a call plain Metal answered +//! and we did not. **A divergence** is a field that differs with nothing announced to justify it. +//! Both are bugs of ours by the owner's standing rule, both have to stay visible, and both need the +//! same two-direction discipline, so they share one file and one mechanism: `AGENTS.md` forbids +//! parallel string lists, and two ledgers would be exactly that. +//! +//! # Per venue +//! +//! A row may name the venue it is expected on ([`KnownGap::venue`]), because a gap can be one +//! venue's and not another's: a pipeline the runtime refuses on MoltenVK for a structural reason +//! can translate on lavapipe, so a global row would fail the lavapipe run for existing. A row +//! naming no venue applies everywhere, which is the **stronger** claim and not the looser one: +//! the second direction then holds it on every venue the run selected its case on, so widening a +//! row's scope makes it harder to satisfy rather than easier. That is what stops a venue-scoped row +//! from becoming a way to silence a venue. +//! +//! The report keeps printing every one of these rows as `Refused` or `Divergent`, with our answer +//! and Metal's, with Metal's own words where its API validation refuses the call too, and counted +//! in the suite's own numbers. Nothing is laundered. +//! +//! A row is held only against the cases a run selected, so replaying one case does not read every +//! other row as fixed. + +use crate::case::Venue; +use crate::replay::Replayed; +use crate::verdict::Verdict; +use std::collections::BTreeSet; + +/// The committed ledger, compiled in so the check needs no path and no filesystem: a replay run +/// inside a container reads the same rows as one on this Mac. +const LEDGER: &str = include_str!("../known-gaps.tsv"); + +/// The venue field of a row that applies to every venue. +pub const EVERY_VENUE: &str = "*"; + +/// The verdict a row expects at its site. +/// +/// Only these two. A case with no Metal answer, a stale recording and a case the venue could not +/// run are never written down: the first two must fail loudly rather than be expected, and the +/// third is not a gap of ours at all. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub enum Expects { + /// We returned a typed error where plain Metal answered the call. + Refused, + /// A field differs and nothing we announced justifies it. + Divergent, +} + +impl Expects { + /// The word the ledger's third field holds, which is also the verdict's own word. + pub fn word(self) -> &'static str { + match self { + Expects::Refused => "refused", + Expects::Divergent => "divergent", + } + } + + /// The verb the report uses of a row that still holds. + fn verb(self) -> &'static str { + match self { + Expects::Refused => "refuses", + Expects::Divergent => "diverges at", + } + } + + /// What `word` names. + fn of(word: &str) -> Option { + match word { + "refused" => Some(Expects::Refused), + "divergent" => Some(Expects::Divergent), + _ => None, + } + } +} + +impl std::fmt::Display for Expects { + fn fmt(&self, out: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + out.write_str(self.word()) + } +} + +/// One gap we have written down as open. +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub struct KnownGap { + /// The case that holds it. + pub case: String, + /// The venue it is expected on: [`EVERY_VENUE`] for all of them, or a pattern held against the + /// venue's own description ([`KnownGap::covers_venue`]). + pub venue: String, + /// The verdict the row expects at its site. + pub expects: Expects, + /// The site, as node names from the root. + pub site: String, + /// What the run answers there, as the report prints it: our typed error for a refusal, and for + /// a divergence the one leaf fact that moved, which names Metal's value and ours. Part of the + /// row's identity, so a gap that changed into another gap at the same site is a new gap rather + /// than this one. + pub answer: String, + /// The gap the row is waiting on, in words: what Metal does, what we do instead, and where the + /// fix belongs. Not compared — it is what a reader needs — but a row must carry one. + pub waiting_on: String, +} + +impl KnownGap { + /// What identifies the row within a venue: the case, the verdict it expects, the site and the + /// answer there. + fn key(&self) -> (&str, Expects, &str, &str) { + (&self.case, self.expects, &self.site, &self.answer) + } + + /// Whether the row is expected on `venue`. + /// + /// [`EVERY_VENUE`] covers all of them. Otherwise the field is held, without case, against the + /// venue's whole description — its device name, driver, API version and Metal level — so a row + /// can name one device (`Apple M3 Max`), one implementation (`llvmpipe`) or a family of them, + /// and a venue that joins later needs no new vocabulary. A pattern that matches nothing holds + /// the row nowhere, so the gap it stands for reads as unlisted and fails the run: a typo is + /// loud rather than silent. + pub fn covers_venue(&self, venue: &Venue) -> bool { + if self.venue == EVERY_VENUE { + return true; + } + venue + .to_string() + .to_lowercase() + .contains(&self.venue.to_lowercase()) + } +} + +/// Why a run is not what the ledger expects. Each of these fails the run. +#[derive(Clone, Debug, PartialEq)] +pub enum Expectation { + /// A gap the ledger does not list: one nobody has written down. + Unlisted { + case: String, + venue: String, + expects: Expects, + site: String, + answer: String, + }, + /// A listed row the run no longer holds on a venue it names: the gap looks fixed, and the row + /// must go. + NoLongerHeld { + gap: KnownGap, + /// The venue it was held against. + venue: String, + }, + /// A failure the ledger has no business covering. A refusal and a divergence are the only + /// expected gaps; an unrecorded case and a stale recording are never written down. + NotLedgerable { case: String, why: String }, +} + +impl std::fmt::Display for Expectation { + fn fmt(&self, out: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Expectation::Unlisted { + case, + venue, + expects, + site, + answer, + } => write!( + out, + "{case} on {venue} is {expects} at {site} and the known-gaps ledger does not list \ + it: {answer}\n a new gap. Fix it, or add a row to known-gaps.tsv naming the gap \ + it waits on" + ), + Expectation::NoLongerHeld { gap, venue } => write!( + out, + "{} on {venue} no longer {} {}, and the known-gaps ledger still lists it\n the \ + gap looks fixed: drop the row from known-gaps.tsv, or scope its venue field if it \ + is another venue's. The ledger must not outlive the bug it stands for.\n the row \ + was waiting on: {}", + gap.case, + gap.expects.verb(), + gap.site, + gap.waiting_on + ), + Expectation::NotLedgerable { case, why } => write!( + out, + "{case}: {why}\n the ledger covers a refusal and a divergence; this is neither" + ), + } + } +} + +/// The committed ledger's rows. +pub fn ledger() -> Result, String> { + parse(LEDGER) +} + +/// `text`'s rows: tab-separated, with blank lines and lines from `#` ignored. +pub fn parse(text: &str) -> Result, String> { + let mut rows = Vec::new(); + for (number, line) in text.lines().enumerate() { + // Only the carriage return is stripped: a trailing tab is a field a row left empty, and + // trimming the line would hide it as a missing field instead. + let line = line.strip_suffix('\r').unwrap_or(line); + if line.trim().is_empty() || line.trim_start().starts_with('#') { + continue; + } + let at = number + 1; + let fields: Vec<&str> = line.split('\t').collect(); + let [case, venue, expects, site, answer, waiting_on] = fields.as_slice() else { + return Err(format!( + "known-gaps.tsv line {at}: {} tab-separated fields, and a row has six: the case, \ + the venue ({EVERY_VENUE} for every venue), the verdict it expects (refused or \ + divergent), the site, our answer there and the gap it waits on", + fields.len() + )); + }; + let Some(expects) = Expects::of(expects.trim()) else { + return Err(format!( + "known-gaps.tsv line {at}: {case} expects {expects:?}, and a row expects either \ + refused — a call plain Metal answered and we did not — or divergent, a field that \ + differs with nothing announced to justify it" + )); + }; + if venue.trim().is_empty() { + return Err(format!( + "known-gaps.tsv line {at}: {case} names no venue. A row that holds everywhere says \ + so with {EVERY_VENUE}, because an empty field reads as a row nobody scoped" + )); + } + if waiting_on.trim().is_empty() { + return Err(format!( + "known-gaps.tsv line {at}: {case} names no gap. A row is an open bug, so it says \ + what Metal does, what we do instead, and where the fix belongs" + )); + } + rows.push(KnownGap { + case: case.trim().to_owned(), + venue: venue.trim().to_owned(), + expects, + site: site.trim().to_owned(), + answer: answer.trim().to_owned(), + waiting_on: waiting_on.trim().to_owned(), + }); + } + Ok(rows) +} + +/// One gap a run held, as a ledger row is written: the case, the verdict, the site and the answer. +/// +/// The venue is not part of it, because the key is only ever read inside one row's own venue. +type Key<'a> = (&'a str, Expects, String, String); + +/// How a replay run's gaps stand against `ledger`: nothing, where what the run held is exactly the +/// ledger's rows over the cases and venues the run selected, and otherwise every way they differ. +/// +/// `rows` is what replay observed. A row the ledger covers still holds its own verdict; this only +/// says whether the run held any surprise. +pub fn against(rows: &[Replayed], ledger: &[KnownGap]) -> Vec { + let mut found = Vec::new(); + // What each row held, as the keys a ledger row is written in. Kept per row, because the + // discipline is per venue: a gap one venue holds says nothing about another's. + let held: Vec<(&Replayed, BTreeSet)> = rows + .iter() + .map(|row| (row, gaps_of(row).collect())) + .collect(); + + for (row, gaps) in &held { + if gaps.is_empty() && !row.verdict.is_compliant() { + // A verdict the ledger cannot carry at all: an unrecorded case or a stale answer. + found.push(Expectation::NotLedgerable { + case: row.case.clone(), + why: row.verdict.to_string(), + }); + continue; + } + for (case, expects, site, answer) in gaps { + let listed = ledger.iter().any(|gap| { + gap.covers_venue(&row.venue) + && gap.key() == (case, *expects, site.as_str(), answer.as_str()) + }); + if !listed { + found.push(Expectation::Unlisted { + case: row.case.clone(), + venue: row.venue.label(), + expects: *expects, + site: site.clone(), + answer: answer.clone(), + }); + } + } + } + + // The other direction, which is what keeps the file from rotting into a silencer: a row the + // run no longer holds is a gap that looks fixed, and the ledger has to lose it. Held per + // venue, and only against the cases a run selected, so replaying one case does not read the + // rest as fixed and a run on one venue does not read another venue's rows as fixed. + for gap in ledger { + for (row, gaps) in &held { + if row.case != gap.case || !gap.covers_venue(&row.venue) { + continue; + } + let still = gaps.iter().any(|(case, expects, site, answer)| { + (*case, *expects, site.as_str(), answer.as_str()) == gap.key() + }); + if !still { + found.push(Expectation::NoLongerHeld { + gap: gap.clone(), + venue: row.venue.label(), + }); + } + } + } + found +} + +/// Every gap one replayed row held, as the keys a ledger row is written in. +/// +/// A row that both diverges and refuses yields both. The verdict of such a row is `Divergent`, +/// since that is the more severe of the two, and it carries the refused sites with it precisely so +/// that a refusal row cannot go unchecked behind a divergence — which would have been a way for a +/// divergence to launder a refusal. +fn gaps_of(row: &Replayed) -> impl Iterator> + '_ { + let (refused, diverged): (&[String], &[crate::diff::Divergence]) = match &row.verdict { + Verdict::Refused { at, .. } => (at, &[]), + Verdict::Divergent { found, refused } => (refused, found), + _ => (&[], &[]), + }; + let case = row.case.as_str(); + refused + .iter() + .map(move |printed| { + let (site, answer) = split_site(printed); + (case, Expects::Refused, site.to_owned(), answer.to_owned()) + }) + .chain(diverged.iter().map(move |divergence| { + ( + case, + Expects::Divergent, + divergence.path.clone(), + divergence.kind.to_string(), + ) + })) +} + +/// A refused site as the verdict prints it, split back into the site and our error there. +/// +/// [`Verdict::Refused`] holds `": "`, and the error may hold the separator itself, so +/// the split takes the first one alone. +fn split_site(printed: &str) -> (&str, &str) { + let (site, error) = printed.split_once(": ").unwrap_or((printed, "")); + // The verdict appends what documents the refusal, which is prose for a reader and not part of + // the row's identity: a gap does not change because Apple reworded its validation message. + let error = error + .split_once(" (documented, not excused, by ") + .map_or(error, |(error, _)| error); + (site.trim(), error.trim()) +} diff --git a/crates/metal2vulkan-conformance/src/known_refusals.rs b/crates/metal2vulkan-conformance/src/known_refusals.rs deleted file mode 100644 index 4e61f7dae..000000000 --- a/crates/metal2vulkan-conformance/src/known_refusals.rs +++ /dev/null @@ -1,204 +0,0 @@ -//! The known-refusals ledger: our open gaps, each one an open bug with a todo behind it. -//! -//! A refusal is never compliant ([`Verdict::Refused`]) and this -//! module does not change that. What it changes is the **exit status** of a replay run, and only -//! that: a case that holds a known gap visible would otherwise make every run red, and a report -//! that is always red is a report nobody reads — which would cost us the next real refusal. -//! -//! # It is an expectation, not an allowlist -//! -//! `AGENTS.md` is explicit that an allowlist resolves no gap, and this must not become one. Two -//! things keep it from becoming one, and both are mechanical rather than a matter of discipline: -//! -//! - **A refusal the ledger does not list fails the run** ([`Expectation::Unlisted`]): a new gap -//! appeared and somebody has to look at it. -//! - **A listed row that is no longer refused also fails the run** -//! ([`Expectation::NoLongerRefused`]), saying the gap looks fixed and the row must go. -//! -//! That second direction is the point. Closing a gap forces the ledger edit, so a row cannot -//! outlive the bug it stands for. A one-directional check would quietly keep passing after the fix -//! and the file would drift into permission for whatever happened to be in it. -//! -//! The report keeps printing every one of these rows as `Refused`, with our error, with Metal's own -//! words where its API validation refuses the call too, and counted in the suite's own `refused` -//! number. Nothing is laundered. -//! -//! A row is held only against the cases a run selected, so replaying one case does not read every -//! other row as fixed. - -use crate::replay::Replayed; -use crate::verdict::Verdict; -use std::collections::BTreeSet; - -/// The committed ledger, compiled in so the check needs no path and no filesystem: a replay run -/// inside a container reads the same rows as one on this Mac. -const LEDGER: &str = include_str!("../known-refusals.tsv"); - -/// One refusal we have written down as an open gap. -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] -pub struct KnownRefusal { - /// The case that refuses. - pub case: String, - /// The site it refuses at, as node names from the root. - pub site: String, - /// Our typed error there, as the report prints it. Part of the row's identity, so a refusal - /// that changed into another refusal at the same site is a new gap rather than this one. - pub error: String, - /// The gap the row is waiting on, in words: what Metal does, what we do instead, and where the - /// fix belongs. Not compared — it is what a reader needs — but a row must carry one. - pub waiting_on: String, -} - -impl KnownRefusal { - /// What identifies the row: the case, the site and our error there. - fn key(&self) -> (&str, &str, &str) { - (&self.case, &self.site, &self.error) - } -} - -/// Why a run is not what the ledger expects. Each of these fails the run. -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum Expectation { - /// A refusal the ledger does not list: a gap nobody has written down. - Unlisted { - case: String, - venue: String, - site: String, - error: String, - }, - /// A listed row the run did not refuse: the gap looks fixed, and the row must go. - NoLongerRefused(KnownRefusal), - /// A failure the ledger has no business covering. Only a refusal is ever an expected gap; a - /// divergence, an unrecorded case and a stale recording are never written down. - NotLedgerable { case: String, why: String }, -} - -impl std::fmt::Display for Expectation { - fn fmt(&self, out: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Expectation::Unlisted { - case, - venue, - site, - error, - } => write!( - out, - "{case} on {venue} refused {site} and the known-refusals ledger does not list it: \ - {error}\n a new gap. Fix it, or add a row to known-refusals.tsv naming the gap \ - it waits on" - ), - Expectation::NoLongerRefused(known) => write!( - out, - "{} no longer refuses {}, and the known-refusals ledger still lists it\n the gap \ - looks fixed: drop the row from known-refusals.tsv. The ledger must not outlive \ - the bug it stands for.\n the row was waiting on: {}", - known.case, known.site, known.waiting_on - ), - Expectation::NotLedgerable { case, why } => write!( - out, - "{case}: {why}\n the ledger covers refusals alone; this is not one" - ), - } - } -} - -/// The committed ledger's rows. -pub fn ledger() -> Result, String> { - parse(LEDGER) -} - -/// `text`'s rows: tab-separated, with blank lines and lines from `#` ignored. -pub fn parse(text: &str) -> Result, String> { - let mut rows = Vec::new(); - for (number, line) in text.lines().enumerate() { - // Only the carriage return is stripped: a trailing tab is a field a row left empty, and - // trimming the line would hide it as a missing field instead. - let line = line.strip_suffix('\r').unwrap_or(line); - if line.trim().is_empty() || line.trim_start().starts_with('#') { - continue; - } - let at = number + 1; - let fields: Vec<&str> = line.split('\t').collect(); - let [case, site, error, waiting_on] = fields.as_slice() else { - return Err(format!( - "known-refusals.tsv line {at}: {} tab-separated fields, and a row has four: the \ - case, the site, our error and the gap it waits on", - fields.len() - )); - }; - if waiting_on.trim().is_empty() { - return Err(format!( - "known-refusals.tsv line {at}: {case} names no gap. A row is an open bug, so it \ - says what Metal does, what we do instead, and where the fix belongs" - )); - } - rows.push(KnownRefusal { - case: case.trim().to_owned(), - site: site.trim().to_owned(), - error: error.trim().to_owned(), - waiting_on: waiting_on.trim().to_owned(), - }); - } - Ok(rows) -} - -/// How a replay run's refusals stand against `ledger`: nothing, where the refused set is exactly -/// the ledger's rows over the cases the run selected, and otherwise every way they differ. -/// -/// `rows` is what replay observed. A row the ledger covers still holds its `Refused` verdict; this -/// only says whether the run held any surprise. -pub fn against(rows: &[Replayed], ledger: &[KnownRefusal]) -> Vec { - let selected: BTreeSet<&str> = rows.iter().map(|row| row.case.as_str()).collect(); - let listed: BTreeSet<(&str, &str, &str)> = ledger.iter().map(KnownRefusal::key).collect(); - let mut found = Vec::new(); - let mut refused: BTreeSet<(&str, &str, &str)> = BTreeSet::new(); - - for row in rows { - match &row.verdict { - Verdict::Refused { at, .. } => { - for site in at { - let (site, error) = split_site(site); - let key = (row.case.as_str(), site, error); - refused.insert(key); - if !listed.contains(&key) { - found.push(Expectation::Unlisted { - case: row.case.clone(), - venue: row.venue.label(), - site: site.to_owned(), - error: error.to_owned(), - }); - } - } - } - verdict if !verdict.is_compliant() => found.push(Expectation::NotLedgerable { - case: row.case.clone(), - why: verdict.to_string(), - }), - _ => {} - } - } - - // The other direction, which is what keeps the file from rotting into a silencer: a row the - // run did not refuse is a gap that looks fixed, and the ledger has to lose it. Held only - // against the cases the run selected, so replaying one case does not read the rest as fixed. - for known in ledger { - if selected.contains(known.case.as_str()) && !refused.contains(&known.key()) { - found.push(Expectation::NoLongerRefused(known.clone())); - } - } - found -} - -/// A refused site as the verdict prints it, split back into the site and our error there. -/// -/// [`Verdict::Refused`] holds `": "`, and the error may hold the separator itself, so -/// the split takes the first one alone. -fn split_site(printed: &str) -> (&str, &str) { - let (site, error) = printed.split_once(": ").unwrap_or((printed, "")); - // The verdict appends what documents the refusal, which is prose for a reader and not part of - // the row's identity: a gap does not change because Apple reworded its validation message. - let error = error - .split_once(" (documented, not excused, by ") - .map_or(error, |(error, _)| error); - (site.trim(), error.trim()) -} diff --git a/crates/metal2vulkan-conformance/src/lib.rs b/crates/metal2vulkan-conformance/src/lib.rs index 4663ef1f4..a5137d92a 100644 --- a/crates/metal2vulkan-conformance/src/lib.rs +++ b/crates/metal2vulkan-conformance/src/lib.rs @@ -23,11 +23,12 @@ //! and compares, and needs no Metal at all. //! - A **report** ([`report`]) over a selection gives the verdict counts and the matrix of case //! against venue. -//! - A **known-refusals ledger** ([`known_refusals`]) holds the gaps we have written down, so one -//! case that keeps an open bug visible does not make every run red. It changes the exit status -//! and nothing else: the row still reads `Refused` and still counts. It is an expectation, not -//! an allowlist — a refusal it does not list fails the run, and a row it lists that is no longer -//! refused fails the run too, so a row cannot outlive the bug it stands for. +//! - A **known-gaps ledger** ([`known_gaps`]) holds the gaps we have written down — a refusal or a +//! difference nobody announced, optionally scoped to a venue — so one case that keeps an open bug +//! visible does not make every run red. It changes the exit status and nothing else: the row +//! still reads `Refused` or `Divergent`, with both answers, and still counts. It is an +//! expectation, not an allowlist — a gap it does not list fails the run, and a row it lists that +//! the run no longer holds fails the run too, so a row cannot outlive the bug it stands for. //! //! What stays out, because Metal has no counterpart and a host without Metal can have no answer: //! internal counters, and which variant or pipeline the implementation chose. Those stay device @@ -47,7 +48,7 @@ pub mod diff; pub mod event_orders; pub mod fixture; pub mod handler_waits; -pub mod known_refusals; +pub mod known_gaps; pub mod measured; pub mod queue_slots; pub mod record; diff --git a/crates/metal2vulkan-conformance/src/report.rs b/crates/metal2vulkan-conformance/src/report.rs index 312a5ca31..be4122f32 100644 --- a/crates/metal2vulkan-conformance/src/report.rs +++ b/crates/metal2vulkan-conformance/src/report.rs @@ -5,7 +5,7 @@ use crate::compare::Unfired; use crate::cost::{self, CostVerdict, Counts, Region}; -use crate::known_refusals::{against, Expectation, KnownRefusal}; +use crate::known_gaps::{against, Expectation, KnownGap}; use crate::replay::{ReplayError, Replayed}; use crate::verdict::Verdict; use std::collections::{BTreeMap, BTreeSet}; @@ -132,14 +132,14 @@ impl Report { self.errors.is_empty() && self.rows.iter().all(|row| row.verdict.is_compliant()) } - /// How the run's refusals stand against the known-refusals `ledger`: nothing where the refused + /// How the run's refusals stand against the known-gaps `ledger`: nothing where the refused /// set is exactly the ledger's rows over the cases the run selected, and otherwise every way - /// they differ ([`crate::known_refusals`]). + /// they differ ([`crate::known_gaps`]). /// /// This is what the command exits by. It does not touch a verdict: a refusal the ledger /// expects is still a `Refused` row in the counts and is still printed in full, because the /// ledger's rows are open bugs rather than accepted differences. - pub fn unexpected(&self, ledger: &[KnownRefusal]) -> Vec { + pub fn unexpected(&self, ledger: &[KnownGap]) -> Vec { let mut found = against(&self.rows, ledger); for error in &self.errors { found.push(Expectation::NotLedgerable { diff --git a/crates/metal2vulkan-conformance/src/tests.rs b/crates/metal2vulkan-conformance/src/tests.rs index 89ee009fa..c0789275b 100644 --- a/crates/metal2vulkan-conformance/src/tests.rs +++ b/crates/metal2vulkan-conformance/src/tests.rs @@ -35,6 +35,9 @@ struct StubSide { notices: Vec, /// A call that fails, by its name, with the failure it gives. refuse: Option<(&'static str, Failure)>, + /// The device name the side's venue answers, so a test can hold a venue-scoped ledger row + /// against one venue and not another. + device: &'static str, made: u32, } @@ -45,10 +48,17 @@ impl StubSide { status: "Completed", notices: Vec::new(), refuse: None, + device: "stub", made: 0, } } + /// The same side on a venue of another name. + fn on(mut self, device: &'static str) -> Self { + self.device = device; + self + } + fn announcing(mut self, codes: &[Degradation]) -> Self { self.notices = codes.iter().map(|kind| kind.code().to_owned()).collect(); self @@ -75,12 +85,7 @@ impl StubSide { impl Side for StubSide { fn venue(&self) -> Venue { - Venue { - device: "stub".to_owned(), - driver: "stub".to_owned(), - api: "none".to_owned(), - metal_level: ORACLE_OS_VERSION.to_owned(), - } + venue_named(self.device) } fn library(&mut self, _source: &ShaderSource<'_>) -> Answer { @@ -112,7 +117,10 @@ impl Side for StubSide { _row_pitch: u32, _bytes: &[u8], ) -> Answer { - Ok(self.handle()) + match self.refusal("texture") { + Some(failure) => Err(failure), + None => Ok(self.handle()), + } } fn read_texture( @@ -300,6 +308,103 @@ impl Case for WordsCase { } } +/// A case written for the known-gaps ledger's own tests: one site that a side can be told to +/// refuse **without stopping the case**, and one site whose value can move, so a test can hold a +/// refusal row, a divergence row, or both of one case at once. +/// +/// Its own case rather than a real one, on purpose. A test over a real case can only hold the gaps +/// that case happens to have today, so the day the product fixes one the test keeps passing while +/// proving nothing — and the point of the ledger's second direction is that a row cannot outlive +/// its bug. This case owns its inputs and both of its outcomes, so each direction can be broken +/// deliberately and watched to fail. +struct LedgerCase { + name: &'static str, +} + +impl LedgerCase { + fn new(name: &'static str) -> Self { + Self { name } + } + + /// The transcript a side that answered everything, with `output` at the output site, emits: + /// Metal's answer for this case. + fn metal(&self, output: u64) -> Transcript { + let mut sites = Sites::new(); + sites.push(crate::case::inputs_node(&self.inputs().unwrap())); + sites.value("library", Value::ok(Value::Absent)); + sites.value("texture", Value::ok(Value::Absent)); + sites.value("pipeline", Value::ok(Value::Absent)); + sites.value("buffer/0", Value::ok(Value::Absent)); + sites.value("dispatch", Value::ok(Value::Absent)); + sites.value("status", Value::ok(Value::unit_variant("Completed"))); + sites.value("read-back", Value::ok(Value::Absent)); + sites.value("output", Value::Uint(output)); + sites.notices(NOTICES_SITE, &[] as &[&str]); + sites.finish() + } +} + +impl Case for LedgerCase { + fn name(&self) -> &'static str { + self.name + } + + fn metal_source(&self) -> MetalSource { + MetalSource::Run + } + + fn inputs(&self) -> Result, String> { + Ok(vec![Input::bytes("buffer:0", &[0u8; 4])]) + } + + fn allowances(&self) -> Vec { + Vec::new() + } + + fn run(&self, side: &mut dyn Side, sites: &mut Sites) -> Result<(), Abort> { + let source = ShaderSource { + bitcode: &[], + air_text: "", + entry: "gap", + }; + let library = made(sites, "library", side.library(&source))?; + // Recorded and carried past, which is the whole point of the site: a refusal here is one + // site of the transcript rather than an abort, so one run can hold a refusal and a + // difference at the same time. + let _ = call( + sites, + "texture", + side.texture_2d( + metal2vulkan::metal::PixelFormat::RGBA8Unorm, + [1, 1], + 4, + &[0u8; 4], + ), + |_| Value::Absent, + ); + let pipeline = made(sites, "pipeline", side.compute_pipeline(library, "gap"))?; + let buffer = made(sites, "buffer/0", side.zeroed_buffer(4))?; + let command_buffer = made( + sites, + "dispatch", + side.dispatch( + pipeline, + &crate::case::Bindings::buffers(&[buffer]), + [1, 1, 1], + [1, 1, 1], + ), + )?; + call(sites, "status", side.wait(command_buffer), Clone::clone)?; + let bytes = call(sites, "read-back", side.read_buffer(buffer, 0, 4), |_| { + Value::Absent + })?; + let mut word = [0u8; 4]; + word.copy_from_slice(&bytes[..4]); + sites.value("output", Value::Uint(u64::from(u32::from_le_bytes(word)))); + Ok(()) + } +} + /// The words `values` are, as little-endian bytes. fn words(values: &[u32]) -> Vec { values.iter().flat_map(|word| word.to_le_bytes()).collect() @@ -341,7 +446,7 @@ fn one_word_moving_names_its_row_and_index() { ); let mut side = StubSide::new(words(&[1, 2, 9, 4])); let replayed = replay_against(&case, &mut side, &recording).unwrap(); - let Verdict::Divergent { found } = &replayed.verdict else { + let Verdict::Divergent { found, .. } = &replayed.verdict else { panic!("not divergent: {}", replayed.verdict); }; assert_eq!(found.len(), 1, "{found:?}"); @@ -401,7 +506,7 @@ fn an_allowance_whose_notice_did_not_fire_fails_the_case() { // The bytes differ and the allowance would cover them, but no notice was announced. let mut side = StubSide::new(words(&[1, 7])); let replayed = replay_against(&case, &mut side, &recording).unwrap(); - let Verdict::Divergent { found } = &replayed.verdict else { + let Verdict::Divergent { found, .. } = &replayed.verdict else { panic!("not divergent: {}", replayed.verdict); }; let printed = format!("{found:?}"); @@ -808,13 +913,21 @@ fn a_negative_fact_differs_from_a_value_rather_than_from_an_absent_field() { let ours = Transcript::new(vec![Node::leaf("blocked", Observed::value(Value::Uint(3)))]); let found = compare(&metal, &ours, &[], Offered::notices(&[])); assert_eq!(found.divergences.len(), 1); - assert!(matches!( - found.divergences[0].kind, - DivergenceKind::Negative { - metal: Some(Negative::DidNotBlock), - ours: None - } - )); + let DivergenceKind::Negative { + metal, + ours, + observed, + } = &found.divergences[0].kind + else { + panic!("{:?}", found.divergences[0]); + }; + assert_eq!(*metal, Some(Negative::DidNotBlock)); + assert_eq!(*ours, None); + // The value the other side observed is named, not left as "a value": at the notices site the + // value IS the whole difference, and a known-gaps row's answer is this printed line. + assert_eq!(observed.as_deref(), Some("3 (0x3)")); + let printed = found.divergences[0].kind.to_string(); + assert!(printed.contains("we observed 3 (0x3)"), "{printed}"); } #[test] @@ -1619,11 +1732,11 @@ fn the_committed_recordings_carry_all_three_validated_answers() { /// The committed ledger parses, every row names a gap, and each row's case is a real case. /// -/// A row whose case has been renamed away would otherwise read as "no longer refused" forever, or +/// A row whose case has been renamed away would otherwise read as "no longer held" forever, or /// never be held at all, and either way the row would stop meaning anything. #[test] -fn the_known_refusals_ledger_parses_and_names_real_cases() { - let ledger = crate::known_refusals::ledger().unwrap(); +fn the_known_gaps_ledger_parses_and_names_real_cases() { + let ledger = crate::known_gaps::ledger().unwrap(); assert!( !ledger.is_empty(), "the ledger is empty; drop the machinery" @@ -1635,7 +1748,10 @@ fn the_known_refusals_ledger_parses_and_names_real_cases() { known.case ); assert!(known.site.starts_with("case/"), "{known:?}"); - assert!(!known.error.is_empty(), "{known:?}"); + assert!(!known.answer.is_empty(), "{known:?}"); + // A row says where it is expected, and says "everywhere" in words rather than by leaving + // the field blank. + assert!(!known.venue.is_empty(), "{known:?}"); // A row is an open bug, so it says where the fix belongs. assert!( known.waiting_on.len() > 40, @@ -1646,7 +1762,7 @@ fn the_known_refusals_ledger_parses_and_names_real_cases() { } // The rows this round left open, and what they are waiting on: `drawMeshThreads` whose // threads leave a partial object threadgroup, which Metal runs with the threads left over. - let partial: Vec<&crate::known_refusals::KnownRefusal> = ledger + let partial: Vec<&crate::known_gaps::KnownGap> = ledger .iter() .filter(|known| { known @@ -1656,6 +1772,7 @@ fn the_known_refusals_ledger_parses_and_names_real_cases() { .collect(); assert_eq!(partial.len(), 2, "{ledger:?}"); for known in partial { + assert_eq!(known.expects, crate::known_gaps::Expects::Refused); assert!(known.site.ends_with("drawMeshThreads"), "{known:?}"); assert!( known.waiting_on.contains("partial object threadgroup"), @@ -1663,6 +1780,23 @@ fn the_known_refusals_ledger_parses_and_names_real_cases() { known.waiting_on ); } + // The divergence rows this round left open: the fragment quad's placement on llvmpipe, which + // MoltenVK answers exactly, so the rows are venue-scoped rather than global. + let quads: Vec<&crate::known_gaps::KnownGap> = ledger + .iter() + .filter(|known| known.case == "discard-quad-sum-placement") + .collect(); + assert_eq!(quads.len(), 3, "{ledger:?}"); + for known in quads { + assert_eq!(known.expects, crate::known_gaps::Expects::Divergent); + assert_eq!(known.venue, "llvmpipe"); + // A divergence row carries both answers, because the leaf fact that moved names them. + assert!(known.answer.contains("Metal 1"), "{known:?}"); + assert!(known.answer.contains("ours 0"), "{known:?}"); + // And it is honest about what is not established, which is the whole cause. + assert!(known.waiting_on.contains("NOT established"), "{known:?}"); + } + // The zero-screen-width refusal is closed, so no row may name that case: the ledger holds // rows in both directions and a stale row would fail the run it is selected in. assert!( @@ -1673,24 +1807,49 @@ fn the_known_refusals_ledger_parses_and_names_real_cases() { ); } -/// A malformed ledger is refused rather than read loosely: a row must carry all four fields, and -/// must name the gap it waits on. +/// A malformed ledger is refused rather than read loosely: a row must carry all six fields, must +/// name a verdict the ledger can carry, must say which venue it holds on, and must name the gap it +/// waits on. #[test] -fn a_ledger_row_without_its_gap_is_refused() { - let parse = crate::known_refusals::parse; +fn a_ledger_row_missing_a_field_is_refused() { + let parse = crate::known_gaps::parse; assert!(parse("# just a comment\n\n").unwrap().is_empty()); - let row = "a-case\tcase/map\tErr(Error::Invalid)\tthe runtime refuses what Metal does"; + let row = + "a-case\t*\trefused\tcase/map\tErr(Error::Invalid)\tthe runtime refuses what Metal does"; assert_eq!(parse(row).unwrap().len(), 1); - let why = parse("a-case\tcase/map\tErr(Error::Invalid)\t").unwrap_err(); + let why = parse("a-case\t*\trefused\tcase/map\tErr(Error::Invalid)\t").unwrap_err(); assert!(why.contains("names no gap"), "{why}"); - let why = parse("a-case\tcase/map").unwrap_err(); - assert!(why.contains("four"), "{why}"); + let why = parse("a-case\t*\trefused\tcase/map").unwrap_err(); + assert!(why.contains("six"), "{why}"); + // An unrecorded case and a stale recording are never written down, so no other word parses. + let why = parse("a-case\t*\tunrecorded\tcase/map\tnothing\tsome gap").unwrap_err(); + assert!(why.contains("refused"), "{why}"); + assert!(why.contains("divergent"), "{why}"); + // "Everywhere" is said in words. An empty field is a row nobody scoped, which would read as a + // venue pattern matching nothing. + let why = parse("a-case\t\trefused\tcase/map\tErr(Error::Invalid)\tsome gap").unwrap_err(); + assert!(why.contains("names no venue"), "{why}"); + let row = parse("a-case\tllvmpipe\tdivergent\tcase/out\tMetal 1, ours 2\ta gap of ours") + .unwrap() + .remove(0); + assert_eq!(row.expects, crate::known_gaps::Expects::Divergent); + assert_eq!(row.venue, "llvmpipe"); +} + +/// A venue, for a test that holds a row against one venue and not another. +fn venue_named(device: &str) -> Venue { + Venue { + device: device.to_owned(), + driver: "stub".to_owned(), + api: "none".to_owned(), + metal_level: ORACLE_OS_VERSION.to_owned(), + } } /// The ledger is an expectation held in both directions, and it changes no verdict. #[test] fn the_ledger_fails_on_a_new_refusal_and_on_one_that_is_gone() { - use crate::known_refusals::{against, Expectation, KnownRefusal}; + use crate::known_gaps::{against, Expectation, Expects, KnownGap, EVERY_VENUE}; let case = WordsCase::new("words", 2); let recording = recording_of(&case, case.transcript(words(&[1, 2]), "Completed", &[]), 3); let mut side = StubSide::new(Vec::new()).refusing( @@ -1708,25 +1867,36 @@ fn the_ledger_fails_on_a_new_refusal_and_on_one_that_is_gone() { assert_eq!(found.len(), 1, "{found:?}"); let Expectation::Unlisted { case: named, + expects, site, - error, + answer, .. } = &found[0] else { panic!("{found:?}"); }; assert_eq!(named, "words"); + assert_eq!(*expects, Expects::Refused); assert_eq!(site, "case/dispatch"); // Written down exactly: nothing unexpected, so the run may exit 0. - let listed = vec![KnownRefusal { + let listed = vec![KnownGap { case: "words".to_owned(), + venue: EVERY_VENUE.to_owned(), + expects: Expects::Refused, site: site.clone(), - error: error.clone(), + answer: answer.clone(), waiting_on: "the stub refuses the dispatch, which is the point of the stub".to_owned(), }]; assert_eq!(against(&rows, &listed), Vec::new()); + // The row's identity is the verdict it expects as well as the site and the answer: the same + // site written down as a divergence does not cover a refusal. + let mut as_divergence = listed.clone(); + as_divergence[0].expects = Expects::Divergent; + let found = against(&rows, &as_divergence); + assert_eq!(found.len(), 2, "{found:?}"); + // The direction that keeps the file from rotting: the same ledger against a run that did NOT // refuse fails, and says the row must go. let mut clean = StubSide::new(words(&[1, 2])); @@ -1734,20 +1904,22 @@ fn the_ledger_fails_on_a_new_refusal_and_on_one_that_is_gone() { assert_eq!(passed.verdict.word(), "exact"); let found = against(std::slice::from_ref(&passed), &listed); assert_eq!(found.len(), 1, "{found:?}"); - let Expectation::NoLongerRefused(known) = &found[0] else { + let Expectation::NoLongerHeld { gap, .. } = &found[0] else { panic!("{found:?}"); }; - assert_eq!(known.case, "words"); + assert_eq!(gap.case, "words"); let printed = found[0].to_string(); - assert!(printed.contains("looks fixed"), "{printed}"); + assert!(printed.contains("no longer refuses"), "{printed}"); assert!(printed.contains("drop the row"), "{printed}"); // A row is held only against the cases a run selected, so replaying one case does not read // every other row as fixed. - let elsewhere = vec![KnownRefusal { + let elsewhere = vec![KnownGap { case: "another-case".to_owned(), + venue: EVERY_VENUE.to_owned(), + expects: Expects::Refused, site: "case/map".to_owned(), - error: "Err(Error::Invalid)".to_owned(), + answer: "Err(Error::Invalid)".to_owned(), waiting_on: "a gap of some other case, which this run did not select".to_owned(), }]; assert_eq!( @@ -1756,17 +1928,313 @@ fn the_ledger_fails_on_a_new_refusal_and_on_one_that_is_gone() { "the unlisted one alone" ); - // A divergence is never a ledger row: only a refusal is ever an expected gap. - let mut wrong = StubSide::new(words(&[1, 9])); - let diverged = replay_against(&case, &mut wrong, &recording).unwrap(); - assert_eq!(diverged.verdict.word(), "divergent"); - let found = against(std::slice::from_ref(&diverged), &[]); + // An unrecorded case is never a ledger row: only a refusal and a divergence are. + let stale = crate::replay::Replayed { + case: "words".to_owned(), + venue: venue_named("stub"), + verdict: Verdict::Unrecorded { + why: "no Metal answer at Metal level 99".to_owned(), + }, + allowances: Default::default(), + measured_on: None, + ours: Sites::new().finish(), + }; + let found = against(std::slice::from_ref(&stale), &[]); assert!( matches!(found.as_slice(), [Expectation::NotLedgerable { .. }]), "{found:?}" ); } +/// A row that names a venue is held on that venue, in **both** directions, and nowhere else. +/// +/// The gap this closes: a row was global, so a case that plain Metal answers and we refuse on one +/// venue for a structural reason — while the same pipeline translates on another — could not be +/// written down at all. The row was needed by one run and failed the other for existing. +/// +/// It is held on a case of this test's own ([`LedgerCase`]) rather than on a real one, because a +/// test over a real case can only hold the gaps that case happens to have today: the day the +/// product fixes one, such a test stops proving anything without saying so. +#[test] +fn a_venue_scoped_row_is_held_on_its_venue_and_nowhere_else() { + use crate::known_gaps::{against, Expectation, Expects, KnownGap}; + let case = LedgerCase::new("ledger-venue-scope"); + let recording = recording_of(&case, case.metal(7), 3); + let refusal = Failure::named("Error::Invalid", "this venue's pipeline is refused"); + + // One venue refuses; the other runs the same case exactly. + let mut refusing = StubSide::new(words(&[7])) + .on("Woven Vulkan") + .refusing("texture", refusal); + let refused = replay_against(&case, &mut refusing, &recording).unwrap(); + assert_eq!(refused.verdict.word(), "refused"); + let mut elsewhere = StubSide::new(words(&[7])).on("llvmpipe (LLVM 19.1.7, 128 bits)"); + let exact = replay_against(&case, &mut elsewhere, &recording).unwrap(); + assert_eq!(exact.verdict.word(), "exact"); + + let Verdict::Refused { at, .. } = &refused.verdict else { + panic!("{:?}", refused.verdict); + }; + let (site, answer) = at[0].split_once(": ").unwrap(); + let row = KnownGap { + case: case.name().to_owned(), + venue: "woven".to_owned(), + expects: Expects::Refused, + site: site.to_owned(), + answer: answer.to_owned(), + waiting_on: "the venue's own structural gap, written down for this test alone".to_owned(), + }; + let listed = vec![row.clone()]; + + // On the venue it names, the row covers the refusal and the run may exit 0. + assert_eq!(against(std::slice::from_ref(&refused), &listed), Vec::new()); + // On the other venue, the row is not held at all — neither direction — so a run there is clean + // rather than failing because another venue's gap is written down. + assert_eq!(against(std::slice::from_ref(&exact), &listed), Vec::new()); + + // BOTH directions on the venue it names. The row must not become a way to silence a venue, so + // a run on `Woven Vulkan` that stops refusing fails and names the gap the row waited on. + let mut fixed = StubSide::new(words(&[7])).on("Woven Vulkan"); + let now_exact = replay_against(&case, &mut fixed, &recording).unwrap(); + assert_eq!(now_exact.verdict.word(), "exact"); + let found = against(std::slice::from_ref(&now_exact), &listed); + let [Expectation::NoLongerHeld { gap, venue }] = found.as_slice() else { + panic!("{found:?}"); + }; + assert_eq!(gap.venue, "woven"); + assert_eq!(venue, "Woven Vulkan"); + + // And the other direction on the venue it does not name: the refusal appearing there is a new + // gap, because this row says nothing about that venue. + let mut other = StubSide::new(words(&[7])) + .on("llvmpipe (LLVM 19.1.7, 128 bits)") + .refusing( + "texture", + Failure::named("Error::Invalid", "this venue's pipeline is refused"), + ); + let refused_elsewhere = replay_against(&case, &mut other, &recording).unwrap(); + let found = against(std::slice::from_ref(&refused_elsewhere), &listed); + assert!( + matches!(found.as_slice(), [Expectation::Unlisted { .. }]), + "{found:?}" + ); + + // A row naming no venue is the STRONGER claim, not the looser one: it is then held on every + // venue the run selected the case on, so the venue that does not refuse fails it. + let mut global = listed.clone(); + global[0].venue = crate::known_gaps::EVERY_VENUE.to_owned(); + let rows = vec![refused.clone(), exact.clone()]; + let found = against(&rows, &global); + let [Expectation::NoLongerHeld { venue, .. }] = found.as_slice() else { + panic!("{found:?}"); + }; + assert_eq!(venue, "llvmpipe (LLVM 19.1.7, 128 bits)"); + + // A venue pattern that matches nothing holds the row nowhere, so its gap reads as unlisted and + // the run fails: a typo is loud rather than silent. + let mut typo = listed.clone(); + typo[0].venue = "wovenn".to_owned(); + let found = against(std::slice::from_ref(&refused), &typo); + assert!( + matches!(found.as_slice(), [Expectation::Unlisted { .. }]), + "{found:?}" + ); +} + +/// A divergence is a ledger row of its own, held in **both** directions, and it is still printed +/// and still counted as `Divergent`. +/// +/// The gap this closes: the ledger covered refusals alone, so a known product bug that shows as a +/// difference rather than as a typed error had nowhere to live and made the whole-set replay exit +/// non-zero with no entry possible. +#[test] +fn a_divergence_row_is_held_in_both_directions() { + use crate::known_gaps::{against, Expectation, Expects, KnownGap, EVERY_VENUE}; + let case = LedgerCase::new("ledger-divergence"); + let recording = recording_of(&case, case.metal(7), 3); + + let mut moved = StubSide::new(words(&[9])); + let diverged = replay_against(&case, &mut moved, &recording).unwrap(); + // The ledger changes no verdict: the row is still `Divergent` and still non-compliant, so it + // is still printed and still counted in the suite's own numbers. + assert_eq!(diverged.verdict.word(), "divergent"); + assert!(!diverged.verdict.is_compliant()); + let Verdict::Divergent { found, .. } = &diverged.verdict else { + panic!("{:?}", diverged.verdict); + }; + let [divergence] = found.as_slice() else { + panic!("{found:?}"); + }; + // The row carries our answer and Metal's, because the leaf fact that moved names both. + let answer = divergence.kind.to_string(); + assert!(answer.contains("Metal 7"), "{answer}"); + assert!(answer.contains("ours 9"), "{answer}"); + + // Unlisted, a divergence fails the run, and the report says which verdict it was. + let found = against(std::slice::from_ref(&diverged), &[]); + let [unlisted @ Expectation::Unlisted { expects, .. }] = found.as_slice() else { + panic!("{found:?}"); + }; + assert_eq!(*expects, Expects::Divergent); + assert!(unlisted.to_string().contains("divergent"), "{unlisted}"); + + let listed = vec![KnownGap { + case: case.name().to_owned(), + venue: EVERY_VENUE.to_owned(), + expects: Expects::Divergent, + site: divergence.path.clone(), + answer: answer.clone(), + waiting_on: "a difference this test writes down on purpose, to prove the row is held" + .to_owned(), + }]; + assert_eq!( + against(std::slice::from_ref(&diverged), &listed), + Vec::new() + ); + + // The answer is part of the row's identity, so a difference that moved to another value is a + // new gap rather than this one. + let mut again = StubSide::new(words(&[8])); + let moved_again = replay_against(&case, &mut again, &recording).unwrap(); + let found = against(std::slice::from_ref(&moved_again), &listed); + assert_eq!(found.len(), 2, "{found:?}"); + + // The direction that keeps the file from rotting, for a divergence as for a refusal: a run + // that no longer diverges fails and names the gap the row was waiting on. + let mut fixed = StubSide::new(words(&[7])); + let exact = replay_against(&case, &mut fixed, &recording).unwrap(); + assert_eq!(exact.verdict.word(), "exact"); + let found = against(std::slice::from_ref(&exact), &listed); + let [gone @ Expectation::NoLongerHeld { gap, .. }] = found.as_slice() else { + panic!("{found:?}"); + }; + assert!(gap.waiting_on.contains("on purpose"), "{gap:?}"); + let printed = gone.to_string(); + assert!(printed.contains("no longer diverges at"), "{printed}"); + assert!(printed.contains("drop the row"), "{printed}"); +} + +/// A divergence never launders a refusal of the same case: the verdict carries both, and the +/// ledger holds a refusal row against a case that also diverges. +/// +/// Without this the refusal would vanish from the verdict — `Divergent` is the more severe of the +/// two and used to be the only thing reported — so its row would read as "no longer refused" and +/// somebody would drop a row whose gap was still there. +#[test] +fn a_divergence_does_not_launder_a_refusal_of_the_same_case() { + use crate::known_gaps::{against, Expects, KnownGap, EVERY_VENUE}; + let case = LedgerCase::new("ledger-both"); + let recording = recording_of(&case, case.metal(7), 3); + let mut side = StubSide::new(words(&[9])).refusing( + "texture", + Failure::named("Error::Invalid", "the texture was refused"), + ); + let both = replay_against(&case, &mut side, &recording).unwrap(); + let Verdict::Divergent { found, refused } = &both.verdict else { + panic!("{:?}", both.verdict); + }; + assert_eq!(found.len(), 1, "{found:?}"); + // The refusal is reported, not swallowed by the divergence. + assert_eq!(refused.len(), 1, "{refused:?}"); + let printed = both.verdict.to_string(); + assert!(printed.contains("and refused case/texture"), "{printed}"); + + let (site, answer) = refused[0].split_once(": ").unwrap(); + let rows = vec![ + KnownGap { + case: case.name().to_owned(), + venue: EVERY_VENUE.to_owned(), + expects: Expects::Refused, + site: site.to_owned(), + answer: answer.to_owned(), + waiting_on: "a refusal of this test's own, beside a divergence of the same case" + .to_owned(), + }, + KnownGap { + case: case.name().to_owned(), + venue: EVERY_VENUE.to_owned(), + expects: Expects::Divergent, + site: found[0].path.clone(), + answer: found[0].kind.to_string(), + waiting_on: "a divergence of this test's own, beside a refusal of the same case" + .to_owned(), + }, + ]; + // Both rows are held, so a case holding both gaps can reach exit 0 — and neither row can go + // unchecked behind the other. + assert_eq!(against(std::slice::from_ref(&both), &rows), Vec::new()); + + // Drop the refusal from the run and its row fails, although the divergence is still there. + let mut only_moved = StubSide::new(words(&[9])); + let diverged = replay_against(&case, &mut only_moved, &recording).unwrap(); + let found = against(std::slice::from_ref(&diverged), &rows); + let [crate::known_gaps::Expectation::NoLongerHeld { gap, .. }] = found.as_slice() else { + panic!("{found:?}"); + }; + assert_eq!(gap.expects, Expects::Refused); +} + +/// A site the venue honestly lacks is the **venue's** gap at that site, not a refusal of ours, and +/// the rest of the case still compares. +/// +/// The gap this closes: the `lacks-feature` verdict came from the case **stopping**, so a case +/// that carried on past a call the device cannot take had that site read as a refusal of ours — +/// the one thing the verdict exists to prevent. It is per site now, and a divergence anywhere else +/// in the same case still fails, which is what makes it safe to be compliant. +#[test] +fn a_site_the_venue_lacks_is_the_venues_gap_and_not_a_refusal() { + use metal2vulkan::error::{Capability, Feature, Unsupported}; + let case = LedgerCase::new("ledger-device-gap"); + let recording = recording_of(&case, case.metal(7), 3); + // A typed refusal naming capabilities a device could enable: the device's own gap. + let lacking = Failure::of(&metal2vulkan_runtime::Error::Unsupported( + Unsupported::needs_any_of( + Feature::Format, + vec![vec![Capability::Feature( + metal2vulkan::device::VkFeature::ShaderStorageImageMultisample, + )]], + ), + )); + assert!(lacking.lacks.is_some(), "{lacking:?}"); + + let mut side = StubSide::new(words(&[7])).refusing("texture", lacking); + let replayed = replay_against(&case, &mut side, &recording).unwrap(); + assert_eq!(replayed.verdict.word(), "lacks-feature"); + assert!(replayed.verdict.is_compliant()); + let printed = replayed.verdict.to_string(); + assert!(printed.contains("case/texture"), "{printed}"); + assert!(printed.contains("the venue lacks"), "{printed}"); + // The venue's own gap is never a ledger row, in either direction: it is not a bug of ours. + assert_eq!( + crate::known_gaps::against(std::slice::from_ref(&replayed), &[]), + Vec::new() + ); + + // The rest of the case still compares: a difference elsewhere in the same run still fails. + let lacking = Failure::of(&metal2vulkan_runtime::Error::Unsupported( + Unsupported::needs_any_of( + Feature::Format, + vec![vec![Capability::Feature( + metal2vulkan::device::VkFeature::ShaderStorageImageMultisample, + )]], + ), + )); + let mut moved = StubSide::new(words(&[9])).refusing("texture", lacking); + let replayed = replay_against(&case, &mut moved, &recording).unwrap(); + assert_eq!(replayed.verdict.word(), "divergent"); + assert!(!replayed.verdict.is_compliant()); + + // And a refusal that is ours to answer for is still ours: the same site, a typed error the + // device could not have enabled away, reads as `refused`. + let ours = Failure::of(&metal2vulkan_runtime::Error::Unsupported( + Unsupported::not_implemented(Feature::Format), + )); + assert!(ours.lacks.is_none(), "{ours:?}"); + let mut unbuilt = StubSide::new(words(&[7])).refusing("texture", ours); + let replayed = replay_against(&case, &mut unbuilt, &recording).unwrap(); + assert_eq!(replayed.verdict.word(), "refused"); +} + #[test] fn an_allowance_no_site_needed_is_counted_and_named_rather_than_silently_kept() { // The hole this closes: the up-front check over a case's allowances has to exempt a degrade @@ -2082,7 +2550,7 @@ fn answering_where_metal_did_not_return_is_divergent() { ); let mut side = StubSide::new(Vec::new()); let replayed = replay_against(&case, &mut side, &recording).unwrap(); - let Verdict::Divergent { found } = &replayed.verdict else { + let Verdict::Divergent { found, .. } = &replayed.verdict else { panic!("{}", replayed.verdict); }; assert!( @@ -3095,3 +3563,124 @@ fn the_runtime_side_forwards_every_field_of_a_pipeline_spec() { "a ninth colour attachment" ); } + +/// A divergence that **is** a notice names the notice each side announced, and a known-gaps row +/// carries it. +/// +/// The shape: our side announces a degrade notice where Metal announces nothing, and every other +/// field is bit-exact. The whole difference is the notice, so a row whose answer did not name it +/// would record a difference without saying what it was waiting on. The notices site used to print +/// "Metal recorded AnnouncedNothing, we observed a value", which names nothing a reader can act on. +/// +/// It is a divergence and not a tolerance on purpose: where the product's own degrade note says +/// validation derives no explanation from it, loosening the site here would be this suite +/// overruling the product's stated contract. +#[test] +fn a_divergence_that_is_a_notice_names_the_notice_each_side_announced() { + use crate::known_gaps::{against, Expectation, Expects, KnownGap}; + 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 mut side = StubSide::new(words(&[1, 2])) + .on("llvmpipe (LLVM 21.1.8, 128 bits)") + .announcing(&[Degradation::ShaderColorConversion]); + let replayed = replay_against(&case, &mut side, &recording).unwrap(); + assert_eq!(replayed.verdict.word(), "divergent"); + let Verdict::Divergent { found, .. } = &replayed.verdict else { + panic!("{:?}", replayed.verdict); + }; + // The notice is the only difference: the two sites the notices record sit at. + let set = found + .iter() + .find(|divergence| divergence.path.ends_with("/set")) + .unwrap_or_else(|| panic!("{found:?}")); + let answer = set.kind.to_string(); + // Metal's side of it, and ours, in the one line a row's answer field holds. + assert!(answer.contains("AnnouncedNothing"), "{answer}"); + assert!(answer.contains(code), "{answer}"); + + let rows: Vec = found + .iter() + .map(|divergence| KnownGap { + case: case.name().to_owned(), + venue: "llvmpipe".to_owned(), + expects: Expects::Divergent, + site: divergence.path.clone(), + answer: divergence.kind.to_string(), + waiting_on: format!( + "our side announces {code} on this venue where Metal announces nothing, with every \ + other field bit-exact; the product's degrade note derives no tolerance, so this \ + stays a difference until the notice goes" + ), + }) + .collect(); + assert_eq!(against(std::slice::from_ref(&replayed), &rows), Vec::new()); + + // Both directions, as for any other row: the venue that does not announce it is clean, and the + // day this venue stops announcing it the rows fail and must go. + let mut elsewhere = StubSide::new(words(&[1, 2])).on("Apple M3 Max"); + let exact = replay_against(&case, &mut elsewhere, &recording).unwrap(); + assert_eq!(exact.verdict.word(), "exact"); + assert_eq!(against(std::slice::from_ref(&exact), &rows), Vec::new()); + + let mut fixed = StubSide::new(words(&[1, 2])).on("llvmpipe (LLVM 21.1.8, 128 bits)"); + let gone = replay_against(&case, &mut fixed, &recording).unwrap(); + assert_eq!(gone.verdict.word(), "exact"); + let found = against(std::slice::from_ref(&gone), &rows); + assert_eq!(found.len(), rows.len(), "{found:?}"); + assert!( + found + .iter() + .all(|why| matches!(why, Expectation::NoLongerHeld { .. })), + "{found:?}" + ); +} + +/// A multisampled sparse texture on a device without `sparseResidencyNSamples` is the **device's** +/// gap, never a refusal of ours and never a ledger row. +/// +/// This pins the cross-crate chain that made four unlisted refusals appear on lavapipe: the +/// runtime's `sparse_refusal` names the Vulkan capability the device lacks +/// (`Needs::DeviceCapability`), and the suite reads it as the venue's own gap. It used to say +/// `Needs::NotRepresentable` -- "no Vulkan mechanism exists on any device" -- which the suite could +/// only score as a gap of ours, so a device that simply does not have the feature produced a +/// refusal with no bug behind it to write down. +/// +/// Measured on lavapipe through `vulkaninfo` in the Linux container (2026-10-23): `sparseBinding` +/// true, its one queue family carries `QUEUE_SPARSE_BINDING_BIT`, `sparseResidencyImage2D` and +/// `3D` true, and `sparseResidency2Samples`, `4Samples`, `8Samples` and `16Samples` all **false**. +/// So a multisampled sparse texture reaches the sample-count check there, and nothing about it is +/// ours. +#[test] +fn a_multisampled_sparse_texture_without_the_sample_count_is_the_devices_gap() { + use metal2vulkan::error::{Feature, Needs, SparseNeed, Unsupported}; + for count in [2u32, 4, 8, 16] { + let needs = Unsupported::device_capability( + Feature::SparseTextures { + missing: SparseNeed::SparseResidencySamples(count), + }, + "x", + ); + assert!( + crate::verdict::device_gap_of(&needs).is_some(), + "a device without sparseResidency{count}Samples is the device's gap" + ); + } + // And what the runtime has not built stays ours, by the same reading: the two must not be + // confused in either direction. + assert!(crate::verdict::device_gap_of(&Unsupported::not_implemented( + Feature::SparseTextures { + missing: SparseNeed::SparseMetadata, + } + )) + .is_none()); + // The vocabulary can now say both, which is the whole point: `NotRepresentable` claims no + // Vulkan form exists anywhere and reads as our unbuilt work, so it must not be the word for a + // feature bit a device happens not to have. + assert!(matches!( + Unsupported::device_capability(Feature::Format, "sparseResidency4Samples").needs, + Needs::DeviceCapability("sparseResidency4Samples") + )); +} diff --git a/crates/metal2vulkan-conformance/src/transcript.rs b/crates/metal2vulkan-conformance/src/transcript.rs index 62b7b24e1..4f3596feb 100644 --- a/crates/metal2vulkan-conformance/src/transcript.rs +++ b/crates/metal2vulkan-conformance/src/transcript.rs @@ -497,6 +497,23 @@ impl Element { #[serde(deny_unknown_fields)] pub struct Transcript { pub root: Node, + /// The sites where the **venue honestly lacks** what the call needed, by their paths from the + /// root, each with what it lacks ([`crate::verdict::device_gap`]). + /// + /// Our side's own fact about the device, not an observation of anything Metal did, so it is + /// kept apart from the tree: it is never compared, never fingerprinted and never written to a + /// recording ([`Vec::is_empty`] skips it), and Metal's side never holds one, because the fact + /// is read from a typed runtime error. A recording from before this field existed reads it as + /// empty. + /// + /// Why it exists: a device's honest gap must not read as a refusal of ours, and until now the + /// only way to say so was to **stop the case** — the whole-case + /// [`LacksFeature`](crate::verdict::Verdict::LacksFeature) verdict comes from an abort. A case + /// whose one unsupported site is not fatal could not say it at all, so coverage on a venue + /// that lacks one feature read as a gap of ours at that site, which is the one thing the + /// verdict exists to prevent. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub device_gaps: Vec<(String, String)>, } impl Transcript { @@ -504,9 +521,18 @@ impl Transcript { pub fn new(children: Vec) -> Self { Self { root: Node::branch("case", children), + device_gaps: Vec::new(), } } + /// What the venue lacks at `path`, where it lacks anything. + pub fn device_gap_at(&self, path: &str) -> Option<&str> { + self.device_gaps + .iter() + .find(|(site, _)| site == path) + .map(|(_, needs)| needs.as_str()) + } + /// Every degrade notice the transcript records, by code, with how many times it was /// announced: the `counts` child of each site [`Sites::notices`] emitted, wherever it sits in /// the tree. @@ -549,6 +575,7 @@ fn collect_notices(node: &Node, found: &mut BTreeMap) { #[derive(Debug, Default)] pub struct Sites { nodes: Vec, + device_gaps: Vec<(String, String)>, } impl Sites { @@ -572,6 +599,17 @@ impl Sites { self.leaf(name, Observed::value(value)); } + /// Record that the venue honestly lacks `needs` at the site named `name`, which + /// [`Transcript::device_gaps`] carries by its path from the root. + /// + /// Every failing call goes through [`crate::case::call`], which records this whenever the + /// typed error names capabilities a device could enable or a measured driver defect, so a + /// case needs no code of its own and cannot forget to say it. + pub fn device_gap(&mut self, name: &str, needs: impl Into) { + self.device_gaps + .push((format!("case/{name}"), needs.into())); + } + /// Add the two sites that record what a device announced: the exact set of degrade-notice /// codes, and how many times each was announced, so a case can hold Metal's empty set and ours /// to one notice per kind. An empty set records [`Negative::AnnouncedNothing`]. @@ -602,6 +640,9 @@ impl Sites { /// The transcript of the sites emitted so far. pub fn finish(self) -> Transcript { - Transcript::new(self.nodes) + Transcript { + root: Node::branch("case", self.nodes), + device_gaps: self.device_gaps, + } } } diff --git a/crates/metal2vulkan-conformance/src/verdict.rs b/crates/metal2vulkan-conformance/src/verdict.rs index 3f9cbabd0..da7c218b6 100644 --- a/crates/metal2vulkan-conformance/src/verdict.rs +++ b/crates/metal2vulkan-conformance/src/verdict.rs @@ -5,7 +5,7 @@ //! no Metal answer is counted rather than skipped; and a device that honestly lacks a feature the //! case needs is neither a pass nor a failure, because conflating the two makes coverage fiction. -use crate::compare::Comparison; +use crate::compare::{Comparison, DeviceGap}; use crate::diff::Divergence; use crate::recording::Validated; use metal2vulkan::error::{Needs, Unsupported}; @@ -20,7 +20,19 @@ pub enum Verdict { /// announced. Announced { fields: Vec }, /// A field differs with nothing to justify it: the bug class. - Divergent { found: Vec }, + Divergent { + found: Vec, + /// The sites we also refused, as their paths and our errors, in the form + /// [`Verdict::Refused`] prints. + /// + /// Carried here because a case may hold both, and a divergence must not launder a + /// refusal. The verdict is `Divergent`, since that is the more severe of the two, but the + /// refused sites are still printed, and the known-gaps ledger still holds its refusal rows + /// against them in both directions. Without this a refusal row of a case that also + /// diverges would read as "no longer refused" — the ledger failing for the wrong reason — + /// or, worse, be dropped on that reading while the gap was still there. + refused: Vec, + }, /// We returned a typed error where Metal answered the call. /// /// **Never compliant, and no allowance can change that.** Plain Metal is the behavioural @@ -65,6 +77,12 @@ pub enum Verdict { Unrecorded { why: String }, /// The venue honestly lacks what the case needs, by the typed refusal it gave: neither a pass /// nor a failure. + /// + /// Two shapes reach it, and both are the device's own gap. The case may have **stopped** at + /// the call, which is what `replay` reads from the abort. Or the case may have carried on and + /// one of its sites be the venue's gap ([`DeviceGap`]), in which case `needs` names each site + /// and what it lacks, and the rest of the case compared normally — a divergence or a refusal + /// anywhere else in it still fails. LacksFeature { needs: String }, } @@ -82,21 +100,14 @@ impl Verdict { }, )); } - return Verdict::Divergent { found: diverged }; + return Verdict::Divergent { + found: diverged, + refused: refused_sites(found), + }; } if !found.refusals.is_empty() { return Verdict::Refused { - at: found - .refusals - .iter() - .map(|refusal| match &refusal.documented_by { - Some(documented) => format!( - "{}: {} (documented, not excused, by {documented})", - refusal.path, refusal.ours - ), - None => format!("{}: {}", refusal.path, refusal.ours), - }) - .collect(), + at: refused_sites(found), metal_validation: validated.describe(), }; } @@ -113,6 +124,21 @@ impl Verdict { justified: announced_fields(found), }; } + // After everything that fails, and before the verdicts that claim the case compared: a + // site the venue honestly cannot run is neither a pass nor a failure, so a case holding + // one must not read as `Exact` — that would claim coverage the venue did not give — while + // a divergence or a refusal elsewhere in the same case still fails, which is what makes + // this safe to be compliant. + if !found.device_gaps.is_empty() { + return Verdict::LacksFeature { + needs: found + .device_gaps + .iter() + .map(DeviceGap::to_string) + .collect::>() + .join("; "), + }; + } if found.announced.is_empty() { return Verdict::Exact; } @@ -155,11 +181,17 @@ impl std::fmt::Display for Verdict { Verdict::Announced { fields } => { write!(out, "announced: {}", fields.join("; ")) } - Verdict::Divergent { found } => { + Verdict::Divergent { found, refused } => { out.write_str("divergent")?; for divergence in found { write!(out, "\n {divergence}")?; } + // A refusal is never hidden behind a divergence: plain Metal answered the call + // and we did not, which is a gap of its own kind however the rest of the case + // compared. + for site in refused { + write!(out, "\n and refused {site}")?; + } Ok(()) } Verdict::Refused { @@ -189,6 +221,25 @@ impl std::fmt::Display for Verdict { } } +/// How the report prints each site where plain Metal answered a call and we returned a typed +/// error, with whatever the case named to document it. +/// +/// One function, because the same form is read back by the known-gaps ledger, and a refusal +/// printed two ways would be two rows for one gap. +fn refused_sites(found: &Comparison) -> Vec { + found + .refusals + .iter() + .map(|refusal| match &refusal.documented_by { + Some(documented) => format!( + "{}: {} (documented, not excused, by {documented})", + refusal.path, refusal.ours + ), + None => format!("{}: {}", refusal.path, refusal.ours), + }) + .collect() +} + /// How the report prints each difference a run made inside a justified allowance. fn announced_fields(found: &Comparison) -> Vec { found @@ -236,6 +287,13 @@ pub fn device_gap_of(unsupported: &Unsupported) -> Option { "{:?} needs any of {alternatives:?}", unsupported.feature )), + // A Vulkan capability the compile layer's vocabulary does not name, which only the + // runtime needs: a sparse heap's residency, as `timelineSemaphore` would be. The device's + // own gap by construction — a device with it runs the input — so it belongs here and not + // among the refusals. + Needs::DeviceCapability(capability) => { + Some(format!("{:?} needs {capability}", unsupported.feature)) + } Needs::DriverDefect(workaround) => Some(format!( "{:?} on a driver measured to run it wrong ({workaround:?})", unsupported.feature diff --git a/crates/metal2vulkan-runtime/src/sparse/texture.rs b/crates/metal2vulkan-runtime/src/sparse/texture.rs index 6a85019e7..6ee40be52 100644 --- a/crates/metal2vulkan-runtime/src/sparse/texture.rs +++ b/crates/metal2vulkan-runtime/src/sparse/texture.rs @@ -19,20 +19,53 @@ use std::sync::Mutex; /// The refusal of a sparse heap or texture on a device that lacks `need`, where a function may /// read the image's own residency (the sparse arm of a slot without a tile map; elsewhere the -/// runtime emulates the texture). A device that binds no sparse memory (`sparseBinding`, -/// or the queue family's bit) makes no sparse resident image, but an ordinary image whose unmapped -/// texels a tile map answers is an exact path: the runtime's gap, `NotImplemented(SparseTileMaps)`, -/// not the device's lack. Any other need is the device's: `Unsupported(Feature::SparseTextures)`, -/// naming it. +/// runtime emulates the texture). +/// +/// Two kinds of need, kept apart, because a consumer reads the difference and acts on it. +/// +/// **Ours.** A device that binds no sparse memory (`sparseBinding`, or the queue family's bit) +/// makes no sparse resident image, but an ordinary image whose unmapped texels a tile map answers +/// is an exact path, and it is not built: the runtime's gap, `NotImplemented(SparseTileMaps)`. A +/// sparse image whose memory needs a metadata aspect bound is the same shape — the binding exists +/// and the runtime does not do it. +/// +/// **The device's.** Residency of the texture's type or sample count, and the sparse image formats +/// the device lists, are Vulkan 1.0 capabilities a device either has or does not. They are outside +/// the compile layer's capability vocabulary on purpose (`super::device`), so the refusal names +/// them with `Needs::DeviceCapability`. It used to say `NotRepresentable`, which claims no Vulkan +/// mechanism exists on any device: a device without `sparseResidency2Samples` therefore made our +/// refusal read as unbuilt work of ours, and the conformance suite scored it as a refusal rather +/// than as the venue's own gap. pub(crate) fn sparse_refusal(need: SparseNeed) -> Error { - match need { - SparseNeed::SparseBinding | SparseNeed::SparseBindingQueue => { - Error::NotImplemented(RuntimeGap::SparseTileMaps) + let capability = match need { + // The exact path exists and the runtime has not built it: ours to answer for. + SparseNeed::SparseBinding | SparseNeed::SparseBindingQueue | SparseNeed::SparseMetadata => { + return Error::NotImplemented(RuntimeGap::SparseTileMaps) } - need => Error::Unsupported(Unsupported::not_representable(Feature::SparseTextures { - missing: need, - })), - } + SparseNeed::SparseResidencyImage2D => "sparseResidencyImage2D", + SparseNeed::SparseResidencyImage3D => "sparseResidencyImage3D", + SparseNeed::SparseResidencySamples(2) => "sparseResidency2Samples", + SparseNeed::SparseResidencySamples(4) => "sparseResidency4Samples", + SparseNeed::SparseResidencySamples(8) => "sparseResidency8Samples", + SparseNeed::SparseResidencySamples(16) => "sparseResidency16Samples", + // A sample count Vulkan has no `sparseResidencyNSamples` member for: still the device's + // own gap, named for what it is rather than by a member that does not exist. + SparseNeed::SparseResidencySamples(_) => "sparse residency of the texture's sample count", + SparseNeed::SparseImageFormat => { + "sparse residency of the texture's format, type, sample count and usage \ + (vkGetPhysicalDeviceSparseImageFormatProperties lists none)" + } + // A need the vocabulary gained since: not claimed to be the device's without knowing. + _ => { + return Error::Unsupported(Unsupported::not_implemented(Feature::SparseTextures { + missing: need, + })) + } + }; + Error::Unsupported(Unsupported::device_capability( + Feature::SparseTextures { missing: need }, + capability, + )) } /// How a sparse image's memory is laid out in the device's sparse units. diff --git a/crates/metal2vulkan-runtime/src/tests/sparse.rs b/crates/metal2vulkan-runtime/src/tests/sparse.rs index 0eb1b5f4a..b34836041 100644 --- a/crates/metal2vulkan-runtime/src/tests/sparse.rs +++ b/crates/metal2vulkan-runtime/src/tests/sparse.rs @@ -416,30 +416,75 @@ fn sparse_support_names_what_is_missing() { ); } -/// A device that binds no sparse memory refuses a sparse heap or texture as the runtime's gap, -/// the tile map's ordinary images; any other need as the device's lack, naming it. +/// A sparse need the runtime has not built is the runtime's gap, and one the device simply does +/// not have is the device's, named by the Vulkan capability it is. +/// +/// The two must not be confused in either direction, because a consumer reads the difference and +/// acts on it, and the conformance suite scores it: `Needs::NotRepresentable` used to cover every +/// need past sparse binding, so a device without `sparseResidency2Samples` made our refusal read +/// as unbuilt work of ours. `Needs::DeviceCapability` is the one word that says "the device lacks +/// it" for a capability the compile layer's vocabulary does not name -- which the sparse ones are +/// not, on purpose (`super::super::sparse::device`), since only the runtime needs them. #[test] -fn a_device_without_sparse_binding_is_the_runtime_gap() { - for need in [SparseNeed::SparseBinding, SparseNeed::SparseBindingQueue] { - assert_eq!( - sparse_refusal(need), - Error::NotImplemented(RuntimeGap::SparseTileMaps) - ); - } +fn a_sparse_need_is_the_runtime_gap_or_the_devices_and_never_the_wrong_one() { + // Ours: the exact path exists and is not built. Sparse binding and its queue family take the + // tile map's ordinary images; a metadata aspect is a binding the runtime does not do. for need in [ - SparseNeed::SparseResidencyImage2D, - SparseNeed::SparseResidencyImage3D, - SparseNeed::SparseResidencySamples(4), - SparseNeed::SparseImageFormat, + SparseNeed::SparseBinding, + SparseNeed::SparseBindingQueue, SparseNeed::SparseMetadata, ] { assert_eq!( sparse_refusal(need), - Error::Unsupported(Unsupported::not_representable(Feature::SparseTextures { - missing: need - })) + Error::NotImplemented(RuntimeGap::SparseTileMaps), + "{need:?}" ); } + // The device's: a Vulkan 1.0 capability it either has or does not, named as the device would + // name it, so the refusal reads as the device's gap and not as our unbuilt work. + for (need, capability) in [ + (SparseNeed::SparseResidencyImage2D, "sparseResidencyImage2D"), + (SparseNeed::SparseResidencyImage3D, "sparseResidencyImage3D"), + ( + SparseNeed::SparseResidencySamples(2), + "sparseResidency2Samples", + ), + ( + SparseNeed::SparseResidencySamples(4), + "sparseResidency4Samples", + ), + ( + SparseNeed::SparseResidencySamples(8), + "sparseResidency8Samples", + ), + ( + SparseNeed::SparseResidencySamples(16), + "sparseResidency16Samples", + ), + ] { + assert_eq!( + sparse_refusal(need), + Error::Unsupported(Unsupported::device_capability( + Feature::SparseTextures { missing: need }, + capability + )), + "{need:?}" + ); + } + // A need Vulkan has no one member for is still the device's, named in words rather than by a + // member that does not exist. + for need in [ + SparseNeed::SparseResidencySamples(32), + SparseNeed::SparseImageFormat, + ] { + let Error::Unsupported(unsupported) = sparse_refusal(need) else { + panic!("{need:?}"); + }; + let metal2vulkan::error::Needs::DeviceCapability(words) = unsupported.needs else { + panic!("{need:?}: {:?}", unsupported.needs); + }; + assert!(words.contains("sparse residency"), "{need:?}: {words}"); + } } /// A 2D `R32Float` texture of `extent` and `levels` levels, Metal's 16-KiB tiles (64x64 texels), diff --git a/crates/metal2vulkan-validation/runtime-sources.sha256 b/crates/metal2vulkan-validation/runtime-sources.sha256 index a658bc51c..7414405c3 100644 --- a/crates/metal2vulkan-validation/runtime-sources.sha256 +++ b/crates/metal2vulkan-validation/runtime-sources.sha256 @@ -1 +1 @@ -9c11ab91c7bd5dbf9e7ae89a462533bb64e31740cd9142477418bcfa3581d9cc +507a2347b17254a0b6b72f887c4a62c2aa96b771020a582de6b51de0afb979e2 diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index 3114d5d94..d68ce7776 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -93,7 +93,7 @@ pub const ARTIFACT_FORMAT_VERSION: u32 = 446; /// changes no behaviour, and then updates that hash alone with the commit saying why, or changes /// behaviour and also bumps this version. The commit that bumps it says what changed; this comment /// keeps no history. -pub const RUNTIME_VERSION: u32 = 1523; +pub const RUNTIME_VERSION: u32 = 1525; /// The digest of the sources this build of the crate was compiled from: SHA-256, as lowercase hex, /// of the manifest, the build script, and exactly the files the crate roots' module tree compiles diff --git a/crates/metal2vulkan/src/error/mod.rs b/crates/metal2vulkan/src/error/mod.rs index 3bfc11c49..1cfb5f307 100644 --- a/crates/metal2vulkan/src/error/mod.rs +++ b/crates/metal2vulkan/src/error/mod.rs @@ -157,6 +157,7 @@ impl Error { Needs::NotImplemented | Needs::NotRepresentable => Permanence::Input, Needs::DriverDefect(_) | Needs::RuntimeDriverDefect(_) + | Needs::DeviceCapability(_) | Needs::MetalGpuFamily(_) | Needs::MetalRefuses(_) => Permanence::InputAndDevice, }, @@ -392,6 +393,17 @@ impl Unsupported { } } + /// Run on a device with `capability`, which this device does not have and which the compile + /// layer's vocabulary does not name ([`Needs::DeviceCapability`]). + pub fn device_capability(feature: Feature, capability: &'static str) -> Unsupported { + Unsupported { + feature, + needs: Needs::DeviceCapability(capability), + location: None, + symbol: None, + } + } + /// Translatable if the device had every capability of any one alternative. pub fn needs_any_of(feature: Feature, alternatives: Vec>) -> Unsupported { Unsupported { @@ -481,6 +493,25 @@ impl fmt::Display for Unsupported { pub enum Needs { /// Enabling every capability of any one alternative would make it translatable. AnyOf(Vec>), + /// A device capability the compile layer's vocabulary does not name, which this device does + /// not have: named by its Vulkan member name (`"sparseResidencyImage2D"`) or, where it is not + /// one member, in words. **The device's own gap**, not unbuilt work of ours: a device with the + /// capability runs the input. + /// + /// Why a variant of its own rather than [`Needs::AnyOf`]. `AnyOf` names its capabilities as + /// [`Capability`], and `Capability::Feature`'s vocabulary — [`VkFeature::ALL`], generated from + /// the exposure table — *is* the compile profile's feature set, so anything named there enters + /// every profile, cache key and digest. A capability only the **runtime** needs is deliberately + /// outside it: a sparse heap's `sparseBinding` and `sparseResidency*`, its queue family's + /// sparse bit, and the sparse image formats a device lists, as `timelineSemaphore` would be + /// (`sparse::device`). Before this variant there was no way for such a refusal to say "the + /// device lacks it": the remaining words were [`Needs::NotImplemented`], which claims we have + /// not built the thing, and [`Needs::NotRepresentable`], which claims no Vulkan mechanism + /// exists for it on any device. Both are false of a device that simply does not have a Vulkan + /// 1.0 feature, and both read to a consumer as our unbuilt work. + /// + /// No compile profile, cache key or digest holds it; only the runtime refuses so. + DeviceCapability(&'static str), /// Not implemented by this translator version on any device. NotImplemented, /// No Vulkan 1.2+ mechanism exists for these semantics. diff --git a/crates/metal2vulkan/src/error/tests.rs b/crates/metal2vulkan/src/error/tests.rs index f43f5512c..26ebcbc57 100644 --- a/crates/metal2vulkan/src/error/tests.rs +++ b/crates/metal2vulkan/src/error/tests.rs @@ -63,9 +63,11 @@ fn retry_and_permanence_table() { // A defect of the device's driver: another device translates the input. A Metal GPU // family the device does not claim: another device, one that claims it, may. A // form Metal refuses on the measured devices: an unmeasured device is not refused - // so. + // so. A device capability outside the compile layer's vocabulary: a device with + // it runs the input. Needs::DriverDefect(_) | Needs::RuntimeDriverDefect(_) + | Needs::DeviceCapability(_) | Needs::MetalGpuFamily(_) | Needs::MetalRefuses(_) => (Retry::Never, Permanence::InputAndDevice), }, diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 0399950ca..b38f888cb 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -14,7 +14,7 @@ Columns: - `none`: no public API path: malformed or non-Metal input, Apple-private calls, or a cap no valid program of ordinary size meets; - `?`: not assessed yet. -Generated at `127608025`. +Generated at `5524d22b4`. ## Totals @@ -32,8 +32,8 @@ Generated at `127608025`. | Variant | What it blocks | Where | Sites | Reach | |---|---|---|---|---| -| `LibraryKind` | A metallib that is not an executable library (dynamic library, companion) | - | via a helper: 2: `crates/metal2vulkan-air/src/container/mtlb.rs:253`, `crates/metal2vulkan/src/error/mod.rs:243` | `none`: a metallib that is not an executable library, loaded as one | -| `Stage` | A function stage the model does not cover | - | via a helper: 2: `crates/metal2vulkan-air/src/abi/check.rs:579`, `crates/metal2vulkan/src/error/mod.rs:244` | `none`: a stage outside AIR's public stages | +| `LibraryKind` | A metallib that is not an executable library (dynamic library, companion) | - | via a helper: 2: `crates/metal2vulkan-air/src/container/mtlb.rs:253`, `crates/metal2vulkan/src/error/mod.rs:244` | `none`: a metallib that is not an executable library, loaded as one | +| `Stage` | A function stage the model does not cover | - | via a helper: 2: `crates/metal2vulkan-air/src/abi/check.rs:579`, `crates/metal2vulkan/src/error/mod.rs:245` | `none`: a stage outside AIR's public stages | | `AddressSpace` | An LLVM address space the typed model does not define (it defines AIR's `thread` 0 through `threadgroup_imageblock` 4, `object_data` 6 and the... | every device (not implemented) | 2: `crates/metal2vulkan-air/src/ir/types.rs:191`, `crates/metal2vulkan/src/memory/plan.rs:2061` | `none`: Apple's AGX library address spaces | | `ModuleRecord` | A module-level record outside the accepted subset (alias, ifunc, comdat, …) | - | via a helper: 4: `crates/metal2vulkan-air/src/bitcode/module.rs:343`, `crates/metal2vulkan-air/src/bitcode/module.rs:435` (+2) | `none`: LLVM constructs AIR does not emit | | `Instruction` | An instruction record outside the closed instruction set | - | via a helper: 11: `crates/metal2vulkan-air/src/bitcode/function.rs:1010`, `crates/metal2vulkan-air/src/bitcode/function.rs:1057` (+9) | `none`: LLVM instructions AIR does not emit | @@ -108,9 +108,9 @@ Generated at `127608025`. | `GpuEncodedIndirectCommands` | | devices short of a Vulkan feature the site names; devices without buffer device addresses (`addressed_needs`); every device (no Vulkan mechanism); every device (not implemented) | 17: `crates/metal2vulkan/src/bind/replay.rs:556`, `crates/metal2vulkan/src/bind/replay.rs:796` (+15) | `rare`: indirect command buffers encoded by a kernel | | `VulkanVersion` | The device's Vulkan version is below the 1.2 floor | devices without ApiVersion::V1_2 | 2: `crates/metal2vulkan/src/ash_interop/query.rs:927`, `crates/metal2vulkan/src/device/derive.rs:105` | `none`: a device below Vulkan 1.2 | | `Constant` | A bitcode constant record outside the typed model (block address, inline asm, `select` and other constant expressions the IR has no form for) | - | via a helper: 3: `crates/metal2vulkan-air/src/bitcode/constants.rs:210`, `crates/metal2vulkan-air/src/bitcode/constants.rs:268` (+1) | `none`: LLVM constant forms AIR does not emit | -| `Attribute` | An LLVM attribute kind that changes the calling ABI and that AIR does not use (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds) | - | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493`, `crates/metal2vulkan/src/error/mod.rs:256` | `none`: LLVM ABI attributes AIR does not use | +| `Attribute` | An LLVM attribute kind that changes the calling ABI and that AIR does not use (`inalloca`, `preallocated`, `byref`, `nest`, the `swift*` kinds) | - | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493`, `crates/metal2vulkan/src/error/mod.rs:257` | `none`: LLVM ABI attributes AIR does not use | | `BitcodeRecord` | A bitcode record LLVM defines in `block` that the typed model does not cover and that has no more specific variant (legacy spellings predating... | - | via a helper: 7: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337`, `crates/metal2vulkan-air/src/bitcode/function.rs:572` (+5) | `none`: bitcode records AIR does not emit | -| `SyncScope` | An atomic access or fence in a synchronization scope other than LLVM's built-in `singlethread` and system scopes | - | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/function.rs:1255`, `crates/metal2vulkan/src/error/mod.rs:258` | `none`: synchronization scopes AIR does not use | +| `SyncScope` | An atomic access or fence in a synchronization scope other than LLVM's built-in `singlethread` and system scopes | - | via a helper: 2: `crates/metal2vulkan-air/src/bitcode/function.rs:1255`, `crates/metal2vulkan/src/error/mod.rs:259` | `none`: synchronization scopes AIR does not use | | `SubgroupOperations` | Simdgroup operations of a class the stage's subgroups do not support (the stage is not in `subgroupSupportedStages`, or an operation class is... | devices without VkFeature::ShaderQuadControl; devices without VkFeature::ShaderSubgroupExtendedTypes; devices without VkProperty::SubgroupStage | 4: `crates/metal2vulkan-runtime/src/families/features.rs:1720`, `crates/metal2vulkan/src/lower/simd/mod.rs:407` (+2) | `app`: simdgroup functions in a stage a device's subgroups do not support | | `DirectCall` | A call to a defined function the inliner cannot take | every device (not implemented) | 1: `crates/metal2vulkan-air/src/canon/mod.rs:1319` | `rare`: variadic or byval calls the inliner cannot take | | `WideSwitchLiteral` | A switch case literal wider than 32 bits | every device (not implemented) | 1: `crates/metal2vulkan/src/structurize/emit.rs:207` | `rare`: 64-bit switch literals | @@ -142,7 +142,7 @@ Generated at `127608025`. | `PixelCoverage` | The fragment's coverage (`[[sample_mask]]` read) in a fragment function of a pipeline of more than one sample that runs once per pixel | drivers with a defect | 2: `crates/metal2vulkan-runtime/src/families/features.rs:1232`, `crates/metal2vulkan/src/pipeline/link/graphics.rs:771` | `rare`: coverage reads at pixel rate in a multisampled pipeline | | `CentroidVarying` | A centroid varying (`[[centroid_perspective]]`, `[[centroid_no_perspective]]`) in a fragment function of a pipeline of more than one sample | drivers with a defect | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs:789` | `rare`: centroid varyings in a multisampled pipeline | | `PrivateMemory` | A stage whose private memory (its `thread` variables and arrays, and the constants it holds per thread) takes more Function storage a thread than... | - | via a helper: 1: `crates/metal2vulkan/src/lower/select.rs:1171` | `rare`: very large per-thread arrays | -| `SparseTextures` | A sparse heap (`MTLHeapTypeSparse`), or a texture made from one, on a device without what a sparse resident image of it needs, which `missing` names | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/sparse/texture.rs:32` | `rare`: sparse heaps on a device without sparse images | +| `SparseTextures` | A sparse heap (`MTLHeapTypeSparse`), or a texture made from one, on a device without what a sparse resident image of it needs, which `missing` names | devices without the capability the site names; every device (not implemented) | 2: `crates/metal2vulkan-runtime/src/sparse/texture.rs:60`, `crates/metal2vulkan-runtime/src/sparse/texture.rs:65` | `rare`: sparse heaps on a device without sparse images | | `TimelineSemaphores` | Command buffers and events, which the runtime completes and signals through timeline semaphores (core in Vulkan 1.2), on a device whose... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/device/create.rs:1115` | `none`: a device below the runtime's floor | | `Reflection` | Reflection of an argument whose answer Metal's has not been measured for (`reflection`) | every device (not implemented) | 9: `crates/metal2vulkan/src/bind/argument_buffer.rs:626`, `crates/metal2vulkan/src/reflection/derive.rs:178` (+7) | `rare`: reflection of argument kinds Metal's answer is unmeasured for | | `HeapTextureTiling` | A texture of a heap whose memory the device's optimal images do not take (a `Shared` heap on a device whose optimal images take no host-visible... | every device (no Vulkan mechanism) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:632` | `app`: textures in Shared heaps on a device whose optimal images take no host memory | @@ -154,7 +154,7 @@ Generated at `127608025`. | `PrivateRenderState` | A private fixed-function property of Metal's pipeline descriptor (Apple SPI, OpenGL on Metal's) set to a value whose effect the translation has... | devices without VkFeature::LogicOp; every device (not implemented) | 7: `crates/metal2vulkan/src/bind/heap.rs:1300`, `crates/metal2vulkan/src/bind/plan/resources.rs:887` (+5) | `none`: Apple-private pipeline fields of OpenGL on Metal (no public header) | | `ExtendedRangeBlend` | Metal's blend into an extended-range attachment (`BGRA10_XR`, `BGR10_XR`, `RGB10A8_2P_XR10` and their `_sRGB` twins), which the function computes... | every device (not implemented) | 4: `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:305`, `crates/metal2vulkan/src/lower/fragment/fetch.rs:1654` (+2) | `system`: the parts of a blend into an extended-range (XR10) attachment the measured model does not hold (second-source factors, the color blend color difference, a one-color-channel mask, float4 and sRGB outside the measured forms); the consumer's guests blend RGB10A8_2P_XR10 attachments | | `TileReach` | The tiles a render pass's primitives reach, binned on the device ([`tile_reach_module`](crate::bind::tile_reach_module)), on a device without what... | devices short of a Vulkan feature the site names; devices without a capability the site computes (`vec![int64]`); every device (not implemented) | 3: `crates/metal2vulkan/src/bind/tile_reach.rs:270`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:2517` (+1) | `app`: the tiles a pass's draws reach, binned on a device without shaderInt64 | -| `ProgramScopeBinding` | A program-scope buffer binding of MSL 3.2 (macOS 15 and later), `constant T* constant p [[buffer(n)]];` in Apple's `!air.global_bindings` list,... | - | via a helper: 2: `crates/metal2vulkan-air/src/abi/module.rs:77`, `crates/metal2vulkan/src/error/mod.rs:267` | `app`: MSL 3.2 program-scope buffer bindings (macOS 15 and later) | +| `ProgramScopeBinding` | A program-scope buffer binding of MSL 3.2 (macOS 15 and later), `constant T* constant p [[buffer(n)]];` in Apple's `!air.global_bindings` list,... | - | via a helper: 2: `crates/metal2vulkan-air/src/abi/module.rs:77`, `crates/metal2vulkan/src/error/mod.rs:268` | `app`: MSL 3.2 program-scope buffer bindings (macOS 15 and later) | | `SeqCstFence` | A sequentially consistent fence (`seq_cst` `atomic_thread_fence`, an LLVM `fence seq_cst`, or a `seq_cst` barrier ordering device memory), whose... | devices short of a Vulkan feature the site names | 1: `crates/metal2vulkan/src/lower/sync/barrier.rs:443` | `rare`: a seq_cst fence in a vertex or fragment stage without its stores and atomics | | `PostDepthCoverage` | The coverage after the depth and stencil tests (`[[sample_mask, post_depth_coverage]]`), read through `VK_EXT_post_depth_coverage` | devices short of a Vulkan extension the site names; devices without VkExtension::ExtPostDepthCoverage | 2: `crates/metal2vulkan-runtime/src/families/features.rs:1226`, `crates/metal2vulkan/src/lower/stage_io/plan.rs:783` | `rare`: the coverage after early depth and stencil tests on a device without VK_EXT_post_depth_coverage | @@ -165,7 +165,7 @@ Generated at `127608025`. | `Textures` | Textures and texture buffers | every device (runtime piece not built) | 9: `crates/metal2vulkan-runtime/src/blit_texture.rs:163`, `crates/metal2vulkan-runtime/src/buffer_texture.rs:1572` (+7) | `rare`: texture forms the runtime has not built (texture buffers of some forms, X24Stencil8 views) | | `ResourceHeap` | The resource-ID heap, descriptor set 1 | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/binding.rs:1982` | `rare`: the resource-ID heap's remaining forms | | `SparseHeaps` | Sparse heaps and their textures | every device (runtime piece not built) | 3: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:440`, `crates/metal2vulkan-runtime/src/texture.rs:1684` (+1) | `rare`: sparse heaps | -| `SparseTileMaps` | What the runtime's emulation of sparse textures does not build yet | every device (runtime piece not built) | 4: `crates/metal2vulkan-runtime/src/binding.rs:562`, `crates/metal2vulkan-runtime/src/sparse/texture.rs:30` (+2) | `rare`: sparse texture emulation's unbuilt pieces | +| `SparseTileMaps` | What the runtime's emulation of sparse textures does not build yet | every device (runtime piece not built) | 4: `crates/metal2vulkan-runtime/src/binding.rs:562`, `crates/metal2vulkan-runtime/src/sparse/texture.rs:44` (+2) | `rare`: sparse texture emulation's unbuilt pieces | | `HeapPastMaxBufferSize` | A heap larger than the device's `maxBufferSize`, which the device can allocate | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/heap.rs:714` | `rare`: a heap past maxBufferSize | | `HeapTextureAlignment` | A heap texture whose image needs an alignment past the heap memory's base alignment (256 KiB) | every device (runtime piece not built) | 1: `crates/metal2vulkan-runtime/src/texture/heap.rs:1073` | `rare`: a heap texture needing more than 256 KiB alignment | | `HeapTextureMemory` | A heap texture whose image the heap's memory type does not take | every device (runtime piece not built) | 5: `crates/metal2vulkan-runtime/src/texture/heap.rs:1511`, `crates/metal2vulkan-runtime/src/texture/heap.rs:1518` (+3) | `app`: a heap texture the heap's memory type does not take | @@ -291,13 +291,13 @@ Generated at `127608025`. Each refusal's sites, with the function that builds it. -- `feature::LibraryKind`: `crates/metal2vulkan-air/src/container/mtlb.rs:253 (parse)`; `crates/metal2vulkan/src/error/mod.rs:243 (from)` -- `feature::Stage`: `crates/metal2vulkan-air/src/abi/check.rs:579 (unsupported_stage)`; `crates/metal2vulkan/src/error/mod.rs:244 (from)` +- `feature::LibraryKind`: `crates/metal2vulkan-air/src/container/mtlb.rs:253 (parse)`; `crates/metal2vulkan/src/error/mod.rs:244 (from)` +- `feature::Stage`: `crates/metal2vulkan-air/src/abi/check.rs:579 (unsupported_stage)`; `crates/metal2vulkan/src/error/mod.rs:245 (from)` - `feature::AddressSpace`: `crates/metal2vulkan-air/src/ir/types.rs:191 (from_raw)`; `crates/metal2vulkan/src/memory/plan.rs:2061 (reprs)` -- `feature::ModuleRecord`: `crates/metal2vulkan-air/src/bitcode/module.rs:343 (record)`; `crates/metal2vulkan-air/src/bitcode/module.rs:435 (global)`; `crates/metal2vulkan-air/src/bitcode/module.rs:514 (function)`; `crates/metal2vulkan/src/error/mod.rs:246 (from)` -- `feature::Instruction`: `crates/metal2vulkan-air/src/bitcode/function.rs:1010 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1057 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1078 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1135 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1209 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1217 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1233 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1338 (call)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1380 (call)`; `crates/metal2vulkan-air/src/bitcode/function.rs:823 (record)`; `crates/metal2vulkan/src/error/mod.rs:247 (from)` -- `feature::Type`: `crates/metal2vulkan-air/src/bitcode/types.rs:184 (decode)`; `crates/metal2vulkan-air/src/bitcode/types.rs:206 (decode)`; `crates/metal2vulkan-air/src/bitcode/types.rs:232 (decode)`; `crates/metal2vulkan/src/error/mod.rs:248 (from)` -- `feature::CallingConvention`: `crates/metal2vulkan-air/src/bitcode/function.rs:1354 (call)`; `crates/metal2vulkan-air/src/bitcode/module.rs:499 (function)`; `crates/metal2vulkan/src/error/mod.rs:249 (from)` +- `feature::ModuleRecord`: `crates/metal2vulkan-air/src/bitcode/module.rs:343 (record)`; `crates/metal2vulkan-air/src/bitcode/module.rs:435 (global)`; `crates/metal2vulkan-air/src/bitcode/module.rs:514 (function)`; `crates/metal2vulkan/src/error/mod.rs:247 (from)` +- `feature::Instruction`: `crates/metal2vulkan-air/src/bitcode/function.rs:1010 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1057 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1078 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1135 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1209 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1217 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1233 (record)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1338 (call)`; `crates/metal2vulkan-air/src/bitcode/function.rs:1380 (call)`; `crates/metal2vulkan-air/src/bitcode/function.rs:823 (record)`; `crates/metal2vulkan/src/error/mod.rs:248 (from)` +- `feature::Type`: `crates/metal2vulkan-air/src/bitcode/types.rs:184 (decode)`; `crates/metal2vulkan-air/src/bitcode/types.rs:206 (decode)`; `crates/metal2vulkan-air/src/bitcode/types.rs:232 (decode)`; `crates/metal2vulkan/src/error/mod.rs:249 (from)` +- `feature::CallingConvention`: `crates/metal2vulkan-air/src/bitcode/function.rs:1354 (call)`; `crates/metal2vulkan-air/src/bitcode/module.rs:499 (function)`; `crates/metal2vulkan/src/error/mod.rs:250 (from)` - `feature::UnknownIntrinsic`: `crates/metal2vulkan-air/src/error.rs:621 (from)`; `crates/metal2vulkan/src/lower/select.rs:1006 (route)` - `feature::AgxUnmodeled`: `crates/metal2vulkan/src/lower/simd/agx.rs:62 (unmodeled)` - `feature::StaticInitializer`: `crates/metal2vulkan-air/src/error.rs:627 (from)` @@ -366,10 +366,10 @@ Each refusal's sites, with the function that builds it. - `feature::RasterizationRateMap`: `crates/metal2vulkan/src/lower/fragment/mod.rs:952 (select)` - `feature::GpuEncodedIndirectCommands`: `crates/metal2vulkan/src/bind/replay.rs:556 (preprocess)`; `crates/metal2vulkan/src/bind/replay.rs:796 (replay_preprocess_module)`; `crates/metal2vulkan/src/bind/replay/draws.rs:280 (draw_replay_preprocess)`; `crates/metal2vulkan/src/bind/replay/draws.rs:482 (draw_replay_module)`; `crates/metal2vulkan/src/bind/replay/flat.rs:247 (flat_dispatch_module)`; `crates/metal2vulkan/src/bind/replay/merged.rs:242 (draw_merge_module)`; `crates/metal2vulkan/src/lower/access/encode.rs:394 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:410 (needs)`; `crates/metal2vulkan/src/lower/access/encode.rs:527 (select_command)`; `crates/metal2vulkan/src/lower/access/mod.rs:1540 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1566 (plan_replay)`; `crates/metal2vulkan/src/lower/access/mod.rs:1569 (plan_replay)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2707 (merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2763 (finish_merged)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:458 (param)`; `crates/metal2vulkan/src/pipeline/compile.rs:2126 (plan_one)`; `crates/metal2vulkan/src/pipeline/compile.rs:2131 (plan_one)` - `feature::VulkanVersion`: `crates/metal2vulkan/src/ash_interop/query.rs:927 (query)`; `crates/metal2vulkan/src/device/derive.rs:105 (with_deviations)` -- `feature::Constant`: `crates/metal2vulkan-air/src/bitcode/constants.rs:210 (record)`; `crates/metal2vulkan-air/src/bitcode/constants.rs:268 (record)`; `crates/metal2vulkan/src/error/mod.rs:255 (from)` -- `feature::Attribute`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493 (known)`; `crates/metal2vulkan/src/error/mod.rs:256 (from)` -- `feature::BitcodeRecord`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337 (decode_lists)`; `crates/metal2vulkan-air/src/bitcode/function.rs:572 (symtab)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:130 (decode)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:157 (decode)`; `crates/metal2vulkan-air/src/bitcode/module.rs:727 (check_bodies)`; `crates/metal2vulkan-air/src/bitcode/module.rs:872 (symtab)`; `crates/metal2vulkan/src/error/mod.rs:257 (from)` -- `feature::SyncScope`: `crates/metal2vulkan-air/src/bitcode/function.rs:1255 (atomic)`; `crates/metal2vulkan/src/error/mod.rs:258 (from)` +- `feature::Constant`: `crates/metal2vulkan-air/src/bitcode/constants.rs:210 (record)`; `crates/metal2vulkan-air/src/bitcode/constants.rs:268 (record)`; `crates/metal2vulkan/src/error/mod.rs:256 (from)` +- `feature::Attribute`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:493 (known)`; `crates/metal2vulkan/src/error/mod.rs:257 (from)` +- `feature::BitcodeRecord`: `crates/metal2vulkan-air/src/bitcode/attrs.rs:337 (decode_lists)`; `crates/metal2vulkan-air/src/bitcode/function.rs:572 (symtab)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:130 (decode)`; `crates/metal2vulkan-air/src/bitcode/metadata.rs:157 (decode)`; `crates/metal2vulkan-air/src/bitcode/module.rs:727 (check_bodies)`; `crates/metal2vulkan-air/src/bitcode/module.rs:872 (symtab)`; `crates/metal2vulkan/src/error/mod.rs:258 (from)` +- `feature::SyncScope`: `crates/metal2vulkan-air/src/bitcode/function.rs:1255 (atomic)`; `crates/metal2vulkan/src/error/mod.rs:259 (from)` - `feature::SubgroupOperations`: `crates/metal2vulkan-runtime/src/families/features.rs:1720 (simd)`; `crates/metal2vulkan/src/lower/simd/mod.rs:407 (finish)`; `crates/metal2vulkan/src/lower/simd/mod.rs:466 (full_quads)`; `crates/metal2vulkan/src/lower/simd/mod.rs:990 (select_group)` - `feature::DirectCall`: `crates/metal2vulkan-air/src/canon/mod.rs:1319 (post_check)` - `feature::WideSwitchLiteral`: `crates/metal2vulkan/src/structurize/emit.rs:207 (check_tree)` @@ -401,7 +401,7 @@ Each refusal's sites, with the function that builds it. - `feature::PixelCoverage`: `crates/metal2vulkan-runtime/src/families/features.rs:1232 (state)`; `crates/metal2vulkan/src/pipeline/link/graphics.rs:771 (split_pixel_fragments)` - `feature::CentroidVarying`: `crates/metal2vulkan/src/pipeline/link/graphics.rs:789 (split_pixel_fragments)` - `feature::PrivateMemory`: `crates/metal2vulkan/src/lower/select.rs:1171 (function_storage)` -- `feature::SparseTextures`: `crates/metal2vulkan-runtime/src/sparse/texture.rs:32 (sparse_refusal)` +- `feature::SparseTextures`: `crates/metal2vulkan-runtime/src/sparse/texture.rs:60 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:65 (sparse_refusal)` - `feature::TimelineSemaphores`: `crates/metal2vulkan-runtime/src/device/create.rs:1115 (timeline_difference)` - `feature::Reflection`: `crates/metal2vulkan/src/bind/argument_buffer.rs:626 (unmeasured)`; `crates/metal2vulkan/src/reflection/derive.rs:178 (specialized_reads)`; `crates/metal2vulkan/src/reflection/derive.rs:212 (read_attributes)`; `crates/metal2vulkan/src/reflection/derive.rs:239 (gap_at)`; `crates/metal2vulkan/src/reflection/function.rs:172 (unmeasured)`; `crates/metal2vulkan/src/reflection/function.rs:366 (attribute)`; `crates/metal2vulkan/src/reflection/function.rs:437 (module_constants)`; `crates/metal2vulkan/src/reflection/linked.rs:125 (function)`; `crates/metal2vulkan/src/reflection/mod.rs:249 (stage)` - `feature::HeapTextureTiling`: `crates/metal2vulkan-runtime/src/texture/heap.rs:632 (tiling_refusal)` @@ -413,13 +413,13 @@ Each refusal's sites, with the function that builds it. - `feature::PrivateRenderState`: `crates/metal2vulkan/src/bind/heap.rs:1300 (array)`; `crates/metal2vulkan/src/bind/plan/resources.rs:887 (write_rounding)`; `crates/metal2vulkan/src/lower/sampler/select.rs:2710 (clamps_reference)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:3445 (alpha_test_refused)`; `crates/metal2vulkan/src/lower/texture/mod.rs:2926 (mode_rounded_write)`; `crates/metal2vulkan/src/pipeline/private_state.rs:115 (refused)`; `crates/metal2vulkan/src/pipeline/private_state.rs:449 (logic_operation)` - `feature::ExtendedRangeBlend`: `crates/metal2vulkan/src/lower/arith/extended_range/blend.rs:305 (refused)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1654 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1699 (plan)`; `crates/metal2vulkan/src/lower/fragment/fetch.rs:1756 (plan)` - `feature::TileReach`: `crates/metal2vulkan/src/bind/tile_reach.rs:270 (tile_reach_module)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2517 (capture)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:2543 (capture)` -- `feature::ProgramScopeBinding`: `crates/metal2vulkan-air/src/abi/module.rs:77 (decode)`; `crates/metal2vulkan/src/error/mod.rs:267 (from)` +- `feature::ProgramScopeBinding`: `crates/metal2vulkan-air/src/abi/module.rs:77 (decode)`; `crates/metal2vulkan/src/error/mod.rs:268 (from)` - `feature::SeqCstFence`: `crates/metal2vulkan/src/lower/sync/barrier.rs:443 (require_seq_cst)` - `feature::PostDepthCoverage`: `crates/metal2vulkan-runtime/src/families/features.rs:1226 (state)`; `crates/metal2vulkan/src/lower/stage_io/plan.rs:783 (param)` - `gap::Textures`: `crates/metal2vulkan-runtime/src/blit_texture.rs:163 (check_depth_view)`; `crates/metal2vulkan-runtime/src/buffer_texture.rs:1572 (view_usage)`; `crates/metal2vulkan-runtime/src/pipeline/mod.rs:1625 (compile_error)`; `crates/metal2vulkan-runtime/src/texture.rs:1464 (image_error)`; `crates/metal2vulkan-runtime/src/texture.rs:2257 (storage_over_buffer)`; `crates/metal2vulkan-runtime/src/texture.rs:3079 (new_image_starting)`; `crates/metal2vulkan-runtime/src/texture.rs:4129 (image)`; `crates/metal2vulkan-runtime/src/texture.rs:5777 (host_copy)`; `crates/metal2vulkan-runtime/src/texture/surface_two_planes.rs:207 (new_surface_planes_texture)` - `gap::ResourceHeap`: `crates/metal2vulkan-runtime/src/binding.rs:1982 (descriptor)` - `gap::SparseHeaps`: `crates/metal2vulkan-runtime/src/sparse/encoder.rs:440 (first_slice)`; `crates/metal2vulkan-runtime/src/texture.rs:1684 (plan_sparse_texture)`; `crates/metal2vulkan-runtime/src/texture.rs:4894 (make_aliasable)` -- `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:562 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:30 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1742 (sparse_zeroing)`; `crates/metal2vulkan-runtime/src/texture.rs:1746 (sparse_zeroing)` +- `gap::SparseTileMaps`: `crates/metal2vulkan-runtime/src/binding.rs:562 (slot_tile_map)`; `crates/metal2vulkan-runtime/src/sparse/texture.rs:44 (sparse_refusal)`; `crates/metal2vulkan-runtime/src/texture.rs:1742 (sparse_zeroing)`; `crates/metal2vulkan-runtime/src/texture.rs:1746 (sparse_zeroing)` - `gap::HeapPastMaxBufferSize`: `crates/metal2vulkan-runtime/src/heap.rs:714 (heap_size)` - `gap::HeapTextureAlignment`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1073 (check_heap_base)` - `gap::HeapTextureMemory`: `crates/metal2vulkan-runtime/src/texture/heap.rs:1511 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:1518 (heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2060 (host_heap_plan)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:2292 (memory_shadow)`; `crates/metal2vulkan-runtime/src/texture/heap.rs:556 (memory_refusal)` diff --git a/scripts/refusal-surface/refusal_surface.py b/scripts/refusal-surface/refusal_surface.py index eb3fa51be..a57266968 100755 --- a/scripts/refusal-surface/refusal_surface.py +++ b/scripts/refusal-surface/refusal_surface.py @@ -5,7 +5,8 @@ The refusal surface is read from the construction sites of the typed refusals, o - the translator's and the AIR front end's `Unsupported` (a `Feature` and its `Needs`): the constructors `Unsupported::not_implemented`, `not_representable`, `needs`, `needs_any_of`, - `driver_defect`, `runtime_driver_defect`, `metal_gpu_family`, and `Unsupported { .. }` + `driver_defect`, `runtime_driver_defect`, `metal_gpu_family`, `device_capability`, and + `Unsupported { .. }` literals, in the `src` of crates/metal2vulkan-air, crates/metal2vulkan and crates/metal2vulkan-runtime; - the runtime's `RuntimeGap` (`Error::NotImplemented`) and `AppleOnly` (`Error::AppleOnly`); @@ -54,6 +55,7 @@ CONSTRUCTORS = { "driver_defect": "DriverDefect", "runtime_driver_defect": "RuntimeDriverDefect", "metal_gpu_family": "MetalGpuFamily", + "device_capability": "DeviceCapability", } # Binder refusals of a valid bind state: a device limit or an unestablished reading. The other @@ -217,6 +219,11 @@ def conditions(kind, needs_text): return {"every device (not implemented)"} if kind == "NotRepresentable": return {"every device (no Vulkan mechanism)"} + if kind == "DeviceCapability": + # A Vulkan capability the compile layer's vocabulary does not name, which only the runtime + # needs: the device's own gap, so the condition is the devices without it and never "every + # device". The site names it as a string, so there is no capability token to read. + return {"devices without the capability the site names"} toks = re.findall(CAP_TOKENS, needs_text) if kind == "AnyOf": caps = sorted({f"{a}::{b}" for a, b in toks if a.startswith("Vk") or a == "ApiVersion"})