Commit Graph
875 Commits
Author SHA1 Message Date
Anees Iqbal 3fe18c4efd Guest RAM: a driver's refusal of a span's dma-buf is remembered for the device's life
Counting the refusal left its cost: on a device whose import tax holds and whose driver refuses
every udmabuf (NVIDIA 615.71.09, FAST-PATHS), every guest-RAM chunk asked the source for a dma-buf,
failed vkAllocateMemory, let go of one descriptor (the driver closes the clone it was handed) and
only then took its pointer.

ram_span_as_dma_buf now tells the source's failures (an error, or an answer of other lengths:
that span's alone, counted) from the driver's (anything once the source answered one dma-buf of
the span: its memory types, the buffer, the import, the bind). A driver's refusal is counted once
and remembered in the device's RamSource; every later span is refused at once, unasked and
uncounted, and takes its pointer. The decision reads the device's own answer, never its identity.
A transient failure of the driver's (memory that ran out) is remembered the same way, recorded in
FAST-PATHS' NVIDIA row.

Tests: a_driver_s_refused_dma_buf_sends_the_device_s_later_chunks_to_their_pointer forces the tax
held and refuses every dma-buf import through a test stand-in for the driver (Memory::import_refusal,
cfg(test), answered where the driver's import would run), on every device that imports dma-bufs:
two chunks, the source asked once, the failed count 1, the second chunk by its pointer. The route
test, where the driver itself refused (NVIDIA's), makes a buffer over the RAM's second chunk and
asserts the same with the real driver. Without the remembering both ask the source a second time.

(cherry picked from commit abddf2d2f1ed16a5ee6407cae04f7e10dfffb736)
2026-11-09 11:05:12 -08:00
Anees Iqbal 98729ad0de Guest RAM: a chunk's dma-buf the driver refuses is counted; the route test forces the tax held
On the RTX 5080 (NVIDIA 615.71.09) pin 29's runtime half failed
host_ram_dma_buf::a_ram_with_a_source_takes_the_route_its_device_s_checks_choose: that process's
import tax answered Holds, the chunk went dma-buf first, the source was asked, and no dma-buf was
imported. A probe printed the refusal: vkGetMemoryFdPropertiesKHR gives the udmabuf types 0x9,
the buffer takes 0x1f, and vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY (the refusal
FAST-PATHS already records for NVIDIA). import_chunk dropped that error and took the pointer, as
it should, but nothing counted it, and the test held every taxed device to a dma-buf import.

- WorkCounts::host_ram_dma_buf_imports_failed counts a guest RAM span's dma-buf that failed on a
  device that imports dma-bufs (the source failed or answered other lengths, or the driver
  refused it); ram_span_as_dma_buf counts it past its device check.
- The route test (now where_the_import_tax_holds_a_chunk_takes_its_dma_buf_first) forces the tax
  held, as the pointer-first test forces it not held, so the taxed route runs on every device in
  every run, not only in a process whose check measured a tax. It asserts the source asked once
  for the chunk, and the dma-buf imported or refused and counted, the pointer then taking it; it
  prints the verdict the device measured beside it.
- HOWTO, FAST-PATHS' NVIDIA dma-buf row, host_ram's docs and the API signature table name the
  count.

Verified: the probe at 3f3ca70d32 on the 5080 (b5080 t entry exitcrash-dmabuf-100324): with the tax
forced held, 2 of 2 runs failed the old assertion with the refusal above; quiet runs measured the
tax not held (3 of 3). This commit's own runs are in the next evidence.

(cherry picked from commit a6ccb78810867a4d567892feee4b3b56ba1af834)
2026-11-09 11:05:12 -08:00
Anees Iqbal 513d792675 REFUSALS: MadeBeforeRecovery's pooled buffers are those in memory the device allocated
A recovery now carries a pooled Shared or Managed buffer that lies in a block of the runtime's own
pages, so the reach note names the pooled buffers left refused as those in memory the device
allocated. docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py); no refusal
changed.

(cherry picked from commit b11909130479dbdb8c42c8d6c3950ffa1d9414ed)
2026-11-09 09:51:55 -08:00
Anees Iqbal 73545f6afc Page blocks only where the fresh pages' verdicts give textures what plain blocks do
A texture over a buffer in a block of the runtime's own pages takes the route
over fresh pages: its image is made for host allocations and starts UNDEFINED,
so it lies in place only where the in-place check's verdicts of fresh pages
pass, where over a plain block's buffer the device's linear image starts
PREINITIALIZED and needs none. So the program's buffers now lie in such blocks
only where those verdicts give every access and row ends a texture over a plain
block's buffer takes in place (by the pooled class's verdicts) the same, as
the blocks allocated exportable already do: fd_blocks_take is now blocks_take
of a pages class (FdBlocks or Fresh), its enum BlocksTake, and
Device::page_blocks_taken asks it for Fresh, starting no check. Pending
verdicts leave the buffers in plain blocks.

The memory lock is no longer held while the verdicts are read as a buffer is
made.

Docs: memory.rs's module docs, device/carry.rs, the runtime README, docs/API.md
and the recovery notice's cost name the condition.

Verification: the suite follows.
(cherry picked from commit 8c50d54d9871bce0e80865ac4916e7da0c192a8a)
2026-11-09 09:51:54 -08:00
Anees Iqbal 3d0ece2f7a Page blocks: kept() asks the page buffers' address types before it borrows the families; docs
kept() asked address_types for Holds::PageBuffers while a Sharing borrowed
the families, which the borrow checker refused (job 11930). The query now runs
before that borrow.

Docs: memory.rs's module docs get "Buffers in the runtime's own pages";
device/carry.rs, Buffer::carry, the runtime README and docs/API.md's recovery
cost say a recovery carries the Shared and Managed (unified memory) buffers in
blocks of the runtime's own pages, and leaves those in memory the device
allocated.

Verification: the build follows.
(cherry picked from commit e5df53c305b27909f4cca460a4910c12861d20aa)
2026-11-09 09:51:53 -08:00
Anees Iqbal 9e663b770c Memory: the pools of exportable buffers get their growth blocks made ahead
A creation call that places an exportable buffer (new_exportable_buffer, an exportable buffer
descriptor, the in-place check's buffers) in a pool with no room made the pool's 64 MiB block
itself, on the program's thread. keep_room made blocks ahead (memory/ready.rs) only for the
pools the runtime's encodings and commits place in and for the host copies' pool, so every
growth block of Holds::Exports and Holds::DmaBufs was made in place.

Now each pool of exportable buffers that grew within KEPT_EMPTY_FOR and lacks room for a whole
block gets a block started ahead at each creation call's keep_room (Memory::exported_growing,
ready_if_growing, the kept pools' tail of keep_room moved into it), made right after a burst of
the device's submissions ended, as the kept pools' blocks are. makes_ahead covers those pools,
so the placement that finds no room takes the block made ahead or waits for its making
(place, take_ready) and counts a block it makes itself in buffer_blocks_made_in_place.
keep_room makes no block for such a pool in place: its placements are the creation calls.

The reclaim bench gains an arm of exportable buffers made by the runtime (24 of 32 MiB a phase,
one every 400 ms) and prints blocks_ahead_waited_for. The citation of a consumer's wait is
replaced by these measurements; FAST-PATHS's row on kept blocks says blocks are made ahead for
pools that grew, the exportable ones among them.

Verified, on a Radeon 780M (RADV PHOENIX, Mesa 26.2.6, gem10, MESA_VK_DEVICE_SELECT
'1002:15bf!'):
- reclaim_submit_bench_exportable in release under --cfg m2v_gpu, exclusive, two rounds each,
  the negative being memory.rs and memory/ready.rs as on development (job m3-max-12103): the
  creation calls that made blocks in place took 10.0 to 10.8 ms (quiet, round 1), 12.9 to
  15.0 ms (fragmented: free memory in single pages, round 1) and 12.0 to 13.7 ms (fragmented,
  round 2; 0.3 ms at most in round 2's quiet phase). With the change no creation call took over
  0.3 ms in any phase: 10 blocks made ahead and 2 in place (the pool's first two) in each quiet
  phase, 12 ahead and 0 in place in each fragmented one, 0 waited for. Turnarounds of 8 ms or
  more: 0 in every phase both ways (an exportable block holds no submission).
- blocks_ahead's new test a_growing_pool_of_exportable_buffers_gets_its_new_blocks_made_ahead:
  6 of the pool's last 6 blocks made ahead, 0 in place; with memory.rs as on development it
  fails, 0 of 6 made ahead (job m3-max-12111).
- The whole runtime lib under --cfg m2v_gpu (debug): 1997 of 1997 passed (job m3-max-12109);
  clippy on the runtime crate, all targets and features, clean.
And on lavapipe (llvmpipe, LLVM 23.1.4) under --cfg m2v_cpu_icd: blocks_ahead and clip_bursts
pass (the later clips allocated nothing: [(0, 0), (0, 0)]; job m3-max-12110), clippy clean, and
the new test fails, 0 of 6, with memory.rs as on development (job m3-max-12112).
Not run: NVIDIA, MoltenVK.

(cherry picked from commit 5a862c6ab9ebf0a6f2effeb8776aaac6de3bed16)
2026-11-09 09:44:38 -08:00
Anees Iqbal 2ef8af3abe A pass-start read takes the copy cleared by MoltenVK's clear command, which is Metal's clear
What: on MoltenVK (DriverFact::ColorClearIsMetals) a draw that samples a colour its pass clears,
after a memory barrier at the pass's start, split the pass again (attachment_read_splits, a
second render pass instance, the render-pass-split notice) instead of reading a copy of the
attachment cleared to the clear before the pass (attachment_read_clears). Texture::cleared_copy
refused a clear whose device-color-conversion note the load operation withholds
(ColorTarget::withheld_clear), because the copy is cleared by vkCmdClearColorImage and only
the load operation was measured to store Metal's texel there. Since 876cfd1402 every clear of
a normalized channel off a whole code is in question (the spec's rule), so the pass-start
clears of the lanes and the conformance cases became withheld on MoltenVK and split.

The driver's clear command is measured to store Metal's texel too, so the fact now covers it:
- Texture::cleared_copy takes a withheld clear (no note owed: the clear command's texel is the
  load operation's, Metal's).
- A memoryless attachment's backing cleared after the first instance, and an attachment the
  first instance leaves out cleared before the pass by the clear command (cleared_ahead), owe no
  note either; the same clear by a render pass of the attachment alone, or as sample planes,
  still announces it.
- DriverFact::ColorClearIsMetals, ColorTarget::withheld_clear, texture/attached_reads.rs and
  docs/API.md's device-color-conversion entry say so.
Elsewhere withheld_clear is None (the note is announced as the pass is laid out), so nothing
changes on other drivers.

Why, measured on the M3 Max (macOS 27.0.1, MoltenVK 1.4.2):
- The cause, by a probe of each condition of cleared_copy over 22,482 runs of
  attachment_reads::a_draw_after_a_barrier_at_the_pass_start_reads_the_clear on development at
  1571c220d7: every run failed the same way, (cleared copies, splits, begun) = (0, 1, 2), with
  withheld_clear Some([200, 40, 120, 160] / 255) the only condition that refused (not load, not
  timing).
- The clear command: each of the 71 colour clears Metal was measured with
  (renders.rs COLOR_CLEARS: ties of 8-, 10- and 16-bit unorm and snorm channels, sRGB, packed
  16-bit, half and small floats, shared exponents, NaNs) by a plain fill of a whole 1x1 texture,
  which is vkCmdClearColorImage of the load operation's clear value (blit_fill.rs): 71 of 71
  Metal's bytes, and equal to the load operation's 71.
  runtime_lane::renders::clears_are_the_device_s_conversion_of_the_clear_value now checks this
  on a driver with the fact.

Ran on the M3 Max (macOS 27.0.1, MoltenVK 1.4.2) at this change over 693fd3f96d, under --cfg
m2v_gpu: the whole validation suite, 3398 of 3400 passed (attachment_reads and renders among
them); the two failures are the runtime-sources pin, which the landing sets, and
degrade_notices::a_creation_s_notices_and_messages_reach_the_sink_on_the_asking_thread at
device creation (creation_heard_checked), before any pass is recorded. conformance cost --check
over the whole set: no gated count and no ceiling moved (the pass-start-barrier cases read the
cleared copy again, as recorded); conformance replay of the 14 pass-start-barrier cases: rc 0,
each difference an accepted one. On this base only driver_facts.rs merged (beside
ClearedDepthAtStandardPositions); the other five files are unchanged since 693fd3f96d.

RUNTIME: the runtime's pass-start reads on MoltenVK change (a cleared copy instead of a split).
(cherry picked from commit 25063af705d28d07b7332cc1b35a5cf1beedc6bb)
2026-11-09 07:53:32 -08:00
Anees Iqbal 462934908e RUNTIME_VERSION 1974, the runtime-sources pin and the API table for recovery 1b
exitcrash 1571c220d7..4b9b7ed8b0 (11 commits): a device recovery carries the
program's no-copy buffers (made again on the new VkDevice over the same pages,
same contents pointer, Metal address and bytes: pointer imports, buffers in
another's import, gate-refused copies, runs of guest RAM) and its uses of
guest RAM (HostRamUse, carried before the buffers). The caller's deallocator
still runs once, after every generation's import of the pages is freed; a
detached no-copy buffer stays on the lost generation (MadeBeforeRecovery).
Runtime behaviour changed: RUNTIME_VERSION 1973 -> 1974, pin recomputed,
docs/REFUSALS.md regenerated (two refusal sites renamed: ram_use_on,
buffer_over_host_parts).

API table: HostRamUse is now a tuple struct over a private Arc<RamUseCell>
and its own impl Drop is gone (the cell's use drops it). Nothing breaks for a
consumer: dropping a HostRamUse still lets go of the RAM at once (the
recovery's carry holds only a Weak, upgraded for the carry itself), and
nothing could call the Drop impl directly.

Verified by exitcrash: lavapipe 11782 at a5f0c3be37 runtime suite 1999/2000
(the one red a test bug, fixed), clippy plain/cpuicd/gpucfg, rustdoc, refusal
check; lavapipe 11814 recovery/no-copy/event 30/30 with negative controls A
(deallocator not handed on) and B (lost parts never let go) failing as
designed; rebased tip 4b9b7ed8b0: Iris 11823 51/51 and 780M (RADV PHOENIX)
11824 51/51 over recovery, no-copy, host_ram_device, event_timeline,
detach_lost, the new tests run on both. Not run at the tip: lavapipe whole
suite, clippy, the 5080 (development's checks).
2026-11-09 06:02:36 -08:00
Anees Iqbal 15923d88c0 Docs: a recovery carries no-copy buffers and uses of guest RAM
The DeviceRecovered cost text (and docs/API.md's catalogue entry, which states
it), the runtime README's recovery section, new_buffer_with_bytes_no_copy, and
the contracts of the import gate, the run resolver and the dma-buf source now
say the following. A recovery carries a device's uses of guest RAM and its
no-copy buffers. Each buffer is made again over the same pages. The caller's
callbacks are asked again on the thread that recovers, before the new device
serves, so they must make no call on the device. The deallocator runs at the
buffer's release once no VkDevice's import of its pages is left (the
keep-alive's contract says the same). Detached no-copy buffers and a no-copy
heap's buffers stay refused. HostRamUse's doc says the use goes on.

(cherry picked from commit 58ba0931b857a9dcf9a6124138c81fc31a259552)
2026-11-09 06:01:13 -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 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 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 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 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
Anees Iqbal 92202c5eaf RUNTIME_VERSION 1963, the runtime-sources pin and REFUSALS.md for the opaque-fd block split
radvruns' split (43 commits, its fd-blocks-2 branch at dd5e698bff): on a unified device's system
heap, runtime buffers lie in blocks exportable as opaque fds once the device's in-place check
takes them, and buffers that declare their padding unobserved stay in plain blocks. On the 780M
this removes the submit stall behind the kernel's lock (0 turnarounds of 8 ms or more against
11-12; the lock wait 305 -> 2.6 ms). A buffer's making no longer starts the in-place check
(289b04fae4); kept room serves the runtime's own pools first (916073fc37); blocks made ahead stop
at the allocation margin left to the objects (dd5e698bff). REFUSALS.md: BufferLength gains the
pooled_check_buffer site. The runtime changed, so RUNTIME_VERSION 1963.

Verified (radvruns) at dd5e698bff: PHOENIX (um790, release, gpucfg) host_ram_device 22/22, the
seven earlier-red modules 47/47, the full runtime suite 1963/1963 and 1962/1963 (completion_order's
timing test once; base comparison 11395 against tip 11394 running); M3 clippy plain/m2v_gpu/
m2v_cpu_icd and rustdoc clean, runtime 1367/1367, m2v_gpu set 168/168. Open: Iris
in_place_check::the_in_place_check_takes_no_range_of_the_metal_space failed at dccbb9d3d7 (base
vs tip 11363/11364 pending). Here: the API-signature check, REFUSALS.md and
CONFORMANCE-COVERAGE.md regenerated, cargo fmt clean.
2026-11-09 01:45:34 -08:00
Anees Iqbal 97afeae593 Kept room: the runtime's own buffers' pools first, the exportable ones only while they lie there
keep_room kept room in every kept pool in the order Buffers, FdBuffers, Images, whatever kind
of block the runtime's own buffers took. On a device near its count of allocations the plain
Buffers pool's block spent the last allocation the program's buffer, placed in the FdBuffers
pool once the device's in-place verdicts were known, then needed:
tests::host_ram_device::the_ahead_thread_leaves_the_allocation_limit_to_the_objects made no
buffer (Vulkan -10) on RADV PHOENIX at 97f92139dd, where the base made one.

Device::keep_room now asks which kind the runtime's own buffers take (Memory::own_buffers of
Device::fd_blocks_taken, the verdicts as fd_blocks_checked reads them, counting nothing and
starting no check), and keep_room keeps that kind's pools first and the FdBuffers pools only
when that kind is FdBuffers. The FAST-PATHS row on exportable blocks says so.

Verification: the failing test and the runtime gpucfg suite on RADV PHOENIX follow.
(cherry picked from commit 916073fc374888e44f203e7f1c00abbf55497af5)
2026-11-09 01:44:42 -08:00
Anees Iqbal 33f1fecac1 fd blocks: a buffer's making starts no in-place check
The full runtime gpucfg suite on PHOENIX at e03275c440 (job 11224, release) had 16 failures in
completion_here, draw_again, host_residency, teardown_threads, waiter_submits and
pointer_residency. The fd set itself passed 3/3. The failing tests count device-wide state
(recorded commands, host-import residency, threads at teardown, completions).

With this branch the first buffer a device made asked fd_blocks_checked, which went through
in_place_verdict and started the in-place check in the background wherever its verdicts were
pending: on every program's first run on a driver, and in every test with a fresh shader cache.
The check's own buffers, imports and command buffers then ran among the program's, as
tests::recycle showed exactly (472 vs 490-505 recycled under load).

fd_blocks_checked now reads the verdicts without starting the check. The runtime's own buffers
lie in exportable blocks once the verdicts are known: from the check's record as the device is
made, or once a check that a texture over host pages or Device::settle_in_place_checks started
has answered. Until then they lie in plain blocks, counted fd_blocks_awaited, as before.

The recycle tests' settle (3297613ce2's) is removed: it would now start a check the tests have
no use for.

Docs:
- in_place.rs, memory.rs, WorkCounts::fd_blocks_awaited and the bench's arm doc say who starts
  the check.
- The FAST-PATHS Private row drops the unsettled-runtime numbers (taken while a buffer started
  the check): until the verdicts are known the blocks are plain, as the base's. The settled
  numbers stand.

Verification is pending: the full suite at this tip and at development, side by side on
PHOENIX.

(cherry picked from commit 289b04fae4ce20bed3b2ebe92e6b693e7d4a8e0b)
2026-11-09 01:44:42 -08:00
Anees Iqbal cd3676b4f3 FAST-PATHS: the Private row's runtime numbers at the split
From the bench at 73312dc63e on gem10 (RADV PHOENIX, '1002:15bf!', job 10985), two runs of
each runtime arm against the base binary: base 13/12 turnarounds of 8 ms or more quiet and
103/17 fragmented (slowest 40.4/49.0 ms, 350/311 ms of kernel-lock wait); tip fresh 1/1 quiet
(3 plain blocks made while the first check was pending) and 0/0 fragmented (21/24 ms waited);
tip settled 0/0 in both phases (4/10 ms waited).

Verified: docs only.
(cherry picked from commit e5816df55531a25ec0730d82e962f87e9cc17f52)
2026-11-09 01:44:41 -08:00
Anees Iqbal 829a68129b FAST-PATHS: the Private row names the split by padding, the first turnaround and what stays plain
The heading and body say buffers that declare their padding unobserved keep plain blocks
and why (a DRM_FORMAT_MOD_LINEAR image over exportable memory needs a dedicated allocation
on RADV); the made-before arm's 57.0 ms first turnaround against 2.4 to 8.1 ms with 64
exportable blocks held (reclaim-10514/10615); what still makes plain blocks
(WorkCounts::plain_buffer_blocks_made) and the second pool's held block; the planes over an
unobserved buffer take the conversion image as before. The RUNTIME_ARMS placeholder is gone;
the runtime arms' numbers follow once the bench at the split has run.

Verified: docs only.
(cherry picked from commit 3619d8e8783039e8568afc4c0e75fb9b943bfd76)
2026-11-09 01:44:41 -08:00
Anees Iqbal 5e020e43bd fd blocks: buffers that declare their padding unobserved stay in plain blocks
A texture over a buffer whose rows lie apart is in place only where the buffer declares
its padding unobserved, and there, over a plain block, it may take a DRM_FORMAT_MOD_LINEAR
image at Metal's pitch, which RADV makes for exportable memory only as a dedicated
allocation. The placement test at b48d8fae41 counted 15276 such textures lost over
exportable blocks for padding-unobserved buffers and 0 for padding-kept ones. So the split:

- BufferDescriptor's padding_unobserved reaches the placement (Made, buffer_of_length,
  NewBufferOf::Unobserved): such a buffer lies in a plain block (Holds::Buffers) wherever;
  every other buffer of the runtime's buffer path lies where the device's own buffers do.
- The recycler's BufferMaking keys on the block kind, so a parked buffer in an exportable
  block is never handed to a padding-unobserved one.
- fd_blocks_cover's second guard asks what a padding-kept texture can take: rows one after
  another at a multiple of 16 bytes where the device's own linear image lies otherwise, at
  every width of linear_alignment::WIDTHS, every backed format and usage; any
  DRM_FORMAT_MOD_LINEAR image of its own memory made there refuses the blocks. The linear
  layout comparison runs at every width too.
- WorkCounts::plain_buffer_blocks_made counts plain blocks of buffers, beside
  fd_buffer_blocks_made, so a lane can read the share of block makes on each side; the bench
  prints it.
- The placement test tries rows rounded to 16 too, makes the program's buffer through
  new_buffer_with_descriptor for each padding, asserts where it lies, and asserts 0 lost for
  both kinds. The nv12 test checks a padding-unobserved picture lies in a plain block while a
  parked exportable one of its making exists.
- Docs: memory.rs, in_place_check.rs, the FAST-PATHS in-place row, the descriptor field and
  the runtime README.

Verified: cargo fmt only; builds and device tests are dispatched next.
(cherry picked from commit 6e5c80ac3caaa2ad26c0456ecfc0801bca4ccd42)
2026-11-09 01:44:41 -08:00
Anees Iqbal 005a54ea8d fd blocks: opaque fd only, every image there the device's linear image, behind a cover check
RADV PHOENIX asks a dedicated allocation of a DRM_FORMAT_MOD_LINEAR
image made for an opaque fd or a dma-buf (requiresDedicatedAllocation=1
for formats 9/16/37/44/64/97, m3-max-10880), and its image format query
takes a dma-buf for no linear-tiling image: the dma-buf blocks of
6798cf39a2 held no texture at all (all 1824 in-place layouts of the
placement test lost, m3-max-10884), and the FdBlocks check made nothing.
The one image such a block can hold there is the device's linear image
made for an opaque fd, and over a plain block's buffer no texture took a
DRM_FORMAT_MOD_LINEAR image at Metal's pitch (0 of 1824 over 20736
layouts): the driver takes no explicit pitch but its own.

So the blocks are exportable as an opaque fd again (FD_BLOCKS_HANDLE),
every texture over such a buffer the linear image made for it, gated on
the FdBlocks first-move verdict, and no pitched image there.

Guards, from documented queries and made-and-released images, never a
driver name:
- memory::fd_image_types, at device assembly: per memory type of the
  system heap, kept where a 64x4 linear image made for an opaque fd
  (R8, RG8, RGBA8, RGBA16F; format query exportable and not
  dedicated-only first) takes it wherever the plain linear image does,
  and not asking a dedicated allocation; the memory log names the kept
  types and why the others stay plain.
- Device::fd_blocks_cover (texture/fd_blocks_cover.rs), in the check's
  FdBlocks class: for every backed pixel format and the read, write and
  render usages, the opaque-fd linear image wherever the plain one is
  made, laid out the same (pitch, offset, size, alignment, types); and
  no DRM_FORMAT_MOD_LINEAR image of the device's own memory at a pitch
  other than its linear image's (probed at +256 and twice it). Else the
  class is unmade (lasting, so recorded), fd_blocks_take refuses, and
  the memory log says why.

Removed: the dma-buf block path, Device::modifier_takes_linear, the
probe-then-DRM linear slot, pooled_pitched_image's class parameter.
CHECK_VERSION 16.

Verified: nothing yet.
(cherry picked from commit 0b59a1700f0911b1024f83ed3be30f99fb5e23d8)
2026-11-09 01:44:40 -08:00
Anees Iqbal cb6c971456 fd blocks: dma-buf only, every image there a DRM_FORMAT_MOD_LINEAR one
The validation layer on RADV PHOENIX reported
VUID-VkExportMemoryAllocateInfo-handleTypes-09860 at every bind of a
linear-tiling image into a block allocated exportable as opaque fd and
dma-buf (32 reports over three exported_textures tests, m3-max-10768):
the handle types of an allocation must be supported for the resources
in it, and RADV's image format query takes a dma-buf for no image of
linear tiling (ERROR_FORMAT_NOT_SUPPORTED for formats 9, 16, 37, 44,
64, 97), while it takes an opaque fd for a DRM_FORMAT_MOD_LINEAR image
only from a dedicated allocation (VUID-VkMemoryAllocateInfo-pNext-00639).
No dual-handle block holds either image kind validly.

So the blocks are dma-buf only (FD_BLOCKS_HANDLE), taken where the
device exports a pooled dma-buf for both buffer usages and enables
VK_EXT_image_drm_format_modifier. Every image there is a
DRM_FORMAT_MOD_LINEAR one naming that handle type: where the device's
linear image (made to be measured, never bound) lies on Metal's
layout, one of that layout, gated as before on the FdBlocks first-move
verdict for the texture's row ends and free of the pitched cost bound,
as base's linear form is; else the pitched path at Metal's pitch under
the FdBlocks verdicts. Both count as pooled pitched images.
fd_blocks_take is unchanged. CHECK_VERSION 15, as the class's images
changed. FdExport::compatible and Memory::fd_handles are gone.

Verified: nothing yet; built on gem10 next.
(cherry picked from commit 2b4919bd9e54635c7192b425bb740d9a77f57ec7)
2026-11-09 01:44:40 -08:00
Anees Iqbal ecfe8dc225 reclaim bench: a 16 MiB system-heap arm, for the image pools' growth blocks
Verified: not yet built.
(cherry picked from commit 5a97a25ce536f91d5d95840dd1d1afef1a66111c)
2026-11-09 01:44:40 -08:00
Anees Iqbal 6962de9cdc FAST-PATHS: the NVIDIA exit fault's known gap as the gap and its bound alone
A known gap states what is true now and one bound; the evidence stays here. A correction to
d35c43feaf's message: the exit hunt stopped on the orchestrator's call, not the owner's word.

The evidence behind the line (NVIDIA 615.71.09, RTX 5080 Laptop GPU, Linux):
- exitcap-162601 (probe 7f851ced8c): 1 of 94 runtime children, each making a device on libtest's
  test thread and returning with it kept live, took SIGSEGV after their test passed. The faulting
  thread was an NVIDIA worker (libnvidia-eglcore into libnvidia-glvkspirv+0x363b2, address 0x18)
  named after the ended test thread, while the main thread ran libEGL_nvidia's exit handler (an
  ioctl in libnvidia-glsi). The runtime's 30-odd threads were all waiting, none in a section of
  the exit guard or a making. A consumer saw the same fault twice in a suite of about 1900 tests,
  in a test that keeps its device in a static.
- nvexit, a Vulkan program without the runtime (an instance, the NVIDIA device, one compute
  pipeline, a return from main), beside the same 14-minute load of the runtime's device suite:
  1550 runs, 0 faults. 1028 destroyed everything first (507 + 262 on the main thread, 259 on a
  thread joined before the return); 522 kept the device live (263 made on the main thread, 259 on
  a joined thread, whose two driver workers named after it still ran at the return).

(cherry picked from commit be87171f9ecb74c3b695ceb9501cc4435144728f)
2026-11-09 01:35:53 -08:00
Anees Iqbal 31cef63d20 FAST-PATHS known gaps: NVIDIA's SIGSEGV in the exit of a process whose device is live
The exit hunt stops here, on the owner's word, with the cause not found. What is known:
- exitcap-162601 (probe 7f851ced8c): 1 of 94 runtime children took SIGSEGV after their test passed
  with the device kept live. In the core the fault is in an NVIDIA worker (eglcore into
  libnvidia-glvkspirv+0x363b2, address 0x18) named after the ended test thread, while the main
  thread ran libEGL_nvidia's exit handler (an ioctl in glsi). The runtime's 30-odd threads were
  all waiting, none in a section or a making.
- nvexit, a Vulkan program without the runtime (instance, NVIDIA device, one compute pipeline,
  return from main), beside the same 14-minute load of the runtime's device suite:
  - exitcrash-nvexit-201854: 507 with everything destroyed on the main thread, 0 faults;
  - exitcrash-nvexit-203651: 262 destroyed and 263 kept live, on the main thread, 0 faults;
  - exitcrash-nvexit-thread-230656: 259 destroyed and 259 kept live, made on a thread joined
    before the return, whose driver workers (named after it) still ran at the return, 0 faults.
The line goes where a user of the runtime reads open gaps.

(cherry picked from commit 5c6971ade39abb0ec1a92ad1c2a8fe80e112951e)
2026-11-09 01:35:53 -08:00
Anees Iqbal 051de6ce39 submit_stalls: the driver's stall is told by the thread's CPU time in the call, not its length
The 5080's submit_stalls_idle test failed in round 064's rt2 beside the runtime's device suite
(idle_submits 0, submit_stalls_idle 0, submit_stalls_on_work 20) after passing alone. A probe of
the queue's place (STALLPROBE counts and events, probe branch steelbrain/exitcrash-stallprobe
1227ec7423, entry exitcrash-stallprobe-225855) reproduced it 3 of 3 beside the suite and passed
2 of 2 alone:
- The driver's stalls came every 1024 counted calls (calls 760 and 1784 in every run) and spent
  1998 to 3880 us of the calling thread's CPU, within 0.5% of their length.
- Beside the suite, 25 to 29 other calls a run took 1.3 to 40.8 ms but spent 8 to 884 us of CPU:
  waits. Each, taken as the stall while the place was unconfirmed, moved the place off the
  stalls (the second stall came 354 to 551 calls after the last wait), so no stall was ever due
  at an idle (idles_due 0) and every one fell on work.
- The submit checks' uncounted uses forgot the place 114 times a run, alone and beside the
  suite, all within the device's first ~120 calls, before its first stall: not the cause.

So a call is the driver's stall only where its thread spent STALL_NANOS of CPU in it
(CLOCK_THREAD_CPUTIME_ID read before and after each timed signalling call, on a device whose
driver has DriverFact::SignallingSubmitsStallEvery1024 alone; elsewhere nothing more is read and a
call's length counts as before). The fact's own doc already names the cost as the submitting
thread's CPU.

Tests: calls_that_wait_long_beside_other_work_are_no_stall models the failing run (a wait of
1.5 ms every 250 to 410 calls, 15 in 5000): taken by length it gives the failure's counts
exactly (20 on work, 0 idle, 0 empty); by CPU, 1 on work and every later stall idle.
a_long_call_short_of_a_stall_is_none now also holds a 10 ms wait with under 1 ms of CPU to no
stall. The device test's doc states its calls on the 5080 (about two periods, its batches
merged), not five. FAST-PATHS' row says what a stall is.

(cherry picked from commit 5c8295ac235da7492861bc255e7d53874bfaaac7)
2026-11-09 01:35:53 -08:00
Anees Iqbal 6ee9db2b60 METAL2VULKAN_PENDING_AUDIT: a default-off audit of command buffers freed or reused while pending
A GPU hang on Iris (ANV) left a compute dispatch reading an interface
descriptor that another pass's viewport state had overwritten: the hung
command buffer's dynamic state went back to ANV's pool (a reset or begin)
while its request still ran. The path that freed it is not known yet. This
adds a diagnostic that finds it where it happens, against the GPU's own
timelines rather than what the host saw of them.

What it checks, where it is on (DeviceOptions::pending_audit, or
METAL2VULKAN_PENDING_AUDIT set, read at device creation):
- every vkBeginCommandBuffer made through the device's functions (Vk's
  begin_command_buffer, in both the full and the exit guard's tables), a
  primary begun ahead in a spare pool among them;
- each vkResetCommandPool of a spare pool, and each pool given back to the
  spares, for every command buffer the pool made;
- each submission of a command buffer submitted before and not begun for
  simultaneous use (ANV rewrites a chainable primary's tail at each
  submission).
What carries a command buffer: a batch's submission (direct or held in the
scheduler's group) to its queue's timeline value; the device's own and the
staging queue's submissions to their timelines; a secondary through each
primary that executes it (Vk's cmd_execute_commands notes it, a begin of
the primary forgets it). A failed submission is withdrawn. Each check reads
the carrying timelines with vkGetSemaphoreCounterValue; a value not reached
is a finding, logged (id name metal2vulkan-pending-audit, Info) with the
thread, command buffer, timeline, counter and value, and a backtrace for the
first 8. Off, each site tests an Option; on, it changes no work.

Tests: tests::pending_audit (the ledger: timelines, latest value per
timeline, one read per timeline per check, secondaries through primaries,
withdrawal, unreadable timelines, simultaneous use), and the device test
tests::pending_audit_device: a command buffer held on the GPU by a wait for
a reserved event signal has its pool given back early (a cfg(test) hook);
the audit finds it once and says it; after the host signal, the next command
buffer's pool reset, the primary begun ahead and its taking are checked and
nothing more is found. env_vars.rs registers the variable with its cost;
docs/API.md and api_signatures.tsv carry the option.

Verification: pending (potluck jobs on lavapipe and Iris).
(cherry picked from commit 2c524391e70921596add39688daf761cbc20662f)
2026-11-09 01:09:02 -08:00
Anees Iqbal f36d32dfd3 No-copy memory whose pointer the device refuses and whose source fails is a copy, as with no source
On RADV a no-copy buffer or heap over shared memory (a memfd mapping) made with no dma-buf
source is a copy of the pages since 3f69d1af77, but one made with a source that fails was
still refused (Unsupported, HostMemory): source_failure kept the dma-bufs' refusal unless the
pointer's refusal was the runtime's unpinnable one, and the caller marked it not the device's.
Metal makes a no-copy buffer over any page, and rule 2 lets only what Metal refuses or what
cannot run fail; the pages are readable, so the copy runs.

buffer_over_host_memory now carries whether the device was asked the pointer: where it refused
it (not_importable) and no dma-buf of the pages served either (the source failed, or the device
refused its dma-bufs, refused()), the outcome is the device's refusal, as with no source: a copy,
announced and counted as copied_host_buffers_device_refused. Unchanged: the unpinnable path
(copied as Failed), misuse (chunks that break the source's contract stay Invalid, DmaBuf), a lost
device, memory imported only as dma-bufs and windows the import alignment does not cover (no
pointer asked: still refused, as without a source), and rebinds (refused without a working
source, as before).

Docs: CopiedFor and CopiedBecause::DeviceRefused, the copied-host-pages detail and catalogue
entry (degradation.rs, docs/API.md), WorkCounts::copied_host_buffers_device_refused, copied.rs,
dma_buf.rs's refusals, HostMemory::with_dma_buf, imports_shared_host_pointers, the runtime
README and HOWTO section 6 and Copied host buffers.

Tests: copied_device's shared-memory test makes a second buffer, with a source that fails, over
pages of its own: on a device that refuses shared memory's pointer a copy counted as the
device's refusal, the source called once; elsewhere the pointer's import, no source called. The
runtime lane dma_buf_imports (renamed shared_memory_without_a_working_source_is_a_copy_and_
misuse_refused) expects the failing source's copy on RADV, over a view of its own.

Verified: cargo fmt only; the 780M runs (with a negative control on the base's
buffer_descriptor.rs) are dispatched next.

(cherry picked from commit a30909d44aec64136e29f57b5a5dacca8568d3bc)
2026-11-09 00:34:52 -08:00
Anees Iqbal 853e9205d9 word_samples_msaa: RADV's RGB9E5Float blend checked as the device's blend of halves
The 780M lane's red (19 answers, all RGB9E5Float blends at 2 and 4 samples on RADV PHOENIX,
Mesa 26.2.6) is the device's own blend arithmetic: RADV hands its blend an RGB9E5Float source
whose channels and alpha are halves rounded toward zero (a value past 65504 as 65504), where
Metal blends the floats. Vulkan asks a blend for no more precision and range than the
attachment's, which a half meets. Rule 1: the device's native blend is the only form, so no
path computes Metal's bits; the blend already records and announces device-color-conversion
(ChannelWrite::Device for a blend of factors other than one and zero).

The model, run offline over the lane's inputs (the probe's generator) and Metal's table:
- Metal's words are the f32 blend over Metal's stored samples, truncated to the format
  (32/32, 64/64);
- RADV's 11 failing sample words are the blend of halves rounded toward zero over Metal's
  stored samples, truncated, in 10 of 11. The eleventh (4 samples, pixel 7 sample 3) blends
  over a sample RADV's fill stored a code from Metal's;
- Metal's RGB9E5Float resolve is the crate-owned resolve's rule (f32 mean, nearest half,
  mantissas rounded half up) in 64/64 pixels. RADV's 8 failing blend resolves are that rule
  over the model's samples in 7 of 8.

The lane now, where the device is RADV and holds RGB9E5Float in its own format:
- checks each blended sample against that blend's word over the device's own stored sample,
  within a code (half_blend);
- checks the blend's resolve within a code of Metal's resolve of the device's samples
  (shared_exponent_resolve);
- prints how many of the samples' model words are not Metal's;
- requires device-color-conversion to be announced.
Elsewhere it keeps Metal's bound.

The note's declaration, API.md's entry and the comparison table's doc record the measured
size: 30 of 96 blended samples not Metal's, up to 33 units of the larger value's last
mantissa bit where the source passes 65504, and 7 where the half's alpha weighs a destination
far larger than the source.

Verified so far: the offline model above. The lane on PHOENIX is pending.

(cherry picked from commit 0fb6dcf07456cf7531021bb70fbe7eea64dadbb0)
2026-11-09 00:17:24 -08:00
Anees Iqbal 8bd103fc8e Record RADV's extrapolated perspective reads at a sample or offset as the device's answer
On the Radeon 780M (RADV, Mesa 26.2.6) runtime_lane::pull_model_interpolation read 1700
values off Metal's, up to about 1.0 in lane 3. The lowered pm_offset is straight-line code (a
uniform offset, its move and clamp, InterpolateAtOffset per input), so no control flow is at
fault. Every miss is a perspective input's read at a sample or an offset; the no-perspective
inputs' same reads were Metal's. A model with the lane's own geometry gives the driver's form:
the pixel center's value extrapolated along the quad's coarse derivatives,
f(center) + (f(tr) - f(tl)) * dx + (f(bl) - f(tl)) * dy. It reproduced all 52 one-sample offset
misses within 0.004 and all 1061 four-sample sample and sample_id misses within 0.005, where the
fine-derivative form was up to 0.98 off. Metal's value plus that form's error (first-order less
exact) matched each of RADV's within 0.2 of the lane's device bound.

Vulkan states no precision for interpolation, so under rule 1 the device's interpolation is the
answer: no form computes it otherwise. The fix records it.
- DriverWorkaround::PerspectiveReadsExtrapolated, a measured row keyed on RADV
  (driver_facts::DEFECTS, no vendor), as InterpolationNeedsTheWholeQuad is.
- PrecisionNote::ExtrapolatedInterpolation (extrapolated-interpolation). stage_io::plan records
  it structurally: an interpolant with the perspective qualifier read at a sample or an offset,
  or a perspective sample-qualified varying a looping function reads at each pass's sample
  (InterpolateAtSample), on a profile with that fact. A no-perspective read, the pixel-center
  form (offset 0), a center or centroid read and an absent interpolant record nothing.
- The pull-model lane: on such a device each perspective lane read at a sample or an offset is
  held to the device bound of Metal's value plus the extrapolation's error, computed from the
  lane's geometry (extrapolation_error), and the pipelines that read so, and those alone, must
  record the note.
- The engine tests over every committed profile assert the note where the RADV profile reads a
  perspective interpolant at a sample or offset, and nowhere else: pm_linear, a new fixture
  function reading the no-perspective interpolant alone at a sample and an offset, must not
  record it. The coverage-loop test asserts it for the looped perspective varyings on RADV.
- docs/API.md's device-interpolation entry and docs/FAST-PATHS.md's row no longer cover RADV's
  sample and offset reads with the 1.5e-4 figure. The new entry and row state the form and the
  measured size.
- SEMANTICS_VERSION 2000 (the RADV profile's pull-model and looping modules gain a note),
  ARTIFACT_FORMAT_VERSION 497 (the codec gains the note), api_signatures blessed. The refusal
  surface regenerated with no change.

The fixture's AIR companions for pm_linear come in the next commit, from the regen script on the
M3. The golden tables and the air_input snapshot are re-blessed on development.

(cherry picked from commit f4eb92a9bc4c099f9020fde2c2da40580514ec20)
2026-11-09 00:16:01 -08:00
Anees Iqbal ad451a5334 Scheduler: a held group never waits behind another queue's submission handlers
What. A pass that ends with batches held for one kernel submission keeps them held while their
VkQueue runs two or more earlier submissions (Group::keeps). It now sends them instead where a
submission handler the thread runs once its passes end (scheduler::round) is of a command
buffer of another logical queue (Metal command queue) than a batch held:
scheduler::holds_back_another_queue, over the round's handler list and the batches held with
their logical queues. The handlers of the held batches' own queue still keep the group held.
CommandBufferShared::logical_queue reads a command buffer's queue identity for it.

Why. A submission handler runs on the scheduler thread, and a held batch's handlers run as it
is held, before its group goes to the driver. Where two command queues share one VkQueue on a
driver that merges, a batch of one queue held and kept behind running work, and a batch of the
other queue with a handler that waits for the first one's completion joined the group: the
group stayed held until the handler returned, so the handler waited for work its own return let
go (the deallocator lane test on the Iris Xe hit it once, its handler waiting 60 s). Metal does
not do that: on an M3 Max under macOS 27.0.1 (probe cross_queue_handler_waits), a command
buffer's completed handler reached another queue's scheduled or completed handler that waited for
it in each of 30 runs, 7.6 to 9.3 ms after the wait began, b committed before a included. On one
queue it never did (the 5 s bound in each of 10 runs): Metal runs one queue's handlers one at a
time, so the runtime keeps the group there and promises nothing more than Metal.

Cost: a group mixing two queues' batches is no longer kept past a pass in which a submission
handler of one of them runs; it goes then, the batch that joined last included, in one
submission. Measured on a lane (frame_costs_over_imports, the guest's shape) in the runs that
verify this commit.

Docs: group.rs ("Kept while its queue runs earlier work", Group::keeps),
CommandBuffer::add_submission_handler ("Keep it short"), the runtime README's handler entry,
and FAST-PATHS.md's grouped-submission row.

Verified: cargo fmt. Build, clippy and runs (the previous commit's test, without and with this
change; the deallocator lane test as it was) are potluck jobs on the Iris Xe and the XTX.

(cherry picked from commit 8d04b2d15d3cb745363428fdc9acbbb9ca2eb868)
(cherry picked from commit 2cbd8a970905d931b7be39c92fbdd18d6024f62a)
2026-11-08 23:56:34 -08:00
Anees Iqbal f11ad530fe blit fill: a multisampled 32-bit float depth's samples clamp into [0, 1] where the device's do
On Iris Xe (ANV, RPL-P), which lacks VK_EXT_depth_range_unrestricted, the sample_fills case
d32-wide-4 fills a 4-sample Depth32Float texture with 33221100 77665544 bbaa9988 ffeeddcc and
reads back 33221100 3f800000 00000000 00000000. A multisampled fill writes each sample's bits
into an R32_UINT scratch image and copies it into the depth image (maintenance8's colour-to-depth
vkCmdCopyImage on ANV), and Vulkan writes undefined values there for a depth outside [0, 1]: ANV
stores the NaN as 0. restricted-depth-upload, announced once per device on an earlier case,
promises a clamp, a NaN 1.0, that no step made. replace_region and the buffer-copy route clamp
before the copy (depth_clamp.rs); the multisampled fill did not.

sample_fill now clamps each sample's depth word on the CPU (bind::clamped_depth) where the
texture clamps depth uploads, announces restricted-depth-upload for the fill, and counts it in
WorkCounts::depth_uploads_clamped, as replace_region does. A device with the extension writes
the bits as before. The docs of depth_clamp.rs, the counter, the degradation and docs/API.md's
entry name the fill.

The lane: the probe recorded d32-wide-4's digest (9c5b7be066d1c9fc) alone. depth_lines rebuilds
a byte-filled Depth32Float case's lines from the fill rule; the_recorded_lines_are_the_probes
holds the rebuild to that digest and to the recorded d32-4 and d32-2 lines. A Depth32Float case
on a device that announced restricted-depth-upload passes where it holds Metal's lines with every
word through clamped_depth, the fill counted (SAMPLE-FILLS-CLAMPED). Expected on Iris:
33221100 3f800000 00000000 3f800000. The metal.txt fixture, and so the conformance recordings'
input digest, is unchanged.

Verified offline: the rebuilt d32-wide-4 and d32-4 lines hash to the probe's 9c5b7be066d1c9fc
and 2098b9445cd43b96. Device runs (Iris, lavapipe, M3) are reported with the tip.

(cherry picked from commit b3f0f2ba7e176fa1972cb89982f6404375ffd169)
2026-11-08 22:48:29 -08:00
Anees Iqbal c1a825d748 Volume resolves: RADV writes a 3D image's first plane, so resolve through a scratch copied into the planes
On a Radeon 780M (RADV, Phoenix) a 4x multisampled RGBA8Unorm attachment resolved into depth plane
3 of a 4x4x4 volume, through the 2D view of the plane that resolve::destination attaches, wrote
plane 0 instead (the volume's first byte held the resolve; view_attachments, three runs at each of
two commits, ownpixel's job). Drawing into the same kind of view writes its plane there, and the
usage is valid: a 2D view of a 3D image made 2D_ARRAY_COMPATIBLE "can be used as a framebuffer
attachment that refers only to the specified range of slices" (VkImageSubresourceRange), and of a
resolve attachment Vulkan refuses only a 3D view (VUID-VkRenderingAttachmentInfo-resolveImageView-
12471). MoltenVK on the M3 Max writes each named plane (a_resolve_writes_the_volume_plane_it_names).

RuntimeDriverDefect::VolumeResolveFirstPlane names it, on every RADV GPU until a probe finds one
clean (driver_defects.rs, the table's rule). There a color resolve into a 3D texture's planes past
its first, or into more than one, goes into a scratch image of the pass's layers (Destination::
attach), whose layers ResolveCopies copies into the planes after the pass: one region whose depth is
the layers, from the resolve's first plane (VUID-VkCopyImageInfo2-srcImage-01791, dstImage-04444).
The scratch's copy into a 3D texture was not built before (render_pass::not_2d refused it); it is
now, but for a level reaching past the attachment, whose clear would be of the planes alone, which
stays NotImplemented(Render). Announced as resolve-scratch, its reason naming the defect; the
catalogue and the variant's docs say so. The device's own resolve still averages: the copy moves
its result unchanged.

Tests: tests::driver_defects lists the defect for every committed RADV profile;
runtime_lane::view_attachments::a_resolve_writes_the_volume_plane_it_names fails without the
change on the 780M (to be run with the runtime before it and after, on the 780M and the XTX).
docs/REFUSALS.md regenerated: unchanged.

(cherry picked from commit dcffee430897a499f47155664a8549a248b8a8ad)
(cherry picked from commit 707ef3439b2ca3c5f81f967a1322470da47c0d77)
2026-11-08 22:48:23 -08:00
Anees Iqbal de5a77cc06 Wide lines: no device's own lines are taken as Metal's parallelogram
RADV fails wide_lines_draw_metal_s_parallelograms and its exact-answers twin at the lane's
"scattered lines width 2.5, fragments" map, 628 pixels where Metal's has 622: on the Radeon RX
7900 XTX (homelab-gem10-1, m3-max-10724) and on the 780M (homelab-um870-1, its only GPU,
m3-max-10773), at this branch's base and at development alike. The runtime took RADV's lines as
Metal's there, unannounced: RADV is the one driver of the committed profiles stating non-strict
parallelogram lines (strictLines unset, nonStrictWideLinesUseParallelogram set), and 2.5 lies on
its 1/8 granularity above 1, so the route was the device's lines under both policies.

Cause, measured: a probe on the XTX (m3-max-10800, a scratch branch, never merged) drew each of
the 48 scattered lines alone and printed its pixels. 21 of them lie a row or a column off Metal's
parallelogram at an end: one more past the first vertex, one fewer before the last. A model of
Metal's rule (endpoints on the 1/256 subpixel grid, the parallelogram whose minor-axis edges are
w' long through them, the ends not extended, pixel centres by the top-left rule) reproduces
Metal's map pixel for pixel; the XTX's ends fit no constant shift of it. Vulkan leaves where a
non-strict wide line's ends fall to the implementation, and no driver is measured to place them
as Metal does.

Change: the device route has no exact form any more (render/line_width.rs route). Every draw the
device's own lines take is announced device-wide-lines, the notice naming "parallelograms, whose
ends and endpoints' snap the driver places as it draws them" where the width is on the grid above
1, and under WideLinePolicy::Exact (exact_answers) the band draws it wherever the device has
tessellationShader. On RADV, widths above 1 on the 1/8 grid move from silent device lines to
announced device lines under the default, and to the band under exact answers. No other profile
changes route: lavapipe and NVIDIA (strict) and ANV (not stated as parallelograms) were announced
already.

Tests: the runtime's route table reads A or B where it read E for the three RADV profiles (Cell::
Exact removed). The validation lane drops LineFacts::draws_as_metal, and asserts per case that
the draws of the device's own lines announce device-wide-lines one for one, which fails without
this change on RADV (width 2.5 drawn by the device's lines with no notice); the edges test
asserts the notice at each device-line draw.

Docs: render/line_width.rs's module docs, DeviceWideLines' rustdoc and docs/API.md's entry and
policy text, WideLinePolicy's and DevicePolicy::wide_lines' docs, the runtime README's route table
(its "exactly Metal's" row folded into the announced one), docs/FAST-PATHS.md's row (no device's
lines are taken as Metal's; the cost adds a row or a column at an end), docs/RUNTIME-PORTING.md's
SetLineWidth row. The announced cost string is unchanged.

Notices: one device-wide-lines per device (once per kind, unless announce_each names it) on a
RADV run that draws wide lines only at widths above 1 on the 1/8 grid, where it announced
nothing; a run that already drew a width below 1 or off the grid announced it already.

Needs the runtime-sources pin and a RUNTIME_VERSION (the orchestrator's numbers).

Verified: cargo fmt. The XTX, 780M, lavapipe and M3 runs follow through potluck.
(cherry picked from commit be88ae03f199d5a485abcc546d0d52b181290e7b)
2026-11-08 22:45:29 -08:00
Anees Iqbal aef1b019f4 Lines at the nearest width go on the device's granularity grid, never 0
With the refused band's lines through pixel centres (the commit before), RADV on gem10's RX 7900 XTX (NAVI31; the 780M, PHOENIX, on um870 reads the same, job 10773)
drew nothing at round 0 of a_refused_band_draws_at_the_nearest_width (m3-max-10559), where Metal
draws 23 pixels (its probe's 'horizontal y=16.5 x 4.5 to 27.5 width 0'). The nearest route
handed the driver w' = 1/16 for Metal's width 0, clamped into lineWidthRange [0, 8] alone. RADV's
lineWidthGranularity is 1/8 from 0, so 1/16 is a tie between 0 and 1/8, and Vulkan lets the
driver take either ("the nearest supported width"): a line of width 0 covers no pixel centre.
ANV's grid is 1/128, which holds 1/16, so ANV draws it as it is.

The nearest width is now on the device's grid: clamped into the range, then the nearer step of
lineWidthGranularity from the range's bottom (a tie the wider), and never 0 where the range starts
at 0 (render/line_width.rs drawn_width). So RADV draws Metal's width 0 at 1/8, and ANV still at
1/16. The runtime's route test and the validation lane's LineFacts::nearest mirror the rule; the
module docs, the runtime README's table, docs/API.md's lines-at-nearest-width entry and the
kind's rustdoc say it. The announced cost is unchanged.

Needs the runtime-sources pin and a RUNTIME_VERSION (the orchestrator's number).

Verified: cargo fmt. RADV, lavapipe, the M3 and the Iris lanes follow through potluck.

(cherry picked from commit c20de3da6e, message corrected: the run it cites (m3-max-10559) took the XTX, its MESA_VK_DEVICE_SELECT lacking the "!")
2026-11-08 22:17:31 -08:00
Anees Iqbal 81abe49dad Attached reads of the levels before the attached one read the texture's own image
A draw's sampled slot of a texture its render pass instance renders at level k (counted from the
texture's own first level) took the texture's usage shadow, a whole copy of every level, even
where its reads reach only levels before k. Such a slot now binds the texture's own image
through a view of its levels 0..k, the same first level, so an explicit level of detail selects
the same level, and names those levels in its uses (`binding::NarrowedSlots`): no copy is taken
for it. The copy would hold the same texels: nothing the instance does writes those levels
where the texture is an image of its own the bind reads in place (not sparse, no decoded twin,
the sampled usage), no attachment of the instance is at them, no earlier draw wrote them since
the instance's last barrier (a draw after one records into a new instance), and no write of the
draw's own meets them (else every narrowed slot of the draw takes its copy, its uses made
again). Which levels a read reaches is the translator's fact (`StageModule::level_reads`)
through the samplers the draw binds: level-count and level-of-detail queries, computed fetch
levels and samples without a sampler-bounded level keep the copy.

A draw rebound works its narrowed slots out again and is rebound only where they are its kept
draw's; a draw again binds as its kept draw did.

WorkCounts: attached_read_slots_below becomes attached_read_slots_apart (the own image cannot
serve them), attached_read_slots_written (something writes those levels) and
attached_read_slots_narrowed.

Verified: cargo fmt only; the build, clippy, a device test of an explicit read of level k - 1
while level k is attached and the touched suites follow as potluck jobs.

(cherry picked from commit 7ba814a2e2f419643c2f9e68b9768709658cbe94)
2026-11-08 21:48:37 -08:00
Anees Iqbal 5ed5e47ae5 DriverFact::ColorClearTakesEitherCode on RADV on the Radeon RX 550 (Polaris 12), as measured
runtime_lane::color_fills::plain_color_fills_are_the_device_s_clear failed on the RX 550 (um790,
RADV POLARIS12, Mesa 26.2.6, job m3-max-10655 at 90c9936538): 186 plain fills differed from
Metal's past what they announce, 93 colour fills of 11 formats, each in a texel of a level and in
a whole 1 x 1 slice: RGB10A2Unorm and BGR10A2Unorm 24 each, RGBA8Snorm 9, RGBX8Snorm 7,
RGBA8Unorm, BGRA8Unorm and ARGB8Unorm 6 each, RGBX8Unorm 5, RG8Snorm 3, RG8Unorm 2, A8Unorm 1.
Every differing channel stored the code below the nearest, a code from Metal's, off the
midpoint: 8-bit scaled values 0.50 to 0.58 past their lower code (RG8Unorm's 0.515986, 131.58
codes, stored 131 where Metal stores 132), 10-bit ones 0.51 to 0.87 past (0.549235, 561.87 codes,
stored 561). None was announced: the runtime announces a clear off a midpoint only on a driver
that takes either code (clear_value::rounds_apart).

The cause: the device's clear cuts the colour to a half toward zero, then rounds to the code.
That model gives every one of the 270 channels of those 93 fills (offline, from the job's
lines), and the same lane's R16Float clears store the half cut toward zero (0.001 as 0x1418,
Metal's 0x1419), RG16Float and RG11B10Float alike, already announced there. A half's cut is under
half a 10-bit code, so the stored code is one of the two nearest: Vulkan's "one of the two ...
closest" allows it, the device's native conversion. The row records it as the 5080's and ANV's
do, keyed to RADV, AMD's vendorID and the RX 550's deviceID (0x699f, AMD_RX_550), so the runtime
announces device-color-conversion for a clear or plain fill of a normalized channel anywhere off
a whole code there.

The fact's doc gives the measurement; docs/API.md's clear entry names RADV on the RX 550. No
committed profile is of the RX 550, so no profile's facts move.

Verified: the model offline over the 10655 lines. The RX 550 color_fills lane and the suites
follow through potluck.

(cherry picked from commit e3455e70e245184ce96777a64e4a166c73400625)
2026-11-08 21:42:16 -08:00
Anees Iqbal f0628b75eb The levels each texture slot reads, and the attached-read slots counted by them
The translator states, for each texture slot of a stage, the levels of its bound view its
reads reach (`StageModule::level_reads`, `spirv::requirements::level_reads`): whether some
read may reach any level, the highest constant level a fetch, size query or gather names
(through the fetch lowering's `UMin(c, levels - 1)` containment too), and its samples by
sampler, with the highest constant explicit level of detail and whether one is computed.
`SampledLevels::level` answers the highest level such samples reach through a bound
sampler (`SamplerLevels::of` a `vk::SamplerDesc`: its LOD clamps, bias and mip mode), and
`LevelReads::highest_level` the slot's.

The runtime counts, at each draw that takes every step and reads through copies, every slot
whose sampled binding presents a texture an attachment of the instance renders
(`WorkCounts::attached_read_slots`), split by how its reads meet the lowest attached level:
one level, the first level attached, any level, reaching it, or below it. The samplers are
those the draw binds (the bind's own descriptor for a runtime sampler, the layout's
immutable sampler for a constexpr one). No draw binds or copies otherwise: this names the
shape of the usage shadow the attached reads of mipmapped textures take, ahead of serving
the "below" slots through a view of fewer levels.

SEMANTICS_VERSION 1998 and ARTIFACT_FORMAT_VERSION 495: the artifacts carry the new fact.
api_surface and api_signatures name the new public types and fields.

Verified: cargo fmt only so far; the build, clippy and tests run as potluck jobs next.
(cherry picked from commit 89855203ad1b8b9b3695f313b3cdb34688993840)
2026-11-08 21:15:12 -08:00
Anees Iqbal e67c617756 Visibility past an early-tests mask: announced where the device may count after the mask
runtime_lane::sample_coverage::the_sample_coverage_applies_after_the_fragment_function fails on
the Iris Xe (ANV, RPL-P) at its three early-tests draws: a full-screen draw of coverage 0.3
under psc_early counts 0 of 256 samples at 1 sample, 80 of 512 at 2 and 140 of 1024 at 4
(iris-B at 6cb37f2c86), where Metal counts every sample the early tests pass and masks the
colors alone. Its colors and depths are Metal's. The translator applies Metal's private masks
under early tests in the fragment function's SampleMask output, which Vulkan orders after
sample counting only where the device states earlyFragmentMultisampleCoverageAfterSampleCounting
(VkPhysicalDeviceMaintenance5Properties). ANV's capture on the Iris Xe of RPL-P states false;
RADV on the 780M, NVIDIA's on the RTX 5080 Laptop GPU, lavapipe and MoltenVK on the M3 Max
state true.

- metal2vulkan: Limits::early_fragment_multisample_coverage_after_sample_counting, read from the
  maintenance5 structure (false without the extension), and
  GraphicsState::writes_sample_mask, the fragment function's SampleMaskOut builtin (its own
  [[sample_mask]] return or the private masks it applies). SEMANTICS_VERSION 1998,
  ARTIFACT_FORMAT_VERSION 495 (a new encoded field).
- metal2vulkan-runtime: a draw under a visibility result (Counting or Boolean) whose fragment
  function declares early tests and writes its sample mask, on a device without the property,
  runs announced as Degradation::VisibilityPastEarlyMask
  (metal2vulkan-degrade-visibility-past-early-mask) and is counted in
  WorkCounts::draws_counted_past_early_masks. Keyed to the documented property alone, never to
  a driver or vendor.
- No structural form keeps Metal's count at no cost to uncounted draws: the colors' masks are
  the SampleMask output or a discard, both fragment operations such a device may count after, so
  only a second draw of each counted draw without the mask would count as Metal does. The
  announcement is the proportionate answer.
- The lane: on a device without the property, the early draw's colors and depths are still
  Metal's, its count at most Metal's, the draw counted once and the kind announced; elsewhere the
  count is Metal's and nothing is announced.
- docs/API.md's catalogue entry, docs/FAST-PATHS.md's device-gap row, visibility.rs's module docs,
  the api_signatures rows, and validation's limit bound (Execution). docs/REFUSALS.md
  regenerates unchanged.

Not done here: the runtime-sources pin and RUNTIME_VERSION (the orchestrator's number), and the
golden tables, which development re-blesses.

Verified: cargo fmt; the device description test reads the property from RADV's and ANV's
captures. Builds, lint and lanes follow through potluck.

(cherry picked from commit 4aa2896af563c41fec7d8129f15fb86b5dc4e418)
2026-11-08 20:41:07 -08:00
Anees Iqbal 553a7dfeb3 half_read_nans: a sampled 32-bit float NaN or denormal is the device's under device-texel-conversion
What the device does: ANV on the Iris Xe (Mesa 26.2.6) hands back every NaN
of an R32Float, RG32Float or RGBA32Float texel as 0xffc00000 in a nearest
sample, through a constexpr sampler or a runtime one, and every denormal as a
zero of its sign. Metal hands back the stored bits. Reads, texture-buffer
reads, argument-held reads and gathers on ANV hand back the stored words.
Iris run m3-max-10431: 224 sampled lanes, every one a NaN as 0xffc00000 or a
denormal as a zero of its sign, and no other difference.

Why the old expectation was wrong: on a device whose texture unit is not
Metal's (no VkProperty::MetalSampler), a float-result access hands back the
device's own conversion of the texel, recorded as
PrecisionNote::DeviceTexelConversion. That is rule 1's native sampling. The
note's recorded bound and the lane covered a 32-bit float texel's NaN and
denormal only in a gather (NVIDIA), plus a denormal in a nearest sample
(RADV). ANV's samples are the same native behaviour, measured.

So:
- PrecisionNote::DeviceTexelConversion's recorded bound (artifact.rs) and its
  docs/API.md entry now name a 32-bit float texel's NaN in a nearest sample
  as the device's encoding, with ANV's measurement beside RADV's denormals.
- The lane takes a NaN of the device's encoding and a denormal flushed to a
  zero of its sign in a sample, as it did in a gather. It now also asserts the
  notice: where the texture unit is not Metal's, each sample dispatch's
  executed stage (CommandBuffer::executions) records DeviceTexelConversion,
  and the device announces device-texel-conversion.

Verified: the Iris run follows.
(cherry picked from commit d759e0fb4b264508f32ee069b9945e9c7f39fa34)
2026-11-08 20:16:04 -08:00
Anees Iqbal 7be13179cc DriverFact::ColorClearTakesEitherCode on ANV on the Iris Xe of RPL-P, as measured
runtime_lane::color_fills::plain_color_fills_are_the_device_s_clear failed on the Iris Xe (ms01,
job m3-max-10408 at 67b66645ab): "4 plain fills differ from Metal's past what they announce",
each the colour (0.0845, -5e-324, 0.8793, 1e300) into RGB10A2Unorm and BGR10A2Unorm, in a texel
of a level and in a whole 1 x 1 slice: the 10-bit channel of 0.8793 (899.51 codes) stored 899
(RGB10A2Unorm f8300056 against Metal's f8400056, BGR10A2Unorm c5600383 against c5600384), off
a midpoint, which the runtime announces only on a driver that takes either code
(clear_value::rounds_apart). Beside them 3,827 texels of 38 formats and placements stood a code
apart at ties, announced. And ANV's load-operation clear takes its code by the image: 0.1 in an
8-bit unorm channel (25.5 codes) stores 0x1a in a private optimal image and 0x19 in a linear
image in place over host pages or in a shadow listing an unsigned-integer view format
(pitched_surfaces, no_copy_textures; the lanes' previous commit). Vulkan allows either code
("one of the two unsigned binary integer values ... closest"), so this is the device's native
conversion: the row records it as the RTX 5080 Laptop's row does, keyed to the measured driver,
vendor and deviceID (0xa7a0), and the runtime then announces device-color-conversion for a clear
or plain fill of a normalized channel anywhere off a whole code there.

The fact's doc gives the measurement; docs/API.md's device-color-conversion entry names ANV;
the committed profile's facts test (device::tests::driver_facts) lists it for
intel-irisxe-rplp-anv. The profile's fingerprint moves with its facts, so the golden tables
follow on development.

Verified: cargo fmt. The Iris color_fills and lane modules, the Linux suites and lint, and the M3
follow through potluck.

(cherry picked from commit 385c9c6357cd5eb8d0e6deb579533fcad45b5472)
2026-11-08 20:08:34 -08:00
Anees Iqbal 57c21dc6bb Draws unlike their kept draw only in their own arguments are rebound with them
In reims' pin-26 glass walk, 69,981 of 70,882 draws unlike their kept draw differed only in
their arguments (draws_unlike_kept_arguments_alone, all of them in the index offset), and each
took every step. Such a draw, of something to draw, now goes to the rebound path
(render/draw_again/rebound.rs), whatever its tables' stamps, and works out again each step that
reads its arguments:

- its route, which reads them only through whether the draw may make a primitive
  (line_width::draws_primitives): the draw goes on only where that is the kept draw's;
- its commands' Vulkan draw, index overrun, BaseVertexInstance push fields and index buffer use,
  through a new BindingPlan::redraw_apart_into, which answers Ok(false) where the plan reads the
  arguments some other way (a stage's argument or root table, a mesh, patch or de-indexed draw)
  or a fixed-function vertex buffer's fetch window moves with them;
- its pulled attributes' reach (check_vertex_reach, as before, now of the new draw);
- its index buffer's use, patched in place as a moved slot's use is
  (binding::patch_command_uses), so a moved, narrowed draw checks, notes and gathers it with
  the moved slots' uses;
- its index buffer's bind (IndexBind::of of the new source), recorded where the record holds
  another, with its new draw; the kept draw takes its arguments, index source and draw.

A stop at one of those steps is counted (WorkCounts::draws_rebind_stopped_arguments) and the
draw takes every step; a rebound one is counted in draws_rebound_arguments. A draw of other
arguments that draws nothing still takes every step and is counted unlike, as before. The
draw-again debug check covers the new form: the kept draw it compares is the kept draw with the
new arguments, and the rebound check now compares the recording's Vulkan draw and index buffer
bind as well as its draw state.

New public items: BindingPlan::redraw_apart_into (docs/API.md), WorkCounts::draws_rebound_arguments
and draws_rebind_stopped_arguments (api_signatures blessed). Tests: the translator's
draws_of_other_arguments_redraw_what_every_step_writes holds redraw_apart_into to every step's
commands (first index, count, base vertex, a robust overrun) and to Ok(false) where a window
moves, for another kind, index type or buffer, and a de-indexed plan, and to every step's error
past a multiview limit; the runtime's draws_of_another_first_index_alone_are_rebound_with_their_pixels
draws each rectangle by its first index alone, then by its base vertex alone, rebound, with the
commands, state commands and pixels of the same draws taking every step; the unlike-count test
now holds one draw rebound with other counts, one stopped at its route and one of nothing.

(cherry picked from commit ab3e5002bbd6bf8dde7c2761bf7d12ab4461b555)
2026-11-08 20:04:26 -08:00
Anees Iqbal e22f367533 HOWTO section 7: the RX 550's missing extension as listed, not by generation
6ff21171d8's message said RADV enables VK_EXT_image_drm_format_modifier
on GFX9 and later only; that was inferred, not measured. Measured
(m3-max-10378, vulkaninfo on um790, Mesa 26.2.6): the RX 550 (POLARIS12)
lists VK_EXT_external_memory_dma_buf and VK_EXT_queue_family_foreign but
no VK_EXT_image_drm_format_modifier; the 780M (PHOENIX) and lavapipe
list all three. The line now says that. Doc only.

(cherry picked from commit 617becef4f0d68a14d0ff85ce0b15c5e07f81e0a)
2026-11-08 18:30:28 -08:00
Anees Iqbal 006d43ecb0 HOWTO section 7: the RX 550's dma-buf planes are shadows for want of VK_EXT_image_drm_format_modifier
RADV enables VK_EXT_image_drm_format_modifier on GFX9 and later only, so
the RX 550 (POLARIS12) has no DRM_FORMAT_MOD_LINEAR image to import a
dma-buf export's memory into: its dma-buf planes stay announced
shadows. Doc only.

(cherry picked from commit 6ff21171d8d228d1e22bdb072b65f67c85784187)
2026-11-08 18:30:28 -08:00
Anees Iqbal 7b29073f8c A dma-buf export's texture goes in place through its own dma-buf where no image binds in the memory
On RADV the runtime's memory exported as a dma-buf takes no image of a
texture's: the format query takes the dma-buf handle type for no
linear image, and its DRM_FORMAT_MOD_LINEAR image requires a dedicated
allocation (VUID-vkBindImageMemory-image-01445), so the 780M's VA-API
frames' planes were announced shadows (m3-max-10261, 10304). Binding
an image naming another handle type there is no way out: the layer
checks each type of the memory's export set against the bound image
(VUID-VkExportMemoryAllocateInfo-handleTypes-09860, m3-max-10339).

As the last step before the shadow, on any device that does it, the
texture's image is the runtime's route for images over dma-bufs
(Device::dma_buf_image): a DRM_FORMAT_MOD_LINEAR image whose explicit
plane lies at the texels' offset in the memory with Metal's pitches,
bound to a dedicated import of that memory's own dma-buf:

- dma_buf.rs: explicit_plane_image (shared with dma_buf_image_unbound),
  exported_dma_buf_image_unbound (the format query with DMA_BUF
  importable, the driver's layout, the image's memory within the
  memory and of its type) and bind_exported_dma_buf_image:
  vkGetMemoryFdKHR(DMA_BUF) of the memory (Device::dma_buf_of, as
  export_memory_dma_buf makes one), vkGetMemoryFdPropertiesKHR, the
  dedicated import at the image's size (01433; the import's type is
  among the image's, 02989; bound at offset 0, 02628), of the memory's
  own type. Vulkan imports a payload into the instance that exported it
  (VkImportMemoryFdInfoKHR, fd-00668). import_dma_buf hands the driver
  a duplicate and closes ours either way. The import is a DmaBufPages
  of no source (of_exported), freed after the image, live in
  WorkCounts::dma_buf_image_memories_live; each image is counted in the
  new WorkCounts::exported_dma_buf_images.
- texture.rs: exported_dma_buf_alias, after alias_unbound's refusal of
  the image in the memory (a shared block's, or a buffer's dedicated
  allocation): only for the runtime's dma-buf exports, only on a
  refusal (a pending or failed verdict stands), under the device's
  check of that memory; the image must hold exactly Metal's texels to
  the buffer's end (linear_plan::aliases). alias_image binds it
  (exported_dma_buf_texture_image: the buffer's memory held, the first
  move acquiring from VK_QUEUE_FAMILY_FOREIGN_EXT into GENERAL as an
  image over dma-buf pages does), alias_image_made answers it unbound.
  Devices whose image binds in the memory (ANV, lavapipe) keep that
  path unchanged.
- in_place_check.rs: the ExportedDmaBuf class takes a dma-buf's
  dedicated allocation too, and its textures take this route wherever
  the image in the memory is refused, so its verdicts (reads: a CPU
  write through the buffer's mapping read through the import's image;
  writes and renders the other way) measure it. CHECK_VERSION 13 -> 14:
  13's records kept ExportedDmaBuf Unchecked as a cause that lasts.

Test: exported_textures'
a_dma_buf_export_s_planes_go_in_place_through_its_own_dma_buf_where_no_image_binds_in_it
asks the device itself (the format query and the image's dedicated
requirement) whether a plane's image binds in the memory; where none
does and the device makes DRM_FORMAT_MOD_LINEAR images, each plane must
be in place through the import (counted) or a CheckFailed shadow, never
Unchecked; the buffer's export is a dma-buf (fdinfo exp_name); one
import live per such image, none once the textures go; no VUID. The
NV12 test reads such an image's memory plane (09433). The RX 550
enables no VK_EXT_image_drm_format_modifier: its planes stay announced
shadows.

Docs: API.md's shadow rule, HOWTO section 7, the runtime README, the
module docs.

Verification follows: the 780M, the RX 550, lavapipe and the Iris Xe
under the layer, then the 5080 through an entry.

(cherry picked from commit c2e90e2321937067d38cebc5b342f651a638b064)
2026-11-08 18:30:28 -08:00
Anees Iqbal 5ebe1d32aa Revert the dual dma-buf export and the opaque-descriptor naming
Reverts 1acb4f1fbf, 07d9fcac79, 6a6523d2bf, 4a13dfe5bc and 239d8ff9bb
as one fix-forward commit; the tree is b4331408bd's again.

An image naming an opaque file descriptor in a block exported as
DMA_BUF | OPAQUE_FD went in place on the RX 550 (m3-max-10339 at
239d8ff9bb), but the validation layer reported
VUID-VkExportMemoryAllocateInfo-handleTypes-09860 at each bind: it asks
vkGetPhysicalDeviceImageFormatProperties2 for the bound image with each
handle type of the memory's export set, and RADV supports no dma-buf
linear image. Its DRM_FORMAT_MOD_LINEAR dma-buf image requires a
dedicated allocation. So no image in a shared block exported as a
dma-buf is clean under the layer there, whatever else the block
exports, and the block goes back to exporting the dma-buf alone, with
no opaque naming and no counter of it. The next commit takes the
DmaBuf route instead: the block's own dma-buf, imported as memory
dedicated to the texture's image.

(cherry picked from commit af8bda811b4ba9a7816965d2f3bf1fd710d1e40e)
2026-11-08 18:30:28 -08:00
Anees Iqbal 0b1dd0fc36 An image over a dma-buf block names a type the block is exported as, with no image-side compatibility test
On the 780M (m3-max-10304 at 07d9fcac79) the image naming an opaque
file descriptor over a block exported as DMA_BUF | OPAQUE_FD was
refused only by the image-side compatibility test this branch added:
RADV's format query lists compatibleHandleTypes 0x1 (the opaque type
alone) for its opaque linear images. That test was stricter than
Vulkan:

- VUID-VkExportMemoryAllocateInfo-handleTypes-09860: the export set's
  bits must be compatible "as reported by ...
  VkExternalImageFormatProperties, or VkExternalBufferProperties"; the
  buffer query answers them so (FdExport::new).
- VUID-VkImageCreateInfo-pNext-00990: an image's handleTypes lie in its
  own compatibleHandleTypes; the image names one type.
- VUID-vkBindImageMemory-memory-02728: the memory's export set includes
  one of the image's types.

So the test goes (LinearRefusal::Incompatible and
ModifierMemory::shared_with with it). What stays, per handle type the
image names: the format query reports it EXPORTABLE, not
DEDICATED_ONLY; the image made requires no dedicated allocation
(VkMemoryDedicatedRequirements); its memoryTypeBits take the block's
type and its alignment is met at the texels' offset (alias_unbound_in's
aliases check); and the in-place check measures that exact image, under
the layer, before a texture takes it. The VUIDs are cited where the
export set (FdExport::new) and the image's handle type (alias_unbound)
are decided. Docs follow: API.md's shadow rule, HOWTO section 7, the
in_place.rs module doc.

Verification: the 780M, the RX 550, lavapipe and the Iris Xe next, then
the 5080 through an entry.

(cherry picked from commit 239d8ff9bbd4477d784f4ccc815ebf8af53dcad0)
2026-11-08 18:30:28 -08:00
Anees Iqbal 6d5c7b8e92 A dma-buf block's images name an opaque file descriptor where the device takes no dma-buf image in a shared block
On the 780M (RADV PHOENIX) the runtime's memory exported as dma-bufs
kept every texture a shadow: the device's image format query refuses
the dma-buf handle type to a plain linear image and takes it for a
DRM_FORMAT_MOD_LINEAR image only in a dedicated allocation, so the
in-place check of that memory made no image and its verdicts stayed
Unchecked (m3-max-10261). RADV takes an opaque file descriptor for the
same images in a shared block (the opaque-descriptor planes are in
place there, alignment 256).

The remedy, decided from documented queries alone:

- exported_memory.rs: FdExport::new asks
  vkGetPhysicalDeviceExternalBufferProperties for the dma-buf and the
  opaque handle types with the runtime's buffer usage. Where the
  dma-buf's compatible types hold the opaque one, and the opaque one is
  exportable, not DEDICATED_ONLY, and compatible with both, a shared
  block of dma-bufs is allocated exportable as DMA_BUF | OPAQUE_FD
  (Memory::export_dma_bufs_as). Elsewhere, and for a buffer's dedicated
  allocation, it stays the dma-buf alone. The buffer still names the
  dma-buf type (VUID-vkBindBufferMemory-memory-02726 needs one in
  common) and export_memory_dma_buf is unchanged: vkGetMemoryFdKHR of
  the dma-buf type, a dma-buf of the same memory.
- memory.rs: Exported carries the export set beside the handle type;
  bound_memory answers the set.
- texture.rs: alias_unbound tries the image naming the dma-buf type,
  then, where the block exports both, the one naming the opaque type,
  each through the same linear-then-DRM_FORMAT_MOD_LINEAR route
  (alias_unbound_in). An image takes a handle type only where
  vkGetPhysicalDeviceImageFormatProperties2 with that type reports it
  exportable, not DEDICATED_ONLY, and lists every type the block is
  exported as among its compatible types (external_image_limits,
  modifier_image_limits; LinearRefusal::Incompatible). Where neither
  takes it, the shadow and its notice name both refusals.
- in_place.rs: the class follows the memory (ExportedDmaBuf for any
  block of dma-bufs); the check's own textures go through the same
  route, so its verdicts are of the image a texture names.
  CHECK_VERSION 13 -> 14: 13's records kept ExportedDmaBuf Unchecked as
  a cause that lasts.
- WorkCounts::exported_dma_buf_images_named_opaque_fd counts the images
  that name the opaque type over a dma-buf block (api_signatures.tsv).

Test: exported_textures'
a_dma_buf_block_s_planes_name_an_opaque_fd_where_its_images_take_no_dma_buf_in_a_shared_block
asks the buffer and image queries itself, apart from the runtime: it
asserts the block's export set matches the buffer queries, the
buffer's export is a dma-buf (fdinfo exp_name), and, where the block
exports both and the dma-buf type takes no image of the plane's format
in a shared block, each plane is in place naming the opaque type
(counted) or a shadow of a byte the check found changed, never
Unchecked; no VUID under the layer. Without the change it fails on
RADV: the block exports the dma-buf alone where the buffer queries
answer both.

Docs: API.md's shadow rule, HOWTO section 7, the runtime README and the
module docs.

Verification: to run on the 780M, the RX 550 and lavapipe, then the
5080 through an entry.

(cherry picked from commit 1acb4f1fbf1fd4df8fcee2948417dcc089909fe4)
2026-11-08 18:30:27 -08:00
Anees Iqbal 04f1587445 Snapshot refusals: say which clause leaves an own-pixel slot out, and count unreadable splits by it
WorkCounts::reading_draws_split_unreadable_own_pixel counted draws whose
own-pixel slot no snapshot serves without saying why: its one logged reason
lumps a branch, a sample, a derivative, a store and a function that writes
memory. On the guest compositor's 780M walk it is 23,031 draws (23,463
before f922125bb1's demote guard), so the guard served another shape, and
which clause refuses decides the next step. Counts and interface facts
only; which slots qualify is unchanged.

Translator: spirv::requirements::snapshot keeps one reach mask per clause
and states each slot left out with every clause that holds for it
(StageInterface::snapshot_refusals, StageModule::snapshot_refusals, the new
public pipeline::SnapshotRefusal): Branch, Derivative, Sample,
GroupOperation, Store, Atomic, ImageWrite, UndefinedOperand, WritesMemory,
Interlock, Coherent, Other (a slot past 127, values that do not settle, a
ray query, a mesh output count, an unmatched call, the entry's returned
value). The walk now runs also in a function that writes memory or a module
with an interlock or coherent resource, so such a slot is stated with the
per-value clauses too; its slots stay left out as before. A snapshot variant
judges none. ARTIFACT_FORMAT_VERSION 494 (two encoded fields, one enum),
SEMANTICS_VERSION 1996 (a new interface fact).

Runtime: a draw split for UnreadableOwnPixel is counted once under each
clause that leaves out any of its unreadable attached slots
(WorkCounts::reading_draws_split_unreadable_own_pixel_{branch, derivative,
sample, group_operation, store, atomic, image_write, undefined_operand,
writes_memory, interlock, coherent, other}), and the log names the clauses,
once a device per set.

Tests:
- spirv::requirements::snapshot::tests::only_values_no_helper_can_pass_on_qualify:
  every sink states its one clause, with new sinks for a quad swap, a
  storage-buffer store, an atomic, an image write and a coherent image.
- spirv::requirements::snapshot::tests::a_slot_left_out_by_the_function_or_its_index_says_so:
  WritesMemory alone and beside a derivative; slot 200 Other beside slot 0
  qualifying.
- pipeline::compile::tests::the_interface_states_why_a_slot_takes_no_snapshot:
  owned fixture sd_read_discarding on the 780M's profile states none, and
  Branch alone with shaderDemoteToHelperInvocation withheld; tob_read none;
  the render pipeline's fragment stage the same.
- runtime_lane::snapshot_reads::a_reader_that_ends_itself_by_its_texel_takes_the_split_for_its_branch
  (device): the discarding reader with demote withheld: 3 * FILL, two
  splits, two unreadable own-pixel splits, both under branch alone.

api_signatures blessed (26 records); api_surface row for SnapshotRefusal;
docs/API.md's snapshot reads name snapshot_refusals.

(cherry picked from commit 4412816cc23ede42b266ad4d2c62465711853d83)
2026-11-08 18:29:23 -08:00
Anees Iqbal 733108b25d fresh_contents: the Depth32Float rows' zeroed-pattern declarations are held by the row test
The family's declaration test held every allowance to the notices site or
the fresh value declaration, so the two Depth32Float rows' unchecked fresh
site under fresh-pattern-zeroed (55df5fa64b) failed it. The test now names
that declaration, counts the texture row's three extra allowances and the
pattern row's two, and checks no other row carries it.
docs/CONFORMANCE-COVERAGE.md is regenerated
(python3 -I scripts/conformance-coverage/coverage.py): fresh_contents now
loosens one measured value.

Verified: both failed in the conformance suite on gem10 (job 10312); the
rerun follows.

(cherry picked from commit 184d622fa578658947c19dd19df29ff160a91b9b)
2026-11-08 18:15:24 -08:00