Commit Graph
2681 Commits
Author SHA1 Message Date
Anees Iqbal 1dc4e8ab46 module_version_1 tests: read a symbol table record's name only for the codes it spells
vst_record read the characters of any record before matching its code; a code
it does not abbreviate is now written unabbreviated before its operands are read
as characters.

(cherry picked from commit a507f448ca63b001225486ee648219a9e6f54e32)
2026-11-08 10:15:51 -08:00
Anees Iqbal c178704fef module_version_1 tests: re-emit version 1 exactly as LLVM 4's writer laid it out
reims's macOS 11 descriptions (VectorKit's clear shaders) put the version-1
modules in LLVM 4's layout: an empty producer, a BLOCKINFO of LLVM's four
symbol table abbreviations, FUNCTION records of 15 fields, no
SYNC_SCOPE_NAMES, the module symbol table's ENTRY and FNENTRY records
abbreviated, the latter through three abbreviations of its own. The
re-emission wrote 19-field records unabbreviated with no BLOCKINFO, so the
reader's first pass never met a BLOCKINFO-abbreviated symbol table and no
record was version 1's own length.

The re-emission now writes that layout: BLOCKINFO after VERSION; every
symbol table record (module and function) through the abbreviation LLVM's
writer picks for its characters (char6, 7 or 8 bits), the module's entries
last value first, as a hash order would; FUNCTION records cut to 15 fields
and GLOBALVAR to 6 or 12 where the cut fields are 0; SYNC_SCOPE_NAMES left
out where it holds only the two built-in scopes; the producer and epoch
through their own abbreviations. The decode test counts the records cut and
the blocks left out; the translation test writes an empty producer.

(cherry picked from commit 74f4d2b77c13b6367b71c9f6bd9eba8b892114d0)
2026-11-08 10:15:51 -08:00
Anees Iqbal 3aabe68072 bitcode: drop the module symbol table checks no version-1 table can fail
check_bodies counted the version-1 function entries it matched and
compared the count with the entries, and required no more entries than
defined functions. Neither can fail: a version-1 record refuses a
function offset on a global or a declaration, and each value id has at
most one entry, so every entry names a distinct defined function, which
the loop matches. Version 2 keeps its one-entry-per-defined-function
check. The two no-VSTOFFSET arms are one arm.

No behaviour changes; the air suite's symbol-table tests cover both
versions.

(cherry picked from commit f98b303d8db6092e3df6625d79feab619bb18a6e)
2026-11-08 10:15:51 -08:00
Anees Iqbal 33c81f77db Re-bless five cost records whose submission counts d119fdeca7 moved down
Round 058's M3 cost leg (at f84816ddec) failed on 18 gated counts in five
cases, all of them down. d119fdeca7 ("YCbCr conversion: make its staging
buffer, sets and refresh at its first conversion") moved all 18: a
two-plane texture whose planes are read in place no longer pays for the
conversion's staging buffer, copy and sets when it is made.

The contrast is a whole-set `cost --runs 8 --check` on the M3 (MoltenVK),
run against the records then in the tree (m3-max-9015):
- At 2ade9a7971, d119fdeca7's parent: no gated bound moved.
- At d119fdeca7: exactly the leg's 18. It was built with ed618c7102's
  one-line fix (self.refresh -> made.refresh), since d119fdeca7 and
  dfdbca7d72 do not compile without it.
  - surface-fills-over-planes-and-buffers: command_buffers_begun 38 -> 23,
    command_buffers_begun_batch_work 19 -> 4, command_buffers_submitted
    38 -> 23, cmd_copy_buffer 34 -> 19, cmd_pipeline_barrier 53 -> 23,
    end_command_buffer 38 -> 23.
  - ycbcr-minify-band-x: command_buffers_begun, command_buffers_submitted
    and end_command_buffer 5 -> 4.
  - ycbcr-gathers-edge, -zero and -white: the same three, 12 -> 10.

Alone (`cost --runs 8 --alone --show`, m3-max-8997), the five cases'
counts are equal at 0578e213c0 and 2ade9a7971. They move at d119fdeca7
(with the fix) and hold at every later commit measured through
67e38e3e9a: dfdbca7d72 (with the fix), ed618c7102, 26db05e481,
be9e3547b2, b15443f18d, ded385b661, 31bfbd22a9, 8329c9e954, f84816ddec.

Written at 31e642ecc2 the way s37-job.sh's record leg writes: a whole-set
`cost --runs 8 --write`, every recording outside the five put back, then
`cost --runs 8 --alone --write` of the five. A whole-set
`cost --runs 8 --check` afterwards moved no gated bound and no ceiling
(0 of the 95 differences is a number the gate reads).

The leg also printed "the run stopped: a call did not answer, at
MTLPixelFormatRGB10A8_2P/..." for format-footprints-two-plane-ten-bit.
That is the case's known refusal (known-gaps.tsv). The check passes over
a case that stopped, so it did not fail the leg.

(cherry picked from commit 2ba47889a63898aff3ebbb4a2bba0a4edf142e17)
2026-11-08 10:08:25 -08:00
Anees Iqbal 6f702cb76a docs/API.md: an exit mid-making, the difference left
What: the accepted differences' "Process exit" names what the exit hook's registrar leaves: a
making on the program's own thread, which the exit does not wait for, and destructors the
driver's compiler registered in the last 2 ms before the exit (or past the registrar's 16384
registrations), which can run beside the compile, where Metal compiles in another process.

Why: the registrar (RUNTIME_VERSION 1899) closed the rest of exit_guard's hole for makings on the
runtime's threads; what is still open is a consumer-visible difference, and one such exit (a
consumer's making thread left running) ended its process with SIGSEGV inside NVIDIA's SPIR-V
compiler on the RTX 5080.

How verified: docs only; the figures are exit_guard's MAKING_INTERVAL and MAKING_REGISTRATIONS.

(cherry picked from commit 5f1846a295017a2244fde27cdd2ed3db97bdb9cb)
2026-11-08 09:58:54 -08:00
Anees Iqbal b7e27c7ab9 exits lane: drop the @bare probe
What: a child's case name no longer takes an @bare suffix, which ran it without the validation
layer; every child's device is the lane's validated one again.

Why: the suffix served the exit-crash probes (loops with and without the layer on the RTX 5080,
the XTX and lavapipe, which faulted in neither form); no test of the lane names it.

How verified: the lane builds and runs its children as before (gem10, the RTX 5080).

(cherry picked from commit 87fe0b663ff2d0a443e98ee425fa5e0d92f96b65)
2026-11-08 09:58:54 -08:00
Anees Iqbal d6c9d04698 exits lane: an_exit_mid_making_is_clean also exits during the process's first making of a kernel
What: an_exit_mid_making_is_clean runs first_making_exit beside making_exit: the same exit while a
pool's thread makes a dispatch's pipeline, with no making of the kernel before it, so the pool's
making is the process's first and the driver's compiler makes its statics, and registers their
destructors, while it runs. Each case's mark is checked; the registration after a program
thread's making only for making_exit, which makes one.

Why: that is the exit the registrar (exit_guard, "Registered again") covers. With an LD_PRELOAD
shim logging exit handlers on lavapipe (Mesa 26.2.4, LLVM 23), in 1 of 3 such exits before the
registrar, destructors LLVM registered 1 to 2 ms before the exit ran before the hook, the compile
going on. The lane now runs that exit on every device.

How verified: the exits module on lavapipe (gem10) and the RTX 5080 follow.

(cherry picked from commit e3cdfa528cedfd6c0efb8f7a2af0ff19dedc5ef6)
2026-11-08 09:58:54 -08:00
Anees Iqbal 7b0d90390c Re-bless the authored compile census at 14f1ce3657
Its product fingerprint follows development's versions at 14f1ce3657. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).

(cherry picked from commit da66b91b0eee2cf026b0c31b0347aaa26e43629c)
2026-11-08 09:58:20 -08:00
Anees Iqbal 14f1ce3657 RUNTIME_VERSION 1900: buffer hand-outs settle their first work; HostRam lists kept past their copies
Buffer hand-outs (vk_buffer) now wait for the first work on the VkBuffer they return, reading it
apart once, and HostRam copies keep their page lists past the copy for the next copies of the same
pages (bounded at 64 MiB / 16 lists). Both change what a run submits, so the version moves; the
runtime-sources pin is recomputed over the merged sources.

Verified by radvruns: lavapipe suite on gem10 (job 8970) 1910/1911, clippy in three configs,
rustdoc; a same-host A/B on um790's 780M (job 8986) for the kept lists. Doc checks rerun here.
2026-11-08 09:43:32 -08:00
Anees Iqbal 48cfac5cb3 HostRam lists kept: the docs say the lists outlive their copies, with same-host numbers
HOWTO, the runtime README and FAST-PATHS still said a copy's lists were
freed with its command buffer and that every copy pays its lists'
imports. They now say each list is kept past its copy for the copies of
the same pages after it (at most 64 MiB and 16 lists, released once no
copy took one for 2 s), and they give the numbers.

The numbers come from tests/host_ram_listed_bench.rs on the Radeon 780M
of one host (um790, RADV, kernel 7.3.1). The kept tip was run with a
timing probe that never lands, then again with the bound sabotaged to
(0, 0), which keeps nothing, back to back. Medians are commit to
completion, then encode:
- A 5 MiB device cache filled again: 0.37 to 0.43 ms and 0.2 to 0.4 ms,
  against 3.0 to 3.2 ms and 0.7 to 1.0 ms with no list kept. Over an
  imported chunk it takes 0.37 to 0.40 ms and 0.12 to 0.14 ms.
- A surface-shaped tile's download after its fill: 0.53 to 0.60 ms,
  against 4.0 to 4.2 ms.
- A scattered tile's download: 0.46 to 0.50 ms, against 0.98 to 1.04 ms.
- A copy that imports pays the lookup through the kept lists: 48 to
  63 us for a surface tile, 250 to 290 us for 1,800 scattered runs
  against 16 lists.
- The scroll's 24 visible tiles pass the 64 MiB bound (about nine
  tiles), so a third to a half of their repeated fills took a kept list.
- Residency is the same with and without kept lists: 4028 of 8192 MiB,
  and 8300 of 16384 MiB.

(cherry picked from commit ee030ba7ed497aeb4bf0c92653cc33078e987379)
2026-11-08 09:42:35 -08:00
Anees Iqbal bf1296077c HostRam lists: keep each past its copy for the copies of the same pages after it
A copy over chunks not imported, of a RAM with a source of run lists, paid
its lists' imports every time: on the Radeon 780M a surface-shaped tile took
4.1 to 4.5 ms from the commit to the completion where a copy over an imported
chunk takes 0.39 to 0.48 ms, first copy or repeated, and the probe that kept
the lists brought repeated copies to 0.55 to 0.60 ms.

Each list a copy imports is now kept by the RAM's use on the device
(host_ram/kept.rs) and taken by the copies after it for every run of theirs
one of its runs holds whole; their other runs take lists of their own. The
kept lists hold at most 64 MiB and are at most 16, the least recently taken
let go of first; the device's thread for the RAM (listed_chunks) lets go of
each no copy took for the idle window (2 s) and no command buffer holds, every
tick, whether or not the plan releases chunks; the use's end lets go of all.
Residency is unchanged: a list's pages were made resident by its import and
stay in the file once it is freed; kept, they stay pinned, and each kept list
is one more import every submission lists.

Tests: kept.rs's units (taken whole or not at all; the least recently used
past the bytes or the count; idle ones not held); the dma-buf tile and
residency tests now expect the scatter after a gather to take the gather's
lists and import none, the lists to stay live past their copies, and the
device's thread to let them go within 5 s. Docs: with_dma_buf_of_runs,
use_host_ram, Imported, the module docs, host_ram_run_list_imports and
run_imports_live.

(cherry picked from commit 86b0de84551210c31d01af1d7f35e8f468ec4e5b)
2026-11-08 09:42:35 -08:00
Anees Iqbal 5c62a353ca vk_buffer: settle the first work on the VkBuffer it hands out, reading it apart once
28dcdcaed2's hand-out read the buffer's VkBuffer a second time, through
Buffer::at, to find the fills waiting on it. A no-copy buffer's import
counts each read apart by its reason, so vk_buffer of a no-copy buffer
now counted a Binding read beside its VkBuffer read. In the lavapipe
suite (job 8946), host_import_counts::each_read_apart_counts_for_its_reason_once_and_each_import_for_its_keeping
read [1, 1, 1, 0, 0, 0] where it expects [1, 1, 0, 0, 0, 0].

settle_first_work now takes the VkBuffer from its caller. vk_buffer reads
it once, for VkBuffer, and settles with it. export_memory_fd passes its
own buffer's, which is no import. hand_out only notes the hand-out again.

(cherry picked from commit 3d3ea570b4f1d90263c22a1f7456bb1a94264f9f)
2026-11-08 09:42:34 -08:00
Anees Iqbal d84bc3269f Buffer hand-outs make the first work waiting on their VkBuffer before they return
A new Private buffer's zeros (Buffer::clear_first) and its staged bytes,
and a Managed buffer's upload, wait for the device's next submission,
which makes them before its own commands. Buffer::vk_buffer handed the
VkBuffer out with that work still waiting. The consumer's frame cache
took vk_buffer() of a new Private buffer before any runtime submission,
wrote the buffer on its own VkQueue, and our next blit made the pending
zero fill first and read all zeros.

The hand-out now makes the work first, by an internal submission waited
for, as Texture::vk_image already does for its texture's move. It
submits nothing where no fill waits on that VkBuffer
(FirstMoves::fills_wait: a waiting fill, staged copy or upload whose
destination is the VkBuffer). Buffer::export_memory_fd settles the same
way, since another API may write the exported memory at once. A texture
handed out was already covered: its settle submits whenever its move
waits, and that submission takes every fill waiting, the zeros of the
buffer it lies in among them. The first-moves docs, vk_buffer's docs and
the runtime README say so.

Tests (tests/caller_queue_writes.rs, device tests). Each writes on a
queue of the caller's: the reserved queue, or a command queue's lent
VkQueue.
- a_new_private_buffer_handed_out_reads_the_caller_s_writes_not_its_zeros:
  a Private Zero buffer with aligned byte 0x20, 3,110,400 bytes, is
  handed out with its fill still waiting (asserted, so the path runs),
  written by the caller's vkCmdCopyBuffer, then read by a runtime blit.
  The negative control is the old hand-out, which only notes the
  hand-out; it should read zeros.
- a_texture_over_a_new_private_buffer_handed_out_reads_the_caller_s_writes:
  the same for an R8Unorm 3840x2160 plane in place at byte 0x20 over
  such a buffer, written by the caller's vkCmdCopyBufferToImage in
  GENERAL. The texture and the bytes under it both read the copy.
- a_shared_aligned_frame_written_on_the_caller_s_queue_reads_the_writes:
  the shape of the consumer's report of a device loss on RADV. Six
  rounds; each makes a Shared NV12 frame with aligned byte 0x20, fills
  it through contents(), then writes both planes from the caller's
  image with vkCmdCopyImageToBuffer. Each round reads the copy through
  contents() and through a blit, and the device stays live.

Not yet verified; the 780M and lavapipe runs follow this commit.

(cherry picked from commit 28dcdcaed27183ebe375919944d2175850ef418b)
2026-11-08 09:42:34 -08:00
Anees Iqbal a65dec2e53 RUNTIME_VERSION 1899: the exit hook is registered again every 2 ms while a making is in progress in a section
A pipeline making in progress when the process's exit began could let a driver compiler (LLVM's, under
lavapipe; NVIDIA's libnvidia-glvkspirv on the 5080) register destructors after the hook's last
registration, which then ran before the hook, beside the making: exit_guard's documented hole, the
class of reims's exit SIGSEGVs after 'test result: ok'. While a making is in progress in a section,
a runtime thread now registers the hook again every 2 ms, at most 16384 times a process (exitcrash,
a3bd94ba66). The exits lane gains the released-import and first-making cases, a case without the
validation layer, and ends every child's exit at the mark after its first device once the hook ran
(64a00697f4..4b91b2ba92). Runtime sources re-pinned.

Verified: the doc checks in the landing tree. The change's own evidence: exit_guard 47/47 x3 on gem10
with the new an_exit_mid_making_waits_for_it_before_a_destructor_the_making_registered, failing (43)
with the registration removed; the 5080 tip run is a check on development.
2026-11-08 09:39:36 -08:00
Anees Iqbal 156034d7cf exits lane: every child's exit ends at the mark after its first device, once the hook ran
What: every child registers after_the_later_devices right after its first device (before, only
instance_after_handler_exit and making_exit did), and the mark prints whether the hook ran by then
(hook_ran). exits_cleanly counts an exit up to the mark where the hook ran before it, and the
first device's driver's and layer's handlers after it are printed, not bounded; where the hook ran
after the mark (no registration of it followed the device), the exit is counted to its end, as
before.

Why: on the RTX 5080 laptop, three exits tests failed in the exits module run beside another
entry (perdraw6-exitmark: an_exit_runs_no_handler_beside_a_cpu_device_s_work,
an_exit_while_a_host_step_waits_is_clean, an_exit_while_submitting_is_clean), and in 200 exits of
the lane's children 12 at once (entry exitcrash-four-and-loop-1) host_step_pending_exit,
submitting_exit and handler_learns_exit ended their handlers 1.53 to 1.60 s after their last line,
past EXIT_LIMIT. The handlers registered as the device was made, NVIDIA's and the layer's, took
495 ms of instance_after_handler_exit's exit alone and 7.1 s in that loop, and 1.5 to 5.9 s of
making_exit's beside the runtime suite (a1edaca06b), where the rest of the exit took 2 to 41 ms.
That is the driver's own exit, which the hook neither waits for nor shortens.

How verified: the lane's exits on the RTX 5080 and lavapipe follow (the mark's split per case).

(cherry picked from commit 4b91b2ba925892f7176c4cba988b4c7eb77d8f33)
2026-11-08 09:38:50 -08:00
Anees Iqbal 0ee63aaf46 exit guard: register the hook again every 2 ms while a making is in progress in a section
What: a thread of the runtime's, the registrar, started at the process's first making in a
section (a pool's piece's, a host step's) and parked while none is in progress, registers the
exit hook again every MAKING_INTERVAL (2 ms) while one is, at most MAKING_REGISTRATIONS (16384,
512 KiB of the C library's list of exit handlers) times in a process, until the guard closes.
Registrations counts them (during_makings), and the lane's bound on the sections' registrations
leaves them out.

Why: a driver's compiler makes statics at its first use of a path, and registers their
destructors then, inside the making. The hook was registered again only after a making returned,
so an exit that began mid-making ran those destructors before the hook, while the making still
compiled. Measured with an LD_PRELOAD shim that logs every exit handler registered after the
hook's first registration and the order they run in (lavapipe, Mesa 26.2.4, LLVM 23, the exits
lane's first_making_exit): in 1 of 3 exits, three destructors LLVM registered on a driver's
thread 1 to 2 ms before the exit ran first, and that thread registered three more once the exit
began. That is the module docs' hole ("a static first made by a making in progress as the exit
begins"), and the shape of the consumer's NVIDIA exit faults in libnvidia-glvkspirv. Now such a
destructor runs after the hook once 2 ms passed, and the hook waits for the making first. The
hole left is the last interval before the exit, makings past the bound, and the program's own
makings, which the hook does not wait for.

How verified: the new unit test
an_exit_mid_making_waits_for_it_before_a_destructor_the_making_registered forks a child whose
piece registers a destructor inside its making and exits once the registrar registered after it;
without the registrar the destructor runs beside the making (43). Build and test runs follow on
Linux (gem10) and the RTX 5080.

(cherry picked from commit a3bd94ba669c67fa1c34b9d9a4974f37b5e8979c)
2026-11-08 09:38:50 -08:00
Anees Iqbal 8ecd5fc18a exits lane probe: first_making_exit, making_exit without the program's making first
(cherry picked from commit a42885bbc46d83f6913366a260353e0af7991547)
2026-11-08 09:38:49 -08:00
Anees Iqbal d9fa910f62 exits lane probe: a case named with @bare runs without the validation layer
(cherry picked from commit ce38bf914cce83792a51ab54b4ba3ac52cbd971e)
2026-11-08 09:38:49 -08:00
Anees Iqbal 2fa6337959 exits lane: the released-import cases' busy time is BUSY, apart from the HELD device
(cherry picked from commit 82619ec44b686e6574e8f0ed27f6f2132c0feefc)
2026-11-08 09:38:49 -08:00
Anees Iqbal b55899dd47 exits lane: exits after a texture over host pages was released while its command buffer ran
reims-vgpu's pin-22 run on the RTX 5080 Laptop GPU ended one test process with SIGSEGV
after its test had passed (a_released_surface_texture_keeps_the_surfaces_memory_while_
imported): a texture over a surface's pages released while a command buffer that binds the
device's heap set ran, then the process's exit with the runtime still releasing.

Two child cases in that shape: a texture over a no-copy buffer of fresh host pages (its
deallocator unmaps them), released once a command buffer of fills (about 60 ms on a GPU)
and a dispatch that reads another texture through its ID is scheduled; twice. Then either
the device is kept for the process's life and the rest let go of as main returns
(released_import_exit), or the second command buffer's completed handler tells the
program, which let go of everything, and it exits at once, the device's last reference
going on the handler thread (released_import_teardown_exit). The parent test
exits_after_a_released_import_are_clean runs both, alone in the suite like the other
exit-timing tests.

Not yet run: built and looped under load next.

(cherry picked from commit 64a00697f47a7c7047c60b75d11ea7a537cbcfd6)
2026-11-08 09:38:49 -08:00
Anees Iqbal 31e642ecc2 RUNTIME_VERSION 1898: a host RAM gather over a chunk the device's thread imports is staged through the CPU however few its ranges
On plans that are not listed, copy_take now answers ThroughCpu for a gather over a chunk the device's
thread will import, so no gather imports its own ranges on the encoding thread (radvruns, 40d18ec325 +
3dbab04a58). On the RTX 5080 such an import (a host-pointer vkAllocateMemory) held the caller for tens
to hundreds of milliseconds, and with three clips several such imports and every other thread's
submissions met behind the driver's lock: reims's 4K fills took 3.4-327 ms, and 1.4-2.1 s with three
clips. Scatters, listed plans and gathers the CPU path cannot take keep the imports' path. Runtime
sources re-pinned.

Verified: the doc checks in the landing tree. The change's own evidence: gem10 8968 (clippy x3,
rustdoc, a_first_gather_of_few_ranges_imports_nothing_on_the_encoding_thread passing, its negative
control failing, lavapipe 1907/1908 with the owned-kernel test fixed on development by 290748e457).
The 5080 before/after is a check on development.
2026-11-08 09:37:31 -08:00
Anees Iqbal 7d4d9346df HostRam gathers over a chunk the device's thread imports go through the CPU, never importing on the encoding thread
copy_take answered Now for a gather over a chunk not imported yet whenever
its ranges, joined where under 2 MiB apart, were at most 16 and none was
the whole chunk. The copy then imported those ranges alone on the encoding
thread. With runs scattered over a chunk, the joined ranges cover nearly
all of it. On the RTX 5080 Laptop GPU a 24 MiB cache of 2,477 runs over
five chunks, its runs joined where under 1 MiB apart, pinned 317 MiB in
61 ms (irisperf's first-fill bench), where the CPU copied the same runs
in 2.8 ms. The bench's first call took 105 to 107 ms with import waits of
0, so the staged path (RT 1893) never ran: it covered only gathers that
would otherwise wait. The consumer's mid-playback fills of new 4K
surfaces took 3.4 to 327 ms with one clip and 1.4 to 2.1 s with three.

Now, on a plan that is not listed and with the device's thread running,
a gather over such a chunk is ThroughCpu however few its ranges. It is
staged through the command buffer's arena, filled by the CPU at its
batch's host step, and the chunk is asked of the thread. A gather the
CPU path cannot take (its bytes possibly written by another use, no
staging memory) still takes the imports' path. So do scatters and
listed plans, as before.

Docs: copy_take, the copy module's first-touch bullet, the staging
check, and HOWTO's copy section.

Test: host_ram_copy_device::a_first_gather_of_few_ranges_imports_nothing_on_the_encoding_thread.
It gathers three pages within 2 MiB in one chunk and one in another,
which before this change was an import of the ranges alone. It asserts
no run import is live once the gather is encoded, the gather is staged,
it waits for no import, and it reads the pages. The negative control is
the old match order; it should fail on any device without
AliasedImportBlitsUnordered. Not run yet.

(cherry picked from commit 3dbab04a5849524c694c74aaea52b776cbef6dd2)
2026-11-08 09:36:45 -08:00
Anees Iqbal 3ed65a2b22 host_ram_first_fill_bench: new surfaces filled while three clips fill theirs, the consumer's mid-playback shape
host_ram_contended_fill_bench (ignored, release, --cfg m2v_gpu) uses a
4 GiB fresh memfd RAM. Three threads each fill seven new surfaces; each
surface is either a 4K NV12 frame's 3040 single pages or a P010 frame's
6080, over three chunks no surface took before. Each fill is one
copy_from_host_ram into a new Private buffer, committed and waited for,
as the consumer's decoder fills each new output surface. A fourth thread
meanwhile imports and frees a no-copy buffer over 32 MiB of fresh
anonymous pages every 20 ms. CONTENDED-FILL lines print the calls' and
completions' median, p90 and slowest per surface kind, plus the copies'
staged, import-wait and chunk-import counts and times.

The consumer measured 3.4 to 327 ms for such a call with one clip, and
1355 and 2055 ms with three, on the RTX 5080 Laptop GPU. Fresh::of
takes the RAM's length.

(cherry picked from commit 40d18ec32589c55e6b56b783d479f6cdd5447b4e)
2026-11-08 09:36:44 -08:00
Anees Iqbal ecddb49936 FAST-PATHS: the NVIDIA pool block gap with its sizes, its frees and making ahead
The RTX 5080's measurement of its own (an exclusive window, 12 blocks a
size): vkAllocateMemory of a pool block's memory takes about 0.16 ms a
MiB, idle or beside another process's GPU work (medians 5.5, 11.0, 20.4
and 40.6 ms for 32, 64, 128 and 254.7 MiB), vkFreeMemory about 0.035 ms
a MiB, and every vkQueueSubmit another thread calls during either
returns once it does. Frames every 16.7 ms met a 254.7 MiB making 28.6
to 48.6 ms late on their own thread (23 of 23 over 1 ms), and up to 67.5
ms with the making on another thread, spread over the frame or right
after a submission (11 of 23 either way). So no block is made ahead on
a thread of the device's own: it would not keep frames from the hold.
A smaller block would shorten it in proportion, at the cost of each
command buffer's pool capacity, which is the orchestrator's call.

Verified: docs only; the numbers are entry
poolwait-poolwait-sizes-063031-063031 (7eb0aab5e5's allocation_holds).

(cherry picked from commit f3e209f7ea255d79ef6b524bd1dcd176e9792589)
2026-11-08 09:33:19 -08:00
Anees Iqbal 0beaeca5fe Re-pin the runtime sources after with_vk_queue's closure gets the VkDevice its VkQueue belongs to, which changes no answer
b4bf228df9 (radvruns): CommandQueue::with_vk_queue calls f(&ash::Device, vk::Queue, u32), the
device the serving generation's, read under the queue's lock, so a caller that made objects with an
earlier generation's handles (Device::raw) sees a recovery atomically and makes them again (reims's
vaplanes copier met the new generation's queue with the lost one's command buffers). The runtime
submits nothing differently.

Verified: signatures --check exit 0 and the pin in the landing tree. The change's own evidence:
gem10 8912 (clippy x3, rustdoc, lavapipe 1907/1908 with the owned-kernel test failure fixed on
development by 290748e457, the new device_recovery test), um790 780M 8911 (device_recovery 9/9).
2026-11-08 09:17:15 -08:00
Anees Iqbal 0d66b9de2b with_vk_queue: the closure gets the VkDevice its VkQueue belongs to
`CommandQueue::with_vk_queue` now calls `f(&ash::Device, vk::Queue, u32)`. The
device is the serving generation's, read under the queue's lock with the
VkQueue. After a recovery the queue lends the new VkDevice's VkQueue. Until
now a caller could get the device only from `Device::raw` handles it had
cached, and after a recovery those name the lost VkDevice. The consumer's
copier did exactly that: it submitted command buffers from a pool made on the
lost device to the new device's queue, and the process died inside RADV
(a segfault at null+0x50 in libvulkan_radeon.so, right after our "VkDevice
was lost and made again" log). No call let it see the change atomically.

Every call site in the runtime, its examples and the validation lanes takes
the new argument. The runtime README's interop and "A lost device" sections,
`Device::raw`'s docs and docs/API.md's device-recovered entry say what the
closure gets. api_signatures.tsv is re-blessed (one signature changed).

Test: device_recovery::a_lent_queue_names_the_vk_device_it_belongs_to_across_a_recovery.
It reads the lent queue's device before and after recover_for_test. The two
differ, and the second equals what Device::raw answers after the recovery.
The test also asserts the old route is wrong: the raw handle cached before the
recovery differs from the lent queue's device after it. That cached handle was
the only source of the device under the old signature.

(cherry picked from commit b4bf228df9db98a451c997f350c6014b027f7e31)
2026-11-08 09:16:24 -08:00
Anees Iqbal 67e38e3e9a SEMANTICS_VERSION 1994: a repeated equal compile option and bitcode module version 1 translate
air11 (8fff014bca, c27da64aaf, b500dc8717): air.compile_options accepts an option that repeats what it
already stated (a linked module's merged list; macOS 11's Core Image kernels), and the bitcode reader
reads module version 1 (names from the module VALUE_SYMTAB, both of its layouts; one macOS 11
framework's clear pipeline). Both were refused before, so translation outcomes change for those
inputs.

Verified: the doc checks in the landing tree (signatures --check exit 0, refusal surface,
conformance coverage). The change's own evidence: msi m3-max-8930/8935 (metal2vulkan-air 526 passed;
every public fixture re-emitted as version 1 decodes alike, 658 compared; engine fixtures translate to
identical SPIR-V, 1046 alike and 369 refused alike; goldens unchanged; clippy clean).
2026-11-08 09:10:35 -08:00
Anees Iqbal 97ba27de2d Regenerate docs/REFUSALS.md for the version-1 symbol table's refusal site
The module-level symbol table reader (bitcode/module.rs, Names::read)
refuses a summary-index entry (VST_COMBINED_ENTRY) as
Unsupported(BitcodeRecord), a new construction site of that variant.
Generated with python3 scripts/refusal-surface/refusal_surface.py.

(cherry picked from commit b500dc8717a4dd60f84eb775fa0a70446db44cd6)
2026-11-08 09:09:42 -08:00
Anees Iqbal a5cfe960fc bitcode: read module version 1 (names in the module symbol table)
A framework pipeline (`clear_vertex`/`clear_fragment`) on reims-vgpu's
macOS 11.7.11 guest was refused 31 times with
`UnsupportedBitcodeVersion { version: 1 }`: the reader took only module
version 2.

LLVM's version 1 numbers values relatively, as version 2 does, but has
no string table: its GLOBALVAR and FUNCTION records carry no name fields
(LLVM's reader strips them with `readNameFromStrtab` only when
`UseStrtab`), and the module-level VALUE_SYMTAB names each global and
function by value id: `VST_ENTRY [valueid, namechar x N]` and
`VST_FNENTRY [valueid, offset, namechar x N]`. LLVM 3.8 and later write
that table after the function blocks with `VSTOFFSET`; earlier writers
put it ahead of them, with no offsets.

The decoder's first pass over the top level now also reads a version-1
module's symbol table (the module-level records read past, every other
block skipped by its length word), so names are known when the records
are decoded: the intrinsic classification of a declaration happens at
its record, before the bodies that call it. The record parsers index
their fields from `type`, after the version-2 name fields when there
are any. The cross-check of function blocks against the table keeps
version 2's rules; in version 1 a defined function without a
`VST_FNENTRY` (an unnamed one, which LLVM's version-1 writer gives no
entry; or every function before 3.8) is found by record order, as LLVM's
reader finds it, and a table with offsets still needs `VSTOFFSET`.
Malformed tables are typed refusals at their record: two names for one
value, a name for no global or function, a NUL or a non-byte in a name,
a block name at module level, a function offset on a global or a
declaration, two module tables; a summary-index entry is `Unsupported`.
Names are charged to the meter before they are copied. Version 0
(absolute value ids) stays refused.

Tests: air's synthetic version-1 twins of the module-level and body
modules (`a_version_1_module_decodes_as_its_version_2_twin`,
`a_version_1_body_decodes_as_its_version_2_twin`, both layouts, an
unnamed function), the error cases, mutation of both; the translator's
`module_version_1` re-emits every public fixture in version 1 (as LLVM's
version-1 writer laid it out) and requires the same decoded module and
ABI, and for every engine fixture's entries the same SPIR-V words,
passing spirv-val.

(cherry picked from commit c27da64aafa87194547223d8b70e052cf5ff795f)
2026-11-08 09:09:42 -08:00
Anees Iqbal 8df3304903 abi: accept a repeated compile option that states what it already stated
`!air.compile_options` refused any option read twice, an equal repeat
included (`slot.replace(value).is_some()`, and a second
`denorms_disable`). Core Image on macOS 11 links its kernels at run time,
and the linked module's merged option list repeats options: reims-vgpu's
macOS 11.7.11 guest got 15 pipeline-create refusals for `ciKernelMain`,
`Abi(BadValue)` at `air.compile_options`.

A repeat now states nothing new and is accepted. An option stated both
enabled and disabled keeps its typed refusal (`BadValue`): the format
gives neither precedence.

Tests: `a_repeated_compile_option_states_it_once` (every option repeated,
whole list twice and adjacent repeats), and `closed_module_level_sets`
now also refuses a conflict that follows an equal repeat.

(cherry picked from commit 8fff014bca534bfeaf2cb550bb26a11ffc53745e)
2026-11-08 09:09:42 -08:00
Anees Iqbal 290748e457 Re-pin the runtime sources after the owned-kernel test's counts and InPlaceRefusal::Placement's doc, which change no answer
0008710e8e counts the YCbCr conversion's kernel builds at a texture's first conversion, where
d119fdeca7 moved them; 9493894b26 records the short last row's shadow among FAST-PATHS's known gaps
and in InPlaceRefusal::Placement's doc. Verified: the pin recomputed and signatures --check in the
landing tree; the test's own evidence (um870 lavapipe 8933, 3/3 x3) in its commit.
2026-11-08 09:08:54 -08:00
Anees Iqbal bfcd71e5d6 Record the short last row's shadow among the known gaps
A texture over host pages whose buffer ends inside its last row's pitch is a shadow
(Refused(Placement)): a linear image's last row takes the whole pitch, so the image's memory
requirements reach past the buffer's bytes, over an import of the caller's pages and over a copied
host buffer's copy alike, whose placement is the buffer's length. Metal reads such a texture in
place, so it is a runtime cost above the driver's: docs/FAST-PATHS.md's known gaps now say so, and
InPlaceRefusal::Placement's doc names the case.

Seen on the Iris Xe (ANV) and the 780M and RX 550 (RADV) by a probe at the guest's shape, which
stays on a branch of its own.

Verified: cargo fmt; scripts/api-signatures --check (signatures unchanged; a doc change).
(cherry picked from commit 9493894b26cee3b1a525d9a0916a83f3fc6a594f)
2026-11-08 09:08:35 -08:00
Anees Iqbal a5cc119ae9 owned_kernel_builds: count the conversion's kernels at the texture's first conversion
d119fdeca7 made a two-plane YCbCr texture's conversion (its staging buffer, sets and refresh, and
with them the conversion's kernels) at the texture's first conversion instead of at its making, so
the test, which counted them at the making, read 0 kernels and failed on every device.

The test now counts each step apart: the making builds no kernel and takes no scratch; the first
conversion (a read() of the texture, which reads the converted image) builds the kernels and takes
the texture's scratch; the next conversion builds and takes none; a second texture over the same
surface builds none at its first conversion and takes scratch of its own. ycbcr_in_place_loop's
read is split into reader (the pipeline state, made outside the counts) and read_with (a grid of
texels), which the test shares.

Verified: cargo fmt; the device test runs as a potluck job after this commit.
(cherry picked from commit 0008710e8ece5cadf96ce3761419a0cb009e2edb)
2026-11-08 09:08:35 -08:00
Anees Iqbal 35c115d102 Re-bless the authored compile census at 0164fee7da
Its product fingerprint follows development's versions at 0164fee7da. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).

(cherry picked from commit bd9d9b89f85f1b30660bd0451a473fdc119725af)
2026-11-08 09:04:14 -08:00
Anees Iqbal 7892414451 Re-bless the golden tables at f84816ddec
Translation changed at f84816ddec (SEMANTICS_VERSION 1993). Blessed on the M3
(s37-pl.sh bless, dv-golden).

(cherry picked from commit 0164fee7da0c9e51459b2c8465c8b7df73c8d1e0)
2026-11-08 08:59:46 -08:00
Anees Iqbal f84816ddec RUNTIME_VERSION 1897: dma-buf imports are made with the device's memory lock released
A no-copy buffer's or texture's dma-buf import (dma_buf.rs import_chunks, and textures over
dma-buf pages) called vkAllocateMemory with the device's memory lock held, so every other making,
placement or free on any thread waited for the driver's import: 62 to 273 ms on the Radeon 780M in
reims's boots (8588, 8866). It now chooses the type under the lock, imports without it and records
the import under it, as pointer imports already did (radvruns, 66f69a827a..93437d2586). Runtime
sources re-pinned.

Verified: the doc checks in the landing tree. The change's own evidence: 780M gem10 8861
makings_beside_a_dma_buf_import_in_the_driver_wait_for_none_of_it (a placement 0.170 ms, a pointer
import 0.248 ms beside a held import; the negative control waits past 5 s), 91/91 in the dma-buf,
residency, in-place, export, host RAM and YCbCr suites; clippy x3 and rustdoc (8829).
2026-11-08 08:52:53 -08:00
Anees Iqbal 93437d2586 host_residency: the timed test times the waits for the memory lock itself, beside kept placements
The 780M run of the timed test at 97594efec3 (job 8861) showed the same
placements with the lock held across the import and with it released:
median 0.003 ms, slowest 0.87 ms against 0.79 ms. Its placements were
4 KiB buffers dropped at once, so each later one was a parked buffer of
the same making (recycle.rs). That path takes no memory lock, so the run
never measured the wait the fix removes.

The placing thread now times each wait for lock(&shared.memory) itself.
It also keeps the buffers it places, at most 4096, so none is taken from
the parked and each placement takes the lock. Printed: the import times,
the lock waits (median, slowest, count past 1 ms) and the placements'
(median, slowest, count past 10 ms). The job's negative control, with the
lock held across the import, gives the before figure.

(cherry picked from commit aba88f26431d9232c842aee11b65fb3f59afd2c2)
2026-11-08 08:52:04 -08:00
Anees Iqbal 762549d9a2 host_residency tests: the held import is the making's alone, the device's own imports going on
The test's stand-in for a slow driver import held every dma-buf import of the
device while set, the device's own checks' among them, which could hold one
and leave the making's waiting a minute. It now holds only the import made on
the making's thread (named for the test).

(cherry picked from commit 97594efec3564e2db6b99636651a3e0bae8816b3)
2026-11-08 08:52:04 -08:00
Anees Iqbal 706e7f61d1 dma-buf imports: made with the device's memory lock released, as pointer imports are
A no-copy buffer's import of its dma-bufs (dma_buf.rs, Device::import_chunks)
and a texture's over dma-buf pages each called Memory::import_dma_buf through
lock(&shared.memory), so the device's memory mutex was held across the
driver's vkAllocateMemory with VkImportMemoryFdInfoKHR. A consumer measured
no-copy buffers over dma-bufs on the Radeon 780M taking 120 to 273 ms to make
while their mapping took 0.14 to 1.8 ms, with two other threads' makings stuck
beside them; every placement, import and free of the device takes that lock.

memory::import_dma_buf is now a function of the memory's mutex, as
import_host is: the types and the device-address flag are chosen under the
lock, the driver's import runs with it released, and the import is logged
under it once made. Pool blocks, imports of pointers and of the runtime's own
pages, and the exported pages already allocated with it released; no other
vkAllocateMemory runs under it.

Tests (tests/host_residency.rs): with the memory's test stand-in for a driver
slow to import (Memory::import_hold, cfg(test) only, called where the
driver's import runs), a placement and an import of a pointer made while a
no-copy buffer's dma-buf import is held must each be done within 5 s, and the
held import then makes its buffer, which reads the file's bytes; and a timed
test prints how long placements wait beside three real 256 MiB dma-buf
imports.

(cherry picked from commit 66f69a827a9de23c7b65443e2974906728fa58ce)
2026-11-08 08:52:03 -08:00
Anees Iqbal 2ce1cf0da3 RUNTIME_VERSION 1896: textures over copied host buffers lie in place over the copy, not in shadows
A texture made over a host buffer the runtime copied (the copy's memory its own) was refused as
Refused(Placement) and made a shadow of the copy: two trips a use, the Iris's 491
refused-placement shadows in reims's census. It is now a linear image bound in the copy's memory
at the texels' offset where the in-place check passed: the host-allocation image under the Fresh
verdicts for a copy in fresh pages; for a copy in device memory the driver's linear image
(PREINITIALIZED), or a DRM_FORMAT_MOD_LINEAR image at Metal's pitch, under the caller's pages'
verdicts (the pooled check only for the pitched image). A rebind re-makes the image over the new
memory (perdraw, 1cf4730839 + da896c5a1f). New count copied_textures_in_place. Runtime sources
re-pinned.

Verified: the doc checks in the landing tree. The change's own evidence: lavapipe (gem10 8867:
clippy x3, rustdoc, 57/57 focused, 40/40 lanes, suite 1900/1901 with the one failure present at
its base), 780M 8878 46/46, RX 550 8881 46/46, Iris 8825 46/46, negative control 8840 failing.
2026-11-08 08:51:57 -08:00
Anees Iqbal da896c5a1f Textures over a device-allocated copy: the caller's pages' verdicts, the pooled check only for the pitched image
On RADV (the RX 550, job 8832) every texture over a copied host buffer whose copy lies in memory
the device allocates stayed a shadow: the route asked the runtime's pooled class's verdicts, which
the check leaves unchecked there, though the image over such a copy is mostly the driver's own
linear image, which starts PREINITIALIZED and so keeps the copy's bytes at its first move. The
pooled class judges only the DRM_FORMAT_MOD_LINEAR image made UNDEFINED at Metal's pitch where the
driver lays its rows otherwise.

So the route asks the caller's pages' class (Pointer) for texels as they lie in the copy and as they
lie in the pages (a rebind may import them), and fresh pages' where the copy lies in them;
copy_unplaced refuses the pitched image for its pitch where the pooled check did not pass for its
accesses. The wider plans of a texture over a copy (the usages its descriptor lacks) take the
caller's pages' verdicts too, as the route does. Texels::over_caller_pages answers only over a
copied buffer.

The device test now asserts an image over the copy where both checks passed and none where the
pages' did not.

Verified: cargo fmt; builds and tests run as potluck jobs after this commit.
(cherry picked from commit 7911bb167b88661f3d4b8b6a4431145ff22a143c)
2026-11-08 08:51:02 -08:00
Anees Iqbal 1cf4730839 Textures over a copied host buffer: an image over the copy where the check passed, not a shadow
Every texture made over a copied host buffer (a no-copy buffer whose import the caller's gate
refused, or that failed) was a shadow, refused as `Refused(Placement)` ("a copy of the caller's
pages in memory of the device's own"), whatever its usage: each command buffer copied the copy's
texels into the shadow's image, and merged writes back, on top of the copy's own copy-in and merge.
A consumer whose views of guest memory pass the host's mapping budget gets copies of its large
window surfaces (reims's Iris census: 112 gate copies, 1.9 GB), and every texture over them is
such a double copy: the boots' 491 refused-placement shadows.

The GPU uses the copy in the pages' stead, so a texture's image can lie there, as a rebind onto a
copy already makes one (`in_place_over_copy`):

- route.rs: a copied buffer's class is its copy's memory's (Fresh in fresh pages the runtime
  imported, else Pooled); the in-place decision asks that class's verdicts and the caller's pages'
  (Pointer: a rebind may import them), each for texels that lie in lines as they lie there
  (`Texels::line_start` reads the copy's offset in its memory; `over_caller_pages` the pages').
- in_place_image.rs: `unplaced` over a copy makes the image in the copy's memory: in fresh pages
  the host-allocation one, as over the pages; in memory the device allocates `own_unbound`, the
  driver's linear image (PREINITIALIZED) where it lays the rows at the pitch, else the
  DRM_FORMAT_MOD_LINEAR one of no external memory (`unbound_in` serves both, and
  `in_place_unbound`). The image is watched for rebinds and its first move holds the pages, for any
  no-copy buffer's pages (the class no longer decides it). A rebind onto a device-allocated copy
  takes the DRM_FORMAT_MOD_LINEAR image too where the pooled class passed for its accesses
  (`class_takes`, from `fresh_pages_take`).
- The image's identity is the buffer's, so its uses name the copy: commits copy the CPU's writes
  in, completions merge the GPU's back, as for the buffer.
- Counted: `WorkCounts::copied_textures_in_place` (also in `host_textures_in_place`); a shadow's
  notice names the copy.

Tests (copied_device.rs): a sampled and a rendered texture over a gate-refused copy take an image
over the copy exactly where the verdicts of the copy's memory and the pages pass (before this,
every one was a shadow, so on a device whose check passes the test fails), read the caller's
texels and a CPU write before a commit, and their blit and clear reach the texels' bytes in the
pages alone; such a texture follows rebinds to another copy and back to an import.

Docs: copied.rs, in_place.rs, in_place_image.rs, route.rs, HOWTO (copied host buffers),
FAST-PATHS (the in-place row), TexturePlacement::InPlace; api_signatures blessed.

(cherry picked from commit e6573e3f1b942d11bda3063f5477745018cf9239)
2026-11-08 08:51:02 -08:00
Anees Iqbal f56371ea90 RUNTIME_VERSION 1895: a GPU pool block a queue lets go is the device's spare for the next queue
A block that goes (its queue went, or it sat unleased for QUIET) becomes the device's spare of its
kind where the device has none, and a queue's first lease takes the spare before it makes one
(cbnotice, dcc2bc0cb4 + 79e85cc69f). A device makes no more blocks of a kind than the most queues
that held one at once; it keeps at most one block per kind beyond them (254.7 MiB of device memory
on the RTX 5080, 1 GiB of wired host memory on the M3 Max). FAST-PATHS's known gap narrows to
makings past that peak. Runtime sources re-pinned.

Verified: the doc checks in the landing tree (signatures --check exit 0, refusal surface,
conformance coverage). The change's own evidence: gem10 m3-max-8873 (gpu_pools 6/6, negative
control 4/6 failing, lavapipe index_pools 4/4 x6, clippy x3, rustdoc); M3 m3-max-8894 (index_pools
4/4 x3, the handler test told 36/36 rounds).
2026-11-08 08:49:15 -08:00
Anees Iqbal c56c50e472 GPU pools: let a quiet period's blocks go before the spare keeps one
The two closures of one chain both borrowed the queue blocks mutably
(E0524). Collect the queues' blocks first, then keep or release each.

Verified: cargo fmt only, here; the build follows as potluck jobs.
(cherry picked from commit 79e85cc69f5b2ec9f98ae682d0a4a775f0d4fff0)
2026-11-08 08:48:27 -08:00
Anees Iqbal 15c72b1690 GPU pools: a block a queue lets go is the device's spare for the next queue
A queue's pool block that went (its queue went, or no lease held it for
QUIET) was released, and the next queue to need a block of that kind
made one again: on the RTX 5080 a 254.7 MiB vkAllocateMemory of 4.9 to
189.5 ms beside other GPU work, during which the driver holds every
vkQueueSubmit of the process (docs/FAST-PATHS.md, known gaps).

Now the block becomes the device's spare of its kind where the device
holds none (else it is released, as before), a made-meanwhile block too,
and a queue holding no block takes the spare at its first lease before
it makes one. A device so makes no more blocks of a kind than the most
queues that held one at once, and none as queues come and go or rest.
The cost is one block of each kind beyond the queues' own until a queue
takes it or the device goes: 254.7 MiB of device memory on the RTX 5080
Laptop GPU, 1 GiB of host memory kept wired on the M3 Max. The spare is
safe to hand on: no lease holds a block that goes, so no command uses
it, and nothing reads a pool's bytes before its own command buffer wrote
them.

QueueBlocks::drain pops the slots instead of taking the map.

Tests: the pool CPU tests cover the spare from both releases, the
made-meanwhile block, the teardown and queue churn (eight queues one
after another make one block); the device tests see a later queue and a
rested one take the spare without a making, and the handler test makes
each round's block after a holder queue took the spare.

Verified: cargo fmt only, here; the runtime and validation suites, clippy
and the device runs follow as potluck jobs.

(cherry picked from commit dcc2bc0cb49f391b7d14c135d7aae97f1a93795b)
2026-11-08 08:48:27 -08:00
Anees Iqbal 452fdfc551 Re-pin the runtime sources after gpu_pools.rs's doc of the NVIDIA submission held by a block's making, which changes no answer
The probe commits cherry-picked with it are removed again in 795d860397, so the runtime's code is
as before; only gpu_pools.rs's module doc differs. Verified: the pin recomputed in the landing tree.
2026-11-08 08:23:50 -08:00
Anees Iqbal 68276c4ffb index_pools: make the handler test's rounds complete during the making
On the RTX 5080 the test passed 20 of 20 beside another lane while
telling almost nothing: in 240 rounds only 8 told, and its negative
control (the completion path waiting on a lock the making holds) failed
0 of 3. The round committed its command buffer and began the making at
once, so the scheduler's vkQueueSubmit mostly came after the making's
vkAllocateMemory began and the driver held it to the making's end; the
command buffer then completed after the making, where a handler that
waits for the making and one that does not look the same.

Each round now waits for the command buffer to be scheduled (its
submission returned, the completion watch begun) before the making
begins, so the allocation holds none of it, and its draw takes about
3 ms of GPU time (instances doubled from one until a measured command
buffer took that long, at most 1 << 24), so it completes early in the
making. A round tells only where the completion fell in the making's
first half (no longer where it came before the making began).

Verified: cargo fmt only, here; the build, clippy, the 5080 runs beside
load with the negative control, and lavapipe follow as potluck jobs.

(cherry picked from commit 319a3632e44804f381002fa2ea88f24cfbbcdca6)
2026-11-08 08:23:36 -08:00
Anees Iqbal 9024d9ee5f index_pools: count a completed handler's lag from its submission's return too
runtime_lane::index_pools::a_completed_handler_waits_for_no_pool_block_made_meanwhile
failed on the RTX 5080 (round 5ce05e1908, lane ln07): the handler ran 37.2 ms
after its command buffer completed, during a 50.5 ms making of the other
queue's index pool block.

What it waited on is the driver, not the completion path. A probe on the
5080 (NVIDIA 615.71.09; 40 rounds of the lane's draw, with and without the
validation layer, completion trace, b5080 entry poolwait-probe1) found:
- the making is nearly all vkAllocateMemory of the 254.7 MiB block, 3.1 to
  35.7 ms beside another process's GPU work;
- in 25 rounds the scheduler thread's vkQueueSubmit of the first command
  buffer was called during that allocation and returned 0.01 to 0.25 ms after
  it, twice after the GPU had ended the batch (23.9 ms into a 29.4 ms making;
  0.3 ms into a 3.7 ms one: the failure's shape). The runtime watches a batch
  from its submission's return on, so it completed as the making ended;
- in the other 15 the submission returned before the allocation began, and
  the handler ran during the allocation in all 15;
- in all 40, the handler ran 0.07 to 1.44 ms after the later of the GPU end
  and the submission's return;
- raw, another thread's vkWaitSemaphores (no wait), vkGetSemaphoreCounterValue
  and vkGetFenceStatus took at most 0.03 ms during allocations of that size
  (1.9 to 213.6 ms): host waits are not held, submissions are.

So the claim is now exact: the lag counts from the later of the GPU end and
the kernel end time (the last vkQueueSubmit's return), and a round tells only
where both fall in the making's first half. One round told about one time in
four on the 5080, so the test runs 12, each with a queue of its own, and
prints each. The driver's hold of the submission is a known gap
(docs/FAST-PATHS.md), and gpu_pools.rs says what a making costs there.

(cherry picked from commit 438b4ec928dc1d44d2003a20537fea77a768d731)
2026-11-08 08:23:36 -08:00
Anees Iqbal 9ac1abfcd1 Remove the pool-making probe and its trace marks
The probe (23e11f529f and the two commits before it) answered its question on
the RTX 5080: the next commit states the finding where its test and docs live.
Its runs: b5080 entries poolwait-probe1 (5080), m3-max-8354 (lavapipe),
m3-max-8388 (RX 7900 XTX).

(cherry picked from commit 795d860397d36cd3ffc50da78ff65e124d38f284)
2026-11-08 08:23:36 -08:00
Anees Iqbal abe8600749 Probe: slow locks with their callers, tasks' kernel waits, page-faulting and spawning samples
(cherry picked from commit 23e11f529fa8e65d82b30e6ad1b8961def4f3894)
2026-11-08 08:23:36 -08:00