Commit Graph
2257 Commits
Author SHA1 Message Date
Anees Iqbal f4eb47d792 Validation: a play's gauges at frames 100 and 200 go out as the matrix's records, every kind on its end lines
What:
- The runtime backend's end lines (`Backend::live`) carry every count of an object kind the
  runtime keeps live: samplers, LOD clamp variants, level elements, kernel variants and entries,
  render contents, attachment views, descriptor slots, device samplers, shadows, resolve images,
  plane stand-ins, buffer set pools, surface buffers, indirect command buffers, releases waiting
  and handles out join them, and the pipeline cache's bytes.
- At the ends of frames 100 and 200 (GAUGE_FRAMES) the player reads them once they hold still
  (Backend::settled_live): the runtime backend reads them every 10 ms until no release waits and
  two reads in a row agree on every recorded kind, for at most 2 s, a wait no frame's time holds.
  What the program released goes on the runtime's block-maker and reaper threads after the work
  before it retired, so a read straight after the frame's waits could differ between two plays.
- command-replay prints, where the play ended frame 200 and skipped nothing by then,
  `M2V-MATRIX gauge replay-rt/STEM/GAUGE@100` and `@200` for each kind of GAUGED (gauge_records).
  scripts/matrix/results.py judges them as it judges the harness's: equal at 100 and 200, blocks
  no higher at 200.
- Left out, and why: handles_out (1 while the play holds the device), releases_waiting (lowered by
  the block-maker thread whenever it runs), private_units (a layout of memory that follows the
  bytes the program holds), and every byte and age gauge, which follows the program's content and
  the pool's idle clock: the pipeline cache's data (bound 128 MiB), the translator's entries'
  bytes (bound 64 MiB), the staging bytes, the pool's allocated, idle, reserved, reused, taken and
  block bytes, and the shadows', resolve images' and stand-ins' bytes, whose counts are recorded.

Why: the matrix's leak rule (live gauges per resource kind flat between iterations 100 and 200)
reached only the harness's compute workloads. The kinds only draws and passes make (render
contents, attachment views, shadows, resolve images, stand-ins, the samplers draws reach) had no
such check, and a play's end lines lacked 17 of the kinds.

Docs: REPLAY-STREAM.md section 10 (the end line's gauges, the settled read, the records),
VALIDATION.md's gauge row, command-replay's module doc.

Tests: replay::tests the_player_settles_the_gauges_at_frames_100_and_200_alone and
the_gauge_records_are_the_counted_kinds_at_frames_100_and_200; replay::rt_replay
the_end_lines_carry_every_gauge_the_gauge_records_carry (device); test_results.py
test_a_plays_gauges_at_frames_100_and_200_are_held_flat_as_the_harness_s.

Verified: in the hand-over.
2026-12-02 14:24:06 -08:00
Anees Iqbal fcdcffea07 Docs: REFUSALS.md regenerated after the slot-usage refusal met the word-bound draw
The draw now refuses a missing pipeline state at two sites, one from the word-bound content's
path (7a1da6cb22) and one from the slot-usage check (73bb5eb204); each branch regenerated the
table on its own base, so the landed tree counted one. Regenerated with
scripts/refusal-surface/refusal_surface.py; no code change.
2026-12-02 10:12:50 -08:00
Anees Iqbal c25a5b238a rt: a view made with a swizzle keeps its texture's usage at a slot, as its known gap rules
8811dd6790 checked a texture slot against the usage Metal answers, and answered a view made with a
swizzle as ShaderRead and PixelFormatView alone, so a kernel's write through such a view became
Refusal::TextureUsageAtSlot. That reversed the runtime's recorded known gap of swizzles (README,
Known gaps of textures: a view's descriptor reports its base texture's usage, so a draw into such
a view and a kernel's write through it run, the write stored unswizzled; docs/API.md's accepted
differences), on which OpenCL mode stands: Apple's OpenCL binds an image of most channel orders
as a swizzled view and writes it (tests/opencl_swizzles.rs, job m3-max-16336). The runtime suite
on lavapipe at b28f70e076 (job m3-max-78531) failed three tests on it:
opencl_mode_queries_of_a_swizzled_write_only_image_answer_the_view,
opencl_mode_writes_through_a_swizzled_image_store_the_value_as_written and
every_device_reads_through_a_view_s_swizzle_and_writes_past_it, each "the Kernel function uses
texture slot 0, whose texture's usage MTLTextureUsageShaderRead |
MTLTextureUsagePixelFormatView lacks what its access there asks".

The slot check now takes the texture's descriptor usage (TextureObject::metal_usage: Metal's
unknown usage as 0x17, a view's its texture's, a swizzled view's included). The known-gap text
and new_texture_view_with_swizzle's doc are as before 8811dd6790; the refusal's doc, the README's
Texture slots and usage and RESOURCE-ID.md say a view's usage is its texture's, a swizzled one
included. The slot_usage test's swizzled destination is now a case that runs and stores the
texel as written.

The same run failed every_device_gives_an_index_to_the_texture_placed_there_last, whose dispatch
wrote through A, a texture of ShaderRead usage alone, at sample_down's written slot: that is the
refusal Metal's validation gives, and the test's point is that A's placement empties D's storage
element. It now writes through D's ID, the same index, which D's ShaderWrite usage lets the slot
check pass, and D still keeps its texels.

Verified: cargo fmt; refusal_surface.py --check (REFUSALS.md unchanged). The suite run of this
commit follows as a job. The other 865 tests of job m3-max-78531 passed (3 skipped).
2026-12-02 10:12:04 -08:00
Anees Iqbal da03093c0c rt: TextureUsageAtSlot's basis quotes Metal's (t[0]) as code, which rustdoc read as a link
Rustdoc with -D warnings refused the basis line of Refusal::TextureUsageAtSlot: the quoted Metal
validation text "reads texture (t[0]) whose usage ..." holds t[0], which rustdoc reads as an
intra-doc link to an item named 0 ("unresolved link to `0`", error.rs, three times, in both the
public and the private-items build). The three t[0] are now code spans and the lines reflowed
under 100 columns; REFUSALS.md regenerated (the row's text; basis.rs is unchanged).

Verified: the failure is job m3-max-78486's rustdoc steps (doc and privdoc EXIT=101; fmt, clippy
over the workspace and under --cfg m2v_cpu_icd and --cfg m2v_gpu, refusal_surface --check and
the signatures check passed there). Here: cargo fmt and refusal_surface.py --check; the rustdoc
run of this commit follows as a job.
2026-12-02 10:12:04 -08:00
Anees Iqbal 73bb5eb204 rt: a dispatch or draw whose texture lacks the usage its slot's access asks is TextureUsageAtSlot
A function's texture slot bound to a texture whose usage lacks what the function's access there
asks reached no element of the texture's and ran: it read element 0 of set 1 (nil's null
descriptor) or a null element as zeros and dropped its writes, with no refusal and no count. The
textures: one no shader reaches (no index: a Depth32Float target of RenderTarget usage alone, a
texture of PixelFormatView usage alone), a colour target of RenderTarget usage alone (null
elements), a texture not made for shader writes at a written slot (no storage element), and a
view made with a swizzle at a written slot (written unswizzled, where plain Metal writes through
the swizzle).

Each dispatch and draw now checks, once after the pipeline state or a binding changes and before
it records anything, each texture its functions' slots reach against the usage Metal's validation
asks by the access the function declares there (pipeline::slot_usage): ShaderRead for a sample or
read slot, a size query alone included; ShaderWrite for a write or read_write slot; both for a
read_write slot it reads. The texture's usage is Metal's answer (TextureObject::metal_usage):
the descriptor's, Metal's unknown usage as 0x17, and a texture reading through a swizzle other
than the identity ShaderRead and PixelFormatView alone. A texture short of it refuses the command,
Refusal::TextureUsageAtSlot { stage, index, usage }, binding and recording nothing. The binds take
every texture, as Metal's do. Gap::SwizzledReadWrite stays checked first for a read_write slot it
reads. The check reads facts the interface and the texture already hold; nothing runs per draw.

Basis (the previous commit's measurement, an Apple M3 Max, macOS 27.0.1, jobs m3-max-78392 and
m3-max-78422): plain Metal reads and writes the texels; Metal's validation asserts "Compute
Function(k_read): reads texture (t[0]) whose usage (0x04) doesn't specify
MTLTextureUsageShaderRead (0x01)", "writes texture (t[0]) whose usage (0x01) doesn't specify
MTLTextureUsageShaderWrite (0x02)" (an access::write argument asked only its width included), and
"Fragment Function(f_first): Shader reads texture (t[0]) whose usage (0x04) doesn't specify
MTLTextureUsageShaderRead (0x01)".

Docs: REFUSALS.md regenerated (the refusal's site); the runtime README's Textures section states
the rule (Texture slots and usage) and its compute encoder, render encoder and swizzle entries
name the refusal; RESOURCE-ID.md's sentence that a slot binding a colour target of neither usage
reads nil now says what a runtime refuses; the doc comments of set_texture, set_vertex_texture,
dispatch_threadgroups, draw_primitives, gpu_resource_id and new_texture_view_with_swizzle name it.

The test literals of the kernel interface and of a content's draws (tests/compute.rs,
tests/indirect.rs) take the new field.

Verified: cargo fmt. The red and green runs, clippy and the runtime suite on lavapipe follow as
jobs.
2026-12-02 10:12:04 -08:00
Anees Iqbal 9ad296c6cd rt: Refusal::TextureUsageAtSlot, and a test of slots whose texture lacks the usage they ask (red)
A texture slot a function uses, bound to a texture whose usage lacks what the function's access
there asks, reaches no element of the texture's, and nothing refuses it: the slot reads element 0
of set 1 (nil's null descriptor) as zeros and its writes are dropped. A texture no shader reaches
(a Depth32Float target of RenderTarget usage alone, a texture of PixelFormatView usage alone) has
no index; a colour target of RenderTarget usage alone has an index whose elements are null; a
texture not made for shader writes has no storage element. This is the index-free direct bind of
the consumer's row 194 that is still open after f3bb94275b, which refuses the bind of a texture
reached through its views alone.

Metal binds such a texture and its validation stops the command that uses the slot, by the
argument's declared access; plain Metal reads and writes the texels. Measured on an Apple M3 Max,
macOS 27.0.1 (jobs m3-max-78392 and m3-max-78422, runtime-compiled MSL):
- setTexture:atIndex: binds every such texture, under the validation layer too;
- the validation layer asserts at the dispatch "Compute Function(k_read): reads texture (t[0])
  whose usage (0x04) doesn't specify MTLTextureUsageShaderRead (0x01)" for a sample, a read or a
  get_width alone of an access::read or access::sample argument; "writes texture (t[0]) whose
  usage (0x01) doesn't specify MTLTextureUsageShaderWrite (0x02)" for an access::write argument,
  its get_width alone included; both for access::read_write; and at the draw "Fragment
  Function(f_first): Shader reads texture (t[0]) whose usage (0x04) doesn't specify
  MTLTextureUsageShaderRead (0x01)", the pass's own attachment included;
- Metal's unknown usage answers 0x17 and passes every access; a view's usage is its texture's
  (0x14, 0x11); a view made with a swizzle answers 0x11 (ShaderRead | PixelFormatView) of a
  texture of 0x13 and of one of unknown usage, and a write of it asserts;
- with the layer off, plain Metal reads the depth (0.75), the texels (64, 128, 192, 255) and the
  width (4) in every case, and writes a swizzled view through its swizzle.

This commit adds the refusal a dispatch or draw will return (stage, slot index, the texture's
usage as Metal answers it), its basis line, REFUSALS.md, basis.rs and the signature table, and the
device test slot_usage: sample_down (slot 0 sampled, slot 1 written and its size asked),
depth_fill_read and first_texel_fragment over textures of each usage. Its controls (read and
write usage, unknown usage, a view of a read texture, a read depth) run with their texels; a
render-target colour source, a read-only destination, a swizzled view's destination, a
render-target depth with no index and a PixelFormatView-only texture with no index expect the
refusal and their bytes kept. The commands do not refuse yet, so the test is red here: they run
and read zeros (or drop or unswizzle the write). The next commit makes them refuse.

Verified: cargo fmt; the red run is the next commit's job.
2026-12-02 10:12:04 -08:00
Anees Iqbal 15e53e4209 Translator: the emulated simdgroup tier takes the partial-threadgroups variant
select.rs refused a kernel's partial-threadgroups variant in the
Emulated tier (Unsupported{PartialThreadgroups}), which the runtime
reports for a ragged grid as Gap::PartialThreadgroups{Translator}. The
tier is lavapipe's for every SIMD-group kernel (its compute subgroups
are below 32), Intel's for a large kernel the widest-pin rule sends
there, and the emulated variant's on every device.

The variant now walks the tier's synchronizations as the subgroup tiers
walk their barriers. workgroup::check plans the predicated walk for a
kernel of partial threadgroups with any of the tier's synchronizations
(an exchange or a threadgroup barrier), with Predication::partial_groups
set, so emit_entry starts `live` from Metal's threads (lin < n) and the
invocations past them reach each exchange's barriers never live, storing
nothing. The exchanges take Metal's thread count as the threadgroup's
N: KernelDecl::live also answers that count, emit_entry keeps it as
EmitCx::entry_threads, and Emu::n is it in place of the local-size
constant. Every existing rule below N then answers Metal's partial
threadgroup: a read of a lane past it reads the calling lane, folds,
votes, ballots and quad masks take only the lanes below it. The scratch
stays sized from the local size, so every invocation has its slot.

Docs: LoweringInputs::partial_threadgroups, the divergent and workgroup
module docs, PartialThreadgroupsSite::Translator, the runtime README's
partial-threadgroups gap, and docs/REFUSALS.md regenerated.
SEMANTICS_VERSION 2316 -> 2317.
2026-12-02 09:56:19 -08:00
Anees Iqbal 7a1da6cb22 rt: a draw through buffers bound at a multiple of 4 below their alignment draws the state's word-bound content
Row L97 (the draw residual). A dispatch of a function's kernel whose buffer
argument of 8 or 16 is bound at a multiple of 4 below that alignment runs a
variant of its kernel that holds the slot to 4 (8 where a 64-bit atomic may
reach it). A draw refused such a bind (Refusal::BufferOffsetAlignment). It
now draws the same way.

- RenderPipelineState::for_words(device, words) makes the state's content
  with LoweringInputs::word_bound_buffers set for its vertex function (bits
  0..31) and fragment function (bits 32..63). The device's map of contents
  keeps it under the state's key with that mask (KernelKey.words widens to
  u64). Like a pass's 2D-array content, it has no cache record of its own.
  Its samplers are numbered at the state's indices; a mismatch is
  Gap::KernelInput (ConstexprSampler).
- RenderCommandEncoder keeps the state set (`base`) apart from the state it
  draws through (`pipeline`). Where a draw's facts are not held (a bind or
  the state changed), bind_words reads the base's buffer address fields. A
  slot of mask 7 or 15 whose bound address is a multiple of 4 but not of
  its alignment sets its bit. The mask is ANDed with the slots the state
  lowers from AIR (word_slots: a function the consumer compiled has none,
  and its bind stays refused). A new mask switches `pipeline` to that
  content, or back to `base`. An execution of an indirect command buffer
  draws through `base`.
- The draw's own checks then hold each slot to the content's alignment: an
  address off a multiple of 4 is still refused, as is one off 8 that a
  64-bit atomic may reach.

Cost: a draw bound aligned keeps the state it was set with, and the scan of
its address fields runs only where the draw's facts are found again
(expected from the code, not measured). The first draw of a new mask lowers
both functions again and makes the content's VkPipeline (a first-use wait),
as the compute variant does. A later draw of that mask finds the content.

Docs: the runtime README (Render encoders: the draw bullet; Compute
encoders: the variant's paragraph); error.rs's BufferOffsetAlignment;
docs/API.md section 1 and its accepted differences. REFUSALS.md unchanged
(refusal_surface --check 0); api signatures --check 0.

Verified:
- Green on lavapipe, m3-max-79015 (at this commit's tree before its rebase
  onto 8dd00ec58c). Over tests::draw, render_offsets and indirect: 67 of 67
  passed, 838 skipped. The new test draws every case through the content,
  and the second draw of a bind finds it.
- The two draw-alignment tests on a card per vendor, 2 of 2 passed on each:
  - Radeon 780M (RADV PHOENIX, Mesa 26.2.6), m3-max-79076, at this commit;
  - RTX 3090 (NVIDIA 620.70.06), m3-max-79043, and Iris Xe (ANV, Mesa
    26.2.6), m3-max-79051, both before the rebase.
- m3-max-79086, at this commit: workspace clippy (all targets, all
  features, -D warnings) EXIT=0 in all three configurations (plain,
  --cfg m2v_cpu_icd, --cfg m2v_gpu); Rustdoc EXIT=0; the runtime's private
  Rustdoc EXIT=0. The runtime suite on lavapipe: 903 tests run, 903 passed,
  3 skipped.
2026-12-02 09:30:59 -08:00
Anees Iqbal 212d7b2d8e rt: blit copies whose rows meet go a row at a time where no one axis orders them, and a surface's plane lies in its buffer
Row L212. Metal leaves overlapping copies undefined; an Apple M3 Max reads the
source whole before it writes, which the runtime gives as slabs, and no Vulkan
copy command may read bytes it writes (VUID-vkCmdCopyImage-pRegions-00124,
VUID-vkCmdCopyBufferToImage-pRegions-00173,
VUID-vkCmdCopyImageToBuffer-pRegions-00184).

Form (blit.rs):
- Slabs becomes an enum: Across (the existing single-axis cut) and Rows
  (RowSlabs). Where cut() finds no axis, row_by_row() takes the rows one at a
  time. Each row goes before every row whose source its destination lies on:
  descending where every destination row lies on a source row after its own
  (meeting()'s y shifts all positive), ascending where all are negative.
- Within a row, the shift from the destination row to its own source row
  (the first row's, plus the pitch difference per row) decides the cut. Zero:
  the row is its own bytes and copies nothing. Less than the row: slabs of
  |shift| in whole texels, the far end first. Otherwise: one command.
- Slabs::of yields each slab's 3D start, which ImageCopy::regions and
  BufferCopy::slabs add to the other side's origin and to the buffer offset.
- An execution barrier still separates two commands. Every hazard between
  them is a write after a read, as no row reads bytes an earlier row wrote.
- Still refused (Gap::OverlappingCopy): rows of two pitches that cross, where
  one destination row lies on a source row before its own and another on one
  after its own.

Surface (texture.rs, buffer.rs, surface.rs, d3d11.rs):
- An exported surface's plane image keeps its PlaneLayout (Under::Surface
  laid, from SurfaceImage).
- TextureObject::rows_in(buffer) answers the plane's rows in a buffer on the
  surface's memory: BufferObject::surface_range matches the buffer's block
  aliases to the plane's (Arc::ptr_eq) and maps the plane's offset through the
  block's memory range.
- A copy between a buffer and a texture takes those rows where the texture
  has none of its own. A texture over the surface's buffer is always the copied
  form (OverCause::Surface), so a copy between it and a plane shares no bytes
  in Vulkan, and is left as it was.
- The surface's buffer and planes are aliases that read alike in the general
  layout. Surface::buffer's doc quotes the section.

Docs:
- blit.rs and the copy methods' docs; error.rs's OverlappingCopy (REFUSALS.md
  regenerated).
- The runtime README: Blit encoders, their known gaps (only crossing pitches
  remain refused), and the surface's buffer.

Verified:
- Green, on lavapipe, m3-max-78902 (at 70c887a155, before the rebase): the
  blit module, 26 of 26 passed (865 skipped). The plane is in place
  (OpaqueFd); into it and out of it go a row at a time.
- Cards, the blit module at 02421a08a9, 26 of 26 passed (867 skipped) on each.
  That tree differs from this one only by a branch for a texture in place over
  a surface's buffer, now deleted: no device laid one in place, and each
  printed "copied".
  - Radeon 780M (RADV, Mesa 26.2.6), m3-max-78888.
  - Iris Xe (ANV, Mesa 26.2.6), m3-max-78889.
  - RTX 3090 (NVIDIA 620.70.06), m3-max-78896.
  On each, the textures over one buffer are in place: whole rows go a row at a
  time (16 slabs; 256 on the Iris, whose memory alignment is 4), and two
  pitches go a row at a time. The surface's plane is in place (OpaqueFd), into
  it and out of it a row at a time.
- m3-max-78906 at 70c887a155: workspace clippy (all targets, all features,
  -D warnings) EXIT=0 in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu). Rustdoc and the runtime's private Rustdoc EXIT=0. The
  runtime suite on lavapipe: 888 tests run, 888 passed, 3 skipped.
- refusal_surface.py --check: 0 at this commit.
2026-12-02 08:42:26 -08:00
Anees Iqbal 9c375eb504 Conformance ledger: the sample-positions cases answer on the runtime, so their seventeen refused rows go
The rt side of the suite now hands a pass's positions to the runtime's RenderPassDescriptor
instead of answering `setSamplePositions:count:` Unavailable, so the answer those rows expect,
`Err(Unavailable({call: "setSamplePositions:count:"}))`, can no longer occur on any venue. The
fourteen `*` rows (custom-left, custom-mixed, custom-right, the three fewer-, high, off-grid,
off-grid-low and the five rounded- cases) and the three venue rows of sample-positions-custom-2x
(Iris(R) Xe, RADV, NVIDIA) are dropped. A venue without VK_EXT_sample_locations, or whose
properties fall short of the answer, would answer at the same site with
`Refusal::SamplePositions` of `Unsupported` or `Gap::RenderPass`, which its replay would print as
unlisted; no venue run here does. docs/CONFORMANCE-COVERAGE.md is regenerated (7979 ledger rows to
7962); docs/METAL-COVERAGE.md is unchanged.

Verified: `conformance replay` of the 19 sample-positions cases and pass-sample-positions at
33865b2a57, before this edit, on each venue: every one of them listed exactly these rows as no
longer held ("now matches: 15", 14 on the Apple M3 Max, which has no custom-2x row) and nothing
unlisted; the custom and rounded cases read announced (justified by notices) on each.
- RX 7900 XTX, RADV NAVI31, Mesa 26.2.6: m3-max-78702
- Radeon 780M, RADV PHOENIX, Mesa 26.2.6: m3-max-78710
- RX 550, RADV POLARIS12, Mesa 26.2.6: m3-max-78713
- RTX 2080, NVIDIA 620.70.06: m3-max-78703
- RTX 3090, NVIDIA 620.70.06: m3-max-78711
- Iris Xe (RPL-P), Mesa 26.2.6: m3-max-78704
- Apple M3 Max, KosmicKrisp Mesa 26.3.1 (VK_EXT_sample_locations revision 1): m3-max-78722
lavapipe's replay with this ledger runs in the green job. Not run: the RTX 5080 Laptop GPU and the
Windows host's UHD Graphics 630.
2026-12-02 08:39:11 -08:00
Anees Iqbal 1c307b4608 Runtime: a pass rasterizes at the sample positions its descriptor sets, through VK_EXT_sample_locations
L168: a pass's custom sample positions were dropped while the guest could be told they are
supported, so a non-default set rendered at the standard positions with no refusal.

What changed:
- VK_EXT_sample_locations joins the floor's OPTIONAL_EXTENSIONS (enabled where listed; it has no
  feature). Device::programmable_sample_positions_supported (programmableSamplePositionsSupported)
  is true where the device lists it with locations at every sample count above 1 it renders, a
  1 x 1 grid, every sixteenth from 0 to 15/16 and variableSampleLocations; false elsewhere. No
  second form: a device that answers no refuses positions other than the defaults.
- RenderPassDescriptor::sample_positions is checked as the pass begins (crate::positions): each
  coordinate is taken to the nearest sixteenth, a tie up, at most 15/16, and each sample past the
  positions given at the pixel's corner, as the conformance suite's sample_positions rows measured
  an Apple M4. A set that comes to Vulkan's standard locations (Metal's defaults at 1, 2 and 4
  samples) rasterizes as an empty one on every device.
- Refusal::SamplePositions (Count, Coordinate, OneSample, Unsupported) where Metal's validation
  stops the descriptor or the device answers no. Gap::RenderPass of SamplePositions for other
  positions beside a depth attachment (Vulkan needs a sample-locations-compatible depth image whose
  layout transitions name the last locations) or at a count the device's locations lack.
  Gap::Draw of SamplePositions for a draw in such a pass whose fragment module uses
  InterpolateAtSample (VUID-01524), read from the translator's GraphicsState.
- A draw in such a pass takes a VkPipeline of its class made with sampleLocationsEnable and the
  locations as dynamic state (Raster::positions), one pipeline for every set; the encoder records
  vkCmdSetSampleLocationsEXT before the pass's first draw. Every coordinate handed to Vulkan is a
  sixteenth in [0, 15/16], which Vulkan's required 4 sub-pixel bits hold exactly, so no precision
  note.
- The translator's description of a device that enables the extension states it
  (floor::shader_extension), as for every extension creation enables that the translator names;
  the translator reads none of its properties. tests::translator_fields gives
  GraphicsState::interpolates_at_sample its verdict (refused at custom positions).
- The conformance rt side passes a case's positions to the runtime; the replay player sets them on
  the runtime's descriptor and drops its count of passes at other positions (docs/REPLAY-STREAM.md
  says so).
- README (floor table, the device's answers, the known gap rewritten), REFUSALS.md and basis.rs,
  api_signatures.tsv, METAL-COVERAGE.md and CONFORMANCE-COVERAGE.md regenerated.

Tests: the device test every_device_rasterizes_a_pass_at_its_sample_positions now gates on the
device's answer and holds the answer to the extension's properties; new device tests
every_device_refuses_the_positions_metal_refuses and
a_draw_that_interpolates_at_a_sample_is_refused_at_custom_positions; new device-free tests
(placed::) of the answer's gates (each count above 1 the device renders in
sampleLocationSampleCounts, a 1 x 1 grid, a range holding 15/16, 4 sub-pixel bits, variable
locations) and of the placement (every coordinate in [0, 1) on a sixteenth from 0 to 15/16,
refusals, the corner, the standard sets, the count and depth gaps); the replay device test
sample_positions_play_through_the_runtime_s_descriptor. Verification: the lane's jobs, named in
the ledger commit that follows.
2026-12-02 08:39:10 -08:00
Anees Iqbal 6750442c22 rt: a draw reads its target over a buffer in place through the feedback loop, or through its shadow
Row L291: a texture over a buffer laid in place (a linear image on the
buffer's memory, rule 3's form) took neither the feedback usage nor a shadow,
so a draw that read it as an attachment of its own pass, through a texture or
by a fetch, was Gap::Draw (AttachmentRead, FetchedAttachment) on every device.
Metal reads any render target this way.

Form (the ruled one: rule 2's attachment feedback loop form, with the counted
shadow copy where it is not available, a known gap):
- Plan::linear_loop. check_over sets it where the plan reads attachments, the
  device has the feedback loop, the format's linear tiling features sample it,
  and the linear image query makes the image with the sampled and feedback
  usages at the texture's extent (asked with the dma-buf handle for a dma-buf's
  import). Plan::linear_usage then adds both usages.
- If the linear image with those usages does not lie as the texture's bytes do
  (Unmade::Unfit), it is made again in place without them, and a draw reads it
  through its shadow where the device makes one (Plan::shadow_offered), as a
  device without the loop does. Only after that does a texture fall back to the
  copied form, as before.
- The pass moves the image from the general layout to the feedback layout and
  back, through the same moves a surface plane takes. Once it is back in
  general, the image and the buffer are again aliases that read their bytes
  alike. vkspec, memory aliasing: "Buffers, linear tensors, and linear image
  subresources are considered host-accessible subresources when they are in
  any of these layouts: VK_IMAGE_LAYOUT_PREINITIALIZED, VK_IMAGE_LAYOUT_GENERAL,
  VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT" and "If two aliases are both
  host-accessible, then they interpret the contents of the memory in
  consistent ways, and data written to one alias can be read by the other
  alias."

Docs: the runtime README says where the image leaves the general layout
(Memory blocks and buffers) and how a draw reads it (Render encoders). Its
known gaps of render encoders gain the shadow for an in-place target whose
linear image takes no feedback usage, and drop the refusal. error.rs's
AttachmentRead doc is updated, and REFUSALS.md is regenerated (unchanged).
known-gaps-rt.tsv drops the 15 rows the change fixes, each of which the replay
printed as "the gap looks fixed" once the draw read its target in place:
- pass-start-barrier-over-buffer-{read, sample, barrier-read, barrier-sample,
  draw-barrier-read} on llvmpipe and the Iris Xe (10 rows): their targets are
  in place on these two, and the reading draw was refused; it now reads its
  target in place. The 780M, the RX 7900 XTX and the RX 550 had no rows for
  these cases; their replays report "differed, justified" (the case's
  accepted difference).
- pass-start-barrier-new-texture-chain on llvmpipe, the Iris Xe, the 780M, the
  RX 7900 XTX and the RX 550 (5 rows): its new texture over a buffer is in
  place on all five (the refusal arose only there), and its reading draw was
  refused the same way; it now reads its target in place.
CONFORMANCE-COVERAGE.md is regenerated.

Verified:
- Green, on lavapipe, m3-max-78715 (at 60d2af3017, this change before the
  ledger and layouts edits): 12 of 12 passed (876 skipped). Both forms read
  in place through the feedback loop.
- Cards, at 921a33a894, running over_reads, fetch-over and the layouts
  in-place test, 3 of 3 passed on each:
  - Radeon 780M (RADV, Mesa 26.2.6), m3-max-78784: in place, through the loop.
  - Iris Xe (ANV, Mesa 26.2.6), m3-max-78819: in place, through the loop.
  - RTX 3090 (NVIDIA 620.70.06), m3-max-78785: its linear tiling lays these
    targets in the copied form, so the in-place path did not run there.
  - The shadow form for an in-place target (a linear query that refuses the
    feedback usage) ran on no lab device: unaudited.
- Conformance replay (the case selection, or every case for lavapipe) with
  the 15 rows dropped, EXIT=0 with no surprise either way:
  - llvmpipe, m3-max-78743 (at 580fecacb7, every case);
  - RX 7900 XTX, m3-max-78749; RX 550, m3-max-78750; Radeon 780M,
    m3-max-78751; Iris Xe, m3-max-78760 (each at f9f3178302).
  The trees differ from 921a33a894 only in other venues' rows and the
  layouts test.
- m3-max-78783 at 921a33a894: workspace clippy (all targets, all features,
  -D warnings) EXIT=0 in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu); Rustdoc EXIT=0. The runtime suite on lavapipe: 885 tests
  run, 885 passed, 3 skipped.
- m3-max-78757 at f9f3178302: private Rustdoc of the runtime EXIT=0. The
  conformance crate's suite: 1047 of 1047 passed, 0 skipped.
2026-12-02 08:22:01 -08:00
Anees Iqbal 5d6ac696d0 Runtime and translator: a framebuffer fetch from the first slice of a 2D array that its pass renders alone
Row L223: a fragment function's fetch ([[color(n)]]) of a one-slice 2D array
attachment of a layered pass was refused (Gap::Draw FetchedAttachment), where
Metal reads the attachment at the fragment's pixel. The fetch reads the
texture's second element, which for a 2D array texture holds a 2D_ARRAY view.
Vulkan reads such a view only through an arrayed image (vkspec, image view
validation). The function read every element as a 2D image.

Form (ruled B, the per-state variant, as L97's compute variant):
- Translator: LoweringInputs::arrayed_fetches names the colours read through
  such an element. The fragment function declares that element's class arrayed
  and fetches it at (x, y, 0). The key takes the field only when it is set,
  so every existing function keeps its key and its bytes. No SEMANTICS bump.
- Runtime: set_render_pipeline_state binds, for a pass whose fetched attachment
  is a 2D array texture (a multisample one too), the state's content lowered
  with those colours (RenderPipelineState::for_pass, which also makes the
  content without colours past the pass's last attachment, as before). The
  content is kept in the device's bounded map of contents under the
  descriptor's key and its colour mask (KernelKey::arrays). The cache
  directory's render record is neither read nor kept for it. A failed variant
  leaves the state itself, whose fetching draws are then refused.
- attachment_reads accepts a 2D array texture whose first level and slice the
  pass renders, one layer, where the bound content fetches that colour
  arrayed.

Still refused (README, error.rs): an array whose pass renders more than one
layer, a slice past an array's first, and a view whose first slice is not the
rendered one.

REFUSALS.md and the api_signatures table are regenerated (the new
LoweringInputs field). API.md and the runtime README are updated.

Verified:
- Red, lavapipe, m3-max-78542: the test commit alone fails at fetch.rs:396
  (FetchedAttachment): 10 tests run, 9 passed, 1 failed.
- Green, lavapipe, m3-max-78570: 45 of 45 passed (832 skipped); the one-slice
  array is fetched exactly through the feedback loop.
- Radeon 780M (RADV), m3-max-78604; RTX 3090 (NVIDIA 620.70.06), m3-max-78609;
  Iris Xe (ANV, Mesa 26.2.6), m3-max-78649: the fetch and unattached-colour
  tests, 6 of 6 each, the array fetched exactly through the feedback loop.
- States-only play, m3-max-78602, lavapipe, this change against 118bd0dff7:
  identical on both replay streams (one recorded on the 3090: 10643 render and
  15299 compute states made; one on the 780M: 8972 and 225), 0 refused.
- m3-max-78600 (at the pre-rebase 90726b13b7): clippy, Rustdoc and private
  Rustdoc EXIT 0; runtime 874 of 874 passed (3 skipped), translator 3393 of
  3393 (37 skipped).
- Workspace clippy in all three configurations (plain, --cfg m2v_cpu_icd,
  --cfg m2v_gpu; all targets, all features, -D warnings): m3-max-78645 at
  this change alone on development, and m3-max-78677 at this tree on top of
  the row-1166 tests. Every EXIT=0.
2026-12-02 07:52:24 -08:00
Anees Iqbal 2f16658ac2 Translator, runtime: an OpenCL-mode kernel's 1D images read their 2D textures under the identity domains
L61. A kernel of OpenCL mode that takes a 1D image stated RuntimeFact::OpenClLineTexture for each
such slot. That fact marks the variant in which the table domains read a 1D texture bound there,
as a Radeon Pro 5300M answers. The identity domains source no such fact, so every such kernel's
pipeline was Unsupported{IdentityDomains} when made, whatever else it did.

Apple's OpenCL binds a 2D texture of height 1 for an image1d_t and a 2D array of that height for an
image1d_array_t, and never a 1D texture. The kernel already reads its 1D images as those 2D textures
at row 0 (canon::opencl_1d), as the M3 Max and the 5300M answer. A 1D texture bound there is
outside documented Metal, and the Macs disagree on it: the M3 Max reads texel 0 at every
coordinate, the 5300M the 1D texture's texels, a UHD Graphics 630 layer 0 of an array.

- Translator: under the identity domains a kernel states no OpenClLineTexture and has no such
  variant; it reads the 2D textures. The table domains keep the fact and the variant.
  identity_unsourced no longer names a fact the identity domains never state.
- Runtime: a state records whether its kernel is of OpenCL mode (RuntimeFact::OpenClMode). A
  dispatch of one with a 1D or 1D array texture bound at any of its texture slots is the new
  typed Gap::OpenClLineTexture { slot }, not a read: Apple's OpenCL binds none, and Metal defines
  no reading of one. It is checked where the swizzle and bicubic checks run, when the state or a
  binding changes. Its doc ends in "Basis: ours".
- Docs: the runtime README's known gap is rewritten for the dispatch's refusal. API.md and the
  fact's doc say what the identity domains do. docs/REFUSALS.md and error/basis.rs are regenerated
  (Gap 30 to 31), and api_signatures.tsv is blessed (one variant).
- The runtime test opencl_lines now also binds a 1D texture at each of the kernel's three slots in
  turn. Each dispatch answers Gap::OpenClLineTexture naming that slot and writes nothing.

A refusal becomes a module, so SEMANTICS_VERSION 2316. The translator's refusal sites are
unchanged.
2026-12-02 07:25:18 -08:00
Anees Iqbal 5806b10c13 Translator: a sampled cube read by face samples its cube element under the identity domains
L215 (a). A texturecube or texturecube_array read by face was declared as the binder's 2D-array
view of its faces (RuntimeFact::ImageViewShape), since SPIR-V's OpImageFetch takes no cube. The
identity domains hold a sampled cube's element as its cube view and source no such fact, so
every such read was Unsupported{IdentityDomains}.

Under the identity domains a sampled cube (not a depth cube) that is read is now declared as its
cube element, and the read samples it. It goes through element 0 of its numeric type's sampler
array (binding 2, or 4 for an integer texture), which no ID reaches: the default sampler. It
samples at the direction of the read texel's centre on its face, with the read's level as the
explicit Lod.
- On face f the centre is (sc, tc) = ((2x + 1 - w) / w, (2y + 1 - h) / h), whose numerator is an
  exact integer.
- The direction is Vulkan's cube map face selection read backwards, the table Metal's faces share.
  With m the face's sign, it is (m, -tc, -m*sc), (sc, m, m*tc) or (m*sc, -tc, m).
- Its major axis is the face's, at magnitude 1, so (s, t) on that face is the texel's centre, half
  a texel inside its cell, and nearest reads that texel. Integer Lod l under nearest mip selects
  level l.
- A sample clamps every operand, so the read is checked in the shader on every device
  (ReadCheck::Shader). x and y are tested against the extent at the level, the face against 6, the
  cube index against the cube count, and the level against the level count, with Metal's
  out-of-bounds texel outside (its alpha from the ID's word).
- slot::samples_cube_element is the one rule the declaration and the read's check share.
  SlotPlan::face_sampler gives the sampler use the sampler family declares.
- A depth cube read by face, and a cube whose faces an emulated filter fetches, keep the 2D-array
  view and stay refused under the identity domains. The table domains are unchanged.

The runtime's default samplers now reach every level (maxLod VK_LOD_CLAMP_NONE, was 0), so an
explicit level past 0 reads that level. A sampler element nobody owns holds the default, as do
nil, freed and out-of-range sampler IDs. Their samples could reach only level 0 before; they now
reach the level they ask for.
Existing tests that cover the default samplers:
- tests::arrays' set_1_is_filled_at_creation (both live with set 1);
- tests::device's gauge check (set 1's two default samplers and nothing else);
- tests::argument_sampling's argument_sampler_edges (an argument buffer's sampler against the
  default's answer).
RESOURCE-ID.md states the default sampler and the cube read's contract for a consumer that lays
the arrays out itself. API.md and the runtime README say so too; the README's known gap now names
only the depth cube read.

A refusal becomes a module, so SEMANTICS_VERSION 2315. The golden table's cube_faces cells
change from the refusal, a bless at the next pin. No refusal site was added or removed:
docs/REFUSALS.md regenerates unchanged.
2026-12-02 07:25:18 -08:00
Anees Iqbal a3cfe0be7c rt: a pool allocation the device places off a multiple of 16 is refused as Limit::AllocationAddress
What: make_allocation reads the allocation's device address and, where it is not a multiple of
16, frees the allocation and returns the new Limit::AllocationAddress { class, address }. A take
that no free range fits returns it; an allocation made ahead of need (Device::new's stock, the
block-maker thread) is not kept, so the next take makes its own and gets the refusal.

Why: Vulkan places a buffer's address at a multiple of the largest of its memory requirements'
alignment and its usages' minimum offset alignments (vkGetBufferDeviceAddress), none of which has
a lower bound of 16. Metal's offset rule for a device buffer (offset aligned to the data type's
size, at most 16) asks a base at a multiple of 16, which the translator's accesses take. A block's
buffers take the allocation's address as their base and its images sit beside them in the same
allocation, so no offset serves both; an allocation off 16 cannot keep Metal's alignment, and it
now fails visibly instead of handing out blocks the translated kernels misread (L84).

Docs: the variant's doc names Metal's counterpart and what differs; take_block's errors; the
runtime README's block contract; docs/REFUSALS.md, src/error/basis.rs (Basis: device) and
api_signatures.tsv regenerated (refusal_surface.py, signatures.py --bless).

Verified: the test every_device_hands_out_no_block_at_an_address_off_16 (red at the previous
commit) is the check; jobs in the hand-over.
2026-12-02 06:51:00 -08:00
Anees Iqbal edee7b22ec Replay: the stand-in makes no import Vulkan forbids: no dedicated opaque fd import, no memory type its buffer lacks
The audit lane read the stand-in cold (standin.rs:262, 288-290 at cc3188c3da):
- An opaque fd's import named the stand-in's buffer in VkMemoryDedicatedAllocateInfo wherever the
  driver keeps that buffer to a dedicated allocation. Such an import must name a buffer identical
  to the exporter's (VUID-VkMemoryDedicatedAllocateInfo-buffer-01879), and the runtime's export is
  dedicated to its own buffer, of other usage, whose create info the export does not give. That
  case is now an import the stand-in cannot make, counted with that reason; an opaque fd's import
  is dedicated to no buffer.
- The import bound memory of the export's type without checking that the stand-in's buffer lists
  it (VUID-vkBindBufferMemory-memory-01035). A type the buffer does not list is now an import
  failure with that reason, before the allocation.
docs/REPLAY-STREAM.md section 10 says both.
2026-12-02 05:39:50 -08:00
Anees Iqbal 23847fe2ae Runtime: a pass that mixes a marked surface plane with another attachment renders it through a stand-in
A surface plane in place whose format's LINEAR tiling renders only through
VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV (VK_NV_linear_color_attachment: such a
format renders "as long as all the color attachments in the render pass instance have
VK_IMAGE_TILING_LINEAR tiling") was refused in any pass that set something beside it,
Gap::LinearPlanePass. A guest met it: a view of an exported 1920x1080 surface's R8 luma plane as
colour 0 beside an ordinary RG8 texture as colour 1, both loaded and stored. Red on the RTX 5080
Laptop GPU (job m3-max-78092) and the RTX 3090 (job m3-max-78106, NVIDIA 620.70.06).

The planner's ruling, form (ii): in a pass that mixes a marked plane with another attachment (a
colour attachment that is not one, a depth or stencil attachment, or a multisample attachment
resolving into it; decided by the format query's mark and the pass's attachments alone,
pass::mixes_linear), each marked colour attachment and each marked resolve target renders into
its stand-in, an optimal image of the runtime's of the plane's format and size
(TextureObject::stand_in). The pass's begin moves the stand-in from undefined and, where the
plane's Vulkan load op is LOAD, copies the render area of the plane into it; its end copies the
stand-in's render area into the plane where its store op is STORE or the pass resolves into it.
The plane stays general. A pass of marked planes alone still renders them in place; a device
whose LINEAR tiling offers the format as a colour attachment renders the plane in place in every
pass.

Counted: Metrics::plane_copies_in, plane_copy_in_bytes, plane_copies_out, plane_copy_out_bytes
(in bytes_copied too). The guest's pass pays both: its luma plane is loaded and stored, so each
run copies 2,073,600 bytes in and 2,073,600 bytes out. The stand-ins are bounded by structure,
one per (plane image, format), made at the first mixed pass and freed with the plane
(StandIns, Free::StandIn), counted in Gauges::plane_stand_ins and plane_stand_in_bytes, which
each_device checks are zero at the device's drop. A draw of such a pass that reads the plane
through a texture, or fetches it, stays refused: Gap::Draw of AttachmentRead or
FetchedAttachment (the plane holds what the pass rendered only after its end); a read of another
plane of the same surface is not.

Gap::LinearPlanePass and LinearPlanePassKind are gone: every kind (OtherColor, DepthStencil,
Resolve) renders. AGENTS.md's rule 2 grows to thirteen forms with the mixed-pass entry; the
runtime README's exported surfaces, floor and render encoder known gaps say the form and its
cost; docs/REFUSALS.md and the signatures table are regenerated.

Tests: the plane tests assert the plane copies (none in place; one out for a cleared plane
beside a colour or resolved into; one in and one out for the loaded plane beside a depth
attachment and the guest's pass), and a new test runs eight mixed passes over one plane: one
stand-in where it is marked, none elsewhere, freed when the surface drops. The unit test of
mixes_linear replaces linear_shape's. Device runs follow in the lane's report.
2026-12-02 05:39:50 -08:00
Anees Iqbal cbd5423458 Replay device tests: the layer guard is LayerOn, apart from the profiles layer's Layered; the test device constant is the device tests' hosts' 2026-12-02 05:39:49 -08:00
Anees Iqbal 909739e23f Replay device tests: every device a test opens runs under the validation layer, as VALIDATION.md says
VALIDATION.md's GPU-leg row says the replay player's device tests (replay::rt_replay) run under
the validation layer, but only the exported-surface test enabled it: the jobs put the layer on the
loader's path and nothing in the validation crate turned it on. Each test's pipeline cache
directory (ScratchCache), which every rt_replay test holds longer than its devices, now puts the
layer over the process's instances through candidate::Layered (the candidate runs' helper, which
validated now uses too): rt_device asserts the device lists the layer as an active tool, and the
cache's drop fails the test on any message the layer logged. The exported-surface test no longer
wraps itself. rt_replay, and places' device test that shares its helpers, are Linux's and macOS's,
where the candidate's platform gives the layer.

Cost (job m3-max-78137 at edc3bfa01b, lavapipe on msi, LP_NUM_THREADS=1): ID:rt's device filter
94.9 s; replay::rt_replay alone 1.4 s bare, 1.5 s with the layer enabled through the same
variables, no layer message. Unverified here: the run with this commit follows.
2026-12-02 05:39:49 -08:00
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