Commit Graph
9781 Commits
Author SHA1 Message Date
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
Anees Iqbal b111f209ec Replay: the stand-in's device keeps its loader word as the candidate's context does; a doc line no longer starts a list
Clippy of the validation crate (job m3-max-78070, aeb43cd8b7, default and m2v_cpu_icd configs)
refused the stand-in's direct vkGetDeviceQueue, vkAllocateCommandBuffers and vkDestroyDevice: the
crate's clippy.toml keeps those loader-served calls behind the loader word a driver may write over
while reporting a message (candidate/platform/loader_word.rs). The stand-in now records its device's
word as vkCreateDevice returns it and puts it back before each such call on Linux and macOS, with
the crate's #[expect(clippy::disallowed_methods)] at those sites as VulkanContext has; LoaderWord is
re-exported to the crate for it. A redundant deref and a doc line that began with "+ " (a list
item to rustdoc's markdown) are fixed.
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 02325796bc Replay: the exported-surface records, played through the runtime's surface call with a stand-in for the other API
The player plays m2v.newExportedSurface, m2v.surfacePlane, m2v.exportSurface and
m2v.surfaceWritesDone (the snippet's records) through Device::new_exported_surface,
Surface::planes, Surface::wait_until_ready and Surface::external_writes_done. Where the
stream was recorded a decoder wrote each picture; on replay a Vulkan device of the
player's own, on the runtime's instance and physical device, imports the surface's
handle, copies the picture's packed rows into its memory at the play's layout (or fills
it with the landing's number where the stream holds no bytes), releases it to the
handle's queue family and waits on its own fence. An import or write the stand-in cannot
make is counted on the exported-surfaces line and the play goes on.

The backend also counts what the runtime's hand-overs follow from, per frame: commits
whose command buffers name a texture in an exported surface, the makings a submission
carried, the pictures landed, and CPU calls on such textures (frames with those are not
judged). The report's hand-over line compares each frame's external_acquires and
external_releases with the runtime's Metrics contract at this commit: one acquire per
such submission, one release per such submission plus one per submission carrying a
making.

Unverified at this commit: the lavapipe run follows.
2026-12-02 05:39:49 -08:00
Anees Iqbal e4c206f759 Validation tests: an exported surface's snippet, its hand-overs per picture as the runtime's contract says
What: snippets::video_surfaces writes a synthetic stream of our own: one exported surface of a
64x36 8-bit 4:2:0 picture's two planes (m2v.newExportedSurface, m2v.surfacePlane, a view of the
luma plane, m2v.exportSurface), then three pictures of our own bytes (m2v.surfaceWritesDone), each
in a frame of its own: two submission parts (m2v.split) read the planes back into Shared buffers,
a third command buffer uses none of the surface, and m2v.check compares the read-backs with our
bytes. The device test plays it for each handle the host has and asserts that every frame's
external acquires and releases agree with the report's hand-over line (the runtime's documented
contract), that every check matches, and that nothing is skipped; a handle the device does not
export is counted and passed over.

Why: no recorded stream carries the exported-surface hand-over the consumer's video uses; this
test fails until the player plays the record family (it refuses m2v.newExportedSurface now).

Verified: not yet run; its first run is the red one, before the player change.
2026-12-02 05:39:48 -08:00
Anees Iqbal 6ae68f6eab Runtime tests: an acquire from the general layout moves an image over another API's memory home
The layouts recorder's moves() took an image's move home to be a barrier of its first level from
the undefined or the preinitialized layout, so a texture over a dma-buf in place, whose move home
is its acquire from the foreign queue family from the general layout (Vulkan's section 12.10.1:
that acquire's layout is the image's true initial layout), would have been noted as a step before
its move home, as would a Direct3D 11 plane's first acquire. No test read moves() for either.

The recorder now keeps the memory allocated from another API's handle (VkImportMemoryFdInfoKHR,
VkImportMemoryWin32HandleInfoKHR, through vkAllocateMemory) and the images made with external
memory info that vkBindImageMemory binds to it. For such an image alone, an acquire of its first
level from the external or foreign queue family from the general layout is its move home where
it has not moved home, and a use after. For every other image a first move from the general
layout stays a step before its move home. An exported surface's dma-buf planes are bound to the
runtime's own imports of its export, which the record does not tell from another API's; the
module doc says so.

Tests: a device-free test of the step a barrier is (an acquire over another API's memory, over
the runtime's, at another level, a release, a plain barrier, from undefined) and of take() (the
first acquire a move home, the second a use, a plain barrier first out of order); and import_overs'
dma-buf layouts test reads moves() and asserts no step out of order.

Also: forget() gets its own doc line, and barriers()'s doc is back above barriers().
2026-12-02 05:39:48 -08:00
Anees Iqbal 28a4ee50a8 Runtime README: a dma-buf texture's first acquire names the general layout by convention, not by a sentence
The planner's ruling on d789ca7aa5. The first acquire of a texture in place over a dma-buf's import
names the general layout as its old one, though the runtime has released nothing yet and the
image was made undefined. For a Direct3D 11 plane that layout stands on section 12.10.1 with
Table 17 (External Image Implied Layouts). Table 17 lists no dma-buf handle type, and section
12.10.1 leaves layouts to the other API, so no sentence names the dma-buf's layout there: the
first acquire's old layout is general by the same convention as the later ones. Imported blocks
says so, and Known gaps of memory blocks lists it. The undefined layout there would discard the
bytes, so the code stays.

Docs only.
2026-12-02 05:39:48 -08:00
Anees Iqbal 5ae5d0a169 Runtime tests: the external-image check compares its layout with assert!, ImageLayout having no Debug
no_external_preinitialized used assert_eq! on a vk::ImageLayout, which this build of ash gives no
Debug, so the runtime's lib tests did not compile at 49583b80c0 (lavapipe jobs m3-max-77905 and
m3-max-77906 stopped at E0277). The check now compares with assert! and prints the layout's
number, as the message already did.
2026-12-02 05:39:48 -08:00
Anees Iqbal e61d47452f Runtime README: a write to an imported dma-buf through another mapping is a host write
The planner's ruling on the aliased-write row. Imported blocks' coherence paragraph says that rt
takes a write to an imported dma-buf's pages, made through another mapping of the same pages, as a
host write to that memory, and that rt imports a dma-buf only into a host-visible, host-coherent
type on a device whose Shared type is host-coherent, refusing otherwise
(Limit::ImportCoherence, Limit::ImportType), so no flush or invalidate is owed (import.rs at
lines 420, 431, 439, 444, 530 and 696, read by main). Known gaps of memory blocks records that
Vulkan defines host access only through its own mapping and host-pointer imports, so the order of
such a write rests on the pages being the same and the type host-coherent, measured on the
Radeon 780M (RADV), not on a sentence of the spec.

Docs only.
2026-12-02 05:39:48 -08:00
Anees Iqbal 6fe011608a Runtime: a texture over a dma-buf in place is acquired from the general layout, never preinitialized
A texture over a buffer in a dma-buf's import, in place, is a linear image made with the import's
handle, so undefined (VUID-VkImageCreateInfo-pNext-01443). Its move home is the acquire of the
image and the buffer's range under it from the foreign queue family, and that acquire's old layout
is the image's true initial layout (section 12.10.1). It named the preinitialized layout: the
Source::Over in-place arm of Device::new_texture set first to PREINITIALIZED for every image in
place, the dma-buf's included, and Image::homing's foreign acquire named it.

The planner's ruling: no image with external memory info is named in the preinitialized layout,
and the acquire names the layout the memory was released in. The arm now sets first to
PREINITIALIZED only for an image of the runtime's own memory (made preinitialized, Laid::Own); the
dma-buf's image keeps first undefined, and homing's foreign acquire names the general layout
(first.old_layout(home)), the layout of the runtime's own hand-overs, in which a linear image and
the buffer are host-accessible aliases that read the bytes alike (section 12.11). copy_layout,
which took a preinitialized first to mean an image in place, also takes an image with a foreign
acquire as one, so a copy keeps it in the general layout. writes_whole already excluded it.

After this, no product code names the preinitialized layout for an image made with external
memory info: the remaining PREINITIALIZED sites are the in-place arm for the runtime's own memory
(texture.rs:1718), the probe image of linear_layout (texture.rs:2556, never bound) and
image_create's None-handle arm (texture.rs:3421); the handle arm makes undefined.

README: Imported blocks and Buffer::new_texture name the general layout as the acquire's old one.

Pinned by the previous commit's test (import_overs:
every_device_names_a_texture_over_a_dma_buf_in_no_preinitialized_layout), red before this commit
and green after on lavapipe (llvmpipe); jobs reported with the series.
2026-12-02 05:39:48 -08:00
Anees Iqbal 30b21e5ffb Runtime tests: no command names an image made with external memory info in the preinitialized layout
The layouts recorder keeps each image made with VkExternalMemoryImageCreateInfo in its chain, with
the layout it was made in. no_external_preinitialized checks every such image of a device: made
undefined (VUID-VkImageCreateInfo-pNext-01443), and named in the preinitialized layout by no
command. An acquire's old layout is such an image's true initial layout (section 12.10.1), and
Vulkan names the preinitialized layout only as one an image is made in and, under memory
aliasing, as the old layout of a move after host writes through an alias (section 12.11).

Two tests use it, each under a recording:
- import_overs: a texture over a dma-buf's buffer, read by a blit; exact against the CPU's bytes,
  and in place exactly one external image named.
- surface: every row the device exports, on the 1080p picture: read after external_writes_done,
  then written by a blit; every plane in place named.

At this commit the dma-buf test fails where the texture takes the form in place: the image's move
home is the acquire from the foreign queue family from the preinitialized layout
(texture.rs, the Source::Over in-place arm sets first to PREINITIALIZED for the dma-buf's image
too; Image::homing's foreign acquire names it). The next commit fixes it.
2026-12-02 05:39:48 -08:00
Anees Iqbal d562f130a6 Runtime: a making's wait for the work lock is a home lock wait; the ready-order test reads the semaphore
Work::create, which an exported block's or surface's make calls to owe its making to the next
submission's upload, waits for the submit side's work lock as a texture's move home does. It now
times that wait as Part::HomeLock, so Metrics::home_lock_waits counts it again; the hand-over change
moved the surface make's upload entry into Work::create and left the wait untimed, and
make_parts' every_device_times_an_exported_surfaces_make_by_part expects one home lock wait per
make. The counter's doc names the exported make.

every_device_completes_a_surface_s_making_before_its_ready_wait_returns read the device's
completed progress (Done::completed), which the completion thread raises after the progress
semaphore does; the ready wait returns on the semaphore. The test now reads the semaphore's own
value (vkGetSemaphoreCounterValue), which the ready wait's return orders after.

Failing before: both tests on lavapipe (llvmpipe), runtime suite job m3-max-77883 at 6559c48acd.
2026-12-02 05:39:48 -08:00
Anees Iqbal 4ea93af18c Runtime tests: a picture loop's hand-overs, counted per picture
every_device_counts_a_picture_loop_s_hand_overs runs, for each row the device exports on the
1080p picture, 8 decode pictures (the other device writes, external_writes_done, rt reads through
the planes) and 8 encode pictures (rt writes the planes by a blit, the other device reads through
the handle) after one warm-up of each, each read exact, and prints each picture's barriers,
runtime command buffers, submissions, acquires and releases counted around rt's calls alone. It
is the before-and-after measure of the hand-over: the same loop at 21d219b089, with the release
call the consumer's encode path made there, runs on a scratch branch; no lab recording carries
decoded pictures (main, 12-02). Printed only.

Verified on lavapipe with the before run; reported with the lane's tip.
2026-12-02 05:39:48 -08:00
Anees Iqbal 2113de81cb Runtime: the hand-over's private docs name Image::making and Upload::hand_over
6559c48acd renamed Image::made to Image::making and folded Upload::make_handed into
Upload::hand_over, and four private doc links still named the old items: the private-items
rustdoc of the runtime failed on them (job m3-max-77880, the Linux node's privdoc step; its
public rustdoc, gpu clippy and the validation crate's clippy passed there).

Verified by the next privdoc run, reported with the lane's tip.
2026-12-02 05:39:48 -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 6557e60115 Runtime tests: a picture the other API writes after rt's read is read with no release call between
The consumer's video paths (VA-API into a dma-buf surface, NVIDIA's decode into an opaque one)
call Surface::external_writes_done before each picture and release_surface_to_external only in
their encode fills, so every acquire after a surface's first has no release of rt's to match
(VUID-vkQueueSubmit2-commandBuffer-03879: "there must exist a previously submitted Queue Family
Ownership Transfer Release Operation ... with parameters matching the acquire operation").

The new test makes each row's surface (the VA-API dma-buf, the NVIDIA opaque handle, the copy form)
at 1080p, waits for its ready point, and has the second device write picture 1, then the
consumer's call and rt's read; then picture 2 the same way, with no release call between. Each read
must be its picture's exactly, the validation layer silent, and each read's submission must count
one acquire and one release of the surface's memory (Metrics::external_acquires,
Metrics::external_releases). At this commit no submission releases the surface, so it fails there.
2026-12-02 05:39:47 -08:00
Anees Iqbal a57f18224c Runtime: a serial dispatch that writes after a read through an address outside every resource takes a barrier
A serial compute encoder recorded no barrier between a dispatch that reads through an address
outside its resources and a later dispatch that writes a resource through its slot or a
use_resource declaration, so on Vulkan the write could overlap the read and the read see its
bytes. Metal runs a serial encoder's dispatches in dispatched order (MTLCommandBuffer.h:
"Command encoder dispatches are executed in dispatched order"), and the README held that such a
pipeline conflicts with any write. The hazard sets marked nothing for the read
(Hazards::mark_wild_read set touched alone), and Building::dispatch_hazards tested an unbound
read against earlier writes and an unbound write against any earlier access, never a write
against an earlier unbound read.

Now Hazards keeps read_wild since the last barrier, set by mark_wild_read and cleared with the
sets, and a dispatch any of whose accesses writes conflicts with it, counted in
Metrics::dispatch_unbound_barriers (its doc says so). The flag covers any resource: what an
address read reaches is whatever the guest made resident, residency sets included, which the
runtime does not see, the breadth the rule already takes for an unbound read after any write.
The README's serial-encoder sentence and use_heap's doc say the read orders before later writes.
No public change; no new form. The barrier is the one an unbound access already takes.

Verified: not run yet; the lavapipe run of every_device_orders_a_write_after_an_unbound_read,
the runtime suite and clippy follow.
2026-12-02 05:39:47 -08:00
Anees Iqbal 58305fb9cd Runtime tests: a serial dispatch that writes after a read through an address outside every resource takes a barrier
A serial compute encoder records no barrier between a dispatch that reads through an address
outside its resources and a later dispatch that writes a resource through its slot or a
use_resource declaration: the read marks nothing in the hazard sets (Hazards::mark_wild_read sets
touched alone), and the unbound test in Building::dispatch_hazards looks at earlier writes for an
unbound read and at any earlier access for an unbound write, never at an earlier unbound read for
a write. Metal runs a serial encoder's dispatches in dispatched order (MTLCommandBuffer.h), so the
read sees the bytes from before the write; on Vulkan the two may overlap.

every_device_orders_a_write_after_an_unbound_read: the wild step kernel (reads_unbound) over y,
then step over x, in one serial encoder; it asserts one barrier in the unbound source and two
barriers with the segment's end. It fails before the fix (no source, one barrier).

Verified: not run yet; the lavapipe run follows.
2026-12-02 05:39:47 -08:00
Anees Iqbal d8735b75f0 Golden tables: bless at semantics 2310 for the high-word carry and the dominating slot base
The golden hash table was last blessed at semantics 2307 (031c37d674). Two translator commits
since then change emitted SPIR-V and bump SEMANTICS_VERSION to 2310: 2a42256955 carries biased
buffer offsets into the high address word, and e2e76d8879 makes a slot's direct base and address
once where they dominate. golden_hashes_match_the_table therefore reports a bless due, not a
missing bump.

What moved, read from the table's diff: 2310 of 3600 rows, every one hash to hash. No refusal
class changed, no fixture source hash changed, and no row was added or removed. That is 19275
cells: 10086 in .ll fixtures, the count the Linux run reports, and 9189 in .air.ll fixtures,
which only a macOS run computes. Every changed row's fixture source holds a device or constant
buffer pointer, which is the path both commits change. The 137 rows whose fixture has none did
not move.

The table is the only file changed. Every other test in the same core run passed, and the
public cases ran at 7adf1d6603 with new_mismatch 0 on lavapipe, the Iris and the 780M.

Blessed on the M3 at 7adf1d6603 (job m3-max-78055: inventory, golden and printouts all exit 0;
only golden_hashes.tsv changed).
2026-12-02 04:13:30 -08:00