The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
Device::owned_kernel held the device's owned-kernels lock across a
kernel's whole making: its module's build and its VkPipeline's
creation, which on ANV can take hundreds of milliseconds to seconds.
So every lookup of a kernel made already waited for an unrelated
kernel's compile: an encoder's rows copy, ICB reset, shadow copies and
merges, YCbCr sample and index kernels on encoding and committing
threads, ycbcr_conversion and made_ycbcr_conversion at a texture's or
a pipeline's creation; and route_counts_kernel's try_lock answered None
while any making ran, so the frame's routed draws took the region-copy
route. The pool's begin_draw_replay_kernels makes three kernels in a
row and begin_route_counts_kernel one, each a trigger.
Now the lock covers only a lookup, a settle and a Y'CbCr conversion's
creation:
- A kernel made is answered at once.
- A kernel in flight (OwnedKernels::making, one InFlight per kernel) is
waited for: its asker waits on that making's answer alone, holding no
turn of the budget's (budget::without_turn lends a pool piece's), and
takes the same kernel or a clone of the same error. No second compile.
- Otherwise the asker records an InFlight, lets the lock go, takes its turn
(program_turn: what helper_turn took once the kernel was known
unmade), builds, makes the sampler of a YCbCr or 4:2:2 sample kernel
under a short lock (the order and the one conversion per sampler that
the views and the samplers baking it share, as before), and makes the
objects. Its settle, under one lock, counts the kernel
(WorkCounts::owned_kernels_made, as before), keeps it, and removes the
making from those in flight, then answers the waiters. A making whose
thread unwinds is settled with an internal error by its guard, so no
asker waits for ever. A failed making is not kept: a later asker makes
it again, as before.
- route_counts_kernel locks (briefly) in place of try_lock: it answers
Some once RouteCounts is made, whatever else is being made.
keep_nothing (device/carry.rs) is a LOST generation's recovery step: the
line serves past it, its objects were carried to the new generation,
none of its command buffers records, and no work is made on it again;
it destroys the generation's owned kernels (OwnedKernels::destroy sets
`destroyed`). The only other caller of destroy is DeviceShared's drop,
which no making can overlap (a making holds a &Device). Before, destroy
waited on the lock for a making in flight and then destroyed its kernel;
now a making settled after it destroys its kernel at once and answers
Error::DeviceLost, which is what that generation is. A live device never
has `destroyed` set, so no asker on a live device that got a kernel
before gets DeviceLost now.
The test hold: it stays a field of OwnedKernels (a kernel and a Held,
the same Held type device/holds.rs holds its holders with) rather than
a Holds slot. The holds of device/holds.rs are indexed by Holder, the
runtime's own holders of a device, and are passed in holds_go_on
between a holder's steps, before a making starts, where the lock is not
held. This hold must stop one kernel's making midway (between its
module's build and its objects), on whatever thread makes it, the pool's
or a program's, and be read under the same lock as the lookup, so it is
keyed by the kernel where the kernels live.
The test grows a same-kernel check: a second asker of the held kernel
is seen waiting on its making in flight (a test-only count), the hold
has one making at it, and once let go both askers take one pipeline,
one kernel made.
Verified: at the base f310ebe9ee the test failed on lavapipe (msi job
m3-max-33983: the lookup waited past 5 s, the routes' kernel answered
unmade). This commit's runs follow in the lane's report.
Test: tests/owned_kernel_lookups.rs holds one kernel's making midway and asserts that a made kernel's lookup on another thread returns at once with the same pipeline, that route_counts_kernel answers Some, that a second asker of the held kernel waits on its making, and that the release makes exactly one kernel.
Verified: lavapipe on msi (llvmpipe, LLVM 23.1.1): at the test alone (f310ebe9ee, m3-max-33983) owned_kernel_lookups fails ('a made kernel's lookup waited past 5s for another kernel's making'; the routes' kernel answered unmade); at 2a52418bfc (m3-max-33993) clippy -p metal2vulkan-runtime --cfg m2v_cpu_icd --all-targets --all-features -D warnings 0, and 71/71 tests (owned_kernel_lookups, owned_kernel_builds, owned_pushes, rate_mapped_route_kernel, driver_pipeline_compile, the 15 teardown_threads tests, ycbcr_device, ycbcr_in_place_loop, ycbcr_refresh, described_row_copies, shadow_merge_read, surface_two_planes, icb_carry_race, rate_mapped_*, mipmap_plan). Running at landing: plain and --cfg m2v_gpu clippy, rustdoc. Not run on hardware GPUs; the stall is shown with a deterministic hold, not timed on ANV.
ANV's compile time grows with the values live at once. At 94f9436cd8 the heavy test failed on
the Iris Xe (ANV, Mesa 26.2.6; Iris job m3-max-33948): at 10,000 steps with 400 values live a
command buffer waited past the test's 60 s WAIT for its pipelines, and the test failed at that
wait after 224.8 s. With 8 live the same driver is fast at that size: in the same job the
large-kernel test, whose chain is 8,000 steps with 8 values live, made its states' variant and
plain pipelines and passed in 3.6 s in all, and 40,000 steps with 8 live took about 52 s
(m3-max-33783).
WINDOW is now 8. STEPS stays 10,000, which keeps the kernel large by the runtime's measure, and
the test still asserts that premise (`ComputePipelineState::whole_on_partial`: `COUNTED_WORDS`
SPIR-V words or more) for each state it makes. The 400 came with the test and no measurement
chose it. The test's name and docs still say what it checks: the variant's one VkPipeline
against the split's six, with their creation times printed.
Verified at 5a39d9a75f: m3-max-33966 (msi) clippy -D warnings for metal2vulkan-runtime (all targets, all features) plain, --cfg m2v_cpu_icd and --cfg m2v_gpu. Running at landing: the heavy test on the Iris.
On the Iris Xe (ANV), whose GPU writes back the whole 64-byte line its writes end in, a plane's
texture at 0x20 of a Private buffer is in place for RenderTarget and ShaderWrite while another GPU
command may write the bytes beside it in the plane's first and last lines. A device test
(tests::line_beside, under the GPU cfgs) puts two commands with no dependency between them in one
command buffer: a render pass's clear and store, or a kernel's writes, of an R8Unorm plane at
0x20 (a buffer laid by aligned_byte and a plain one; tight rows of 1920 and padded rows of 1000
at 1024; tracked and untracked), and a blit copy or kernel stores into bytes 0x0-0x1f and the
bytes after the plane's last texel to the end of its line; it reads the buffer back. A control
leaves the second command out and must count every one of its bytes lost.
docs/FAST-PATHS.md's Iris known gap now says the line write-back holds over the runtime's own
memory as over host pages (the check's Pooled, ExportedFd and ExportedDmaBuf classes fail renders
for rows that end inside a line, m3-max-33545), and that another GPU command's bytes in the line
are kept.
Verified: Iris m3-max-33919 (ANV, Mesa 26.2.6): 0 bytes lost in all 32 cases x 3 rounds, the
controls counting exactly the left-out bytes ([32, 64], [32, 32], [32, 24], [32, 56]), 0 wrong;
lavapipe m3-max-33912 the same; clippy -p metal2vulkan-runtime --all-targets --all-features
-D warnings under --cfg m2v_gpu (33920), --cfg m2v_cpu_icd (33921) and plain (33926). The doc
commit had cargo fmt only; tests::fast_paths runs on development.
On ANV (Mesa 26.2.6, the Iris Xe of RPL-P) the heavy kernel's 40,000-step chain took the driver
about 52 s to make with 8 values live (Iris job m3-max-33783: the first ragged grid done at
53.76 s, one VkPipeline) and more than 120 s with the test's 400, and the test makes seven
pipelines of it, so it ran for minutes there. Its compiler took about 3.2 MB of stack for that
chain (3,216,936 bytes measured), about 80 bytes for each value; the runtime now makes every
driver compile on a stack with that room (RUNTIME 2392), so the chain's length no longer stands
in for the stack guard, which tests::small_stack_device and the relay's and the pool's unit
tests cover.
STEPS is now 10,000, and the test asserts the premise that keeps it heavy by the product's own
measure: each state it makes is large (`ComputePipelineState::whole_on_partial`, the module at
`compile_memory::COUNTED_WORDS` SPIR-V words or more), so a smaller chain cannot pass the test
vacuously. LARGE_STEPS (8,000, window 8) already meets that measure, so 10,000 holds it with room.
docs/FAST-PATHS.md records the driver's time and stack as a device gap, with what the runtime
does about the stack: the pool's threads start with 8 MiB, and a call asked for on a thread with
less than 4 MiB of stack left is made on a thread of the runtime's started with 8 MiB.
Verified: an msi job's clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and the ledger tests,
and an Iris job running tests::partial_threadgroups (the heavy test prints its ANV times) and
tests::small_stack_device from this commit's archive.
Verified at a96a3ef68d: m3-max-33936 (msi) clippy -D warnings for metal2vulkan-runtime (all targets, all features) plain, --cfg m2v_cpu_icd and --cfg m2v_gpu; metal2vulkan tests::fast_paths 34/34. Running at landing: the heavy test and small_stack_device on the Iris (m3-max-33948).
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A texture over a no-copy buffer's pages imported as dma-bufs tries its image in place with each
of its plans (wider usages first, its own last) and asks the caller's source for each plan's
pages. On RADV PHOENIX (Mesa 26.2.6) an RGBA8Unorm ShaderRead texture tries four, so a source
that refuses pages past udmabuf's list_limit was asked four times for the same pages
(texture_shadow_bench, m3-max-33878: source calls 4.00, refused 4.00 a texture); a consumer's
trace logged 1,620 such refusals over 765 textures, 367 ms in all.
The runtime cannot infer that one refusal answers a wider range: a source may accept exactly a
range it keeps a dma-buf of, or a wider one split otherwise. So the source marks it: a new public
DmaBufStandingRefusal (a runtime extension), returned as its io::Error, stands for every range
that holds the refused one for the rest of that texture's making. bind_dma_buf_image reads it into
DmaBufRefusal::Source { stands }, and in_place_image refuses each later plan whose request holds
such a range with that refusal, its unbound image released, the source unasked. Plain errors
behave as before: each plan is asked.
Documented in DmaBufSource's and DmaBufStandingRefusal's rustdoc, docs/HOWTO.md's dma-buf section
and the runtime README; api_signatures blessed (the type, new, Display, Error). REFUSALS.md
regenerated, unchanged.
Test: tests/dma_buf_standing_refusal.rs, on a device that imports no host pointer: a source of
plain refusals is asked once per plan, a standing one once, and one that refuses plainly then
gives the pages makes the texture in place on the second ask.
With it, a test-only release bench (ignored, --cfg m2v_gpu, Linux with /dev/udmabuf), tests/texture_shadow_bench.rs: an RGBA8Unorm ShaderRead texture over a no-copy buffer of a sealed memfd's pages, in place over one dma-buf against a shadow over more runs than one udmabuf lists, used by one or two dispatches that read or sample every texel and dropped, at four sizes, with a blit and a Private sample as references, printing host, GPU and CPU time, submission counts and the WorkCounts of each part. Its source marks its list_limit refusal as standing.
Verified: compiled in m3-max-33918 (msi, release lib-test archive under --cfg m2v_gpu). Running at landing: lavapipe (dma_buf*, no_pointer_import, host_residency, texel_rows, texture_placement) in 33918, clippy x3 next, and a PHOENIX run of the new test and the bench (the 4 -> 1 asks on RADV expected, unverified). The bench's numbers (PHOENIX m3-max-33878 um790, 33898 gem10) came from 2fe80f0a64 and d06fa76b74.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
On the Iris Xe (ANV, Mesa 26.2.6) two runtime tests aborted with "has overflowed its stack":
- tests::partial_threadgroups::a_heavy_kernel_s_ragged_grids_pay_one_creation, on a pipeline pool
thread (std's default 2 MiB stack). Under gdb (m3-max-33742) the thread held 25,972 frames and
2,090,624 bytes when it overflowed, 25,922 of them one function of libvulkan_intel.so, 80 bytes
each: ANV's compiler recurses about 80 bytes deep for each value of a chain of dependent
values. The kernel's chain is 40,000 values long, so its vkCreateComputePipelines takes about
3.2 MB. Our frames above the driver's entry point there are 13 KiB.
- tests::small_stack_device::a_device_is_made_used_and_released_on_a_thread_with_a_small_stack, on
a 256 KiB thread. Device creation's priming (prime.rs) compiles its kernel through
vkCreateComputePipelines on the caller's thread: 204 KiB of our frames in this debug build
(assemble 108,864 bytes, create_on 52,560, Primer::objects 24,688) and then ANV's compile, 52 KiB
of its frames (one of 49 KiB) when the stack ran out. vkCreateDevice itself took about 55 KiB,
and the fill, commit and wait at most 74 KiB of the thread (painted stack probe, 33742).
Metal compiles in a service of its own, so no program's stack takes its compiles. Every driver
call that may compile already goes through device/compiles.rs's at_user_initiated
(vkCreateDevice, vkCreateGraphicsPipelines, vkCreateComputePipelines, priming's included):
- this_thread::stack_room reads the room left on the calling thread's stack, where its stack ends
read once a thread: pthread_getattr_np + pthread_attr_getstack on Linux,
pthread_get_stackaddr_np - pthread_get_stacksize_np on macOS, GetCurrentThreadStackLimits on
Windows (gnullvm and msvc alike, windows-sys's Win32_System_Threading), none elsewhere.
- at_user_initiated runs the call on the asking thread only where it is at the user-initiated
class (macOS) and its stack has COMPILE_ROOM (4 MiB) left; else on its relay thread, which now
starts with COMPILE_STACK (8 MiB, glibc's default thread stack, which Mesa's own compile threads
use) on every OS. A Linux or macOS main thread still compiles in place; a Rust thread's 2 MiB,
a macOS secondary thread's 512 KiB and a Windows main thread's 1 MiB hand the call over, at one
thread start and join per call. The relay is the one macOS's class already used, unchanged: it
raises its class to user-initiated on macOS, makes the one call inside an exit-guard section
with the asking thread's measured diagnostics, holds the driver's messages for the asking
thread's sink, is joined before the call returns, resumes the call's panic on the asking
thread, and where no thread starts or the process is exiting the asking thread makes the call.
- The pipeline pool's threads start with COMPILE_STACK, so their pieces' makings run on them.
The stacks are address space; the system commits their pages as they are touched.
Tests: device::compiles::tests::a_pipeline_asked_for_on_a_small_stack_is_made_on_a_stack_with_the_room
(a fake driver reports the room and thread its call ran on: asked on 256 KiB and 2 MiB threads
it runs on the relay with at least 4 MiB left, on an 8 MiB thread on the asking thread; without
the room check it runs on the 256 KiB thread and fails), and
pipeline::pool::tests::a_piece_runs_on_a_stack_with_the_room_a_compile_takes. The existing tests'
asking thread now has the compile stack, so their in-place assertions still hold.
The relay test expects by the room the asking thread has: glibc reuses a cached stack of up to four times the size asked, so a 2 MiB thread may hold the 8 MiB a previous relay thread left and rightly compile in place; the 256 KiB thread must relay and the COMPILE_STACK thread must not.
Verified at a4d5ec0cdf: m3-max-33801 (msi) clippy -D warnings for metal2vulkan-runtime (all targets, all features) plain, x86_64-pc-windows-gnullvm, x86_64-pc-windows-msvc, gpucfg and cpuicd; device::compiles + pipeline::pool unit tests 14/14; the negative control (room check removed) fails at the 256 KiB thread ('made on the asking thread true, 251975 bytes of room'); lavapipe small_stack_device and the two non-heavy partial_threadgroups tests 3/3. Iris (m3-max-33783, the same stack code plus inert probe hooks): small_stack_device passes; the heavy kernel's vkCreateComputePipelines ran on an 8 MiB pool thread at 3,216,936 bytes deep (13,449 ours) without overflowing. The heavy test still takes ANV about 52 s a pipeline at 40,000 steps; its step count follows in its own commit.
Its first encoder's first dispatch recorded later, in a segment of its own, while the pipeline
was being made: the next dispatch pushed whole into the encoder's new VkCommandBuffer and the
segment kept the second encoder from folding (lavapipe, m3-max-33792: [2, 2, 2, 2, 2, 0], 0
folded). One dispatch completed first makes it. The ANV rule PushedSetZero follows is draws'
in render/bound.rs (Bound::pushed_set's forgotten flag).
Verified: m3-max-33819 (msi) clippy -p metal2vulkan-validation, lavapipe 14/14: writes per dispatch [2, 0, 2, 2, 2, 0] with 1 encoder folded pushing, [0, 0, 0, 0, 0, 0] with push withheld, outputs checked under the validation layer.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The encoder's end built the route-counts kernel inline (owned_kernel): a VkPipeline made on the
encoding thread behind a program turn of the pipeline budget, which can wait behind the pool's
makings. On the PHOENIX (RADV, release, probe m3-max-33749) end_encoding took 0.83 to 0.90 ms with
the kernel built there, against 0.22 to 0.27 ms with it made before.
A pass's first draw the GPU routes now begins the kernel on the device's pool, once per device
(Device::begin_route_counts_kernel, holder RouteCountsKernel). The encoder takes it as it ends
only where it is made, without waiting (Device::route_counts_kernel, a try_lock). An instance
whose kernel is not made by then runs no steps: its draws' counts keep what the CPU wrote
(fan-out 0, region-copy MAX_SEGMENTS), so each draws its region-copy route, as a draw whose other
routes did not record does. rate_map_gpu_routed_draws now counts an instance's marked draws as its
steps are planned, so routed equals fanned plus copied whether or not the steps ran. The device
tests' hold array takes its length from the last holder (it had three places, so the kernel's
pool piece indexed past it under the GPU cfgs).
Test: rate_mapped_route_kernel holds the pool while a frame's routed draws begin the kernel and
asserts the encoder made no kernel, routed none, drew every draw by its region-copy route (2897
red, 16 region-copy draws), and that once the kernel is made the same draws are fanned out over
the same pixels ([16, 16, 0]).
Verified at 7ed2805004: m3-max-33791 clippy (runtime, all targets, all features), runtime unit
tests 79/79, lavapipe rate_map device tests 25/25 (depth_equal 0 red in every leg), and the
negative control (the kernel made inline again: the new test fails, 1 kernel made in the held
frame); m3-max-33818 clippy under m2v_cpu_icd and m2v_gpu. PHOENIX (m3-max-33813, release, two
runs): cold end_encoding 204 / 182 us (166 / 158 us with the kernel made before; 826-896 us
before this change), the kernel made on the pool in the cold frame (0.30 ms, off the encoding
thread), the second frame routing 64/64; cold through commit 6.0 / 5.8 ms against 5.8 / 5.2 ms
premade.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A compute dispatch pushed its whole set 0 and bound its pipeline at every dispatch, though draws
already push only what changed (render/bound.rs). On ANV a dispatch's push and the flush of the
dirty push set cost most of the ~5.7 us a dispatch its committing thread spends there beyond
lavapipe (the Iris sizing run, committer 8.5 us a dispatch of the textured shape).
Now an encoder keeps what its dispatches recorded at the compute bind point of its
VkCommandBuffer (binding::PushedSetZero): the pipeline bound last and set 0 as pushed with a
pipeline layout. A dispatch binds its pipeline only where another is bound and pushes only the
writes that differ from those set 0 holds, none where none does. It holds only while nothing
else recorded into that VkCommandBuffer since the encoder's last such dispatch (a count of the
encoder's recordings, bumped by every command, barrier, copy run and gather run that takes it);
another VkCommandBuffer, any other command (which forgets it explicitly), a flat dispatch's
preprocess, set 0 bound from a set and a dispatch of another layout forget it. Each encoder
begins it empty, so an encoder folded into the group's VkCommandBuffer (encoder_fold.rs) pushes
its first set 0 whole, and a dispatch recorded later into a segment of its own pushes whole.
Vulkan's rules it rests on: vkCmdPushDescriptorSet, "Push descriptors can be updated
incrementally and cause shaders to use the updated descriptors for subsequent bound pipeline
commands ... until the descriptor is overwritten, or else until the set is disturbed"; Pipeline
Layout Compatibility, binding a set N disturbs a lower set only where the layouts are not
compatible for it, and binding a pipeline disturbs none. Where the driver's pushed descriptors
go stale across a pipeline bind (RuntimeDriverDefect::PushedDescriptorsStaleAfterPipelineBinds,
ANV), the dispatch binds its pipeline before the push and pushes at least one write after each
bind (set 0's first where none changed), as a draw does; a later region that binds another
pipeline pushes one again.
WorkCounts::dispatch_set_zero_writes_pushed now counts the writes carried (none for a dispatch
whose set 0 is unchanged); dispatches_pushing_set_zero still counts each dispatch of a pushed
set 0.
Tests: tests::pushed_set_zero (carry, forgetting, the stale rule); the device test
runtime_lane::dispatch_work::dispatches_push_only_the_writes_that_changed: writes per dispatch
[2, 0, 2 | 2, 2, 0] over two encoders folded into one VkCommandBuffer (encoders_folded 1), the
second's first dispatch of the buffers the first's last pushed carrying 2, and every output's
words checked, under the validation layer, both ways.
Verified: clippy -p metal2vulkan-runtime -p metal2vulkan-validation --all-targets --all-features -D warnings in m3-max-33792 (msi). Running at landing: the lavapipe tests (33792) and the negative control at the base plus the test alone (33803); the Iris A/B follows.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A runtime extension (Metal has none). A guest's buffers over pieces of one shared file of guest RAM
were each imported as their own dma-buf import and freed with the buffer, so a compute loop that
made and dropped no-copy buffers paid an import and a free per command buffer, and on RADV each
import maps its pages at once (the next submission's CS waits for the page-table job).
Device::import_shared_dma_buf(file, options) (unix) imports the whole dma-buf on the caller's
thread, or joins the device's live import of it, and returns a SharedDmaBufImport; while a handle
lives, the file's entry in the device's map keeps the import, so buffers over its pieces join it
instead of importing again, and it is freed once its last buffer, heap and handle have gone (one
kept import per file a live handle names, per generation). The class comes from `options` as a
no-copy buffer's (Private, Memoryless and undefined options refused, Invalid StorageMode); the
import takes the type a no-copy buffer of that class would get first, so pieces join it.
Refusals use the existing kinds (Unsupported HostMemory, OutOfMemory). A device's recovery lets go
of the lost generation's kept holds and seeds the new one's map, whose first buffer imports the
file again; nothing is imported on the recovering thread. A device without a dma-buf importer
keeps nothing (Debug: imported false). The handle imports whether or not the device's buffers over
those pages take the dma-buf route: on a device that takes the pages' pointer it is one listed
dma-buf a submission for nothing. WorkCounts::dma_buf_shared_imports_kept gauges the kept imports;
the handle's import counts in dma_buf_imports. Docs: rustdoc, dma_buf.rs Shared files, HOWTO
dma-buf section, the runtime README extensions and unix-only lists. REFUSALS.md: the StorageMode
site moved to host_class, which the no-copy call and this one share.
Public surface: Device::import_shared_dma_buf, SharedDmaBufImport (Send + Sync, consumer_auto_traits)
and WorkCounts::dma_buf_shared_imports_kept, blessed in api_signatures.tsv.
Verified: m3-max-33745 at the lane tip 856a1fabae: clippy plain, m2v_gpu, m2v_cpu_icd 0; rustdoc 0;
lavapipe runtime suite 2836 passed. Device tests (lavapipe): three buffers made and dropped in turn
take imports 1 / joined 3 with the handle, imports 3 / joined 0 without; a handle keeps a live
buffer's import; recovery imports nothing and the next buffer's import stays kept; Private refused.
Churn bench, PHOENIX (RADV 780M, release, interleaved, 450 command buffers an arm, a8f297bf11, the
same code but the count): no handle 1 import + 1 free a command buffer, call median 820-907 us, GPU
start median 3026-3037 us; handle kept 0 imports, 0 frees, 1 join, call median 25-69 us, GPU start
median 104-145 us.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
What: two default-on counts, one relaxed add each per compute dispatch that records (compute.rs,
before its command_reaching or command_later): the dispatches whose uses hazard tracking took, and
those uses (each resource range the command reads or writes, those reached through what the
encoder made resident among them). Uses over dispatches is what a dispatch's tracking walks
(command_reaching, track, order_as, touch_reaching). Listed in the host_ab example's counts; the
dispatch_work lane test asserts four tracked dispatches of at least two uses each.
Why: a guest compute benchmark's dispatches cost 7 to 38 us each on a Radeon 780M, most of it
inclusive under command_reaching, track, settle_live and order_as, which scale with the uses a
dispatch reaches; the repository's dispatch bench reaches 5 and costs about 1.2K instructions
there. No count said how many uses the costly dispatches reach (dispatch_used_resources_listed
counts listings of what an encoder made resident, not uses per dispatch).
Verified: m3-max-33750 (msi) at the lane tip b7ed24d9a8: clippy (runtime + validation, all targets, all
features) 0; lavapipe runtime_lane::dispatch_work passes (4 dispatches tracked 8 uses, push and bind devices).
clippy m2v_gpu / m2v_cpu_icd and rustdoc follow.
Public surface: WorkCounts (for the lanes) gains dispatches_tracked and dispatch_uses_tracked, blessed in
api_signatures.tsv; a struct literal of WorkCounts must name them, Default and readers are unaffected.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
On lavapipe (msi job m3-max-33699, the test binary at d7e7eca11f) three tests made their
textures while the device's in-place check was still pending ("pending 2" in the counts), so
the textures and their twins were shadows and "the texture's twin made, in place" read 0:
a_private_bit_buffer_s_texture_is_read_in_place_by_a_kernel,
a_private_bit_buffer_s_texture_is_sampled_in_place_by_a_draw and
a_texture_twin_bound_without_the_slots_proof_is_refused_and_would_reach_the_pages. The tests'
device waited for the check only where its memory types export (fd_buffer_types), which
lavapipe's do not, so whether the check answered before the first texture was a race the
loaded host lost.
device_with now settles the check wherever the policy takes textures over host pages in place
too (Device::settle_in_place_checks), as it did on exportable devices.
On the Iris Xe (ANV) the_shadow_log_names_a_twin_not_in_place_and_a_dispatch_s_first_read
reached neither line ("the shape reached neither line on this device", read_twin_device.rs:993):
ANV takes the 64x64 BGRA8Unorm texture at rows of 272 bytes as an explicit
DRM_FORMAT_MOD_LINEAR plane, so its read twin and the texture both lie in place (made: twins 1,
not in place 0, pitched 1). The product is right; the premise "no driver lays rows at 272" did
not hold.
The test forces RADV's rule for such a plane on its own device (`linear_pitch_rule_forced`,
256), as the sibling tests of the same shape (`refused_twin`, REFUSED's (0, 64, 64, 272)) do,
so neither lies in place on any device, and asserts both lines' preconditions exactly: one twin
not in place, the texture a shadow.
Verified: see the lane's report (Iris probe job and the msi build with lavapipe runs).
On the Iris Xe (ANV) the plane R8Unorm 3840x2160 at byte 0x20 of a buffer made without the
aligned-byte option was in place ("off the alignment without the option", aligned_byte.rs:207).
The test asserted a shadow wherever
`Device::minimum_linear_texture_alignment_for_pixel_format` answers more than 32 bytes. That
answer is at least the device's line of memory (`nonCoherentAtomSize`): ANV answers its 64-byte
line, while its linear image of the plane binds 32 bytes into memory, and the runtime makes a
texture under the answer in place where the device's image takes its layout (as documented).
The product is right; the premise confused the line with the image's alignment.
The control now asserts the shadow where the memory alignment of the device's linear image of
the plane (`VkMemoryRequirements::alignment`) does not divide 0x20, read through
`Device::linear_texture_memory_alignment`, a test-only query that makes the same image
`linear_texture_bytes_per_row` makes (one code path, `own_linear_image`). The public API is
unchanged. The print names both alignments.
Verified: see the lane's report (Iris probe job and the msi build with lavapipe runs).
On the Iris Xe (ANV, Mesa 26.2.6) four kept_padding tests failed. ANV lays the linear rows of the
tests' textures tight: an RGBA8Unorm image 101 texels wide at 404 bytes a row, a BGRA8Unorm one
65 texels wide at 260 (`Device::linear_texture_bytes_per_row`, the driver's
`vkGetImageSubresourceLayout` row pitch, as documented). Neither is a multiple of 16, which
Metal's `bytesPerRow` must be, so no texture lies at the device's own pitch there:
`Buffer::new_texture` refused 404 (`RowPitchAlignment { bytes_per_row: 404, alignment: 16 }`,
kept_padding.rs:336), and the blocks tests' premise "rows of the device's own pitch hold
padding" failed at 260 (kept_padding.rs:667). The product's answers are right; the premise held
only where the driver pads linear rows to a multiple of 16 (lavapipe, RADV, NVIDIA).
The own-pitch checks now run where that pitch is a multiple of 16 (as padding_unobserved.rs
already does); on ANV each of 416, 448 and 512 is checked as one of the other pitches (a shadow,
or in place with its first move kept). The two blocks tests of the texture at the device's own
pitch print that none lies there and return; the past-pitch test lays rows 256 bytes past that
pitch rounded up to 16 (unchanged where it is a multiple of 16: 528 on ANV).
Verified: see the lane's report (Iris probe job and the msi build with lavapipe runs).
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
What: the pages copy's owned kernel makes its first storage-buffer binding, the array of
PagesCopyModule::imports(device) imports, VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT where the
array holds more than one and the device enables descriptorBindingPartiallyBound (the runtime
enables it wherever the device has it: device/enables.rs, Vulkan 1.2 features). Each dispatch of a
copy then writes (pushes, or writes into its set) only its own imports, then the buffer's window
and the table: OwnedKernel::first_written accepts a set that writes 1 to the array's length of the
array's elements where the binding is partially bound, every element elsewhere, and buffer_place
places the rest after them. Without the feature the elements past the dispatch's imports hold its
first import again, as before. The kernel's making text carries the flag.
Why: since RUNTIME 2322 every pages-copy dispatch wrote the whole array: on a device of 32 push
descriptors (ANV, RADV, NVIDIA, lavapipe: 30 imports) a dispatch over one import pushed 32
storage-buffer descriptors where 3 serve, through push_set's heap path (past 16 writes) and the
driver's vkCmdPushDescriptorSet, at every copy dispatch (358 to 813 a consumer's boot). No table
entry names an element past the dispatch's imports, so no invocation accesses one.
Vulkan: VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT "specifies that descriptors in this binding
that are not dynamically used need not contain valid descriptors at the time the descriptors are
consumed"; a push descriptor set layout takes it
(VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-flags-03003 forbids such a layout only
UPDATE_AFTER_BIND, UPDATE_UNUSED_WHILE_PENDING and VARIABLE_DESCRIPTOR_COUNT), and
descriptorBindingPartiallyBound must be enabled for it.
Test: host_ram_copy_device's a_dispatch_over_one_import_writes_its_own_descriptors_alone: rows of
4-byte texels in one chunk, one dispatch, the gathered bytes right, and the storage-buffer
descriptors the owned kernel's set or push wrote (a test-only thread-local count,
owned_kernel::buffers_written) 3 where the array is partially bound, the array's length and 2
elsewhere (32 before this change on lavapipe).
Verified: m3-max-33702 (msi) at the lane tip 238fde9d64: clippy (runtime + validation, all targets,
all features) 0, rustdoc 0; lavapipe host_ram_copy_device 32/32 (m3-max-33686, the same tree before
its rebase), "an array of 30 imports, partially bound true: 3 storage-buffer descriptors written";
PHOENIX (RADV, carried m2v_gpu archive of 238fde9d64) host_ram_copy_device 32/32, 3 written
(m3-max-33733); negative control (the whole array written again) fails the new test with 32
(m3-max-33700). clippy m2v_gpu / m2v_cpu_icd in 33722.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
What: a default-on count beside dispatches_pushing_set_zero, one relaxed add of the push's write
count per pushing dispatch (compute.rs), so writes over pushes is the descriptors a compute push
writes. Listed in the host_ab example's counts; the dispatch_work lane test asserts every push
carries the same writes, at least one, and that writes are counted exactly where pushes are.
Why: on the consumer's Iris Xe, binding::push_set's instructions over a guest compute benchmark's
timed pass rose 21-36% between two runtime pins with the same Mesa (26.2.6), almost all of it
under compute dispatches' pushes, inside the driver's vkCmdPushDescriptorSet. Whether each push
carries more descriptors, or more dispatches push, needs both counts; draws already count theirs
(set_zero_writes_pushed).
Verified: msi m3-max-33677 at the lane tip 9794e48d50: clippy (runtime, all targets, all features) 0;
lavapipe runtime_lane::dispatch_work::dispatches_push_their_set_zero_where_the_device_pushes passes both
ways (4 pushes carried 8 descriptor writes / 0 pushes carried 0). clippy m2v_gpu/m2v_cpu_icd and rustdoc follow.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A heap's GBGR422 or BGRG422 texture lies as a shadow of the heap's bytes in Metal's rows (its answer
is Metal's measured rows: 512 @ 16 for 16x16, 8192 @ 16 for 64x64), and heap_texture_at excluded
4:2:2 textures from the decoded twin RUNTIME 2382 gave other carried formats' shadows, so every
kernel read and sample of one was refused, NotImplemented(Format) (56 refusals on PHOENIX and on
lavapipe, m3-max-33636 / 33625), where Metal reads it and the device can decode it.
heap_texture_at drops the 4:2:2 exclusion: the shadow keeps the twin with_decoded_twin chooses for
the device, through the device's conversion of the pairs where it converts them (rule 1), else
Metal's decode, one whole-image pass recorded after each copy in that moves its rows, its kernel made
at first use. A 4:2:2 heap texture cannot lie apart from the heap's bytes (held_to_metal sends rows to
Shadow or refuses with HeapTextureMemory; Unaliased is for one-plane and two-plane formats only), so
every 4:2:2 heap texture over device memory now keeps a twin; one over the caller's host pages, and a
detached heap's stand-in, stay twinless and refuse reads. Docs: chroma_pairs.rs contract,
decoded_twin.rs, degradation.rs CarriedDecodedTwin (doc and cost: "moves the blocks or rows"),
docs/API.md; first_use's lines say "decode passes set at the making N, their kernels made at first
use"; the HEAPDECODE line names a missing twin "none".
Verified: PHOENIX m3-max-33671 (carried archive of the lane tip 4976a40be3): 5/5 (heap_carried_reads
with GBGR422 and BGRG422 16/64 Private/Shared under both heap answer policies, new_resources_wait_for_
no_gpu_work, a_carried_heap_texture_reads_its_bytes_with_no_commit, four_two_two_heap_textures_take_
metal_s_size_and_layout, a_texture_held_for_copies_a_kernel_s_handles_reach_is_announced_once): every
4:2:2 case shadowed, a use 1 copy and 1 decode, a second encoder 0 and 0; kernel reads, samples,
samples after a blit and a Shared replaceRegion, blit out and getBytes equal the texture outside a
heap; route: Metal's decode (RADV and lavapipe convert no 4:2:2 pairs; the device-pair route in a
heap shadow ran on no device). lavapipe msi 33635: the same 5. Control (test commit alone): PHOENIX
33636 and lavapipe 33625 fail with the 56 refusals. Clippy plain, m2v_gpu, m2v_cpu_icd and rustdoc 0
(33635); runtime lib tests in 33672.
The lane's device options ask for exact answers, RateMapRegionPolicy::Exact among them, and the
encoder frame did not set the policy back, so its draws went region by region through each
region's own viewport: on the Iris Xe (job m3-max-33608) every frame printed 0 draws through the
region-copy variant and 0 routed on the GPU, base and tip alike. It now sets FanOut, as the
pieces frames set their policy. A lavapipe probe of the same pass over the same map under the
default policy took the region-copy variant and the GPU's routes in every case (job m3-max-33629).
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A guest compute benchmark's encoders each update one fence and wait for one (reims, 780M,
c471372f87: fence updates = waits = encoders in every workload; 63 encoders a command buffer in one
workload), and an encoder that updated a fence ended its fold group, so every encoder began its own
VkCommandBuffer: 47.5 a submission, encoders_folded 54 of 117591. The driver's per-call work grows
with every VkCommandBuffer, and on the Iris Xe a VkCommandBuffer boundary costs 18.25 us of GPU time
against 0.64 us for the least barrier between dispatches (m3-max-33589).
A fence update no longer ends its group. A later member's commands order after the update by a
barrier recorded per command at the narrowest width that covers it: source, the updating encoders'
writes in the stages the update covers (SHADER_STORAGE_WRITE in shader stages, TRANSFER_WRITE in
transfer stages, attachment writes in a pass); destination, what the command can reach of memory
no use names, in its own stages (SHADER_STORAGE_READ | SHADER_SAMPLED_READ | SHADER_STORAGE_WRITE,
TRANSFER_READ | TRANSFER_WRITE), plus its untracked uses' own reads (indirect-argument or uniform
reads only where an untracked use reads them); tracked resources keep the tracker's rule. Between
two compute encoders that is the least barrier, SHADER_WRITE to SHADER_READ | SHADER_WRITE. The
barrier precedes the member's commands whether or not it waits, since a wait anywhere in an encoder
covers all its commands, which enter the shared VkCommandBuffer as they come; independent encoders
that update fences no one in the group waits on so run one after another (accepted: the guest's
encoders all wait). Across command buffers and queues nothing changes: Metal evaluates a fence at
submission, a wait only orders after updates committed before it ("commit the command buffers with
the producing passes before those with the consuming passes", MTLFence), a waiter on another VkQueue
waits for the updater's batch end, and a group never crosses a batch, so no cycle can form.
WorkCounts gains fold_fence_barriers and six folds_refused_* counts (the reason a join was refused:
kind, tail, batch, state, parts, ends; one relaxed add on a refused join, nothing on a join). Tests
that ended a group by a fence update now end it by a change of dispatch type or an event.
Verified: PHOENIX (RADV 780M, release, interleaved, 600 command buffers of 24 encoders, m3-max-33626):
fenced chain 47 -> 1 VkCommandBuffer a submission, mean call 56-79 -> 18-20 us, GPU start median
142-173 -> 101-105 us, GPU time median 146.7 -> 87.8 us (either wait order); independent fence-updating
encoders 74.7 -> 88.0 us GPU (serialised, as accepted); unfenced control unchanged (49.2 us).
fold_fence_barriers 13800 = 600 x 23; no folds_refused_* moved. Long-call bench, small listed:
539 -> 371 us mean call. Lane tip 8ae906a4fd: clippy plain, m2v_gpu, m2v_cpu_icd 0 (33633); lavapipe
runtime suite 2829 passed at 143a0013f8 and tracker unit tests 85 (33621; 8ae906a4fd deletes only the
dead Summary::has_updates); PHOENIX encoder_fold, render_fold, spares, fences 71 passed (33626).
Iris before/after: m3-max-33627, pending.
Public surface: WorkCounts (for the lanes) gains fold_fence_barriers and folds_refused_*, blessed in
api_signatures.tsv; a struct literal of WorkCounts must name them, Default and readers are unaffected.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
- Rate maps: the GPU routes the encoder's own draws of a fanning pass
- rate-map GPU routes: the rebound recording takes no route; the routed-draw count through the device's counters
- rate_mapped_pieces_encoder: the small triangles' commands drawn as the encoder's own draws
- Rate maps: the GPU routes' docs, the depth test's flagged draw between fanned ones
- rate_mapped_pieces_encoder: the draws the GPU routed, fanned out and drew through the region-copy variant
- CountDraws: the indirect-count draw's recording is record_draw
- rate_mapped_depth_equal: the GPU routes the encoder's draws as the host step's probe decides them
In a rate-mapped pass that fans out (RateMapPolicy FanOut, the default), the encoder's own draws
were routed by the host step only for executions; the GPU now routes them: a counts kernel
(bind/fan_out/route_counts.rs, built through the translator's public API) reads each draw's lead
instance probe and writes indirect counts, so each draw either fans out per region or draws through
the region-copy variant, as the host step's probe decides for the same draws. Its kernel is made at
first use; a cold frame, whose variants are still being made, falls back to the region-copy route
alone. Exact (RateMapPolicy::Exact) routes nothing on the GPU. WorkCounts gains
rate_map_gpu_routed_draws, rate_map_gpu_fanned_draws and rate_map_gpu_copied_draws (for the lanes;
blessed in api_signatures.tsv). FAST-PATHS rate-map row updated. No new Degradation kind.
Verified: msi m3-max-33521 at the lane tip 4ee726aa13: clippy (translator, runtime, validation; all
targets, all features) 0; translator route_counts, fan_out, api_surface, api_signatures, fast_paths
62/62; runtime fan_out, every_command_the_runtime_records_is_routed, work_counts, upload,
owned_kernel 10/10; lavapipe rate_map device tests 24/24. rate_mapped_depth_equal (each pass two
ground halves with a w-crossing triangle between): 0 red pixels in every leg under Exact and FanOut;
the warm FanOut encoder frame routed 6/6 draws on the GPU (2 fanned, 4 region-copy), the same as the
host step decides for them executed. Pending: clippy m2v_gpu/m2v_cpu_icd, rustdoc, the Iris A/B.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
Under DevicePolicy::exact_answers (HeapAnswerPolicy::Metal) a heap's PVRTC or ETC2 texture on RADV
PHOENIX misses Metal's answer (its BC1 carrier image takes 4096 B @ 4096, Metal answers 128 @ 128
or 2048 @ 128), so it lies in memory of its own as a shadow of the heap's bytes (MemoryShadow;
Shadow or Tiled where those serve). heap_texture_at gave a decoded twin only to the Direct,
HostTransfer, Linear and Hidden routes, so its sampled view fell to the carrier, which has no
sampled usage, and every kernel read and sample was refused, Unsupported(Format) (8 of 8 cases in
m3-max-33467), where Metal samples it and the device can decode it.
A heap's PVRTC, ETC2 or EAC texture on a shadow route (not over the caller's host pages, not
detached) now gets its decoded twin. ShadowCopy::record_gated records the shadow's decode
(ShadowCopies::decode) after a copy in that moved texels, and only then (record_moves answers
whether it moved any); the pass is set at making (Image::decode_after_copies_in) and its kernel is
made in ShadowCopies::prepare at first use, so no making compiles. WorkCounts::shadow_twin_decodes
counts the decodes. 4:2:2 heap shadows stay twinless; heaps over the caller's host pages stay the
documented copies-alone gap. Docs: decoded_twin.rs, pvrtc.rs, etc.rs, degradation.rs, docs/API.md,
docs/FAST-PATHS.md (heap shadows of decoded formats are no longer for copies alone). New device test
runtime_lane/heap_carried_reads.rs. Public surface: WorkCounts (for the lanes) gains
shadow_twin_decodes, blessed in api_signatures.tsv.
Verified: PHOENIX m3-max-33568 (carried binary of the lane tip d5bf9cac82): heap_carried_reads,
a_carried_heap_texture_reads_its_bytes_with_no_commit, pvrtc_texels_read_as_metal_s and
etc_texels_read_as_metal_s pass. Under HeapAnswerPolicy::Metal all 8 cases shadowed; a use takes 1
copy and 1 decode, a second encoder in the same command buffer 0 and 0; kernel reads, samples, blit
out and getBytes equal the texture outside a heap, and samples follow a blit and a replaceRegion.
Under HeapAnswerPolicy::Device: not shadowed, 0 copies, 0 decodes, equal. Without the fix
(33467 at the test commit) all 8 reads were refused. lavapipe (msi 33535): the 4 tests pass. Clippy
x3 running in 33569.
The IN-PLACE-LENT line of render_targets_whose_copies_lose_their_padding_lie_in_place
printed runs of spaces where its string's line continuations had collapsed when
it was written (lavapipe job m3-max-33512 shows them). Print only; no
assertion changes.
Verified: compiled under --cfg m2v_gpu by the clippy job that follows.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
On the Iris Xe (ANV), a render target over host pages whose rows end
inside a 64-byte line (nonCoherentAtomSize) failed the in-place check's
renders: the clear and store, and draws, write back the line holding a
row's last texels whole, so a CPU write to the padding in that line can
be lost. Such textures were shadowed (733 in reims's walk: RGB10A2
66x66@512 572, RGBA16F 55, R8 49, A8 49, BGRA8 3). But the shadow keeps
nothing more: its copy back writes the same lines, and on this device a
plain buffer copy, a copy of texels into a buffer's rows and a kernel's
stores all write back that line too (Iris probe, job m3-max-33417:
clear+store 15/15 rounds changed padding bytes, draw 15/15, product
shadow copy back 14/15, buffer copy 15/15, kernel stores 6/6; every
changed byte in the row's tail line, none past it; rows on lines 0).
The check gains an access, Copies: a blit copies a zero texture's texels
into the class's buffer's rows while the CPU writes beside them (every
shape but the 3840x2160 surface; no rounds over the runtime's own
memory). A texture that renders over host pages whose rows' padding is
free (not declared unobserved), whose renders failed for its row ends,
now takes the verdict of renders that let that padding change where the
class's Copies failed for those row ends too (pending while they are),
announced as Degradation::LineWriteBack (line-write-back, Precision).
Copies failures carry across classes as the other GPU writes do. The
check notes each class and access's rounds' time. CHECK_VERSION 19.
Docs: FAST-PATHS host-pages row and a known gap for the Iris line
write-back (nonCoherentAtomSize 64; buffer copies, texel copies, kernel
stores, passes); API.md section 1 and the catalogue entry; the in-place
lane's VERDICTS 98 -> 112 and a lane test with the kind's site.
Verified: msi m3-max-33510 at the lane tip 47b06c9f0d: clippy (runtime + translator, all features,
all targets) 0; runtime tests 29/29 (the decision, a_texture_that_renders_lends_its_free_padding_
where_the_copies_change_it_too, carry, degradation_catalogue, degradation_sites, texture_placement);
translator api_signatures, fast_paths, api_surface 34/34; --cfg m2v_gpu archive of runtime +
validation built (33511). Pending: negative control 33520, lavapipe 33512, the Iris proof.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
RUNTIME 2379's WorkCounts::batch_submit_cpu_nanos and submit_long_call_cpu_nanos read
CLOCK_THREAD_CPUTIME_ID twice on every submission call on every driver. That clock is a system
call on Linux, not a vDSO read: 459 ns a read against the host clock's 19 ns (thread_clock_bench,
Ryzen 7 7840HS, Linux 7.3, fastest of 3 rounds of 1M reads, m3-max-33486), so 0.9 us a call always
on, against a whole NVIDIA submission call of ~12 us. The thread's CPU time is now read only where
the device notes queue times (METAL2VULKAN_QUEUE_TIMES, the existing default-off diagnostic); the
CPU fields read 0 elsewhere and their docs say so with the measured cost. The wall-time fields,
the long-call counts included, stay on. The long-call bench turns queue times on and gains its
unfenced arms (one VkCommandBuffer against 47); thread_clock_bench measures the reads.
Verified: msi m3-max-33490 at the lane tip 57e916e1c6: clippy (all features, runtime + translator)
0, clippy --cfg m2v_gpu 0, lavapipe kernel_end_device + submit_stalls 16/16 (the queue-times device
test checks the CPU time stays unread when not asked and is counted once asked).
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A guest compute loop's vkQueueSubmit calls on the Radeon 780M averaged 601 us, 293 of them 1 ms or
more in 32 s, and nothing told a call that works from one that waits on a driver without the stall
fact. WorkCounts::batch_submit_cpu_nanos sums the thread's CPU time (CLOCK_THREAD_CPUTIME_ID; on
Windows GetThreadTimes, sampled at the clock's ticks) across every call batch_submit_nanos times;
submit_long_calls, submit_long_call_nanos and submit_long_call_cpu_nanos count the calls of 1 ms or
more. Benches (test-only): a guest compute loop's submissions term by term, chained encoders and a
host-set event's wake, growth per VkCommandBuffer with fenced chains, import and free churn apart,
and long calls split by the GPU's work and the listed dma-bufs, with and without a warm-up spin.
Finding (PHOENIX, release, m3-max-33442): the long calls work, they do not wait: thread CPU is
about wall time in every arm (360 listed, 3 in flight: mean 867 us, 861 us CPU). A 500 us spin
before the call cuts it 7-12%, so most of the doubling after a 3 ms GPU step is cold caches.
Verified: msi m3-max-33446 at the lane tip f67314bade: clippy (all features) 0, clippy --cfg
m2v_gpu 0, submit_stall tests 12/12. Windows clippy not run (thread_cpu, the existing
GetThreadTimes path, only made pub(super)).
Public surface: WorkCounts (for the lanes, not part of the API) gains four pub fields, blessed in
api_signatures.tsv; a struct literal of WorkCounts must name them, Default and readers are unaffected.
a_recovery_starts_a_ram_s_plans_and_their_tables_anew copied into a Shared buffer made before
recover_for_test(). Where the device keeps Shared buffers in pooled memory (the RX 7900 XTX on
RADV, whose check finds that a held import taxes submissions), the recovery leaves such a buffer
with the lost generation, as device/carry.rs documents, so the first copy after it was refused
with NotImplemented(MadeBeforeRecovery) (round ef313200e2, XTX runtime leg). The test is about
the RAM use's plans and tables, which the recovery carries; the copies after it now go to a
buffer made after it.
Verified: see the landing check job.
The commit before made the heap's carried texture an ASTC_4x4_LDR one. A
heap refuses that texture where the device lacks ASTC
(NotImplemented(DecodedHeapTexture), job 33372 on lavapipe). A heap's 4:2:2
texture is a shadow of the heap's bytes (AliasRoute::MemoryShadow), so it
takes no twin and stages no decode. The heap's carried kinds that take a
twin in its own memory, and stage its whole decode as they are made
(heap.rs, decode_whole), are ETC2/EAC and PVRTC. So the timed heap makings
are now a PVRTC_RGBA_4BPP texture and an ETC2_RGB8 one. Every device but
PowerVR's carries PVRTC. The test prints the whole decodes those makings
staged (WorkCounts::block_decode_passes), which shows the route was taken.
The no-commit get_bytes test uses a PVRTC texture in a Shared heap. Its
rows are unpitched, as Metal takes PVRTC's.
Verified: nothing yet; the msi job (clippy x3, rustdoc, lavapipe) and the
PHOENIX run (tip x3 plus the control) follow.
A GBGR422 texture in a heap took no staged decode on PHOENIX: the control
(runtime at 18c640a85d) built nothing at that making, so the check could not
fail there without the fix. An ASTC_4x4_LDR texture in a heap is carried
where the device lacks ASTC (PHOENIX, lavapipe), and its making stages its
twin's whole decode (heap.rs, decode_whole), so the timed making and the
no-commit get_bytes test now use one. The 4:2:2 texture of its own stays
among the makings.
Verified: nothing yet; the msi job and the PHOENIX run (tip x3 plus the
control) follow.
On the RTX 2080 (job m3-max-33373, 34 queue tests at 16 threads)
a_device_refused_once_takes_its_least_plan_where_it_takes_fewer_queues
failed: the stand-in refused the plan's 18 VkQueues as the test asks,
and the driver itself then refused the least plan's 3
(ERROR_INITIALIZATION_FAILED), the other test processes' devices
holding its channels, so the test read a refusal of a least plan that
takes fewer.
plan_room's wait is now a generic with_room (device_with_room is built
on it, unchanged in what it does), and the test asks the stand-in's
refusal and the least plan's making again while the driver's own
answer to the least plan is a refusal (two attempts on a GPU whose least
plan takes fewer), with the same pauses and bound and a
PLAN-DEVICE-ROOM line each. The probe's making again, where the least
plan takes no fewer, goes through device_with_room.
Verified: cargo fmt; build, clippy and the tests in the lane's jobs.
The 2080 lane leg 1/2 at c1747ff89 (job m3-max-33322, 1,040 tests,
830 s) waited 35 times for room, 12.0 s of pauses in all, and every
device it waited for was then made with its plan. 16 of those tests
then failed on the loader's errors, which the wait had left in the lane's
message list: kernel_textures x10, layered_passes, made_at_creation x2,
math_routines, mesh_commands and ycbcr_in_place. The loader reports each
refused vkCreateDevice as two errors through the instance's messenger
("terminator_CreateDevice: Failed in ICD ... vkCreateDevice call",
"vkCreateDevice: Failed to create device chain."), and those come from
the making the lane drops and makes again, not from the device the
test keeps.
Messages::failing_kept and Messages::drop_failing_since: the lane marks
the failing list before each making, and where it makes that one again
it drops what was kept since the mark. The kept making's messages, the
layer's included, stay. validated_device_with and made_lane_device both
do it.
Verified: cargo fmt; build, clippy and the 2080 lane leg in the lane's
jobs.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.