Enables::enable_zero_initialize_device_memory gets the test each runtime-own enable has
(tests/enables.rs: the structure, of the registry's type 1000620000, is chained only once
enabled, its member TRUE, the extension's name after host image copy's). docs/API.md's paragraph
of what the runtime enables for itself outside the vocabulary names VK_EXT_zero_initialize_device_memory
and when. api_signatures.tsv gains WorkCounts::images_started_zeroed (scripts/api-signatures, --bless).
Not yet built; the next gem10 build runs it.
(cherry picked from commit 2ec9061a61c7262e7a05b4e42f0e1122518439cf)
The draft (amdperf-27 8b8d1b9295) was never compiled: PixelFormat and TextureUsage come from
metal2vulkan::metal, whose name is RGBA8Unorm. The test now also makes a second Shared texture
while the busy work runs and times its first replace_region (one texel), the CPU's first write
into that memory, so a run shows whether a wait moves from the making to the first copy.
(cherry picked from commit 9eb797f3c8ce1632c43428a5bd99edb8146d274b)
On an RX 7900 XTX (RADV, Mesa 26.2.6) whose GPU had idled into runtime suspend (autosuspend 5 s,
the first run of a job), runtime_lane::first_use::new_resources_wait_for_no_gpu_work failed:
new_texture(Shared) waited 2.08 s, until 2 s of queued fills ended (probe 26824af571, log
q2p3-5383), and 1.2 ms with the GPU awake. Its making wrote zeros over the image on the host
(host_copy::start), the CPU's first touch of the image's new memory, which waits where the
kernel's zeroing of that memory waits.
Where the device lists VK_EXT_zero_initialize_device_memory with zeroInitializeDeviceMemory (and
enables hostImageCopy), the runtime enables it (enables.rs: the feature structure ash 0.38
predates, Enables::enable_zero_initialize_device_memory; create.rs; never on an adopted device),
and a Shared or Managed texture's host-transfer image is made in VK_IMAGE_LAYOUT_ZERO_INITIALIZED_EXT
in a block of its own allocated with VK_MEMORY_ALLOCATE_ZERO_INITIALIZE_BIT_EXT
(memory::allocate_image_zeroed, Fit::Zeroed) and moved to GENERAL out of it on the host
(host_copy::transition_from), with no write of the host's. The bytes are the driver's zeros,
Metal's answer, so no accuracy trade. Counted: WorkCounts::images_started_zeroed. Cost: each such
texture takes an allocation of its own.
Test: tests/zeroed_start.rs (a Shared texture made while about 1.5 s of fills run returns before
they end, starts zeroed where the device enabled the feature, and reads zero). The XTX runs follow.
(cherry picked from commit f7338a5d83d9415697a6f2585c3c7fc73af7e1fa)
The test's claim is each thread's: a kernel-time read and a status or error read return inside a
submission, so neither waits for it. It asked for reads of both threads inside the same
command buffer's submission, which is 0.05 to 0.11 ms on lavapipe. At development f09bdd0f84 on
gem10's lavapipe (m3-max-6374) no round of 8 had both: one thread landed inside and the other did
not, taking turns ([(0, 0), (0, 0), (406, 0), (0, 172), (386, 0), (0, 408), (0, 134), (0, 347)]),
and every read stayed under the slow bound. Now the rounds end once each thread has had reads
inside some submission; a thread whose reads never land inside one still fails the test.
Test only; the runtime-sources pin is unchanged. To be verified on lavapipe and the M3 after the
merge.
When a real fence wait fails on a lost device, command buffers whose queue timeline had already
passed them now complete Ok (their GPU times read where the device still answers) instead of
failing as the recovery's victims. Device::raw's docs say a lost generation's VkDevice stays alive
until the next raw call. Re-pinned the runtime sources.
Verified by devloss: MoltenVK on the M3, the negative control failed 3 of 3 (m3-max-6319); with
the change the runtime and lane device_recovery tests passed 6 of 6 rounds each (6325); lavapipe
on msi clippy clean, runtime suite plus touched validation 1862/1863 (6329), the one failure
predating this change.
The device's line keeps the generation a root handle's Device::raw lent until
a later raw call lends another, so a lost VkDevice whose handles raw answered
outlives the runtime's own objects made on it. That is kept: DeviceHandles is
Copy and holds references into the generation, which a drop at the recovery
would leave dangling under a live borrow, and a consumer that made its own
objects with the handles (a swapchain, an import) needs the device alive to
destroy them.
Device::raw, DeviceHandles and the runtime README's device-loss section now
say so: the lost VkDevice stays alive until a later raw call of a root
handle, so the consumer destroys what it made with its handles first.
Docs only.
(cherry picked from commit e675a9868f6a52598f86289dc76fe09f938eda77)
A completion turn that finds a batch's queue timeline past it, and then fails
the wait for that batch's fence or the fences' reset (a real lost device's
wait), answered the command buffers that batch ends with the failure: as
victims of the recovery, or DeviceLost where the device does not recover.
Their work had completed, so that answer was wrong: Metal's command buffers
that completed before a GPU recovery complete.
fail() now posts those command buffers (`ending`) Ok, after the queues
drain, with their GPU times read where the device still answers (else their
completion's), ahead of the pending batches, which fail as before. A relayed
failure still reaches its command buffer through CommandBufferShared::complete.
The recovery's notice no longer counts them among the victims.
The test hook (Device::recover_for_test) never takes this path: it fails
the pending batches with no wait failed. So the test drives it with a
cfg(test) hook, completion::trace::fail_settle_of, which fails one command
buffer's completion turn as a lost device's fence wait fails, after its work
completed: tests::device_recovery::
work_that_completed_before_a_failed_wait_completes checks it completes, its
fill ran, and the next call recovers the device and its queue serves on.
Verified on MoltenVK, the M3 Max: with the old answer (a negative control)
the test failed 3 runs of 3, (Error, GpuRecoveryVictim) (m3-max-6319); with
this change the runtime's device_recovery tests passed 6 rounds of 6, and the
validation lane's 6 rounds of 6 (m3-max-6325). On lavapipe (msi, m3-max-6329)
clippy is clean and the runtime suite and touched validation tests pass
1862 of 1863, surface 19 of 19; the one failure,
tests::freed_memory::the_in_place_check_s_buffers_delay_no_deallocator_behind_batches_in_flight
("the batch was never submitted"), fails so at development 73f73a3bd3 and
f09bdd0f84 too (m3-max-6379, m3-max-6380).
(cherry picked from commit 639f363cf7141e36591e4629799f7b212f3af150)
A lost VkDevice is replaced by a new generation of the device. Every in-flight command buffer
fails with the loss, and one loss names one hang: a batch watched after the loss fails with it,
so a single loss can no longer count twice against its queue. The type-9 hang's GPU-met wait is
judged by when the other queue's signal landed. kept_images' tile passes each run alone (test
only). Re-pinned the runtime sources.
New public items: Degradation::DeviceRecovered (device-recovered); WorkCounts::vk_devices_live,
vk_devices_made, device_recoveries; RuntimeGap::MadeBeforeRecovery and
RuntimeGap::AdoptedDeviceRecovery; Device::recover_for_test. None removed. REFUSALS.md, the
signatures and conformance coverage are unchanged by the bump.
Verified by devloss: MoltenVK on the M3, the recovery tests 12 of 12 rounds fixed (m3-max-6242)
against 3 of about 20 failed unfixed (6219, 6233); clippy on this tree (6278). Per-draw cost on
the M3 within 0.31% (6121). Pending: 5080 devloss-recovery-fixed-183346, ms01/lavapipe 6277.
runtime_lane::kept_images::a_kept_image_let_go_of_while_its_command_buffer_waits_goes_after_it
failed on the Iris Xe (ANV): "while the first command buffer waited, 3 images
made and 3 live; 3 live once it completed; the next pass made 0", where the
case wants 2, 2, 1 and 1. The Iris Xe is the one device of the fleet whose
merges keep their texels in images (ShadowCopyBackDispatchFaster without
ShadowCopyInDispatchFaster), so the only one where the case checks its
counts. It failed so at development d65be37964 (m3-max-5851, 3 runs of 3) and
at the device-loss tip before this commit (m3-max-5852, 3 of 3).
The cause is the case's own: its 300 passes into the small tile, in one
command buffer with nothing between them, form a run of passes merged once
(pass_runs.rs, since 241ee2c0d1), whose later passes take no kept image. So
the queue's takes never reach the 256 past the tile image's last take, the
pool keeps that image, and the next pass into the tile takes it rather than
making one.
An empty blit encoder after each pass ends its run (pass_runs.rs, "What ends
a run"), so each pass is a pass alone and takes the queue's image, as the
case means.
Verified on the Iris Xe (ANV, ms01, m3-max-5892): the three kept_images
lanes passed 5 runs of 5, each "2 images made and 2 live; 1 live once it
completed; the next pass made 1".
(cherry picked from commit 3286a3ff8c59b2f8a5ed5fe1faaae5c5b10d7a7e)
runtime_lane::private_primitives::type_nine::a_direct_draw_of_type_nine_hangs_as_metal_s_gpu_does
failed once on the RTX 5080 Laptop GPU at -j 6 beside other lane tests: the
hang queue's command buffer whose event wait another queue's command buffer
meets read Scheduled 108.8 ms after its commit, after the hang completed,
where the test wanted it during the hang.
The runtime decides the hang queue's waiting command buffers as the hang's
thread lets its hold go, (the GPU reached the hang) + 27.5 ms, no sooner than
SCHEDULED + HANG (32.6 ms) after the draw's commit: a wait whose value the
event's counter shows by then was met during the hang and runs nothing; one
met later runs, as the one the host meets after the hang does and as Metal's
met after the hang did. The other queue's command buffer is committed 10 ms
after the draw's.
The cause is the GPU's load, not the runtime: beside five other lane tests
at -j 6 the other queue's command buffer is submitted at once and its signal
lands only after the hang's end. On the RX 7900 XTX (RADV), first scenario
of each run, 8 runs of 8 (m3-max-5719) and 5 of 6 (m3-max-5709): it read
Scheduled 0.2 to 0.4 ms after its commit and completed 84 to 112 ms after
it, the scenario's batches submitted behind two or more pending earlier
batches of their VkQueue (4 or 5 of them; no group of batches kept), and the
command buffer committed once all the others completed took about 97 ms
too, with nothing of the scenario left in flight. Alone (m3-max-5725, 4
runs): it completed 0.5 to 0.6 ms after its commit, the wait it meets read
Scheduled 4.3 to 5.4 ms after its own commit, during the hang, and no batch
went behind two pending. With the old check those loaded runs fail as the
5080's did.
On the RTX 5080 Laptop GPU (b5080 entry devloss-devloss-tip1-nine-163410,
NVIDIA), 12 runs of 12 passed beside the five other lane tests and 4 of 4
alone. Loaded, in 25 of the 36 scenarios the other queue's signal landed
32.6 ms or more after the draw's commit: it completed 26 to 238 ms after its
own commit, in 21 of them read Scheduled 0.1 to 0.4 ms after it, and the
hang's command buffer took 34 to 433 ms, the GPU reaching the draw late.
Alone, in none of the 12: the signal completed 0.3 to 0.7 ms after its
commit, the wait it meets read Scheduled 4.4 to 5.1 ms after its own commit,
and the hang's command buffer took 33.6 to 34.4 ms. So the runtime does not
hold the other queue's signal behind the hang: it submits it at once, and
alone it completes during the hang; beside other processes' GPU work it
completes late.
The test now tracks that command buffer (commit, Scheduled, completion),
prints each row's answers and the device's grouping and pending counts
before its check, and, where the GPU-met wait's command buffer ran (its mark
set), checks that the other queue's signal completed no sooner than
SCHEDULED + HANG after the draw's commit, as the runtime's decision implies;
otherwise the bounds are as before.
(cherry picked from commit 1e5fde71637f56744e09f09035110a04e049d43b)
Metal's MTLDevice survives a GPU recovery; the runtime's device refused every
call with DeviceLost from the first loss on, and the consumer ends its VM at
the first refusal. Now a device the runtime made is a line of generations
(device/line.rs), each a DeviceShared over its own VkDevice, and the first call
that needs the device after a loss makes a new VkDevice of the same physical
device, options, queue families and extensions.
- Two kinds of handle. The program's device (and its clones) is a root handle:
it holds the line, pins no generation, and every public Device call goes to
the generation that serves (each public method forwards to its *_now body).
Objects hold generation handles, so their Vulkan calls, drops included, reach
their own VkDevice alone. A generation handle's check is one relaxed load of
the line's generation (Device::generation_serves).
- A draw pays nothing for it. A command buffer takes its generation once, as
it is made (CommandBuffer::generation); its encoders' per-draw reaches (work
counts, fresh-unwritten and alias records, sampler-slot changes, attachment
read notices) read it there, not through a device handle's kind. A bind's
device check is one compare of the cells the two handles hold, inlined, its
refusal (Device::foreign) out of line.
- The state machine (Live, Lost, Failed): the claiming call recovers, every
other call waits (a notice past 10 s, waiting on); threads command buffers'
completion depends on never wait. Recovery: the lost generation's command
buffers in flight fail through its completion path, its queues drain under
their locks, create_on makes the next VkDevice, the queues are retired.
- Command-buffer answers, as a real loss is one more hang: the oldest
incomplete batch's command buffer fails GpuHang (exact on one VkQueue; on two
or more the queue whose oldest incomplete batch was submitted first, said so
in the notice), counted against its queue so the second revokes it
(AccessRevoked); the others GpuRecoveryVictim; one committed on the hang's
queue before the recovery runs nothing and completes with no error; one made
before and committed after fails GpuRecoveryVictim. One loss names one hang:
a batch that went to the driver just before the loss and reached the lost
device's completion after the loss took the pending batches fails with it,
as a victim (its own wait need not fail: the test hook's VkDevice runs it),
and no later failure of the lost device names a second hang.
- Command queues survive: a queue is a root handle and a cell of its place on
one generation (VkQueue, slots, pools, hangs), which a recovery retires and
the next command buffer re-makes; label and GPU-error count go on.
- Objects made before a recovery are refused where they meet the new VkDevice
or need their lost one: RuntimeGap::MadeBeforeRecovery, at the 38 lost-device
checks (Device::lost_refusal) and at every foreign-object check of one line
(Device::foreign). DeviceLost stays for a device the consumer made.
- Carried across generations: the address space, resource IDs and the passing
holds a making waits out before it takes one, unique identifiers, counters
and the announced notice kinds.
- A device handle is an enum of the two kinds (24 bytes, was 16): the shadow
merge's copy-back dispatch, which holds handles, is boxed (clippy's
large_enum_variant).
- Device::recover_for_test (public, documented) runs the whole path with no
GPU fault; RuntimeGap::AdoptedDeviceRecovery on an adopted device.
- Degradation::DeviceRecovered (device-recovered), announced at each recovery
with the culprit and its time. WorkCounts::vk_devices_live, vk_devices_made,
device_recoveries: two VkDevices while objects of the lost one live, one
after.
Docs: docs/API.md catalogue entry, the runtime README's device-loss section,
FAST-PATHS known gap (a make whose own submission first meets the loss is
refused DeviceLost), docs/REFUSALS.md regenerated (refusal_surface.py names a
forwarded body's sites by its public method), api_signatures blessed.
Tests: runtime_lane::device_recovery (hang and victims, command buffers on
their way to the driver at a recovery, MadeBeforeRecovery and the VkDevice
bound, revocation at the second hang, a command buffer made before fails as
victim, all under the validation layer; a recovery that finds nothing of the
queue scheduled names no hang, its command buffers victims),
tests::device_recovery (the hold of the hang's queue between a loss and the
recovery), detach_lost and the MoltenVK lost-device lanes updated to the
recovery's answers.
Verified:
- lavapipe: runtime suite and touched validation tests 1850/1850, surface
19/19 (m3-max-5695, gem10, before the rebase onto 7e039f062a); on
7e039f062a, before the one-hang fix, 1853/1853, surface 19/19, clippy clean
(m3-max-6150, ms01). This tree: clippy clean (m3-max-6278, msi).
- RADV RX 7900 XTX: 81/81 touched device tests (m3-max-5709). Iris Xe (ANV):
80/81 (m3-max-5766), the 81st kept_images, which fails so at development
too and the last of these three commits fixes; the recovery tests alone 3
rounds of 3 (m3-max-5852). RTX 5080 Laptop GPU: 80/81 (b5080 entry
devloss-devloss-tip1-nine-163410), the 81st the test's own 20 s bound on
the recovery, which took 39.5 s beside another entry; the test now prints
the recovery beside the device's first making and bounds neither.
- MoltenVK on the M3 Max: the device_recovery tests 8 rounds of 8
(m3-max-6135); with the one-hang fix 12 of 12 (m3-max-6242), where without
it 3 rounds of about 20 failed with a command buffer Completed after the
hang (m3-max-6219, m3-max-6233). The RTX 5080 failed the second-hang test
so in 2 runs of 3 (devloss-devloss-rec-alone-170457).
- Recovery time, alone, under the validation layer: llvmpipe 29.9 ms, RX 7900
XTX 20.4 ms, Iris Xe 15 to 21 ms (its first making 30 to 41 ms), M3 Max
(MoltenVK) 35 to 40 ms (42 to 50 ms), RTX 5080 530 to 559 ms (602 to 635
ms). VK_EXT_device_fault listed: llvmpipe 0, XTX 1, Iris 0, 5080 1.
- Per draw (draw_costs, release, --heap, M3 Max, base 7e039f062a and the tip
alternating, 4 rounds, m3-max-6121): instructions a draw ws +0.03%, many
-0.05%, 10k -0.31%; draw_primitives +10, +8 and -26 of 17,172, 11,245 and
7,736 a call; each set_* call +3 to +4 (of 425 to 860); a command buffer's
creation +170 to +370, an encoder's end +120 to +390.
(cherry picked from commit 3d7758c074fc9895d5d6c9766604c6c4eae9166d)
The device's own checks (in-place, queue-switch and submission checks) now pause a step while
another thread of the device allocates or frees, for at most 100 ms a step, so the first makings
on a fresh device no longer wait behind them. Their makings, releases and submissions are counted
apart from the program's (WorkCounts' device_checks). Re-pinned the runtime sources.
Verified by amdperf-26: 5080 A/B amdperf-sa26-ab (m3-max-6037), slow first takes with a fresh
cache directory 8 of 36 -> 1 of 36, but there the checks never finished; the 100 ms cap
(00974454eb) fixes that, and its A/B (amdperf-sa26-ab2) is queued. The 780M checks' tests passed
111/111 at that tree (job 6019). Cost records that counted the checks move; the next re-bless
names the cause.
A program whose allocations and frees never pause for QUIET (20 ms), one that allocates every few
milliseconds, held each check's step back for as long as it ran, so its verdicts never came and the
device kept the forms of a device without them. A step now goes on after MOST_ASIDE (100 ms)
whatever the device does: a check goes on at least a step each 100 ms, its steps a short share of
that time.
Test: step_aside::tests::a_step_goes_on_after_the_longest_wait (an allocation that never ends holds
a step 100 ms, under 300 ms).
(cherry picked from commit 00974454eb385085452ee11ff3c82b296432497c)
A device's checks run on threads of their own beside whatever the program or case does first, and
their Vulkan work landed in that program's counts: on the M3 Max, pass-bytes-srgb-decode-all-bytes
alone read vk_memory_allocations 7 before the import tax check held 32 imports of its 16 MiB
(9d3ac94e85^) and 259 after it (131 at development 49d9a3fd06), the cost record of whichever case
met the device first carrying them. The conformance cost half already left the submission checks'
own counters out (cost::DEVICE_CHECKS, "never a case's"); their allocations were not among them.
On a thread step_aside marks as a check's (the submission, queue-switch and in-place checks'), the
creation and release doors count their vkCreate*/vkAllocateMemory/vkBind*/vkDestroy*/vkFreeMemory
calls in CHECK_MAKINGS and CHECK_RELEASES (churn_counts.rs) instead of the process's
VK_MAKINGS/VK_RELEASES and their site tables, and Counters::queue_submitted counts a submission
there as the checks'. WorkCounts::device_checks (DeviceCheckWork, new) reads them, with the step-aside
counters moved into it (steps_aside, aside_nanos; they were check_steps_aside/check_aside_nanos,
which the cost half would have read as a case's). cost::DEVICE_CHECKS excludes device_checks.
The in-place check's work through the program's paths (buffers_made, commands_recorded and the
like) is still counted as those paths count it, and a free the device's free thread makes for it is
the device's; DeviceCheckWork's docs say so.
Tests: churn_counts::tests::a_check_s_makings_and_releases_are_its_alone (a marked thread's makings
and releases leave ObjectChurn alone and count as the checks'); submit_check_device asserts the
checks' allocations are counted apart; the conformance reading test asserts device_checks is never
read. API signatures blessed. The M3 measurement of pass-bytes-srgb-decode-all-bytes follows.
(cherry picked from commit 674cbf0842821dfaec93c5ec7a29d094f3da6c06)
tests::exit_guard::threads_and_the_program_s_code_go_through_the_guard refuses a .spawn( outside
exit_guard.rs; the unit test that a check's thread's allocations count for nothing started a
scoped thread. It now marks the test's own thread, which libtest and nextest give each test.
Verified: the exit-guard test failed on the 780M at c8976bd84d (job m3-max-5871); rerun follows.
(cherry picked from commit 7e8f54b1d6e2a2809f43b5efe5092a895d197bb8)
Each variant's checks line names WorkCounts::check_steps_aside and check_aside_nanos beside the
checks run and recalled, so the 5080 A/B of the step-aside shows the checks waited where the
takes went on. Test-only.
(cherry picked from commit a1370fb3140f35b7bb9cc9a6eb8134a1c62626e4)
A device whose checks have no record runs them on threads of their own beside the program's
first makings: the submission checks as it is made, the queue-switch and in-place checks at the
first use that asks. On the RTX 5080 Laptop GPU (NVIDIA 615.71.09) the consumer's orders of
tests/host_ram_window_bench.rs over a guest RAM in 2 MiB pages took 11 takes of 5 to 10.7 ms in
36 runs with the submission checks running beside them (b5080 entry amdperf-b26-checks: a fresh
shader cache directory of the device's own), every one in the first two runs, while the checks
ran (87 to 115 ms, against 22 to 26 ms alone), and 2, at 5.1 and 5.2 ms, with the checks read
from a record. The checks' own submissions were not what the takes met (0 during 9 of the 11):
their imports, frees, mappings and submissions together are.
step_aside.rs counts the device's allocations and frees in progress at their two doors
(creation::allocate_memory, release::object) on every thread but a check's, and when the last
ended. Each check's thread marks itself, and before each step that allocates, frees, maps or
submits (the submission checks: each round, import, release, submission of a phase, copy and
remap; the queue-switch and in-place checks: each round) waits until none is in progress and none
ended for QUIET (20 ms). It goes on at once while a call waits for the check's verdicts
(SubmitChecks/InPlaceChecks/QueueSwitch::wait count their waiters), so use_host_ram's wait for
the import tax's verdict is the checks' own run alone. Counted: WorkCounts::check_steps_aside,
check_aside_nanos.
Unit tests of the wait (step_aside.rs). The 5080 A/B follows.
(cherry picked from commit 83d28421ecaa127b6eb3a363ee73dfff70fe5e92)
The 5080 run of the split by shader cache directory (b5080 entry amdperf-b25-cache-split, three
rounds of twelve order runs a variant) took no take of 5 ms or more, its slowest 1.4 to 4.8 ms,
only with an own directory a device before had used (the records of the device's checks there):
none in 36 runs, against 9 with a fresh own directory (up to 10.5 ms), 8 with all the consumer's
options, 4 with a fresh one 2 s after the making, and 1 to 5 with the per-user directory and an
option alone. So the takes that wait follow the device's checks running beside them.
Each variant now prints, once its orders ran, which of its device's checks ran in the process and
which it read from a record (WorkCounts' submission, queue-switch and in-place counts) and its
submission checks' report (how long they ran); each slow take and each run the submission checks'
submissions meanwhile; and a variant more, a fresh directory whose device's submission checks
settled before its first order (Device::settle_submit_checks).
Test-only; its 5080 run follows.
(cherry picked from commit e039e21ca901946d00071f97ebe34adb734f1bd4)
The 5080 run of host_ram_window_bench_by_consumer_option (b5080 entry amdperf-b22-by-option, two
rounds) found takes of 5 to 10 ms at chunk starts with every variant, its "none" among them, while
the same orders on a device of the default options (host_ram_window_bench, entry amdperf-b20-ab)
took none in 72 runs. What every variant shared and the default options lack is a shader cache
directory of the device's own, a fresh one.
The variants now keep the per-user directory, as the default options do, unless they name their
own (Parts::own_cache, which Parts::ALL keeps): none, an own fresh directory, the same directory
again (holding what the first device wrote), an own fresh directory with 2 s between the device's
making and its first order, each other option alone, and all. Each run's summary and each slow
take's line print the device's pipeline creation time and its shader cache's read, write and
off-thread time over them (WorkCounts), and each variant's header the same since the device's
making, so a take that meets the device's own pipeline work says so.
Test-only; not run here: its 5080 run follows.
(cherry picked from commit a8f7da41c6c84c8ea2956d6b8c416379d6ef31af)
Its product fingerprint follows development's versions at eac9da30c7. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit 476ba225c857764e11fdda70bd68203b901aac02)
perdraw-6 tip 1 (cherry-picked as 80add4510e): a draw rebound after calls that only moved buffer
slots' offsets (or attribute strides), the same buffers bound, skips the function-table check, the
shadow and detached-buffer looks and the set-0 rebind where the descriptor ranges are the kept
draw's, and notes, checks and gathers only the moved slots' uses (WorkCounts::draws_moved); no
sampler-maps clone per draw; PassStartReads skips its walks while no fragment stage wrote. Each
skip asserted in debug builds; the every-second-draw check still compares with every step.
draw_costs 10k --heap, release, base acd437e9fe vs tip, alternating, 3 rounds:
lavapipe (ms01 m3-max-6045): 8,370 -> 6,639 instructions a draw (-20.7%), 775-805 -> 546-552 ns
M3 MoltenVK (m3-max-6114): 8,183-8,192 -> 6,666-6,682 (-18.5%), 377-414 -> 310-321 ns
Runtime suite lavapipe 1806/1806 (6101), M3 m2v_gpu 1777/1777 (6139); clippy all cfgs and
rustdoc (6045, 6101); M3 cost --check whole set: no gated bound or ceiling moved (6114). RTX 5080
A/B queued (b5080 perdraw6-perdraw6-ab-1-180628).
A render draw rebound after calls that moved only buffer slots' offsets
(or attribute strides), each slot keeping the buffer it bound
(argument_table::Changed::offset), is now a draw moved
(WorkCounts::draws_moved, new). Its tables bind the kept draw's objects,
so it skips what those objects decide, each skip asserted in builds with
debug assertions:
- no stage's visible-function tables checked again, no shadowed-texture
or detached-buffer look (both functions of the objects bound);
- set-0 writes and dynamic offsets kept, and the push writes not built
again, where its commands' descriptor ranges are the kept draw's
(rebind_into writes a buffer's descriptor of its buffer and range
alone); the every-second-draw check compares them with every step;
- narrowed, where its uses were patched in place and none is of what the
encoder made resident: the uses differ from the kept draw's only at the
moved slots' (CommandUses::slot_uses_into), so only those are checked
against the attachments (degrade_moved_attachment_reads) and the
geometry writes, compared and recorded for the encoder's noted uses
(EncoderCore::note_moved, NotedApart::note_moved, no touch walk), added
to the pass's reads and gathered (InstanceShadows::add_moved).
Every rebound draw without a resident prefix also skips the unordered
writes, indirect reads and geometry writes adds and the pass's reads'
announce: its uses are the kept draw's access types, none written and
none an indirect read (draw_again::unwritten), in a pass whose fragments
wrote nothing, which makes each of those a no-op.
Folded in from the brief: bring_in reads with its sampler maps instead of
cloning them per draw (ReadFrom::reads_through, read_again), and
PassStartReads::announce and found walk no use while no fragment stage
of the pass wrote (and read) anything.
Verified: see the tip message (release A/B on lavapipe, the 5080 and the
M3; runtime suites; conformance cost --check). New test
draws_after_offsets_alone_moved_bind_what_every_step_binds compares moved
draws with every-step draws (commands, pixels, state records, noted
counts); draws_moved joins command_counts' per-encoder counts.
(cherry picked from commit 1a2e3258d40604607bc681e8a58202ed632f1594)
surface's linear-run-host-range (cherry-picked): a pass whose commands named a buffer over host
pages (a setVertexBytes upload chunk) was kept out of a linear run, so each such pass merged by
itself. Now it joins the run; where a rebind encodes it again alone it leaves the run, as a
shadowed texture's pass does, and a later pass that took its merge over reloads the run's box
(LinearMerge::record_reload, WorkCounts::linear_runs_reloaded). RADV 780M, release, 3 runs, 706
passes each reading a no-copy chunk over host pages into a target on a Private buffer (reims's
many_passes shape): 706 merges a frame -> 1, GPU 47.6 ms -> 14.0 ms (12.3 ms over a private
texture), commit to completed 94-107 -> 86-90 ms (m3-max-6078 base, 6118 fix). The reload test:
0 of 98,304 texel bytes differ on RADV and lavapipe; negative control 6,778 differ (6141). M3
clippy plain and gpu, rustdoc, runtime unit 1297/1297 (6120); RADV and lavapipe related device
tests 54/54. NVIDIA before/after pending.
The negative control (the reload's linear arm returning None, m3-max-6134 on RADV) stopped at the
counts (runs reloaded 0 of 2) before the texel comparison: now the texels are compared first and
the count of differing bytes printed, so a control shows what the reload keeps right.
(cherry picked from commit db7e75f334fba63cca56da250051f46761af12d8)
On RADV (m3-max-6104) the six passes formed one run (5 merges taken over, not 4): with no
scissor, every pass's box is the whole render area (linear_attachment::Coverage takes the Vulkan
scissors), so the second pass went on with the first's run. Now the first is scissored to the
top left quarter and the second to the top right, which reaches past the first's box: the second
opens a run over the whole target, and the third and later passes blend over the bottom half,
which only the reload copies in once the second is encoded again alone. The chunk test passed
there: 706 passes, 1 merge recorded and 705 taken over, GPU 13.99 ms (47.6 ms at development).
(cherry picked from commit a09cbd2e83ec9777eea42c1b1d10a99d22f6b139)
A pass over a linear attachment rendered apart joined no run where its commands named a buffer
over host pages (render.rs's once rule): a rebind of one encodes the pass again alone, and a
linear run had no keep after such a pass. A consumer's setVertexBytes lands in an upload chunk in
its guest RAM, a no-copy buffer over host pages, so every pass of reims's many_passes merged
alone: 706 passes, 706 merges, 705 scratch reuses (11-05).
Measured at development 0165341336 on RADV 780M, release, the rule forced
(linear_runs::passes_reading_host_pages_form_one_run, m3-max-6078, three runs): 706 passes, 706
through copies, 706 merges recorded and 0 taken over, 705 scratches reused; GPU 47.59 to 47.65 ms,
against 12.27 to 12.30 ms for the same passes over a private texture.
Now such a pass joins. Encoded again alone by a rebind, it leaves its run as before
(RunMerge::leave: the merge it took over records at the pass before it) and copies in, keeps and
merges after itself; where a later pass of the run took its merge over, it then copies the run's
box in again from the surface and keeps it into the run's scratch (RunMerge::keep_after's new
linear arm, LinearMerge::record_reload, recorded by EncoderCore::finish_replay; counted as
WorkCounts::linear_runs_reloaded). The run's later passes render over what the bytes hold then
(the run's box may reach past the pass's own, where the pass opened the run over its whole render
area), and its merge writes only what they change. Attachments over host pages other than the
run's own bytes still keep a pass out.
Docs: pass_runs.rs (Which passes join; Encoded again; keep_after), command_buffer/reencode.rs
(Runs of passes), merge_scratch.rs (order 1), linear_merge.rs (Runs), render.rs. API signatures
blessed (one WorkCounts field).
Tests: linear_runs::passes_reading_host_pages_form_one_run (one run expected);
linear_runs::a_pass_of_a_run_encoded_again_alone_reloads_the_run (six passes behind a
host-signalled event, two of them reading a chunk over host pages that is rebound: both encoded
again, both reloading, five merges, the texels a private texture's). Not yet run.
(cherry picked from commit 2b79be56f39ef529db48090dd3185f795ed3c75e)
reims's many_passes (11-05) read 707 passes, 706 merges: a pass whose commands name a buffer
over host pages (setVertexBytes landing in the consumer's upload chunk in guest RAM) joins no
linear run (render.rs, the run's once rule). This test is that shape with the device's rule
forced: one target over a Private buffer, rows of 2048 bytes, 706 passes each binding its
rectangle and color from one chunk at an offset of its own. It prints the merges, the encoding
time and the GPU time, against the same passes over a private texture, and asserts one run.
(cherry picked from commit 2778f79301d96d3632a40e024e451130fa8aee05)
runtime_lane::submission_checks::an_event_wait_a_gpu_signal_in_flight_meets_is_checked_at_once
failed on the RTX 5080 in round 49d9a3fd06's lane (b5080 m2v-orch-dv-ln03-170042): 'the
signaller never ran at the waiter's scheduling in 7 tries'. Beside the lane's other tests at -j 6
the host scheduled the waiter after the GPU had finished 256 fills of 64 MiB (about 20 ms there);
type_nine in the same part read another queue's command buffer Scheduled 145 ms after its
commit. A premise the try could not arrange, not a refusal or a wrong answer: 9 tries reach 1024
fills (about 80 ms on that GPU). It passed in 9 earlier 5080 lane runs. Test only.
Its product fingerprint follows development's versions at 49d9a3fd06. Blessed on the
M3 (s37-pl.sh censusbless --bless, dv-m3).
(cherry picked from commit 8ead51dad7cdb667f124e35154974dc723c31260)
amdperf-23 (cherry-picked): on ANV (INTEL_OPEN_SOURCE_MESA), a fill through one import of host
pages, a global barrier and a copy through another import of the same pages in one command buffer
read 0 of 4096 bytes (probe m3-max-5482, Mesa 26.2.6; across command buffers or queues, 4096), so
AliasedImportBlitsUnordered now covers ANV and such blits take the ordered route there. Iris Xe
(ms01, m3-max-5804, ICD pinned to intel_icd.json): host_ram_device, host_ram_dma_buf and the
dma_buf_imports lane 42/42 against 40/42 at the control (the two aliasing tests the defect
covers); clippy plain and m2v_gpu of runtime (um790 m3-max-5814).
tests::host_ram_dma_buf::where_each_listed_import_costs_a_submission_the_ram_is_long_chunks_released_once_idle
asserted that the first object over a chunk not imported lies in an import of its own run. With
ANV now holding RuntimeDriverDefect::AliasedImportBlitsUnordered (the commit before), no run is
imported alone there: each object lies in its chunk's import, which the first one over it makes,
as on MoltenVK. On the Iris Xe (ms01 job m3-max-5700, Mesa 26.2.6) the test failed at the tip
with (run, chunk) = (0, 1) against (1, 0), and passed at its control, which lacks the defect.
The test now reads the device's answer (host_ram_device's runs_alone, made pub(super)) and
expects, where no run is alone: the first object and the first over each chunk in the chunk's
import, no run's import released or made again, the source asked for the chunks alone, and a copy
over a released chunk importing the chunk alone. Elsewhere its expectations are unchanged.
(cherry picked from commit 0fe111381051afc82f3ff64a57110c18ff087497)
On ms01's Iris Xe (Raptor Lake-P, Mesa 26.2.6) two host_ram_device tests failed (5425): a write
through a buffer bound in a run's import and a read through one bound in the chunk's import of
the same pages, in one blit encoder. A probe of each way (5482, scratch branch
steelbrain/amdperf-iris-probe, two runs) showed the shape MoltenVK's AliasedImportBlitsUnordered
names: in one command buffer, in one encoder or two, a fill through one import, a global memory
barrier and a copy through the other read none of the fill (0 of 4096 bytes) in either
direction, where two command buffers of one queue, a wait first, and two queues each read all of
it, and every way through one import read all of it. Vulkan counts imports of the same pages as
aliases of one memory, which a global barrier orders, so this is the driver's.
ANV now has the defect in the Affected table, so an object over a chunk not yet imported binds in
the chunk's import (waiting for it), never in an import of its own run, as on MoltenVK. The table
test lists it for ANV; host_ram.rs, the host_ram_device tests' docs and HOWTO name ANV beside
MoltenVK.
Verified: cargo fmt only here; the Iris rerun of the 42 tests is a potluck job.
(cherry picked from commit 589815be2cd36191673b6aae36e2f50a2afcd1cd)
clmode's ask 2 (cherry-picked 02562d2a1e..da2a0dfe28): Device::new_exportable_shared_event and
SharedEvent::export_semaphore_fd, an OPAQUE_FD export of the event's timeline semaphore; a device
without the export refuses NotImplemented(RuntimeGap::ExportableSemaphore). Verified by clmode:
RTX 5080 (b5080 clmode-ask2-nv-164856, m3-max-5785): the exported semaphore crosses to a second
device both ways, event/interop/keepers 40/40; RADV 780M (m3-max-5593) 41/41; lavapipe
(m3-max-5558) refuses as documented; clippy plain and cpu-icd, api_signatures, api_surface.
Re-pinned; REFUSALS and signatures already in the picks.
The cross-device test asked vk_wait(5) for a counter after the signal of 5 completed, and
vk_wait answers Reached there (no wait needed), so the test panicked on RADV (m3-max-5557)
before it reached the import. It now reads the counter value through the second device before
and after the runtime's signal, and holds it to the runtime's own semaphore's value.
Verified: the device runs follow (RADV on um870, lavapipe on gem10).
(cherry picked from commit eb5b10e81a9e5f6788d72a9c0c8b31e9af53d3f0)
The exportable shared event changed SharedEvent's public record to a pub(super) field so
exported_semaphore.rs could build one. event.rs now makes it (new_exported_shared_event) and
the export reads the event through EventRef, so the struct's record is development's again.
The table's one other line moves into the sorted order the bless writes.
Verified: signatures.py --check passes on this tree; build and tests in the next check job.
(cherry picked from commit 0d101500fc75bcb19b2385c213a07a553d58e8ed)
reims's ask 2: CUDA signals the event's semaphore on the GPU after a decode
(cuSignalExternalSemaphoresAsync), and waits on it, where it now orders
through the host.
Device::new_exportable_shared_event() makes a shared event as
new_shared_event does, its timeline semaphore made with
VkExportSemaphoreCreateInfo naming VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT;
SharedEvent::export_semaphore_fd() answers a new OwnedFd each call
(vkGetSemaphoreFdKHR), the caller's to close. An event not made exportable is
refused Invalid(Problem::NotExportable). The counter stays the signal index
the interop hooks name: the importer waits for vk_wait's counter and signals
only one reserve_vk_signal reserved; that call's contract now names an
importer's signal beside the device's queues.
The device decides structurally, once: it enables VK_KHR_external_semaphore_fd
wherever listed (adopted: where its consumer enabled it), and asks
vkGetPhysicalDeviceExternalSemaphoreProperties for a timeline semaphore:
OPAQUE_FD exportable and among the compatible types. Lacking either, the
making is refused NotImplemented(RuntimeGap::ExportableSemaphore), with its
REFUSALS row. Lifetime (the event outlives every import and every signal and
wait an importer submitted) and device loss (state lost for the imports; a
device made again exports new semaphores) are in the call and module docs,
interop.rs and the README. api_signatures blessed; exit_guard's KEEPERS
lists exported_semaphore.rs.
Test (device, src/tests/exported_semaphore.rs): the semaphore imported into a
second VkDevice; a command buffer's signal of 5 reaches vk_wait(5)'s counter
there; the second device's host signal of the counter reserved for 9 raises
the event to 9 and releases a command buffer that waited for 9 and then
filled a buffer. Unverified at this commit.
(cherry picked from commit 525580c12be28e6efa0a06ab09cde1f736ebace7)
587 recordings moved, measured on the M3 (cost --runs 8 --write over the whole set, then
--alone --write over the changed cases; gate tree commit bc975c20ab).
Gated bounds that rose, by family:
- fills_recorded / commands_recorded.cmd_fill_buffer (20 / 14 cases, from 0), fills_by_transfers
gone: fills on MoltenVK are vkCmdFillBuffer again (82e7c74f89). Contrast: surface's whole-set
replay at ac0310c517 (m3-max-5712), 20 overs, all fill counts.
- per_state pipelines 3 -> 6 in xr-masked-bgr10xr-red and -srgb-red: the old records came from a
36-case selection, whose take-back lands on another case than the whole set's (surface: 11
whole-set processes read 4/6/3 at 064e7a8e88 and b50a345f73).
- scheduler_sleeps / scheduler_passes / scheduler_wakes_host / wakes_spared, +1 to +3 in 13-50
cases (and as many fell): not separated from the 103 runtime commits since the last write
(5b64b8b425); each was steady over 8 runs in both writes.
- object_churn evictions and destroys (buffers 37 cases, images 8): the recyclers evict what was
parked past a second of wall time, so these follow how long each case and its predecessor ran.
- pass-bytes-srgb-decode-all-bytes: vk_memory_allocations 11 -> 131, vk_memory_freed 8 -> 128, in
the set and alone. Attributed by reading, not contrasted: the case is the first to make a
texture over host pages, where the device's one-time in-place check runs, and that check's
fresh-pages class runs wherever the device takes fresh pages since ff631aada9.
- A handful of single cases otherwise (xr-gamut images and buffers recycled, two-plane-row-blits'
spare pools): not separated.
(cherry picked from commit bc975c20ab1070a167570946d4112789a7ef4251)
tests::recycle::a_burst_of_one_off_makings_keeps_the_proven_image failed once in 13 RTX 5080
runs (b5080 m2v-orch-dv-rt2-140644 at 5f334c5204: 'the texture took a parked image' 0 vs 1): its
64 one-off makings took longer than the images' park time (recycle::IMAGES, a second), so the
proven image went stale before the take, as the bounds say it goes. The test now times the take
from just before the proven image's park; a try whose take came past the park time is made
again (at most 3, one-offs of widths no earlier try made), and the last try asserts it came
within it. Bounds::parked_for is crate-visible for that. Re-pinned (recycle.rs's field); no
behaviour changes.
amdperf's 003382bdc9 (cherry-picked): on a device that pays per listed import (RADV), an 8 GiB
guest RAM is listed in 16 chunks at most. RADV 780M (um790, m3-max-5738, release, 2 rounds, 8 GiB
in 2 MiB pages): submit p50 23.3/23.0 us at 512 MiB chunks against 32.1/32.0 at 256 (10.3/11.4
with none listed); reims's 5584: QEMU Rss over no RAM to RADV +0.45 GiB at the desktop against
+0.94 at 256 MiB. Lint at its base on um790 (m3-max-5742): clippy plain and gpu-cfg runtime, fmt,
tests::fast_paths 21/21.
On a device whose held imports add to the cost of every submission (RADV), a guest RAM's chunks
now run up to 512 MiB. reims's 16 GiB guest on the Radeon 780M (their job 5584, two boots of each
setting) had less of QEMU's RAM resident with 512 MiB chunks than with 256 MiB ones: 0.45 GiB more
than without the source at its desktop against 0.94 GiB, and 0.15 against 0.25 GiB at the end of
its run, with at most 11 to 12 chunks live against 15 to 18. The probe's per-submission cost falls
too: an 8 GiB RAM's submission median was 32 to 33 us in 32 chunks of 256 MiB and 24 us in 16 of
512 MiB (job 5411).
LONGEST_LISTED_CHUNK, the module and use_host_ram docs, HOWTO, the FAST-PATHS row and the
chunk-length probe (now up to 512 MiB) say 512 MiB.
(cherry picked from commit 003382bdc921fa8e7901fa00c7896f29439d7907)
`judge` holds a case's in-set counts to their bounds only in a whole-set run, because a case's
counts are of what ran before it in the process; the README already says a bound is written from
a whole-set `cost --runs 8 --write` and nothing smaller. The command still wrote from any
selection, and the re-record of the 36 cases the interlocked split moved (m3-max-5515: "8 run(s)
of 36 case(s)") wrote a composition the gate never runs: `xr-masked-bgr10xr-red` at 3 pipelines
over its 2 states and `xr-masked-bgr10xr-blue-green` at 6, where the whole set reads 6 and 3 in
every run (11 whole-set processes, the record's commit 064e7a8e88 and b50a345f73, debug and
release, settled 0 to 1000 ms after each xr case: no timing moves it; the released variants the
next creation takes back are another case's in the whole set). The gate's cost --check failed six
xr-masked rows on it.
`cost::write_refusal` now refuses an in-set write of anything but the whole case set, before the
runs; `--alone --write`, whose shape no selection changes, writes from any. Tested by
`an_in_set_write_takes_the_whole_case_set_alone`. The six xr-masked records want a whole-set
write, which the M3 cost re-bless after the fill change makes.
(cherry picked from commit 36340ebbb21c0cf35872defe5ce7549f45c6012c)
Lands steelbrain/orch-stitched-copies (cherry-picked a779b1824a..c5192a2cae):
- a commit's copy in asks only the copies its command buffer's used keys reach (every copy where a
command may reach memory no use names); merge back was already by written keys;
- a few changed pages find the bytes they meet in a copy stitched from thousands of runs through
an index of the runs by offset, not a walk of every run;
- a copied host buffer reads the caller's pages before it maps its own memory, so a mapping the
runtime makes cannot fill an unmapped page of the caller's and make a buffer Metal refuses.
Verified, release, gem10 (m3-max-5734), the stitched bench (512 copies x 640 runs, 1280 MiB),
base 018900246e vs fix, medians of 15, 3 alternating rounds:
0 pages written: 0.224 ms -> 0.003 (8 copies used) / 0.031 (every copy reached)
16 pages written: 1.21 ms -> 0.005 / 0.266
256 pages written: 2.37 ms -> 0.039 / 2.23
4096 pages written: 6.19 ms -> 0.156 / 6.0
Lavapipe (ms01 m3-max-5735): copied, dirty, host_ram_copy, host_memory, degrade_notices 154/154.
M3 (m3-max-5724): host_memory's half-mapped refusal 0 failures in 20 (it failed before the fix).
The read-first fix (3c2a300aed) left CopiedBuffers::add_reading, the read and the add together,
used by tests alone (a dead-code error in the library build), and the dma-buf mapping's test
calling add's old signature (gem10 m3-max-5722: E0061, E0599). The helper is the tests' own now,
over FirstRead::of (crate-visible), and the dma-buf test reads through CopiedBuffers::read, the
path buffer_descriptor takes.
(cherry picked from commit cc30dc3e9e916d37cbd42214e1bb4fcab30c5837)
Both copied-buffer makings (Device::copied_pages and copied_buffer) made and mapped the copy's
memory first and read the caller's pages after (CopiedBuffers::add). Where a page of the
caller's range is not mapped, the copy's own mapping could land there, the read find every
byte mapped, and the call make a buffer over memory Metal makes no buffer over. On the M3 Max
runtime_lane::host_memory::memory_metal_makes_no_buffer_over_is_refused_when_it_is_made made a
buffer over a mapped page and an unmapped one in 7 of 20 runs (m3-max-5626); with the test
seeing the page mapped again and trying again over a fresh reservation (da25c0efad), the
retried runs failed on the failed import each try adds (m3-max-5693), the bug itself still
hidden.
CopiedBuffers::read now takes the first read (FirstRead: the snapshot and whether the GPU's
writes are dropped) before either making allocates, and CopiedBuffers::add registers the copy
from it. The test bounds the failed imports by its tries made again.
(cherry picked from commit 3c2a300aed4721dad94c3e682e83075a4f5cca1d)
A match on the state's guard held it through the arm that locks the command buffer's dirty
log (a temporary of the scrutinee lives to the match's end).
(cherry picked from commit c5cbebbec0a0c5c61b761cecd5336a55645d6400)
runtime_lane::host_memory::memory_metal_makes_no_buffer_over_is_refused_when_it_is_made failed
7 of 20 runs on the M3 Max at d65be37964 (m3-max-5626, 'a mapped page and then one not mapped:
a buffer was made'): the test unmaps a page and then asks for a buffer over it and the page
before it, and another thread's mapping can land in the page just freed before the making
looks, so every byte is mapped and the buffer rightly made.
The case now runs in a reservation of its own: where a buffer is made and its second page is
mapped again (msync answers), the try is dropped and made again over a fresh reservation, at
most 8 times; a buffer made over a page still unmapped fails the test as before. Each answer
says how many tries were made again.
(cherry picked from commit da25c0efad3dfaeb78e50fffe82f7e50e3da8c5b)
reims-vgpu's 5080 game probe past its views' budget (512 copies of stitched views) spent
65% of its CPU in its dirty logs' queries, which every commit's copy in made for every
logged copy (about 110 commits a second, about 6 ms each, every copy's own log walked:
m3-max-5561's profile). A command buffer's GPU reaches only the resources its commands use,
as Metal's does, so the copies the others lie in need not be current for it.
DirtyCommit now keeps the keys its commands used, read or written (at most 4096, past which
every copy), beside the writes it kept; the commit hands them to CopiedBuffers::copy_in
(copied::Written, which named the merge back's writes, is CopiesReached, the key set both
take). A copy its commands do not reach is neither compared nor asked of its logs, and keeps
the stamp it last synced to, so the first commit that uses it takes every write since. Every
copy is copied in where the command buffer's uses went unnoted or a command may reach memory
no use names (a function that reaches buffers through addresses, work on the GPU alone, a
host step's records: State::reaches_unnamed). Shadows' copies in from a copy are commands of
their encoder, their uses noted with the copy's key, so a texture over a copied buffer
reaches its copy. Counted: WorkCounts::copied_copy_ins_unused.
The copied-host-pages notice and API.md's catalogue say which copies a commit compares.
tests::copied::a_commit_copies_in_only_the_copies_its_commands_use: a copy left alone keeps
its bytes, the first commit that uses it takes every write since, and every copy where one
may reach anything. copied_stitched_bench times a commit that uses 8 of 512 copies beside
one that reaches every copy.
(cherry picked from commit bc9f3f5ec63504fce3d8f89eb49110099b2b45ab)
A logged copy's copy in maps its log's changed runs into the copy's bytes at each commit
(PagesLog::bytes_of, copied.rs planned). It walked every run of the copy's bytes with a
binary search of the changed runs each: a copy of a view stitched from 640 4 KiB runs of a
guest RAM cost 640 searches per commit whether one page changed or none, and 512 such
copies (reims-vgpu's 5080 guest past its views' budget) 327,680 per commit.
LogOf now keeps its runs' indices in the order of their first offsets and the longest
run's length. Where the changed runs are fewer than the copy's runs, each finds the runs
it meets from them (a binary search, then the runs starting before its end), so the work
follows the pages changed; else every run is walked as before. Runs may overlap in the
source (a view mapping one page twice): the longest run bounds how far below a changed
run's start a run that meets it may begin. The caller joins the bytes, so their order
does not matter.
tests::dirty_bytes_of checks both walks against every pair of pieces and changed runs
over a window of scattered pieces of one to three pages, one page twice.
(cherry picked from commit 9506f4511ec196878647501fa4d8ca93b8137f31)