Commit Graph
9799 Commits
Author SHA1 Message Date
Anees Iqbal 283d8d8f50 Tests: an OpenCL-mode kernel's 1D images read their 2D textures under the identity domains
Red first for L61. Every kernel of OpenCL mode that takes a 1D image (image1d_t or
image1d_array_t) is refused when its pipeline is made: Unsupported{IdentityDomains} naming
RuntimeFact::OpenClLineTexture, the fact by which the table domains read a 1D texture bound
there in a variant. 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 the M3 Max and the Radeon Pro 5300M read those as the
1D image's row 0. These tests now ask for that answer.

- engine_opencl_mode: __entry_lr (read_imagef of an image1d_t at 2 and of an image1d_array_t at
  (1, 1)) compiles in OpenCL mode and passes L3 on every profile the identity domains derive. It
  states OpenClMode and no OpenClLineTexture, and its images are elements of the sampled float 2D
  and 2D-array classes. On the CPU interpreter, over a 4 x 1 2D texture and a 4 x 1 2D array of two
  layers, it reads texel 2 of the first and texel 1 of the second's layer 1.
- runtime opencl_lines (device cfg, under the validation layer): __entry_ol, with its hidden
  buffers bound as Apple's OpenCL binds them, reads a 4 x 1 2D texture at x and a 2D array at
  (x, 1). It writes their sum to a third 2D texture and the array's texel to o[x]; both are
  checked.
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 039de2090e Tests: a sampled cube read by face reads its texels under the identity domains
Red first for L215 (a). Under the identity domains a texturecube or texturecube_array read by
face (access::read or access::sample) is refused, Unsupported{IdentityDomains} naming
ImageViewShape: the read takes the binder's 2D-array view, which the identity arrays do not hold.
These tests now ask for Metal's answer, the texel read(coord, face[, cube], lod) names.

- engine_texture: texture_ops' cube_faces compiles and passes L3 on every profile the identity
  domains derive, with no ImageViewShape, its textures elements of the sampled float cube and
  cube-array classes, the plain sampler array declared, and an explicit-level sample where it
  fetches nothing. The CPU interpreter models no sampler, so values are a device's.
- runtime cube_reads (device cfg, under the validation layer): an RGBA32Float and an RGBA32Uint
  cube (4 x 4, three levels) and an R32Sint cube array (two cubes, two levels) read at every texel
  of every face, level and cube, each the uploaded texel bit for bit; an RGBA8Unorm_sRGB cube read
  the same way equals a 2D array's fetches of the same bytes (the device's decode); and reads past
  the level's extent on each axis, at face 6 and past, at the level count and past, at the cube
  count and past, and at u32::MAX on each operand are Metal's out-of-bounds texel (zero, alpha 1
  for R32Sint).
- validation engine_textures: the cube_faces case through the runtime, which asserted the
  refusal, now asserts its values: face 3's texel, cube 1's face 4 (layer 10), then width 1, 2
  cubes and 1 level.
2026-12-02 07:25:17 -08:00
Anees Iqbal 4295a197e1 rt: map_made answers the allocation and whether it was mapped
clippy's result_large_err refused Result<Allocation, Allocation> (job m3-max-78507, all three cfgs).
map_made now returns (Allocation, bool); a refusal is freed by its caller as before, outside the
timed map in Pool::take.
2026-12-02 07:20:50 -08:00
Anees Iqbal 531f3944d2 rt test: the block-maker panic tests' taker drops its core before it answers
The taker thread held its Arc of the core until its closure returned, after its answer, so the
device's teardown could wait for it past the test's gauge read: job m3-max-78507 read 8 blocks and
2 device samplers after the map case's teardown, the device not yet torn down. The taker now drops
the core first.
2026-12-02 07:20:50 -08:00
Anees Iqbal 71be3eedac rt: the block-maker thread ends as a stop however it ends, a panic of a consumer's hook too
What: run() holds an Ends guard whose drop, on a stop or a panic alike, stops the pool, clears
every internal asked or being made, wakes the waiters, and hands the ring's next block back to the
takes (Ring::unasked). The stop branch, which did the same for a stop alone, now only returns.
The consumer's two hooks on that thread:
- map: Pool::map_made runs BlockMappings::map under catch_unwind. Where it panics, the allocation
  just made is freed and the panic goes on (resume_unwind), on the block-maker thread (ahead) and
  on a take's thread (Pool::take) alike.
- unmap: free_idle runs BlockMappings::unmap under catch_unwind. Where it panics, the consumer's
  mappings may stand, so the allocation is not freed there: it goes back to the pool, which is
  stopped under the same lock so no take lands in it, and teardown frees it with no second unmap.
  Then the panic goes on.

Why: a panic of either hook ended the thread with the ring's ask outstanding, so a ring take that
found no free chunk waited for good, as did a call in Pool::await_made; and the allocation the
hook panicked over was never freed. Now a panic ends the thread as a quiesce does: a take of the
pool's memory is Error::Quiesced (the typed error rt already has; no new public type), what was
asked of the thread is made on the thread that needs it, as after a stop, and nothing waits.

Docs: Error::Quiesced, BlockMappings::map and BlockMappings::unmap say what a panic of the hook
does; the runtime README's mappings section the same.

Verified: the two tests every_device_whose_block_maker_thread_ends_by_{a_map,an_unmap}_hook_s_panic_leaves_nothing_waiting
(red at the previous commit) are the check; jobs in the hand-over.
2026-12-02 07:20:50 -08:00
Anees Iqbal e9b233b7c4 rt test: a block-maker thread ended by a panic of the consumer's map or unmap hook leaves nothing waiting (red)
The block-maker thread runs two of the consumer's hooks: BlockMappings::map for an allocation made
ahead of need, and BlockMappings::unmap before the free of an allocation idle past the idle age.
Where either panics, the thread ends with what was asked of it still marked asked or being made:
the ring's next block stays the thread's to make, so a ring take that finds no free chunk waits
for good, as does a call in Pool::await_made.

Two tests, one per hook, share one body. The hook is armed to hold the thread inside its run (the
map of the allocation a 12 MiB Shared take sets off; the unmap of a whole Shared unit given back
once the next is made). Takes of the parameter ring run past every free chunk on a thread of their
own until the ring has asked the thread for its next block; then the hook panics. The test waits
for the takes at most the tests' patience (60 s) and fails, not hangs, where they still wait. Then:
the pool is stopped, a take is Error::Quiesced, an internal asked now is the asking call's, the
allocation the hook panicked over is freed (gauges zero after teardown), and every other mapped
allocation is unmapped once, the one whose unmap panicked never a second time.

Expected red today: the ring's takes still wait after 60 s, in both tests.
2026-12-02 07:20:50 -08:00
Anees Iqbal bd1f8c479d CI: the private intra-doc link count runs with colour off, so a broken link counts
The step counts the lines of `cargo doc --document-private-items` that begin `error: ` and holds
each crate at its ceiling. The workflow sets CARGO_TERM_COLOR=always, under which Cargo prints
each diagnostic with a colour code ahead of `error`, so the count was 0 whatever rustdoc
reported: the step could not fail.

Verified: m3-max-78564 (msi) plants one broken private intra-doc link in the harness crate and
runs the step's count over it: CARGO_TERM_COLOR=always counts 0 (the unresolved-link diagnostic
is in the log), never counts 1. The step now sets never.
2026-12-02 07:11:57 -08:00
Anees Iqbal 118bd0dff7 Translator: a query-only argument buffer texture reads its element under the identity domains
L215 (b). An argument buffer's texture that a function only queries has no texel class: nothing
structural types it (the member's texture type is only its MSL type name, which decides nothing),
so its group is declared Float and states RuntimeFact::HeapNumericType for the binder of the
table domains. The identity domains source no such fact, so every function with such a member
was refused, whatever its shape.

Under the identity domains the group's element is the texture its resource ID names, as a
texture slot's is, and a slot only queried already takes the Float class there with no fact.
A query reads the element's extent and its level, layer and sample counts; Vulkan's image query
instructions access no texel (13.4.4), so the texture's numeric type changes nothing a query
returns. So under the identity domains a query-only group states no HeapNumericType; the table
domains keep it.

The runtime README's known gap for it goes; the golden table's tail_heap_cube_queries cells
change from the refusal, a bless at the next pin. SEMANTICS_VERSION 2314. No refusal site was
added or removed.

Verified (job m3-max-78379, msi, at this tree before its rebase onto 0b71bdf72a): the interpreter
test passes on every identity profile (2 passed with its neighbour), and on lavapipe (llvmpipe,
LLVM 23.1.1) the runtime test passes under the validation layer, both dispatches at their
addresses (M2V-FORM 0 bound, 2 at their addresses).
2026-12-02 07:00:02 -08:00
Anees Iqbal e02bfb2699 Tests: a query-only argument buffer texture answers its element's size under the identity domains
Red first for L215 (b). The pin that held the refusal of an argument buffer's texture a kernel
only queries (Unsupported{IdentityDomains}, naming HeapNumericType) now asks for Metal's answer:
the size of the texture the member's resource ID names, whatever its numeric type.

- engine_heap_groups: abq_2d (a 2D texture's width) and abq_cube_array (a cube array's cube
  count) on every profile the identity domains derive: no HeapNumericType fact, one Float sampled
  class, L3, and on the CPU interpreter, with an R32Uint texture's resource ID naming element 3,
  the width 12 and the 2 cubes from each thread, the word past them kept.
- runtime query_only_textures (device cfg, under the validation layer): the same kernels over an
  R32Uint 2D texture of 12 x 5 and three levels and an RGBA8Uint cube array of two cubes, each
  reached through an argument buffer's resource ID.

Verified red (job m3-max-78379, msi, at this tree before its rebase onto 0b71bdf72a): the
interpreter test fails at compile_kept with the refusal (1 passed, 1 failed with its neighbour),
and on lavapipe the runtime test fails at new_compute_pipeline_state (0 passed, 1 failed).
2026-12-02 07:00:02 -08:00
Anees Iqbal 357d728590 Validation tests: bin_exe! reads CARGO_BIN_EXE_<name> with env! again
56cf3dbd1b and 5d62e2079a moved the macro's compile-time fallback to option_env!, on the reading
that Cargo does not set `CARGO_BIN_EXE_<name>` for `cargo clippy --all-targets`. That reading was
wrong: Cargo sets it, and the remote CI's Linux leg lost it in scripts/rustc-wrapper, whose
/bin/sh there (dash) drops variables with a hyphen in the name. c231c41ddd runs the wrapper under
bash. The macro is again the text it had before 56cf3dbd1b, where a missing variable is a build
error rather than a test-time panic.

Verified: the next msi job's green arm runs clippy over the validation crate at this tree as CI
runs it (CI=1, a fresh target) through c231c41ddd's wrapper.
2026-12-02 06:59:54 -08:00
Anees Iqbal c231c41ddd scripts: rustc-wrapper runs under bash, so the compiler keeps Cargo's hyphenated variables
The remote CI's Linux leg has failed "Clippy (warnings denied)" on master since at least
11-15 (run 43704398652 and every push after it, 46893773054 at d8735b75f0 included): each bin_exe!
use in the validation crate's integration tests stopped with "environment variable
`CARGO_BIN_EXE_corpus-triage` not defined at compile time" (and corpus-pipeline, corpus-vulkan,
corpus-index, command-replay). The macOS leg's clippy, and every clippy in the lab, passed the
same tree on the same nightly.

The cause is the wrapper's shell. Cargo sets `CARGO_BIN_EXE_<name>` for the test's compile and
runs `scripts/rustc-wrapper` as `#!/bin/sh`. On ubuntu-26.04 /bin/sh is dash, which drops every
variable whose name is not a shell identifier from the environment it passes to exec, so rustc
never saw the hyphenated names. On Arch (the lab) and macOS /bin/sh is bash, which passes them
through. Checked by hand on macOS: `env 'CARGO_BIN_EXE_x-y=1' /bin/dash -c 'exec env'` prints
no such line; /bin/bash and /bin/sh print it.

The wrapper now names bash, present at /bin/bash on Ubuntu, Arch and macOS.

Verified: the next msi job runs clippy over the validation crate as CI runs it (CI=1, a fresh
target, env! in bin_exe!), once through the parent's wrapper under Debian's dash (red, "not
defined at compile time") and once through this one (green).
2026-12-02 06:59:34 -08:00
Anees Iqbal 5d62e2079a Validation tests: bin_exe! takes CARGO_BIN_EXE_<name> through option_env! without unwrapping it, which clippy denies
56cf3dbd1b called .expect on option_env!(...), and clippy::option_env_unwrap ("this will panic at
run-time if the environment variable doesn't exist at compile-time") is denied under -D warnings:
m3-max-78487's run at 01d80f2d65 failed five of them. The compile-time path is now one more fallback
after nextest's NEXTEST_BIN_EXE_<name>, and a test that finds neither panics naming both.

Verified: the next msi job runs clippy over the validation crate as CI does (CI=1, so
scripts/rustc-wrapper runs the compiler itself, and a fresh target), at the old macro and at this one.
2026-12-02 06:53:35 -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 a4a9d232c8 rt test: a device that places the pool's allocations off 16 hands out no block there (red)
What: a device-test answer, DeviceOptions::placed_past (cfg test with a device cfg), adds bytes
to the device address each pool allocation reads from vkGetBufferDeviceAddress, as a device that
places its memory there would answer. every_device_hands_out_no_block_at_an_address_off_16 opens
each device with 4 and asks that no Private or Shared block a take hands out has its first byte
off a multiple of 16.

Why (L84): a block's buffers take their allocation's address as their base. The blocks hold
images bound at memory offsets beside buffers reached by address, so no offset of ours can put
both on their alignment where Vulkan places the allocation off 16, which it may (it promises the
largest of the buffer's memory requirements' alignment and its usages' offset alignments, none
bounded below 16). Metal's offset rule for a device buffer (Apple's setBuffer(_:offset:index:):
the offset aligned to the data type's size, at most 16) asks a base at a multiple of 16. The fix
refuses such an allocation, typed.

How verified: expected red at this commit (the take hands out a block at 4 past 16); the fix
follows.
2026-12-02 06:51:00 -08:00
Anees Iqbal a4001735fb rt test: every device places a block of each class and the ring's nil buffer and zero range at a multiple of 16
What: every_device_of_the_cfgs_kind_opens_presents_and_tears_down_to_zero prints the alignment
Vulkan promises the device's buffer addresses (the largest of the buffers' memory requirements'
alignment, minStorageBufferOffsetAlignment, minUniformBufferOffsetAlignment and
minTexelBufferOffsetAlignment, the floor's usage holding each) and asserts that a Private and a
Shared block's first buffer, and the ring's nil buffer and zero range, lie at multiples of 16.

Why (L84): the ring now starts its chunks on 16 wherever the device places a block, but a block's
buffers take their allocation's address, and the blocks hold images bound at memory offsets beside
buffers reached by address, so no offset can serve both where an allocation's address is off 16.
Metal's offset rule for a device buffer (the offset aligned to its data type, up to 16; Apple's
setBuffer(_:offset:index:) page) asks a base at a multiple of 16. This pins, on every device the
device suites open, that the allocations they make lie on 16, and names the device where one does
not.

How verified: in the hand-over (lavapipe on msi, the Iris on ms01).
2026-12-02 06:51:00 -08:00
Anees Iqbal 459a50702a rt: the ring starts each chunk at a multiple of its alignment in the device address space, wherever Vulkan places the block
What: chunk_starts(address, align) now answers the skew, the first offset in a ring block whose
device address is a multiple of the ring's alignment (16, or the translator's buffer base
alignment where larger), and the chunks the block holds whole from there: 32 where Vulkan places
the block at a multiple of the alignment, 31 elsewhere. State::add places chunk i at skew + i * 64
KiB. So every write, the nil buffer, the zero range and the whole execution range lie at a
multiple of the alignment in the device address space on every device. The skew is a multiple of
the block's own placement, which holds minStorageBufferOffsetAlignment, so a set_bytes copy's
descriptor offset still meets that limit; view()'s debug check now asks the copy's device address,
not its buffer offset, to be a multiple of the alignment. Ring and README docs say so.

Why (L84): the ring assumed every chunk lay at a multiple of 16 ('like every chunk'), which held
only where the block's address did. Vulkan's vkGetBufferDeviceAddress promises a multiple of the
largest of the buffer's memory requirements' alignment and its usages' minStorage/Uniform/Texel
BufferOffsetAlignment, none bounded below 16. The translator reads a parameter block in 16-byte
lines at multiples of 16, and PushField::ZeroAddress is documented (docs/API.md section 5) as a
multiple of 16. One form on every device: the skew is 0 wherever the block's address is already a
multiple of the alignment (no lab card is expected to differ: their buffer alignments are 16 or
64), so nothing changes there; no device in reach places a block off 16.

How verified: a_block_placed_off_the_ring_s_alignment_starts_every_chunk_on_it, red at the parent
commit, green here (jobs in the hand-over).
2026-12-02 06:51:00 -08:00
Anees Iqbal fa9d917ef4 rt: a test that a ring block placed off the ring's alignment starts every chunk on it (red)
What: State::add takes its chunks' places from chunk_starts(address, align), which answers today's
layout (the first chunk at the block's first byte, 32 of them), and a device-free test,
a_block_placed_off_the_ring_s_alignment_starts_every_chunk_on_it, asks of a block at a device
address that is a multiple of 1, 2, 4, 8, 16, 64 or 256 alone that every chunk start at a multiple
of the ring's alignment (16, 64, 256) in the device address space and at a multiple of the block's
own placement in its buffer, and lie whole in the block.

Why (L84): the ring places its writes at multiples of its alignment from each chunk's first byte,
and each chunk at a multiple of 64 KiB from the block's first byte, so a write's device address is
a multiple of 16 only where the block's is. Vulkan promises a buffer's address only at a multiple
of the largest of its memory requirements' alignment and the offset alignments of its usages
(vkGetBufferDeviceAddress, the spec's alignment list), none of which has a lower bound of 16.

How verified: expected red at this commit (a block at a multiple of 4 alone puts chunk 0 at 4 past
a multiple of 16); the fix follows.
2026-12-02 06:50:59 -08:00
Anees Iqbal 01d80f2d65 AIR tests: the metallib half of the committed-fixtures test is skipped where the SDK's linker refuses the fixtures' AIR version
The remote CI's macOS leg (macos-26) has failed "Test metal2vulkan" on master since at least
959a4ccbcd (runs 46004353737, 46104484064, 46893773054): container::tests::
committed_air_fixtures_parse_and_link asserted the link succeeded, and that runner's xcrun metallib
answers "air version set to 2.9.0 (!10 = !{i32 2, i32 9, i32 0}), but expecting 2.8 in fbd_vertex".
The fixtures are compiled by the SDK scripts/regen-air-fixtures ran on, newer than the runner's, and
that linker cannot link them at all. The parse half still runs on every host; the link half is skipped
with a SKIPPED line naming the linker's answer, as it already is where xcrun metallib is absent. Any
other link failure still fails the test with the linker's stderr.

Verified: not run here (the M3 runs no tests, and its SDK links AIR 2.9); the next remote macOS run
shows it.
2026-12-02 06:50:40 -08:00
Anees Iqbal 56cf3dbd1b Validation tests: bin_exe! reads CARGO_BIN_EXE_<name> with option_env!, so clippy --all-targets compiles them
The remote CI's Linux leg has failed "Clippy (warnings denied)" on master since at least fc9c99916d
(runs 45911520903, 46004353737, 46104484064, and 46893773054 at d8735b75f0): every bin_exe! use in the
validation crate's integration tests stops with "environment variable `CARGO_BIN_EXE_corpus-triage`
not defined at compile time" (and corpus-pipeline, corpus-vulkan, corpus-index, command-replay), on
the pinned nightly-2026-11-03. The macro read the path with env!, a compile-time error where Cargo
does not set the variable. option_env! compiles either way; when the test runs, nextest's
NEXTEST_BIN_EXE_<name> or Cargo's baked-in path is still taken first, and a missing one panics with
its name instead of failing the build.

Verified: the next msi job runs clippy over the validation crate with no rustc wrapper and a fresh
target, at the parent's macro and at this one.
2026-12-02 06:50:40 -08:00
Anees Iqbal 0b71bdf72a Translator: OpenGL mode makes a rasterizing void vertex function's state as Metal does
Metal makes, under the private OpenGL mode, a rasterizing render pipeline
state whose vertex function returns void, with or without a fragment
function, and its draws run the vertex function and rasterize nothing (an
Apple M3 Max, macOS 27.0.1, conformance/probes/opengl_mode.m). The link
refused it whatever the mode (DescriptorError::RasterizedVoidVertex), so the
runtime refused a state the guest GL renderer may make.

The compile now takes such a descriptor as the descriptor with rasterization
disabled and no fragment function (private_state::unrasterized_void_vertex),
in both render_variant_key and render_pipeline, before anything compiles: a
Function vertex stage's answer through StageEntries::returns_value (the
decode its specialization through the same object shares), a Compiled one's
from its interface's position, as the link reads it. The fragment function,
which never runs, is neither compiled nor checked; a state Metal would refuse
for another reason is then made, an answer not measured, recorded in
private_state's docs. Without the mode the refusal stands, as Metal's.

The runtime needs no change: its pipelines with rasterization disabled take
the discard as dynamic state. The runtime README's known gap for this state
is removed; docs/REFUSALS.md does not list descriptor errors (its --check
passes unchanged). SEMANTICS_VERSION 2312 -> 2313 (a refusal lifted).

Verified on lavapipe (llvmpipe, msi): job m3-max-78373 at 6aab044c24 (this
change before its rebase onto 472cfba642): the runtime's opengl_mode tests 3
run, 3 passed; the translator's link test 1 run, 1 passed. Job m3-max-78378 at
24d71d71be, this commit's tree but for the version and development's two
translator commits since (edabd70447, fd8b132834) and the four that followed
up to f29613d057: clippy -D warnings over the
workspace (all targets, all features) and over the runtime under m2v_cpu_icd
and m2v_gpu, rustdoc -D warnings and the private docs of metal2vulkan and the
runtime, all clean; the runtime's suite on lavapipe 868 run, 868 passed, 3
skipped; the translator's and AIR's suites without the tables a bless is due
for 3392 run, 3392 passed, 37 skipped. No card run: the state is one form on
every device (rasterization disabled, its discard dynamic state), the form
every_device_runs_a_vertex_function_that_stores already draws on each card.
2026-12-02 06:36:32 -08:00
Anees Iqbal 0538a8395d Tests: OpenGL mode makes a rasterizing state whose vertex function returns void
Under the private OpenGL mode an Apple M3 Max (macOS 27.0.1, the probe
conformance/probes/opengl_mode.m) makes a rasterizing render pipeline state
whose vertex function returns void, with or without a fragment function: its
draw runs the vertex function, its stores landing, and leaves the colour as
cleared. The runtime refuses it in either mode (Error::Translation naming
RasterizedVoidVertex), a known gap.

The runtime's device test now asserts Metal's answer on every device: the
state is made with and without inputless_fragment, a draw of three vertices
of void_store_vertex stores the tint texel three times into its buffer, and
the cleared target reads all zero. The refusal without the mode stays
asserted. The translator's link test asserts that the mode's state compiles
to the pipeline of the descriptor with rasterization disabled and no
fragment function, rasterizer discard set.

Red until the fix that follows, verified on lavapipe in job m3-max-78373
(msi, this commit before its rebase, e25fc1be7d): the runtime's opengl_mode
tests 3 run, 2 passed, 1 failed (the new test, its state refused at
creation); the translator's test 1 run, 1 failed (the OpenGL-mode compile
refused).
2026-12-02 06:36:21 -08:00
Anees Iqbal f29613d057 Translator: a slot pointer stored through a loaded pointer or into an open cell is its Metal address
L288. Under the identity domains (and on Profile F) an escaping slot root stays static, so a
stored slot pointer is access::pointer's: its Metal address, the slot's SlotGuestBase plus its
displacement, as an 8-byte leaf. That leaf went only through a static-root destination; a store
through a pointer loaded from memory, or into a pointer cell whose bytes are read at an offset only
the run knows (an open cell), was Unsupported{Lowering(Access), NotImplemented}. Metal stores the
pointer's 64-bit address wherever it is stored.

Now the stored address goes through any destination dynamic stores a wide pointer's through: a
static-root pointer (unchanged), the address a wide pointer holds (an 8-byte store there), or an
arena's pointer cell. dynamic::store_destination and dynamic::emit_store_word are the one form
both share; dynamic's own StorePointer selects and emits through them as before. A destination in
the blob, a typed object or a constant global stays refused. Census names:
access.pointer.store_pointer.wide and .arena, as dynamic names its own.

Existing inputs keep their modules (the static-root path is unchanged); a refusal becomes a
module, so SEMANTICS_VERSION 2312. No refusal site was added or removed: docs/REFUSALS.md
regenerates unchanged.

Verified (job m3-max-78337, msi, at this tree before its rebase onto f1dfed1138): the interpreter
test passes on every identity profile and compiles and passes L3 on the bound ones (1 passed);
on lavapipe the runtime test passes, both dispatches at their addresses ("32 slot pointers stored
as their Metal addresses", M2V-FORM 0 bound, 2 at their addresses).
2026-12-02 06:35:55 -08:00
Anees Iqbal 37a5bc7f0c Tests: a slot pointer stored through a loaded pointer or into an open cell is its Metal address
Red first for L288. The pin that held the refusal (Unsupported{Lowering(Access)}, NotImplemented)
of a slot pointer stored through a pointer loaded from memory, or into an open thread cell, now
asks for Metal's answer: the stored 8 bytes are the slot's address (gpuAddress plus the bind
offset) plus the element's offset.

- engine_identity_pointers: sp_into_slot, sp_through_loaded and sp_open_cell run on the CPU
  interpreter on every profile the identity domains derive, buf bound 16 bytes past its start,
  each above 4 GiB, and must store those addresses and nothing else (a spare cell keeps its
  bytes); on the profiles that bind a kernel's buffers each must compile and pass L3.
- runtime stored_slot_pointers (device cfg): the same two kernels dispatched on every device of
  the cfg's kind, the loaded pointer naming a buffer made resident by useResource:usage:.

Verified red (job m3-max-78337, msi, at this tree before its rebase onto f1dfed1138): the
interpreter test fails at compile_kept with the refusal (0 passed, 1 failed), and on lavapipe
(llvmpipe, LLVM 23.1.1) the runtime test fails at new_compute_pipeline_state (0 passed, 1 failed).
2026-12-02 06:35:55 -08:00
Anees Iqbal ef9a825aaa rt: a helper killed mid-make leaves every make its refusal at once, and the compute make's doc says no refusal waits
What: a device test, a_helper_killed_mid_make_leaves_every_make_its_refusal_at_once. A helper
that reads the request whole and is killed partway through its reply (the consumer's memory cap
or time limit) ends Device::fill_stage at once with StageFill::Ended; the breach the consumer then
keeps, StageBreach::Memory or StageBreach::Time, answers four makes of the pipeline on threads at
once, and a later device's on the same directory, with Gap::StageSize of that breach, with no
helper asked again and no fill counted. Each call runs on a thread of its own and is given the
tests' patience, so one that waits for good fails rather than hangs. The test runs on a device
whose driver writes a pipeline cache header (lavapipe writes none and is skipped, as the other
stage tests skip it).

new_compute_pipeline_state's doc now says every error is the call's answer as it returns on the
calling thread, that no refusal waits for the consumer's helper, and that Metal's
completionHandler: forms are the consumer's, made over this call.

Why: the consumer's ledger row 1120 (an Iris Xe run at pin 28e1026b3d: 2 of 8 heavy kernels
made, 6 refused, 5 at the helper's memory cap and 1 at its time limit, then the guest app waited
at its first sample for good) was put to rt with a lead: the ring's lost-ask race (the consumer's
row 393). That race was fixed by 9749fcbd63 on 11-23, after 28e1026b3d, and is in the consumer's
current pin d8735b75f0. rt's paths from a refused or killed make to its caller hold no wait: the
make reads the stage entry and answers StageUnfilled or Gap::StageSize at once; a dispatch that
waits for another thread's make of its variant is woken when that make ends, made or failed
(Pending's drop), and makes it itself; a render state's main pipeline the same (Making's drop).
This test pins that answer for the two breaches the run met.

How verified: see the hand-over (msi lavapipe suite and clippy, Iris card run).
2026-12-02 06:26:45 -08:00
Anees Iqbal fd8b132834 Translator: a slot's direct base and address are made before the body, in the function's first block
e2e76d8879 made a slot's direct base and Metal address once, in the block that first asks for
them, and recalled them where that block dominates. Where that block was the walk's first one,
the first application of a function inlined more than once made the base after work of its own,
and every later application read it: the applications were no longer the same code, and
spirv::roll wrote the body twice where it had written it once. The identity-domains engine_roll
case shows it: three applications weighed 26,737 against one's 13,355 on lavapipe (m3-max-78287).

Now EmitCx::load_push_fields, the first hook, makes every placed SlotGuestBase slot's direct base
and address under the identity domains (pointer::make_ahead), after the push fields load and
before any other hook or the body: every block recalls them, and every application reads them
from before it. Those no access reads leave with the other unused values (spirv::dead, at the end
of emission, before the roll and the weighing). Making them in the entry block where first asked
(fb.in_entry_block) is not enough: the walk's first block is the entry block itself until a hook
closes a construct, so the base still landed inside the first application (m3-max-78326: 2.00
bodies, as before).

The arithmetic is unchanged; module bytes change (the bases move to the first block):
SEMANTICS_VERSION 2310 -> 2311. The golden table is re-blessed at the next pin.

Verified: nothing run yet for this commit; the roll, identity, identity-flow, access-size and
golden tests run next on msi.
2026-12-02 06:20:53 -08:00
Anees Iqbal edabd70447 Translator tests: a function inlined three times rolls under the identity domains
engine_roll ran only under the resident-table domains, where an access never makes the slot's
direct base. Under the identity domains, the runtime's, each application of a function reaches its
buffer at the slot's own device address. The new kernel `@head_thrice` applies `@head` three
times: it adds its constant, then loads word 0, before the body's first branch, so the first
application makes the slot's address after an instruction of its own. The test asserts on lavapipe
and MoltenVK that the entry weighs about one application (`@head_once`), that it holds one more
loop, that the slot is reached at its address (an `OpIAddCarry`), that it passes L3, and that it
computes the three applications' values on the CPU interpreter. Each profile prints its weights.

Red at development (m3-max-78287, msi): three applications weighed 26,737 against one's 13,355 on
lavapipe (2.00 bodies), and 13,539 against 13,488 at e2e76d8879^ (1.00). With the load as the
application's first instruction both forms rolled (m3-max-78272): the run then starts after the
first application's two extracts, so that shape does not show it.
2026-12-02 06:20:53 -08:00
Anees Iqbal 472cfba642 Runtime: a viewport Vulkan takes in no form that covers no pixel of the render area draws nothing
set_viewport and set_viewports refused, as Gap::Draw of DrawKind::Viewport, every viewport that
VkViewport's valid usage forbids: an extent past maxViewportDimensions, a corner past
viewportBoundsRange (VUID-VkViewport-width-01771, -height-01773, -x-01774, -x-01232, -y-01775,
-y-01776, -y-01777, -y-01233), a negative width, and depths past [0, 1] (the runtime enables no
VK_EXT_depth_range_unrestricted). Metal documents no such limit. A user met the refusal four times
in one session, and a WebGL 1 page reaches it with a far gl.viewport: 32768 is the bounds range on
the 780M and Iris profiles, 65536 on NVIDIA's.

No other Vulkan viewport maps clip space as one of these does, since a viewport's transform is
fixed by its own origin and extent. But where such a viewport covers no pixel of Metal's render
area, Metal draws nothing through it, as the rt draws nothing through a viewport of no extent. So
checked() now keeps a viewport Vulkan takes as it is, makes one it does not take that covers no
pixel (viewport_pixels) a viewport of no width or height at the area's origin with its depths cut
to [0, 1], which Vulkan takes and whose draws record an empty scissor, and refuses the rest. With
the bounds Vulkan requires (at least twice the largest extent past either side of the origin) and
an area no larger than maxViewportDimensions, a viewport past the bounds within that extent covers
a pixel only where its edge lies inside the last pixel of an area of the largest size; WebGL's
integer origins never do. What stays refused: a negative width over the area (Metal mirrors it), a
depth range past [0, 1] over it, an extent past maxViewportDimensions over it, and that last-pixel
edge. DrawKind::Viewport, set_viewport and the runtime README (Render encoders, and its known gaps)
say so. docs/REFUSALS.md regenerates unchanged: the Gap::Draw row and its checked() site stay.

The refusal test's mirrored viewport now lies over the target (origin x 4, width -4); at origin 0
it covered no pixel and now draws nothing, as Metal's. The new test also sets a mirrored viewport
and one with depths past [0, 1], both off the target.

Verified:
- Red: the test commit 17aa4279b3 on lavapipe (job m3-max-78333): 0 passed, 1 failed, at
  draw.rs:501, the set_viewport of the first far viewport.
- Green, this commit's tree (fd7df2eccb), run as a scratch commit of the same tree: lavapipe (job
  m3-max-78345) 3 passed, 868 skipped: the new test, the triangle test and the refusal test, under
  the validation layer, "10 viewports past bounds [-32768, 32768] and dimensions [16384, 16384]
  drew nothing". The same three tests from one msi-built gpucfg archive under the carried
  validation layer 1.4.363.0, each 3 passed, 870 skipped: Radeon 780M, RADV, Mesa 26.2.6 (job
  m3-max-78347, bounds [-32768, 32767], dimensions 16384); Iris Xe, ANV, Mesa 26.2.6 (job
  m3-max-78348, the same limits); RTX 3090, NVIDIA 620.70.06 (job m3-max-78349, bounds
  [-65536, 65536], dimensions 32768); RX 7900 XTX, RADV, Mesa 26.2.6 (job m3-max-78350, bounds
  [-32768, 32767], dimensions 16384).
- Job m3-max-78346: clippy -D warnings on metal2vulkan-runtime, all targets and features, plain,
  --cfg m2v_gpu and --cfg m2v_cpu_icd, each exit 0; the runtime's whole suite on lavapipe, 868
  passed, 3 skipped. Job m3-max-78371: the runtime's rustdoc with warnings denied, public and with
  private items, 0 diagnostics. scripts/api-signatures/signatures.py --check and
  refusal_surface.py --check pass. cargo fmt --all.
2026-12-02 06:15:13 -08:00
Anees Iqbal b0a8bd866b Runtime test: a viewport past the device's bounds that covers no pixel draws nothing
every_device_draws_nothing_through_a_viewport_past_its_bounds sets seven viewports, each past
one of the device's own limits and over no pixel of an 8 by 8 target: an origin whose x plus the
width passes the top of viewportBoundsRange (what a WebGL 1 page's far gl.viewport reaches), an
origin below its bottom, the same two in y, a flipped viewport whose origin passes the top, and
one wider and one taller than maxViewportDimensions. It draws the whole of clip space in white
through each, and once more through setViewports with the far one as viewport 0. Metal draws
nothing through any of them: its viewport maps clip space onto pixels the target does not hold.
A viewport wider than the largest over the target stays refused (Gap::Draw Viewport), since no
Vulkan viewport maps clip space as it does. Then the whole of clip space in blue through the left
half's viewport, and the target is compared texel by texel with the CPU reference: left half
blue, right half the clear's black. The validation layer checks every viewport recorded.

Today set_viewport refuses the first viewport (Gap::Draw Viewport), so the test fails on every
device; the next commit makes it pass.
2026-12-02 06:15:13 -08:00
Anees Iqbal f1dfed1138 Translator: a slot's direct base takes no borrow; an unbiased SlotGuestBase word there is an invariant error
pointer::direct_base made its base in one of two ways. A biased SlotGuestBase word was used as
it is. An unbiased one, a device-replay variant's under the identity domains, was the word less
2^31, with a borrow from the high word. No admitted compile reaches the second arm.
plan_replay (lower/access/mod.rs) swaps every SlotGuestBase field for RootTableAddress, and
identity_refusal (lower/select.rs) refuses RootTableAddress. identity_admits runs at the end of
every identity select, before emission. So a replay variant that reaches a slot is refused,
typed, under the identity domains, and the emitter never runs with identity && replay.
a_replay_variant_under_the_identity_domains_is_refused_typed (pipeline/compile/tests.rs) holds
that refusal for a vertex function's and a kernel's buffers.

The arm goes. Its place returns an invariant error (EmitCx::fail), so an identity+replay
compile that select admits one day fails visibly and is never silently wrong. Nothing else was
used only by the arm: k32, BinOp and biased all keep other callers. Module bytes do not change
(the arm emitted nothing in an admitted compile), so SEMANTICS_VERSION stays.

Verified: not yet run; the msi job's results follow in the hand-over.
2026-12-02 05:48:53 -08:00
Anees Iqbal 6fff439212 Tests: an irreducible cycle and a phi over two slots under the identity domains, checked by value
Since e2e76d8879 a slot's direct base and address are made once where they dominate (EmitCx's
memo). The finalize verifier catches a use its definition does not dominate, but not a wrong
address. These two shapes had no executed identity-domain test: fuzz_interp's irreducible
automata run only under the resident tables and reach no slot inside the cycle, and the public
pointer-phi fixture runs in the validation executor under the resident tables.

engine_identity_flow, on every committed profile the identity domains derive (lavapipe
asserted among them), compiled with no descriptor, passed through L3 and run on the CPU
interpreter. It checks every word of every buffer against a CPU walk of the program:
- cycle: a two-block cycle entered at either block by the thread's parity. The entry reads
  slot 1. Slots 0, 2 and 3 are first reached inside the cycle, in blocks neither of which
  dominates the other: step sums go to slot 0, and a slot-2 word's Metal address (ptrtoint) is
  stored to slot 3 inside the cycle. The exit stores the sum and the exit block.
- merged: a phi of slot 0 and slot 1 (each path first reads the other slot), read and written at
  the thread's index after the merge, compared with slot 1's pointer (eq and ult), stored as two
  words and as a pointer, then slot 1 read directly.
Slots lie just below and just above 2^31, with bind offsets that are not 0, and some buffers
cross 2^31, 6 GiB or 12 GiB inside the bytes the kernel reaches. So the carry of each biased
access and the bias that a pointer used as a value adds back both show in the answers, and a
compare of biased words would answer the other way.

Verified: not yet run; the msi job's results follow in the hand-over.
2026-12-02 05:48:17 -08:00
Anees Iqbal a6e42ca617 Translator: the bind residual's push comment says what it holds, past the offset alignment
The comment on PushField::SlotBindOffset's shape said the residual is below
min{Storage,Uniform}BufferOffsetAlignment. It is not: where several bind offsets share one
descriptor range, a slot's residual is hundreds or thousands of bytes, which
a_constant_slot_reads_exactly_far_above_its_descriptor_base (tests/engine_access.rs) reads
exactly at 256 and 4096. The comment now states the field as sym.rs documents it (the bind offset
less the descriptor base, modulo 2^32) and names that test, and says the other field of the arm is
a pulled vertex buffer layout's stride. One u32 holds both; nothing else changes.

Doc only; cargo fmt --all.
2026-12-02 05:39:51 -08:00
Anees Iqbal 19e2b1f3ef Replay: a pass uses an exported surface only while one of its attachments holds a surface's texture
The audit lane found that a render pass descriptor stayed among the surface passes once any
attachment setter named a surface's texture, even after that attachment took an ordinary texture,
so its encoders' commits counted as hand-over parts and the hand-over line could show a false
"differ" (exported.rs:178-183 at cc3188c3da). The backend now keeps, per descriptor, the
attachment properties (texture or resolveTexture of each color attachment, depth and stencil) that
hold a surface's texture: a setter's object there sets or clears its property, a nil property keeps
what it held, and the descriptor counts while any property holds one. A unit test of the backend
plays the replacement: a plane at color 0, an ordinary texture at color 1 and a nil at color 0
(still a part), an ordinary texture at color 0 (no part), the plane's view as the depth
attachment's resolve texture (a part again), then object 0 there (none).
2026-12-02 05:39:50 -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 4233a1127b Runtime: a surface image's mark names the image's stand-ins, the field that holds it
The doc of SurfaceImage::linear_attachment named Image's linear_attachment, which the
stand-in form replaced with stand_ins. Docs only.
2026-12-02 05:39:50 -08:00
Anees Iqbal 51f93ee1fd Runtime: a plane's stand-in makes no sampled or storage view
At 951aff127e the stand-in's make took the plan of a Private render target, which has a
sampled view, and dropped the views make returned: one VkImageView leaked per stand-in, which
the validation layer reported at vkDestroyDevice (VUID-vkDestroyDevice-device-05137) in each
NVIDIA test that makes one (RTX 3090, NVIDIA 620.70.06, job m3-max-78190). Every render and
every plane-copy count was right there. The stand-in is only rendered, resolved into and
copied, so its plan now has no sampled view, no storage view and no sRGB twin, and make makes
no view; the stand-in's own attachment view is unchanged.
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 29cb25b5a8 Runtime tests: the depth test passes its depth-stencil state as the encoder takes it, an option
The test at 3fae8a4632 did not compile (job m3-max-78124): set_depth_stencil_state takes
Option<&DepthStencilState>.
2026-12-02 05:39:50 -08:00
Anees Iqbal 790f5b3cac Runtime tests: a surface plane renders in every pass shape, beside a depth attachment among them
every_device_renders_a_plane_alone_and_holds_a_marked_one_to_its_rule asserted that a marked
plane (an opaque handle's plane in place whose LINEAR tiling renders only through
VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV) is refused beside another colour attachment,
beside a depth attachment and as a resolve target. The planner ruled that such a plane renders
in every pass shape, through an optimal image of the runtime's where the pass mixes it with
another attachment. The test becomes every_device_renders_a_plane_in_every_pass_shape: a draw
into one plane, both planes in one pass, a plane cleared beside another colour attachment (that
one compared too) and a multisample attachment resolved into a plane, each read back exact.

The draw beside a depth attachment gets its own test,
every_device_draws_into_a_plane_beside_a_depth_attachment, since an RTX 3090 lost the device
rendering a linear colour attachment beside one: a plane loaded green, a depth attachment cleared
to 1, and the fixture's whole-clip-space triangle drawn blue under Less with writes; every texel
of the plane reads blue.

Expected red where the plane is marked (the RTX 3090 and the RTX 5080 Laptop GPU refuse the pass
as it begins, Gap::LinearPlanePass), green where it is not (RADV, ANV, lavapipe).
2026-12-02 05:39:50 -08:00
Anees Iqbal ad79dedbcd Runtime tests: the guest's pass gives the plane view and the chroma texture indices
A view or texture that shaders may read takes an index; the lavapipe run (m3-max-78076) refused
the view without one.
2026-12-02 05:39:50 -08:00
Anees Iqbal 23fe8702b5 Runtime tests: a guest's pass of a surface plane view beside an ordinary colour attachment renders
The regression's replay, from a recording's refused descriptor (an arm64 guest recording its
screen through the consumer's H.264 encoder on NVENC, every recorded frame flat green): colour 0
a view (its own format, level 0, slice 0) of the R8Unorm luma plane of an exported 1920x1080
two-plane surface in the opaque handle, colour 1 an ordinary Private RG8Unorm 1920x1080 texture,
both Load and Store, one sample, no depth or stencil. Each is cleared alone, then one draw writes
luma 1 and chroma (1, 0), and both are read back through a blit, every texel compared.

It prints the surface's form, R8's and RG8's LINEAR colour attachment bits, whether the device
enabled VK_NV_linear_color_attachment and whether the luma plane is marked. Expected to fail
where the luma plane is marked (its LINEAR tiling renders through
LINEAR_COLOR_ATTACHMENT_BIT_NV alone): the pass is refused as it begins,
Gap::LinearPlanePass { kind: OtherColor }.
2026-12-02 05:39:50 -08:00
Anees Iqbal cdb4725308 Runtime README: the known gaps of a release and acquire with nothing between, and of an exported block reached by address alone
README C. Vulkan 1.4 section 7.7.6's note calls an acquire after a release with no other
release between invalid. The APIs that share an exported surface or block (VA-API, NVDEC,
Direct3D 11) have no release of their own, so where the other side did nothing between two of
rt's submissions, rt's release and next acquire meet with no external operation between. The
form stays; the known gap says so and when it reopens.

README D. The residency-set line gains its exported-block case: a buffer in an exported block
reached only through an address (never bound, declared or kept) puts nothing in its segment's
hand-overs, so its part neither acquires nor releases the block.

Docs only.
2026-12-02 05:39:50 -08:00
Anees Iqbal 87081c05bb Runtime: a surface's planes and buffer are handed over together, and its making releases from the general layout
FIX A. An exported surface in place is one memory that its planes' images and its buffer
alias, and Vulkan 1.4 section 7.7.6 makes "the contents of any other resource aliasing the
transferred memory" undefined after a release or an acquire. A part that used only the planes
handed over only the planes, and a part that used only Surface::buffer only the buffer's block.
Now the surface's make gives its planes one handed::Aliases set, which the buffer joins when
Surface::buffer makes it (memory::Block::aliases, Under::Surface's aliases); Handed::keep adds
every living member with any one, so each part's one acquire and one release name the planes
and the buffer as further entries of the same barriers. No barrier is added. The set holds its
members weakly: one gone is handed over no more. The making is not expanded: the buffer has no
making of its own, and the planes' making releases only what was made.

FIX B. The making released each plane from the undefined layout, while every later acquire and
release names the general layout, and a release's layouts are its acquire's (section 7.7.6). Now
Upload::hand_over records, for a making, the planes' moves out of the undefined layout first,
within the runtime's queue family (handed::moves, Image::making_move), counted in
Metrics::upload_barriers, then the release from and to the general layout. One barrier more per
surface at its making; nothing per picture changes.

The README's making and hand-over text says both.

Tests: ad65d6a70e's two structural tests, red on lavapipe at ad65d6a70e (job m3-max-78062);
the green runs follow in the lane's report.
2026-12-02 05:39:49 -08:00
Anees Iqbal 4a9437f6b3 Runtime tests: the picture loop prints its surface's making's counts
The counts of the surface's make and its ready wait, which submits its making ([barriers,
runtime command buffers, submissions, acquires, releases]), beside each picture's: a change to
the making shows there, and a picture's counts show it changed nothing per picture.
2026-12-02 05:39:49 -08:00
Anees Iqbal e3493ad83c Runtime tests: an exported surface's planes and buffer are handed over together, in the general layout
Two structural tests over the layouts recorder, which now keeps each barrier's ownership
transfers to or from the external or foreign queue family (images with their old and new
layouts, and buffers), in the order submitted.

- A part that uses only an exported surface's planes in place, and a part that uses only its
  buffer, each name both the planes and the buffer in their one acquire and their one release:
  the two alias one memory, and Vulkan 1.4 section 7.7.6 makes "the contents of any other
  resource aliasing the transferred memory ... undefined after a release or acquire operation".
- Every hand-over of such a plane, the making's release included, names the general layout as
  its old and its new layout: a release's layouts are its acquire's (section 7.7.6), and every
  acquire names the general layout.

Both fail at this commit: a planes-only part hands over only the planes, a buffer-only part only
the buffer, and the making releases each plane from the undefined layout.
2026-12-02 05:39:49 -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 e5631ea806 Validation tests: the wait tests' fake source is gated with the tests that use it, which Windows leaves out 2026-12-02 05:39:49 -08:00
Anees Iqbal e8f9ecf7f0 Validation tests: the build-support fingerprint hex-encodes its digest byte by byte, which sha2's array type does not format 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