Commit Graph
3125 Commits
Author SHA1 Message Date
Anees Iqbal 8c19e8bf97 ycbcr_textures: Kernels::quantizes asks the list with contains, as clippy's manual_contains asks
(cherry picked from commit ec5bbee96a13ac7496f1088bb6fc9b3885c11008)
2026-11-09 05:12:12 -08:00
Anees Iqbal 8fc9e3dd68 Half reads through the device's quantize may read a value below 2^-14 as the zero of its sign
On a device without shaderFloat16 (the RX 550, RADV POLARIS12: shaderFloat16 and the 16-bit float
controls all false) a half is rounded by the device's OpQuantizeToF16, whose result below the
smallest normal half Vulkan leaves to the device as that value or the zero of its sign; every such
stage records PrecisionNote::NativeHalfQuantize (lower::arith::narrow::quantizes) and its making
announces native-half-quantize. RADV gives the zero, and four lane checks held Metal's denormal:

- tile_normalized's reads through halves (RG16Unorm code 1, 1.5258789e-5, read 0);
- ycbcr_device_reads' half read() and nearest half sample of a device-converted texture
  (-5.4e-5 and an sRGB twin's 4.86e-4, read 0), through its two callers' tests;
- ycbcr_textures' half gathers of a device-converted texture (-1.09e-5, read -0).

Each now asks the stage's notes (made_tile_kinds, stage_notes) and, where it records
NativeHalfQuantize, takes a zero of the right sign for a value whose device float may lie below
2^-14; anything else stays a failure, and tile_normalized prints how many channels read such a
zero. Where the stage records no such note the checks are as before.

(cherry picked from commit 758edd19354d1d1982c63c960648c87343018824)
2026-11-09 05:12:12 -08:00
Anees Iqbal 7324384287 dma-buf lane: a heap texture is an image only where the device lists the modifier extensions
What: the lane expected every heap texture over dma-buf pages to be an image
over a dma-buf of its own pages wherever the device imports dma-bufs (keyed on
RADV). The runtime makes that image only where the device enables
VK_EXT_image_drm_format_modifier and VK_EXT_queue_family_foreign beside its
imports; elsewhere the texture is a shadow of the heap's bytes, counted as a
fallback and announced as shadowed-texture naming the two. The lane now reads
which route to expect from the device's own extension list
(`makes_dma_buf_images`, which prints what is missing):
- the no-copy heap texture: an image, or one fallback with the source not
  asked for the texture; the heap's pages are compared only for the image;
- the source-fails fallback: the source is asked twice for an image route,
  once for a shadow, and the notice names the failed dma-buf or the missing
  extensions;
- the rebind: an image made again where the device makes them, the new
  source asked once more for it; the new pages compared only for an image;
- the source-runs-unlocked heap texture: an image or a fallback.

Why: on the RX 550 (RADV, POLARIS12) these four tests failed. A probe
printed the shadow's notice: "the device enables no
VK_EXT_image_drm_format_modifier and VK_EXT_queue_family_foreign beside its
dma-buf imports: its image is a shadow of the heap's bytes". That is the
runtime's documented route for such a device, so the expectation was wrong,
not the product.

(cherry picked from commit 7aecc7e810ac6fb75d2904f9c4c43ee560e1c58e)
2026-11-09 05:12:12 -08:00
Anees Iqbal c8a41e013d Fetch gate: the alpha_in_red color inputs, color_groups' fetch scene and four extended-range blends
The RX 550 run of development (potluck 11625) found seven more tests unwrapping the typed
FramebufferFetch refusal: alpha_in_red's two A8 color-input tests, the device-width color_groups
scenes (whose fetch scene and cg_fetch pipeline need a fetch form) and four extended_range_blends
tests (a blend into an extended-range color holds its shadow in the pixel interlock). Each opens
with framebuffer_fetch::fetches; color_groups skips only its fetch scene and requires cg_fetch's
refusal to be FramebufferFetch where the device has no form.

(cherry picked from commit a63850737a463164609dc0ba99c53cf21d7156e0)
2026-11-09 05:08:51 -08:00
Anees Iqbal 64815698b5 Fetch gate: every framebuffer_fetch submodule that opens with the gate imports it
The gate's calls landed in twelve submodules without their import; the um790 build of 43b7948cc0
(potluck 11622) failed on them (E0425).

(cherry picked from commit 2d545658fcb41408e73c8cc896098b6cbd667b72)
2026-11-09 05:08:51 -08:00
Anees Iqbal 268df0f603 Fetch, imageblock and stencil-output lane tests skip a device with no form, after its typed refusal
On the RX 550 (RADV POLARIS12, GCN4) neither rasterization-order colour attachment access nor the
fragment shader pixel interlock is there, so every fetching, imageblock and shader-side-stencil
pipeline is refused as Unsupported, the device's honest answer; the lane tests unwrapped those
refusals and failed (sweep's survey: 56 framebuffer_fetch-family tests and 3 fragment_imageblocks).

One test-level gate per capability, which every such test opens with:

- framebuffer_fetch::fetches(device) replaces blend16's per-draw fetch_unavailable skip;
- fragment_imageblocks' Fixture::imageblocks;
- shader_stencil's Lane::outputs_stencil, per run (as opened, and with
  VK_EXT_shader_stencil_export withheld).

Where the profile has the form (input attachments or the interlock for fetch; the interlock and
fragment stores for imageblocks; the extension or the interlock for the stencil output) the gate
makes nothing, so a test's count of makings stays its own (assert_made_once). Otherwise it makes
one state of the capability, requires Unsupported of that feature, prints a FETCH-SKIP,
IMAGEBLOCKS-SKIP or STENCIL-SKIP line naming the refusal and the device, and the test returns.
Any other answer there fails the test. Shared helpers gate once (blend8's srgb_blends, the
cases_at of returned_stencil, shader_depth and stencil_stand_in, storage_forms' beside, now an
Option).

(cherry picked from commit 43b7948cc0255728e921cfd8aa96770a6fe735e5)
2026-11-09 05:08:51 -08:00
Anees Iqbal 612f5dcfba SEMANTICS_VERSION 2002 for a front_facing argument held in an integer
nvreds 0950743006: an older front end's i8 [[front_facing]] argument
(i8 + trunc to i1, seen in an iOS-simulator library from metalfe-32023.884)
now translates: the Bool builtin is OpSelect'ed to 1/0 in the argument's
integer form. Inputs that were refused now translate, so SEMANTICS 2001 ->
2002. Golden hashes expected unchanged (no committed fixture has an integer
front_facing; not checked here).

Verified by nvreds on gem10 (debug): clippy -D warnings for metal2vulkan and
metal2vulkan-air, all targets/features; 100/100 tests over front_facing,
stage_io, engine_fragment, air_abi, engine_line_band (11689); negative control
4dd15ecbd1 fails the new engine_front_facing_byte test with the reported
refusal (11690). Here: signatures --check and refusal surface unchanged.
2026-11-09 05:05:54 -08:00
Anees Iqbal 7c6e9d1fcf Read an i8 [[front_facing]] argument as the face, 1 or 0
What: a fragment argument whose `air.front_facing` metadata names the
builtin and whose type is an integer scalar (an older front end's ABI:
metalfe-32023.884 at air64-apple-ios13.0.0-simulator passes
`bool [[front_facing]]` as `i8`, read through `trunc i8 %0 to i1`) now reads
the FrontFacing builtin and holds it as 1 or 0 in the argument's integer
form (a select of the loaded bool). Before, `input_builtin` took the
argument only as a `bool`, so the i8 form was refused
`NotImplemented(StageIo)` at the argument's metadata. The decision is the
argument's type with the builtin's metadata; no name is read. The
`i1 zeroext` form is unchanged.

Test: tests::engine_front_facing_byte, a module written here (today's
compiler emits no such shape and regen-air-fixtures cannot make one) with
`ff_bool` (i1 zeroext) and `ff_byte` (i8 + trunc) side by side: both
translate, link and pass spirv-val on every committed profile with no
precision note; ff_byte's module selects 1 or 0 on the FrontFacing load,
ff_bool's selects nothing on it. Without the fix ff_byte is refused.

(cherry picked from commit 0950743006c6011c5c136f80f4b48d2d0a43b392)
2026-11-09 05:04:59 -08:00
Anees Iqbal fc668f8ec6 RUNTIME_VERSION 1972 and the runtime-sources pin for carried buffers' calls that hold the lost generation's parts
The race fix (exitcrash 8910b47c56..5ccc385768): a Buffer call outside command
buffers' work (textures over its bytes, exports, did_modify_range,
set_purgeable_state, vk_buffer/vk_host_memory) holds the parts it read, and
the lost generation's release at rest waits for the last hold. Runtime
behaviour changed, so RUNTIME_VERSION 1971 -> 1972 and the pin is recomputed.

Verified by exitcrash: lavapipe 11680 at 5ccc385768 runtime recovery 27/27
(new test included), lane recovery 6/6, clippy plain/cpuicd/gpucfg, rustdoc,
refusal check; negative control 5c523b175c fails the new test at
!first_parts_freed; Iris 11673 26/26, 7 recoveries end at 1 live VkDevice.
Here: signatures --check, refusal surface and coverage regenerate unchanged.
2026-11-09 05:04:58 -08:00
Anees Iqbal 3e81231551 Carried buffers' held parts: clippy clean
LostBuffer::release_now takes the parts by value (clippy's boxed_local), and
the device tests' helpers (Buffer::first_parts_freed, Carry::at_rest) compile
only with the device tests, as the crate's other such helpers do.

Verification: lavapipe 11672 at 3b4443dc3b ran the recovery tests (27/27, the
new held-call test among them), the lane's (6/6), and the negative control
(the held-call test fails: the parts went under the parked call); this commit's
clippy in the three configurations follows.

(cherry picked from commit 5ccc3857687af7ffe57c54f2cdb4d04462287f94)
2026-11-09 05:03:58 -08:00
Anees Iqbal dc936fbb33 Buffer::held_parts: a name apart from Buffer::held, and the test's hook on its own thread
Buffer::held (the reference a command buffer holds a buffer by) was there
already: the parts' hold is Buffer::held_parts. The test imports PixelFormat
and TextureUsage from metal2vulkan::metal, as the other tests do.

The hook that parks the call is thread-local, set on the call's thread just
before the call, so no other thread's hold (a device thread's texture
placement, say) takes it.

Verification: the lavapipe and Iris runs that follow.
(cherry picked from commit 3b4443dc3b43b444016a0be76583ddddbd446761)
2026-11-09 05:03:58 -08:00
Anees Iqbal 15ea040ef0 Buffer::held: follow a marked link to the generation carried to, joining one a call holds back
Where a thread's reads answer a lost generation (inside such a hold) and that
generation's parts of the buffer were marked let go of, Buffer::s answers the
same marked link again, so the loop in held() would spin there. held() now
takes the next link itself, and joins a marked link whose release a call under
way holds back (its parts go only once the last such call ends), so a call
nested inside another stays on the generation the outer one holds.

Verification: with the race fix's test runs (lavapipe, Iris).
(cherry picked from commit 0145c6e8c69abcb452fdbc66425c2c0a74746136)
2026-11-09 05:03:58 -08:00
Anees Iqbal b126bdbc72 Carried buffers: a call outside command buffers' work holds the parts it read past the lost generation's rest
Closes the race left open in 1a. A thread inside a Buffer call that read a
carried buffer's lost-generation parts just before the carry could hand the
driver a VkBuffer or memory that the generation's rest had just destroyed.

The Buffer calls that reach the buffer's Vulkan objects outside command
buffers' work:

- textures over its bytes: new_texture, new_linear_texture,
  new_tiled_texture, new_texture_with_iosurface_plane, and the three
  placement queries;
- export_memory_fd, export_memory_dma_buf, external_write_done;
- did_modify_range (the staged upload);
- set_purgeable_state (Empty clears the bytes);
- vk_buffer and vk_host_memory.

The no-copy-only calls (rebind, detach, host_backing) are not carried yet.
Event host calls already counted their uses (HostUses).

- Buffer::held: each listed call holds the parts it read. The count is per
  link, under a small lock that the parts' release also takes. A release at
  rest that finds a call under way leaves the parts to the last such call to
  end (LinkCalls::waiting). A call that finds the parts already marked takes
  the generation the buffer was carried to. While held, the thread's reads of
  the buffer's parts answer the held generation (NoticesFor::of_generation),
  so the call never mixes generations. carried() now skips only parts that
  went (FixedPages::freed), not parts merely marked.
- Handles handed out (Buffer::vk_buffer, Event::vk_semaphore) may be used by
  the caller while the object lives. Their parts, and the lost VkDevice, now
  stay until the object goes. The interop docs say so.

There is no cost on draws, encoders or command buffers: the hold is taken
only by the calls listed above.

Test (device_recovery_carry):
a_call_under_way_keeps_the_parts_it_read_past_the_lost_generation_s_rest
parks a texture-over-buffer call inside its hold (a cfg(test) hook in
Buffer::held), then recovers. The lost generation comes to rest, the
buffer's parts there stay, and the buffer serves on the next generation.
Released, the call completes on the lost generation, and the parts go.

(cherry picked from commit 8910b47c5672e7e15eac8b03aa877e3c78c359a6)
2026-11-09 05:03:58 -08:00
Anees Iqbal 4c685abaf4 RUNTIME_VERSION 1971 and the runtime-sources pin for batches counted pending from the tracker's one read
nvreds' option C for the XTX commit_work flake: the submit path counted
batches_with_none_pending from a second read of the queue's completed value, which could see
completion the tracker's plan did not; the count is now Tracker::pending_before(at), from the
value the plan retires by (4e4ea3cfa3). A deterministic tracker test of the lane's chain shape
(c73e449936), and the lane's assertion made exact: bare starts == batches_with_none_pending, no
rounds, no retry (70606ff48d). The runtime changed, so RUNTIME_VERSION 1971.

Verified (nvreds): gem10 11634 tracker unit tests 72/72, clippy plain and m2v_gpu clean for the
runtime and validation; XTX 11644 the two chained lane tests 24/24 at the tip (8 copies behind
work in flight, each with its barrier) against a negative that drops same-queue barriers (24/24
fail 'left 9, right 1', and both new unit tests fail). Here: the API-signature check, REFUSALS.md
and CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt clean.
2026-11-09 04:38:02 -08:00
Anees Iqbal 87a17202c7 commit_work: a chained batch begins bare exactly where nothing before it was in flight
The exact-form test asserted one bare start (the long fill's) of nine batches, which held only
while every copy was planned before the GPU finished the work ahead of it. The scheduler holds the
long fill on the host until the host raises the event (no batch is submitted waiting for a value
the host may set), so the chain is planned after the raise, and on the RX 7900 XTX a 1 GiB fill
sometimes finished first: 7 of 24 runs at aeaa4844ee counted 2 to 5 bare starts, each a copy that
correctly needed no barrier. The runtime has no way to hold GPU work in flight for the host, so the
premise can't be made to hold by construction through the public API.

The assertion is now the rule itself, with no retry and no widened bound: under the exact form,
bare_starts equals batches_with_none_pending, both counted from the completed value the plan took
(the commit before last). Ends and the stall fact keep their counts. The barrier side is proved by
construction in tests::tracker's chain test; the printed line says when a run exercised only the
bare side. The long fill goes from 1 GiB to 16 GiB, so the barrier side usually runs.

(cherry picked from commit 70606ff48d9680f4151b3993cba34a510b5ee1b1)
2026-11-09 04:37:15 -08:00
Anees Iqbal e34008c733 Tracker test: a chain of copies orders each after the one before only while it is in flight
The shape of runtime_lane::commit_work's chained batches, planned by the tracker with its state
set: a fill of link 0, then eight batches each copying the link before into the next. With every
earlier batch unseen complete, each copy plans a barrier after the write before it and counts
every earlier batch pending; with the batch before each completed as it is planned, no barrier
and nothing pending. The device lane can't hold work in flight for the host (no batch is submitted
waiting for a value the host sets), so the barrier side is proved here by construction.

(cherry picked from commit c73e449936efeef870d76d6f15b18157a13e6609)
2026-11-09 04:37:14 -08:00
Anees Iqbal eb68e03449 Submissions count a batch's pending work from the completed value its plan took
command_buffer/submit.rs read each VkQueue's completed value once for the hazard tracker, whose
plan of the batch orders after the work it has not seen complete, then read its own queue's value
a second time for WorkCounts::batches_with_none_pending and kin. A completion seen between the two
reads made the count say "nothing pending" of a batch the plan had ordered after work in flight,
so bare_starts and batches_with_none_pending could disagree for the same batch.

The count now comes from the tracker's own state: Tracker::pending_before(at), the batches of at's
queue before it past the last value Tracker::completed took for that queue, the value the plan
retires by. The second read is gone.

Test: tests::tracker::a_batch_is_counted_pending_behind_exactly_the_work_its_plan_orders_after: a
read after a write planned with the write's batch unseen has a barrier and counts it pending, and
planned after its completion neither; another queue's completion and an older value leave the
count as it was.

(cherry picked from commit 4e4ea3cfa3d5412d14a2df75d8ccf60ae8440feb)
2026-11-09 04:37:14 -08:00
Anees Iqbal 154d0e2734 RUNTIME_VERSION 1970 and the runtime-sources pin for a device recovery carrying events, Private and fresh-page buffers
exitcrash's MadeBeforeRecovery 1a (16 commits, steelbrain/exitcrash-recovery 158e85f26a). Metal keeps
every object across a GPU recovery; the runtime refused each object made on the lost generation, and
a refused encodeSignalEvent:value: ended the consumer's VM. Now a recovery carries events (at the
value the host saw land, with their listeners), Private buffers (new memory that reads zero,
announced) and fresh-page buffers (imported again: same contents() pointer, same bytes, including
those in exportable blocks never exported). Pooled Shared/Managed buffers, no-copy buffers, buffers
over the caller's VkBuffer and exported memory or events stay refused and are counted in the
recovery's notice. Once the line serves past the lost generation and none of its queues' slots is
held, the lost generation comes to rest: carried objects' parts there, its work objects, recyclers
and kept or ahead blocks are freed, carried objects let go of it, and the lost VkDevice goes through
the single DeviceShared::drop path when nothing refused holds it. A generation never recovered pays
a flag load per command buffer and per buffer made, no lock or read-modify-write. The runtime
changed, so RUNTIME_VERSION 1970.

Verified (exitcrash): lavapipe 11612/11626 runtime recovery/event_timeline/detach_lost 26/26, lane
tests under the layer 6/6, clippy plain/cpuicd/gpucfg and Rustdoc clean, refusal_surface --check 0;
Iris 11620 25/25, 7 recoveries in 478 ms ending at 1 live VkDevice; 780M PHOENIX 11621 25/25 with
CARRY-PRIVATE-BLOCK true (the exportable-block carry ran), 9 lost blocks -> 1, 7 recoveries in 351
ms at 1 live VkDevice; negative controls 11618 (no rest: 7 recoveries leave 8 live; nothing
carried: MadeBeforeRecovery); M3 instructions a draw base -> tip 10k 5373 -> 5363, ws 17857 ->
17817, many 14468 -> 14453, 4 threads 20473 -> 20242. Open: a program thread inside a buffer or
event call begun before the carry can race the release of the lost parts (fix next); first-move
zeros (up to 8 MiB) stay until teardown while a refused object holds the lost generation. Here:
the API-signature check, REFUSALS.md and CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt
clean.
2026-11-09 04:26:59 -08:00
Anees Iqbal 4fdaf1de67 Carry test: let the device's checks answer before the Private buffer is made
A device's own buffers lie in exportable, never-exported blocks
(Holds::FdBuffers) only once its check of those blocks has passed. The test
made its Private buffer right after making the device, before the check
answered. So even on a device where the check passes (the 780M), the buffer
lay in a plain block, and the BoundMemory::Blocks carry was never exercised.
The test now waits for the device's checks (settle_in_place_checks) first.
CARRY-PRIVATE-BLOCK says which kind of block the buffer lies in.

(cherry picked from commit 158e85f26ac5f6adca19e4e6b2db255a2ecfb000)
2026-11-09 04:26:06 -08:00
Anees Iqbal ec101631cf Carry tests: the lost generation's blocks, not bytes allocated; the lane test lets go of its raw handles
The rest probe (m3-max-11599, a print of the rest check's inputs, never
landed) showed every lost generation coming to rest in both failing tests,
and releasing its carried parts. Both failures were in the tests.

- WorkCounts::device_memory_allocated counts bytes allocated so far, freed
  since or not, so it never falls. The carry test now checks the lost
  generation's live blocks (with a placement, or kept empty). The probe
  showed 2 before the loss and 1 at rest. The test also requires that the
  rest freed some (memory_frees.teardown).
- The lane test's device was made through creation_checked, whose
  creation_kinds reads the driver's pipeline cache through Device::raw. Those
  handles keep the first generation's VkDevice until a later raw() call, as
  the neighbouring test there says. The test now makes that call before it
  waits for one live VkDevice.

(cherry picked from commit 44a5fc55c935bf8c000884487f3561c5551e6734)
2026-11-09 04:26:06 -08:00
Anees Iqbal 3e14cb62dc Carry: a generation never recovered pays a flag load, no lock or count, per command buffer and per buffer
Main asked where 1a's per-command-buffer and per-encoder instructions come
from, and for no lock and no atomic read-modify-write on a generation that
was never recovered.

Measured on the M3 (draw_costs --calls, m3-max-11582): the tip, the base,
and the tip with one cost taken out at a time. The per-encoder counts move by
several hundred instructions between builds that differ only trivially, and
the base itself moved 350 between runs. No single 1a cost moves them
consistently. What 1a did add was structural:

- Per command buffer: a SeqCst fetch_add on the generation's shared
  recording count, then a SeqCst load, and at its end an ended.swap and a
  fetch_sub. That is three read-modify-writes, two of them on a counter that
  every encoding thread writes.
- Per program buffer made: a registry lock, a Weak push and a downgrade.

Both are gone:

- A command buffer already holds its queue's slot on its generation from its
  making to its completion or uncommitted drop. That is exactly the interval
  in which it may record. Slots are per queue per generation. The registry
  now knows each generation's queues' slots (Carry::queue, registered as a
  queue's place is made). The rest condition reads them under their own
  locks. A queue's last slot to come back loads the generation's taken flag
  (RestWatch) and looks for the rest only if it is set. Making a command
  buffer loads the same flag after taking its slot, and locks the registry
  only once the generation was taken (Carry::refuses). The slot's lock
  orders the two, so a command buffer that takes its slot as the generation
  comes to rest is either seen by the rest or sees it.
- The program's buffers are already kept in the device's program resources
  (Owners). The recovery now takes them from there, and records the ids it
  took under the registry's lock. A maker loads the taken flag after its
  Owners insert, and only then asks the registry whether the recovery took
  its buffer (Carry::late_buffer). So each buffer is still carried once.

What stays: a flag load per command buffer made, per program buffer made,
and per queue's last slot back. Events are still kept in the registry under
its lock as each one is made, since no other registry of events exists.
NoticesFor's scope stores two words, as one Option<ObjectId> did before.

(cherry picked from commit 5b5e735e96b76a1d44e3575519a6f81b442a4669)
2026-11-09 04:26:06 -08:00
Anees Iqbal 8dfec09eb7 Carry test: say which kind of the device's own blocks the Private buffer lies in
So a run shows whether it exercised the exportable, never-exported kind
(BoundMemory::Blocks) that the previous commit carries, or the plain kind.

(cherry picked from commit 03501b904ed46e2af2e9af4946ffc22d1f540361)
2026-11-09 04:26:06 -08:00
Anees Iqbal 75223b12f2 Carried buffers: a buffer in an exportable block that was never exported is carried too
development added blocks for the runtime's own buffers that are allocated
exportable as FD_BLOCKS_HANDLE and never exported (Holds::FdBuffers). Once
the device's check of them passes, a device's own buffers, Private ones
included, lie in those blocks. bound_memory answers BoundMemory::Blocks for
them. The carry let only BoundMemory::Own through, so on such a device every
Private buffer would have stayed refused as the caller's memory.

Blocks is the runtime's own memory, as Own is: both are carried now. The new
generation places a carried Private buffer in a plain block. Any of a
device's buffers may lie there, as they do until the device's check
answers.

Found while rebasing 1a onto development 1dcb4eb4a6, by reading the new
bound-memory kinds. No run yet shows this path.

(cherry picked from commit 1f2ebd581c0276ecab5b172cfb63f371b522bdc6)
2026-11-09 04:26:06 -08:00
Anees Iqbal 17a5559a83 Carry test: three buffers of three eighths of a block for the memory the lost generation keeps
The Iris run at f9a367d0bb (m3-max-11504) failed the same way lavapipe did:
192 MiB held before the loss and 192 MiB at rest. A buffer of exactly half a
block becomes a dedicated placement wherever a driver pads its size past
half, and a dedicated block is freed as it empties. Three buffers of three
eighths of a block each are pooled whatever the padding. Together they are
more than a block, so one of them lands in a block apart from the test's
other buffers.

(cherry picked from commit eff7eaff9ac041894792ae8e4899003539aa38b3)
2026-11-09 04:26:05 -08:00
Anees Iqbal 7929e445fe Carried buffers: a lost generation at rest stops its blocks being made ahead; the test's kept memory takes a block of its own
The carry test failed on lavapipe (m3-max-11503, at f9a367d0bb): the lost
generation held 64 MiB before the loss and 64 MiB at rest. The 40 MiB buffer
the test dropped to give the lost generation memory to keep had already been
freed, and everything else shared the one pooled block that the refused
pooled buffer keeps.

- The test now drops two buffers of half a block each. The second cannot fit
  in the block the first shares with the test's other buffers, so it takes a
  block of its own. The lost generation keeps that block, either empty or with
  the buffer parked in it, until the generation comes to rest.
- At rest (memory::keep_none), the lost generation used to free only the
  blocks whose making ahead had ended. A block still being made stayed until
  teardown, which can be the pooled buffer's whole life. Those makings are
  now stopped with the memory lock released, and their blocks freed.

(cherry picked from commit 2b4a3a5f8dcf2e956a43a12b8979a2680f20e140)
2026-11-09 04:26:05 -08:00
Anees Iqbal 25487ae2d0 Carried buffers: NoticesFor's scope back to two words; identity reads skip the carry check
The per-call costs (draw_costs --calls on the M3, job m3-max-11515, base
5edcb8d876 against f9a367d0bb) showed two costs. Calls that never touch a
buffer each cost about 14 instructions more: set_fragment_texture +14 and
set_fragment_sampler_states +13. On top of that came the buffer reads:
set_vertex_buffer +25, and draw_primitives +62 (10k) and +185 (ws).

- NoticesFor's thread-local scope grew from one Option<ObjectId> (two words)
  to four words. It is two words again: the command buffer's ObjectId number
  and the generation's address, each 0 for none (ObjectId::of_number reads
  the number back).
- held_by, identity, tracked, object_id, length and metal_address read the
  program's buffer directly. Every generation's parts keep these fields, and
  a heap's buffer is never carried, so they need no check of where the buffer
  was carried.

(cherry picked from commit 0c924d09963ed5b627f7e5166d9b43f53e017835)
2026-11-09 04:26:05 -08:00
Anees Iqbal baa5cc9d3c Buffer: read its parts once in each method that reads them more than once
Buffer::s costs a relaxed load and a branch on each call. Eleven methods called it two to five times; they now bind it once at the top: resident, alias, copy_reach, bound_memory, clear, clear_first, fill_first_from, upload, note_acquire, make_aliasable and own_pages_device_local.
(cherry picked from commit 7b9258f8cadc6f9eecead178216f4670a9304c45)
2026-11-09 04:26:05 -08:00
Anees Iqbal 5c5dfe71ad Carried buffers: one TLS cell for notices and generation, and a relaxed flag ahead of next
The per-draw instruction count went up after the carry. With draw_costs on
the M3, base 5edcb8d876 against 2119bd969f, instructions a draw went from
5382 to 5546 for 10k and from 17836 to 18270 for ws (job m3-max-11493). Two
costs were on every draw:

- RecordsOn wrote a second thread-local beside NoticesFor's in every scope of
  command-buffer work. The generation now lives in NoticesFor's own cell,
  set and restored in the same access, and RecordsOn is gone.
- Buffer::s read next's OnceLock with an acquire load on every call. It now
  reads a plain carried flag with a relaxed load first, and next only where
  the flag is set, as the orchestrator asked.

(cherry picked from commit bb3fc8dbf66eb47614e3fad1562a70aeeb5016bf)
2026-11-09 04:26:05 -08:00
Anees Iqbal 8020011a52 Carry tests: what the lost generation kept for reuse goes; a carry lane test under the layer
The carry test's memory check compared the lost generation's allocation before
and after, and that failed on lavapipe (job m3-max-11487). There the carried
Private buffer shares its 64 MiB block with the pooled buffer that stays, so
freeing it frees no block. The test now drops a 40 MiB Private buffer before
the loss, which the generation keeps for reuse (parked, or its block kept
empty). It checks that the lost generation at rest holds at least those
40 MiB less and no empty block.

New validation lane test, carried_objects_serve_on_the_new_vk_device: a
Private buffer and a shared event are used after two recoveries under the
validation layer, and one VkDevice is left. The layer reporting nothing
checks that no lost VkDevice's handle reaches a new one.

(cherry picked from commit 0d317721b275c084cd66991337d0d6da730a1897)
2026-11-09 04:26:05 -08:00
Anees Iqbal 742e320bee REFUSALS.md for what a recovery carries; the carry test's notification sends plainly
REFUSALS.md is regenerated by scripts/refusal-surface/refusal_surface.py in job m3-max-11457, and its --check passes. MadeBeforeRecovery's row now says what the recovery does not carry and lists the exportable-event carry site. The carry test's notification no longer drops a Copy Result, which the CPU-ICD clippy rejected.

(cherry picked from commit ef076009e82d2bde7f29ff9a81608ec40e94cb6a)
2026-11-09 04:26:05 -08:00
Anees Iqbal d83c658475 carry: clippy's drain and append forms, and a plain flag in OwnedKernels::destroy
Clippy rejected collecting a full drain into a Vec and extending from one. The lost parts now move out one by one as they are marked, and the event's pending notifications move with Vec::append. OwnedKernels::destroy sets its flag plainly, with no mem::replace.

(cherry picked from commit d7cc6f4806e1f2948372fb274e619aedaadfe3d1)
2026-11-09 04:26:05 -08:00
Anees Iqbal 33675e87f1 Carry tests, and docs for what a recovery carries and leaves refused
New device tests (tests/device_recovery_carry.rs, under the CPU-ICD and GPU
cfgs):

- One recovery carries a Private buffer (same address, zero after) and a
  buffer in fresh pages. The fresh-page buffer keeps its contents pointer and
  bytes, and the host's writes through that pointer after the recovery reach
  the GPU's copy. It also carries a shared event: its value, its listener's
  notification and a GPU signal after the recovery.
- A pooled Shared buffer stays refused, and the notice counts it. It keeps the
  lost VkDevice, which then holds no empty block and less memory than before
  the loss. Dropping it takes the line back to one live VkDevice.
- Seven recoveries with a carried buffer and event in use between them end
  with one live VkDevice, and eight made.

The device_recovery helpers are shared with the new file.

Docs: RuntimeGap::MadeBeforeRecovery, the DeviceRecovered catalogue entry and
its consequence (runtime and API.md), the runtime README's lost-device
section, line.rs's module and recover_for_test docs, in_place.rs, the
validation lane's docs and the refusal surface's reach mark now say what is
carried and what stays refused. REFUSALS.md is regenerated in the next commit.

Not yet built.

(cherry picked from commit 68d68cdfbdbbac979e5097a8ad286416450790bf)
2026-11-09 04:26:04 -08:00
Anees Iqbal 17a35ba5c0 Lost generation goes once nothing records on it: device handles, semaphores and work objects
Following the orchestrator's decision for 1a, the lost generation of a
recovered device is let go of rather than kept alive by its carried objects.
Before this, every recovery left one more live VkDevice behind while carried
objects lived, and the 5080's driver refuses an 8th.

- Carried buffers, their pages and events hold their generation through
  MadeOn, a device handle let go of once the object's parts there went.
- A buffer names its generation by address for the RecordsOn compare, so
  nothing reads a handle that was let go of.
- Lost parts go in two phases: marked under the registry's lock, then
  released after it. Command buffers made after the mark meet none of them.
- Rest needs the line to serve past the generation. Once there, a lost
  generation refuses new command buffers (Recording::begin answers None and
  the queue refuses as on the lost device).
- At rest, the generation destroys its device-level work objects: internal
  submissions, the staging pool, owned kernels, the mipmap scratch and the GPU
  pools. It also closes its recyclers and frees its kept and made-ahead blocks.
  OwnedKernels::destroy now runs once.
- A carried event counts the host calls under way on its semaphore (counter
  reads, host-wait slices, reservations, the watcher). The last call, or the
  release when none is under way, destroys the semaphore. vkspec 7.4.4 bounds
  a wait on a lost device to finite time.

The lost VkDevice is still destroyed only through DeviceShared's drop. This
change adds no vkDestroyDevice site.

Work in progress: not yet built.

(cherry picked from commit f851e029dd4a4268d60e95bc936174c4ad2da715)
2026-11-09 04:26:04 -08:00
Anees Iqbal 4502a352af Device recovery carries events, Private buffers and fresh-page buffers to the next generation
A device's recovery now carries the program's events and the buffers whose
bytes no program pointer reaches, or whose pages the runtime owns, to the new
VkDevice before the line serves it. Each keeps its identity: ObjectId, hazard
key, Metal address (a share of its range), range token, label and purgeable
state. Until now they were refused afterwards (MadeBeforeRecovery), where
Metal's objects carry on.

- Events get a new timeline semaphore at the value the host saw. Its
  listeners' notifications move with it, and host waits go on with it.
- Private buffers get new memory at the same address, zero.
- Fresh-page buffers lie in the same runtime-owned pages, imported again on
  the new device: the same contents pointer and bytes.
- Pooled Shared/Managed buffers, no-copy buffers, heaps' buffers, the caller's
  VkBuffers, exportable memory and exportable events stay the lost
  generation's and are counted in the recovery's notice.

A command buffer of the lost generation that still records sees its own
generation's parts through a thread-local scope (RecordsOn). The scope is read
only for a buffer that was ever carried, so other buffers pay one load.

The lost generation's VkBuffers and memory go once none of its command buffers
can record (vkspec 5.2.3). After that the generation parks and keeps nothing.

Work in progress: not yet built. Tests, docs and REFUSALS follow.

(cherry picked from commit 962f9b61280c263f1a182ab0572ab28ce38fc9f6)
2026-11-09 04:26:04 -08:00
Anees Iqbal a543115fab RUNTIME_VERSION 1969 and the runtime-sources pin for NVIDIA's volume-plane resolve through the scratch
nvreds' 93795eaaa2: on the RTX 5080 Laptop (NVIDIA 615.71.09) a resolve into a 2D view of a 3D
image starting at depth plane 1 writes nothing (planes 0, 2 and 3 resolve correctly), the class of
RADV's RuntimeDriverDefect::VolumeResolveFirstPlane. NVIDIA's driver ID joins that defect's
affected table, so such a resolve goes into the scratch and is copied into its plane, announced
as resolve-scratch, as on RADV. No public variant added. The runtime changed, so RUNTIME_VERSION
1969.

Verified (nvreds): 5080 b5080 entry volres5080-041003, the view_attachments tests 3x at the tip
(3/3 pass) and 3x at the base aeaa4844ee (3/3 fail, "t3d_resolve_plane1: byte 64 is 0x11,
Metal's 0x33"); gem10 11608 the runtime's driver_defects and degradation tests 27/27, plain
clippy -D warnings clean for metal2vulkan, -runtime and -validation. Here: the API-signature
check, REFUSALS.md and CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt clean.
2026-11-09 04:16:19 -08:00
Anees Iqbal 2cbe8ce595 Volume resolves: NVIDIA's leaves plane 1 unwritten, so it resolves through the scratch copied into the planes too
On the RTX 5080 Laptop GPU (NVIDIA 615.71.09)
runtime_lane::view_attachments::a_resolve_writes_the_volume_plane_it_names failed at base and tip
alike, 3/3 each (t3d_resolve_plane1: byte 64 is 0x11, Metal's 0x33). Its VOLUME-RESOLVE lines and a
probe of resolve orders (scratch branch, never merged) show a 4x multisampled RGBA8Unorm attachment
resolved into the 2D view of a 4x4x4 or 4x4x8 volume that begins at depth plane 1 writes no plane:
the volume keeps every byte it had. Into the views at planes 0, 2 and 3 it writes that plane alone,
in every order tried (1023, 3210, 0123) and three times over into plane 1. A draw into plane 1
through the same kind of view writes it (a_volume_s_plane_is_an_attachment passes), and the
validation layer reports nothing, so the usage is the valid one RADV's defect row already cites.

Fix, the RADV fix's shape (c1a825d748): RuntimeDriverDefect::VolumeResolveFirstPlane gains an
NVIDIA_PROPRIETARY row, every NVIDIA GPU until a probe finds one clean. Its meaning is stated for
both drivers: the resolve is written where the view begins only at the image's first plane (RADV
writes plane 0 whatever plane the view begins at; NVIDIA's writes no plane from plane 1). There a
color resolve into a 3D texture's planes past its first, or into more than one, goes into the
scratch image of the pass's layers that is copied into the planes after the pass, announced as
resolve-scratch with the defect named. The variant, the table's doc, the resolve module's docs, the
notice's reason and docs/API.md's catalogue entry say so.

Tests: tests::driver_defects lists the defect for every committed NVIDIA profile (the RTX 5080
Laptop GPU's and the others'), so it fails without the row.

Verified: cargo fmt. The lane on the 5080 at this commit and at its base follows through potluck.
(cherry picked from commit 93795eaaa29dba62257ca9b4c569394e23c269da)
2026-11-09 04:15:29 -08:00
Anees Iqbal aeaa4844ee RUNTIME_VERSION 1968 and the runtime-sources pin for colour clears and fills taking either code by default
nvreds' 876cfd1402 (from 9a844f5c5f): a normalized channel a clear or fill leaves off a whole code
is in question on every device, as the spec allows either code, except where a measured row says
the device stores Metal's (ColorClearIsMetals, MoltenVK Apple9 load-op clears). This inverts the
old default. Removed from the public surface: DriverFact::ColorClearTakesEitherCode (both crates)
and its three device rows; the AMD_RX_550 constant goes with them. The runtime changed, so
RUNTIME_VERSION 1968.

Verified (nvreds), full runtime lanes, the stack 0bf26ce585 against its base 7b45bd4646: on the
780M (11477) and the XTX (11476), color_fills (188 plain fills), logic_ops (the 16 cleared
RGB10A2Unorm draws) and buffer_texture_blits::iosurface_planes go from red to green; Iris
(11544) 1922/1922 at both; RX 550 (11495) and M3 (11478) unchanged; 5080 tip 1406/1922 + 642/643,
the one red (view_attachments volume-plane resolve) red at the base too (3/3 each).
device-color-conversion notices rise about 16.2k on the XTX, the 780M and the M3 (plain fills
announced 17558 -> 33706 of 106680). Here: the API-signature check, REFUSALS.md and
CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt clean.
2026-11-09 03:48:38 -08:00
Anees Iqbal 876cfd1402 Colour clears and fills take either code on every device but where a measured row says Metal's
The orchestrator's decision: Vulkan lets a clear of a normalized channel store either of the two
codes closest to its scaled value ("returns one of the two ... closest ... Implementations should
round to nearest"), so every device takes that rule, not only the three devices measured to take
the farther code (DriverFact::ColorClearTakesEitherCode's rows: NVIDIA's on the RTX 5080 Laptop
GPU, ANV on the Iris Xe of RPL-P, RADV on the Radeon RX 550). The one exception stays the measured
DriverFact::ColorClearIsMetals row: MoltenVK on the Apple9 GPUs, whose load operation of an
attachment the render area covers clears as Metal's.

Runtime: clear_value::rounds_apart and fill_value::device_apart lose their `either` argument; a
normalized channel's clear or plain fill is in question wherever its scaled `float` is off a whole
code (the rule the three rows took), which subsumes the old margin of 1/1024 around a midpoint
(and the packed 16-bit formats' wider one). render_pass.rs and blit_fill.rs read no fact for it;
the load operation's exception under ColorClearIsMetals is unchanged. The fresh pattern of a
signed normalized format (code -1) is written by copies of its bytes, not a clear: no `float`
scales onto it (-1/127 is -0.99999999627 codes), so its clear is in question under the rule
(texture/heap_tiled.rs fresh_pattern; the fresh-pattern test allows its 1-byte texel).

Translator: DriverFact::ColorClearTakesEitherCode, its three rows and AMD_RX_550 (only they used
it) are removed; the facts table test and api_signatures.tsv follow. ColorClearIsMetals' doc
and PrecisionNote::DeviceColorConversion's state the spec's rule.

Validation: buffer_texture_blits' IOSurface planes expect the clear's notice on every device but
where the load operation clears as Metal's (degrade_notices::clear_in_question, the former
tie_cleared, now stated for any value off a whole code). color_fills prints how many plain fills
announced device-color-conversion (COLOR-FILLS-ANNOUNCED).

Docs: docs/API.md's device-color-conversion entry is the spec's statement plus the measured
devices and the one exception.

Verified: cargo fmt. Runs follow through potluck.
(cherry picked from commit 9a844f5c5f5ce1499664f77eceb66fccf2dfd9f7)
2026-11-09 03:47:40 -08:00
Anees Iqbal 39773d40f2 type_nine lanes: a failure's time is measured from the command buffer's kernel end time
On lavapipe under load, two in_turn tests failed, a hang reading as failed
about 26-27 ms after Scheduled, under HANG (27.5 ms). The hang emulation counts
the hang from when it posts the Scheduled transition (the command buffer's
kernelEndTime), but the test measured from its scheduled handler, which runs
on the handler thread and, under load, late. The bound was right; the origin
was wrong.

The test now records both handlers' host times (metal2vulkan_runtime::host_time,
the clock kernelEndTime is read on) and measures a failure from the command
buffer's kernel end time, the mark Metal's contract states the hang from, to
its completed handler. The scheduled handler's lag behind the kernel end time
is printed.

Verified: not yet run. The base and this change, interleaved 20 times on
lavapipe beside a CPU hog on every core (the tests at nice 19), are queued as
potluck 11510.

(cherry picked from commit 6017e89451e805418c5e6083ea0fd8ccdbfbb661)
2026-11-09 03:34:37 -08:00
Anees Iqbal d928302b34 Depth lanes: the layer's GPU-assisted buffer-copy check off, after it crashed ANV's recording
runtime_lane::depth_upload_clamps::a_staged_blit_from_a_buffer_takes_no_depth_outside_0_1_into_a_depth_image
crashed with SIGSEGV on the Iris Xe of RPL-P (ANV, Mesa 26.2.6) under validation layer 1.4.363.
The crash is on the CPU, while the copy is recorded: in the core (coredumpctl, pid 633468) five
layer frames sit between our vkCmdCopyBufferToImage and four of the driver's, which fits the
commands the layer inserts for its buffer-copy check (a dispatch of its own, then a restore of
the command buffer's compute state), not the copy itself.

Measured at development 524cf28137 on ms01 (jobs 11255 and 11372), each run of the test alone:

- lane test, copy check on: 1 of 5 and 4 of 10 crashed;
- the probe of the same copy, copy check on: 2 of 5; core checks alone: 0 of 5; GPU-assisted
  validation without the copy check: 0 of 5; lane test, copy check off: 0 of 5;
- copy check on, rows of the staging copied by vkCmdCopyBuffer instead of their dispatch
  (DriverFact::RowCopiesDispatchFaster, ANV's): 0 of 10;
- copy check on, the staging's depth clamp dispatch left out: 0 of 10 crashed (the check then
  reports the 6 depths outside [0, 1], as it should).

So the crash needs the layer's copy check and both dispatches before the copy, each of which
pushes set 0 under its own layout (two bindings, then one). Our command stream is valid Vulkan
and the layer's core checks report nothing of it; the product stays as it is.

The lanes keep GPU-assisted validation on and turn off only its buffer-copy check
(depth_upload_clamps::gpu_assisted_device, renamed from gpu_assisted_copies, with the reason and
the layer version). Their evidence is the uploads clamped and the texels read back, as before;
the docs of the depth lanes and heap_textures' two depth lanes say the check is off.

(cherry picked from commit 13490a0b070c46dd735435fcf4381be9020310e5)
2026-11-09 03:30:43 -08:00
Anees Iqbal 380a9225f1 blend16 lanes: a device without a fetch form skips each refused draw, printed
On the RX 550 (RADV, GCN4) the six blend16 lane tests panicked at pipeline
creation. The device has neither form a framebuffer fetch takes
(rasterization-order color attachment access, the fragment shader pixel
interlock), and the runtime refuses each fetching pipeline, typed: Unsupported
of FramebufferFetch, needing either feature. That refusal is the device's
honest answer, not a failure of the lane.

framebuffer_fetch::fetch_unavailable takes a refusal as that answer only when
it is FramebufferFetch's and the device's profile has neither form. The
blend16 sweep (stores_metals_blend, behind the blend16, nans and zero tests)
and narrow print each such refusal and skip its draw, then print how many
were skipped. Any other refusal, or this one on a device with a form, still
fails the test.

Verified: the six tests on the RX 550 at 81cf64c16a failed at pipeline
creation with that refusal (potluck 11470). Not yet run at this commit.

(cherry picked from commit fd472b008435c945dcc197f07aa136e92a23bd94)
2026-11-09 03:24:18 -08:00
Anees Iqbal 97fd73c36b RUNTIME_VERSION 1967 and the runtime-sources pin for every pipeline making reporting what its driver found
ownpixel's f82a8a3b3f: DeviceShared::make_compute_pipeline and make_graphics_pipeline chain
VK_EXT_pipeline_creation_feedback and count it, and every former make_pipelines caller (owned
kernels, the split kernels, the resolve/copy/planes/interleave draws, the library parts, the
program compute making) uses them; the unreported make_pipelines is deleted. A making the driver
found in its loaded record reads nothing back and writes nothing, so a found record is never
rewritten on byte drift. The runtime changed, so RUNTIME_VERSION 1967.

Verified (ownpixel): um790 780M RADV PHOENIX, release, --cfg m2v_gpu (11523): the new
the_runtime_s_own_kernels_found_in_their_records_write_nothing failed 50/50 without the fix (0
reports; the negative proves the missing reports, those kernels' records were not drift-written in
50 runs), and with it x51 and the library test x51, warm x100, touched modules 34, runtime suite
x2 1965 each, pipeline_records and cache lanes 10; lavapipe (11524) both tests and 34; clippy plain
and m2v_gpu clean (11527). NVIDIA not run. Here: the API-signature check, REFUSALS.md and
CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt clean.
2026-11-09 03:19:30 -08:00
Anees Iqbal c0f334eaff Every pipeline making reports what its driver found, so no found record is written again
What: the runtime's own pipelines were made through the shader cache with no
VK_EXT_pipeline_creation_feedback: its owned kernels, the depth, stencil and planes split
kernels, and the draws of its copies, resolves and planes steps. So each such making read the
driver's data back and compared its SHA-256 with what the cache was loaded with. Two functions of
DeviceShared now make every pipeline that goes through a record, each chaining the feedback:
make_compute_pipeline makes a program's compute pipelines and the runtime's kernels, and
make_graphics_pipeline makes the libraries of shaders a render pipeline is linked from and the
runtime's draws. A making the driver reports found in the cache its record loaded reads nothing
back and writes nothing (driver_data_found). Its report counts in driver_pipeline_hits and
misses. The unreported DeviceShared::make_pipelines, which nothing calls now, is gone. The
whole render pipeline's making keeps its own call, which already reported.

Why: RADV's data after a making from its record is now and then not the record's byte for byte
(Mesa 26.2.6 on a Radeon 780M: one byte of over a thousand, at the same length; the previous
commit fixed the libraries of shaders, the cause of the warm flake). The byte comparison took
that for new data and wrote the record again: needless SSD writes at a device's makings of its
helpers.

The negative: tests::driver_pipeline_compile::the_runtime_s_own_kernels_found_in_their_records_write_nothing.
A second device, over the directory where a first device made two of the runtime's kernels
(RowsCopy, VisibilityCombine), makes them again. It must count one report per kernel, with found
== hits, and where both are found it writes no record (driver_saves 0). Without the fix it reads
0 hits and 0 misses and fails.
That proves the missing reports, not drift writes on those two kernels: without the fix their
records were written 0 times in 50 runs on PHOENIX. The drift I measured was on the libraries.
With the fix, a kernel found in its record is neither read back nor written, whatever bytes the
driver returns.

Verified on um790's 780M (RADV PHOENIX via MESA_VK_DEVICE_SELECT=1002:15bf!, Mesa 26.2.6,
release, --cfg m2v_gpu), job 11523:
- The test alone (the negative) failed 50 of 50: 2 kernels made, 0 hits and 0 misses reported,
  0 written, 2 loaded.
- With the fix:
  - The own-kernel test passed x51: 2 hits, 2 found, 0 written.
  - a_library_of_shaders_reports_what_its_driver_found passed x51.
  - The warm own-directory test passed x100: 4 found, 0 written.
  - tests::warm, shader_cache, driver_pipeline_compile, owned_kernel_builds and owned_pushes:
    34 passed.
  - The runtime suite (the GPU-hazard filter, the GPU-time tests left out) passed in 2 runs,
    1965 tests each.
  - runtime_lane::pipeline_records and runtime_lane::cache: 10 passed. The second device read
    loads 2, saves 0, found 2, hits 2. The cache lane read 26 makings, each counted once by its
    report.
- lavapipe (--cfg m2v_cpu_icd, llvmpipe from Mesa 26.2.6), job 11524: both report tests passed
  (each 0 hits, 2 misses, 0 written) and the touched modules passed, 34 tests.
- cargo clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings is clean, plain
  and with --cfg m2v_gpu (job 11527).
Not yet run: NVIDIA (the 5080).

(cherry picked from commit f82a8a3b3f192fef6bb7dc74c030797f0a2773eb)
2026-11-09 03:18:41 -08:00
Anees Iqbal 1dcb4eb4a6 Re-bless the golden tables at a773acbc5f
Translation changed at a773acbc5f (SEMANTICS_VERSION 2001). Blessed on the M3
(s37-pl.sh bless, dv-golden).

(cherry picked from commit 9bb30a92456aab0803ce79e53e30f66fbc5b0bdf)
2026-11-09 03:16:46 -08:00
Anees Iqbal 71129978d4 host_memory lane: the past-completion deallocator runs on one VkQueue and on two
a_deallocator_returns_whatever_thread_submits_past_its_completion ran its two
command queues wherever the round robin put them: on two VkQueues where the
device has two (MoltenVK), on one elsewhere, so no device ran both
arrangements. Its hang came back on a device where the queues shared one
VkQueue. The causes are fixed on development: Exact completion by 4ef6cbad82
(the owed completion turn of a command buffer taken with no submission is made
before the submission handlers run) and Grouped by ad451a5334.

The test now makes each arrangement where the device has it: two queues on
one VkQueue on every device, and two queues on two VkQueues where the device
has another (queue_where, from the round robin through
CommandQueue::vk_queue_sharing). A failure names the arrangement, the queues'
VkQueues, both command buffers' statuses, the thread the deallocator began on
and the submissions since. The doc says why the owed turn must come before
the handler.

Verified, with this test body at earlier commits (edb9854f3b, 81cf64c16a):
- M3, MoltenVK (two VkQueues; both arrangements): 100/100 alone and 100/100
  beside lane-module loops (potluck 11460).
- Iris (one VkQueue): 100/100 alone and 100/100 under load (potluck 11459).
- RX 550, RADV (one VkQueue): 50/50 (potluck 11470).
Not yet run: the XTX and 780M (11468), lavapipe (11469), and the negative on
lavapipe with 4ef6cbad82's scheduler hunk reverted (11472).

(cherry picked from commit 25d8962fa5735ed3f1eb69f23f9ff3ec04e1a222)
2026-11-09 03:14:42 -08:00
Anees Iqbal a773acbc5f RUNTIME_VERSION 1966 and the runtime-sources pin for nvreds' resolve, half and logic fixes
- resolve_rounding (db251d505e, 66c344998a, 541c5afec6): a cleared sRGB resolve takes either code
  nearest the clear where the passes announce the conversion; closes the XTX's cleared-sRGB red.
- RADV's fused half conversion (7ed49fd04d, e68eea5a2a, c8d166727f): DriverWorkaround
  HalfConversionFusedWithArithmetic, keyed on the RADV driver ID; a pipeline whose half comes from
  an f32 add, subtract, multiply or fma records NativeHalfConversion. PHOENIX and NAVI31 measured
  fusing (4542 of 253958 lanes the device's), POLARIS12 noted anyway. The RADV profiles' hash
  moves, so their golden keys move (re-blessed next); no artifact format change.
- logic_ops (30501351a4): a channel the device converts its own way takes either code nearest its
  value; the XTX's 24/189 red becomes 16/189, all of it clears, which the clear-code change closes.
e68eea5a2a's conflict in device/tests/profile.rs (development had added
PerspectiveReadsExtrapolated to the same list) resolved to both variants in declaration order.
Translator and runtime sources changed, so RUNTIME_VERSION 1966.

Verified (nvreds): full runtime lanes on the XTX 11476 (RADV NAVI31), the 780M 11477 (RADV
PHOENIX), the RX 550 11495 (POLARIS12) and the M3 11478, hazard and timing filters on; lavapipe
and m2v_cpu_icd clippy 11373; the half fix's unit tests and clippy 11374 (41/41). Here: the
API-signature check, REFUSALS.md and CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt
clean. The merged tree's own build runs next with development's checks.
2026-11-09 03:13:21 -08:00
Anees Iqbal 30501351a4 logic_ops: a channel the device converts its own way takes either code nearest its value
On the Radeon 780M (RADV PHOENIX) the_logic_operation_stores_metal_s_codes failed 24 of 189
draws, all RGB10A2Unorm (radvruns job 11026, 2 of 2 runs; operation 2: [00,c9,f8,af] against
Metal's [00,cd,f8,af]). A probe on that device (job 11147) found the cause in the conversions,
not the operation: the plain draw and the copy draw both store green 562 for 562.65 (Metal 563),
and the clear alone stores blue 613 for 613.8 (Metal 614). Every RGB10A2Unorm pipeline that
writes the color records PrecisionNote::DeviceColorConversion there (plain and copy: notes
[DeviceColorConversion]; no-op: none), and the clear is announced as device-color-conversion.
That is the device's conversion, noted and announced (rule 1); the lane did not follow either.

Now a draw whose texel is not Metal's is checked against the device's codes: each channel the
operation of either code nearest the drawn value, where the pipeline's fragment stage records
DeviceColorConversion (compiled through the device's compile layer), and either code nearest the
cleared value, where the device announced device-color-conversion over a pass of each normalized
format's clear alone, made before any pipeline (a device announces each kind once). Elsewhere the
draw must be Metal's texel, as before. The test prints how many draws took the device's codes and
under which key.

(cherry picked from commit bc4b5197202d9508bea0fd718a439675e79dee2d)
2026-11-09 03:12:21 -08:00
Anees Iqbal c8d166727f HalfConversionFusedWithArithmetic names the generations measured: PHOENIX and NAVI31 fuse, POLARIS12 notes every narrowing
The orchestrator asked that a fact of RADV's compiler, keyed on the driver, name the generations it
was measured on. The full runtime lanes at 0bf26ce585's base (7b45bd4646, this branch among the
stack) printed, for runtime_lane::half_conversions' product kernel:

- Radeon 780M (RADV PHOENIX, GFX11, '1002:15bf!', job 11477): 4,542 of 253,958 lanes the device's,
  note true (the v_fma_mixlo_f16 fusion seen in the 11121 disassembly);
- Radeon RX 7900 XTX (RADV NAVI31, GFX11, '1002:744c!', job 11476): 4,542 of 253,958, note true;
- Radeon RX 550 (RADV POLARIS12, GFX8, '1002:699f!', job 11495): 8,180 of 253,958 for the product,
  sum and fma kernels and 8,185 for a plain load, every kernel noted, so the narrowing itself is
  the device's there and no fusion can be told apart.

The workaround stays keyed on VK_DRIVER_ID_MESA_RADV on every GPU; the doc says so and names the
three. Doc only.

Verified: cargo fmt.
(cherry picked from commit fd13169d87b9d81921ff304929d3af3f54587a89)
2026-11-09 03:12:21 -08:00
Anees Iqbal e68eea5a2a Unit tests that list RADV's workarounds and set aside a half kernel's own rounding note
Job 11253 (gem10, the whole metal2vulkan suite at 799d39233c) failed three tests:

- moltenvk_on_apple_carries_the_early_tests_image_write_defect lists the workarounds of a
  description under RADV's driver id: it now carries HalfConversionFusedWithArithmetic too, which
  holds on any vendor as RADV's interpolation defect does.
- exported_float_notes_are_the_ones_a_compile_records sets aside the note of a half kernel's own
  rounding (narrow::native_rounding); on a RADV profile the rounding of a half function computed
  in float arithmetic (log10_f16_flagless on amd-rdna2-apu-radv) now records
  NativeHalfConversion through the fused conversion (narrow::rounds_arithmetic), which is the
  module's rounding, not the function's, so the test sets it aside as well where the exported
  notes do not name it.
- golden_hashes_match_the_table: 6480 cells under the RADV profiles, whose profile key changed
  with the new workaround ("no SEMANTICS_VERSION bump is needed"); re-blessed on development.

(cherry picked from commit bd1796334a0cd8150484d2e8d4a9bccfb3d56898)
2026-11-09 03:12:21 -08:00
Anees Iqbal 7ed49fd04d RADV fuses float arithmetic into a half conversion: the pipeline records NativeHalfConversion
On the Radeon 780M (RADV PHOENIX) runtime_lane::half_conversions failed its product kernel:
2.6822087e-7 * 1.0000001 answered half 0x0005 where Metal's half of the float product is
0x0004, with notes only [NativeNanEncoding] (radvruns job 11026, 2 of 2 runs). The module
rounds under the float controls (QuantizeForm::Controlled), which make the conversion Metal's,
so it recorded no conversion note. RADV_DEBUG=shaders on the 780M (job 11121) shows why: ACO
compiles the product's OpFMul and the narrowing, both decorated NoContraction, as one
v_fma_mixlo_f16 v2, v1, v0, neg(0), rounding the exact product to half once where Metal rounds
the float product; the sum kernel's narrowing is one v_fma_mixlo_f16 1.0, a, b too.

That is the device's own rounding (rule 1), so the fix is the note, not Metal's bits:

- DriverWorkaround::HalfConversionFusedWithArithmetic, keyed on RADV on every GPU (the others
  unmeasured), as NVIDIA's HalfConversionPairFolded is keyed on its driver.
- narrow::rounds_arithmetic: whether a module rounds to half, through a conversion pair, the
  result of an f32 OpFAdd, OpFSub, OpFMul, OpFmaKHR or GLSL Fma.
- compile_kept records PrecisionNote::NativeHalfConversion where the module takes the
  controlled conversion, the profile carries the workaround and rounds_arithmetic holds. The
  controlled form itself stays: a loaded float's conversion is exact there and records nothing.
- Tests: radv_carries_the_fused_half_conversion (every committed RADV profile carries it, no
  other does, and RADV keeps the controlled form) and
  a_controlled_rounding_of_arithmetic_is_noted_where_the_driver_fuses_it (a float sum, product
  and fused multiply-add rounded to half record the note on every RADV profile and not on ANV;
  a loaded float narrowed alone records it on neither). Both fail with compile.rs and derive.rs
  at the base.
- The note's doc, the API guide's catalogue entry, HOWTO, the narrow module doc, the lane's doc
  and the signature table name the new variant.

(cherry picked from commit 799d39233c4e0ae2a18a716e794db8f67405ff00)
2026-11-09 03:12:03 -08:00