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)
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)
A test-only probe (ignored, run by name) and test-only trace marks on the
pool block's making, the completion turn and the handler thread, to find
what the 5080's index_pools failure waited on. Not for landing as is.
(cherry picked from commit 1299b5a3ea5c01cf70e78a5f1e6fd47d759c988a)
HostRam::with_dma_buf_of_runs (radvruns, 0f36724d0f..384ce01a32): on Plan::listed (RADV), a copy
over chunks not imported takes one UDMABUF_CREATE_LIST dma-buf per list of up to list_limit runs
across every chunk it touches, freed once its command buffer completes. Without the source, copies
take their chunks as before. New work count host_ram_run_list_import_nanos. 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: 780M (gem10, m3-max-8822) host_ram_dma_buf 7/7 and
60/60 host RAM device tests; lavapipe 67/67, clippy x3 and rustdoc (m3-max-8786).
HOWTO section 6 gains HostRam::with_dma_buf_of_runs: what the source answers,
where copies take lists, what they differ from (a chunk's import pins every
page of it, for good, and later copies import nothing; lists pin the copy's
pages while it runs, and every copy pays its imports), and the Radeon 780M's
numbers from tests/host_ram_listed_bench.rs at 4f30c38a77 (before the rebase
onto development; the list path is unchanged by it): 4028 MiB of an 8 GiB
guest's file held where whole chunks would make 8192 MiB resident, 8300 of
16384 for 16 GiB; a surface-shaped tile 4.1 to 4.5 ms from the commit to the
completion, a scattered one 0.9 to 1.25 ms, against 0.39 to 0.48 ms over an
imported chunk. The copy paragraph says where lists replace the staged and
alone paths. The runtime README names the call; FAST-PATHS's row on idle
dma-buf imports gains the trade (memory for per-copy time, the consumer's
choice, no accuracy).
(cherry picked from commit c6f08a396cc2e4713dedfae06ad0648019e9e22d)
A list of a copy's runs is the copy's own import of its pages, made on the
encoding thread as a range's alone is, so its time goes in a counter of its
own, WorkCounts::host_ram_run_list_import_nanos (the source's dma-buf and the
device's import, made or failed), not in host_ram_chunk_import_nanos (a
chunk's imports) nor in host_ram_copy_import_wait_nanos (a copy's waits for a
chunk's import). The waits of the chunks no list takes still reach that
counter, through CopyImports. The tile test fails where lists are imported
in no time counted, and prints the time.
Also drops copy.rs's Duration import, which the rebase left unused.
(cherry picked from commit 84f83a5672b392c6c5182a30b0c089dd6fd966e1)
The 780M bench at c4077928ac showed a tile of 1,800 guest pages spread over an 8 GiB RAM taking 16
lists a copy and over a 16 GiB RAM 32: one per 512 MiB chunk it touched, each its own udmabuf
and import (call 1.0 to 2.5 ms, commit to completion 1.5 to 5.2 ms). A list's runs need not share a
chunk: udmabuf's list names a file and offset per run.
RamOnDevice::copy_imports now gathers a copy's imports for every chunk it touches: where lists are
taken (Plan::listed, a source of run lists, ordered blits through aliases, room in the allocation
limit) each imported chunk's own import, then RamOnDevice::run_lists over the runs of every other
chunk, by address across them (page runs cut at chunk ends), split at the source's count of runs
and a chunk's bytes; a list serves each chunk it holds pages of (CopyImports::of_chunk). Chunks
with a run that is the whole chunk, and every chunk where lists are not taken, take
RamOnDevice::for_copy, which is development's again (no list branch). The residency test's RAM
is two 64 MiB chunks where listed, so its 90 clusters across both are one list, which the
per-chunk lists made two.
Verified: cargo fmt only; the 780M runs follow.
(cherry picked from commit 66146a596638850ce0649317928306fb4892686a)
clippy's single_range_in_vec_init refused a one-element array of a Range in the lists test.
Verified: cargo fmt only; clippy follows.
(cherry picked from commit 5e1fe73b374193ba3a412fec13151e0a8661586d)
HostRam::with_dma_buf_of_runs(source, most_runs) gives a RAM a DmaBufRunsSource: one dma-buf of
a list of runs of its pages, their pages one after another (udmabuf's UDMABUF_CREATE_LIST on
Linux, at most list_limit runs a list). Only copies by runs call it, and only where the plan is
Plan::listed (each held import costs every submission and the RAM's chunks are the device's
dma-bufs of its source: RADV) and the device's barriers order blits through two imports of the
same pages. There RamOnDevice::for_copy, for a chunk not imported, takes RamOnDevice::run_lists:
the copy's ranges of the chunk by address, widened to whole host pages and joined where those
share or touch a page (copy::page_runs), split into lists of at most most_runs runs and one
dma-buf's bytes (copy::run_lists), each imported as one dma-buf of the source
(Device::ram_runs_as_dma_buf, Imported::Runs), held by the command buffer until it completed and
freed then. The chunk is neither imported nor asked for, so copies pin their own pages while they
run and never a chunk's untouched pages, which udmabuf allocates for good. Without the source, a
source that fails or answers a dma-buf of another length, the margin of the allocation limit, a
run that is the whole chunk or passes one dma-buf, the copy takes the chunk as before.
A list's VkBuffer holds each run from where the runs before it end: RamChunk keeps the runs and
their offsets (RamChunk::offset_of, RamChunk::bytes), and the copy maps each piece through it;
regions take their host bytes from the pieces, not the import's span. alone_ranges takes one
chunk's sorted ranges (chunk_ranges with no cap) and joins them as before, so every other plan
(ANV, NVIDIA, lavapipe, MoltenVK, RADV without the source) copies as before.
Counted: WorkCounts::host_ram_run_list_imports (new), live in run_imports_live. Tests: copy.rs
units for page_runs and run_lists; host_ram_dma_buf's tile tests over a RAM with a udmabuf list
source (lists of at most 1,024 runs, no chunk, nothing asked, no untouched page resident) and,
without it, the chunk; elsewhere the list source never asked. The bench takes the list source and
prints first and repeated copies, sorted runs and lists per copy, over surface-shaped and
scattered tiles. api_signatures blessed (three added: DmaBufRunsSource, with_dma_buf_of_runs,
the counter; nothing removed); docs/REFUSALS.md regenerated (a DmaBuf site).
Verified: cargo fmt and the signature and refusal scripts only; the 780M runs follow.
(cherry picked from commit f2e5c143dd314835fd58cd6f8430c5c7c620e52a)
Reverts be6e2759e9 and fb3c488788. Importing each of a tile's ranges alone as a dma-buf of its
own kept residency bounded (8 GiB guest: 4028 MiB stays 4028; 16 GiB: 8300 stays 8300) but cost
35 to 45 us an import on the Radeon 780M, 13 to 19 ms for a tile of 1,800 scattered pages, every
copy, where over an imported chunk a copy takes 0.15 ms to encode and 0.5 ms to complete. That
is a speed regression for any caller copying today. The bounded path comes back as an opt-in
source of one dma-buf for a list of runs (UDMABUF_CREATE_LIST), in the next commit.
Verified: cargo fmt only; host_ram.rs and host_ram/copy.rs equal development's (2e381ae1f0).
(cherry picked from commit 5df2d2c71df35ea9be08fd377dced78680a68447)
udmabuf makes no dma-buf of a memfd not sealed against shrinking, so the bench's first copy
was refused (Unsupported, HostMemory: the source failed and RADV refused the shared pointer).
QEMU's memory-backend-memfd seals its file so; the bench's RAM is sealed as the dma-buf tests'
is. Also times the 5 MiB cache's copies over a RAM of one 512 MiB chunk an object imported:
what a copy costs with no import of its own.
Verified: cargo fmt; the 780M run follows.
(cherry picked from commit d89c82e6e85c3488b268015b8842728af99801fd)
tests::host_ram_device::the_ahead_thread_leaves_the_allocation_limit_to_the_objects failed on
the Radeon 780M (homelab-um790-xtx-1, RADV, Mesa 26.2.6) in a run of 41 host RAM tests in
parallel, at its check that the device's live allocations stand at the limit less its margin
once the thread stopped (host_ram_device.rs:575), and passed alone five times and with
host_ram_device's 20 tests. The test picks the allocation limit from the live allocations it
reads first; the device's submission checks (submit_check.rs) hold imports of their own while
they run (TAX_IMPORTS), off the test's thread, and a test that read the live count while they
held them saw the count drop once they let go. ahead_device now waits for the checks to answer,
as host_residency's device does, so no test of the file reads counts or a limit the checks move.
Verified: cargo fmt; the 780M runs follow.
(cherry picked from commit 6ccb33ed88c3650b6014666a7e386c2b3312550c)
copy_from_host_ram: where a chunk is not imported, the pages are imported alone; on a device
whose held imports add to every submission's cost (RADV with a source) always so, joined only
across pages in memory, the chunk not imported for it; elsewhere for at most 16 ranges. What is
refused: pages the device cannot import alone nor as their chunk, with RADV's case named (a RAM
of shared memory with no source). use_host_ram: a copy over a listed RAM's chunk asks for
nothing; a RAM of shared memory with no source refuses copies too. with_dma_buf: the source may
be asked once for each of a copy's ranges. host_ram.rs module docs: the copies bullet.
Verified: cargo fmt only.
(cherry picked from commit 477925f329a4dabff7716f2847d7c248f42d9e40)
Where each listed import costs every submission (RADV with the RAM's source of dma-bufs,
Plan::listed), a copy by runs over a chunk not imported no longer takes the chunk for its pages:
- RamOnDevice::for_copy imports its ranges alone however many they are (no copy::MOST_ALONE
cap there), joins two ranges less than 2 MiB apart only where every page between them is in
memory already (host_ram::resident, mincore), and asks the device's thread for nothing
(run_alone's new ask flag), so the copy pins its runs' pages and pages the guest's file holds
already. A chunk's import pinned every page of a chunk of up to 512 MiB, and udmabuf
allocated each page the guest never wrote, for good.
- The chunk's import stays where the chunk is made already, the device's barriers do not order
blits through two imports of the same pages (AliasedImportBlitsUnordered), the allocations
are within the margin the device's thread leaves, a range is the whole chunk, or a range's
import fails.
- Every other plan (ANV, NVIDIA, lavapipe, MoltenVK, and RADV without a source) is unchanged:
copy::alone_ranges takes the join test as a closure, which answers yes there, over the same
sorted ranges (chunk_ranges with no cap, then the 2 MiB joins as before).
Verified: cargo fmt only; the 780M runs follow.
(cherry picked from commit 9093fc6093d8880b51b920c3b2029449a769048d)
On RADV with the RAM's source of dma-bufs (a listed plan: chunks of up to 512 MiB, each one
dma-buf), a copy by runs over a chunk not imported either imports the whole chunk (past
copy::MOST_ALONE ranges) or imports its ranges alone and asks the device's thread for the
chunk, which imports it. Either way the chunk's import pins every page of it, and udmabuf
allocates each page of the guest's file the guest never wrote, which stays allocated. reims
measured 12.3 GiB of a 16 GiB guest resident with the RAM handed to the 780M, against 7.9 to
8.0 GiB with views alone, and so hands RADV no RAM (and makes no copy by runs there).
These tests state what a copy should do there instead, and fail on the code as it is:
- host_ram_dma_buf's tile test (1,800 pages, near and spread across both chunks; from
steelbrain/ramcopy's f6ce20514c and f5a5fd6cff, reworked): over chunks not imported, each
copy imports its ranges alone as dma-bufs and no chunk, and asks for none (checked past a
tick of the device's thread); over chunks imported by objects, no import; byte for byte both
ways.
- copies_over_a_listed_ram_make_no_untouched_page_of_it_resident: a RAM of which the guest
wrote the tile's pages alone; the copies leave the file's pages in memory (mincore over the
RAM's mapping) as they were, each range imported alone, none joined across pages not in
memory.
- The listed test's copy over a released chunk: its run alone and no ask; the next object over
the chunk lies in its run's import and asks for the chunk.
- tests/host_ram_listed_bench.rs (ignored): an 8 GiB and a 16 GiB guest RAM, half written in
2 MiB extents, a scroll of 240 tiles of 1,800 pages copied both ways: the file's pages in
memory against what whole-chunk imports would hold, and each copy's CPU, wall, GPU and
completion times; a 5 MiB cache's fill and download.
Verified: cargo fmt only. The 780M runs come with the fix.
(cherry picked from commit e63fb417f16a6811d6f1292d5d7455e5b2024579)
The first shape's pages are nine apart and join into one range, which a copy imports alone. A
consumer's tile spreads wider: the second shape is 36 groups of 50 pages, 3.5 MiB apart across
both chunks, past copy::MOST_ALONE. Each shape copies over a RAM of its own, so its first round
finds no chunk imported.
Verified so far: cargo fmt only.
(cherry picked from commit 780c820736ae6bd69f8711aaeacf7fdb48f3ee3c)
A consumer's cache copies a tile of about 1,800 scattered guest pages with copy_from_host_ram and
copy_to_host_ram over a RAM of shared memfd pages with a dma-buf source. This test copies such
a tile both ways, first with its chunk not imported and then with it imported. It checks every
page, and that the page beside each run is untouched. It prints each copy's answer, times and
imports (HOST-RAM-TILE).
Verified so far: cargo fmt only.
(cherry picked from commit 0f36724d0fc69c4801c02a7276aae034c44b4bbf)
What: an_exit_mid_making_is_clean accepts a making_exit without its mark where the
runtime's at-once notice ended it. Why: the hook ends the process at once where the
runtime's work outlasts its bound (AT_ONCE), and then no handler registered before
the hook runs; exits_cleanly counts such an exit to the notice. How verified: with the
tip's runs.
(cherry picked from commit 53c69417c40700c5614ceafa8cbc1ca5089b786b)
What: the making_exit child registers after_the_later_devices right after its
device, as instance_after_handler_exit does. exits_cleanly then counts the exit
up to that mark, and the handlers registered as the device was made (the
driver's and the layer's) are printed, not bounded. an_exit_mid_making_is_clean
asserts that the mark was printed.
Why: on the RTX 5080 beside the runtime suite (-j 6), making_exit failed
EXIT_LIMIT in 44 of 122 exits (entry exitflake) and in 48 of 123 (entry
exitprobe, with probes). The probe timed each part. The hook closed 1 to 2 ms
after the child's last line. The making ended, and the handlers registered after
the device (the hook's later registrations, the compiler's destructors) were
done, 8 to 41 ms after it. The handlers registered as the device was made, the
NVIDIA driver's and the validation layer's, then took 1.5 to 5.9 s. That is the
driver's own exit, slowed by the other GPU work, as exits_cleanly's mark already
treats it for instance_after_handler_exit. In passing exits the whole exit took
205 to 1443 ms.
How verified: the tip's evidence (5080 making_exit loops beside the runtime
suite, the exits module on lavapipe).
(cherry picked from commit 49fb927001081866dd076931707d88232ec7b24f)
On plans that are not listed (every device but RADV's), a copy out of host RAM over a chunk the
device's thread has yet to import no longer waits for that import. Its bytes are filled into the
command buffer's arena in the batch's host step and copied with one vkCmdCopyBuffer, behind the
GPU gate wherever another placement or a recorded scatter covers them (irisperf, 8a22e487b4 to
294c10215f). The ahead thread then imports the chunks such gathers asked for. New work counts:
host_ram_copies_staged, host_ram_staged_fills_gated, host_ram_staged_fill_nanos. 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: lavapipe 78/78 host_ram + host_aliases, the
negative controls 186b38bb12 and 7250eecde2 failing; the M3 and the 5080 before/after runs are
checks on development.
A staging the device has no memory for (the arena's unset region refused)
no longer fails the copy: the copy takes the chunks' imports as before.
The region is asked for before record_staged, which takes it.
(cherry picked from commit 7044fd2ea59da6cb0452e4029214130cecf0f981)
docs/HOWTO.md's host RAM copy paragraph said a copy over a chunk not
imported waits for its import; it now says what each takes: ranges
alone (at most 16, not on MoltenVK or ANV), a staged gather through the
CPU on devices whose thread imports ahead, and the wait otherwise, with
the counts that show each.
api_signatures.tsv blessed for the six new WorkCounts fields
(signatures.py --bless: six records added, none moved).
(cherry picked from commit 9332df0676eea0a5336ee95ffc25deb2b5d0b05f)
Clippy's drain_collect: the fills leave the state as the arena does, and
are dropped outside its lock with it.
Also the tests: a unit test of HostAliases::others_over, and device
tests of a first gather staged through the CPU (no wait, the CPU's
writes after encoding gathered, the asked chunks and only those
imported next, the next gather through the imports), of a staged gather
gated behind a GPU write over its pages, and of one behind a shared
event reading the CPU's writes before the signal.
(cherry picked from commit c2290563334f25f1ada2dec376ea1d276172dba1)
On a device whose plan is not listed (NVIDIA, ANV, lavapipe, MoltenVK), a
gather over a chunk not imported yet whose ranges cannot go alone (more
than MOST_ALONE, a whole-chunk range, or AliasedImportBlitsUnordered)
took the chunk's import on its encoding thread: about 60 ms a 64 MiB chunk
on the RTX 5080, 216-297 ms for a login's first fill of a 24 MiB cache.
Such a gather, where the device's thread will import the chunk, is now
staged: an unset region of the command buffer's arena as long as the
copy's bytes, filled by the CPU from the pages in the host step of the
copy's batch (the scheduler's existing host-step hold), and one
vkCmdCopyBuffer of the covered bytes into the buffer. No import is made
or waited for, and no page is pinned for it. The copy's uses stay the
chunks' keys' reads and the buffer's write, so hazard tracking orders it
as before.
Exactness:
- The step runs once the batch is otherwise ready: its event waits met,
every batch before it in order submitted, so CPU writes before the
commit or before an awaited signal are in the pages.
- Where a key other than the chunks' own read-only copy keys lies over
the bytes (HostAliases::others_over: a buffer or heap over host pages,
placed until its last command buffer let it go), or a scatter into
those chunks was recorded (ChunkSlot::scattered), the step waits for
the gate: every VkQueue done with what was submitted before it.
- Such a use at encode time (which covers earlier work of the same
command buffer, not submitted before the step) keeps the imports' path.
So does an encoder encoded again.
The device's thread now imports chunks a staged gather asked for before
its window's next (next_ahead takes next_asked first), so a cache over
scattered chunks is imported whole by the next fill.
New WorkCounts: host_ram_copies_staged, host_ram_staged_fills_gated,
host_ram_staged_fill_nanos.
Unverified at this commit: build and tests follow.
(cherry picked from commit 8a22e487b457be90b237a460251ca2397038a600)
Measures a login's first fill of a device cache by copy_from_host_ram:
thousands of 1-4 page runs over five chunks of a fresh 1 GiB memfd, only
the cache's pages written. It reports the first fill and the steady
fills (call, GPU, commit to completion, and the counts' movement), and
what each way to serve a first fill costs alone: imports of the runs by
no-copy buffers, joined at gaps of 0, 64 KiB and 1 MiB; the five chunks
imported whole, one after another and on a thread each; and the runs
gathered by the CPU into a Shared buffer that the GPU copies into the
cache.
Ignored, m2v_gpu only. It is the evidence for removing the first-touch
wait on devices with no listed plan.
(cherry picked from commit 837f4a87f1400ef4919f104bb1b416ddc471d056)
checked_frames_merge_once read the device's counts around each frame as the other tests of the
module did before 8d4c3f3db1: the device's in-place check of textures over host pages renders
passes over linear images of its own on its own thread, which the forced rule renders apart and
the device counts with the test's (an RTX 5080 under load counted 727 passes through copies for
706). The test now waits for the check to end before it makes anything (merge_scratch::settled)
and opens each frame's window through merge_scratch::counts_alone, as the module's other tests do.
Verified: see the tip's evidence (lavapipe on gem10, clippy with --cfg m2v_gpu).
(cherry picked from commit e62a71d0958bbf0e08d8811ca719f215c5974a2d)
The consumer's many_passes frame, as a runtime test: a clear, then 706 passes over a target over
a Private buffer (rows of 2048 bytes), each loading and storing it beside a cleared depth
attachment, each after a 1x1 encoder of no attachment whose state rasterizes nothing (WebKit's
index check). Run in eight shapes, the linear rule forced: a Depth32Float_Stencil8 attachment
whose stencil each pass loads, or Depth32Float; the check encoders or none; each pass's
rectangle and color in the command buffer's upload arena (setVertexBytes, setFragmentBytes) or
in a no-copy buffer over host pages at an offset of its own (a consumer's upload chunk in its
guest RAM). Each shape must render every pass apart, merge the passes after the clear once as
one run, every later pass taking the merge over, and leave the texels a private texture holds
after the same frame. Each prints its counts and its GPU time against the private texture's.
The run's break the consumer measured (11-05: 707 passes apart, 706 merges, 705 scratches
reused) was the once rule that 4368a35894 removed: a pass naming a buffer over host pages joined
no run. The runtime's own upload arena never counted: its chunks are the runtime's Shared
buffers (Owner::Runtime, Lie::Fixed), never registered in Rebinds, so Rebinds::host_range
answers None for them.
The probe at 49e75ea4a3 (64 passes a shape) on lavapipe, gem10, job m3-max-8640: every shape
65 passes through copies, 1 merge recorded and 63 taken over, the texels a private texture's.
merge_scratch.rs: blending_beside, the blending state beside any depth and stencil format.
(cherry picked from commit f22edb6823e2a85c89ad6d51120e543fdf1531e4)
A WebGPU frame split at every indexed draw, as the consumer's many_passes test renders it: a
clear, then passes each loading and storing a target over a Private buffer beside a depth
attachment, each after a 1x1 encoder of no attachment whose state rasterizes nothing. The
consumer measured one merge a pass there on an RTX 5080 (707 passes apart, 706 merges), where
one merge a run is the rule. The test runs the frame in each of eight shapes (a
Depth32Float_Stencil8 attachment whose stencil each pass loads, or Depth32Float; the check
encoders or none; the passes' data from a no-copy buffer over host pages, or their own bytes
through setVertexBytes and setFragmentBytes) with the linear rule forced, prints each shape's
merges and compares the texels with a private texture's.
Verified: not yet run (a probe, to find which shape breaks the run).
(cherry picked from commit 6688871a54bd97cbd978675fb419a4be082afba7)
The work counts gain host_ram_chunk_import_nanos, host_ram_copy_import_waits and
host_ram_copy_import_wait_nanos (e8397f1a66), so a run records more. Signatures
re-blessed and the runtime sources re-pinned.
Verified: the doc checks (signatures --check, refusal surface, conformance coverage)
in the landing tree; the change's own evidence is in its commit.
A copy over a chunk not imported yet, whose ranges cannot go alone (more
than MOST_ALONE of them, the device's thread not running, ANV's or
MoltenVK's defect), takes the chunk's import on its encoding thread: it
makes the import there or waits for the one under way. reims-vgpu saw a
login's first fill of a 24 MiB cache take 216-297 ms on the RTX 5080 and
could only infer the cause.
New WorkCounts fields:
- host_ram_chunk_import_nanos: the time every chunk import took, whoever
made it (the device's thread, an object, a copy), failed ones included.
- host_ram_copy_import_waits: copies whose encoding waited for a chunk's
import, counted once a copy.
- host_ram_copy_import_wait_nanos: the time those encodings waited.
RamOnDevice::for_copy answers the time its thread spent in the chunk's
import with the imports; record_host_ram_copy sums it over the copy's
chunks.
Verified: a_gather_and_a_scatter_move_every_runs_bytes_in_order asserts
one wait and nonzero import time for the first copy (the thread held, so
the copy imports both chunks), and no wait and no import time for the
next copy over the imported chunks.
(cherry picked from commit e8397f1a669e062f2a3134f332b0afabf0d16a72)
What: each test of the two modules waits for the device's in-place check of
textures over host pages to end before it makes anything (merge_scratch::settled,
where the policy runs one), and opens each window of the device's counts through
merge_scratch::counts_alone, which asserts that no verdict is pending: the check
no longer runs.
Why: an RTX 5080 under load failed
linear_runs::passes_reading_host_pages_form_one_run with 727 passes through
copies for the test's 706. The counts are the device's. The check renders passes
over linear images of its own on its own thread, and the device counts them with
the test's. The rule the test forces (linear_rule_forced) renders those passes
apart too. That run's output holds the clear-copies notice for an R8Unorm linear
attachment, and the test makes no R8Unorm texture. Once every verdict is known,
the check runs no more, so a window opened after it holds the test's work alone,
exactly. The device memory bounds in merge_scratch read the same windows. A
target over host pages made after the verdicts takes its place for good, where
one made before them is a shadow that may move in place at a later commit.
How verified: see the tip's evidence (5080 beside a lane x20, lavapipe, MoltenVK,
and a probe without the settle showing the check running as the window opens).
(cherry picked from commit 17384c19019c8d305f66fa38b63a8f3fd2ffbd25)
irisperf-pairs (8292ae5075, 02b7831f79): BlitCommandEncoder::copy_runs_from_host_ram and
copy_runs_to_host_ram take (buffer byte, host run) pairs, so a laid-out surface copies in one call;
copy_from_host_ram and copy_to_host_ram lay their runs one after another as before, behaviour and
refusals unchanged, so RUNTIME_VERSION stays.
Verified (irisperf): Iris ms01 8653 host RAM copy tests 18/18, negative control fails the
laid-out test; gem10 8633 runtime clippy plain and m2v_gpu, signature/refusal/api_surface 19/19,
lavapipe host_ram 57/57. Iris, a 31.5 MB laid-out BGRA surface downloaded in one call: 1.02 ms GPU
and 1.79 ms CPU against 4.29 ms and 8.78 ms one call per row.
clippy's reversed_empty_ranges refused the u64::MAX..0 start the span was
folded from (gem10, m3-max-8618); the lowest and highest bytes are folded
apart and make the span once. No behaviour changes.
(cherry picked from commit 02b7831f7985dc892fa32df9d03f4674a56e0969)
BlitCommandEncoder::copy_runs_from_host_ram(ram, runs, destination) and
copy_runs_to_host_ram(source, ram, runs) take (buffer byte, host run)
pairs, so a device cache that keeps a surface's layout (row r at
base + r * pitch, the padding between rows the guest's and untouched)
copies every row in one call instead of a call a row (the Iris measured
2054 calls at 3.9 ms GPU and 8.1 ms CPU against 0.83 ms and 1.5 ms for one
call of the same runs, m3-max-8523).
The call now holds runs at their buffer bytes (Run); copy_from_host_ram
and copy_to_host_ram lay theirs one after another from their offset
(one_after_another), so their behaviour and refusals are as before. Runs
join where they touch in the RAM and in the buffer (merged). pieces()
places each piece at its buffer byte; the record path takes the span
from the lowest run's first byte to the highest's last for the bindings,
windows and hazard tracking, and the kernel's entries already carry their
buffer word, so only the table's filling changes. Runs that all end on a
word and lie at words of the buffer's memory take the dispatches; others,
and copies that write a destination byte twice (a scatter's host bytes, a
gather's buffer bytes), take regions, in rounds where a byte is named
twice so the later run's bytes stay. For the runs calls, a run past the
buffer is RangeOutOfBounds (the first such run's), and a run at a buffer
byte off a word takes regions instead of being refused.
Tests: a laid-out surface (rows at a pitch over scattered pages, two side
by side, one in each chunk) both ways in one call with sentinels in the
buffer's padding and the whole RAM compared, 4-byte rows by a dispatch per
chunk, 2-byte rows and rows at a buffer byte off a word by regions; a
gather naming one buffer byte twice keeps the later run's bytes; the
runs calls' refusals; unit tests for merging pairs, in_words off a buffer
word and pieces at their buffer bytes. The bench's laid-out one-call form
now uses copy_runs_to_host_ram from the laid-out cache.
Docs: both calls' API docs, the module docs, Problem::HostRam, HOWTO
section 6 and the runtime README; signatures re-blessed (REFUSALS.md
regenerated, unchanged).
(cherry picked from commit 8292ae5075d07cbcd6eada94cf8dc99060792722)
viewimport (5ee3ed96c0..32ba8392a0): a lane test pins each driver's route for a reversed view of
single pages, and HostMemory::with_dma_buf's docs and HOWTO state ANV's limit: it imports a
dma-buf for a plain buffer but reports no external memory for a sparse one, so a view past one
udmabuf's list_limit cannot be assembled from several dma-bufs there and is refused.
Verified (pooledmove): Iris 8540 and 780M 8500 dma_buf_imports 18/18; clippy cpuicd/gpu and
rustdoc (8512).
What: the reversed-view test now asserts each measured driver's route for a no-copy Shared
buffer over 64 and list_limit + 1 single pages of a memfd in reverse, mapped from the file and
through udmabufs (VM_PFNMAP), placed outside the guest's range, with a dma-buf source:
- RADV: through dma-bufs, one chunk, or two in a sparse buffer;
- ANV: by pointer from the file; through udmabufs, one dma-buf where one udmabuf holds the view,
else refused (Unsupported, HostMemory) after one request for a single dma-buf of the whole
view;
- lavapipe: by pointer.
No route is a copy. It prints the mappings the view and the import took.
with_dma_buf's docs and HOWTO now say what ANV does. It imports a dma-buf for a plain buffer but
reports none for a sparse one, so its source is asked for one chunk of the whole length, which one
udmabuf must hold. It refuses the pointer of a mapping of dma-bufs.
Why: a consumer's probe found ANV refusing a view of list_limit + 1 pages mapped through
udmabufs. The runtime's route there was not a copy, nor a skipped source:
- the pointer import of the udmabuf mapping was refused: vkGetMemoryHostPointerPropertiesEXT
answered memoryTypeBits 0x7f, then vkAllocateMemory with VkImportMemoryHostPointerInfoEXT
returned VK_ERROR_INVALID_EXTERNAL_HANDLE on memory types 2 and 1;
- the source was then asked;
- vkGetPhysicalDeviceExternalBufferProperties for DMA_BUF reports import for flags 0 but not for
SPARSE_BINDING, so the request's granule was the whole 4,198,400 bytes, and one udmabuf of 1,025
items is past list_limit 1024.
No buffer of Vulkan binds more than one imported memory without sparse binding, so the runtime has
no documented path for such a view on ANV.
Verified: diagnostics on a scratch branch (never merged), on the Iris Xe (ms01, job m3-max-8433,
Linux 7.3.1, i915), the 780M (job m3-max-8454) and lavapipe (gem10, job m3-max-8477). The runs of
this test follow.
(cherry picked from commit 32ba8392a0aa8d16b4fceb9b6ed052e5d618b1a0)
A consumer maps a view of more than one run of file pages as udmabufs of them, one mapping per
udmabuf (VM_PFNMAP), not from the file a mapping a page. The test now makes each of its two views
both ways (Memfd::view_through_dma_bufs).
Verified so far: cargo fmt only.
(cherry picked from commit b655204695165f3cd9abc664af0245ca2dcf3db8)
A no-copy Shared buffer placed outside the guest's range over single pages of a memfd mapped in
reverse order, with a dma-buf source of its pages: over 64 pages, which one udmabuf takes, and
over list_limit + 1, which take two. It prints the making's answer, the source's calls, and the
imports, copies and mappings it took (VIEW-IMPORT), and checks the GPU's read where it is made.
Verified so far: cargo fmt only.
(cherry picked from commit 5ee3ed96c05eeb4c142c958e4f568175ba5ce507)
video4k (26 commits, f195cfae62..171e80a3c1): DevicePolicy::ycbcr_in_place_reads
(YCbCrInPlacePolicy::Model by default, Exact under exact_answers) for linear samples of two-plane
4:2:0 planes read in place through texel buffers, which no device filters natively: the model
blends 4 luma and 4 chroma fetches with midpoint siting and Metal's coefficients, recorded as
HalfSampleFilter/FloatSampleFilter and announced ycbcr-filter-not-exact; Exact keeps Metal's filter.
FAST-PATHS row, both settings tested. The conversion's staging buffer, sets and refresh are made at
the first conversion, and the device-conversion notice is announced there. SEMANTICS_VERSION 1993
(the branch's). Lane fixes for devices that convert the format (780M), and half reads off Metal's
texture unit take the device's rounding (PrecisionNote::HalfTexelConversion, one half ulp).
Verified (video4k): 780M um870 8546 core 31/31, runtime ycbcr 5/5, aligned_byte 2/2, lane ycbcr
48/48; M3 8549 core 31/31, runtime 7/7, lane 48/48; 780M linear sample 1314-1744 us model against
3094-7793 us exact. gem10 780M lane 8547 and clippy x3/rustdoc/lavapipe 8550 follow post-merge.
On the Radeon 780M the half read() and gathers of the _sRGB twins and the 10-bit 4:2:2 and
packed twins, whose images hold steps of 1/8192, lay one half ulp under Metal's at exact ties
(srgb_twins_read_what_metal_reads, four_two_two_and_four_four_four_textures_read_what_metal_reads,
packed_textures_read_what_metal_reads, ycbcr_textures_over_plane_1_read_its_codes_as_luma,
ycbcr_half_gathers_round_ties_away; um870 m3-max-8485, and at this branch's earlier tip
a8a6379b44, um870 m3-max-8499, and development's 7f2257b8af, gem10 m3-max-8421): the device's
conversion of the float texel to half rounds to nearest even, where Metal's rounds a YCbCr step
with ties away from zero. That is the device's native conversion (rule 1): the translation keeps
Metal's ties only through the routine on Metal's own texture unit (lower/texture/half.rs) and
records PrecisionNote::HalfTexelConversion for every half access off it, bound within one half
ulp of Metal's. The lanes read only NativeHalfConversion from read_half's stage as the device's
rounding, so they held such a read to Metal's ties.
Kernels::native_half now takes either note, and a half read or gather that rounds by the device
lies within one half ulp of Metal's (asserted), counted and printed as before.
Verified: cargo fmt; the 780M runs follow.
(cherry picked from commit 171e80a3c1f31234d05498cebad78268cec8aa37)
Clippy under --cfg m2v_gpu (gem10 m3-max-8484): the kept textures' type was very complex
(type_complexity), and parts() borrowed its already borrowed device (needless_borrow).
Verified: cargo fmt; clippy follows.
(cherry picked from commit 884a3691d6987046276b43c1a63b70ec914333dd)
On the 780M (um870 m3-max-8485, this branch over development 7f2257b8af):
- a_ycbcr_slot_takes_the_devices_filter_in_the_pipeline_its_creation_made built Metal's steps
from the twin's half bytes, which took the name of the surface's bytes: the surface is planes.
- textures_over_any_surface_read_what_metal_reads held a P3 surface's codes to Metal's 9/3/3/1
sums where the device reconstructs them itself (YCBCR8_420_2P under DciP3: a chroma code 178
where Metal's is 179): such a texture's read is now the nearest codes to the device's
reconstruction, as the code twins' are (assert_read_codes).
- ycbcr_samples_outside_read_metals_modes held the samples of a texture whose planes are read in
place to the image's texels, the device's conversion: the texels there are the texture's
nearest samples at their centres, Metal's conversion of the codes, whose addressing the test
checks.
Verified: cargo fmt; the 780M runs follow.
(cherry picked from commit 9dfe7b1bc575efeabd6c58a96c841956634dc843)
The closure of Metal's steps took the name of the device's MetalSampler flag, which the notice
check reads after it (E0308, E0600; um870 m3-max-8468).
Verified: cargo fmt; the builds follow.
(cherry picked from commit 255aada33dd15eaeb3ca4657f8ebe484ba8071bd)
On the Radeon 780M, which converts the 4:2:0 formats itself and reads their planes in place, the
ycbcr lanes failed 9 of 48 at this branch (um870 m3-max-8383) and 17 of 48 at development's tip
(gem10 m3-max-8421), the same 9 among them. Two causes:
- A texture whose conversion is the device's announced ycbcr-filter-not-exact as it was made,
though a texture whose planes every function reads in place never converts and so never reads
the device's conversion (a_ycbcr_texture_sampled_and_gathered_by_one_function_reads_its_planes_in_place,
a_ycbcr_sample_through_an_unmeasured_filter_is_announced). Converts::new now announces it at
the texture's first conversion. WorkCounts::ycbcr_device_conversions still counts the texture
as it is made, so a lane can tell before a read that the texture's image holds the device's
conversion. The lanes' notice predicates now take a conversion that ran,
WorkCounts::ycbcr_device_samples (device_samples), in place of the textures made.
- The lanes held the samples of a texture whose planes are read in place to its image's texels,
the device's conversion on such a device, where a function reading the planes converts the codes
itself: Metal's conversion and filter under the lane's exact_answers (YCbCrInPlacePolicy::Exact),
as ycbcr.rs states. Texels::sampled takes Metal's steps of the codes (modelled) for a texture read
in place and the image's texels elsewhere, in a_linear_sample_of_a_ycbcr_texture_is_metals,
a_linear_sample_is_metals_through_each_sampler_and_result and its fragment twin,
a_ycbcr_slot_takes_the_devices_filter_in_the_pipeline_its_creation_made and
ycbcr_textures_read_the_texels_metal_converts; a_draw_samples_the_planes_as_written_before_it
holds a draw read in place to Metal's conversion of the uniform codes.
four_two_two_and_four_four_four_codes_read_what_metal_reads also held a code twin over a surface
whose chroma plane it does not fit in to Metal's codes where the device reconstructs them itself:
it now takes the device's codes there, as the test's other surfaces do.
Docs: the ycbcr.rs and ycbcr_device.rs module docs, Degradation::YCbCrFilterNotExact and its
docs/API.md catalogue entry say the notice comes at the first conversion.
Verified: cargo fmt; the 780M runs on um870 and gem10 follow.
(cherry picked from commit c498f9383a3f4a2ef3f267a135ea5494aa8fb5e4)
video_device_cache_costs (ignored, a release-mode measurement): the 10-bit 4K frame's planes at
CoreVideo's offsets (luma 32 bytes in, chroma right after its rows) in Private buffers of the
runtime's own, as a consumer that lands each decoded frame in a device cache; the frame's bytes
blitted into the cache in each frame's command buffer before the pass that samples the planes.
The caches are made without BufferDescriptor::aligned_byte, then laying byte 32 on a multiple of
256, printing (VIDEO-CACHE) the planes' placements, the GPU time and every work count the frames
moved. frame() takes the optional blit.
Verified: cargo fmt; the 780M run follows.
(cherry picked from commit 36abe1b4909c2b2238fcb06cd9c8545230306982)
The consumer asks whether its plane textures go in place for reads, renders and shader writes.
The probe now makes each plane, at each offset and over each buffer, with ShaderRead |
RenderTarget beside ShaderRead and ShaderRead | ShaderWrite.
Verified: cargo fmt; run by the jobs that follow.
(cherry picked from commit caba7fc304d06e4df1e32142ab176509f7181996)
Plain clippy on Linux (gem10 m3-max-8336) refused m[channel] under lower/'s
deny(clippy::indexing_slicing). The three matrices' coefficient triples are now zipped into one
triple per channel for each range, so no index is taken.
Verified: cargo fmt; clippy runs in the job that follows.
(cherry picked from commit 62c42e8d9501f45b080d89527c1da4fbdff73481)
The lazy conversion (a9d9712869) announced the device's conversion as the texture was made and
again where its first conversion made the device's sampling, and counted it only there. On the
Radeon 780M (um870 job m3-max-8351) tests::ycbcr_device saw the notice twice (2 against 1), and
the ycbcr_textures lane, which reads a texture made while ycbcr_device_conversions grows as the
device's, held the device's texels of a kept image to Metal's grid (688.5 off the grid).
Both now happen once, in YCbCrConversion::new, where the texture is made, as before the
conversion was made lazily: Converts::new takes the device's conversion on the same terms (the
staging copy's planes at BYTES_AT, a multiple of 4, of the staging buffer's own VkBuffer) and
neither counts nor announces, nor does YCbCrDeviceSampling::new. The WorkCounts docs say the
count is taken as the texture is made.
Verified: cargo fmt; the 780M run follows.
(cherry picked from commit 9bd9b9077b25718979af0486c45c2ad7bb4a7b95)