Commit Graph
3029 Commits
Author SHA1 Message Date
Anees Iqbal aa111e32d0 Runtime buffers lie in blocks exportable as opaque fds on a unified device's system heap
On RADV (Radeon 780M) a vkAllocateMemory of always-valid GTT memory holds the VM root
reservation while the kernel populates the pages, and every vkQueueSubmit takes that
reservation: a 64 MiB block of the system heap held the scheduler's submissions 9 ms on a
quiet host and up to 22-34 ms on a fragmented one (reclaim_submit_bench). Memory allocated
exportable is a BO with its own reservation, and its making holds no submission.

Where the device has unified memory and exports an opaque fd of a pooled buffer's memory for
the runtime's buffer usages (vkGetPhysicalDeviceExternalBufferProperties: EXPORTABLE, not
DEDICATED_ONLY), the buffers of placed_new_buffer (the program's, buffer descriptors', the
runtime's own) are made with VkExternalMemoryBufferCreateInfo(OPAQUE_FD) and lie in pools of
their own (Holds::FdBuffers) in the memory types of heaps without DEVICE_LOCAL, whose blocks are
allocated with VkExportMemoryAllocateInfo and never exported. Their buffers of addresses carry
the handle type (VUID-vkBindBufferMemory-memory-02726); a texture over such a buffer names it
(VUID-vkBindImageMemory-memory-02728) through bound_memory's External(OPAQUE_FD), taking the
in-place check's ExportedFd class. Heap buffers, preprocess buffers and the in-place check's
Pooled buffer (pooled_check_buffer) stay in plain blocks, so the Pooled verdict's image
creation is unchanged. WorkCounts gains fd_buffer_blocks_made and fd_buffer_blocks_plain.

Verified: not yet built; tests added (own_buffer_blocks_are_exportable_in_a_unified_device_s_
system_heap, and the device test over a buffer of the runtime's own in exported_textures).

(cherry picked from commit 065bcac9bd6f1a6f0b09beb514acb57447144094)
2026-11-09 01:44:39 -08:00
Anees Iqbal 0e761b0ada reclaim bench: the export facts print raw formats and usages
ash is built without its debug feature, so vk::Format and vk::ImageUsageFlags have no Debug;
the facts test printed them with {:?} and the test target did not compile (job 10566).

Verified: not yet built; the next facts job builds it.
(cherry picked from commit 79e283b7e77338a752f63167b9f387b8c4e20c36)
2026-11-09 01:44:38 -08:00
Anees Iqbal d34723e62e reclaim_submit_bench: opaque-fd arms and the device's export facts
On the 780M a texture over memory the runtime exports as a dma-buf is a
shadow (the in-place check made no image of that class: Unchecked),
where one over memory exported as an opaque file descriptor goes in
place (tests::exported_textures, gem10 job 10554). So the arms that
measure exportable memory take the handle type: the 64 MiB system-heap
making, 64 held blocks and the two-queue arm each run for an opaque
file descriptor too. Export facts prints what the device answers for
both handle types: vkGetPhysicalDeviceExternalBufferProperties for the
runtime's buffer usage with and without the device-address usage, and
vkGetPhysicalDeviceImageFormatProperties2 with an external image format
query for linear and DRM_FORMAT_MOD_LINEAR images of six formats,
sampled and copied, and rendered to.

Tests only; cargo fmt --all run. Verified: nothing yet (gem10 runs
follow as potluck jobs).

(cherry picked from commit 4a1d73a2f0c98e2f5d1503de4ae442aba2c88431)
2026-11-09 01:44:38 -08:00
Anees Iqbal b05f8cefbf reclaim_submit_bench: two-queue arms, private and exportable memory
Whether memory allocated exportable as a dma-buf holds one queue's
work behind another's, as memory that synchronizes implicitly would:
each arm allocates 128 MiB of the system heap, plain or exportable,
binds three buffers in it (each made for the handle type where the
memory has one, VUID-vkBindBufferMemory-memory-02726), and for 100
rounds a queue reserved for the caller fills the first 96 MiB buffer
eight times while, a millisecond later, a command queue's lent VkQueue
copies 64 KiB between the other two. Printed: the fills' and copies'
times to their fences and the rounds whose copy completed while the
fills ran.

Tests only; cargo fmt --all run. Verified: nothing yet (the gem10 run
follows as a potluck job).

(cherry picked from commit 4caa8b1ef1195be46b4e65ba4d12f44b115b6e05)
2026-11-09 01:44:38 -08:00
Anees Iqbal 0f69672d54 reclaim_submit_bench: fragment within the job's cgroup, time turnarounds, hold exportable blocks
The v3 run (gem10, job 10472) left about 970 order-10 blocks free after
the fragmenting: a memory cgroup is charged for the page cache it
reads, so the bench's heat file and its checkerboard together passed
the job's 18 GiB limit, and the kernel reclaimed the heat in long runs
(pgscan_direct about 30M a phase, MemAvailable 16.7 GiB). The heat is
gone; the checkerboard covers the host's free memory but 1 GiB as far
as the cgroup and its ancestors have room but 2 GiB (memory.high or
memory.max less memory.current), and the pressing thread maps its huge
pieces only while that room lasts. What the fragmenting took, the free
memory and the room are printed.

commit_and_submit leaves its batch to the scheduler's thread when that
thread is submitting, so it does not see a vkQueueSubmit held back
there: each commit's turnaround to completion is timed too, with
command_buffers_submitted, batches_submitted_at_commit and
batch_submit_nanos over the phase. The making thread is named
reclaim-make so a lock trace tells it from the submitting thread. Two
arms hold 32 and 64 exportable 64 MiB system-heap allocations made
before the phases: what memory that is not private to the process
costs each submission.

Tests only; cargo fmt --all run. Verified: nothing yet (the build and
the gem10 run follow as potluck jobs).

(cherry picked from commit ac35216c2ce0303441d0dcbb2d62172aca267874)
2026-11-09 01:44:38 -08:00
Anees Iqbal d08273a0d9 reclaim_submit_bench: rewrap the module doc to 100 columns
The pressing and printed paragraphs had three lines past 100 columns
after the last edit. Doc text only; cargo fmt --all run.

(cherry picked from commit 9cf31a4a9f03cc8faf66c3bb6a918fcf3899af96)
2026-11-09 01:44:38 -08:00
Anees Iqbal 25ad0e0994 reclaim_submit_bench: the free blocks by order printed after the pressed phase too
(cherry picked from commit eb700b8e605afc207fd504760a7dcf3fe6dee766)
2026-11-09 01:44:38 -08:00
Anees Iqbal 2c16ca47a5 reclaim_submit_bench: the fragmenting mapping takes all the free memory but 1 GiB, so no high order is left
With 6 GiB the fragmenting took the free blocks of the lower orders and left every order-10 block
(1109 of them, 4.3 GiB, potluck 10420's buddyinfo), so a 64 MiB block's pages came without
compaction (compact_stall 0). The mapping now takes all of MemFree but 1 GiB, at most 14 GiB.

(cherry picked from commit 2b8744b3264ff66a96368ab0a97ca5d0aba10ed9)
2026-11-09 01:44:38 -08:00
Anees Iqbal 8890d6504c reclaim_submit_bench: the free blocks by order printed before and after the fragmenting
(cherry picked from commit d2b18a17775afcdefd228e084df85ca79506a713)
2026-11-09 01:44:38 -08:00
Anees Iqbal 35acbf538f reclaim_submit_bench: the fragmenting mapping in single pages, so each page given back is freed
Under transparent huge pages always, the 6 GiB fragmenting mapping took 2 MiB pages, and giving
back every other 4 KiB of one frees nothing until its deferred split: potluck 10398's pressed
phase had no compaction stall (compact_stall 0). The mapping is now advised MADV_NOHUGEPAGE.

(cherry picked from commit 07a127e58812270c56c6c1d7cacf77216a2d85e7)
2026-11-09 01:44:38 -08:00
Anees Iqbal 197eaf89f2 reclaim_submit_bench: memory blocks made beside the submissions, on a fragmented host
The first form held idle blocks while the host reclaimed and no submission stalled in any arm
(potluck 10374, gem10's 780M: slowest commit_and_submit 0.08-0.24 ms pressed, 7-12 M pages
scanned by direct reclaim, kswapd none). A consumer's capture named the holder of its long
submissions: the runtime's own block making, a 64 MiB GTT buffer object's creation in direct
compaction under the VM root's reservation. So each arm now makes memory beside the submissions
in both phases, and the pressed phase first fragments the host's memory as a desktop's is: half
of it in the page cache from a sparse file, and 6 GiB of anonymous memory with every other page
given back, MemAvailable staying high.

Arms: the runtime's Private buffers (its blocks made ahead), raw 64 MiB and 4 MiB allocations of
the system heap's type, 64 MiB exportable as dma-bufs, 64 MiB of the carve-out, blocks made
before the phases, and nothing made. Each prints the submissions' and the makings' spread and
the host's reclaim.

(cherry picked from commit 0def7f69b78e2f4308d0d931cd65306bcf1acf10)
2026-11-09 01:44:38 -08:00
Anees Iqbal 06f8ab1398 reclaim_submit_bench: the slowest submissions sorted by key
(cherry picked from commit 3e94ec18c994498e57d2e7e16e1787df24a34e7c)
2026-11-09 01:44:37 -08:00
Anees Iqbal baaa014985 reclaim_submit_bench: submissions beside held memory blocks while the host reclaims memory (WIP, unverified)
(cherry picked from commit c8e443da5b6e26db60219cca40f857f8feb9170f)
2026-11-09 01:44:37 -08:00
Anees Iqbal 23fca440ae draw_again: a run's begins are its encoders' alone
run() counted a run's vkBeginCommandBuffer calls from the device-wide commands_recorded count,
plus a primary its encoder took begun ahead. That count also takes the primaries other threads
begin ahead in spare command pools as their command buffers complete with no thread waiting
(spares.rs), whenever the GPU's completions come: a begin there that fell while a run encoded
made its begin_command_buffer 1 more than a run's, the draws_after_buffer_changes_* and
draws_after_texture_and_sampler_changes_* flake under heavy load.

A run's begins are now WorkCounts::encoder_command_buffers_begun's change over it, which only
encoders count: their own primaries (begun, or taken begun ahead), segments, continuations and
draws' secondaries, and no other thread's begins.

a_primary_begun_ahead_while_a_run_encodes_is_no_begin_of_the_run_s makes the race certain: a
command buffer on another queue waits for an event the run's encoding signals, then the
encoding waits until that command buffer's pool's primary was begun ahead (primaries_begun_ahead
moved), and the run must still count 1 begin.

(cherry picked from commit 791933cf21191521fa9ad24dd8ba811356cd689d)
2026-11-09 01:42:59 -08:00
Anees Iqbal 5edcb8d876 RUNTIME_VERSION 1962 and the runtime-sources pin for the driver's stall told by thread CPU time
exitcrash's submit_stalls change (051de6ce39) reads CLOCK_THREAD_CPUTIME_ID around each timed
signalling call on a device whose driver has SignallingSubmitsStallEvery1024 alone, and counts a
call as the driver's stall only where its thread spent STALL_NANOS of CPU in it. Beside other
work, waits of 1.3-40.8 ms with little CPU had been taken as the stall and moved the scheduler's
place off the real stalls, so none came due at an idle. The runtime changed, so RUNTIME_VERSION
1962. With it: the FAST-PATHS known gap for NVIDIA's exit fault (31cef63d20, trimmed to the gap
and its bound by 6962de9cdc), and submit_stalls_idle running frames until a stall is taken idle
or six periods of calls pass (26c06a4bca).

Verified (exitcrash): RTX 5080 Laptop, NVIDIA 615.71.09, b5080 entry exitcrash-stallfix2 at
e50d699573: submit_stalls_idle 7/7 (4 alone, 3 beside the runtime device suite at -j 6, 409
passing meanwhile), each taking exactly 1 stall idle; clippy -D warnings on the runtime, plain
and --cfg m2v_gpu, clean (job 11384). Here: the API-signature check, REFUSALS.md and
CONFORMANCE-COVERAGE.md regenerate unchanged, cargo fmt clean.
2026-11-09 01:36:40 -08:00
Anees Iqbal 26c06a4bca submit_stalls_idle: frames until a stall is taken idle or six periods of calls passed
The 5080 check of the stall fix (b5080 entry stallfix-233857) passed alone
once of twice. The probe entry stallprobe2-010023 (aed3f80c65, every
signalling call of 0.5 ms or more with its count) shows why: with the
scheduler merging ready batches, 200 frames made 1686 to 1882 signalling
calls; the 32nd and the 784th stalled (the period's count is forgotten across
the device's uncounted uses of the queue before then), so the first stall
due idle was the 1808th call, past the end of the run that failed (1686
calls: two stalls on work, none idle). The runs that reached it took it idle
(the 1808th, an empty call, 2.7 and 3.6 ms of thread CPU).

The test now runs frames, on a driver with the stall, until a stall was
taken idle or the device's calls to its queues passed six periods (at most
2000 frames), and asserts as before; a driver without the stall runs its 200
frames and makes no empty submission. The product is unchanged.

Verification: pending (b5080 c entry).
(cherry picked from commit e50d699573d7b1e7a206ecec8ea7ec0cd60e1d03)
2026-11-09 01:35:53 -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 c8a8f0dbe6 mipmap_chains: a half's allowance below the float filter follows the announced device filter's direction
Orchestrator review of 1ced2a372b: the two-unit bound was not keyed and had no direction. The
780M's halves lie only below the filter (job m3-max-11026: 274 one below, 9 two below, none
above), so the device truncates its blit's filter of a half, and the lane should follow the
notice that says the level is the device's filter.

A half now lies within one unit in the last place above the filter, as before. Below it, it lies
within HALF_BELOW_ULPS (2) where the run announced device-filtered-mipmaps, else within one. Each
RGBA16Float level prints how many halves lie one and two below and one above, and the most each
way. The 8-bit formats keep their one-code bound both ways. The lane's docs state the measured
rule.

(cherry picked from commit fbfc2f492dc4d0711e7efd30a443286d5d329dba)
2026-11-09 01:29:15 -08:00
Anees Iqbal 9fed9dec1a mipmap_chains: a half the device's blit filters lies within two units in the last place of the float filter
On the Radeon 780M under RADV (development 1c7a75be62, job m3-max-11026), the_device_s_blit_chain_
filters_each_level_and_is_announced fails at an RGBA16Float cube's level 1. Of its 384 halves, 274
lie one unit in the last place below the bilinear filter in float of the level above and 9 lie
two below (0x3381 against 0x3383, for one); none lies above. The device's blit filters with its
own precision, which Vulkan leaves to it. generate_mipmaps announces device-filtered-mipmaps for
that filter and states no bound against Metal (rule 1: the device's filter is the answer). The
lane's one-unit bound was its own check that each level is the device's filter of the level
above, not a contract.

The lane bounds a half at HALF_BLIT_ULPS, two units in the last place, with the measurement that
sets it, and prints each RGBA16Float level's count at one and two units and the most. The
8-bit formats keep their one-code bound.

(cherry picked from commit 1ced2a372b2affb27e6877bca8f59057e227ec61)
2026-11-09 01:29:15 -08:00
Anees Iqbal 577bcb935f RUNTIME_VERSION 1960 and the runtime-sources pin for METAL2VULKAN_PENDING_AUDIT
The three commits before this are exitcrash's default-off diagnostic for the Iris GPU hang. a1's i915 error state
showed a command buffer's dynamic state freed and reused while its request ran: the runtime reset a pending command
buffer, by a path the capture can't name.

When METAL2VULKAN_PENDING_AUDIT=1 (or DeviceOptions::pending_audit), every place that frees or reuses a command
buffer's state reads the GPU's own timeline (vkGetSemaphoreCounterValue) and logs a finding, with a backtrace for
the first 8, where a submission carrying the command buffer may still run. Those places:
- vkBeginCommandBuffer, in both device tables, which covers primaries begun ahead;
- vkResetCommandPool;
- give-back of a pool to the spares;
- a resubmission of a pending command buffer not begun SIMULTANEOUS_USE.
Secondaries are carried by their primary's submissions. With the audit off, each site only tests an Option.
RUNTIME_VERSION goes 1959 -> 1960 and the runtime-sources pin is recomputed:
595f7c8a861556537f5fa0ca1fbfa2d1d8c61432af1ef5de40363510edebe3bb.

Verified at 1e1cb70eb2 (on f129a02989) by exitcrash, lavapipe:
- 11314: plain and cpu-ICD clippy clean; env_registry and api_signatures 7/7; pending_audit units,
  pending_audit_device and spares 16/16.
- 11309, negative control: with the give-back check deleted, the device test finds [0, 0, 0, 0]. With it, the
  deliberate early give-back finds the 2 command buffers the held batch carried, with the backtrace.
- 11309, false-finding probe: 233 runtime device tests with the audit on, 73 devices, 0 findings.
Not run on Iris; reims' a1-shape boots are the first ANV run. The cherry-picks onto 26f4338e93 were clean; this
tree is not yet built.
2026-11-09 01:09:52 -08:00
Anees Iqbal c415c3015c pending_audit: its module docs within 100 columns
Body: a doc line ran to 101 columns; rewrapped, no change of words.
(cherry picked from commit 1e1cb70eb2a14504f05af7de4d7a03d748edb1ac)
2026-11-09 01:09:02 -08:00
Anees Iqbal 5da8557152 pending_audit_device: one finding for each command buffer of the pool the held batch carries
The early give-back of a pool whose batch waits on the GPU finds every
command buffer of it that batch carries: on lavapipe, two (m3-max-11295).
The test counted one. It now asserts at least one give-back finding, none
of another kind, and one line for each.

Verification (m3-max-11295, lavapipe on msi, at 9ca953912d): cpu-ICD clippy
clean; tests::pending_audit (7), tests::spares, event_vk_signal and
draw_again's begun-ahead test pass; the device test failed only on the
count ([0, 0, 2, 0] against [0, 0, 1, 0]); the negative control (the
give-back check removed) found [0, 0, 0, 0] and failed.

(cherry picked from commit c43afb86223b19c752606f00fddacb1d686dc03b)
2026-11-09 01:09:02 -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 26f4338e93 Re-pin the runtime sources for the private doc-link fixes
The two commits before this are ownpixel's doc-only fixes of five private intra-doc links that resolved to nothing,
a red in the round's privdocs leg (cargo doc --document-private-items with -D warnings):
- the runtime's three: memory.rs place_fresh, render/replay.rs Lowering::logged, texture.rs Self::alias_unbound;
- the translator's two: metal/format/mod.rs [`footprint()`], which was ambiguous with the private module of the
  same name.
The runtime files are hashed, so the runtime-sources pin is recomputed:
126aa0da718d8e8b821ffd2b1691e722c1324c90a7d9ed432162c086e6af8c03. No behaviour changes, so RUNTIME_VERSION stays.

Verified at 35fae0e6ae by ownpixel, M3 11323: CI's loop (RUSTDOCFLAGS=-Dwarnings cargo doc -p <crate>
--all-features --no-deps --document-private-items) gives 0 errors for all six crates. The same loop on Linux
(11324) is pending.
2026-11-09 01:08:54 -08:00
Anees Iqbal c993c002b3 Translator docs: footprint's links name the function, not the module of the same name
crates/metal2vulkan/src/metal/format/mod.rs links footprint twice; under --document-private-items
the private module footprint makes both ambiguous, two errors in CI's 'Private intra-doc links'
step, which holds metal2vulkan at 0. footprint() names the function (M3 run 11315).

(cherry picked from commit 35fae0e6aea5077c3b4937b4a75b5f0269b38de9)
2026-11-09 01:08:38 -08:00
Anees Iqbal da5f0c92bf Runtime docs: the three private intra-doc links that resolve to nothing
memory.rs named Pool::place, which exists only under cfg(test); place_fresh's doc now says what it
places itself. render/replay.rs named RenderLowering::logged, which is Lowering::logged.
texture.rs named alias_unbound without its type; it is Self::alias_unbound on Device.

The CI step 'Private intra-doc links (no new breakage)' holds metal2vulkan-runtime at 0 under
cargo doc --document-private-items -Dwarnings; these three made it 3 (M3 run 11293).

Verified: the CI step's loop over all six crates, recorded in the tip message.
(cherry picked from commit f4f5b5d554cfd83a5b8613fcd179a78597811aec)
2026-11-09 01:08:38 -08:00
Anees Iqbal f129a02989 Re-bless the golden tables at b04d0a8a31
Translation changed at b04d0a8a31 (SEMANTICS_VERSION 2001). Blessed on the M3
(s37-pl.sh bless, dv-golden).

(cherry picked from commit 5fa08158ff4adec91d216386fe9d44c9e3904c9e)
2026-11-09 01:00:42 -08:00
Anees Iqbal b04d0a8a31 RUNTIME_VERSION 1959 and the runtime-sources pin for the exit hook after a program's own instance
The two commits before this are ownpixel's fix of the lavapipe runtime-lane exit SIGSEGV.
- Cause: a VkInstance the program makes itself (Device::from_raw's adopted devices, the validation candidate
  engine) registers the validation layer's ApplicationAtExit after the runtime's exit hook. Exit handlers run LIFO,
  so the layer tore its per-device state down first, while runtime threads were still inside it.
- Fix: the new public metal2vulkan_runtime::program_instance_made() registers the hook again after a program's own
  vkCreateInstance, and Device::from_raw calls it for an adopted device's instance.
- The new test checks the order directly, without relying on a crash: the program's handler must see
  process_exiting() == true.
- The NVIDIA exit known gap is a different mechanism (the driver's own worker against libEGL_nvidia's handler, no
  runtime section in progress) and stays.
RUNTIME_VERSION goes 1958 -> 1959, and the runtime-sources pin is recomputed:
a4bdf2ba5041a01ec31781e65adf27602dc005de13b85abb7cfd64559d64fed3.

Verified at 6f24b49f16 (on bb8c60238b) by ownpixel, M3 MoltenVK 11283:
- the negative control (adopt.rs at the base, an empty program_instance_made) fails with "the layer's handler ran
  before the hook: hook_ran=0";
- with the fix, both cases pass 3/3;
- exits, presenting, heap_textures, view_reinterpretation and tests::exit_guard 87/87;
- gpu clippy clean.
Probe (M3, 20 child exits a case): no program instance 20/20 clean; a program instance with the layer aborted in
GetDeviceFromKey 2/20 and 3/20. Still running: lavapipe 11284 and rustdoc for the new links. The cherry-picks onto
67650c36a5 were clean; this tree is not yet built.
2026-11-09 00:57:57 -08:00
Anees Iqbal 934a456a8c api_signatures: metal2vulkan-runtime::program_instance_made
The row the bless wrote at 6f24b49f16 (M3 job m3-max-11283, scripts/api-signatures/signatures.py
--bless), and nothing else changed.

(cherry picked from commit 120e931514a3dc3b9366701671ba0b78b350416d)
2026-11-09 00:57:09 -08:00
Anees Iqbal 40fe8587f3 Exit guard: a program's own instance registers the exit hook again after its layer's handler
What. A layer registers an exit handler as each VkInstance is created (the validation layer's
ApplicationAtExit forgets every device it knows), and exit handlers run in the reverse order of
their registration. The runtime registered its hook again after every instance it creates, but
not after one the program creates itself. Now:
- metal2vulkan_runtime::program_instance_made() (public) registers the hook again; a program
  calls it right after its own vkCreateInstance.
- Device::from_raw registers it again once the device is adopted: the adopted device's instance
  was the program's.
- The validation crate's own instance creation (candidate::platform create_instance) reports
  each instance it makes.

Why. With such an instance made after the hook's last registration, the layer's handler ran
first at exit, and a runtime thread's call still in progress, or begun before the hook closed
the guard, ended the process inside the layer:
- A lane run in one libtest process on lavapipe (gem10, 9619020361) ended with SIGSEGV after
  its 2060 tests. The core shows the main thread in the hook, waiting for sections, and two
  predicated-loop threads (loops without bound, run on by design) inside the layer's
  vkWaitForFences, calling through freed state.
- A probe on the M3 Max (MoltenVK, the validation layer from Homebrew) ran 20 child exits per
  case, each child with a loop without bound running on:
  - with no instance of the program's: 20 of 20 clean;
  - with one made after the device: SIGABRT inside the layer in 2 and 3 of 20 (vvl's
    GetDeviceFromKey, at the loop's next vkResetFences, vkWaitForFences or
    vkDestroyCommandPool).

Test. runtime_lane::exits::an_instance_the_program_made_registers_the_exit_hook_after_its_layer_s_handler
(cases program_instance_exit and adopted_instance_exit). Each child:
- has a loop without bound running on (predication::loop_without_bound);
- makes its own instance and device with the layer (presenting::Adopted);
- registers an exit handler after the instance;
- then reports the instance, or has the runtime adopt the device.
The handler must find the hook already run (process_exiting), and the exit must be clean.

Docs: exit_guard.rs (the registrations and the hole left), the runtime README, the new
function's doc comment.

(cherry picked from commit 6f24b49f16d47a63bae2d3dde2422f570f9a7505)
2026-11-09 00:57:09 -08:00
Anees Iqbal 67650c36a5 SEMANTICS_VERSION 2001, RUNTIME_VERSION 1958 and the runtime-sources pin for storage-form color inputs read once
The commit before this is sweep's fix of the coverage_chain red on the M3.
- Cause: a discarding fill uses its fetched coverage twice, once for the discard test and once for the colour. Its
  body read the raster-ordered storage image, branched on the value, fenced, and read it again. Under GPU load on
  the M3 the second read loses the colour output in 8x4 blocks.
- Fix: a storage-form colour input is read once, before the body (fragment::emit_entry, EmitCx::fetched), and every
  use takes that texel, which is Metal's semantics (the function gets one value of the attachment).
- Translation changes on the interlock profiles (MoltenVK, RADV, ANV), so SEMANTICS_VERSION goes 2000 -> 2001.
  RUNTIME_VERSION goes 1957 -> 1958 with it, and the runtime-sources pin is recomputed:
  see crates/metal2vulkan-validation/runtime-sources.sha256.
- The golden tables are re-blessed on development.

Verified at the tip 3917662cbb (on df79c0a7df) by sweep, M3 MoltenVK 1.4.2 job 11274:
- coverage_chain A/B, 120 runs each under runtime-suite load: development's lowering failed 15, the tip 0.
- translator fragment, imageblock, helper-thread and fetch tests 149/149 with MSL compiles.
- lanes framebuffer_fetch, interlocked_draw_order, view_attachments, imageblock and runtime fetch 121/121.
The new test tests::engine_fragment::a_fetched_color_is_read_once_before_the_body asserts one read in the first
block on every interlock profile. Still to run: gem10 11275 (clippy, rustdoc, the suite, and the test failing
against development's lowering), and the XTX and 780M fetch lanes. The cherry-pick onto b60bab13e4 was clean; this
tree is not yet built.
2026-11-09 00:57:01 -08:00
Anees Iqbal 0c3eb77a5d Storage-form color inputs are read once, before the body
What. A fragment function that fetches a color in the storage form (the
ordered pixel interlock's storage image of the attachment) reads that image
once per invocation, in its entry hook before the body (fragment::emit_entry,
EmitCx::fetched), and every use of the color input takes that texel. Before,
each use read the image again at the use.

Why. The coverage chain's discarding fill (dsx_coverage_chain's
chain_color_discarding) tests its fetched coverage for its discard, then
multiplies its color by it: two uses, so the body read the raster-ordered
image, branched on it, then fenced and read it again. On MoltenVK on the M3
Max (MoltenVK 1.4.2, macOS 27.0.1), while other work ran on the GPU, Apple's
GPU lost the color the function wrote through its output in whole 8x4 blocks:
runtime_lane::framebuffer_fetch::coverage_chain failed 4 of 60 runs (and 9 of
90, 12 of 90 in earlier batches). With one read, 0 of 60, whether the discard
demotes or is predicated; a form that read the image twice with no branch
between the reads also lost nothing (0 of 150). Metal hands the function one
value of the attachment, so one read is its semantics, and it keeps the
image's accesses in the interlock to that read and the writes at the returns.

Test. tests::engine_fragment::a_fetched_color_is_read_once_before_the_body:
chain_color_discarding reads the coverage's image once, in the first block,
on every committed profile that orders fetch through the interlock (two reads
without the change).

(cherry picked from commit 3917662cbbb5d214ceb7a4f8c8631a71679a2849)
2026-11-09 00:56:11 -08:00
Anees Iqbal b60bab13e4 RUNTIME_VERSION 1957 and the runtime-sources pin for an owed completion turn before submission handlers
The commit before this is ownpixel's fix of the Iris deallocator lane red under CompletionPolicy::Exact.
- Cause: an empty command buffer taken with no submission owes its completion turn to the thread that took it.
  The scheduler made that turn at the end of `round`, after the round's submission handlers, and submit_at_commit
  did the same. So a handler in the same pass, waiting for that command buffer's completion, waited 60 s.
- Fix: the owed turn is made before the thread runs or waits for a submission handler or check. That is the rule
  of ad451a5334: a handler holds back nothing the runtime took for another queue.
Scheduling changes, which a stored runtime artifact can see. So RUNTIME_VERSION goes 1956 -> 1957 and the
runtime-sources pin is recomputed: 1ef99693110ba5ecc473862e3a456b2906480a1ec5d8699a457184a5eacc8fba.

Verified at the tip fcc20eec92 (on 9619020361) by ownpixel:
- lavapipe 11186 reproduced the red at the base 4/240 under load.
- lavapipe 11229: the negative control fails at 60.07 s ("the empty command buffer's completed handler never
  reached the other queue's submission handler"); with the fix 5/5, runtime suite 1974/1974, stress 0/240.
- M3 MoltenVK 11228: the new test 5/5, touched suites 68/68, deallocator 10/10.
- lint 11227: clippy plain, m2v_gpu and m2v_cpu_icd clean; rustdoc clean.
Still running: Iris 11226, the device where the red was seen. The cherry-pick onto df79c0a7df was clean; this tree
is not yet built.
2026-11-09 00:51:45 -08:00
Anees Iqbal 4ef6cbad82 Scheduler: an owed completion turn goes before the thread's submission handlers
What. A command buffer that needs no GPU work is taken with no submission and, where its
VkQueue has no work in flight and no turn is under way, its completion turn is owed to the
thread that took it (Completion::turn_owed). The scheduler's thread made that turn at the end of
its round, after the round's submission handlers; a committing thread's pass
(Scheduler::submit_at_commit) made it after its handlers and its check. Both now make it before
them: round makes the owed turn after settling the storage-form switches and before Turns::run,
and the committing thread makes it after each pass, before AtCommit::let_go.

Why. A submission handler that waits for the completed handler of such a command buffer of
another queue, taken in the same pass, waited for a turn that only its own return let the thread
make. This is the Iris Xe red of
runtime_lane::host_memory::a_deallocator_returns_whatever_thread_submits_past_its_completion
under CompletionPolicy::Exact: its `after` is an empty command buffer, and where the fill before
it on its queue had completed by the time the pass took it, `after` read Scheduled for the whole
60 s that `holding`'s submission handler waited ("1 kernel submissions ... in 2 passes", every held
head count 0). Its completed handler then ran once that handler gave up. Reproduced on lavapipe
under load at 961902036: 4 failures in 240 runs of the test, four loops beside two parallel
runs of the runtime lane. Metal delivers a command buffer's completion to another queue's
handler that waits for it (the probe cross_queue_handler_waits, 30 of 30, as in ad451a5334).

Test. tests::unsubmitted::an_empty_command_buffer_completes_while_another_queue_s_submission_handler_waits_for_it,
under Exact and Grouped. With every queue idle, an opener holds the scheduler's thread in its
submission handler while an empty command buffer with a completed handler (first queue) and a
command buffer whose submission handler waits for that completed handler (second queue) are
committed, so one pass takes both. It also checks that all three were taken with no submission.
Without the fix the handler waits the whole SETTLE and the test fails.

Docs: the scheduler's module docs and round, submit_at_commit, the completion module's "No GPU
work" entry, add_submission_handler ("Keep it short") and the runtime README's handler entry.

(cherry picked from commit fcc20eec92e10a652bf81f38648086cdf6eb7452)
2026-11-09 00:50:51 -08:00
Anees Iqbal df79c0a7df RUNTIME_VERSION 1956 and the runtime-sources pin for no-copy memory whose source fails
The commit before this is radvruns' fix for an inconsistency sweep found on RADV:
- Before: a no-copy buffer or heap over shared memory (a memfd mapping) whose pointer the device refuses was a copy
  when it had no dma-buf source, but refused (Unsupported, HostMemory) when its source failed.
- Now: where the device refused the pointer and no dma-buf of the pages served (the source failed, or the device
  refused its dma-bufs), the outcome is the device's refusal either way: a copy, announced and counted as
  copied_host_buffers_device_refused. Rule 2: Metal makes a no-copy buffer over any page.
- Unchanged: misuse (Invalid, DmaBuf), the unpinnable path, a lost device, dma-buf-only imports, windows the import
  alignment does not cover, and rebinds.
A stored runtime artifact can see the answer change, so RUNTIME_VERSION goes 1955 -> 1956 and the runtime-sources
pin is recomputed: 667a42b2147fda1812b456d20e37b897aee4eae3228ef69bfbe170a8e885000e.

Verified at the tip a30909d44a (on bb8c60238b) by radvruns:
- PHOENIX 11208: runtime tests 78/78; host-memory lanes 69/69. The negative control (development's
  buffer_descriptor.rs) fails copied_device with Unsupported(HostMemory), and fails the lane.
- PHOENIX 11207: clippy clean, plain and gpucfg.
- M3 11230: clippy clean; rustdoc clean; runtime suite 1358/1358.
2026-11-09 00:35:39 -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 bb8c60238b Re-bless the golden tables at 08652be54e
Translation changed at 08652be54e (SEMANTICS_VERSION 2000). Blessed on the M3
(s37-pl.sh bless, dv-golden).

(cherry picked from commit 2c555cc89df2fed564b7c8007ee894849b3c04ad)
2026-11-09 00:20:25 -08:00
Anees Iqbal 3ef2ca4e11 word_samples_msaa: an own-format sRGB sample's reads allow srgb-texel-decode as a word's do
With the RGB9E5Float blends checked as the device's blend (job 11181, PHOENIX: no wrong
answers at either count), the lane reached its notice check on RADV for the first time and
failed there:
  announced past [DeviceColorConversion, DeviceRoundedResolve, DeviceDenormals,
  FastMathRewrites, DeviceTexelConversion, NativeNanEncoding]: [SrgbTexelDecode]

RADV holds R8Unorm_sRGB multisampled in its own format. The lane's reads of its samples go
through the device's sRGB decode and announce srgb-texel-decode, but the lane allowed that
notice only for a format held as its word. The allowance now covers an sRGB sample held
either way, wherever the device's sampler is not Metal's; read() already bounds the decode
alike for both.

(cherry picked from commit acc53ee20437d7532c109e9c26de374174098e9b)
2026-11-09 00:17:24 -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 08652be54e RUNTIME_VERSION 1955 and the runtime-sources pin for RADV's extrapolated perspective reads
The two commits before this are radvruns' fix of the 780M pull_model_interpolation red.
- Cause: on a perspective input read at a sample or an offset, RADV/ACO answers the pixel center's value
  extrapolated along the quad's coarse derivatives, a first-order value. A model reproduces every miss within 0.005;
  exact perspective matches Metal within 0.003.
- Fix (rule 1, the device's native interpolation): no v/w emulation. The measured fact
  DriverWorkaround::PerspectiveReadsExtrapolated (MESA_RADV) makes stage_io record
  PrecisionNote::ExtrapolatedInterpolation on structure alone: a perspective-qualified input read through
  InterpolateAtSample/AtOffset, or a perspective smooth varying read at the coverage loop's sample.
- API.md's DeviceInterpolation and the FAST-PATHS row are corrected, from "within 1.5e-4" to the measured ~1.0 on
  the lane's w = 1, 2, 4 geometry.
- The lane checks RADV against the first-order model.
SEMANTICS 2000 and ARTIFACT_FORMAT 497 come with the commits. This commit moves RUNTIME_VERSION 1954 -> 1955 for the
runtime's announcements and recomputes the runtime-sources pin:
8ae32d4765b4f41b760258dd704bedcbfc3453081f6c2273dac3e614fdde045b.

Verified by radvruns:
- gem10 PHOENIX 11157: lane 2/2, largest distance ~1.02, all within the model; the negative control without the
  fact fails with the original "1700 values off".
- M3 11153/11187: clippy clean; focus 72/72; degradation 17/17. The full suite is 3395/3398, the three being
  golden_hashes and the engine inventory's pm_linear rows, re-blessed on development.
- M3 11189: the negative control with the note emptied fails engine_pull_model and engine_coverage_loop.
The cherry-picks onto 9619020361 were clean; this tree is not yet built.
2026-11-09 00:16:59 -08:00
Anees Iqbal a1734cc220 pull_model_interpolants: the companions regenerated with pm_linear
The fixture's .ll and .air.ll were regenerated from the MSL by scripts/regen-air-fixtures on
the M3 (Apple metal 32023.922, macOS SDK 27.2; TOOLCHAIN unchanged), and the air_input snapshot
was blessed over them (job m3-max-11153). That job also ran:
- clippy on metal2vulkan, the runtime and validation (plain and --cfg m2v_gpu): clean;
- the focused engine tests (98) and the runtime's degradation tests (17): pass;
- validation's comparison tests (9): pass.
The full metal2vulkan suite (3398) fails only these:
- golden_hashes, from the SEMANTICS_VERSION bump;
- the engine inventory's new pm_linear rows (llvm_as part 8, metal_as part 3).
Both are tables re-blessed on development.

(cherry picked from commit 02b6755308a71091e7957ac137b794270016a747)
2026-11-09 00:16:01 -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 9619020361 Re-pin the runtime sources for the recorder-slots test fix
The two commits before this are ownpixel's fix of round 064's rt1 red on the RTX 5080. The cause is that the 5080's
driver refuses an 8th live VkDevice in one process, deterministically (VK_ERROR_INITIALIZATION_FAILED at the 8th
make, alone and under load). The runtime already answered that refusal as Err; the test unwrapped it while holding
recorder::SLOTS = 8 devices. The test now takes the free recorder slots directly (recorder::take_free_slots,
compiled only for the device tests) and holds at most 3 devices. recorder/mod.rs is hashed, so the runtime-sources
pin is recomputed: 3ef374c57741e051d2568b6d2dfbc1d38e4d41375b44b04d9ed648b6d89ad133. The runtime's behaviour is
unchanged (the helper is test-only), so RUNTIME_VERSION stays.

Verified by ownpixel:
- the probe (steelbrain/recorder-slots-probe, not landed): makes 0..6 succeed, make 7 fails with -3, alone and
  beside 12 looping test processes. Not memory: the process held 1.4 GB RSS at the refusal.
- the fixed test: 3/3 alone and 3/3 under load on the 5080, 3/3 lavapipe (11110), 3/3 MoltenVK (11109).
- plain and m2v_gpu clippy green (11066).
2026-11-09 00:08:02 -08:00
Anees Iqbal c00d718241 recorder_slots: the 5080's per-process device count in the test's docs
Measured on the RTX 5080 (b5080 entry ownpixel-slots-231316, probe branch
steelbrain/recorder-slots-probe 5edb022ecc): a process makes seven live devices
of sinks of their own and the eighth fails with VK_ERROR_INITIALIZATION_FAILED,
alone (beside one other entry) and beside twelve processes of device tests
alike; an instance is still made past it, and a device is made again once the
seven are dropped. The test as it was fails at its eighth slot device, before
the device past the slots; the test at 05cba8be17 passed three runs alone and
three beside the load there, and three each on lavapipe (m3-max-11110) and
MoltenVK (m3-max-11109).

Verified: cargo fmt; comments only.
(cherry picked from commit b3f25aca9dea87f141a1da6459e5dcd6eb66f8ce)
2026-11-09 00:07:42 -08:00
Anees Iqbal 8c435c8a73 recorder_slots: the free slots taken in place of devices, three devices at most
The test made one device per slot (recorder::SLOTS, 8) and two more, holding
nine at once, each of a message sink of its own (an instance and a device of
its own). On the RTX 5080 (round 064's rt1 at 32c3330694), beside the suite's
other device tests, a make took about 11 s and one of them failed with
VK_ERROR_INITIALIZATION_FAILED after 98 s: the test asked the driver for more
devices in one process than any other test or program does, which nothing
about the slots needs.

recorder::take_free_slots (test builds with a GPU cfg alone) takes every slot
no device holds, as a device takes one, each let go as its Slot drops. The
test makes a device to record and one to let go, takes the other slots, makes
the device past them (uncounted, as before), fills on it and on the counted
one, drops the idle device and the uncounted one, and makes one more, counted
in the freed slot: three devices at most at once, five makes.

Verified: cargo fmt. The build and the 5080 run follow.
(cherry picked from commit 05cba8be17f3663ac344f3bcf86e19b8bdbbffa0)
2026-11-09 00:07:41 -08:00
Anees Iqbal 524cf28137 RUNTIME_VERSION 1954 and the runtime-sources pin for held groups that never wait behind another queue's handler
The eleven commits before this are sweep's fix for a scheduler hang under CompletionPolicy::Grouped (the default):
- The bug: a group held behind running work waited while a submission handler of another logical queue, which
  waited for a command buffer in that group, ran on the scheduler thread. A probe on the M3 Max shows Metal
  delivers across queues (30/30) and never within one queue (10/10).
- The fix: scheduler::holds_back_another_queue sends the held group before such a handler runs.
- DeviceOptions::assume_submissions_merge (doc-hidden, a test hook like fail_in_place_check) holds the device's merge
  check, so the handler test checks the held group on every run.
- Under Exact (the lane devices') no group is held, so the Iris deallocator lane red is a separate, open cause.
- Two intermediate commits (from 2a43201e53 and d7065a11b5) do not compile alone; a bisect skips them.
Scheduling changes, which a stored runtime artifact can see. So RUNTIME_VERSION goes 1953 -> 1954 and the
runtime-sources pin is recomputed: 6bdfea21e45d0dbc47b4f86037e1ebeeefd23302ac877f0d5a9c1748b0667567.

Verified by sweep at bf62810259 (same content on an older base):
- XTX 11130: handler test 3/3 (X and Y in one submission, Y reached in ~440 ms); without the fix, Y waits 60 s and
  the test fails; deallocator 10/10; plain and gpu clippy clean; api tables 11/11.
- lavapipe: handler 2/2, deallocator 5/5.
- 780M 11096: grouped, reached in 330/428 ms; without the fix, 60 s.
- M3 MoltenVK 11134: handler 3/3, deallocator 10/10 (MoltenVK never groups).
- Cost, 780M frame_costs_over_imports: identical before and after.
Still running: the tip on the development base (11155), the 780M (11148) and Iris (11131/11132). The cherry-picks
onto c79a468965 were clean; this tree is not yet built. api-signatures --check, refusal-surface and
conformance-coverage leave the docs unchanged.
2026-11-08 23:57:27 -08:00
Anees Iqbal b9c962f5f9 DeviceOptions::assume_submissions_merge: the handler test holds its group on every run
What. A hidden test hook, as fail_in_place_check is: a device made with it takes
its merge check (submit_check.rs, Check::Merge) as Holds from its making, reads
and writes no record of its checks, and reports the merge's floors with
"assumed"; its import tax and follows checks answer as ever. Under
CompletionPolicy::Grouped its batches then wait in groups whatever the timing
measured. That is safe on every driver: one vkQueueSubmit of several
VkSubmitInfos, only the last signalling, runs correctly where the driver
submits them apart; it only saves nothing there.

a_held_group_goes_before_another_queue_s_submission_handler_runs makes its
device with the hook and asserts the merge held, so the held group is checked
on every run. Before, on the 780M one run of three read the merge check as
Fails (54.4 us in one call of four against 60.4 us apart) and the test then
passed without checking anything.

Correction to 8d04b2d15d's message: it said the deallocator lane test on the
Iris Xe hit the held-group wait. That claim was not verified, and it is wrong
for the lane. The lane's devices use DevicePolicy::exact_answers
(CompletionPolicy::Exact), so no group is held there. The scheduler change
stands for the default policy; this test fails without it (780M: Y's handler
waited 60.0 s for X, kept behind A and B) and passes with it (X and Y in one
kernel submission, X's completed handler seen after 331 and 428 ms). The Iris
lane red has another cause, under diagnosis.

api_signatures.tsv lists the field. Verified: to be built and run on the 780M,
the XTX, the Iris Xe, the M3 Max and lavapipe, with the scheduler change and
without it.

(cherry picked from commit bf62810259d89e10aa4d558abccbe65d5cf92967)
(cherry picked from commit 3535bee6612a6b831e7b0b843cf94634b83f3f56)
2026-11-08 23:56:35 -08:00
Anees Iqbal f007c6f187 grouped_submissions: the handler test runs under grouped completion; the deallocator test reports what held the later command buffer
The handler test made its device with the lane's options, whose policy is
DevicePolicy::exact_answers: CompletionPolicy::Exact, under which no batch
waits in a group. So X was never kept behind A and B (on the XTX and the 780M
every batch went alone with two or more pending, none grouped, no group end),
and the test could not fail without the scheduler change. It now asks for the
default, CompletionPolicy::Grouped, as held_behind_running_work does.

The deallocator test runs under the lane's exact completion, so no group is
held there. Where the later command buffer's completed handler never reaches
the holding handler, the panic now names its status and what the scheduler did
since the opener's commit: kernel submissions, batches at commit, groups,
passes, and each reason it held a head back.

Verified: to be built and run on the XTX, the 780M and the Iris Xe, with the
scheduler change and without it.

(cherry picked from commit 5e8a173bffebe3fa98be5516b70758c7c9c704f4)
(cherry picked from commit 0f5f9c36c8194347618eadb8b3822ba91bc8b1c2)
2026-11-08 23:56:35 -08:00