Commit Graph
2237 Commits
Author SHA1 Message Date
Anees Iqbal ca370da605 Replay: the stand-in for the other API is Linux's and macOS's; the validation crate's clippy for Windows passes
The validation crate builds for x86_64-pc-windows-gnullvm (with llvm-mingw for the bundled
SQLite, as win-cross.sh builds command-replay for the Windows play), and its clippy there (job
m3-max-78094 at abf7b8f873, plain and under --cfg m2v_gpu) reported the stand-in: its writes wait
under the crate's bounded fence waits (gpu::wait::vulkan), which the crate keeps to Linux and macOS,
and its empty extension list for an NT handle did not type-check. Rather than a Windows form of the
fence wait, the stand-in is Linux's and macOS's alone: its import is fd-only, and on any other host
StandIn::new says why it is absent, so each landing is counted unwritten with that reason and the
play goes on (the S1 ruling's handling of a stand-in that cannot be made). The NT-handle import,
which no build compiled, is gone, and so is the device test's Windows arm: the test, under the
layer through candidate::validated, is Linux's and macOS's. A plane's rows are the caller's tuple.

The same clippy reported lib-test code that predates the exported surfaces and never compiled for
Windows: build_support_tests.rs hex-encoded through crate::hash (not on Windows; now sha2's own
lower-hex), and gpu/wait.rs's tests of the fence and Metal waits' own endings, which Windows lacks
(now gated as those variants are).

docs/REPLAY-STREAM.md section 10 says the stand-in is Linux's and macOS's and what Windows counts.
2026-12-02 05:39:49 -08:00
Anees Iqbal edc657331a Replay: the exported-surface device test plays under the validation layer; the format doc's exported-surface records
The device test of the exported-surface snippet ran with the layer on the loader's path but not
enabled: the validation crate's replay tests make their instance with no layer. Each of its plays
now runs under the Khronos validation layer as the candidate runs do (candidate::validated, made
reachable from the replay tests): the device must list the layer as an active tool, and any
message the layer logs fails the test, the stand-in's device's included, since it lives on the
runtime's instance.

docs/REPLAY-STREAM.md: section 4 points at the records, section 7 gives them (m2v.newExportedSurface,
m2v.surfacePlane, m2v.exportSurface, m2v.surfaceWritesDone, release), and section 10 says what the
player does at each, the stand-in for the other API, what a player cannot reproduce, the runtime's
hand-overs with its Metrics docs as the contract, the hand-over and exported-surfaces report lines
and counters, --video-handle's override, and `command-replay snippet video-surfaces`.

Verified before this commit (job m3-max-78051, f58ff0a2b3, lavapipe on msi, layer on the path
but not enabled): dma-buf in place and opaque-fd in the copy form each play 3 frames that agree
with the contract (acquires 2, releases 3 in frame 0 and 2 after) and 6 checks that match.
2026-12-02 05:39:49 -08:00
Anees Iqbal d0a424060a Runtime: each submission that uses memory another API shares hands it over; the release calls are gone
A consumer's video path showed green frames. Its paths call external_writes_done before each
picture and a release only in their encode fills, so every acquire of an exported block or surface
after the first had no release of the runtime's to match (VUID-vkQueueSubmit2-commandBuffer-03879),
and whether memory another API wrote was acquired, or discarded, depended on the order the
consumer's calls arrived in. f6fe21431c's test shows it: no submission released the surface.

Now one form serves every kind of memory another API shares, the form Direct3D 11 planes already
took (crate::handed): each vkQueueSubmit2 part whose command buffers or uploads use an exported
block, an exported surface's planes in place or its buffer, or a Direct3D 11 plane acquires all of
it from the other API's queue family in one barrier, in a runtime command buffer at the part's head
after a global barrier, and releases it in one barrier in another at the part's end, which takes
the part's last signals. Per such part: 3 barriers and 2 runtime command buffers; no submission,
VkSubmitInfo2 or semaphore wait is added. The uploads' copies into textures over a buffer in an
exported block go with the first part, which hands that block over too.

Exported memory is the runtime's until its making (Work::create): an exported block's buffer is
released, and an exported surface's planes in place move out of the undefined layout and are
released in the same barrier, in a runtime command buffer at the head of the submission that takes
the make's upload, ahead of any acquire. The upload owes the making by weak reference, so a surface
or block dropped first owes nothing and holds nothing. The making's submission is the ready point:
Surface::wait_until_ready waits for it in both forms (the copy form's is its block's), and the new
Block::wait_until_ready is its twin (Metal counterpart none; refuses a block that is not exported;
has the submission go at once, so it returns with no command buffer committed). One barrier at the
making, nothing per frame beyond the per-part hand-over.

external_writes_done keeps only its host-side mark: on a block (and a copy-form surface) the
textures over it take its bytes again; in place and on a Direct3D 11 import it records nothing.
Surface::buffer records nothing at its make. A block that is not exported is still refused.

Deleted, with no replacement: BlitCommandEncoder::release_to_external and
BlitCommandEncoder::release_surface_to_external, and Building::release_command, which only they
used. Consumer uses (the consumer's checkout, searched for main): release_to_external at
vaapi/fill.rs:599 and nvidia/encode/fill.rs:289, each followed by EndEncoding, commit and the
consumer's CPU wait; its wrapper trait method BlitEncoder::release_to_external
(core/platform/blit.rs:395, a cfg(unix) no-op default) and the RtPlatform impl
(rt_platform/blit.rs:992-999); doc mentions at rt_platform/export.rs:33, vaapi/fill.rs:30 and
nvidia/encode/fill.rs:18. release_surface_to_external: zero uses. The consumer drops them all in
the pin that takes this commit.

The guard the planner asked for: a plane's image in place takes its tiling from InPlaceTiling
alone, whose values are LINEAR and the DRM_FORMAT_MOD_LINEAR modifier, never OPTIMAL; the
device-free test no_plane_in_place_takes_the_optimal_tiling pins it. The order test
every_device_completes_a_surface_s_making_before_its_ready_wait_returns checks that each plane
owes its move at the make and none once the wait returns, with the device's completed progress at
or past the ready point. The export, surface and Direct3D 11 tests now count one acquire and one
release per submission and one release at the making, with no release call.

The runtime README states the contract (The hand-over contract): nothing another API writes may
be handed memory of ours before that memory's ready point; the other API's next write must not
begin before the submissions that used the memory have completed; who waits by kind and what a
reader gets where no write landed; no optimal image in memory another API writes in place
(section 12.11), the Direct3D 11 import being the documented case (section 12.10.1, Table 17).
Its known gaps carry the planner's line on host-pointer memory. docs/REFUSALS.md is regenerated
and the signature table blessed (one added, two removed).

Checked before this commit: clippy of the runtime, all targets, plain and under --cfg
m2v_cpu_icd, on this commit's code less its doc changes (job m3-max-77874). The device runs at
this commit (lavapipe, the Radeon 780M, the UHD 630) follow and are reported with the lane's tip.
The dma-buf import half is not built.
2026-12-02 05:39:47 -08:00
Anees Iqbal 0bb092f8ff API docs: a kernel's write through a channel-permuting swizzled view is stored as written
Section 10's Kernels gains the accepted difference: the runtime stores a kernel's write
through a texture view whose swizzle permutes its format's channels as written, where the
M3 Max stores it through the swizzle (an RGBA8Unorm (Blue, Green, Red, Alpha) view's write
of (0x33, 0x66, 0xb3, 0xcc) leaves (0xb3, 0x66, 0x33, 0xcc); swizzled_view_stores.m, job
m3-max-76829) and Metal's validation refuses the write, the view reporting no ShaderWrite
usage. The OpenCL images paragraph said a write stores the value with the swizzle undone,
which is the M3's answer, not the runtime's; it now states the runtime's rule and points
to the entry.

Docs only; the rule is the runtime's README's ("A swizzle reaches a texture's sampled
element alone") and the lane's write test asserts it.
2026-11-27 05:11:10 -08:00
Anees Iqbal 1a4310899a Runtime tests: OpenGL mode's depth output without a depth attachment, and the void vertex refusal
The old runtime's OpenGL-mode device tests went with it on 11-20 and were never ported, so the
private render state the guest's GL renderer sets on every pipeline lost its guard. This ports
them onto the new runtime's device-test helpers, with the M3 Max's answers as they stood (probe
conformance/probes/opengl_mode.m, macOS 27.0.1):

- opengl_mode_makes_a_depth_output_without_a_depth_attachment: with the mode, a fragment function
  writing depth without a depth attachment makes a state whose colors are those it draws with a
  depth attachment. The old test's other half, the refusal without the mode, is not ported: only
  the M3 Max's driver refuses it and no Metal document states it (MTLRenderPipeline.h, Apple's
  pages for depthAttachmentPixelFormat and makeRenderPipelineState(descriptor:), the MSL spec's
  depth output), so on the planner's ruling the runtime makes the state, recorded in
  docs/API.md's accepted differences.
- without_opengl_mode_a_rasterizing_void_vertex_function_is_refused: the refusal half of the old
  void-vertex test, as the translator's typed DescriptorError::RasterizedVoidVertex; Metal's text
  stays in the module doc, as the runtime's errors carry none.

The module doc names the nine deleted tests not ported and why: point_size_notices' per-draw
notice is gone (the note is the state's), and private_properties' eight tests test Apple's private
device properties, which the consumer answers and the runtime holds none of.

Verified: to run on lavapipe at the branch tip (a CPU job), reported to main with its job.
2026-11-27 03:42:08 -08:00
Anees Iqbal cb77b3f60d Translator: an OpenCL-mode barrier's flags are OpenCL's cl_mem_fence_flags
OpenCL C's barrier(flags) takes cl_mem_fence_flags, which Apple's
cl_kernel.h (OpenCL.framework, "5.9.7 - Synchronization") defines as
CLK_LOCAL_MEM_FENCE = 1U << 0 and CLK_GLOBAL_MEM_FENCE = 1U << 1, and
Apple's OpenCL compiler passes them to air.wg.barrier unconverted (an
internal function passing its parameter on as the barrier's flags).
Metal's mem_flags read the same bits as mem_device (1) and
mem_threadgroup (2), and decode reads every barrier as Metal's, so in a
kernel linked for OpenCL mode barrier(CLK_LOCAL_MEM_FENCE) lowered to
OpControlBarrier(Workgroup, Workgroup, AcquireRelease | UniformMemory):
nothing ordered the __local tiles, and RADV reordered them (a tiled
multiply's outputs wrong on the RX 550, the RX 7900 XTX and the 780M).
CLK_GLOBAL_MEM_FENCE likewise ordered threadgroup memory and left device
memory unfenced.

Specialization now reads each air.wg.barrier's flags again as OpenCL's
in a kernel of OpenCL mode (canon::opencl::barriers, from the
SpecRequest::open_cl_mode fact), after the last SCCP, so an out-of-line
barrier has its own call site's flags: CLK_LOCAL_MEM_FENCE is
mem_threadgroup and CLK_GLOBAL_MEM_FENCE mem_device
(MemFlags::from_cl_mem_fence_flags). It rewrites the call's decoded
operation in the entry's body, which lowering, the lockstep analysis,
the partial-threadgroups variant and the strategy census all read. A
flag outside the two leaves the call an unknown intrinsic, which the
post-check refuses (Unsupported, UnknownIntrinsic, naming
air.wg.barrier), as one outside Metal's mem_flags is. Nothing keys on a
function name. Metal-mode kernels, air.simdgroup.barrier (the header
declares no work_group_barrier or sub_group_barrier) and
air.atomic.fence (mem_fence's flags, which Apple's compiler converts
itself through llvm.bitreverse.i2) keep Metal's reading.

SEMANTICS_VERSION 2308. canon::opencl's module doc, docs/API.md (OpenCL
mode) and docs/ARCHITECTURE.md say what the flags mean and on what that
rests. docs/REFUSALS.md regenerates unchanged: the refusal is the
existing UnknownIntrinsic site.

Tests (tests::engine_opencl_mode):
- an_opencl_mode_barrier_orders_the_memory_its_opencl_flags_name: a
  kernel of barriers 1, 2 and 3 by four routes (air.wg.barrier with the
  constant, the wrapper of two operands, of three, and a parameter each
  of three call sites binds), compiled as a pipeline on every committed
  profile under the runtime's policy: in OpenCL mode WorkgroupMemory
  alone, UniformMemory alone, both; without the mode UniformMemory,
  WorkgroupMemory, both.
- an_opencl_mode_barrier_of_a_flag_opencl_does_not_name_is_refused:
  flags 4, inline and through the wrapper, refused in OpenCL mode and
  ImageMemory without it.
A job at this tip runs them, and once more with this commit's sources
in canon and intrinsics reverted to its parent, where the first fails.
2026-11-27 03:14:48 -08:00
Anees Iqbal 8ac09ba43e Replay compare-dumps: a differing buffer's line names its first word in each play
compare-dumps said which word of a buffer differed first outside every
cover, but not what either play held there, so telling a NaN from a
rounding step or a stale word meant reading both dumps by hand. A
Difference now carries that word in each play's dump (first_values,
little-endian; a short end's bytes with zeros above them, none past a
dump's end), and its line prints them after the word's index:
"the first word W (a 0x........, b 0x........)". The stream doc says so.

The three compare tests take the values in their expected lines and
Differences, and a new unit test compares three buffers whose second
word differs in b, ends 2 bytes into it, or ends before it.
2026-11-27 02:09:46 -08:00
Anees Iqbal 866a8dd2f2 Replay player: a compute pipeline state takes the stream's openClMode
The player refused a compute descriptor whose openClMode was true, so a
stream that makes an OpenCL-mode pipeline (a guest running OpenCL C on
Metal) stopped at its first one. The runtime's descriptor carries the
mode (open_cl_mode_enabled), and the translator links the kernel for it:
the three hidden buffers ahead of the kernel's own, its buffer indices 3
on, get_global_id with the dispatch's offset. The player now gives the
stream's value to the descriptor, off where absent, and the stream doc
says so.

The previous commit's test is its check on lavapipe: red before this
commit, green with it.
2026-11-27 02:09:46 -08:00
Anees Iqbal 1b3bd24aba Runtime: a Direct3D 11 plane past its import's maxExtent is Limit::TextureSize
A plane's extent was checked only against the image format query without the handle type
(plane_plan's prepare). VUID-VkImageCreateInfo-extent-02252 bounds an image's extent by
imageCreateMaxExtent, which for an image made with VkExternalMemoryImageCreateInfo is the query's
answer with VkPhysicalDeviceExternalImageFormatInfo naming the handle type: a device may make an
imported image smaller than a plain one, and a plane between the two would be created past the
limit.

The import query (d3d11::import_query) now answers the image's properties with the handle too, and
d3d11_plane_form checks the plane's extent against them once its usage and format list are
final: past it, Limit::TextureSize carries the import's maxExtent. The existing kind has the
same meaning (an extent past what the device makes of the image), so no new variant; its doc and
basis name the import's query, and docs/REFUSALS.md is regenerated (a second NoImport site, the
query failing at the final form, which the earlier checks make unreachable on a conforming
driver). The extent check itself is one function now (texture::size_within), the plain path's
included, unchanged there.

The Windows refusal test asks for a luma one texel wider than the import query's maxExtent and
expects TextureSize at that answer or the plain query's below it, printing both. On a device
whose two answers are equal the plain check refuses first, so that run does not show the import
check firing on its own.
2026-11-26 22:55:11 -08:00
Anees Iqbal d5b2379d91 Conformance: the between case declares its interpolation notice, and its refusal is a ledger row
`conformance replay --cpu` of both unattached-colour cases on lavapipe (job m3-max-75983,
at 981d1c0d81) read:
- pass-pipeline-color-unattached: announced, every value equal to Metal's; the one
  difference is the native note native-nan-encoding, which the suite's native set holds.
- pass-pipeline-color-unattached-between: refused at case/drawn/pass:lacking
  (DrawKind::AttachmentFormats), as the form intends, and divergent at case/notices:
  our side announced device-interpolation, which the case declared nowhere.

The between case's fragment, cg_five, writes every colour from an interpolated varying,
so the case now declares device-interpolation (a notice declaration, which loosens no
value). known-gaps-rt.tsv gains the refused row, venue *: the refusal is the same on every
device (lacked_past answers None for that shape). docs/CONFORMANCE-COVERAGE.md is
regenerated: 191 case modules, 1339 recordings, both new modules every field compared.

Verified: the replay rerun and the conformance crate's tests follow in the next job.
2026-11-26 20:51:35 -08:00
Anees Iqbal 981d1c0d81 Runtime docs: a state drawn without the colours past its pass's last attachment, and its costs
README, Render encoders: a pipeline state that names colours past its pass's last colour
attachment, the rest of its formats and its sample count the pass's, is drawn as plain
Metal draws it (pass-pipeline-color-unattached, Apple M3 Max, macOS 27.0.1, job
m3-max-75903), through the state of its descriptor without those colours. The costs, each
from a run:
- the first such set and draw: about 3.3 ms once per state and pass shape on an RTX 5080
  Laptop card, from a proxy (a state of the same functions with colour 0 alone; jobs
  m3-max-75918 and m3-max-75925);
- each later such set: about 14,500 user-space instructions on lavapipe (job m3-max-75974,
  release, five runs, 14,510 to 14,517), where a set of a state that renders into its pass
  is 140;
- the descriptor each render state keeps: in states-only plays of two recorded replay
  streams on lavapipe it kept no library alive that was not alive without it (jobs
  m3-max-75968 and m3-max-75969: the bytes of released libraries still alive, at each
  change, equal at this tree and at its base, 29 and 140 changes).
The between shape stays refused (job m3-max-75934). The Gap::Draw list's "a pipeline state
whose formats are not the pass's attachments'" now excepts the shape drawn, and the
first-use list names that state's pipeline under first_use_unfinished_waits.

docs/REFUSALS.md is regenerated (refusal_surface.py): Gap::Draw gains its site in
render.rs (without_colors).
2026-11-26 20:48:06 -08:00
Anees Iqbal 8006d54fbb Runtime tests: six more Managed-form tests run in both forms
The tests of upload, import, spill, sites, gpu_span and resolve that read a Managed buffer's form
(Device::has_unified_memory, or a Managed buffer they make) ran each device in its own form only,
so lavapipe and the integrated cards never took their two-copy arm. Each now runs through
tests::command::on_device::each_device_in_both_forms, which runs a one-copy device once more
through the two-copy view:

- upload: every_device_counts_and_times_its_own_command_buffers
- import: every_device_releases_an_import_under_a_managed_buffer_dropped_before_any_commit
- spill: every_device_spills_private_memory_out_of_device_memory
- gpu_span: every_device_leaves_a_copy_in_out_of_the_gpu_span_it_goes_ahead_of
- resolve: every_device_resolves_a_loaded_pass_into_a_shader_read_texture_over_a_buffer
- sites: every_device_counts_each_allocation_site_apart, through the new
  each_device_in_both_forms_with, which opens both runs with the test's own options
  (MakerTest::Fail here); each_device_in_both_forms is it with the default options.

docs/VALIDATION.md names the six modules among those that run both forms. Test-only: no product
source changes. Verification (lavapipe two-copy runs counted per test, lint) is in the landing
line.
2026-11-26 16:59:51 -08:00
Anees Iqbal 0cd1618247 Runtime tests: the two-copy view runs a Managed buffer's device-copy form on one-copy devices
No device in CI kept a device copy of a Managed buffer: lavapipe is a CPU device, so
Core::unified_memory() (rule 2's unified-memory form, decided by Vulkan's device type alone) is
true there, and every device test of the two-copy form returned at its unified-memory check or
took the one-copy arm. every_device_synchronizes_a_texture_over_a_managed_buffer passed vacuously
on lavapipe while the runtime recorded nothing for that synchronize on discrete cards (fixed in
d0f117f2a8). The integrated lab cards take the same one-copy arm.

DeviceOptions gains a test-only field beside `memory`, under the same
cfg(all(test, any(m2v_gpu, m2v_cpu_icd))): `two_copies`. Device::open reads it, under that gate
alone, where it decides `unified_memory`: where true the device keeps a device copy of every
Managed buffer whatever its device type, and Device::has_unified_memory answers false, as on a
discrete GPU; its Vulkan device, memory types and every other answer are its own. No product
build carries the field or its read, and tests/one_path.rs is untouched.

tests::command::on_device::each_device_in_both_forms runs `body` on each device in its own form
and, where the device keeps one copy, once more through the view (the run's name ends in
", two copies"). The tests a Managed buffer's form decides take it: those of tests::managed that
make a Managed buffer (not the two Managed-texture tests, nor the Shared variant of the
two-queue read), the three of tests::copy_over that read the form, two of tests::blit
(buffer-to-buffer, synchronize of a Managed buffer) and tests::over's texture held in place. So
the plain m2v_cpu_icd and m2v_gpu suites run the two-copy form on lavapipe and on the integrated
cards; a discrete card runs as before. docs/VALIDATION.md says so.

Verification: the jobs on lavapipe (the synchronize test failing with blit.rs and texture.rs at
e9f09c9a92 and passing here, and the device suite), the RTX 5080 and the Radeon 780M follow in the
lane's report.
2026-11-26 16:59:51 -08:00
Anees Iqbal f6aa8dbdf1 Runtime: a dma-buf import is refused where the Shared type is not host-coherent
What: the dma-buf rule (import.rs, dma_buf_type) now takes the device's Shared
coherence, keyed by the query that already decides it (the Shared type's
HOST_COHERENT flag; the device holds a coherence state exactly where it lacks
it). On a device that holds one, every dma-buf is refused with the new
Limit::ImportCoherence { handle }, whatever the fd's query offers, before any
allocation: Device::import_dma_buf and Device::import_dma_bufs (each fd's rule;
the sparse buffer is destroyed, as for Limit::ImportType). Basis: device. The
pointer import (import_host_memory) is unchanged, so the consumer's fallback
imports those pages by pointer. No new route: the refusal sits inside the
existing rule.

Why: on a Meteor Lake GPU under Mesa's Intel driver and the i915 kernel driver
(no LLC), the fd's query offers type 0 (device-local, host-visible,
host-coherent, write-combined) first, so the rule took the import, and the
runtime never flushes an import because its type is host-coherent. That flag
speaks only for mappings Vulkan makes; the consumer writes the pages through
its own cached mapping. In Linux v7.3, i915_gem_prime_import
(drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c:281-337) makes the object with
i915_gem_object_alloc (kmem_cache_zalloc, gem/i915_gem_object.c) and never calls
i915_gem_object_set_cache_coherency, so pat_index 0 and cache_coherent 0; the
only CPU-cache work is one wbinvd_on_all_cpus at get_pages where !HAS_LLC &&
!IS_DG1 (i915_gem_dmabuf.c:249-261, whose comment says only DG1 "still snoops
transactions even with CACHE_NONE"); on MTL PAT 0 is WB with no coherency. So
the GPU reads DRAM without the guest's lines still in the CPU cache: text and
images missing. The pointer import (userptr, I915_CACHE_LLC, PAT 3) snoops.
No Vulkan query says whether a driver's GPU mapping of a foreign dma-buf sees
the CPU's caches, so the Shared type's flag is a proxy that errs to the safe
side: where it refuses, the pointer route is coherent by its type's flag.

Docs: import.rs's header and both dma-buf calls' doc comments; coherence.rs on
imports; the runtime README's Shared memory's coherence ("Imported blocks take
no call"), Imported blocks (the rule, the proxy and its limit) and its known
gaps; docs/VALIDATION.md on the shared view; docs/REFUSALS.md regenerated; the
api_signatures table blessed (one variant added).

Tests: a_dma_buf_is_refused_where_the_shared_type_is_not_host_coherent (pure,
over Meteor Lake's i915 type list and the Iris Xe's);
every_device_under_the_view_refuses_a_dma_buf_and_imports_host_memory (device,
through the refused device's view); the existing dma-buf device tests take the
new refusal. Verified at this commit: cargo fmt only; the build, the pure
tests and the device run are in the jobs the lane reports.
2026-11-26 11:51:26 -08:00
Anees Iqbal b443508375 Runtime, translator docs and validation: the bound form's contract, its README floor entry, and the suites' pins
docs/API.md: section 1's bound kernel buffers (the query's features and every limit set 0's
layout reaches, the four kinds of slot that keep their address by structure), section 5's
SlotBindOffset view, and the accepted difference of a bound buffer's out-of-bounds reach: up to
15 bytes before a buffer off 16 and up to 3 past a length off 4 where
robustStorageBufferAccessSizeAlignment is 4 (none on NVIDIA), reads and writes landing in the
same process's memory, its own or shared with it by name, and past a buffer the consumer placed
by heap_buffer_size_and_align the block's padding (zero or the same device's earlier bytes,
never another device's). The runtime README: the extension row, the Bound kernel buffers floor
entry with its feature table (pool_reach's runs: Iris Xe, 780M, XTX and RTX 3090 bound, jobs
m3-max-75037..75040; the 780M under AMDVLK, which lists no VK_EXT_pipeline_robustness at the
runtime's Vulkan 1.3, in the address form, m3-max-75041/75042), the counters, and the check's
known gap. The placement comments at encoder::view and HEAP_BUFFER_ALIGNMENT.

Suite pins (m3-max-75036): the stage helper's version 3 for its robust compute chain; the
validation runtime-sources pin (RUNTIME_VERSION is already bumped in this change); the profile
subset rules for robust_buffer_access2, robust_buffer_access_update_after_bind (implications)
and robust_storage_buffer_access_size_alignment (a minimum); the enable test's device with room
for set 0's 31 storage buffers; the README floor test's pipeline-robustness feature table.
2026-11-26 05:04:54 -08:00
Anees Iqbal cf270fa34e Harness and replay player: count dispatches by the form their kernel reaches its buffers in
The harness's matrix counts gain bound_dispatches and address_dispatches, and the replay player's
executed counters gain those two with buffer_sets_written and buffer_sets_held, so a run shows
which form its dispatches took. Built only; the harness run is the Iris read that follows.
2026-11-26 05:04:54 -08:00
Anees Iqbal 5b260257e0 Runtime and replay player: count each dispatch barrier in one source, and print the device's buffer alignment
What: Metrics::dispatch_hazard_barriers is now the sum of nine sources, each such barrier in
exactly one: dispatch_after_write_barriers and dispatch_write_after_read_barriers (the
dispatch's own dependencies), then dispatch_encoder_end_barriers, dispatch_pass_end_barriers,
dispatch_indirect_barriers, dispatch_unbound_barriers, dispatch_arena_piece_barriers,
dispatch_heap_barriers and dispatch_other_barriers. The replay player prints the nine on each
frame line's executed counters and in the report's totals. The tally's bit mask is a u128 (69
metrics).

The rule for a barrier with several causes: it counts under the dispatch's own dependency where
it has one, first a write (it reads or writes a resource a command since the last barrier
wrote), then a write after a read (it writes one that was only read), both by the resource's own
id; otherwise under the first source in this order: an encoder that wrote ended; a render pass
moved nothing home (or copied a resolve into a buffer); an indirect dispatch after a write since
the last barrier that reached argument reads, whatever buffer was written; an access outside
every resource (a read after a write, a write after any access, or the barrier such a write
owes); a Private-arena piece after the first; a conflict through a heap's one id alone (an
exported surface's buffer and planes, which share one id, count here too); anything else (a
memory barrier call, a release to another API, a concurrent encoder after commands that touched
anything). An owed barrier keeps the first of its causes in that order. In a concurrent encoder
the dependency is read only where a barrier is owed, as Metal orders nothing else there. Two
buffers of one heap over the same bytes count under the heap: at buffer level they are two
resources.

How: a heap's resources are marked in the hazard sets by the heap's id, as before, and also by
their own ids in a second table of the sets that places no barrier and only tells a dependency
on the resource from a conflict through the heap's id. Building::owe takes its cause and no
longer starts the sets again; the command that pays the owed barrier does, after reading them:
Building::command clears them after paying, and dispatch_hazards takes its command buffer
without paying (current_command) and pays the owed barrier itself, counted by every cause it
has. Where barriers go is unchanged: each path that paid an owed barrier records the one
barrier it recorded before, and the sets start again at the same barriers.

Rider: Device::buffer_alignment (no Metal counterpart) returns the alignment Vulkan's memory
requirements gave the runtime's buffers, which the pool read at the device's making. The replay
player's device line prints it (`device NAME runtime rt buffer alignment N`), and the device
test prints it and checks it is a power of two. The runtime prints no line of its own at a
device's making, so a consumer's log shows it only by reading this accessor.

Why: the planner's reading of the dispatch-hazard barriers: whether the sources that are not the
guest's own dependencies reach a quarter of a frame's barriers on any stream. The buffer
alignment goes into every lab log because the ring and the zero address assume a multiple of 16
with no query behind it.

Tests: every_device_counts_each_dispatch_barrier_in_one_source checks the write after a read,
two encoders' ends (the second's dispatch reading the write before it counts as that
dependency), a render pass's end that moved nothing home, an indirect dispatch after a write of
another buffer, a read outside every resource and a memory barrier in a concurrent encoder, each
in its one source with the sources summing to the dispatch barriers;
every_device_places_barriers_at_hazards_only checks the dependent and concurrent encoders' in
the write dependency and none for independent dispatches;
every_device_orders_a_heap_s_resources_as_one checks the heap's source, and the write dependency
for one buffer of a heap used twice; the arena test checks its pieces' barriers in the arena
source; the hazard sets' unit tests check the own-id table. The signatures table is blessed (9
fields, 1 method).

Verified: nothing yet in this commit; the gate (fmt, clippy in three configurations, Rustdoc,
the runtime suite on lavapipe and the validation suite) runs on it next.
2026-11-26 00:54:46 -08:00
Anees Iqbal 0b7d408201 Runtime and replay player: count barriers by cause, the guest's blits and buffer binds, and over-copy bytes by frame
What:
- Metrics counts every barrier in one of seven causes, whose sum Metrics::barriers now is:
  pass_start_barriers (a render pass's first), pass_home_barriers (the move of its attachments
  home at its end), blit_barriers, dispatch_hazard_barriers (a dispatch's own, at a hazard or
  paying one owed), segment_end_barriers, upload_barriers (the uploads' and Managed copy-ins'
  barriers, the over copies they carry among them) and other_barriers (inside a pass, over
  copies in a command buffer, heap moves ahead of a command or segment, releases). Metric::Barriers
  is gone: each site that records a barrier counts its cause, and the shared helpers
  (Building::barrier, alias::record, over::record_side) take the cause from their caller.
- The replay player's executed counters carry the seven, so each frame line prints them.
- The player's stream counts (the guest's, fixed by the stream) add blits, an encoder's copy,
  fill, mipmap, synchronize, reset and optimize commands, and the buffer slots the set-buffer
  calls set on render and on compute encoders, each split into buffer changes (another buffer
  than the slot held, or its first set) and offset-only changes (replay/binds.rs).
- The runtime backend's report adds an `over copies by frame` line: over-copy bytes a frame,
  mean and largest frame, by memory class (Private, Shared) and by cause (pitch, dma-buf, host
  memory, every other cause as own_image), and the number of textures in an image of their own
  the largest frame's calls named (new_runtime/over_frames.rs), from counters the runtime keeps.
- docs/REPLAY-STREAM.md and the runtime README name them; the signatures table blessed (7 fields).

Why: the planner's reading of round d9b644bae7's plays: whether pass-boundary and blit barriers
are half or more of a frame's barriers (the two pass forms), and whether over copies of Private
buffers reach 1 MB or 5% of a frame's copied bytes (the third form), needs the barrier split and
the over-copy split a frame, beside what the guest asked for; the guest's buffer binds per draw
and per dispatch size the descriptor work.

Tests: every_barrier_rt_records_is_counted adds a pass over a texture whose home is shader-read
and checks each cause's count against the barrier commands recorded (pass start 1, pass home 1,
blit 2, dispatch hazard 0, segment end 1, upload 6 or more, other 0);
every_device_places_barriers_at_hazards_only checks the dispatch-hazard and segment-end counts on
dependent, independent and concurrent encoders;
every_device_reads_its_attachment_through_a_texture_after_a_memory_barrier checks the causes on
the feedback-loop and the copy path; the player's
the_stream_fixes_its_calls_commits_encoders_draws_dispatches_blits_and_binds checks blits and
every bind count; over_copies_by_frame_give_the_mean_and_the_largest_frame checks the line.
2026-11-25 23:55:46 -08:00
Anees Iqbal 8c3bffc079 Runtime: count over-copy bytes by the buffer's memory class, and the renderings an encoder ends and begins again
What: two counters, so reach is counted rather than guessed.
- Metrics::over_copy_bytes_private and Metrics::over_copy_bytes_shared split over_copy_bytes by
  the memory class the bytes shaders reach are in (MemoryClass of the buffer's block; a Managed
  buffer's device copy counts in neither). OverCopy carries the class; Counters::over_copied
  takes it.
- Metrics::rendering_interrupts counts each vkCmdEndRendering and new vkCmdBeginRendering inside
  one render encoder (RenderCommandEncoder::interrupt, its one site): barriers, copies a draw or
  a visibility result mode needs first, feedback and heap moves, an execution's count kernel.
  The passes counter counts encoders and cannot show these.
- The replay player's executed counters carry the three, so every play's frame lines print them;
  docs/REPLAY-STREAM.md and the runtime README name them; the signatures table blessed (3 fields).

Why: the per-frame counts of round d9b644bae7's plays put over-copy bytes at 4.87 MB a frame on
the desktop stream (5080) and 34.5% of bytes copied on the 780M recording (Iris), with no way to
tell how much lies over Private buffers, whose bytes no host write reaches; and no counter shows
how often a render encoder's rendering is cut.

Tests: each_memory_class_counts_its_copies_bytes_alone (device-free); the device test
every_device_counts_each_textures_copies_under_its_cause checks the class split for each copy
and adds a texture over a Private buffer (pitch cause on lavapipe);
every_device_reads_its_attachment_through_a_texture_after_a_memory_barrier holds the count at 2
on both the feedback-loop and the copy path.
2026-11-25 23:24:36 -08:00
Anees Iqbal 1af54e162d Conformance and runtime README: the UHD 630's rows for the read-write and sRGB storage cases
What: the known-gaps ledger's 14 rows for Intel's Windows driver 101.2145 on the UHD Graphics 630
in srgb-storage-writes, read-write-tier-held and read-write-tier-round-trip-float, which that venue
had not run before. Two entries in the runtime README's known gaps of textures. Coverage
regenerated. No product code.

- srgb-storage-writes RGBA8Unorm_sRGB fpv_srgb_write/dispatch, refused: the driver makes no
  extended image for an 8-bit sRGB texture made for shader writes, so there is no UNORM twin and
  the write at a slot is Gap::StorageElement (Absent). README entry: the image format query rt
  makes for the extended image (R8G8B8A8_SRGB, optimal, MUTABLE_FORMAT | EXTENDED_USAGE, the format
  list with R8G8B8A8_UNORM, the plain usage with STORAGE) answers no. That is read from
  tests::storage_element's every_device_writes_an_srgb_texture_through_its_unorm_view, which
  asserts the image is extended exactly where that query takes it and passed there (m3-max-74877),
  and from the case (m3-max-74873). Not probed apart; the README says the resolve usage's part
  was not asked.
- read-write-tier-held RGBA8/BGRA8 sRGB stored-bytes and texels: the same cause through the
  argument buffer, in the A8Unorm "*" rows' words (an undeclared write to a texture with no
  storage element is dropped; the read answers zeros).
- BGR10A2Unorm (held stored-bytes and texels, round-trip refused) and A8Unorm (round-trip
  refused): no storage image by the device's format queries, in the NVIDIA, llvmpipe and RX 550
  rows' words (vulkaninfo of that card lists no STORAGE_IMAGE bit for A2R10G10B10).
- R8Unorm tier2, RG8Unorm beyond and RGBA8Unorm tier2 texels, one ulp: rule 1, the reciprocal
  product, in llvmpipe's words.
- BGRA8Unorm beyond texels (held 256 elements, round-trip 1,024): the driver lists
  VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT for B8G8R8A8_UNORM while
  shaderStorageImageReadWithoutFormat is false; rt follows the per-format bit on every device
  (VUID-vkCmdDispatch-OpTypeImage-07028), and the reads differed from Metal's (the largest
  difference is what a read of zero gives). BGRA8Unorm is outside Metal's read-write tiers. A
  known gap at rung 4 by the planner's ruling, with a README entry; not reproduced outside the
  runtime.

Verified: every row is one of the 14 lines conformance leg m3-max-74873 printed as unlisted
(Windows UHD 630, pin d9b644bae7), with its venue, verdict, site and answer copied from them. The
ledger's read on that venue is verified at its next Windows conformance leg.
2026-11-25 21:29:20 -08:00
Anees Iqbal d9b644bae7 Conformance: Metal's recording of vector-word-phases-vec16-4-8, taken on the M3 Max
Recorded on an Apple M3 Max, macOS 27.0.1 (26A434), by `conformance record` and
`conformance times --runs 8 --write` in job m3-max-74565 (build m3-max-74559), three runs, one
outcome. Plain Metal ran the pass to completion; its API validation stopped it ("Compute
Function(vwp_vec16): the offset into the buffer a that is bound at Buffer index 0 must be a
multiple of 16 but was set to 4", and the same for b at 8), which the recording keeps as its
validated fact. The case's tests hold plain Metal's four buffers equal to answer_at (every
access at its own address) and the validated words to those two messages.

docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py).

(cherry picked from commit 944d20922983e7932a591b6c3d0e1090dc5f3300)
2026-11-25 19:17:03 -08:00
Anees Iqbal b42ef61b9b Runtime: a buffer bound at a multiple of 4 below its argument's alignment runs the state's variant that holds it to 4
What: a dispatch's alignment check (check_alignments) no longer refuses a buffer whose argument's
alignment is 8 or 16 (mask past 3) bound at a multiple of 4 below it: it answers the mask of those
slots, bit i slot i. A non-empty mask picks the state's variant (PipelineInner::variant, srgbwrite's
sRGB variant generalised to both masks): Compiled::of lowers the state's function with those slots
in LoweringInputs::word_bound_buffers, kept in the device's bounded map of contents under
KernelKey's new words mask (1,024 entries), held by the command buffer that dispatched it. The
dispatch then checks the variant's own alignments strictly, so a buffer a 64-bit atomic may reach,
which the variant holds to 8, is refused off a multiple of 8. A kernel the consumer compiled has no
variant: its own module's strict check refuses the bind as before. One bit per slot: a second class
(8 at a multiple of 8) would need a second mask in the key and the input.

Still refused: an address off a multiple of 4 (off 2 for an alignment of 2), a 64-bit atomic's
buffer off a multiple of 8, every draw's (render_encoder keeps the strict check_alignment: the
draw side would need the render path's variant key), and a consumer-compiled kernel's.
Refusal::BufferOffsetAlignment's doc says so; its message and `alignment` now name the alignment
the function holds the address to, as the variant's 8 for a 16-aligned argument is not the
argument's. The buffer-bind-off-alignment ledger row carries the new message;
docs/CONFORMANCE-COVERAGE.md regenerated (unchanged); REFUSALS.md regenerated (unchanged: its row
takes the doc's first words).

Why: a guest's system texture-decode kernel (library db82b13f114fbeef #0) binds buffer 0 at offset
1871700 (4 mod 16) under a 16-byte argument alignment and met the refusal 60 and 72 times in two
sessions; plain Metal runs it with each element at its own address. Only such a dispatch runs the
variant: an empty mask keeps the state's key, hash and module.

Tests (not yet run): translate.rs every_device_places_each_vector_access_at_its_own_address runs
vwp_vec16 at VEC16_AT_WORDS too, holds Metal's words, and asserts a variant lowered exactly at the
runs off a multiple of 16; every_device_keeps_a_word_bound_variant_in_the_bounded_map_of_contents
(cap 2: one variant a mask, kept, the map at its cap, a forgotten one lowered again);
an_argument_bound_off_its_alignment_is_refused binds vwp_vec16 2 and 3 bytes off (alignment 16).
compute.rs's for_test kernel still refuses all 17 binds (no variant to lower).

Docs: the runtime README's compute-encoder rule and a known gap of pipeline states (the relaxed
form, with the unconditional build's 3090 constant_* rows), docs/API.md sections 1 and 10.
2026-11-25 19:17:03 -08:00
Anees Iqbal 4fadeef846 Conformance: the ledger's 8-bit sRGB rows after the twin form
What, from the whole replay at 5bcb3c3253 on four venues (Iris Xe m3-max-74599, RX 7900 XTX
m3-max-74606, um870's RTX 3090 m3-max-74604, lavapipe in the quick check m3-max-74595):

- read-write-tier-held's BGRA8Unorm_sRGB and RGBA8Unorm_sRGB stored-bytes rows (venue *) go: the
  undeclared argument-buffer writes now land in the twin, unencoded, and the case's colours encode
  to the codes that store, so the bytes match Metal's on every venue run.
- Its two texels rows (venue *) become one row per venue: the read through the argument buffer's
  read_write member now answers the twin's codes as linear values where Metal decodes them (192
  elements on the Iris, the XTX and the 3090, 219 on lavapipe, the largest difference 30440712),
  and on the Iris BGRA8Unorm_sRGB's twin is B8G8R8A8_UNORM, which ANV there cannot read without a
  format (256 elements, 1055846126). The AMD rows are written for RADV from the XTX's run; the
  780M's and the RX 550's runs follow.
- read-write-tier-round-trip-float's twelve sRGB rows, one a venue, become one row a format for
  every venue: rt refuses an access::read_write slot bound to an 8-bit sRGB texture on every
  device now, with the same answer on every venue run; the old reason (the device's format
  queries) no longer holds.

srgb-storage-writes itself is announced on all four venues: the bytes equal Metal's and the one
difference is the notices site's DevicePackConversion, a native note. docs/CONFORMANCE-COVERAGE.md
regenerated.

tests::srgb_twin's map test also prints the translation time of fpv_srgb_write's state and of
its sRGB variant, for the release-mode measurement.

Verified: the replays named above; the ledger as edited is verified by the next round.
2026-11-25 18:23:38 -08:00
Anees Iqbal 5bcb3c3253 Conformance: srgb-storage-writes' Metal recording, from the M3 Max
What: conformance record and times --runs 8 --write srgb-storage-writes on the Apple M3 Max,
macOS 27.0.1 (26A434), job m3-max-74594 at 121122cd7f; the recording copied out of its
workspace. docs/CONFORMANCE-COVERAGE.md regenerated (the case module now holds 1 case, its Metal
leg reaching 39 items).

What Metal stored, read off the recording: in every one of the four sweeps (RGBA8Unorm_sRGB and
BGRA8Unorm_sRGB, float and half) each row-0 texel holds codes (i, 255 - i, (i * 37) & 255, i) in
the format's channel order, 0 mismatches of 256; row 1's values past either end clamp to 0 and
255 before the encode, alpha linear.
2026-11-25 18:14:40 -08:00
Anees Iqbal 71388e89d7 Conformance: srgb-storage-writes, what access::write stores into an 8-bit sRGB texture
What: a case over the owned fixture fpv_srgb_storage's fpv_srgb_write and fpv_srgb_write_half,
each writing a 256 by 2 RGBA8Unorm_sRGB texture and a BGRA8Unorm_sRGB one from buffer 0 and
recording the texture's bytes, one code a channel. The values are the linear values each code
decodes to (every code in red, green and blue, each in its own order, alpha i / 255), and row 1
starts with values past either end, which Metal clamps. A unit test checks each value encodes
within a hundredth of a code of its code in float and a twentieth through its half, so no side's
encode meets a value between two codes. half_bits is extended_range_targets'.

Why: Metal promises write access to both formats on every device (8.7.7: the write encodes,
alpha linear); the runtime now stores them through the UNORM twin with the encode in the
kernel. read_write is not in any read-write tier for an sRGB format, so the case writes only.

Verified: not yet run; the recording on the M3 follows. docs/CONFORMANCE-COVERAGE.md
regenerated.
2026-11-25 18:09:09 -08:00
Anees Iqbal b6a57f7958 Translator: LoweringInputs::srgb_storage writes an 8-bit sRGB texture through its UNORM twin
What: a new LoweringInputs field, srgb_storage, names texture slots whose texture is an 8-bit sRGB
texture held for storage through its UNORM twin's view. Such a slot, where storage_images names
no choice for it and its image class is float, declares its storage image without a format, of
class SrgbEncode: a write encodes red, green and blue by the MSL transfer (8.7.7) through the
device's conversion and keeps alpha linear, recording PrecisionNote::DevicePackConversion, and a
read decodes. A device that cannot write or read storage without a format refuses it as
Feature::Format. Under the identity domains the slot's element is the storage array's element of
its declaration's class, as an Unknown-format storage slot of class SrgbEncode now is.

Why: a guest dispatch writes a write-only BGRA8Unorm_sRGB storage texture hundreds of times a
session, and no device the runtime runs on stores an sRGB format; the runtime refused it
(Gap::StorageElement). The runtime's kernels compile from LoweringInputs, not VariantKey, so the
resident-table domain's srgb_textures and storage_images (another meaning) are not reused.

The compile key appends srgb_storage only when it is non-empty, so no existing key moves and no
version is bumped; with the field empty nothing a translation emits changes.

Verified: not yet built; the lane's quick check and suites run next. api_signatures.tsv is
blessed (one record) and docs/REFUSALS.md regenerated (one Feature::Format site more).
2026-11-25 18:08:49 -08:00
Anees Iqbal aa2b0fc670 Translator: delete the one-row and unit-axes kernel variants, and the unit-axes relief
VariantKey::one_row and VariantKey::unit_axes had no product setter: every
product path builds VariantKey::new() (the runtime's render_variant_key call,
compile_render_pipeline, compile_mesh_pipeline, render_pipeline_key, the stage
entries), and the runtime's kernel route builds its LoweringInputs through
kernel_inputs_read and kernel_variant, which set neither. Their forms ran only
under tests.

Deleted with them:
- LoweringInputs::one_row and ::unit_axes, their key tags ("one-row",
  "unit-axes", appended only when set, so no product key moves);
- RuntimeFact::OneRow (emitted only under the variant) and the one-row
  branches of the lockstep order (OrderKey::one_row, the cleared-rows
  retain); a device's profile now fixes the whole OrderKey, so a stage entry
  keeps one ordered entry (KEPT_ORDERS 2 -> 1);
- RuntimeFact::UnitAxes and its computation (divergent::unit_relief, the
  relief at workgroup.rs and divergent.rs, up to seven uniformity analyses a
  predicated kernel), and the unit-axes support of the uniformity analysis
  (Uniformity::with_unit_axes, the `unit` parameter). Readers checked: the
  runtime ignored it (pipeline.rs, `UnitAxes { axes: 0, .. } => {}`, gone);
  validation, the harness and the conformance suite name it nowhere; the
  CLI's --emit-meta writes every dependency generically, so the fact leaves
  that JSON and nothing there reads it; docs/API.md's paragraph is rewritten.
- Tests of the variants: the one-row halves of
  engine_simd_emulated (now a_row_tile_keeps_its_lockstep_barriers_and_records_row_lockstep),
  engine_simd_lockstep (now ..._clears_a_tree_reduction_in_rows, which asserts
  RowLockstep on the plain pipeline and its absence for the mixed guard), the
  harness's cells test, and the runtime test's relief check (now
  every_device_runs_a_kernel_whose_walk_diverges_by_row, which still runs the
  predicated walk and checks Metal's sums).

ARTIFACT_FORMAT_VERSION 597 -> 598: the codec loses RuntimeFact::OneRow and
::UnitAxes (and, in the next commits, VertexInputState::variant_pulled).
SEMANTICS_VERSION unchanged: no product output changes under a kept key.

Consumer search: consumer-uses.sh at the consumer's 19b32575f (development
and 9 steelbrain/* refs younger than a day): 0 code hits for one_row,
unit_axes, OneRow, UnitAxes, VariantKey, LoweringInputs, RuntimeFact.
In-tree grep after the change: no one_row, unit_axes, OneRow or UnitAxes
outside unrelated locals (dispatch.rs's DeepThreadgroup `one_row` spec value,
conformance locals).

Checked by the lane tip's jobs (quick check, suites, golden diff, states-only
play), named in the lane report.
2026-11-25 17:16:50 -08:00
Anees Iqbal 6db36df158 Tests: the refused device's memory view has three doors, and a device opens through it only by the floor's choice
What: cached_types_incoherent moves from tests/mod.rs into tests::command::on_device and is no
longer crate-visible. The tests reach it through three doors alone:
- each_device_under_the_view, the one way a test opens a device through the view; the floor's
  choice over the viewed types decides the arm, and a refused make is asserted and printed;
- viewed, which returns a device's memory properties read through the view (the coherence test's
  read of the types a device under m2v_shared_view reads); it takes and returns a value, so it is
  no DeviceOptions::memory;
- suite_view, compiled only under m2v_shared_view, the suite-wide hook in Device::new that gives
  every device the view where the test gives none.
The doc mentions of the old path (coherence.rs, floor.rs, the settle test, docs/VALIDATION.md)
name the new one.

Why: the planner's ask after the second red of this class today. kkview (cb3d913139) fixed two
view tests that opened KosmicKrisp through the view raw, and the settle test (f78d45b9e0) was a
third, landed beside that fix. With the view private, a new test cannot pass it to
DeviceOptions::memory in the device cfgs; it has to take each_device_under_the_view. The
m2v_shared_view hook stays a door of its own because that cfg runs the whole unchanged suite
through the view on cards the floor opens under it (docs/VALIDATION.md), which no per-test helper
gives. Test only; the runtime does not change.
2026-11-25 16:54:02 -08:00
Anees Iqbal e9484b7d03 Replay dumps: a texture the cover rule holds covered is dumped with a whole-texture cover
A heap texture that another placement's texture wrote over after its last write was reported by
compare-dumps as a difference: the dump loop passed no cover for a texture (dumps.rs: "always `-`
for a texture"), so the bytes Metal leaves undefined there were compared. Each texture a listed
command buffer stores or binds is now dumped, when the dump reads it (after the wait that saw
the command buffer complete, the moment a buffer's ranges are taken), with the cover 0..N, N its
dump's length, where the cover rule holds any byte of it covered (Covers::covered), and `-`
otherwise. A texture's ranges in the rule are its bytes in its heap, which the dump's parts are
not laid out as, so a covered texture is covered whole. The compare then leaves its words out
as it leaves out a covered buffer word. dumps.rs and docs/REPLAY-STREAM.md section 10 say so.

Test: the_dump_compare_leaves_out_a_covered_texture_and_reports_one_outside_every_cover (no
device; Kept reads a texture part's first word from a per-texture word where it holds one). Of
three textures placed in a heap, #5 and #6 over each other and #7 apart, two dispatches of a
state that writes slot 0 write #5 then #6, which covers #5; the second play reads #5 and #7
otherwise. #5's cover is 0..32 and its differing word is counted covered; #7, covered by
nothing, is the one difference reported.

Verified at this commit: nothing yet; the lane's jobs follow.
2026-11-25 16:41:51 -08:00
Anees Iqbal f6b1adf204 Replay player: a layered pass plays as the runtime builds it, and its dump holds each slice
The player marked a pass whose renderTargetArrayLength is 2 or more as one the runtime's
descriptor does not hold (Unheld(renderTargetArrayLength)) and skipped its encoder, though
RenderPassDescriptor::render_target_array_length takes it: the runtime renders that many slices
from each attachment's slice, refuses an attachment with fewer slices (AttachmentPlace) and
answers a length past maxFramebufferLayers with Gap::RenderPass of ArrayLength. The player now
sets render_target_array_length from the recorded value (narrowed to u32 as the other counts
are) and lets the runtime decide: a gap is a skipped encoder counted by the gap, and a refusal
stays the play's error. The attachments already carry slice and resolveSlice into the
runtime's descriptor; no other field is dropped for a layered pass.

The dump's stores read a layered pass's attachment as its first slice alone. They now keep each
pass descriptor's renderTargetArrayLength from its m2v.setPass record and store that many slices
from the attachment's slice (or the resolve's), through the MTLStoreActionUnknown path too.
dumps.rs and docs/REPLAY-STREAM.md (sections 10's skipped encoders and the dump) say so.

Tests: a_layered_pass_plays_and_its_draw_renders_the_layer_it_selects (device cfg; a stream of
a 2D array of two slices, R32Uint, renderTargetArrayLength 2, cleared to 7, and rt6_layered's
triangle selecting layer 1: no encoder or draw skipped, the blit's check of both slices matches
7 then 0x101, and the dump of the command buffer holds both slices) and
a_layered_pass_s_dump_holds_each_slice_it_renders (no device; Kept: length 3 stores slices 1 to
3 of a Store attachment and 0 to 2 of an Unknown one, length 1 the slice alone).

Verified at this commit: nothing yet; the lane's lavapipe job and the quick check follow.
2026-11-25 16:41:37 -08:00
Anees Iqbal c43f1a5447 Replay player: setSamplePositions:count: plays on a pass descriptor, and passes at other positions are counted
The runtime player refused setSamplePositions:count: on a render pass
descriptor ("not played on a render pass descriptor"), so every play of a
stream whose 2D renderer sets positions on its 4-sample pass stopped before
that pass.

It now plays the call as the runtime treats it: the runtime's descriptor has
no field for the positions and every multisample pass rasterizes at Vulkan's
standard sample locations, so nothing is set and nothing is refused. The pass
keeps the positions its last call set, and each render encoder the runtime
makes of a pass whose positions differ from Metal's defaults for the pass's
sample count (its attachments', or defaultRasterSampleCount with none) is
counted on a report line, with the first one's frame and call:
"passes at sample positions other than Metal's defaults N: rasterized at the
defaults, Vulkan's standard locations; the first at frame F, call C".

Metal's defaults are taken as Vulkan's standard locations at 1, 2 and 4
samples (the spec's Standard Sample Locations table; the runtime's floor row
standardSampleLocations and its known gap name them Metal's defaults at those
counts; the conformance rows sample-positions-default-4x/-2x). No other
count's defaults are held, so a set at any other count counts as differing;
an empty list (count 0) is the defaults.

Tests: rt_replay's sample_positions_play_and_a_pass_at_other_positions_is_counted
writes its own stream, two passes over a 4-sample target, one at the 4x
defaults and one at four others; it plays through with nothing skipped and
the line counts only the second (call 12). Without the fix the play stops
refused at call 5. new_runtime's
sample_positions_differ_from_metal_s_defaults_of_the_pass_s_count checks the
comparison (defaults, one coordinate off, reordered, fewer positions than
samples, Vulkan's 8x locations) and the line at zero, without a device.

Docs: docs/REPLAY-STREAM.md lists the call among the pass descriptor's
setters and says how the backend plays and counts it.
2026-11-25 15:48:21 -08:00
Anees Iqbal e6df09cddd Docs: under m2v_shared_view a card that offers imports only cached types refuses every import
What: VALIDATION.md's m2v_shared_view entry gains the planner's sentence: under the view a card
whose host-pointer and dma-buf queries offer only its cached types refuses every import; run it
with the import families filtered.

Why: on the RX 7900 XTX (RADV) the host-pointer query offers type 5 alone (0x20) and the dma-buf
query types 5 and 10 (0x420); the view leaves neither coherent, so import.rs's rules refuse
every import there: 17 tests of the view's suite failed on that alone (job m3-max-73943). The
planner's ruling keeps the view and import.rs unchanged and filters those tests in the leg's
command line.

Verified: docs only.
2026-11-25 14:24:29 -08:00
Anees Iqbal 6c1eb0e77c Runtime tests: m2v_shared_view runs the device suite through the refused device's view
What: a test-only cfg, m2v_shared_view, declared in metal2vulkan-runtime's check-cfg list beside
m2v_gpu_hazards and added to docs/VALIDATION.md's cfg table. Under it, Device::open gives every
device the tests make with no memory view of its own the refused device's view through the
landed seam: options.memory.or(Some(crate::tests::cached_types_incoherent)), which takes
HOST_COHERENT from every host-visible, host-coherent, host-cached type. A test that sets its own
view keeps it. The existing device suite then runs, unchanged, with Shared in a cached type that
reads not coherent, so it runs Shared memory's flushes and invalidates on memory that is coherent
in fact, which Vulkan allows. tests::coherence's every-device test asserts, under the cfg, that
every device builds the coherence state, and prints the Shared type and the calls.

Why: the planner's condition for A-narrow's proof on lab cards, which have no cached type that is
not coherent: a test that sets the option, no second suite, no env var.

Verified: not yet run (cargo fmt only).
2026-11-25 14:24:29 -08:00
Anees Iqbal db3a88526b Validation: the stencil rule's Counting clause has nothing to read in the case schema
The runtime's BitDraws rule refuses a draw through a [[stencil]] output drawn by bits in two
places: a face whose compare is other than Always and Never (DrawDepthStencil::
stencil_reference_face reads it), and, where the state replaces a stencil bit, a draw inside a
Counting visibility result's segment. The second needs a visibility result mode, and the case
schema has no way to state one:

- crates/metal2vulkan-validation/src/case.rs:19-21, AuthoredCase: #[serde(deny_unknown_fields)],
  and none of its fields is a visibility result mode, offset or buffer;
- src/case.rs:1819-1821, Draw (primitive, vertex_start, vertex_count, instance_count,
  index_buffer, base_vertex, base_instance): deny_unknown_fields, no visibility field;
- src/case.rs:1388-1390, DepthStencilResource, and src/case.rs:1406-1408,
  DepthStencilStateLiteral: deny_unknown_fields, no visibility field;
- neither executor sets a mode or gives its pass a visibility result buffer: no "visibility" in
  src/metal/ or src/candidate/ (grep -rni visibility), and runtime_render.rs's Targets::pass
  (line 661) builds the pass from its attachments, array length and default size alone.

A manifest naming such a field is refused at parse, so no case's draw is in a segment and the
classifier carries no clause for it. When the schema grows a visibility result mode, the clause
belongs beside the compare rule, with its own classification test. The doc comment of
stencil_reference_face and docs/VALIDATION.md now say this instead of "a case sets no mode".

Verified at this commit: cargo fmt; doc comment and docs only, no code changed.
2026-11-25 13:24:41 -08:00
Anees Iqbal 5517e2df1b Validation: a stencil output whose test it decides needs VK_EXT_shader_stencil_export on a device without it
What: the engine's render route through the runtime now reads, from the case's own structure, the
draws the runtime refuses on a device without VK_EXT_shader_stencil_export, and records them as the
device's refusal (NotSupported::NotEnabled, not_supported{not_enabled}, class device) naming the
extension, the face and its compare function, instead of drawing them and failing on the runtime's
Gap::Draw { kind: StencilOutput }.

- RenderCase::stencil_output: the case's own fragment function writes a live [[stencil]] output,
  read from its AIR outputs' roles (executor_contract::depth_stencil_test), false for a vertex case.
- DrawDepthStencil::stencil_reference_face (executor_contract/depth_stencil.rs): the first face
  whose stencil test the output decides. It is the runtime's rule, depth_stencil::BitDraws::of, on
  the same Vulkan state (metal::state::depth_stencil_state of the same descriptor): None where the
  stencil test is off; otherwise a face whose compare op is other than ALWAYS and NEVER, whatever
  its operations and masks (BitDraws::of returns None before it reads the replaced bits).
- runtime_render::run: once the state is made, a case with a stencil output, on a device whose
  translator profile lacks fragment.stencil_export (the bit the translator chose the bit-draws form
  by), under a state with such a face, is NotEnabled. After the make, so the product's own refusals
  at creation (a colour beside the output: StencilExport) keep their records.

The runtime's second refusal, a draw that replaces a bit inside a Counting visibility segment,
meets no authored case: the case schema and the executor set no visibility result mode, so no
draw is in a segment. The doc comment and docs/VALIDATION.md say so.

Why this form and not the runtime limit: a ToolingRequirement with Limit::Runtime stops the engine
on every device, and lavapipe, RADV and ANV list the extension and run and match these cases. The
refusal holds only on a device without the extension, which is what a device's NotEnabled records.
Before the stencil form (5a722b5c3f) such a case was the device's refusal on NVIDIA too, through the
translator's StencilExport. Round 733b14ed24's RTX 3090 public leg failed 14 such cases
(stencil-output-reference-* and stencil-output-at-*-rate-*: "the runtime refused a case its
structure classifies as one it runs (Draw { kind: StencilOutput })").

Versions: none move. The authoring-capability census classifies by ToolingRequirement, which this
does not touch, so no census or index version. ENGINE_EXECUTOR_ABI stays: on a device with the
extension nothing changes, and on one without it every case this refuses failed at the base with
no row and no refusal recorded, so no recorded row observes the change (engine.rs's rule for a
bump).

Tests: runtime_render's a_stencil_output_needs_the_extension_where_it_decides_its_test, on the
committed profiles nvidia-rtx5080-laptop (no extension) and gate-lavapipe (the extension): every
pair of the eight compare functions on the two faces under Keep and Replace, 120 refused naming
the face and its function, the 8 of Always and Never drawn; a function with no stencil output and
a device with the extension draw every state. The graphics mapping tests assert stencil_output for
fragment_depth_stencil and its absence for fragment_varying_color. Without this change the case
reaches the runtime's draw and fails, as on the 3090.

Verified at this commit: cargo fmt only. The jobs that check it (the validation suite, the 3090
public leg, lavapipe's public leg) report to the orchestrator.
2026-11-25 13:24:41 -08:00
Anees Iqbal 31b3470a3e Bitcode: read the pre-LLVM-4 metadata and typed-pointer records of AIR 1.8
A game launcher's metallib (AIR 1.8, language 1.1) parses since the container fix, but each
of its 7 functions stopped in the bitcode reader at METADATA_STRING_OLD. A structure-only census
of its 7 modules (job m3-max-73828) found six refused forms in all and nothing else unknown:
METADATA_STRING_OLD, METADATA_KIND inside the METADATA block, METADATA_OLD_NODE,
FUNC_INBOUNDS_GEP_OLD, LOAD without its type, and CALL without the explicit-type flag.

Each is now read as LLVM's reader reads it at llvmorg-23.1.2:

- STRING_OLD (MetadataLoader.cpp:2424-2433): one MDString of the operands as bytes, the next
  metadata id. Its llvm.vectorizer. loop-key upgrade (AutoUpgrade.cpp:6979-7026) renames keys
  the IR keeps in neither spelling, so the decoded loop hints are unchanged.
- KIND in the METADATA block (2457, parseMetadataKindRecord 2631-2643): the METADATA_KIND
  block's record. Both places now refuse a record with fewer than 2 operands and a kind id
  stated twice, as LLVM does.
- OLD_NODE (1401-1428): a uniqued node of (type, value) pairs. A metadata-typed operand is a
  metadata id, a void one is null, and any other is the module value of that type and id, as
  ValueAsMetadata. LLVM numbers no id for such a value; the arena keeps one Md::Value entry per
  value after the block's own ids, and MdIds moves every id LLVM numbers later (later module
  blocks, function blocks, attachments, call operands) past them.
- INBOUNDS_GEP_OLD (BitcodeReader.cpp:5383-5450), LOAD (6418-6436) and CALL (6886-6964)
  without their types: the source element, loaded or function type is the pointer operand's
  contained type. The reader follows LLVM's type ids (getContainedTypeID, 1510;
  getVirtualTypeID, 1532) for every value: TypeIds keeps the virtual ids for pointers made by
  alloca, GEP and the module's globals and functions, shuffles and cmpxchg; each instruction's
  result takes the id LLVM's reader gives it.

Still refused, by name: METADATA_OLD_FN_NODE; KIND and OLD_NODE in a function's block; an
OLD_NODE value in a module block after one whose old nodes kept values; a load atomic without
its type; GEP_OLD (not inbounds) and STORE_OLD. None is in the file. A typed-pointer load, call
or GEP whose operand has no contained type (an opaque pointer, a non-pointer) is BadType or a
malformed record.

Tests: typed_pointer_records_without_their_types_read_as_with_them decodes one typed-pointer
module in both spellings (a struct field, an array element, a loaded pointer, a cast, an
argument, and a function whose record names a pointer to its type) and asserts the tables are
equal, plus the refusals. legacy_metadata_records_read_as_their_modern_twins decodes the
function-test module with its metadata in the old records, asserts the body equals the modern
twin's, the arena's layout, and the shifted ids in a second module block and in a function
block, plus each refusal. Both fail without the fix: the old records were refused. The tests
that asserted those refusals now assert the remaining ones (OLD_FN_NODE).

docs/REFUSALS.md regenerated. Not yet run at this commit: the suite job follows.
2026-11-25 13:14:58 -08:00
Anees Iqbal 8f74582eb3 Docs: CONFORMANCE-COVERAGE.md regenerated for pass-sequence-aspect-actions' NVIDIA ledger row
b7ec03d37a added the row; the generated coverage document counts ledger rows (7983 -> 7984) and lists the case.
Development's suites at a551bbed9f (m3-max-73870) failed the_conformance_coverage_document_is_what_the_sources_derive
on it. Regenerated with scripts/conformance-coverage/coverage.py; no other change.
2026-11-25 12:53:50 -08:00
Anees Iqbal a1b955eec9 indirect_commands: the plumbing only the deleted runtime drove goes
`bind::indirect_commands` kept entry points that the removed in-crate runtime used to execute
indirect command buffers. Nothing calls them now: not the runtime crate, not the command line,
not validation, conformance, harness, devtools or the translator, and not the consumer. Deleted,
each with its own tests, its re-export, its api_surface row, its api_signatures rows and its
docs/API.md sentence:
- `RecordField` (referenced by nothing at all);
- `records_address`, `RECORDS_ADDRESS_BASE`, `RECORDS_ID_LIMIT`, and the crate-private
  `RECORDS_ADDRESS_SHIFT` that only `records_address` read;
- `written_flag_offset`, `WRITTEN_FLAG_BYTES`;
- `BufferBinding::resolve_buffer`, `RegisteredBuffer` (+ `new`), `ResolvedBuffer`, `AddressError`;
- `CommandRecord::resolve_bindings`, `ResolvedBindings`, `BindingError` (tests/inheritance.rs
  tested only these and goes whole);
- `RenderDraws::PRIMITIVES` (its one user, a test, now spells the struct out);
- `RecordView::action`, `barrier`, `kernel_pipeline`, `buffer`, `writes`.
The fixed point inside the module adds `RecordError::Index`, which nothing constructs (its
Display arm alone named it; it was the error of `RecordField`'s indexed fields), and an empty
`impl CommandRecord {}`.

Kept, because a live path calls them inside the module (validation's `CommandBuffer::decode` and
`CommandDescriptor::validate_record`): `BufferStage::of` (descriptor.rs `validate_record`,
host.rs `decode`), `CommandDescriptor::holds` (`validate_record`), `validate_header` (`decode`),
and `RecordView` with the accessors `CommandRecord::decode` reads through `record_into`
(`pipeline`, `retained_pipeline`, `threadgroup_memory_length`, `stage_in_region`,
`imageblock_size`, `record`, `record_into`).

`Bindings::buffers` becomes private: only descriptor.rs and host.rs call it, and validation reads
a record's buffers through `buffers_mut` only. The build at the stack's tip answers whether
anything else used it (an error would mean a user). `BufferBinding`'s doc no longer links it.

Docs that named the deleted items or the deleted runtime say what is true now: the
`bind::indirect_commands` module docs (validation's case model and Metal executor use it),
host.rs's module docs, `BufferBinding::address`, `RecordError`, provenance.rs's
`object_handle_load`, and docs/API.md's indirect-command-buffer section.

Zeros, outside crates/metal2vulkan/src/indirect_commands* and the facade, at metal2vulkan
733b14ed24 and the consumer reims-vgpu d0a7c9614 (whose Cargo.toml pins metal2vulkan 0c9db49765):
- `git grep -nw <name> 733b14ed24 -- 'crates/*.rs' 'docs/*.md'` (the facade and
  tests/api_surface.rs excluded, comment-only lines dropped): 0 for RecordField,
  RECORDS_ADDRESS_BASE, RECORDS_ID_LIMIT, WRITTEN_FLAG_BYTES, resolve_buffer, RegisteredBuffer,
  ResolvedBuffer, AddressError, resolve_bindings, ResolvedBindings, BindingError.
  `records_address`: only other items of the name (metal2vulkan-air intrinsics/objects.rs:449, a
  predicate; provenance.rs:3251-3267, a local and that predicate) and provenance.rs:1831's
  comment, rewritten here. `written_flag_offset`: only docs/API.md:1352, rewritten here.
- `git grep -nF <path> 733b14ed24 -- 'crates/*.rs'` (same exclusions): 0 for
  `RenderDraws::PRIMITIVES`, `RecordView`, `RecordError::Index`.
- Consumer: `git grep -nw <name> d0a7c9614 -- '*.rs'` is 0 for every name above;
  `git grep -nE 'indirect_commands::' d0a7c9614 -- '*.rs'` is 0; `git grep -nE 'metal2vulkan::bind'
  d0a7c9614 -- '*.rs'` names only rt_platform/argument.rs and rt_platform/function_table.rs.

Tables: `scripts/api-signatures/signatures.py --bless` removed 47 rows and added none;
`scripts/refusal-surface/refusal_surface.py` leaves docs/REFUSALS.md unchanged. Build, clippy
and suites run at the stack's tip.
2026-11-25 12:22:04 -08:00
Anees Iqbal dd3f16a656 Conformance: Metal's answer for the compressed small-level copies, recorded with its times
What: the recordings of compressed-small-levels-bc1-rgba and compressed-small-levels-bc3-rgba.
Metal's times are kept in each. docs/CONFORMANCE-COVERAGE.md is regenerated: 188 case modules,
1335 recordings, compressed_small_levels 2 cases, every field compared. A new unit test,
the_recorded_copies_are_the_model, holds each recorded site to the case's model. program()'s doc
no longer links to the private `reads`, which rustdoc refused (job m3-max-73736).

Why: this is the recorded Metal answer the suite holds the runtime to, for the guest's 4 x 4 copy
of a level smaller than one block.

Verified:
- Job m3-max-73751 (Apple M3 Max, macOS 27.0.1, build 26A434), in the workspace job m3-max-73737
  built `conformance` in, release, at 7af2733ddc.
  - It ran `conformance record` of both cases: plain Metal 3 runs, one outcome, three command
    buffers Completed.
  - The validated leg stopped at the work, on the copy from a buffer: "(destinationOrigin.y +
    sourceSize.height)(4) must be <= height(2)".
  - It then ran `conformance times --runs 8 --write` of both.
- Every recorded byte site equals the case's model: levels 8 to 11 of the t2t, b2t and replace
  destinations, and the 64 bytes of t2b and get at levels 9, 10 and 11. I checked this with a
  Python decode of the recordings here. The new test checks the same and has not run yet.
- coverage.py --check: as derived.
2026-11-25 12:02:22 -08:00
Anees Iqbal 88beca43a0 Docs: CONFORMANCE-COVERAGE.md regenerated for the stencil form's four known-gap rows
The stencil form (5a722b5c3f) added four rows to the conformance known-gaps
ledger (stencil-output and stencil-output-loaded, two each: NVIDIA's drivers
list no VK_EXT_shader_stencil_export, and the refused draw's consequence) and
did not regenerate the document, so conformance_coverage's check failed in the
suites run of that tree (m3-max-73661: "docs/CONFORMANCE-COVERAGE.md is not
what the suite's sources and recordings derive"). Written by
scripts/conformance-coverage/coverage.py; its --check passes on this tree.
2026-11-25 10:58:27 -08:00
Anees Iqbal 5a722b5c3f Stencil output: a device without VK_EXT_shader_stencil_export draws it by bits, the owner's tenth form
A fragment function's [[stencil]] output is the reference of both faces' stencil test for its
fragment (MSL Table 5.7, 5.2.3.5). On a device without VK_EXT_shader_stencil_export it was refused
at creation (StencilExport). Under the owner's grant (rule 2's tenth form, chosen by that
extension's query alone), such a device now draws it by bits; a device with the extension is
unchanged (FragStencilRefEXT, no fact, no note, the draw issued once).

Translator: the function stores no reference; each return kills the fragment where the draw's new
push field PushField::StencilBit k is below 8 and bit k of the output's low 8 is 0, and keeps
every fragment at 8 or more (one module, no specialization). The function states
RuntimeFact::StencilBitDraws (Mechanism::PushConstant) and its fragment stage the static note
PrecisionNote::StencilOutputOverlap. Refused there, naming the extension (Unsupported
StencilExport): a function that also writes a colour (the colour would be written by every
repeat) or memory, one whose returns cannot kill (an interlocked body, a loop over its covered
samples), a mesh pipeline, and a render pipeline made for indirect command buffers. Where the
device also lacks the pixel interlock, a function writing memory in a raster order group meets
that refusal first (RasterOrderGroups). SEMANTICS_VERSION 2301 -> 2302, ARTIFACT_FORMAT_VERSION
595 -> 596 (new codec members).

Runtime (depth_stencil::BitDraws, render_encoder::draw): with w the low 8 bits of the write masks
of the faces having a Replace operation, a draw whose stencil test is on and w is not 0 is drawn
once with every fragment kept under the reference 0 (Replace zeroes w's bits, every other
operation runs once), then once per bit k of w keeping the fragments whose output holds bit k,
under the reference 255, write mask (1 << k) & mask, Replace kept and every other operation Keep,
and no depth write; where the state writes depth under a compare other than Always and Never, the
first draw writes none and a last draw writes it with stencil write masks of 0. Each draw records
only the dynamic state that differs from the last; the encoder's tests and reference are recorded
again at the next draw. Counted in Metrics::stencil_bit_draws (the draws beyond the first).
Refused at a draw, Gap::Draw of DrawKind::StencilOutput: a face compare other than Always or Never
(the output decides that test), and, where w is not 0, a draw inside a Counting visibility
segment (every draw would add its samples). A Boolean segment is drawn. Vulkan Appendix I: the
repeats change stencil reference, operations and write masks between draws of one pipeline,
which Rule 2 lists as required (write masks) and strongly suggested (stencil parameters) to be
invariant; the note records the one difference the repeats make.

The note (rule 1): fragments of one draw that overlap leave the OR of their values. Where two
fragments of one draw reach one sample under Replace, the sample stores the OR of their outputs'
low 8 bits within the write mask, where Metal stores the later fragment's value; under a depth
test that writes, each fragment's stencil operation is chosen against the depth from before the
draw. Measured on an RTX 3090 (NVIDIA 620.70.06) under the validation layer 1.4.363.0, job
m3-max-73635: two triangles of one draw outputting 0x35 then 0x4a store 0x7f on the 32 texels both
reach, where Metal stores 0x4a, and 0x35 on the 32 one reaches, in 8 bit draws; the 780M (RADV)
and the Iris Xe (ANV), which list the extension, store 0x4a with 0 bit draws.

AGENTS.md rule 2: "for nine only" becomes "for ten only", the list ending with fragment stencil
output (the planner's text, relayed by main, word for word).

Tests: the translator's engine_stencil (every committed profile: the extension or the draws by
bits, L3 both ways; refusals for colour, memory, mesh and indirect command buffers); rt's host test
of BitDraws::of; rt's device cells (stencil_export.rs): the stencil alone and the stencil with the
depth under Always and Less over a quad, exact, texels of stencil 0 among them; the overlap row;
the refusals; the route of a 4-sample Depth32Float_Stencil8 source read at sample 0 into a
single-sample target under Always/Replace 0xff and depth Always with write, beside colour 0
RGBA8 of write mask none; the codec round trip; the mechanism table.

Docs: docs/API.md (the stencil output passage and the catalogue entry
metal2vulkan-degrade-stencil-output-overlap), rt README known gap and floor row,
docs/REFUSALS.md regenerated, api_signatures blessed. The conformance degradation and the
validation allowance (unbounded) of the note. known-gaps-rt.tsv: stencil-output and
stencil-output-loaded on NVIDIA, refused at renderCommandEncoder (draw 3's back face Equal against
the output) and divergent at case/stencil as a result. runtime-sources.sha256: the guard's inputs
changed only by mechanism.rs gaining the new fact's arm, which no existing artifact states, so no
run of an existing artifact changes.

Golden rows and the engine inventory (22 cells) are re-blessed on development: 20 move from the
StencilExport refusal to a module (stx_stencil_by_pixel, stx_stencil_discard,
stx_stencil_with_depth, stx_stencil_ms_by_sample, fragment_depth_stencil on nvidia-pascal-linux,
nvidia-rtx50-linux, nvidia-rtx5080-laptop and runtime-floor), and the 2 cells
stx_stencil_in_order and stx_stencil_ms_in_order on runtime-floor move from StencilExport to
RasterOrderGroups, still refused. Why: the memory-write refusal now runs on the emitted module
(pipeline/compile.rs), after the body's own refusals, so on a profile without the pixel interlock
the raster order group these functions write memory in is refused first; at the base the plan's
entry refused every [[stencil]] output on such a device before any body was lowered.

Verified (this tree, or the rt archive of d6bd77d203 where named; the rt and translator sources
there differ from this tree in the translator's test and a doc comment alone):
- msi check, job m3-max-73648 (this tree): fmt, signatures, refusals, clippy -D warnings with all
  features plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, Rustdoc, the rt nextest archive and the
  conformance binary built; rt's whole suite on lavapipe under the validation layer 1.4.363.0,
  738 tests run: 738 passed, 3 skipped; the lavapipe leg, 7 tests run: 7 passed: export enabled,
  the overlap row storing {4a}, bit draws 0 on every cell.
- RTX 3090 (NVIDIA 620.70.06, layer 1.4.363.0), job m3-max-73635 (d6bd77d203): 7 passed; the
  overlap row above, bit draws 8; the stencil alone and with depth under Always and Less, 64
  texels exact, bit draws [8, 8, 9]; the route exact, bit draws 8; refused a colour beside the
  stencil (StencilExport), Equal and a Counting segment (DrawKind::StencilOutput), a Boolean
  segment drawn. Conformance stencil-output and stencil-output-loaded: refused at
  renderCommandEncoder and divergent at case/stencil (4 elements, largest difference 80), the
  four known-gaps rows.
- RTX 5080 Laptop GPU (NVIDIA 615.71.09, layer 1.4.363.0), job m3-max-73652 (this tree): 7
  passed; overlap {7f} where both reach, {35} where one, bit draws 8; cells exact, bit draws
  [8, 8, 9]; the route exact, bit draws 8; the same refusals; conformance replay with this tree's
  binary matched the four NVIDIA rows (exit 0).
- Radeon 780M (RADV, Mesa 26.2.6), job m3-max-73636 (d6bd77d203), and Iris Xe (ANV, Mesa
  26.2.6), job m3-max-73650 (this tree): 7 passed each, export enabled, overlap {4a}, bit draws 0.
- States-only plays of recorded streams, base 0c9db49765 against d6bd77d203, every play in
  states-only mode, made and refused equal, refused 0: lavapipe, jobs m3-max-73632 and
  m3-max-73631 (two streams: render 10643 and 9014, compute 15299 and 221); the RTX 3090 with
  --device-type gpu, job m3-max-73638 (two streams: render 9834 and 10643, compute 214 and
  15299); the RTX 5080, job m3-max-73652 (two streams: render 9014 and 9645, compute 221 and
  250). Those two carry a library holding a [[stencil]] function that no recorded pipeline state
  uses; no stream on either NVIDIA node makes a [[stencil]] pipeline (job m3-max-73646 and
  m3-max-73652's scan).
- Owed: the translator and validation suites of this tree (the suites of d6bd77d203, job
  m3-max-73627, failed in the memory refusal's test on runtime-floor, the runtime guard's hash
  and the golden and inventory cells above; this tree fixes the first two).
2026-11-25 10:38:03 -08:00
Anees Iqbal d2e8ab2a85 Replay player: a colour attachment's depthPlane is played
What: the new-runtime player forwards a colour attachment setter's `depthPlane` into the
runtime's RenderPassColorAttachmentDescriptor::depth_plane, as it forwards resolveDepthPlane, and
no longer holds the pass for a plane but 0 ("Unheld(depthPlane)", the encoder skipped). A depth
or stencil attachment's depthPlane is not played and holds nothing: Metal reads it of a 3D
texture alone (Apple's page for depthPlane, as fetched: "If the texture isn't a 3D texture, then
Metal ignores this property."), and the runtime refuses a 3D texture's depth or stencil
attachment by its type (TextureType) whatever its plane, which the player counts as any gap.

Why: since 3c52ee1cf1 the runtime takes a colour attachment's depth plane of a 3D texture, and the
player still skipped every pass that set one, and every pass that set one of a 2D texture, which
Metal with its validation layer off renders as at 0 (probe resolve_depth_planes.m, case plane3,
job m3-max-73495).

Docs: docs/REPLAY-STREAM.md and the player's module doc list what a held pass holds now (the
"a resolve texture" there was stale too: only a skipped one is held).

Test: replay::rt_replay::a_colour_attachment_s_depth_plane_plays_on_the_new_runtime (device
cfgs): a stream clears plane 0 of a 4x4x4 RGBA8Unorm 3D texture green (no plane set), its plane 2
red (depthPlane 2), and a 2D texture red at depthPlane 2; blits copy planes 0 and 2 and the 2D
texture out, and the stream's three checks (green, red, red) match; no encoder, call or object
skipped.

Verified (run tree 44b2cc80bf, on development 3c52ee1cf1; its tree is this commit's but for
development's bless 0c9db49765 of opened_chains.txt):
- msi, job m3-max-73511: fmt, clippy (no cfg, m2v_gpu, m2v_cpu_icd) and rustdoc exit 0; the
  player's stream device tests (replay::rt_replay) on lavapipe (Mesa 26.2.4): 57 passed, the test
  among them; metal2vulkan-validation's suite: 1305 passed, 1 failed, 3 skipped, the one failure
  every_committed_profiles_context_enables_its_pinned_chain, development's own at 3c52ee1cf1
  (job m3-max-73486), which 0c9db49765, this commit's base, blesses.
- Without the fix (the player's render.rs of 3c52ee1cf1, lavapipe, job m3-max-73514): the test
  fails, "skipped render encoders Unheld(depthPlane) 2", and the plane-2 check differs.
2026-11-24 01:56:50 -08:00
Anees Iqbal 3c52ee1cf1 Render pass: a colour attachment renders one depth plane of a 3D texture's level
What: RenderPassColorAttachmentDescriptor takes `depth_plane` (Metal's `depthPlane`). A 3D
texture of RenderTarget usage is made 2D-array-compatible (VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT,
in its image format query too: Plan::flags, from the image's type and its colour attachment usage,
no query). attachment_view then takes the plane of a 3D texture's level as a 2D view of that one
layer (base layer = depthPlane, at the level), checked against the level's depth
(Refusal::AttachmentPlace past it). Every barrier on a 3D texture's image (its attachment's, its
copies' and its moves', texture::barrier_layers) names the image's layers as 0 and
VK_REMAINING_ARRAY_LAYERS, so each moves every plane of the level it names. Before, every such pass
was Gap::RenderPass of RenderPassKind::TextureType.

Still TextureType: a 3D texture in a layered pass (renderTargetArrayLength 2 or more), a depth or
stencil attachment of a 3D texture, a 3D resolve texture, and a resolve's depth plane but 0. A draw
that reads, through a shadow (a device without the attachment feedback loop), a 3D texture whose
plane its pass renders is Gap::Draw of DrawKind::AttachmentRead: a shadow's copies are of layers.
The floor asks a device that lists VK_KHR_portability_subset for imageView2DOn3DImage too
(VUID-VkImageCreateInfo-imageView2DOn3DImage-04459), as it asks multisampleArrayImage.

Why: a guest route meets the refusal. A browser's GL layer clears every 3D texture of an RGB-family
format (RGB8, RGB16F) at creation through a pass on each plane, to set the alpha it emulates; it
also renders into a plane for framebufferTextureLayer(TEXTURE_3D, k) then a clear or a draw, for a
level sampled before a full upload, and for copyTexSubImage3D. The consumer's route showed the key
at 205c8d2398 ("a render pass with TextureType is not built", colour 0 RGBA8Unorm Type3D 32x32x4,
usage 0x7, Managed), and every route that renders into a 3D texture read 0.

Metal (MTLRenderPass.h): `depthPlane` is "The depth plane of the texture to be used for rendering.
Default is zero."; Apple's page for the property, as fetched: "If the texture isn't a 3D texture,
then Metal ignores this property." Every Mac renders into a 3D texture's plane, with nothing to ask,
so it is built.

Vulkan (1.4.366): VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT "specifies that the image can be used to
create a VkImageView of type VK_IMAGE_VIEW_TYPE_2D or VK_IMAGE_VIEW_TYPE_2D_ARRAY" (core since 1.1);
the image is 3D (VUID-VkImageCreateInfo-flags-00950) and not sparse (-09403); the format query takes
the same flags (Image Creation Limits). The view is 2D, one level
(VUID-VkImageViewCreateInfo-image-04970), its base layer below the level's depth (-02724, -02725),
of an image made with the flag (-06728).
Such a view "can be used as a framebuffer attachment that refers only to the specified range of
slices of the selected mip level" (VkImageSubresourceRange). Dynamic rendering refuses only a 3D
view type (VUID-VkRenderingAttachmentInfo-imageView-12470). The runtime does not enable
maintenance9, so a barrier on the image moves the whole level
(VUID-VkImageMemoryBarrier2-subresourceRange-01488); with maintenance9 its layers would name depth
slices (-maintenance9-10798), and the layer count that names the whole level either way is
VK_REMAINING_ARRAY_LAYERS, which the validation layer asks for on such an image
(WARNING-VkImageSubresourceRange-layerCount-compatibility, met on lavapipe with layerCount 1, job
m3-max-73446). Load and store "only update values within the defined render area" of the view's
plane. The view is bound to no descriptor
(VUID-VkDescriptorImageInfo-descriptorType-06713).

Portability: KosmicKrisp, Mesa 26.3.1's source (src/kosmickrisp/vulkan), names no portability
subset, so the M3 device is not asked: a source read, unaudited at run time. MoltenVK reports
imageView2DOn3DImage (profiles/moltenvk-m3.json) and is below the floor anyway.

Conformance: the suite's `layered-attachment-places` crosses `depthPlane` over a 3D target of three
planes, recorded on Metal. Its runtime side now sets a colour attachment's `depth_plane` (a depth or
stencil attachment's plane stays Unavailable), and its twelve known-gaps-rt.tsv rows go.
docs/REFUSALS.md, docs/METAL-COVERAGE.md (depthPlane implemented), docs/CONFORMANCE-COVERAGE.md and
api_signatures.tsv are regenerated.

Tests:
- tests::depth_planes (device cfgs): RGBA8Unorm and RGBA16Float, ShaderRead | ShaderWrite |
  RenderTarget, Managed, an 8 x 8 x 4 texture of two levels (the second 4 x 4 x 2) and an 8 x 8 x 1
  one, every plane written first by replace_region. One command buffer: level 0's plane 2 cleared
  and drawn, level 1's plane 1 cleared and drawn, level 0's plane 0 loaded and drawn, level 0's
  plane 1 cleared alone, the one-deep texture cleared and drawn; every plane of both levels copied
  out and sampled at each texel's centre through a nearest sampler state (level 1 through a 3D view
  of it). A plane past level 1's depth is AttachmentPlace, a pass of two layers TextureType.
  tests::layouts records each rendering's colour attachment's view type and range and its image's
  type and create flags, which the cell asserts and prints.
- tests::floor: the portability features asked and enabled include imageView2DOn3DImage.
- The validation layer, which every device test runs under and which fails a test on any warning,
  holds the barriers: without barrier_layers the cell drew
  WARNING-VkImageSubresourceRange-layerCount-compatibility on lavapipe (job m3-max-73446).

Verified (tree of this commit, run as f748e9e8d2 on development 6047a2d8b6):
- msi, lavapipe (Mesa 26.2.4), job m3-max-73464: fmt, clippy (no cfg, m2v_gpu, m2v_cpu_icd),
  rustdoc, the refusal, signature, Metal-coverage and conformance-coverage checks all exit 0; the
  runtime's suite under the validation layer 734 passed, 3 skipped (the cell among them); the
  conformance crate's suite 1037 passed; `conformance replay --cpu` exit 0, the ledger exact,
  layered-attachment-places "announced" (the native-nan-encoding degrade notice alone).
- One leg a vendor, a nextest archive and the conformance command built on msi (job
  m3-max-73466), under the Khronos validation layer 1.4.363.0: the cell (its form printed: a 2D
  view, base layer the plane, at the level, of a 3D image made with 2D_ARRAY_COMPATIBLE, 0x28 for
  RGBA8Unorm with MUTABLE_FORMAT, 0x20 for RGBA16Float; every plane of both levels and of the
  one-deep texture exact, copied out and sampled), the blit, floor, layouts, layered, no
  attachment, over, pass, render, resolve, shadow, texture, view and depth/stencil route and copy
  families (123 tests), and `conformance replay --gpu` (exit 0, the ledger exact,
  layered-attachment-places "announced" as on lavapipe):
  - Intel Iris Xe (ANV, Mesa 26.2.6), job m3-max-73476: cell passed, 123 passed, replay exit 0.
  - AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.6), job m3-max-73477: cell passed, 123 passed,
    replay exit 0. (The XTX's node was held by another job for 47 more minutes.)
  - NVIDIA RTX 3090 (620.70.06), job m3-max-73478: cell passed, 123 passed, replay exit 0.
2026-11-24 01:35:19 -08:00
Anees Iqbal 50a851487c Conformance: a copy between two Depth32Float_Stencil8 textures, recorded on Metal
What: the case depth-stencil-copies-d32s8 (cases/depth_stencil_copies.rs), its recording from the
M3, and docs/CONFORMANCE-COVERAGE.md regenerated with it. Two 8 x 4 Depth32Float_Stencil8 textures
of ShaderRead | RenderTarget | PixelFormatView usage, private. Each plane of each is written from a
buffer through the plane options, every texel a depth and a stencil of its own, the two textures'
apart. One copyFromTexture:...toTexture:... moves 5 x 2 texels from the source's (1, 1) to the
destination's (2, 2). Both planes of both textures are then copied out through the plane options
and read: four byte sites, laid out in the textures' rows.

Why: the runtime now copies such a texture whole, both aspects in each vkCmdCopyImage region,
because Metal's texture-to-texture copy takes no plane option. The case puts that to Metal and
holds the runtime to Metal's own bytes. The unit test the_recorded_copy_moved_both_planes holds
the recording to the host's model, so a release in which Metal moves one plane alone shows as a
failing test naming the site. The case declares the restricted-depth-upload notice allowance, as
format_copies does: the depth planes take their bytes from a buffer, and every depth written lies
in [0, 1], so the note moves no byte the case reads.

Verified:
- Job m3-max-73350 (Apple M3 Max, macOS 27.0.1) ran `conformance record
  depth-stencil-copies-d32s8`. Plain Metal: 3 runs, one outcome, status Completed. The
  destination's region holds the source's depth and stencil, every other texel of both textures
  is what was written. The validated leg ran. An earlier attempt, m3-max-73338, ended in its build
  (the compiler cache's daemon) before any Metal call.
- Job m3-max-73383 (msi, lavapipe, Khronos validation layer 1.4.363.0) at the case and its
  recording, the coverage doc regenerated in the job:
  - coverage.py wrote docs/CONFORMANCE-COVERAGE.md, the one committed here (187 case modules,
    1333 recordings, depth_stencil_copies one case, every field compared);
  - fmt; clippy of metal2vulkan-conformance plain, --cfg m2v_gpu and --cfg m2v_cpu_icd;
  - the case's three unit tests passed, the_recorded_copy_moved_both_planes among them;
  - rustdoc -D warnings; coverage.py --check;
  - `conformance replay --cpu depth-stencil-copies-d32s8` exited 0: verdict announced, every
    byte site Metal's, the one difference the restricted-depth-upload notice the case declares
    (its allowance fired);
  - the conformance suite on lavapipe under the validation layer: 1038 run, 1037 passed. The one
    failure was times::every_case_is_timed (the new recording held no timing), which the next
    commit, Metal's times for this case, answers.
2026-11-24 01:06:14 -08:00
Anees Iqbal b573e68c11 rt: a Direct3D 11 plane's texture is made by one function of an explicit usage and format list
What: import_d3d11_surface derives every plane's usage and list first (d3d11_plane_form, from
the bind flags and the descriptor, its refusals before any plane is made), then makes each plane's
texture through d3d11_plane_texture(plane, usage, list, unit): the image of the plane's format
with that usage, mutable over that list where it is not empty, imported, bound, and the texture
over it under the plane's descriptor at its index. A plane's error drops the textures made before
it, which frees their images. A test can call the same function with other values, so a cell can
make an image the old way over the same Direct3D 11 texture and read it beside the import's,
with nothing of the old form in product code. docs/REFUSALS.md names the new site functions.

Docs: a plane is viewed in place in the image's own format, the descriptor's and the descriptor's
sRGB sibling. A view in another format has no in-place form on the import
(Gap::TextureView of SurfacePixelFormat), and the consumer takes the copy form of the same call
for it, a counted copy of the plane: the README's plane paragraph and a new entry in the known
gaps of memory blocks say so.

Correction to d310504408: it says the import never receives a view in another format. The
consumer does view a drawn plane (PixelFormatView) on the import itself in any format the guest
asks (surface_shapes.rs:233 and 247-257), so the narrow list does refuse views a guest reaches.
The ruling: the narrow list stays, and the consumer routes a texture over a drawn plane viewed in
another format to its counted copy shape.

Still owed on the same principle: the chroma's uint/unorm pair (R16_UINT under RG8Unorm, R32_UINT
under RG16Unorm) is the one reliance left past the texture Direct3D 11 made, besides the sRGB
sibling and the feedback usage. It is its own row, behind the diagnostic, and goes once the
consumer makes chroma R8G8_UNORM or R16G16_UNORM.

How verified: refusal_surface.py --check passes here. The Windows cross-build, the runtime's
checks, and the device run on the lab's Windows host (red at the parent, green here) are reported
with their job ids to the lander.
2026-11-23 21:13:22 -08:00
Anees Iqbal 737906832c Runtime: a compute pipeline's module reaches the driver with every specialization constant fixed, its workgroup size the entry point's LocalSize literals
Every compute VkPipeline rt makes is now created from a shader module of its own, made of the
kernel's words with each specialization constant the plain constant of its value and destroyed
once the create returns; the create names no VkSpecializationInfo. Vulkan defines specialization
as exactly this conversion (VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849), so
what a kernel computes is unchanged; what changes is that no driver is handed a specialization
constant to size a workgroup or an array from.

- Translator: pipeline::specialize(words, values) (spirv::specialize). OpSpecConstant,
  OpSpecConstantTrue/False become OpConstant/OpConstantTrue/False of the given value or the
  default; each OpSpecConstantOp becomes the constant it computes (SpecOp::eval, now product code,
  and SpecOp::opcode, which the serializer shares); OpSpecConstantComposite becomes
  OpConstantComposite; the SpecId decorations go; a WorkgroupSize composite loses its BuiltIn
  decoration and the entry point takes its values as OpExecutionMode LocalSize. The translator's
  output is unchanged (no SEMANTICS_VERSION bump).
- rt: Kernel holds its words (Code::Module(Arc<[u32]>)) instead of a VkShaderModule made at
  Kernel::new; Kernel::make specializes per variant and makes, uses and destroys the module.
  Heavy kernels specialize the same way: the stage request carries the specialized words and no
  ids or data (WIRE_VERSION 3), and the helper compiles them as they are (HELPER_VERSION 2).
  Lowered::Failed and Unmade go: nothing creates a shader module at Kernel::new now.
- Tests: serializer tests specialize (a deep kernel's spec constants, its bool, two Workgroup
  arrays sized by OpSpecConstantOps: values given and defaults, spirv-val under Vulkan 1.2 and
  1.3); rt deep_threadgroups a_kernel_reaches_the_driver_with_its_workgroup_size_as_literals.
- Docs: API.md (section 3), rt README.
2026-11-23 20:59:01 -08:00
Anees Iqbal a38145f53c Translator: a flat grid's tangled instructions take the profile's reconvergence mode, as the partial-threadgroups variant's do
A flat-grid module (LoweringInputs::flat_grid) returns its invocations past the grid before the
body (lower::dispatch::emit_entry), and under call_threadgroups it admits SIMD-group operations
(select.rs's flat call-threadgroups check). lower::simd::together excluded only
partial_threadgroups, so such a module's SIMD-group operation in a block the workgroup uniformity
proves uniform was stated Guaranteed with no mode, which SPIR-V does not support.

The words, SPIR-V 1.6 Revision 8:
- A threadgroup barrier is OpControlBarrier at Workgroup scope (3.3.20): "When Execution is
  Workgroup or larger, behavior is undefined unless all invocations within Execution execute the
  same dynamic instance of this instruction." A module whose past-grid invocations return early
  cannot hold one at all. The partial variant walks them predicated instead, and a flat
  call-threadgroups module refuses one. So this kind is unaffected.
- A SIMD-group operation or simdgroup barrier (OpGroupNonUniform*, 3.3.24; OpControlBarrier at
  Subgroup scope) acts on "the scope restricted tangle". Who is tangled is 2.2.5's rule:
  "Invocations will continue to execute the same dynamic instances as long as they follow the same
  control-flow path"; after a divergent branch, "Invocations may only resume executing the same
  dynamic instances when all invocations reach the same static instruction", and the merge rule
  ("Uniform Control Flow") needs control flow "uniform upon entry", which no longer holds once some
  invocations returned. Only SPV_KHR_maximal_reconvergence lets an invocation that ran OpReturn
  escape reconvergence.

A predicate on the AIR ("no divergent construct passed since entry") is not enough to keep a
narrower set. The lowering adds selections of its own, whose condition differs between
invocations, before a tangled instruction: the bounds-checked load (lower/access/psb.rs:660), the
guarded store (lower/access/emit.rs:411), an atomic's (lower/access/atomic.rs:1064) and a copy's
(lower/access/copy.rs:1343). So a module that returns past-grid invocations early has no tangled
instruction reached together. The partial-threadgroups variant's exclusion is unchanged.

No runtime or consumer path makes a flat-grid module today. `grep -rn 'flat_grid\|call_threadgroups'
crates/metal2vulkan-runtime/src`, tests excluded, gives 0 hits at 62e7af06e5. In the consumer's
checkout at 360eef13f, `git grep 'flat_grid\|call_threadgroups\|folded_groups' -- . ':!*.md'` gives
0 hits. So no guest module changes.

- simd::together: `partial_threadgroups || flat_grid` (returns_early). Its doc states the reason.
- The flat_grid and DeviceReconvergence doc comments, and docs/API.md's catalogue entry, state the
  same.
- New test a_flat_grid_s_shuffle_after_a_merge_takes_the_profile_s_mode, in
  engine_variant_reconvergence.rs. Our kernel holds a shuffle after the merge of a selection on
  the thread's parity. Its plain module is "none"/Guaranteed/no note on every committed profile.
  Its flat call-threadgroups module takes the profile's mode wherever it compiles: maximal and
  Guaranteed, else SubgroupUniformControlFlowKHR or none with ImplementationDefined and the note.
  At the parent the flat module states no mode on every profile, so the test fails there.
- SEMANTICS_VERSION 2300 -> 2301: a flat-grid module with a tangled instruction in a uniform block
  now states the mode or the note.
2026-11-23 20:57:08 -08:00
Anees Iqbal d16eb39e8f Tests: METAL2VULKAN_TEST_UNVALIDATED=1 runs rt's device tests without the validation layer, and says so
Every rt device test opens its instance through tests/validation.rs instance(), which fails
unless each device lists an active VK_LAYER_KHRONOS_validation. A Windows machine whose only
Vulkan pieces are its GPU driver and the loader it ships therefore cannot run the device suite at
all, and a machine of that kind is the only place some drivers are ever covered (AMD's
proprietary Windows driver: the lab has no AMD card under Windows).

The setting is test-only and off unless its value is 1; product code and the lab's runs, which
never set it, are unchanged. Under it, instance() enables nothing and checks the opposite: every
device lists no validation tool, so a run that says it is unvalidated is. No layer writes a log,
so the guard checks none. Each test process writes "M2V-UNVALIDATED unvalidated run: ..." once to
its standard error, past libtest's capture of a passing test's output, so the run's output says
it whatever passes. The test of the layer's log itself
(every_device_logs_a_deliberately_invalid_call_once) skips: without the layer its call is only
invalid.

The new device test the_setting_runs_the_device_tests_without_the_layer_and_says_so runs the
test binary's unvalidated_child in a process of its own under the setting, with VK_INSTANCE_LAYERS
and VK_LOADER_LAYERS_ENABLE removed, and requires it to pass and to print the line. Without this
change the child opens a validated instance (the layer is on VK_LAYER_PATH in every lab job) and
prints no such line, so the test fails; on a machine without the layer the child fails outright.

Docs: the setting in tests/validation.rs's module doc, docs/VALIDATION.md (the layer section),
CONTRIBUTING.md, and env_vars.rs's module doc, which now says the test suites' own
METAL2VULKAN_TEST_* variables are not in REGISTRY.
2026-11-23 20:27:07 -08:00
Anees Iqbal b4aeaab757 Tests: a partial-threadgroups variant may add DeviceReconvergence on a device without maximal reconvergence
The rt test every_device_s_observers_answer_the_same_on_their_variant failed on the UHD 630's
Windows leg (job 72531) after 1b9ea536f6: for the engine's a27_a4_simdgroup_barrier the variant
records DeviceReconvergence and the plain module none. The translator is right and the test was
wrong. The variant's invocations past the grid return before the body, and SPIR-V states
reconvergence over all invocations, those that returned included (SPIR-V 1.6 section 2.2.5,
"Dynamic Instance": "Invocations may only resume executing the same dynamic instances when all
invocations reach the same static instruction"; "Uniform Control Flow" and the merge-block rule
speak of all invocations too). SubgroupUniformControlFlowKHR extends the same rule to each
subgroup and adds nothing for a subgroup that holds a returned invocation. Only
SPV_KHR_maximal_reconvergence lets an invocation that ran OpReturn escape reconvergence. So
lower::simd::together's exclusion of partial threadgroups stays, and the variant takes the
profile's mode, or ImplementationDefined with the note where the profile has no maximal
reconvergence.

- The rt test now allows exactly that exception: on a device without maximal reconvergence the
  variant may add DeviceReconvergence where the plain module has none. Every other answer, and
  the notes on a device with maximal reconvergence, must still be equal. It prints how many
  kernels took the exception.
- A new translator test, a_simdgroup_barrier_s_variant_is_guaranteed_only_under_maximal_reconvergence,
  guards the rule on every committed profile. The plain module is Guaranteed with no note. The
  variant is the same where the profile has maximal reconvergence, and ImplementationDefined with
  the note where it does not (nvidia-pascal-linux, runtime-floor).
- docs/API.md (section 6 and the note's catalogue entry), the DeviceReconvergence and
  partial_threadgroups doc comments, and together()'s doc state the exception and its reason.

No module changes, so SEMANTICS_VERSION is not bumped.

Verified: the reproduction (job m3-max-72749) failed the old equality on nvidia-pascal-linux at
1b9ea536f6's tree, with variant (ImplementationDefined, true) against plain (Guaranteed, false),
and passed at its parent 0a1c4d4a64. The check job named in the hand-in covers fmt, clippy
(plain and under --cfg m2v_cpu_icd), Rustdoc, the metal2vulkan lib tests and rt's lavapipe suite.
2026-11-23 20:11:09 -08:00
Anees Iqbal 1b9ea536f6 Translator: a threadgroup barrier, and a kernel's group operation in uniform control flow, state the reconvergence mode only in a re-entered loop
A program's threadgroup barrier, and a kernel's tangled instruction in a block the workgroup
uniformity proves every thread of the threadgroup runs together, now count as fragreconv counts a
fragment's derivatives: an entry whose tangled instructions are all such (or a fragment's
derivatives) states no MaximallyReconvergesKHR (or SubgroupUniformControlFlowKHR), records
Reconvergence::Guaranteed and no DeviceReconvergence, except where its emitted module holds a
tangled instruction, itself or through a call, in the construct of a loop whose continue target
two or more blocks of the construct branch to; there it takes the profile's mode and note as
before. An entry whose every group operation stands in a block the pass proves uniform for the
threadgroup, with no re-entered loop around it, states no mode and records Guaranteed. An entry
with any other tangled instruction keeps the mode; a kernel compiled for partial threadgroups
proves no block uniform, and the emulated tier keeps its own rule.

Why: without a mode SPIR-V reconverges invocations at the merge of a construct they entered
together and all leave by it (2.2.5, Uniform Control Flow), and an OpControlBarrier of Workgroup
execution scope is defined where every invocation executes the same dynamic instance of it,
which invocations resume only under those conditions (2.2.5, Dynamic Instance). Metal requires
every thread of the threadgroup to reach a threadgroup barrier, and a group operation in a block
every thread runs together sees every lane, so both are Metal's wherever SPIR-V reconverges,
which is everywhere but a continue target entered from several blocks. On the 780M under AMDVLK
the mode with the group operations of one kernel family costs 9.4-11.4x RADV on its own command
buffers, and 2.8-3.0x without the mode (m3-max-72248, m3-max-72261).

How: BarrierPlan::threadgroup records every threadgroup barrier; simd::finish defers an entry
whose tangled instructions are all a fragment's derivatives, threadgroup barriers or a kernel's
instructions in workgroup-uniform blocks (simd::together: partly_live's uniformity, or the same
analysis where it computed none) to SimdPlan::reentry; lower::simd::reentry (quad_loop, renamed)
settles it on the emitted module, its re-entered-loop test now over every tangled instruction
(derivatives, implicit-LOD samples, LOD queries, control barriers, group operations). The emulated
tier clears the deferral where it clears the mode. The simd module doc, the PrecisionNote and
Reconvergence docs and docs/API.md's Precision sentence and catalogue entry say the same.
SEMANTICS_VERSION 2300.

Tests (src/tests/engine_reconvergence_together.rs): a threadgroup barrier alone states no mode on
every committed profile; one in a loop two latches inside a selection re-enter keeps the mode;
a shuffle in a counted loop states no mode; a shuffle after a merge inside a per-thread branch,
and one in a loop with a per-thread exit, keep it.
2026-11-23 17:10:25 -08:00