reims's per-pass diag (boot dd-1): the restarted window server draws
each icon's content in passes of many draws over a Private RGBA16Float
target loaded and stored, beside a fresh RG16Float second colour (Clear
or DontCare, stored DontCare) and a Stencil8, some draws fetching and
writing the second colour and some the first; then each bitmap is a
pass of one draw that samples the content into a texture over guest
bytes (Clear/Store) beside a fresh RG16Float and Stencil8 loaded and
stored DontCare. The test now draws that: the content pass adds a draw
that fetches and halves the first colour between the two coverage
draws, and the bitmap pass samples the content texel for texel into
the bitmap, which the CPU reads. The kept-second-colour form clears
every icon's second colour, as a driver's DontCare may keep the last
icon's there. Not yet run on a device.
The M3 run of the earlier form (m3-max-18721, all ten legs right) split
no pass for interlocked writes: its only fetching draw read the second
colour and wrote the first. reims's per-pass diag (boot dd-1) shows the
restarted window server's multi-draw passes interleave plain draws with
draws that read and write the RG16Float second colour. The pass now
draws the mark, con_fetch_coverage over the middle rows (reads colour 1,
writes both), the flag, con_fetch_coverage again, and a read of colour
1 over the bottom rows: each coverage draw leaves colour 1 out of its
subpass, so the pass splits around it. Not yet run.
Icons over a buffer's bytes or host pages with rows 64 bytes past their
texels, as a surface's rows lie: MoltenVK's linear image lays rows one
after another, so such a texture is shadowed (refused pitch), as the
guest's icons over its buffers were (host_texture_shadows_refused_pitch
in reims's restart window). The threaded and own-command-buffer legs
over host pages take the padded rows. Not yet run.
Shadowed textures, linear merges recorded and shadow copies per round,
beside the instances, interlocked splits and storage forms: the icons
over a buffer's bytes may render through an image of the runtime's and
merge back. Not yet run.
reims's small-texture diag (boots pd-1, pd-2) gave the shape of the
passes a restarted window server draws in its first second: an icon of
128 to 224 pixels a side, ShaderRead, ShaderWrite and RenderTarget,
over a buffer's bytes the CPU reads, cleared and stored; a new RG16Float
second colour of RenderTarget usage alone, cleared or loaded DontCare,
stored DontCare; a Stencil8 of the same size, DontCare both ways. The
test now renders that: 128x128 icons, odd icons' second colour loaded
DontCare (Metal's answer there is zero), the fetch over the middle rows,
the icon's clear below them on the right, and the CPU reading the bytes
of icons over a buffer or host pages. Not yet run.
Three more legs: the icons as textures over a Shared buffer's bytes,
and over host pages a no-copy buffer imports (one command buffer, and
four threads), as a surface's texture lies. Not yet run.
A 32x32 Private RGBA16Float target loaded DontCare and stored, beside a
RG16Float second colour cleared to the icon's own value and stored
DontCare: a mark into both colours, a draw that fetches the second
colour into the first, a flag into the first. On a device that fetches
through the pixel interlock the pass runs as three instances; on the M3
the second colour's first pass renders through a scratch and takes its
storage form at a commit. Four forms: one command buffer, one each with
all open before the first commits, one each on four threads, and one
second colour kept across icons and rounds.
Not yet run.
a_buffer_inside_an_import_holds_a_deallocator_given_no_keep_alive (RUNTIME_VERSION 2083) expected
shared-in-system-memory on a device without unified memory, as a test's first Shared buffer of the
default CPU cache mode forces it (runtime_lane::shared_kinds). Its buffers are no-copy buffers over
the caller's pages, and the runtime announces that kind only of memory it allocates for a Shared
resource (Device::degrade_system_memory: new buffers, descriptor buffers, exported memory, heaps),
never of an import of the caller's pages, which cannot move to device-local memory as the notice's
advice says. So the test failed on every discrete device that imports the pages: the 5080 and the
3090 lanes of pin 44 (m3-max-19277; 'not announced: [SharedInSystemMemory] (counts
{HostDeallocatorDelayed: 1})'). The runtime is right; the test now expects no first-occurrence kind.
Its other branch, where the device does not bind the narrower buffer inside the wider one's import,
expected nothing announced while its doc says the buffer is a copy of its half there, which
announces copied-host-pages (CopiedBecause::OverImport): it now expects that kind.
Verified: see the landing report (3090, lavapipe and M3 lane runs, lint).
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. The submission checks' thread waited for each fence with no end.
On the RTX 3090, with several processes making devices at once, the driver at times never
completed a check's submission (the same runs logged Xid 69, 32 and 13), and the device's
teardown waited behind the thread for good (SubmitChecks::stop). A self-check must not end a
program's work (AGENTS.md rule 2). Now a wait past STALL (10 s) takes the device as lost for the
checks: nothing is submitted again, unanswered verdicts are Unchecked for the device's life,
nothing is recorded, and the sink hears metal2vulkan-submit-check-stalled (Info). The teardown
waits up to STALL more for the stalled fence and releases it once signalled; if it never signals,
DeviceShared::drop leaves the VkDevice to the process's end (the VkInstance kept alive with it). The
checks' report gains the longest wait. The video interop tests run alone on Linux
(.config/nextest.toml); HOWTO notes the 3090's Xid 69/32/13 under concurrent device makes.
Verified (potluck jobs, on the branch): the new test
tests::submit_check_device::a_submission_that_never_completes_stalls_the_checks_and_the_teardown_returns
fails without the bound ("the checks never ended" at 12 s, lavapipe m3-max-19084) and passes on
lavapipe (19181: settled 2.003 s, teardown 2.002 s), the RTX 3090 (19109) and the M3 (19146). 3090
stress, 8 processes x 6 rounds: 5 of 48 check submissions never completed, each announced after
10.0 s, every process ended (before: one process hung until the 90 s kill, 18786). Lint at the tip
(19179).
Not run: the full suites; the 3090 at the rebased tip itself (code equal to 370931db27).
Open: the queue-switch check's waits (nv5080reg) and Objects::idle's vkQueueWaitIdle are unbounded.
On the RTX 3090 (NVIDIA 620.70.06), eight processes of the extra-queues test at once, 6 rounds
(m3-max-19109, the bound built in): 5 of 48 processes' checks met a submission that had not
completed at 10 s, each announced, its verdicts Unchecked, and every process ended (95 of 96 exit
0; the one exit 101 is the process of an Xid 32, whose own wait on its extra compute queue's fence
failed). Every other process's longest wait for a check submission was 1.3 to 12.0 ms; lavapipe's
0.05 ms (m3-max-19057). The same run logged Xid 13 (a compute class c7c0 exception) in one more
process, with no channel-ID allocation failure in the kernel log around it.
On an RTX 3090 behind a Thunderbolt 3 bridge (NVIDIA 620.70.06, Linux 7.3.3), six processes of
tests::video_interop::extra_queues_are_made_or_reported_and_the_video_features_enabled at once
(job m3-max-18786) met Xid 69 (class c797, offset 0x1b0c SET_REPORT_SEMAPHORE_D, ErrorCode 0xc,
data 0x2001c00d, itself a valid method header: the GPU read the method stream one word short) in
one process and Xid 32 (intr0 0x40000, PBENTRY) twice in another, 37 ms apart; two copies' empty
submission on the extra compute queue failed its fence wait, and one copy's submission checks
waited on their fence with no end. No PCIe error was logged then. The faulting processes of the
first report (um870, m3-max-18368) were video_interop tests too.
What was ruled out: every runtime VkQueue use holds that queue's lock (the queues audit), and a
probe that tracked each thread inside vkQueueSubmit, vkQueueWaitIdle, vkQueueBindSparse and
vkDeviceWaitIdle per VkQueue saw no two threads on one queue in 240 processes of the same shape
(m3-max-18977: 10 variants x 4 rounds x 6 copies: checks off, merge off, import tax off, no extra
queues, no video extensions, the test's submissions off, the validation layer). None of those
240 met the Xid either, so the variants decide nothing; 1 of the 18 earlier processes did.
Recorded as a host note (HOWTO.md), and the four tests run alone on Linux (.config/nextest.toml),
so no other process makes a device beside theirs.
Not run: a check that running alone avoids the error (it is too rare to show in a short run).
The submission checks' thread waited for each of its fences in 100 ms slices with no end. On the
RTX 3090, with six processes making their devices at once, the kernel logged a pushbuffer error
(Xid 69, Xid 32) and one process's checks waited on their fence for good, its device's teardown
behind them (SubmitChecks::stop waits for the thread). An accuracy-free self-check must not end
a program's work (AGENTS.md rule 2).
Now a wait past STALL (10 s) takes the device as lost for the checks: nothing is submitted again,
what had not answered is Unchecked for the device's life, nothing is recorded, and the sink hears
metal2vulkan-submit-check-stalled. The stalled submission's fence and command pool stay pending,
so the thread leaves them to the teardown, which waits up to STALL more and releases them once the
fence signalled; where it still has not, the teardown leaves the device and its instance to the
process's end (as the exit path does) instead of a vkDeviceWaitIdle that would never return. A
step held whole lets go of the loader word without waiting for the relay mark of a stalled use.
The checks' report now gives their longest wait.
Test: a_submission_that_never_completes_stalls_the_checks_and_the_teardown_returns injects a
submission whose first info waits on a timeline semaphore nothing signals, with a 2 s bound; the
checks settle at the bound, the sink hears it once, nothing is recorded, and the device's drop
returns after the bound with its VkDevice still live; then the test signals the semaphore.
Not yet verified: build, lint, the test runs (to come in the following 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.
The commits before this one. A copied host buffer (one whose pages the device can't import) copied
the caller's pages in at commit, before any batch was submitted. A command buffer that begins
with a wait on an event the host signals later, committed before that signal, so read the pages
from before the CPU's writes that the signal publishes; Metal reads them after the wait. The
commit now notes the batches that wait for an event value not yet reached, and submit_batch
copies those batches' copied buffers in again once their wait is met, with no command-buffer lock
held (command_buffer/copies_again.rs; counted: WorkCounts::copied_copy_ins_after_waits). A command
buffer with no such wait copies in exactly as before. Shadows over plain imports were already
ordered after the wait, and over logged pages a command buffer with an event wait already copies
every row.
Also test-only coverage of the guest window server's fetch shapes, from the Dock icon hunt:
waited_reads, lone_fetch (single-colour fetching passes, overlapping layers, host-page targets, a
pair of textures over one surface through two buffers, in flight on a second queue), icon_levels
and fetch_composite.
Verified (potluck jobs, on the branch): waited_reads' copied leg reads 3 of 6 wrong with the
copy-in-again call removed (M3 19227, lavapipe 19236) and 0 wrong with it (3 copies in again, one
per waiting command buffer); copied-no-wait copies 25,165,824 bytes over 6 commits in both, 0
copies in again. At 84b6b4295b: lavapipe 76/76 (m3-max-19273), M3 71/71 (19280); clippy plain,
m2v_gpu and m2v_cpu_icd, rustdoc, fast_paths, api_surface, api_signatures and published_crates
(19274).
Not run: NVIDIA, RADV.
A commit copies into each copied host buffer the bytes the CPU changed in
its pages, before any of the command buffer's work is submitted. A batch
that waits for an event runs its commands only once the event reaches
the value, and on Metal those commands read the pages as they stand
then. So a CPU write made after the commit and before the host's signal
(or before a later command buffer's signal) never reached the copy, and
the waiting command buffer read the bytes from before it.
The commit now notes, before its copy in, the batches that wait for an
event value not yet reached (CopiesAgain::unreached, from each event's
timeline). When the scheduler submits such a batch, which it does only
once the wait is met, submit_batch first copies in again
(copy_in_again): the copies the command buffer reaches, as at the
commit, take the CPU's changes since. This runs with no lock of the
command buffer held, since a copy over logged pages waits for the log's
publication. A batch with no wait, or whose every wait was already
reached at the commit, copies nothing more. The new counter is
WorkCounts::copied_copy_ins_after_waits.
The same mechanism serves a reader held by an event across queues: the
signal of a batch submitted while a copy is live is seen only at its
completion turn, after the merge back. The FAST-PATHS gap that listed
event-ordered reads across queues as stale now says the held reader
copies in again; that case is expected from the code and not run.
Docs: copied.rs (Coherence, the two-memories bullet, copy_in),
dirty_pages.rs (stamps), HOWTO (copied host buffers), FAST-PATHS (cost
row and gap), api_signatures.tsv (the new field).
Verified: waited_reads in the jobs named in the report. The copied leg
fails at cae2e24b4d and passes here; the no-wait copied leg makes 0
copies in again.
A command buffer committed before the CPU writes the host pages it
reads, whose first command waits for an event the host signals once the
write is made, runs its commands after the wait on Metal, so it reads
the written bytes. The new waited_reads legs check this over three homes
of the pages: a plain import, an import whose memory is logged
(dirty_pages.rs), and a copy where the import gate refused
(copied.rs). Each reads through the buffer and through a shadowed
texture over it. A fourth leg runs the same rounds over a copy with no
wait, and prints the bytes each commit copies in, for the cost check of
the fix that follows.
From the code, the copy's copy-in is taken at the commit
(command_buffer/mod.rs, copied.rs Coherence), before the wait. So the
copied leg is expected to fail until it is fixed. The log type of
dirty_pages_device is shared with the new test.
Verified: run on the M3 and lavapipe in the jobs named in the report.
Clippy (redundant_guards) refused the match's 'v if v == 1.0' arms under
both --cfg m2v_gpu and --cfg m2v_cpu_icd: the device tests' lint, which
the earlier commit of this test never ran. The literal patterns match
the same values.
Verified: clippy under both cfgs reported only these arms (job
m3-max-19086); the rerun is in the job named in the report.
The in-flight legs keep the writer's passes behind fills so its write is
still ahead when the reader's command buffer is committed. Sixteen fills
of 64 MiB are a few milliseconds on a GPU; on a CPU device (lavapipe in
the suites' device runs) they are a GiB of memset a round. Under
m2v_cpu_icd the legs now fill once. The event wait still holds the
writer in flight for certain, and the printed ahead count shows whether
the write was still pending.
Verified: the GPU build is unchanged (the const differs only under
m2v_cpu_icd), and the M3 run of 7e0591663f stands for it. The lavapipe run
is in the job named in the report.
The pair repro read the surface through the second buffer only once the
writer's command buffer had completed. Two contexts on two queues can
also commit the read while the write is still running. The runtime
orders tracked work across queues in commit order (tracker.rs,
scheduler/order.rs), and it orders the uses of host-page buffers by the
bytes they cover (host_aliases.rs). That is more than Metal promises for
two buffers over one allocation, so the new legs check that the runtime
keeps its own order.
The pair now takes a span and a follow:
- Span::Same: both buffers cover the same bytes and join one key.
- Span::Wider: the reader's buffer covers more pages and is made first,
and the writer's lies in its import. Two keys, ordered by Placements.
- Follow::Completed: the old order.
- Follow::InFlight: the writer's passes sit behind 16 fills of 64 MiB,
and its end waits for an event the host signals only after the
reader's command buffer is committed on a second queue. That keeps
the writer in flight for certain. The leg counts the rounds whose
read was committed while the pages' first texel still held zeros (the
write still ahead), and the buffers bound in an import or copied.
Verified: built and run on the M3 in the job named in the report.
Two processes each make a texture of one IOSurface over a no-copy buffer of their own over its
pages. Each round the CPU zeroes the pages, the reader's texture is sampled, the writer's is
rendered by the lone passes (a fetch through the scratch on the M3) in a command buffer of its own,
and the reader's is sampled again in another, which must find what the passes left. RGBA16Float
and BGRA8Unorm.
Not yet run.
ab1fd918c9 bounded every home's targets by the host pages' bytes, so the Private RGBA16Float legs
rendered 14 a round in place of 24. m3-max-18982 at ab1fd918c9: all 8 legs right on the M3 Max, the
host legs shadowed (14 or 13 or 24 shadowed textures a round, as the counts show).
A texture over host pages a no-copy buffer imports, rendered by a fetching pass, renders on the M3
through a scratch (no storage form for a texture over bytes); its result must reach the pages before
the command buffer's completion, when another process may sample the surface. Four legs: the lone
passes over tight RGBA16Float rows, over rows 64 bytes apart (a shadow), over BGRA8Unorm, and the
accumulation's layers; the CPU reads the pages after completion. The counts now print inline
instances, shadowed textures and shadow copies.
Not yet run.
One draw lays 12 copies of a rectangle over the target, each fragment fetching the second color
and halving its red through con_fetch_coverage, so the first color holds 2^-12 where the interlock
orders the overlapping fragments of the draw. The runtime splits consecutive interlocked draws on
MoltenVK, whose draws race under other processes' load; the fragments of one draw it cannot split.
Not yet run.
A window server's distance and color filters render a pass of one color, no depth or stencil,
whose fetching draw leaves its subpass no attachment at all where the device fetches through the
pixel interlock; where a draw that does not fetch comes first, the pass runs as two instances, and
on the M3 the color renders through a scratch. lone_fetch renders 24 new targets a round, three
rounds, RG16Float and BGRA8Unorm: a cleared pass with a flag, a loaded pass with the flag and a
fetching halving, a loaded pass of the halving alone, each pixel then a quarter of the flag or the
clear. A third leg: a bitmap's pass whose one draw fetches a cleared, unstored second color and
writes nothing to it.
Not yet run.
The consumer's window-server pyramids take storage forms on the M3 (about one
per two pyramids: storage_forms_taken rose with the level passes in every
window of its boot). Level 0's pass now may fetch its attachment after the
fill (fetch_ordered halving a fill drawn at twice its value), which on the M3
renders through a scratch and notes the icon for its storage form; the icons'
command buffer commits alone, or while another is uncommitted, whose later
commit the switch then rides. storage_forms_taken is printed with the copy
counts.
Verified: the next job runs it.
The read-back of the targets the icon was sampled into copied level 0's side
from targets of levels 1 and 2's sides, which the blit refused (lavapipe,
m3-max-18573: both icon_levels tests panicked at the copy's unwrap).
Verified: the next job runs it.
Two device tests of the shapes a window server's dock rendering takes on an
Apple GPU guest, whose icons on MoltenVK lose their fill:
- tests/icon_levels.rs: a Private RGBA16Float render target of three levels,
each level in a pass of its own that clears and stores it, all in one command
buffer; level 0's pass draws the fill, each later level's pass samples the
texture itself, bound whole: through the texture's copy (tob_sample, whose
level of detail the runtime cannot bound below the attached level) or in
place (alv_implicit clamped to level 0, alv_level1). A later command buffer
samples the icon into targets of each level's size and reads every level
back; every texel must be the fill. Icons are made and released in rounds.
- tests/fetch_composite.rs: a composite pass that samples an icon and fetches
its own target in a raster order group, over a Private target and over a
texture over a Shared buffer's bytes; every pixel must be its draws' answer
in draw order.
Verified: see the report's job ids (M3 and lavapipe).
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.
1. 2078 let a tracked Private image's shadow stand across command buffers. A command buffer's
first copy-in of such a shadow was handed to its batch's submission (gated as Standing) where
no command of its own encoder had written the texture yet. Where an earlier encoder of the same
command buffer had written it, the submission always copied every texel anyway, but the copy
was already a deferred segment: it got its own VkCommandBuffer, the encoder went on in a
continuation, and the batch split. The encoder now asks the submission's question as it
records the copy (State::ended_encoders_write_any, over the summaries stands() reads) and
records it inline there, still counted Unskipped::CommandBuffer. An encoder encoded again at a
rebind keeps the submission path.
2. Degradation::HostDeallocatorDelayed's announced cost names the wait 2083 added (every buffer
bound inside the import goes), as API.md's catalogue entry does
(tests::degradation_catalogue failed on every device in the pin 44 round).
3. The three replay cases' records (pass-start-barrier-private-read, -sample, -draw-barrier-read)
gain only the shadow_texels_* counts 2078 began counting for Private images (308, or 1024).
No whole-set write.
Verified (potluck jobs, on the branch): the three cases are within bounds just before 2078
(m3-max-19075, e51608975b). Lavapipe shadow suites 27/27 at ce1c565bf3, with an in-job negative
control (encoder.rs and command_buffer/mod.rs reverted): 5 -> 8 VkCommandBuffers begun, 1 -> 2
submit infos, 1 copy-in against a standing (19159). M3: image_standing, shadow_standing_device and
attached_read_standing 7/7; whole-set replay with command_buffers_*, submit_infos and
shadow_copies_in_against_standing back within the existing bounds; 8-run contrast old vs fix
binary equal but for the shadow_texels_* relabel (19169). Lavapipe at d13646eea5: 28/28 runtime
tests incl. all degradation_catalogue tests; conformance crate 1043/1043 (19198). Lint at
ce1c565bf3 (19159).
Not run: lint at the tip (cost string, docs and records only); the M3 replay at the tip (19199);
RADV.
RUNTIME_VERSION 2078 counts the first copy-in of a tracked Private image's shadow by why it moved
its texels (shadow_texels_first_copied_in_private_images, shadow_texels_unskipped_* and
shadow_texels_never_stood_*). These cases made that copy before 2078 too, with nothing counting it,
so their records bound these counts at 0. Only these counts are re-blessed. The command buffers,
submit infos and copies against a standing that 2078 added are gone with the previous commit, and
they stay within the old bounds, unchanged here.
Written by `conformance cost --runs 8 --alone --write` of the three cases on the M3 (m3-max-19169,
at ce1c565bf3). It added the same four shadow_texels_* counts to each record's bounds and composed
counts, and changed nothing else. No whole-set write.
Contrast, the same job: `cost --runs 8 --show` of the three cases, in order and alone, with a binary
built at e51608975b (before 2078) and one built at ce1c565bf3. Every count is equal, except:
- these four shadow_texels_* counts (0 to 308, or 1024 for -sample);
- scheduler_passes, 1 to 0 in five of the six readings;
- fences_made alone, 1 to 2 for -read and -sample.
Both of those were already inside the committed bounds: the whole-set replay at ce1c565bf3 lists
only the four shadow_texels_* counts per case as over.
RUNTIME_VERSION 2083 made a buffer bound inside its pages' import hold the import, so a no-copy
buffer's deallocator given no keep-alive waits for that buffer to go, and docs/API.md's catalogue
entry said so in its cost. The kind's announced cost (Degradation::HostDeallocatorDelayed's) did
not, and tests::degradation_catalogue::a_runtime_kind_s_entry_states_the_cost_it_announces failed
on every device that runs it (pin 44: Iris, m3-max-19132, and the 780M).
The announced cost now carries the same clause, worded 'every buffer bound inside their import
goes' in both, and the kind's own docs list the case beside the others it waits for.
Verified: the degradation_catalogue tests on lavapipe (see the landing report).
A command buffer's first copy in of a shadow that may stand across command buffers went to its
batch's submission (a gated copy, `CopyGate::Standing`) whenever no command of its own encoder
had written what it reads. Where an earlier encoder of the same command buffer had, the
submission's `stands` always found that write and moved every texel anyway, but the copy was
already a deferred segment: the submission recorded it in a VkCommandBuffer of its own and the
encoder went on in a continuation, one more batch-work and one more continuation command
buffer, and one more VkSubmitInfo where the batch split there. Since RUNTIME_VERSION 2078 lets
tracked Private images stand, a pass that reads its own render target after an earlier pass of
the command buffer drew into it takes that path: the conformance cost replay's
pass-start-barrier-private-read and -sample rose from 7 to 10 command buffers begun and from 1
to 2 submit infos on the M3 (replay m3-max-18970 at 010958b7f8; m3-max-19075 at e51608975b,
just before 2078, is within bounds for all three).
The encoder now asks, as it records the copy, what the submission would: whether a command of
an encoder of the command buffer that ended before it wrote the standing's keys
(`State::ended_encoders_write_any`, the same summaries `stands` reads). Where one did, the copy
is recorded in the encoder, ungated, counted `Unskipped::CommandBuffer` as before. An encoder
encoded again at a rebind (`replay.rs`) keeps the old path: the encoders after it are among
those ended then, so its batch's submission decides.
Tests: image_standing's new
a_copy_in_after_an_earlier_pass_of_its_command_buffer_wrote_the_texture_is_decided_there (two
passes in one command buffer, the second an attached read over every pixel: no copy in against
a standing, every texel moved for the command buffer, Metal's reds), and
shadow_standing_device's own-command-buffer leg now also asserts no copy in against a standing.
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.
1. Placement: under the default sharing check's answer of no idling (reims's host-timed mode)
every queue took the round robin's next VkQueue (made % 14) and an unshared queue (a
compositor's) got no empty one. Queues now take a VkQueue no command queue holds where one
is free, else the least held; an unshared queue takes an empty one. Counted:
command_queues_live_most.
2. Least plan: NVIDIA refuses vkCreateDevice when its channels run out with
VK_ERROR_INITIALIZATION_FAILED or VK_ERROR_OUT_OF_HOST_MEMORY (2080, 620.70.06, measured), and
the retry covered only INITIALIZATION_FAILED and OUT_OF_DEVICE_MEMORY. It now retries the least
plan (3 queues, announced metal2vulkan-degrade-least-queue-plan) on those and on
TOO_MANY_OBJECTS, and refuses (DeviceRefused, naming both attempts) only when that fails too.
3. Tests: nextest profile few-channels (3 threads) for ad-hoc RTX 2080 runs, which hold 10 devices
of 18 queues (VALIDATION.md); the held-work test's start-based check runs only where the GPU
writes timestamps.
Numbers (walk-shaped churn, 340 queues in 60 s, compositor unshared): RTX 3090 host-timed
compositor frames over 16 ms 44 -> 0, p99 20.0 -> 3.8 ms, waits behind other queues 556 -> 0
(m3-max-18783); M3 Max frames over 16 ms 188 -> 2, p99 51 -> 10 ms (18785). Channel cost per
queue: 3090 25.2 ms create, 3.7 MiB; 61 full-plan devices per GPU (2080: 10).
Verified (on the branch): clippy all-features, no-feature, m2v_gpu and rustdoc at 6f16b2e0c7
(19007); pure tests 20/20 under few-channels (18928); M3 queue device tests 45/45 (18867);
2080 fill run: the device comes up on the least plan at every refusal code (18967).
Not yet in: the exclusive 3090 rerun of
a_compositor_beside_a_long_queue_keeps_its_latency_once_that_queue_went_long (19010; it failed
its p99 < 5 ms on a shared busy card), 3090 exhaust codes (18925); lavapipe device tests.
Measured on an RTX 2080 (NVIDIA 620.70.06, job m3-max-18967, the
probe's --fills): beside 60 devices of 3 VkQueues the runtime's device
of 18 was refused with VK_ERROR_OUT_OF_HOST_MEMORY, beside 62 and 64
with VK_ERROR_INITIALIZATION_FAILED, and each time it was made with
its least plan's 3 and announced it (the probe built at bdfc5047d2,
with 86def80883's retry). Before 86def80883 the first answer was
Error::OutOfMemory(Host): the device test failure on the 2080 under
parallel test load (job m3-max-18589).
--fills N,M,... holds that many devices of the least plan's shape, then
makes the runtime's device beside them: what device making answers
where the plan's vkCreateDevice still fits but little more does. To
find which step of device making answered OutOfMemory(Host) on an RTX
2080 under parallel test load, where a GPU filled to the refusal gives
ERROR_INITIALIZATION_FAILED and the runtime's least plan (job
m3-max-18924).
On NVIDIA's driver each VkQueue is a channel and a runtime device of
the queue plan takes 18. An RTX 2080 held 10 such devices at once
(job m3-max-18774), so a 16-thread host's default 16 test processes
ask it for 288 VkQueues and the driver refuses the rest; the 3090 and
the 5080 Laptop GPU held 61 (jobs m3-max-18776, m3-max-18775).
--profile few-channels runs three at a time, as the consumer's own
profile does. docs/VALIDATION.md says when to pass it.
vkCreateDevice's answer where the device-specific resources a logical
device needs run out is VK_ERROR_TOO_MANY_OBJECTS (the Vulkan spec,
vkCreateDevice), and a driver short of host memory for the plan's
VkQueues may make a device of fewer: both now take the least plan, as
VK_ERROR_INITIALIZATION_FAILED (NVIDIA's channels) and
VK_ERROR_OUT_OF_DEVICE_MEMORY did. A device refused with both plans
is refused naming each attempt, as before.
Asked for by a device test on an RTX 2080 under parallel test load
(job m3-max-18589) that got OutOfMemory(Host) from
Device::system_default_with, where the least plan's three queues would
have fit: the 2080 held 10 devices of the plan's 18 VkQueues at once,
and 68 of the least plan's 3 (job m3-max-18774).
The pure test of made_within_resources takes each of the four codes.
The exhaust phase now names the VkResult each refusing process got, and
while the processes hold their devices makes one more process's runtime
device of the plan: whether it came up (on its least plan, announced) or
what it answered. --exhaust-only skips the make and hold phases. Asked
for by a device test that got OutOfMemory(Host) from
Device::system_default_with on an RTX 2080 under parallel test load.
Under UnsharedIsolationPolicy::Off the unshared queue's command buffer
waits behind all three long ones on the shared VkQueue. The test said
so by its GPU start, which on a device answering GPU times from the
host (MoltenVK 1.4.1 on Apple's GPUs) is its kernel end: on the M3 Max
it read 4.7-75.9 ms against the third's 52.4-75.9 ms, a failure at the
base (8e1d5f42b0, job m3-max-18834) and at the placement fix (job
m3-max-18825). It now says it by the end on every device, and by the
start where the device writes timestamps.
The pure churn simulation counted its makes beside the loop's own index
(explicit_counter_loop); the device churn test looked for an empty
VkQueue with iter().any (manual_contains). Both said once now.
Lint job m3-max-18771 named the two.
A new command queue took the round robin's VkQueue by a creation counter (made modulo the
round robin), which never reuses a slot: a guest makes about 340 queues past NVIDIA's 14 in a
250 s walk, so live queues landed together while other VkQueues stood empty. An unshared
queue (a compositor's) got a VkQueue of its own only where the device shares (an Adaptive
verdict of Idles); under PerQueue, on MoltenVK, and on a device that answers GPU times from
the host (reims-vgpu's, Unchecked) it took the round robin's next, so app queues made later
landed on it every 14th make. Guest walks (reims's logs, read in place): unshared command
buffers behind another queue's batch 1062 in one 3090 walk (39 over 16 ms, longest 33.8 ms),
5 in the next on the same build; 511 on a 2080; 2048 on the M3 (437 over 16 ms).
Now, under every policy and verdict, a command queue takes, as it is made, the round robin's
VkQueue the fewest live command queues hold of those no unshared queue holds, the first in
turn from the counter among equals (queue_share.rs fewest_held, Device::take_round_robin):
one pass over the round robin's VkQueues' counts, atomics alone, at creation only; nothing
scans the command queues. Its claim is made before it reads the unshared count, as an
unshared queue's is made before it reads the live count, both sequentially consistent, so the
two never both succeed. An unshared queue takes one no command queue holds where one is free
(the existing unshared_order, now ungated), else the one the fewest hold.
Counts: WorkCounts::command_queues_live_most (the most command queues the program held at
once: what a walk needs to size the plan by) and unshared_queues_sharing_a_vk_queue (an
unshared queue that found no VkQueue free of other queues). queues_sharing_a_vk_queue keeps
its meaning, the queues made past the round robin's VkQueues; unshared queues now count among
them under every verdict, as they did where the device did not share. QueueLimits notes keep
theirs, an unshared queue's included.
Tests: tests::queue_share's pure churn shaped like a walk (354 made over 14 VkQueues, at most
12 live, an unshared one kept): no queue placed beside a live one while one stood empty and
the unshared one never shared, against a positive count by the old rule; device test
over_a_churn_queues_take_the_least_held_vk_queue_and_unshared_ones_an_empty_one under
Adaptive, PerQueue and untimed Adaptive. The helpers that share a VkQueue on purpose (beside,
the lane's queue_where) keep the queues they make until one lands there.
Docs: QueueSharingPolicy, new_command_queue_unshared, new_command_queue_for_presenting,
queue.rs and queue_share.rs module docs, docs/API.md, the runtime README, FAST-PATHS's queue
sharing row and its known gaps.
Not yet built or run: potluck jobs follow.
A compositor (unshared with --unshared) committing a draw every 16 ms beside three kept
queues and a churn of queues each made with one long command buffer and dropped 1 to 8
ticks later; --untimed answers GPU times from the host, as a consumer that does so does
not share VkQueues. Prints the compositor's latencies and the device's waits behind
other queues, the measure of the placement change that follows.
Not yet run.
A probe for the NVIDIA queue plan's cost: Vulkan devices of 1 to 18 queues made and
destroyed in turn (vkCreateDevice and vkDestroyDevice wall times, slope per queue), held
four at once with nvidia-smi's framebuffer and BAR1 use, the runtime's own device under
each queue limit, and an opt-in exhaust across processes (how many devices of the plan's
and the least plan's shape the GPU holds at once).
Not yet run; numbers follow from potluck jobs.
The commits before this one. Since 2073 a second no-copy buffer over a live import's pages is
bound inside that import instead of importing the pages again (VK_EXT_external_memory_host leaves
a second import undefined). The inside buffer keeps the import, so the import keeps the first
buffer's keep-alive until both are released. With a keep-alive the deallocator still runs at
release, as Metal's does; given none, it is delayed until the inside buffer goes, announced as
host-deallocator-delayed (now naming the inside buffer) and counted
(WorkCounts::host_releases_held_inside; a HostImport counts the buffers bound inside it). API.md
records it as an accepted difference: later than Metal, never early. The keep-alive and
dma_buf_imports lane tests that expected two imports are rewritten (the half-range buffer asks
about no mapping: inside the import or a copy). memory_frees_paced, which lands in a different
replay case each run (other cases' quiet-period frees), is reported under the race rule beside
memory_frees_posted.
Verified (potluck jobs, on the branch at 6e51633beb): M3 4/4 keep-alive tests with the counts at
each step (m3-max-18978); 780M 5/5 (18988); lavapipe 5/5 and 229/229 touched suites (18973); M3
replay: memory_frees_paced over no bound (18992); whole-set contrast d0f800ddd0 (18926) vs base
(18864): the frees did not increase. Lint (fmt, clippy all-features, m2v_gpu, m2v_cpu_icd, rustdoc):
19002. Bisect: 8db2f6f5c8 and 269d7066c4 pass, 4f3bc2e7a3 (2073) fails.
Not run: NVIDIA, XTX, full suites.
runtime_lane::dma_buf_imports::a_buffer_that_lies_in_a_live_import_asks_about_no_mapping expected
a buffer over the first half of a live buffer's bytes to make its own import and ask the kernel
about its 32 mappings. Since RV 2073 (one page, one import) a page a live import holds is never
imported again: the half is bound inside the live import, or, where that import's memory is the
first buffer's alone (its own dma-bufs, dedicated to its VkBuffer), a copy of its pages
(copied_over_live_imports). Neither asks about a mapping: the live import's making asked about
them all, and the pages stay writable while imported. The test failed at 945 on the RTX 5080
(m3-max-18801) and the RX 7900 XTX (m3-max-18892): asked 0 where it expected 32, no error.
It now asserts no mapping asked, the half inside the import or a copy (one of the two counts),
no import made over the live one's pages (imports_inside_live unchanged), the half's source
uncalled, and the GPU reading the CPU's bytes through the half.