What: a_fill_is_recorded_at_its_call waits for the device's queue-switch check
(settle_queue_switch_check, 120 s) after making its command queue and before it counts, as the
other tests that read commands_recorded do (fill_waits, fill_queue, draw_again).
Why: the test's expectation went stale at RUNTIME_VERSION 2089 (24f233db8b). The check's rounds
now open their gate on the GPU with a vkCmdFillBuffer of the check's scratch buffer, recorded on
the check's thread, and WorkCounts::commands_recorded counts every command of the device whatever
the thread (its contract). The test counts all of the device's fills, so a check whose opening was
recorded between the test's fill and its commit read as "the fill recorded again": the RTX 5080's
runtime suite at pin 45 (m3-max-19738) saw 1 at the call and 2 after the commit.
Verified on the RTX 5080 Laptop GPU (NVIDIA 615.71.09), b5080 batch m3-max-19866, with a scratch
probe that counts the device's fills from before its first command queue until its check settled,
the program recording none: 0 at pin 44 (bf442ceb9e + the probe) and 1 at development 9768c1b352
(+ the probe), the check's verdict Idles at both. In that batch this commit's test passed (fills 1
at the call, 1 after the commit). The failure itself needs the check's recording to land inside
the test's window (it did under the suite's load); the unsettled test passed alone in the batch,
as it did in the other devices' suites.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The ledger's copied-buffer rows (FAST-PATHS) and copied.rs's Cost bullet quote
the copied_bench and copied_pass_bench figures measured while a comparison ran
on up to four threads; it now runs on up to eight, so they say so, in the past
tense, rather than read as the eight-thread cost. The two FAST-PATHS rows are
rewrapped to 100 columns (one line ran to 130).
No behaviour change; no figure is new.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commits before this one. A batch on another VkQueue waited on the GPU for every batch that did new
resources' first work (image first moves, staged texel copies, fills at a batch's start) until it
completed. Each such batch is now kept with what owns the memory its work wrote, and a batch waits for
it only where its commands may reach that memory (its uses name it or make it resident; a command
reaches unnamed memory, the root table or work recorded on the GPU alone; or the owner is unknown, the
device's own resources) or where the first work it took lies in that memory. Internal submissions still
wait for every one. On every device. Counted: WorkCounts::first_work_waits and first_work_waits_unused
(the conformance cost SUBMISSION group lists first_work_waits).
Measured, RTX 3090, release, one run (m3-max-19766), a compositor's frame p50 beside an app on another
queue:
- app making two 1024x1024 Private textures per command buffer: 17.07 -> 2.06 ms (2.10 with nothing
made); waits on unused first work per 4 s 247 -> 0;
- making buffers and textures: 12.07 -> 2.00 ms;
- a device with no fill queue: buffers 16.51 -> 2.12 ms (unused 231 -> 0), textures 17.07 -> 2.06 ms.
Test: tests::fill_waits::a_batch_that_reaches_no_new_texture_waits_for_none_of_its_first_work saw 16
unused waits before (fail), 0 after. The zero-read test now holds a heap texture and a plain Private
texture whose moves are taken behind a long load on another queue: both read what was written. 23/23
zeroed_start / fill_queue / first_move tests on the 3090 (19766), lavapipe 26/26 touched (19767), lint
19732. Not run: the 5080, RADV, Intel, MoltenVK.
Job m3-max-19766, one before/after on the RTX 3090 (before: c76b6d619a's code, every batch waiting for all of it; after: 22064bea33). tests::fill_waits_bench, the compositor's frame p50: app making textures 17.07 -> 2.06 ms (247 -> 0 unused waits in 4 s), buffers and textures 12.07 -> 2.00 ms; on the device made with no fill queue, buffers 16.51 -> 2.12 ms (231 -> 0), textures 17.07 -> 2.06 ms. tests::fill_waits::a_batch_that_reaches_no_new_texture_waits_for_none_of_its_first_work: 16 unused waits before (fails), 0 after (passes); zeroed_start, fill_queue, first_moves and first_move: 23/23 after.
A batch on another VkQueue waited on the GPU for every batch that did new resources' first work until it completed, whatever it used: on the RTX 3090 a compositor's one-dispatch frame took 17 ms (p50) beside an app making two 1024x1024 Private textures per command buffer, against 2.1 ms with nothing made (tests::fill_waits_bench, job m3-max-19457), and so for new buffers' fills at a batch's start on a device without a fill queue. Now it waits for those whose work wrote memory its encoders' uses name or make resident, every one where a command may reach memory no use names or where the work's owner is unknown, and those whose memory its own first work lies in, which comes after theirs. Internal submissions still wait for every one. Evidence to follow in the next commits' jobs.
Each batch that did new resources' first work (images' moves, staged copies into them, fills at its start) is now kept until it completed with what owns the memory that work wrote: the owner under the image's key, the staged copy's image key or the fill's key (used_resources::owner_of), learned at the take on every device (FillTake::Owned where the device has no fill queue). WorkCounts::first_work_waits and first_work_waits_unused count the batches that waited for such work, and those whose commands and own first work reach none of it. Every batch still waits for all of it; the narrowing follows. tests::fill_waits gains a_batch_that_reaches_no_new_texture_waits_for_none_of_its_first_work (fails on unused until the narrowing), and the zero-reach test's textures are moved behind a long run of kernels on another queue.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commit before this one. When a command queue went long, its one move (queue_share.rs settle)
took the least recently used idle VkQueue whoever held it, so it could land on the VkQueue a
compositor had just moved to. Seen on the RTX 5080 (nv5080reg's run at 66942365f6):
a_compositor_beside_a_queue_waiting_on_the_gpu_for_long_work_keeps_its_latency failed with p99
21.52 ms, 128 stalls of 9467: at 37.0 ms the compositor left VkQueue 1 for idle VkQueue 2, at 37.2 ms
the waiter's move picked VkQueue 2 too, and the compositor sat behind its 30 ms waits until 103.3 ms.
settle now takes an idle VkQueue no command queue holds where one is, else the one the fewest hold,
least recently used among equals: the rule 2084 gave placement and unshared queues.
Test: a_long_queue_settles_on_an_idle_vk_queue_no_command_queue_holds_before_a_held_one fails on the
old rule (m3-max-19728: left Some(2), right Some(3)); queue_share pure tests 9/9 (19727); clippy plain
(19752) and m2v_gpu (19753). Not run with the fix: the device test on the 5080 or the 3090.
Also landed (no behaviour change): examples/queue_plan_cost.rs gains --rooms, --runtime-rooms,
--runtime-fill and --overlap, and made_within_resources' doc says why a refused device takes its least
plan at once. Stepping down (18, 11, 7, 3 VkQueues) was measured against it: on the RTX 2080 eGPU it
made one device of 11 queues instead of 3 and two more devices refused (12 vs 14 made; 19615/19616);
on the 3090 it changed nothing and added 0.42 s to the device that took 3 (19620/19622).
A long queue's one move (settle) took the least recently used idle VkQueue no long or unshared
queue held, whoever else held it. On the RTX 5080 Laptop GPU (nv5080reg's run of
a_compositor_beside_a_queue_waiting_on_the_gpu_for_long_work_keeps_its_latency at 66942365f6) the
waiter queue went long on VkQueue 1, the compositor left VkQueue 1 for idle VkQueue 2 at 37.0 ms,
and the waiter settled on VkQueue 2 at 37.2 ms: the compositor sat behind its 30 ms waits again
until 103.3 ms, 128 samples over 10 ms in the 2 s window, p99 21.52 ms. settle now takes, of the
idle VkQueues no long or unshared queue holds, one no command queue holds where one is (else the
one the fewest hold), least recently used among equals, as placement and unshared queues do
since 2084.
Test: a_long_queue_settles_on_an_idle_vk_queue_no_command_queue_holds_before_a_held_one (the
compositor's VkQueue used longer ago than an empty one: the old rule took the compositor's).
Verified: cargo fmt; tests and the device repro in the following jobs.
made_within_resources now says why it takes the least plan at once rather than plans between: on a
GPU out of channels, what one refused device takes the next is refused. Measured with
queue_plan_cost --runtime-fill (one runtime device per process) at RUNTIME_VERSION 2084 against a
step-down branch (steelbrain/queuestep a595a24225: round robin halved on each refusal, 18 then
11, 7 and 3 VkQueues):
- RTX 2080 (Thunderbolt, 620.70.06): least at once 11 plan + 3 least devices, the 15th refused
(m3-max-19615); stepping down 11 plan + one of 11, the 13th refused (19616).
- RTX 3090 (620.70.06): 58 plan + the 59th least either way; stepping down added 0.42 s to the
59th (1111 vs 688 ms) and 0.21 s to the refused 60th (612 vs 398 ms) (19620, 19622).
- Refused vkCreateDevice of 7 to 15 VkQueues beside 12 runtime devices on the RTX 2080: 237 to
270 ms each (19639, --runtime-rooms).
The example's overlap phase docs no longer speak of steps.
Verified: cargo fmt; the numbers are the jobs named.
For the plan's shape and each step a refused device takes (16+2, 9+2, 5+2, 1+2 on NVIDIA), K
processes make one device each at the same moment: each vkCreateDevice's time and the time until
all K were made, as when every device of a GPU is made again at once after a device loss. Asked
for by the orchestrator alongside the step-down measurements.
Verified: cargo fmt; built and run in the next jobs.
Device::system_default_with returns the live device of equal options, so the runtime fill child
made one device per process and held five more handles of it (job m3-max-19562, on the RTX 2080:
0 ms for each after the first). Each device of a child now takes a shader cache directory of its
own. The runtime rooms phase holds N runtime devices and probes which bare queue counts the driver
still makes beside them: on the RTX 2080 a runtime device holds more than a bare device of its
queues (66 bare devices of 3 queues left room for 18; the 12th runtime device was refused 18).
Verified: cargo fmt; built and run in the next jobs.
The rooms phase holds K devices of the plan's shape and N of the least
plan's, then asks for a device of every graphics-family count from the
plan's down to one, timing each vkCreateDevice: which queue counts the
driver accepts beside what is held, and what a refusal costs. The
runtime fill phase fills the GPU with the runtime's own devices, each
printing its make time and the VkQueues it took. Both measure the step
down from a refused queue plan; neither runs unless asked.
Verified: cargo fmt; built in the next job.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commits before this one. On a device with a fill queue (NVIDIA, 2074), every other submission
waited on the GPU for the fill queue's last fill until the host saw it complete, fills it never
touched included. A batch now takes and waits for only the fills of memory its commands may reach:
memory its uses name or make resident; everything where a command reaches memory no use names, or
where it took a move in another resource's memory or a staged copy; and the device's own buffers.
Internal submissions still wait for the fill queue's last submission; other devices take every fill
as before. Counted: WorkCounts::fill_queue_waits and fill_queue_waits_unused.
Measured (release; a compositor's one-dispatch frame while an app on another queue makes two 4 MiB
Private buffers per command buffer):
- RTX 3090: p50 9.0 -> 2.10 ms (2.10 ms with nothing made); frames that waited for fills they never
use, per 4 s, 424-429 -> 0 (m3-max-19457).
- RTX 5080 Laptop: p50 13.2 / 7.5 -> 1.18 ms (1.18-1.36 with nothing made); unused waits 288 / 430 ->
0 (b5080 fillq-ab-233804, batch m3-max-19646).
Shared texture makings wait for no queued fill: p50 <= 0.011 ms, max 1.33 ms, both GPUs.
Test: tests::fill_waits::a_batch_that_reaches_no_new_memory_waits_for_none_of_its_fills saw 8 unused
waits and failed before the fix, 0 after (3090 19457, 5080 19646); zero-reads passes (19739);
zeroed_start / fill_queue / first_move tests 22/22 on both GPUs; lavapipe 24/24 touched (19668);
lint 19638, rustdoc 19732. Not run: RADV, Intel, MoltenVK (no fill queue there).
State::reaches_unnamed is set by root tables, work recorded on the GPU alone and records resolved by host steps; a render encoder's handle-table reads set only that encoder's own flag (linear attachments). What a handle reaches is what Metal asks the program to make resident (useResource, useHeap), which the uses' check reads (used_resources::names_any). Docs only.
tests::fill_waits_bench on the RTX 3090 (job m3-max-19457): beside an app making two 4 MiB Private buffers per command buffer, the compositor's frame p50 went from 8.96-9.01 ms (every batch waiting for the fill queue's last submission, 424-429 unused waits in 4 s) to 2.10 ms (0 unused), as with nothing made (2.08-2.12 ms).
ob2_loaded_pointer stores tid | 0xb0000000 into the words its indices 8 to 15 name. They named words 8 to 15 of the new buffer, which the copies on the other queues read in no order with that kernel, so the test failed 6 of 10 runs on the RTX 3090 with the code before the narrowed take and 9 of 10 with it (job m3-max-19536): a race in the test, not the runtime's zeros. The copies now read the first half alone, and the stores go to the second.
On the RTX 3090 the code before the narrowed fill take (8c8dbec6b5) failed this test at its first batch's read (job m3-max-19457); the message now says which reads saw what, so a failure tells a late fill from another writer.
The app makes, by phase, nothing, two 4 MiB Private buffers, two 1024 x 1024 Private textures, or
both, before each command buffer; each phase ends with ten 1024 x 1024 Shared textures made while
the app's work and its fills are queued, their makings' host times printed. Texture moves are the
other first work a batch takes whatever it names, and a Shared texture's making is to wait for no
queued fill: the phases measure both.
Verified: cargo fmt. Runs follow as potluck jobs.
On a device with a fill queue (NVIDIA's copy engine), a batch took every fill waiting, whichever
buffers its commands name, and every submission of the device's waited on the GPU for the fill
queue's last submission until the host saw it complete. A fill-queue submission waits for the
batches before its batch on that batch's VkQueue, so a compositor's frame that named only old
buffers waited for an app's new buffer's zeros behind the app's kernels, or made them itself and
waited for its own queue's last batch first.
What, on such a device:
- A batch takes the fills of memory its commands may reach (FillTake::Reached): memory a resource
its encoders' uses name owns (used_resources::owner_of over Owners and HeapKeys: the buffer, or
the heap it lies in); every fill where a command of it may reach memory no use names
(State::reaches_unnamed, State::parts_reach) or where it takes a move of an image in memory
another resource owns or a staged copy (Taken::every_fill), which come after every fill of that
memory; and the fills of the device's own buffers, which no use names. The rest stay waiting, in
their order, for a batch that may reach them or an internal submission, which takes every one.
A fill's key is noted as it is registered (Filled::key), and its owner as it is taken, so a
buffer's fills share their turn.
- A batch waits on the GPU for the last fill-queue submission the host may not have seen complete
whose fills it may reach (Device::fill_queue_wait_for), where its VkQueue did not already.
Internal submissions still wait for the fill queue's last.
- A command buffer that needs no GPU work goes with no submission where nothing waits but fills of
the program's memory (FirstMoves::none_waiting_but).
Other devices take every fill, as before.
Tests: first_move::a_batch_takes_the_fills_of_memory_it_reaches (pure); fill_waits (device) holds
fill_queue_waits_unused at 0, where the commit before counts the compositor's waits.
Docs: device/staging.rs and texture/first_move.rs module docs, the runtime README, FAST-PATHS'
fill-queue row.
Verified: cargo fmt. Builds, device runs and numbers follow as potluck jobs.
Every batch and internal submission waits on the GPU for the fill queue's last submission until
the host saw it complete (device/staging.rs), and a batch takes every fill waiting, whichever
buffers its commands name. Neither is counted: nothing says how often a batch waits for fills its
commands never use.
What: each fill notes what owns the memory it writes (Filled::owner: the program's buffer, kept
by its key among the device's owners, or the heap a buffer is placed in or whose own buffer it is;
None for the runtime's own buffers), each fill-queue submission keeps them until the host saw it
complete, and a batch that waited on the GPU for its own fills or another's is counted
(WorkCounts::fill_queue_waits), and counted again where its commands reach none of that memory:
no resource its encoders' uses name owns it and none of its commands may reach memory no use names
(WorkCounts::fill_queue_waits_unused, State::parts_reach). No wait changes here.
Tests: fill_waits (a compositor's batches beside an app that makes a new buffer each round, and
new memory read by name, through a loaded pointer and as a heap's texture) and the release bench
fill_waits_bench. fill_waits' count assertion fails on a device with a fill queue until the next
commit narrows the waits: it is the negative control.
Verified: cargo fmt; api_signatures.tsv blessed. Builds and device runs follow as potluck jobs.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
A state of a NaN lodBias failed the debug check that a stage table brought
in place reads as the table read whole (argument_table.rs check_reading):
the bound sampler carried the state's descriptor with its NaN bias, which
== takes for unequal to itself. The M3 MoltenVK run of
runtime_lane::lod_bias panicked there (potluck job m3-max-19703).
The state samples every level as with no bias (Metal's answer on Apple9,
measured on the M3 Max, macOS 27.0.1), so taken_descriptor now gives the
descriptor a state samples with a bias of 0. Every bound sampler, bind memo
and kept execution then compares as for an unbiased state; the SamplerKey
still keys by the request's bias, so a state of another bias stays another
state. same_as_printed compares the bias as it prints, like the clamps, and
the field-list guard in tests/argument_table.rs names lod_bias.
Tests: tests::sampler takes ten biases (signed zero, ±16, 100, MAX, NaN,
the infinities) to the unbiased taken descriptor, normalized and pixel;
tests::argument_table pairs biases of opposite zero signs, NaN payloads
and NaN against 0. Device runs follow.
The runtime lane test for a sampler's lodBias called new_library_with_air
without the AirLibrary trait in scope, so the validation crate's test build
under --cfg m2v_gpu failed with E0599 (potluck job m3-max-19692). Import it
as the sibling mip_levels and kernel_lod modules do.
Verified: the M3 gpucfg build failed with exactly this error; the rebuild
follows.
SamplerDescriptor gains `lod_bias: f32` (MTLSamplerDescriptor.lodBias,
default 0, serde default), so a guest's bias is carried rather than
having no field to land in.
What Metal does with it, measured on the M3 Max (Apple9, macOS 27.0.1
26A434) with a throwaway Swift probe of runtime-compiled MSL (jobs
m3-max-19665/19666): level L of a 7-level texture held L, so every
sample read its own level of detail. Across 136 row groups no sample
changed with the sampler's bias: fragment implicit, shader bias(),
level(), gradient2d(), min_lod_clamp() and bias+min_lod_clamp; kernel
default, level, gradient and bias; linear and nearest mip filters on
float textures, both on uint ones; a NotMipmapped sampler's min/mag
choice; clamps [1,3], [1.5,MAX], [0,2]; biases -1000 to 1000, 15.99,
16, 16.5, 17, NaN, +-inf. The probe saw levels move with the shader
bias, the clamps, explicit levels and the NotMipmapped filter switch.
With MTL_DEBUG_LAYER=1 every value made a sampler with no assertion and
read back as set. Apple's tables list the bias under Apple10, which no
runtime device claims.
So the Vulkan sampler's mipLodBias stays 0 whatever the descriptor
holds: no bias is past maxSamplerLodBias, and none needs a portability
subset's samplerMipLodBias. The binding shape and the sampler word do
not carry it either. The runtime's state key does: on the M3 (job
m3-max-19683, with and without validation) biases 0 and 1, 1 and
1.0001, and 20 and 30 gave two states each, while 0 and -0, and two
NaNs of one encoding, gave one. The key takes the bits of `bias + 0.0`.
The Apple10 family row stays a gap, its reason now that the biased
level of Apple10 is not built. The conformance suite's SamplerSpec
states the bias too (tag 8, a word only where it is not 0, so no
recording's fingerprint moves), and both legs set it. METAL-COVERAGE
lists lodBias as implemented; CONFORMANCE-COVERAGE and the API
signature table are regenerated.
Tests: metal::sampler::a_lod_bias_makes_the_unbiased_sampler covers
every committed profile, every mip filter, three filter pairs and four
uses plus the unnormalized one, and 15 biases: the Vulkan sampler and
the binding shape are the zero bias's. That includes MoltenVK, which
withholds samplerMipLodBias, and biases past every device's limit.
runtime_lane::lod_bias::a_sampler_s_lod_bias_reads_the_unbiased_level
runs a kernel's biased samples through runtime sampler states of ten
biases, under linear and nearest mip filters, and compares them bit for
bit with the unbiased state's. It also checks the state-sharing rule.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
The commits before this one. On the RTX 5080 a guest's Shared no-copy buffer is a copied host buffer
(NVIDIA imports no such pages), and reims attaches no dirty log, so every commit compared the whole
copy: a copy-in with no base ran on one thread (a 256 MiB kernel-read pass spent 27-31 ms committing
against 10 ms of GPU time), and the merge back after a kernel's writes on at most four. A copy-in with
no base now splits across threads as one with a base does, a block that differs is stored whole,
splitting starts at 4 MiB (was 16), and the cap is eight threads (was four).
Measured (RTX 5080 Laptop, release, b5080 entry nvcopybw-nvcopybw-5080-ab-234252, batch m3-max-19706),
a kernel reading a 256 MiB copied buffer: 6.5 -> 12.3 GB/s at four threads (commit 30.8 -> 11.2 ms),
14.1 GB/s at eight; 64 MiB 7.1 -> 11.2 GB/s; CPU writes then a read of 256 MiB 2.0 -> 6.6 GB/s (9.0 at
eight). A guest benchmark read 4.4 GB/s here before; the Metal oracle (Radeon Pro 5300M) reads 6.1.
Kernel writes unchanged at 4.8 GB/s at four threads. The 3090 before/after is m3-max-19454.
Test: tests::copied::a_copy_in_with_no_base_splits_across_threads_and_answers_as_one_thread_does fails
at 28bce80c63 and passes after (m3-max-19343). Bench: tests::copied_bandwidth_bench (ignored).
Lint and lavapipe at the branch tip (m3-max-19729) ride the checks after landing.
A copy's comparison of 4 MiB or more (a commit's copy in with no base, whose
pages carry no log, and a comparison with a base) ran on up to four threads, the
calling one among them. On the RTX 5080 Laptop GPU's host (a Core Ultra 9
275HX) eight cut the commit of a kernel-read pass over 256 MiB from 11.2 to
8.4 ms (12.3 to 14.1 GB/s), 64 MiB from 2.9 to 2.2 ms, a copy in after the CPU
rewrote every float of 256 MiB from 30.3 to 17.0 ms (6.6 to 9.0 GB/s), and the
merge back of a 256 MiB kernel-write from 65 to 41 ms with the stores of
27c4a1ae46 (copied_bandwidth_bench's copied-t8 rows at 31333d4bf4, b5080
entry nvcopybw-nvcopybw-5080-ab-234252); on the RTX 3090's host (a Ryzen 7
7840HS) the 256 MiB kernel-read commit from 14.0 to 11.9 ms and the 64 MiB
kernel-write merge back from 11.2 to 8.8 ms (m3-max-19454). A host that runs
fewer threads at once runs that many.
SPLIT_THREADS is now 8, so a device's comparisons (one at a time under its
copies' lock) hold at most seven more threads at once. The bandwidth bench's
contrast row is now four threads (copied-t4); copied_256_bench_eight_threads,
which measured what is now the default, is gone. Docs say eight.
Tests: run after this commit (copied tests on a host without AVX-512, lavapipe).
27c4a1ae46 made store_masked sixteen byte stores, each not set aimed at the
stack, to take no branch on the mask. On the RTX 5080 Laptop GPU's host (a Core
Ultra 9 275HX, no AVX-512) it made the merge back slower, not faster: a 256 MiB
kernel-write pass's merge back took 65.3 ms against 38.1 ms with the branchy
stores, 64 MiB 21.1 against 9.3 ms, 16 MiB 10.5 against 4.4 ms
(copied_bandwidth_bench, two rounds interleaved with 28bce80c63 and d33e19bc70,
b5080 entry nvcopybw-nvcopybw-5080-ab-234252, batch m3-max-19706). On the
i9-13900H (ms01, m3-max-19305) it was 63.9-68.7 ms against 58.9-60.5 ms.
This restores the fewest stores of 8, 4, 2 and 1 bytes that write the set bytes
alone, and the docs that describe them. A host with AVX-512BW and AVX-512VL
never ran either form (its masked store).
Tests: the merge tests (a_merge_stores_each_byte_it_writes_and_no_other,
copied_comparisons_answer_as_byte_by_byte) cover it; run after the next commit.
The CPU-side counterpart of copied_bandwidth_bench's copied-t8 rows: bench_256
with copied::SPLIT_THREADS_FROM at 8, to measure on the hosts without a GPU
hold whether a copy's comparisons scale past the runtime's four threads.
A test-only switch, copied::SPLIT_THREADS_FROM, sets the most threads a
comparison runs on in place of SPLIT_THREADS (4) where not zero; split_threads()
keeps the host's count in its OnceLock and applies the switch on each call. The
bench adds a copied-t8 subject (a copy with no log, its comparisons on up to
eight threads) beside copied, copied-logged and own-shared, to measure whether
the merge back of a rewritten copy scales past four threads on the hosts of the
RTX 5080 Laptop GPU and the RTX 3090. Not run yet.
96009744c0 made each comparison prefetch the block a page ahead. On a Core i9-
13900H (homelab-ms01-1, job m3-max-19305: tests::copied_bench::copied_256_bench,
three rounds interleaved with the commits before it) the merge back of a 256 MiB
copy whose every float the GPU rewrote took 76.1 and 76.9 ms with it, against
63.1-68.7 ms without it and 58.9-62.4 ms before 27c4a1ae46; the copy in of an
unchanged copy did not move beyond the rounds' spread. Sixteen prefetches a block
on each side compete with the comparison's own reads for the line fill buffers,
and the host's prefetchers already follow the comparison's runs.
SPLIT_BYTES, the fewest bytes each thread of a split comparison takes, goes
from 8 MiB to 2 MiB. A merge back runs about 1.75 GB/s a thread on the RTX 5080
Laptop GPU's host (copied_bandwidth_bench, b5080 entry nvcopybw-bw-before-222944),
so a 16 MiB copy the GPU rewrote merged back on two threads in 4.2-4.5 ms of a
5.4-6.4 ms pass (2.6-3.1 GB/s); a run of 2 MiB takes about a millisecond a
thread, against tens of microseconds to start one. The thread count stays at
most four.
Docs: HOWTO, API and FAST-PATHS said a comparison of a copy with a base of 16 MiB
or more splits; now 4 MiB or more, with a base or without (the copy in with no
base splits since d33e19bc70).
Tests: the split tests take 4 x SPLIT_BYTES (a_comparison_split_across_threads_...,
a_copy_in_with_no_base_splits_...), now 8 MiB. Not run yet.
A copy with no base is written by no committed command buffer (the first that
may write it makes one, after its copy in), and its copies in hold the copies'
lock, so nothing writes its bytes while a copy in compares them. Its bytes that
agree with the pages' can be stored as they are: that changes nothing a reader
of the copy sees. copy_in_run now copies a page that differs whole and counts
the bytes that differ, where it stored those bytes alone through merge_block's
partial stores: a CPU rewrite of a 256 MiB buffer's floats changes some bytes
of each, and its copy in took 96 ms on the RTX 5080 Laptop GPU's host
(copied_bandwidth_bench cpu-then-read, b5080 entry nvcopybw-bw-before-222944).
A copy with a base keeps byte-exact stores: a GPU batch in flight may write its
copy meanwhile.
Also the module's and merge_sse2's docs of the partial stores without AVX-512
(the previous commit's sixteen byte stores).
Tests: copied_comparisons_answer_as_byte_by_byte's steps with no base (the copy
equals the byte-at-a-time reference and the bytes counted are those that
differ), copied_copy_in_writes_the_bytes_the_cpu_changed_alone. Not run yet.
A merge back of a 256 MiB copy the GPU rewrote, on four threads, took 38 ms on
the RTX 5080 Laptop GPU's host: about 1.75 GB/s a thread, of which finding the
blocks changed (the copy's bytes and tags) and reading the pages' took 18 ms
(copied_bandwidth_bench's sampled phases, b5080 entry
nvcopybw-bw-before-222944). The host's prefetchers follow a run of reads only
within a page, and a comparison reads two runs (a block of each side) a block
of 1 KiB at a time.
Each comparison now prefetches (PREFETCHT0, x86-64 only) the block a page
ahead of the one it compares on the side it reads whatever the block holds (the
pages at a copy in, the copy at a merge back), and on the other side where the
block it compares changed; a copy in with no base prefetches both sides' next
page. A prefetch faults on no address and changes no answer.
Not run yet.
Where the host has no masked store of bytes (no AVX-512BW, as the RTX 5080
Laptop GPU's Core Ultra 9 275HX), a 16-byte piece of which only some bytes are
to be written was stored in the fewest stores of 8, 4, 2 and 1 bytes, a branch
on each 4 bytes' pattern. A GPU's rewrite of floats leaves some bytes of each
(the exponent's) unchanged in an unpredictable pattern: the store phase of a
256 MiB kernel-write merge back took 18 of its 38 ms on that host
(copied_bandwidth_bench's sampled phases, b5080 entry nvcopybw-bw-before-222944).
store_masked now makes sixteen byte stores, each set byte at its place in the
pages and each other into a block of the stack, the place picked with
select_unpredictable (a conditional move): still no byte not to be written is
stored, so a CPU write of a byte the GPU did not change is never stored over.
Tests: the existing merge tests (a_merge_stores_each_byte_it_writes_and_no_other,
copied_comparisons_answer_as_byte_by_byte) cover it on a host whose masked stores
are turned off (MASKED_STORES_OFF) or absent. Not run yet.
A copy the GPU only reads has no base, and a commit whose pages carry no log
compared its pages with it on the committing thread alone. On the RTX 5080
Laptop GPU's host (Core Ultra 9 275HX) that was 27 ms of a 51 ms pass of a
kernel reading a 256 MiB copied buffer (5.2 GB/s against 25.3 for a Shared
buffer of the device's own; copied_bandwidth_bench, b5080 entry
nvcopybw-bw-before-222944): the guest's bandwidth test reads such a buffer,
whose pages reims gives no log.
copy_in_untagged now cuts its bytes into runs of whole pages, at least
SPLIT_BYTES each, one for each of up to four threads, through in_threads (the
thread pool split() used, now shared by both). Each thread writes only its own
bytes of the copy, and the copies' lock is held throughout, as for a split
comparison with a base.
Test: a_copy_in_with_no_base_splits_across_threads_and_answers_as_one_thread_does
(copies of 4 x SPLIT_BYTES + 3 KiB + 5 bytes: the CPU's bytes in every run
copied in, those alone, no base, and copied_compare_threads > 0 where the host
runs threads at once; it was 0 before). Not run yet.
copied_bandwidth_bench (ignored, release, GPU cfg) runs one command buffer a
pass over a Shared no-copy buffer whose import the gate refuses (the copied
path an RTX 5080 takes for a guest's pages), at 16, 64 and 256 MiB: a kernel
reading it, writing it, rewriting it in place, a blit reading it and writing
it, the CPU rewriting it before a read, and the CPU writing a word of every
16th page before an in-place rewrite; over a copy with no log, one with a log,
and the device's own Shared buffer as the control. It prints GB/s and where a
pass's time goes: the commit and its copy in, the GPU's time, the merge back
and its reads back, the rest of the wait. A test-only clock in copied.rs
(copied::clock) times whole copies in, merges back and reads back, and the
phases of every 64th block a comparison looks at. Each copied row checks the
pages hold what the copy does.
Not run yet: this commit is the 'before' side of the measurement.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
posted_frees::a_burst_of_posted_frees_runs_paced failed once on Iris Xe
(ANV, ms01) in the pin 45 round's full runtime suite: "0 of the two
frees behind another waited first". The product's answer there was
right: step_aside::pace owes each free after the first as long as the
free before it took, less the time since it ended. A vkFreeMemory that
ends sooner than the free thread reaches its next pace (a quick driver,
the thread preempted under a parallel suite) owes nothing, and the
device's other threads already went between the frees. Nothing near
the free thread changed between pin 44 and pin 45 (free_thread.rs,
step_aside.rs, release.rs and allocations.rs are untouched in
bf442ceb9e..06fd49b221), so this is not a regression.
The test's expectation followed the device's speed and the host's
scheduling. Now the device tests can stand in for how long each block's
free takes (FreeThread::frees_take, step_aside::own_calls_take, both
compiled only under the device-test cfgs): OwnCall still records the
call at the free's door, so the stand-in is owed only where the free
thread's real paced path counts the free. Each free counts as taking
Duration::MAX, so each of the two behind another waits exactly
MOST_ASIDE: the test asserts 2 paced and 2 x MOST_ASIDE nanoseconds,
counted from after the first free's pace. The allocation-at-the-limit
test takes the same stand-in, so its "no free paced while the
allocation waited" is the hurry's doing rather than quick frees.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.