Blocks were made ahead (memory/ready.rs) only for a pool that grew lately:
a second or later pooled block added within KEPT_EMPTY_FOR. So a pool's
first growth, and its first after a pause, was always made in place by
the creation call whose keep_room found no room for half a block: in a
guest's scroll on a Radeon 780M, the buffers' pool's first growth block,
made on the guest's thread.
A pool made ahead for now also gets its next block made ahead, grown or
not, once it is near it (Pool::near_next): it holds a pooled block and
its longest free range is below three quarters of a block (ahead_room), a
quarter of a block before the half block keep_room keeps. The pools of
exportable buffers take the same rule (exported_growing lists those near
their next block too). A block made ahead for a pool that stopped growing
goes after KEPT_EMPTY_FOR only once the pool has room for three quarters
of a block again, so a pool that rests near its next block keeps that
block, one at most a pool, counted against the kept empty blocks'
budget, and makes none over and over. That is the resting cost, written
in docs/FAST-PATHS.md's row on kept blocks and in ready.rs. The other
option, a block ready for every pool in use, holds one at rest for every
pool, not only those near their next.
Tests: blocks_ahead's growing-pool test now asserts its first growth is
made ahead too (renamed). reclaim_submit_bench gains a scroll arm:
Private buffers of 7471104 bytes (a scroll's, eight to a block) every 30
ms, 64 a phase.
Verified on um790's Radeon 780M (RADV PHOENIX) and lavapipe (jobs 12337,
12354):
- blocks_ahead, 780M: first growth 1 made ahead, 0 in place (lavapipe
the same). Negative, development's memory.rs and ready.rs: 0 ahead, 1
in place, the test fails.
- Runtime suite: 780M 2011/2011, lavapipe 2014/2014; clippy with
m2v_gpu, m2v_cpu_icd and no cfg clean; rustdoc clean.
- reclaim_submit_bench_scroll, release, three runs each, alternating:
development made 7 blocks ahead and 1 in place in each phase, quiet and
fragmented (compact_stall about 2500 in the pressed phase), every run;
with this change 8 ahead and 0 in place in every phase. The slowest
creation call: development 0.2 to 0.4 ms, this change 0.1 to 0.2 ms.
The in-place makings were fast in this bench's fragmenting; the
consumer's trace had the same making under the kernel's compaction.
(cherry picked from commit 35c4231506652a454e43e703b162384a0a2f71cc)
A spare command pool's give-back no longer frees and trims on the giving thread: the completion
thread posts the command buffers past the pool's recent uses (and an idle spare's) with the pool
to the device's free thread, which frees and trims them inside exit-guard sections and then keeps
the pool among the spares again (62307392d4). reims measured the trim at 0.65 ms median and up to
3 ms on the 780M, on the completion thread before the completed handlers ran.
Verified by the change's owner at its tree before the rebase (um790 job 12334): RADV PHOENIX
runtime suite 2009/2009 and lavapipe 2012/2012 with clippy clean; the device test sees the frees
on the free thread and fails with them on the giving thread; release, 780M, 32 rounds: status
final to first completed handler 1508/1596 us -> 5.9/5.7 us at the median. MoltenVK (job 12333)
not yet run. Here: the API table check, refusals and coverage generators unchanged, pin
recomputed.
tests::spares_bench on the M3 Max (MoltenVK 1.4.2, job 12271, the bench
as landed): 6 rounds of 252 command buffers freed 32 at a time, each
followed by vkTrimCommandPool: the frees 0.9 to 1.0 us at the median (1.8
us at the slowest), the trims 0.9 to 1.0 us (3.5 us at the slowest). The
process's physical footprint (proc_pid_rusage's ri_phys_footprint, which
counts the GPU memory the process owns) rose 176 KiB with the first
round's makings (179872 to 180048 KiB) and stayed at 180048 to 180128 KiB
through every free, trim and later round: on MoltenVK the spares' command
buffers grow no owned memory that a trim would return at this scale.
(cherry picked from commit b1ad9d75d87840612b6cabcbcf5f946db6707e24)
A give-back of a command buffer's pool runs in complete_seen, on the
queue's completion thread, before the command buffer's completed handlers
run and before its waiters are released. Where the give-back freed the
command buffers past the pool's recent uses (or an idle spare's), their
vkFreeCommandBuffers and vkTrimCommandPool ran there: on a Radeon 780M a
median of 1.5 to 1.6 ms (2.2 ms at the slowest) between the status
reading final and the first completed handler, and the same on the
waiter's return, on the guest's frame path.
The giving thread now only takes the command buffers out of the pool
(those past its recent uses, or all an idle spare holds) and posts them,
with the pool, to the device's free thread (free_thread.rs, its existing
bounded queue of 64): the thread frees them FREED_AT_ONCE at a time, the
pool trimmed after each, each inside an exit-guard section, then keeps
the pool among the spares again (the newest, or the oldest for an idle
spare). The pool stays out of the spares meanwhile, so a taker takes
another spare or makes a pool. Where the queue is full, or the thread
cannot start, the frees run on the giving thread inside a section as
before. The device's teardown drains the posted frees before it releases
the spares. With nothing capping a give-back's time any more, a give-back
frees every command buffer past the recent uses, and an idle spare sheds
all it holds, at once: the per-give-back cap of 32 left a burst's pool
holding the rest until it was taken again, which a pool out of the spares
may not be. FreeThread::wait counts its wait as it begins, as before;
drain is the uncounted wait.
Tests: the spares device test now asserts the frees ran on
metal2vulkan-frees alone (Spares::freed_on, test-only), waiting for the
free thread between command buffers, and that the burst's command
buffers go after RECENT_USES + 1 more uses. tests::spares_latency
(ignored, release) times status-final to first completed handler and to
the waiter's return for a give-back that frees a burst's command buffers.
Verified on um790 (job 12334, at this tree):
- Radeon 780M (RADV PHOENIX), --cfg m2v_gpu: clippy clean, runtime suite
2009/2009; SPARES 3 / 65 / 2 held, freed on ["metal2vulkan-frees"].
- lavapipe, --cfg m2v_cpu_icd: clippy clean, 2012/2012, freed on the
free thread.
- clippy with no cfg and rustdoc clean.
- Negative (the frees on the giving thread): the device test fails on both,
freed on ["metal2vulkan-queue-wait-0"].
- spares_latency, release, 32 rounds, two runs each: development
(203673d873 plus the bench) 1508 and 1596 us median (2156 and 2042 us
slowest) to the first completed handler for the freeing give-back, 1536
and 1604 us to the waiter's return; with this change 5.9 and 5.7 us
(48 and 53 us slowest) and 16.8 and 14.7 us (56 and 63 us slowest).
Give-backs that free none: 1.6 to 3.0 us either way.
(cherry picked from commit 62307392d4ba2b99ef69b1861cf848f8a5bc6fda)
A host whose Vulkan driver listing keeps a manifest whose library is gone
(a vendor's manifest left behind by a driver no longer installed is
common) makes the loader report it at vkCreateInstance, through the
messenger chained there, as Errors of id name "Loader Message": the
dynamic linker's error about the library, then "loader_icd_scan: Failed
loading library associated with ICD JSON <lib>. Ignoring this JSON"; a
library that loads and gives no vkCreateInstance adds
"loader_scanned_icd_add: Could not get 'vkCreateInstance' via
'vk_icdGetInstanceProcAddr' for ICD <lib>"; one that is no driver gives
"loader_scanned_icd_add: Attempt to retrieve either
'vkGetInstanceProcAddr' or 'vk_icdGetInstanceProcAddr' from ICD <lib>
failed." The layer claims counted them, so every claim failed on such a
host (the Iris Xe's 9 failures beside a stale nvidia_icd.json) with
nothing of the device's.
IgnoredDrivers (the runtime's tests::layer_claim and the validation
crate's runtime_case::layer_claim, each its own copy as for the duplicate
layer warning) collects the libraries the loader said it ignored, and
passes, of id name "Loader Message" alone: that message, the linker's
error that begins with one of those libraries and ": ", and the missing
vkCreateInstance about one of them; and the no-driver message, which
names the library it ignored itself. Each passed message is printed
(LOADER-DRIVER / LANE-LOADER-DRIVER). The runtime's claims, the
validation crate's Messages::take, creation_heard_checked and
resource_ids' message check use it.
Verified: unit tests of the matcher (each report matched; the same words
of another id name, a linker error or missing vkCreateInstance about a
library the loader did not say it ignored, an empty library, other loader
messages, all refused). On lavapipe under m2v_cpu_icd with
VK_DRIVER_FILES naming lavapipe and a scratch manifest naming a missing
library: at development 9b00cd81d6, 12 runtime tests (teardown_threads)
and 2 validation tests fail on the loader's two messages; with this
change, the runtime's 21 pass with LOADER-DRIVER lines.
(cherry picked from commit 3f2a390dcbbc6dc33bc7ed6bc0680109911cdb83)
733db7a42c changes the runtime's spare command pools: a pool given back keeps, per level, the most
command buffers any of its last 8 uses handed out and frees the rest; the oldest spare idle for
10 s sheds what it holds when a later give-back finds it; each give-back frees at most 32
(vkFreeCommandBuffers, then vkTrimCommandPool, in an exit-guard section on the giving thread).
vkDestroyCommandPool still runs only at teardown (NVIDIA 615.71.09's hang there). reims measured
the old rule's growth on a 780M: every VkCommandBuffer kept for the device's life, 96 KiB of GTT
each, 2668 -> 6970 over 6 guest resets.
Verified by the branch: um790 12300 at the rebased tip, 780M runtime suite 2009/2009 and lavapipe
2012/2012, clippy for both; the device test holds 3, 65, then 2 command buffers (65 after 10 more
with the frees made no-ops, 3 of 11 spares tests failing). Iris Xe and RTX 5080 spares tests pass
(5080 3/3 rounds, no hang). One give-back freeing 32: free 4-103 us, trim 0.4 us-3.0 ms (780M
median 0.65 ms). MoltenVK cost pending. Here: signatures --check, REFUSALS and coverage docs
regenerated, fmt.
A spare command pool kept every command buffer it ever made: each burst of
command buffers at once filled its pools, and they held it for the device's
life. Mesa recycles freed command buffers into their pool and returns their
memory only at vkTrimCommandPool; on RADV each one holds 96 KiB of GTT
(buffer objects of 80 and 16 KiB), which the consumer saw grow without end.
A pool given back now keeps, of each level, as many command buffers as the
most one of its last 8 uses handed out (a secondary at least) and frees the
rest; and the oldest spare no command buffer took for 10 s frees what it
holds as a later give-back finds it, then goes back as the oldest spare. A
give-back frees at most 32: vkFreeCommandBuffers, then vkTrimCommandPool
(release.rs's PoolBuffers), inside an exit-guard section, on the giving
thread. No vkDestroyCommandPool moves off teardown. The device's priming
frees and trims its own command buffers too.
The cost of a give-back freeing 32, tests::spares_bench (ignored, run by
name): Radeon 780M (RADV) 18 to 35 us to free, 0.63 to 0.70 ms median to
trim (3.0 ms slowest), the GTT returned, where 252 at once took 5.2 to
6.3 ms; Iris Xe (ANV) 64 to 103 us and 43 to 47 us; RTX 5080 Laptop
(NVIDIA 615.71.09) 4 to 7 us and 0.4 to 48 us (0.22 ms slowest);
lavapipe a few microseconds.
Verified: tests::spares (CPU tests of the recent-uses and idle rules and a
device test that 64 command buffers at once fall back to 2 after 8 + 2 more
uses) pass on the 780M, lavapipe, Iris Xe and the 5080 (3 rounds); with
development's spares.rs, three of them fail (the device test holds 65+).
The 780M and lavapipe suites passed apart from the device test's first
form (2003/2004, 2006/2007), since fixed to give back past the 32 cap.
(cherry picked from commit 733db7a42c8a0088069a0016ae7d8cf1b0479f4b)
Its product fingerprint follows development's versions at d2640d5e7e. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit 9c0dea86f1edc7b09c1327dc124a2dc368421694)
0bec0583b0..076cc7b44e change the runtime's memory: where a plain block's making takes longer than
8 ms, the device's later pooled plain blocks become the largest power of two its measured rate
makes within 8 ms, never below 16 MiB (a placement past that size takes a pooled block of its own
power of two up to 32 MiB, a dedicated one past it); exportable and page blocks stay 64 MiB. On a
Radeon 780M a block's making holds the process's VM reservation, so every submission waited for
it (reims rafgap cause 1: 100-300 ms guest frame stalls on fragmented memory).
Verified by the branch (780M RADV PHOENIX, cold, kernel page pool drained): quiet turnarounds of
8 ms or more 13 -> 0; fragmented, none of 17 ms or more (slowest 14.3 vs 40.0 ms); slowest
creation call 0.6-3.4 vs 22.9-24.9 ms; a 4K render target's own block ~11 ms inline when
fragmented, its slowest creation call 16 vs 26 ms. Runtime lib 780M 2004/2004, lavapipe 2007/2007,
negatives fail. M3 cost --check rc 0 at the tip and with blocks forced to 16 MiB (12237);
device_memory_allocated is reported (BLOCK_SIZE), pooled_memory_blocks_made stays gated. ANV and
NVIDIA per-block costs unaudited (FAST-PATHS). Here: signatures --check, REFUSALS and coverage docs
regenerated, fmt.
Clippy over the runtime crate with no device cfg (as CI runs it) found
Memory::pooled_block_sizes unused: only the device test of plain_blocks.rs
reads it. It is now compiled under the device cfgs, as the module's other
device-test readers are.
(cherry picked from commit 076cc7b44ebb37ca7197a37fb4e9164ea003ea8b)
docs/FAST-PATHS.md gains the known-gaps row for the measured-rate size of plain blocks: what a
making holds on RADV, the rule, the 780M's numbers against the base (turnarounds, creation calls,
vkQueueSubmit per call, block counts), what a single slow making costs for the device's life, the
drivers left unaudited, and the M3 Max's makings over the conformance cost measurement.
The conformance cost gate reports device_memory_allocated (a new race-rule reason, BLOCK_SIZE)
rather than gating it, because the bytes a case allocates now follow how long the device's
earlier makings took. Measured on the M3 Max, `conformance cost --check` over eight runs of the
whole set (1233 cases): at this tip rc 0, no 64 MiB making past 1.61 ms, the rule never fired;
with the size held at its 16 MiB floor, rc 1 on one case's device_memory_allocated
(201326592 in the record, 50331648 measured), with no gated bound or ceiling of
pooled_memory_blocks_made moving and no case over a bound, so that count stays gated. The
fold test that used device_memory_allocated as a count with no MONOTONE row now uses
owned_kernel_spirv_bytes.
(cherry picked from commit a4246707ec6da2b49342feca48bf9a931e152675)
On RADV a block of plain memory (allocated with no export: the blocks of images, of heaps, of
buffers that declare their padding unobserved) shares the reservation of the process's buffer
objects, and its vkAllocateMemory holds every submission of the process while the kernel fills
its pages. On a Radeon 780M with the kernel's page pools empty, a 64 MiB block took 8.9 to 9.6 ms
at the median on a quiet host and up to 23.1 ms (slowest 30.4 ms) with its free memory in single
pages, and a texture made every frame left 13 to 33 turnarounds of 8 ms or more a phase (the
slowest 42.3 ms).
Now a making of such a block that took longer than MAKING_BOUND (8 ms, half a frame at 60 Hz)
makes the device's later pooled blocks of plain memory the largest power of two that making's
rate makes within the bound, at least 16 MiB (Memory::plain_block_made); a placement larger than
such a block takes a pooled block of the power of two that holds it (up to half of BLOCK_BYTES,
past which it is dedicated as before). The size is never made larger again. Exportable blocks
keep 64 MiB: each is a buffer object of its own reservation, whose making holds nothing.
Each made Block records how long its making took (Block::took, zero for imports); add_block
feeds the plain ones to plain_block_made. place, keep_room, ready_if_growing, ready_ahead and
sweep_stale size a pool's blocks through pooled_bytes, and add_ready takes the size of the block
it adds.
tests::plain_blocks: the size rule and the pooled block sizes on the bookkeeping alone, and on a
device told of a slow making, 1 MiB textures in 16 MiB blocks and 20 MiB ones in 32 MiB blocks.
tests::reclaim_submit_bench: an images arm (a 1024x1024 texture a frame) and a mixed one (with
2560x1440 and 3840x2160 textures), the blocks of images made, pooled and dedicated, and the plain
block size reached.
(cherry picked from commit 0bec0583b042c1f2c05b98e97d080e6426d13619)
The test of a creation call that cuts a making's wait for quiet short kept the device's queues
in use with three threads that each committed a one-word fill and waited for it. A making's wait
reads the holds of the device's queue locks (device/queue_quiet.rs), not the GPU's work, so a
pause of 1 ms between two of those threads' submissions ends it; on a loaded host the threads
leave such pauses, each making's wait ended before a call needed its block, and the test gave
up after three makings it waited for with none hurried. Pin 30's 5080 runtime half 1 (run
beside half 2) failed so: 0 hurried, 3 made ahead, 28.35 ms at the longest.
Now the test holds one use open (QueueQuiet::began, ended as its guard drops) from before its
first creation, so nothing but the bound (QUIET_MOST) ends a making's wait, and settles the
device's submission checks first, as the first test does, so that no creation call in it makes
the first block of a pool of the runtime's own pages. It stops at the first making a call
hurried, or after three whose wait reached its bound, which only a host slower than 50 ms over
the few creation calls between a making's start and its block's need reaches; it prints those
and the makings waited for.
The exportable pools made ahead (9e663b770c) are not a factor: the test makes no exportable
buffer, so no pool of them grows and that commit's makings never start, and the old test at its
parent failed the same way under load (below).
Verified (debug, --cfg m2v_gpu; load = a busy loop on each of 16 logical CPUs, or four runners
of the whole runtime suite, each test alone):
- Radeon 780M (RADV PHOENIX, Mesa 26.2.6, gem10, MESA_VK_DEVICE_SELECT '1002:15bf!'; job
m3-max-12248): this test 3 of 3 alone, 10 of 10 under the busy loops, 8 of 8 beside the suite,
each run 1 making hurried, 0 past its wait, creation calls 2.4 ms at the longest. The old test
at 9e663b770c's parent failed 1 of 10 under the busy loops (0 hurried, 3 made ahead), and at
development passed 10 of 10 and 8 of 8. Negative control, ready.rs's wait for quiet ended by
STOP alone rather than by a call's wait: 0 of 3 (0 hurried, 3 past their wait, 49.6 to
59.3 ms).
- lavapipe (llvmpipe, LLVM 23.1.4) under --cfg m2v_cpu_icd (job m3-max-12250): 2 of 2 alone,
10 of 10 under the busy loops; the negative 0 of 2.
Correction at landing: the creation calls took 2.4 ms at the longest in every run but one, an
otherwise idle host's, at 8.0 ms. RTX 5080 (b5080 nvreds-ahead-5080-120327): the new test 3/3
alone, 20/20 beside a suite, 10/10 under busy loops; the old test failed 10 of 20 beside a
suite there (0 hurried, 3 made ahead).
(cherry picked from commit 3691633773)
77f336e98c changes the runtime's guest RAM: run-list imports consult the device's remembered
dma-buf refusal (and remember the driver's own refusal of a list), and a use whose plan would be
listed first asks the driver with one page of the RAM (Device::ram_takes_dma_bufs), listing only
where the driver took it, so a taxed NVIDIA keeps 64 MiB chunks by pointer. The host_ram_dma_buf
tests force the tax held and read the plan the device chose. Pin 30's 5080 red
copies_over_a_listed_ram_make_no_untouched_page_of_it_resident was this.
Verified by the branch: RTX 5080 (b5080 exitcrash-follow-112525) dma-buf module 10/10 twice, the
driver refusing the use's question for real; the old tests with the tax forced held fail 3 of 4
there; gem10 lavapipe 12205 (suite 2007/2007, clippy x3, rustdoc), 12213 fast_paths/docs 27/27;
780M 12209 module 10/10 twice (listed, run lists used). Negative controls for each part fail.
Here: signatures --check, REFUSALS and coverage docs regenerated, fmt.
Three follow-ups to remembering a driver's refusal of a guest RAM's dma-buf
(3fe18c4efd):
1. Run-list imports consult the remembered refusal. ram_runs_as_dma_buf now
returns not-importable, the source of run lists unasked, once the device
remembers a refusal, and remembers the driver's own refusal of a list's
dma-buf the same way a span's is (the source's failures stay the list's
alone). Before, every copy over a chunk not imported asked the source of
run lists again and paid a udmabuf and a failed import.
2. A RAM's plan asks the driver before it lists the RAM. Plan::listed means
the RAM's chunks are its dma-bufs; it was chosen from the import tax alone,
so on a taxed driver that refuses udmabufs (NVIDIA 615.71.09) the RAM got
512 MiB chunks imported by pointer, none ahead. ram_plan now, where the plan
would be listed, asks the driver with the RAM's first host page
(Device::ram_takes_dma_bufs: ram_span_as_dma_buf over one page, released at
once, the precedent being shared_refused's one-page question), and lists the
RAM only where the driver took it. A refusal there is counted and
remembered, so the RAM and every RAM after it keep 64 MiB chunks imported
ahead by pointer. Re-choosing a live RAM's plan was rejected: its chunk
geometry and its thread are fixed when the use begins. discard_import takes
the raw VkBuffer so the question's import can be released.
3. The listed tests (where_each_listed_import_costs..., where_the_ram_fits...,
the two tile tests through copies_by_lists) no longer expect dma-buf imports
wherever the measured tax holds. They force the tax held, so the listed path
runs on every device in every run, and read the plan the device chose
(Device::host_ram_chunks), asserting it is listed exactly where the device
imports dma-bufs and the driver took the use's page. The resident test now
allows the use its one page.
Tests:
- a_driver_s_refused_dma_buf_sends_copies_past_the_source_of_run_lists (new):
stand-in refusal set after a listed use; the first copy asks the source of
run lists once and the source of dma-bufs not at all, the second asks
neither (fails without the consult or without remembering a list's refusal).
- a_driver_s_refusal_as_the_use_begins_keeps_the_ram_s_chunks_short (new):
stand-in refusal before the use; the RAM is not listed, the source asked for
the first page only, the refusal counted once (fails without 2).
- a_driver_s_refused_dma_buf_sends_the_device_s_later_chunks_to_their_pointer:
the stand-in now refuses after the use; a RAM used after the refusal is not
listed and its source is unasked.
- The route test reads the use's question and the plan.
Docs: host_ram module, use_host_ram, WorkCounts, HOWTO and the FAST-PATHS
NVIDIA dma-buf row describe the question and the remembered refusal.
Verification: in the follow-up message (gem10 lavapipe suite and negative
controls; 5080 release).
(cherry picked from commit 77f336e98c2a31aa56e45c5eb7659fa28f6f3ad6)
58e674d802 changes the runtime's kernelEndTime: the host time read right before the last batch's
vkQueueSubmit is called, not after it returned. Pin 30's lavapipe replay (6efa9fe7b9, beside the
suites' load) read gpu-ends-no-earlier-than-the-kernel false once: a scheduler thread parked after
the call let the GPU finish before the stamp. Exact 10/10 alone (gem10 12182).
Verified by the branch: kernel_end_device's paused-scheduler test 12/12 on lavapipe (gem10 12184:
suite 2003/2003, clippy x3, rustdoc), its negative control failing (GPU end 199.6 ms before the
kernel end); M3 MoltenVK 3/3 and the gpu_time, unsubmitted, completion and command_buffer tests
82/82 (12187). Not run on NVIDIA. Here: signatures --check, REFUSALS and coverage docs regenerated,
fmt.
Pin 30's lavapipe replay (6efa9fe7b9, on msi beside the suites and lint) answered
command-buffer-facts' gpu-ends-no-earlier-than-the-kernel false where Metal answers true: a command
buffer's GPU end before its kernel end. The scheduler took the kernel end after Group::submit
returned (submit.rs, and group.rs for the held batches), so a driver that runs the work before the
call returns, or a scheduler thread held once it returned while the GPU ran the work, put the
kernel end past the GPU's (calibrated) end. tests/completion.rs already records an RTX 3090 whose
submission returned 57 to 64 ms after its work ran.
The time is now taken inside the submission's closure, just before raw.queue_submit, and returned
by Group::submit and submit_alone; the direct path and the group's held batches stamp their kernel
end with it, only on success. Nothing reaches the GPU before the call, so its end is never earlier.
The held-in-a-group, unsubmitted and hang paths already stamp before any submission. The start,
the GPU times' placement and the other ordering facts are unchanged; the docs of kernel_end_time,
KernelTimes and gpu_time.rs's kernel times say what the end is now.
Test: kernel_end_device::the_gpu_end_is_never_before_the_kernel_end_when_the_scheduler_pauses_after_the_call
pauses the scheduler 200 ms each time a submission returned (completion::trace::pause_after_submit,
a test stand-in under the device tests' cfg, called in submit.rs after the call) while a 1 MiB fill
runs, and asserts GPU end >= kernel end and GPU start >= kernel start over four command buffers.
(cherry picked from commit 58e674d802a70a7e5573edd900fcb96e2d9ed7ca)
a6ccb78810..abddf2d2f1 change the runtime: a guest RAM span's dma-buf that fails on a device that
imports dma-bufs is counted (WorkCounts::host_ram_dma_buf_imports_failed); a driver's refusal of
one is remembered for the device's life, so its later chunks take their pointer without asking the
source (NVIDIA refuses every udmabuf import and lets go of one descriptor each time); and an import
tax Holds short of TAX_MARGIN answers Fails for the device's life, unrecorded, as split tries
short of it do since 4acfbee03b. Pin 29's 5080 runtime half failed the route test when that
process measured the tax held (the driver refused, the pointer took it, nothing counted it).
Verified by the branch: gem10 lavapipe 12177 (suite 2004/2004, the translator's surface and
fast_paths tests, clippy x3, rustdoc; the new test fails with the remembering removed, the source
asked twice); RTX 5080 release (b5080 exitcrash-taxroute2-104522): the route test with NVIDIA's
refusal 15/15 (3 quiet, 12 loaded beside 35 host-RAM tests a loop), every loaded device measuring
the tax not held; before the fix the forced route failed 2/2 (ERROR_OUT_OF_DEVICE_MEMORY). Here:
signatures --check, REFUSALS and coverage docs regenerated, fmt.
Open: run-list imports and a RAM's Plan::listed do not consult the remembered refusal; three other
host_ram_dma_buf tests still expect dma-buf imports wherever the measured tax holds.
Counting the refusal left its cost: on a device whose import tax holds and whose driver refuses
every udmabuf (NVIDIA 615.71.09, FAST-PATHS), every guest-RAM chunk asked the source for a dma-buf,
failed vkAllocateMemory, let go of one descriptor (the driver closes the clone it was handed) and
only then took its pointer.
ram_span_as_dma_buf now tells the source's failures (an error, or an answer of other lengths:
that span's alone, counted) from the driver's (anything once the source answered one dma-buf of
the span: its memory types, the buffer, the import, the bind). A driver's refusal is counted once
and remembered in the device's RamSource; every later span is refused at once, unasked and
uncounted, and takes its pointer. The decision reads the device's own answer, never its identity.
A transient failure of the driver's (memory that ran out) is remembered the same way, recorded in
FAST-PATHS' NVIDIA row.
Tests: a_driver_s_refused_dma_buf_sends_the_device_s_later_chunks_to_their_pointer forces the tax
held and refuses every dma-buf import through a test stand-in for the driver (Memory::import_refusal,
cfg(test), answered where the driver's import would run), on every device that imports dma-bufs:
two chunks, the source asked once, the failed count 1, the second chunk by its pointer. The route
test, where the driver itself refused (NVIDIA's), makes a buffer over the RAM's second chunk and
asserts the same with the real driver. Without the remembering both ask the source a second time.
(cherry picked from commit abddf2d2f1ed16a5ee6407cae04f7e10dfffb736)
The report showed only the Fails it answered, beside floors that may pass the bound; the flag says
the margin's rule ran (the evidence for the change before this one's path).
(cherry picked from commit deccce5b26744b591df0dc9988d4827adef30b16)
The report printed after the force named the forced Holds beside the measured floors (lavapipe
12153: "measured not held: ... import tax Holds (0.7 ... against 0.7 us)").
(cherry picked from commit 72e91bb5df25293f1a5257ebe29ea427d01bd35c)
The verdict the device measured, with its floors, is the evidence of which route its process
would have taken; the forced route no longer shows it.
(cherry picked from commit a7afbb370f689fd3d75e664099083905a3a2fd6f)
A loaded process concluded a tax its quiet ones never see. On the RTX 5080 Laptop GPU (615.71.09),
the route test run 3 times quiet and 5 times beside a loop of the host-RAM and host-residency
device tests (b5080 t entry exitcrash-dmabuf-100324, probe 3f3ca70d32): every quiet device answered
Fails, 2.1 to 2.2 us a submission with the 32 imports held and without alike; the first loaded one
answered Holds from 3.4 against 1.9 us, both halves agreeing, past the 1 us bound but short of
TAX_MARGIN (2 us), and so took the routes of a taxed device (its guest RAM dma-buf first) for its
life. lavapipe's loaded Holds (1.4 against 0.2 us, in the module docs) was the same shape. The
margin already kept such answers out of the records; now a Holds short of it answers Fails, as the
taxsplit change made tries that all split short of it answer, and the next device measures again.
A Holds past the margin stands, recorded only where its repeats pass it again, as before. The taxes
the probe measured (RADV, ANV with 32 imports held) pass the bound six times over and more.
The unit test an_import_tax_holds_short_of_its_margin_answers_fails_unrecorded takes the 5080's and
lavapipe's loaded floors; without this change both answer Holds. The lavapipe case leaves
an_import_tax_holds_is_recorded_only_past_its_margin_and_repeated, which asserted the old answer.
Module docs, TAX_MARGIN's and tax_tried's docs updated; no record changes (CHECK_VERSION stays).
(cherry picked from commit 4c2760204e17687d07fdf7a3cd40b5653f4565d2)
On the RTX 5080 (NVIDIA 615.71.09) pin 29's runtime half failed
host_ram_dma_buf::a_ram_with_a_source_takes_the_route_its_device_s_checks_choose: that process's
import tax answered Holds, the chunk went dma-buf first, the source was asked, and no dma-buf was
imported. A probe printed the refusal: vkGetMemoryFdPropertiesKHR gives the udmabuf types 0x9,
the buffer takes 0x1f, and vkAllocateMemory answers ERROR_OUT_OF_DEVICE_MEMORY (the refusal
FAST-PATHS already records for NVIDIA). import_chunk dropped that error and took the pointer, as
it should, but nothing counted it, and the test held every taxed device to a dma-buf import.
- WorkCounts::host_ram_dma_buf_imports_failed counts a guest RAM span's dma-buf that failed on a
device that imports dma-bufs (the source failed or answered other lengths, or the driver
refused it); ram_span_as_dma_buf counts it past its device check.
- The route test (now where_the_import_tax_holds_a_chunk_takes_its_dma_buf_first) forces the tax
held, as the pointer-first test forces it not held, so the taxed route runs on every device in
every run, not only in a process whose check measured a tax. It asserts the source asked once
for the chunk, and the dma-buf imported or refused and counted, the pointer then taking it; it
prints the verdict the device measured beside it.
- HOWTO, FAST-PATHS' NVIDIA dma-buf row, host_ram's docs and the API signature table name the
count.
Verified: the probe at 3f3ca70d32 on the 5080 (b5080 t entry exitcrash-dmabuf-100324): with the tax
forced held, 2 of 2 runs failed the old assertion with the refusal above; quiet runs measured the
tax not held (3 of 3). This commit's own runs are in the next evidence.
(cherry picked from commit a6ccb78810867a4d567892feee4b3b56ba1af834)
Its product fingerprint follows development's versions at 6efa9fe7b9. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit e7d054f4c02a6de837056aad659cb800e8b0a7c9)
1c (eac07b1f9a..e64d7a7e7a, 14 commits) puts the program's host-visible buffers in blocks of the
runtime's own pages where the device's checks give them what plain blocks do (the import tax
answered Fails and the fresh pages' texture verdicts hold), and a recovery carries those blocks to
the new VkDevice, so pooled Shared and Managed buffers are no longer refused as MadeBeforeRecovery
there. While a verdict is pending, and under exact_answers' Shadow policy, plain blocks serve.
API table: two WorkCounts fields added, page_buffer_blocks_made and page_buffer_blocks_plain
(additions only; nothing a consumer used moved).
Verified by the branch at 951f9244cc (the same product code on 47e072ccd3): M3 percall gate with
holds green at base and 1c, allocs/call identical, both-orders A/B with no row past 15% in both
orders (m3-max-12032); RTX 5080 percall gate green in all four runs, allocs/call identical but one
first-run row, padding_unobserved / hand_out_waits / device_recovery_carry pass; one more pooled
block at rest (the page block beside the plain one, lavapipe 12062). Open: on the 5080
use_resource_read_write and use_resources_read_1 read x1.25 and x1.32 in both orders, unexplained;
an M3 runtime-suite window test failed once in 10 runs at 1c (hunt running). Here: signatures
blessed, REFUSALS and coverage docs regenerated, fmt.
On the M3 the test's undeclared Shared buffers lay in plain blocks at every pitch (m3-max-12032)
while the recovery test's pooled buffer lay in a block of the runtime's own pages. The line each
pitch prints now names the block the undeclared buffer lies in, and a line before them says
whether the device's submission check found a held import costs nothing and whether it takes
those blocks. Diagnostics only.
(cherry picked from commit e64d7a7e7aa8189f3b878299afb2268d12f66920)
Under HostPageTexturePolicy::Shadow (DevicePolicy::exact_answers) no in-place check runs, so its
verdicts stay pending and in_place.rs's blocks_take never takes the blocks of the runtime's own
pages: a Shared buffer lies in the device's own memory and its texture is the device's linear
image, as before such blocks, whatever the submission checks found. The test now holds that on
its exact-policy device: the buffer in no page block, the placement NotHostPages as made, and no
page block made.
Verification: lavapipe (which takes such blocks under the default policy) in the job that
follows.
(cherry picked from commit 73a667fc42878e629ac3c6641882738cb236a302)
The variant's docs listed the events, the Private buffers and the buffers in fresh pages as all a
recovery carries, and every no-copy buffer and pooled Shared or Managed buffer among what it does
not. A recovery also carries the uses of guest RAM and the no-copy buffers (made again over the
same pages; a detached one stays refused), and, where the device takes them, the pooled buffers in
blocks of the runtime's own pages. The docs now say so, as the runtime README's recovery section
does. docs/REFUSALS.md regenerated: its row reads the variant's first sentence, unchanged.
(cherry picked from commit 5db8726121b2ff46f89b793adb3a5f354d505758)
A recovery now carries a pooled Shared or Managed buffer that lies in a block of the runtime's own
pages, so the reach note names the pooled buffers left refused as those in memory the device
allocated. docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py); no refusal
changed.
(cherry picked from commit b11909130479dbdb8c42c8d6c3950ffa1d9414ed)
On the M3 (MoltenVK) the first pitch's undeclared Shared buffer lay in a plain block, made before
the device's submission checks answered, and the next pitch's in a block of the runtime's own
pages, whose texture's placement the test held to InPlace, Unchecked or CheckFailed. A texture
over such pages takes the host route, where the making's own steps may refuse the image at the
pitch (TextureShadowReason::Refused); over a plain block an undeclared buffer's texture is the
BytesBetweenRows shadow, so a shadow either way.
The test now settles the submission checks before it makes the buffers, so every pitch's
undeclared buffer lies where the device's buffers lie once they answered, accepts the making's
refusal there, and prints each pitch's undeclared answer, not a constant.
Verification: the M3's runtime suite follows on this commit.
(cherry picked from commit e1713ded5148bda7d727d37a8cbb08eb4b8d0bb8)
The comment the rebase onto the in-place keep_room wrote ran a character past the 100 the tree
wraps at. Comment only.
(cherry picked from commit 1419bdca90bbc498737193596f5e509e4c4c3eca)
The 1c change put the cases of pooled buffers in device memory between semicolons, which ran into
the list of the other refused objects. The cases go in parentheses, the list reads as before, and
the paragraph above is rewrapped. Docs only.
(cherry picked from commit 05c67001faf3253b6b184dae243bd50d94ca9fad)
The carry of a pooled `Shared` buffer in a block of the runtime's own pages imports the block's
pages again once and places each buffer of the block at its own offset there. The test carried
one such buffer; it now carries two of one block and checks both keep their `contents` pointers
and bytes, the host's writes after the recovery reach the GPU, both lie in one memory on the next
generation, and both keep their offsets. Where the device takes no such blocks, both stay refused
and the notice counts two. The module docs said every pooled `Shared` buffer stays refused; they
now name the ones carried.
Verification: lavapipe runtime suite and the GPU runs follow on the merged tip.
(cherry picked from commit 47f69293ada8be3f314e1fd404fc28a29d9de47d)
A texture over a buffer in a block of the runtime's own pages takes the route
over fresh pages: its image is made for host allocations and starts UNDEFINED,
so it lies in place only where the in-place check's verdicts of fresh pages
pass, where over a plain block's buffer the device's linear image starts
PREINITIALIZED and needs none. So the program's buffers now lie in such blocks
only where those verdicts give every access and row ends a texture over a plain
block's buffer takes in place (by the pooled class's verdicts) the same, as
the blocks allocated exportable already do: fd_blocks_take is now blocks_take
of a pages class (FdBlocks or Fresh), its enum BlocksTake, and
Device::page_blocks_taken asks it for Fresh, starting no check. Pending
verdicts leave the buffers in plain blocks.
The memory lock is no longer held while the verdicts are read as a buffer is
made.
Docs: memory.rs's module docs, device/carry.rs, the runtime README, docs/API.md
and the recovery notice's cost name the condition.
Verification: the suite follows.
(cherry picked from commit 8c50d54d9871bce0e80865ac4916e7da0c192a8a)
The test's branch for an undeclared buffer in a block of the runtime's own
pages ended its pitch's round, so no declared buffer took an aliasing image and
the test failed at its last assertion (job 11947). It now asserts that branch
and goes on, as the other does.
Verification: the suite follows.
(cherry picked from commit fcd5dc709d45961631cd0f7bdbfd09db14e46e62)
On lavapipe the page blocks are taken (job 11936: seven tests failed, each on
a premise they change):
- blocks_ahead: the pools of page blocks join the kept pools once the
submission check answers, their first block made in place then; the test
settles that check before its first creation.
- device_recovery: a Shared buffer a call made on the generation lost under it
is carried by its maker where it lies in a page block; refused as before
elsewhere.
- device_recovery_carry: the pooled Shared buffer is carried (contents pointer
and bytes kept, a host write after read by the GPU) where it lies in a page
block; a texture, which no recovery carries, holds the lost VkDevice instead.
The notice's counts follow.
- exported_textures, padding_unobserved, texture_placement_device: a Shared
buffer in a page block binds images for host allocations and takes the route
over fresh pages (in place where the check passed, else a shadow it decided).
- degradation_catalogue: DeviceRecovered's cost names the buffers in the
runtime's own pages, as docs/API.md does.
TexturePlacement's docs name the pages the runtime imports among host pages.
Verification: the suite follows.
(cherry picked from commit b7279d58a05a396815f3d34293ff1c6fc4b30253)
The commit before this one says so, but its edit did not apply: kept() still
asked address_types for Holds::PageBuffers while a Sharing borrowed the
families, which the borrow checker refuses (job 11930). The query now runs
before that borrow.
Verification: the build follows.
(cherry picked from commit 823871a55b52d3ed55101931220f129709178bff)
kept() asked address_types for Holds::PageBuffers while a Sharing borrowed
the families, which the borrow checker refused (job 11930). The query now runs
before that borrow.
Docs: memory.rs's module docs get "Buffers in the runtime's own pages";
device/carry.rs, Buffer::carry, the runtime README and docs/API.md's recovery
cost say a recovery carries the Shared and Managed (unified memory) buffers in
blocks of the runtime's own pages, and leaves those in memory the device
allocated.
Verification: the build follows.
(cherry picked from commit e5df53c305b27909f4cca460a4910c12861d20aa)
On a device whose submission check found that a held host-pointer import costs
its submissions nothing, the Shared, write-combined and Managed (unified
memory) buffers placed_new_buffer makes now lie in blocks of a new kind,
Holds::PageBuffers: anonymous pages the runtime maps (OwnPages) and imports by
their pointer, the block's host address theirs. Each such buffer is made for
host allocations (VUID-vkBindBufferMemory-memory-02985), and so is a block's
buffer of addresses. The memory types are those the driver imports such pages
as (vkGetMemoryHostPointerPropertiesEXT, asked once as the device is made) that
are host-visible; a class takes the blocks where its best type for such a
buffer is among them. Where the system or the driver refuses the pages, the
block is made as any block of buffers. Until the check answers, and where it
found a tax, the buffers lie where they did.
A recovery now carries such a buffer instead of leaving it on the lost
generation (Left::Pooled): the pages of its block are imported again on the
next generation, once for every buffer carried from that block, into a block
that takes no other placement and goes once those buffers do; the buffer is
bound at its offset there, its contents pointer and bytes as they were.
A texture over such a buffer takes the route a texture over fresh pages takes
(PagesClass::Fresh): its image is bound in imported memory, so it is made for
host allocations and starts UNDEFINED (VUID-VkImageCreateInfo-pNext-01443).
WorkCounts::page_buffer_blocks_made and page_buffer_blocks_plain count the
blocks.
Verification: none yet; build and tests follow.
(cherry picked from commit eac07b1f9a7b405ce2d486e5d8c080e79bfe267b)
4acfbee03b changes the runtime's submission checks: where every import-tax try splits and the last
try's floors fall short of the tax's bound TAX_MARGIN times over, the device answers Fails for its
life (unrecorded) instead of Unchecked. On the M3 Max one device in six answered Unchecked under
its neighbours' load (m3-max-12078) and so took no fresh pages or page blocks where the others did.
Verified by the branch: tests::submit_check 9/9 with the new test; the new test fails (Unchecked)
with the change taken out (um790, 12092 / 12104); clippy and rustdoc. Here: signatures --check,
REFUSALS, coverage docs regenerated (no change), fmt.
In three runs of the runtime's device tests on the M3 Max (m3-max-12078, MoltenVK 1.4.2), one of
the six devices that printed their submission checks' verdicts had all three of its import tax
tries split, under the load of the tests beside it, its last try's floors 2.5 against 1.2 us over
all its phases; the other five answered Fails (1.1 to 2.6 against 1.2 to 3.0 us). That device
answered Unchecked, so its long buffers took no fresh pages where the others' did: the same host
and driver took one form or the other by the load around one process's check.
Tries that all split now answer Fails for the device's life, unrecorded (the next device measures
again), where the last try's floors over all its phases fall short of the import tax's bound
TAX_MARGIN times over: the margin a Holds must pass to be recorded, and a cost no try told from the
load beside it. Past the margin they stay Unchecked, unrecorded, as before; a merge's split tries
are unchanged, and no record changes, so CHECK_VERSION stays.
Verification: tests::submit_check, its new test of both sides of the margin and of the merge's
tries, in the job that follows.
(cherry picked from commit 4acfbee03bf4a01d902e1e362d60e6577174dcfb)
5a862c6ab9 changes the runtime's memory: a pool of exportable buffers (Exports, DmaBufs) that grew
gets its next block made ahead on the ready thread, and a creation call that places such a buffer
takes it instead of making a 64 MiB block on the program's thread. A reported guest stall on a
Radeon 780M with fragmented memory (inline makings 31-97 ms) was that path.
Verified by the branch (RADV PHOENIX, gem10): release bench, slowest creation call 12.0-15.0 ms
at the base vs 0.3 ms at most at the tip under fragmentation; blocks_ahead's new test 6 of 6
made ahead, 0 of 6 with development's memory.rs (780M 12111, lavapipe 12112); runtime lib under
m2v_gpu 1997/1997 (12109). Here: signatures --check, REFUSALS, coverage docs regenerated (no
change), fmt.
A creation call that places an exportable buffer (new_exportable_buffer, an exportable buffer
descriptor, the in-place check's buffers) in a pool with no room made the pool's 64 MiB block
itself, on the program's thread. keep_room made blocks ahead (memory/ready.rs) only for the
pools the runtime's encodings and commits place in and for the host copies' pool, so every
growth block of Holds::Exports and Holds::DmaBufs was made in place.
Now each pool of exportable buffers that grew within KEPT_EMPTY_FOR and lacks room for a whole
block gets a block started ahead at each creation call's keep_room (Memory::exported_growing,
ready_if_growing, the kept pools' tail of keep_room moved into it), made right after a burst of
the device's submissions ended, as the kept pools' blocks are. makes_ahead covers those pools,
so the placement that finds no room takes the block made ahead or waits for its making
(place, take_ready) and counts a block it makes itself in buffer_blocks_made_in_place.
keep_room makes no block for such a pool in place: its placements are the creation calls.
The reclaim bench gains an arm of exportable buffers made by the runtime (24 of 32 MiB a phase,
one every 400 ms) and prints blocks_ahead_waited_for. The citation of a consumer's wait is
replaced by these measurements; FAST-PATHS's row on kept blocks says blocks are made ahead for
pools that grew, the exportable ones among them.
Verified, on a Radeon 780M (RADV PHOENIX, Mesa 26.2.6, gem10, MESA_VK_DEVICE_SELECT
'1002:15bf!'):
- reclaim_submit_bench_exportable in release under --cfg m2v_gpu, exclusive, two rounds each,
the negative being memory.rs and memory/ready.rs as on development (job m3-max-12103): the
creation calls that made blocks in place took 10.0 to 10.8 ms (quiet, round 1), 12.9 to
15.0 ms (fragmented: free memory in single pages, round 1) and 12.0 to 13.7 ms (fragmented,
round 2; 0.3 ms at most in round 2's quiet phase). With the change no creation call took over
0.3 ms in any phase: 10 blocks made ahead and 2 in place (the pool's first two) in each quiet
phase, 12 ahead and 0 in place in each fragmented one, 0 waited for. Turnarounds of 8 ms or
more: 0 in every phase both ways (an exportable block holds no submission).
- blocks_ahead's new test a_growing_pool_of_exportable_buffers_gets_its_new_blocks_made_ahead:
6 of the pool's last 6 blocks made ahead, 0 in place; with memory.rs as on development it
fails, 0 of 6 made ahead (job m3-max-12111).
- The whole runtime lib under --cfg m2v_gpu (debug): 1997 of 1997 passed (job m3-max-12109);
clippy on the runtime crate, all targets and features, clean.
And on lavapipe (llvmpipe, LLVM 23.1.4) under --cfg m2v_cpu_icd: blocks_ahead and clip_bursts
pass (the later clips allocated nothing: [(0, 0), (0, 0)]; job m3-max-12110), clippy clean, and
the new test fails, 0 of 6, with memory.rs as on development (job m3-max-12112).
Not run: NVIDIA, MoltenVK.
(cherry picked from commit 5a862c6ab9ebf0a6f2effeb8776aaac6de3bed16)
runtime_lane::creation_heard_checked demands that a device's making
say only its own informational messages, after the loader's message
about a layer it could not provide. A host that lists an instance
layer twice (two manifests of one layer name) makes the Vulkan loader
warn, at vkCreateInstance, "Removing layer <name> (<path>) because it
is a duplicate of <name> (<path>)", with its id name "Loader Message";
the runtime forwards it (its creation messenger takes warnings and
errors), and the check failed on it. The M3 lists the validation layer
twice: Homebrew's manifest names its library by bare name, which
dlopen does not find there, and a copy in ~/.local/share names it by
absolute path. So a_creation_s_notices_and_messages_reach_the_sink_on_
the_asking_thread failed there on every run (20 of 20 alone at
47e072ccd3; the whole validation suite 3399 of 3400, this test the
one failure). The lane's own sink fails on no warning of the general
kind, so no other test saw it.
The check now takes the loader's own messages at the head of
creation's: its duplicate-layer warning (layer_claim's new
loader_duplicate_layer_message: the loader's id name, the text
starting "Removing layer " and holding " because it is a duplicate
of "), and, where the device was made without a layer, its message
about each, as before. The host's listing of its layers is not the
device's, and nothing wider passes.
Ran (gem10, lavapipe under --cfg m2v_cpu_icd, at the scratch twin of
this commit): with a copy of the validation layer's manifest in a
directory VK_ADD_LAYER_PATH names, so the loader lists it twice, the
test failed at the base on the loader's warning (the M3's message,
with lavapipe's name and the two paths) and passed with the change;
with the host's own listing it passed both ways. The matcher's unit
test passed; clippy on the validation crate, plain and under
m2v_cpu_icd, clean.
(cherry picked from commit 7b2005eb914a62421d2e2206837017acaa640367)
452 recordings moved, measured on the M3 Max (MoltenVK 1.4.2): cost --runs 8 --write over the
whole set, then cost --runs 8 --alone --write over the changed cases (gate tree commit
be02f2e6c2, jobs m3-max-12055).
Why: pin 29's replay at 47e072ccd3 (m3-max-12046) went over its cost gate on six cases,
fresh-pattern-{12,22,32,62,72,112} (R8, R16, RG8, RG16, RGBA8 and RGBA16 Snorm):
commands_recorded.cmd_copy_buffer_to_image reached 1 where the record said 0. Since 876cfd1402 a
signed-normalized fresh pattern is written by copies of its bytes (heap_tiled::fresh_pattern's
SNORM is None: a clear to -1/127 may store 0), and the records predate it (last written at
b5d9e0b933, 11-07). Every value row of that replay matched known-gaps.tsv and no reading moved
between runs; only the cost gate was red.
Bounds that moved, by family:
- plain_buffer_blocks_made, 2 in 146 cases (new): the counter of plain blocks the opaque-fd block
split added (92202c5eaf, RT 1963); no record carried it.
- commands_recorded.cmd_copy_buffer_to_image 0 -> 1 in the six Snorm fresh-pattern cases (above).
- buffer_blocks_made_in_place (10 cases), host_copy_blocks_made_in_place (8), image_blocks_made_in_place
and pooled_memory_blocks_made (3) appear where a case is the first to need a block of its kind
since the block split and the allocation margin for blocks made ahead (fc60379c1f); not separated
case by case.
- scheduler_passes / sleeps / wakes_host, heads_held_for_host_steps and the object_churn evictions
and destroys rose in some cases and fell in as many, as at the last re-bless: they follow timing
(the recyclers evict past a second of wall time).
- No longer bounded: empty_memory_blocks_live, scheduler_sleep_slices, scheduler_wakes_commit,
wakes_handler_threads (now reported where the runs disagreed, or moved by no case).
Verification: the write's own runs above. The gate tree's cost --check at this commit was
requeued behind another lane's M3 job; its result is reported with the landing.
Its product fingerprint follows development's versions at 880a1f0c08. Blessed on the
M3 (s37-pl.sh censusbless --bless, census-at-dev).
(cherry picked from commit bc7a657890515bb81c48d3cc4646de26a8009ac7)
a_wait_ends_once_a_burst_that_began_after_it_ended failed on lavapipe's suite under a loaded
gem10 (m3-max-12030): the wait returned before the burst's end plus SETTLE, as the test reads it.
The test read that end with Instant::now() after QueueQuiet::ended had stored it, so a pause of
the burst's thread between the two of more than SETTLE (1 ms) put the end it read past the one the
wait saw; and it compared Instant (CLOCK_MONOTONIC) against the wait's host clock
(CLOCK_MONOTONIC_RAW on Linux, CLOCK_UPTIME_RAW on macOS).
The thread now reads the host's clock (gpu_time::host_nanos, the clock ended() stores) before
ended(), and the waiter reads it as the wait returns: the end the wait saw is at or after the one
read, so the wait's return is at least SETTLE past it whatever the pauses. The wait itself is
unchanged.
Verification: the test with a 3 ms pause between ended() and the timestamp fails at the old form
and passes at this one, in the job that follows.
(cherry picked from commit 3c6c921005c470f727804c7b05ee8a1209832b26)
nvreds 2f61bceb95 (lockstep/facts.rs): the lockstep analysis could not prove
out[(y*w + x)*n + s] over s < n apart between threads of one row (a counter
needed a constant bound, the sample count had no range, the compiler's
select(y < h, n != 0, false) guard was not split, y*w was not known fixed in
a row), so it kept a barrier and Cluster32 with a multiple of 64, and a
32-thread dispatch on wave64 took the emulated variant and announced
EmulatedSimdgroups. Counters may test a bound computed before the loop,
NumSamples has 0..=64, edge facts split conjunctions, 'fixed' covers uniform
values, size queries and a row's y/z (6 deep). A one-row threadgroup now
records RowLockstep and runs the plain pipeline; multi-row groups keep the
barrier. Kernels with such cells or guards change: SEMANTICS 2005 -> 2006.
Verified by nvreds (msi, same tree over 6d7f59365a): metal2vulkan +
metal2vulkan-air suites 3935/3935, goldens unmoved; clippy both crates; the
new engine_simd_emulated test (RDNA3 profile at wave64: 1/16/32/48 threads
plain, two rows of 16 emulated; three one-change negative controls stay
emulated) fails with facts.rs at the base. Owed: release-mode translation
wall time and peak memory for the largest relevant row and a bounded batch
(the added work is metered and bounded: fixed <= 2^6 visits, edge facts <=
64 dominators). Here: signatures --check and refusal surface unchanged.
What: the lockstep analysis took the store of out[(y * w + x) * n + s] over s < n
(wsm_samples's kernels, n = t.get_num_samples()) as a conflict between two threads of a
simdgroup, in the same iteration and across iterations, even where each simdgroup lies within one
row of its threadgroup. The barrier it kept put the kernel on a flattened tier, and on a wave64
device (Cluster32, a multiple of 64 threads) a 32-thread dispatch ran on the emulated-simdgroups
variant and announced EmulatedSimdgroups. The analysis now proves the address apart from the
IR's structure:
- a loop counter may test its next value against a bound computed before the loop (one value
while it runs), not only a constant; the bound's range stands for it in the counter's numeric
facts, and where the start is below the bound (by the ranges, or as a branch before the loop
tested it: `n != 0`, `k < n`, `start < n`) and the branch lets a next value through only below
it (or, stepping by one, unequal to it), every value of the counter is below it
(Counter::below);
- a multisampled texture's sample count is at most 64, Vulkan's largest sample count (range);
- the comparisons a branch dominating a block held include each part of a conjunction on the
edge taken (`select c, d, false` or `and` taken, `select c, true, d` or `or` not taken), as the
Metal compiler spells `y < h && n != 0` (edge_facts, which guards now reads too);
- a value is one value in every thread of a simdgroup (fixed) where it is uniform, a texture's
size query of such operands (it reads only the texture and the level), or, where each
simdgroup lies within one row, a y or z component of a position; integer operations and casts
of such values too, at most 6 operations deep. An addition with one such operand differs
between threads as the other does (it took only uniform operands before), so y * w + x
differs as x does in a row;
- a cell s + p * n, s a counter below n, n fixed and bounded by N, and p differing between
threads by 1 to S, differs between threads by 1 to S * N + N - 1 (by at least 1 wherever the
p's differ, at whatever iterations, since |s1 - s2| < n), or not at all where p may not
differ; across iterations it is settled where p * n is (core_home: the cell's home is p * n's).
In a multi-row threadgroup two threads of a simdgroup may share a pixel (a grid deeper than one),
so the barrier, the Cluster32 tier and the multiple of 64 stay; the kernel now records
RowLockstep, and a one-row threadgroup of any width runs on its one compiled pipeline.
Tests: engine_simd_emulated's
a_texel_s_samples_in_a_row_need_no_emulated_simdgroups_on_wave64, on the RDNA3 description
narrowed to wave64: wsm_samples's wsm_read_f and wsm_read_u, and the same IR with the guard as an
`and`, keep Cluster32 and LocalSizeConstraint { multiple: 64 }, record RowLockstep, and plan 1,
16, 32 and 48 threads on the plain variant (VariantKey::new()), two rows of 16 on the emulated
one. Negative controls, each one change from that IR and each a real collision, record no
RowLockstep and keep every partial threadgroup on the emulated variant: the row scaled by the
width rather than by n, the latch testing the counter rather than the next value (the body runs
at s == n, the next pixel's first cell), and the loop entered without the n != 0 test (at n == 0
every pixel writes cell 0).
Ran on msi-laptop (Linux, llvm-as 23.1.1) at this change over 6d7f59365a (none of these files
changed since): the metal2vulkan and metal2vulkan-air suites, 3935 of 3935 passed (the golden
tables among them, none moved); clippy on both crates, all targets and features, clean; the new
test passed (its kernels assembled, no SKIPPED line), and with facts.rs restored to 6d7f59365a
it fails (wsm_read_f records no RowLockstep).
SEMANTICS: kernels whose cells or conjunctive guards the analysis now proves apart lose
lockstep barriers or gain RowLockstep.
(cherry picked from commit 2f61bceb95e217465e9750ead7320fdf7aecba3e)