The Direct3D 11 draws' wait into a video cache's planes is bounded at
DEVICE_WAIT and then STALL_HOLD from the draw's own start, after the decode's
sync, itself bounded at DEVICE_WAIT. So a Windows landing can take 15 to 20 s,
past the 15 s from the frame's first wait that TEARDOWN_WAIT and HAND_OFF_WAIT
assume. Row 20 says so until the fix that carries one deadline from the
frame's first wait through the sync and the draw lands.
Since the draws' wait was bounded (#81), a Windows host ended the process at
a draw or a clear into a video cache's planes whose GPU work ran past
DEVICE_WAIT, 5 s, with its fence still answering. What the host saw: a stall
of 6 s, which used to land late, ended the VM. The unix arms hold a stalled
write for STALL_HOLD, 10 s more, before their death: 15 s from the wait's
start.
The draws now take a hold at their make (PlaneDraw::new), and reims-vgpu
gives them STALL_HOLD. Each wait, on the fence's event, by polling the fence
or by polling the event query, asks until DEVICE_WAIT and, where it has no
answer by then, up to the hold more, the first stall of each way logged. A
wait answered in the hold says so (Waited::held), counted as
video-drawn-waits-held. Past the hold the draw is Unwaited, and the process
ends with the same named fatal. A refused signal with a refused event query
still ends the process at once: no wait is left that could answer.
What the host sees now: a draw whose GPU finishes between 5 and 15 s lands,
counted; one not finished by 15 s ends the process with "reims-vgpu: fatal:
platform call the wait for the Direct3D 11 draws into a video cache's
planes: the fence's event did not answer the GPU done with the draws in
15.0 s".
The held-signal test now needs the draw to last the total (red: unwaited at
5.0 s, mini job m3-max-84765). A new test passes the held fence from the CPU
6 s into the draw, which lands held (red: Unwaited at 5.0 s). The refused
signal and query test asserts both end inside DEVICE_WAIT, and the
virtual-clock poll test covers an answer in the hold. The hand-over table's
row 20, docs/conventions.md and answer.rs's counts list follow; answer.rs
now lists the drawn waits' polled and queried codes too, which it lacked.
(cherry picked from commit bde4638ea0af75c8acad992ef31eed82d0974d81)
docs/conventions.md is the register of the degradation codes, but some
counted codes were not in it: the pipeline finish's and the held stage
create's, the dispatch pre-pass's made-on-walk, the read-only pages'
writes, VideoToolbox's surface imports, the encodes' plane fills, the pages
blocks' overlaps, the pool's codes and the rt platform's stage codes. A
reader of a counts line had nowhere to look them up.
answer.rs's list of the kinds counted by code had earlier commits adding
codes to it, so it is meant to be complete; it lacked the codes above and
others already in the register (the surfaces' refusals, the display's
refusals, the slow answers', the pipeline creates' replies, the pictures
handed, the encode quality level, the VideoToolbox lends'). It now has
them, in the register's words, and says that the register is
conventions.md and that the list mirrors it.
(cherry picked from commit 3cbffc6b31ccd962be902d08efbb913df171a258)
Two boots of a macOS 26.7.2 guest on an RTX 3090 host (2026-12-03) looked
for where AppleGVA's AMD path hands the driver a data rate limit. They found
nothing.
- With the limit and without, the H.264 streams and the frames' QPs were the
same. No word of the per-frame records held the limit or the rate, and the
encoder's two context parameters held no rate (m3-max-84444).
- Filling, in turn, each length-record word the driver leaves at 0 with the
frame's bits changed no stream. That spends the lead the row named
(m3-max-84639).
The row keeps its measurements and waits for a user report of a data rate
limit not held.
(cherry picked from commit ac74252372a53f15692d82009ae8e28929b75116)
A function made with values that lack a constant an argument's binding index
reads (`[[buffer(kIdx)]]`, kIdx given no value) was made, the bundle taking the
missing required constant as 0: the argument sat at index 0, beside the
kernel's buffer 0 or alone, where Metal refuses the function.
What Metal answers, measured by an oracle probe of our own on macbook-pro-2019,
macOS 26.7.1 (25G241), the AMD Radeon Pro 5300M (m3-max-84515/84516), and on
the M3 Max, macOS 27.0.1 (m3-max-84627), the same 110 answers: nil and
MTLLibraryErrorDomain code 3, its description alone, a line for each such
argument in argument order, "error: texture argument ts has invalid location
(<_ZL32__metal_implicit_attr_int_expr_2,2>) in k_texarr\n", the global the
module stores the index in by name and the count. Buffers, threadgroup memory,
textures, arrays of textures and samplers alike, kernels, vertex and fragment
functions alike, used or not. Such an argument takes no location, so a later
one at the same index is no overlap; overlap lines keep their form, in the
same order. An argument whose predicate the values leave undecided is left out,
and an index of a default (`is_function_constant_defined(k) ? k : 3`) is made.
What the guest sees now: newFunctionWithName:constantValues:error:, and every
way that reaches it (descriptors, completion handlers), answers nil with
Metal's error and words for such values, and never takes 0 for the missing
index. The refusal of overlapping locations, RgfxOverlappingArgumentError, is
now RgfxInvalidLocationError: it runs the module's initialisers with the values
given, and, where a global they do not decide is read, again with a 0 for each
declared constant the values lack; a global only that run decides is one the
values leave undecided. The AIR reader keeps the names of an argument's index
and count globals. Functions given every constant answer as before.
test_undecided_locations_refused_as_metal holds the oracle's words for
tests/undecided_locations.metal (the probe's source), first two arguments at
one undecided index, and compares every function under each of the probe's
takings, by values set by name, by index and in a descriptor, with this Mac's
own Metal.
(cherry picked from commit cbae8ac8df3ba63894826c2ef1d631f00881acf9)
Row 20 of the hand-over table, a Windows host's draw of VA-API's picture into
a cache's planes over Direct3D 11 textures, still said the wait on the draws'
fence had no bound of its own, and that a failed wait or a refused signal had
none, leaving the CPU's copy to land the picture while the draws might still
write the textures. The three commits before the table's in this batch closed
that path: the wait is bounded at DEVICE_WAIT, a failed call of it polls the
fence (video-drawn-waits-polled), a refused signal flushes the draws and polls
an event query (video-drawn-waits-queried), and past the bound the process
ends at the draw with a named death.
The row now says so, quotes the d3d11 module doc's bound and query sentences
and graphics::drawn's death, and names the tests those commits added. Its
first quote is unchanged and still in the file.
A device cache's picture reaches the guest's CPU through the host's copy into
the surface's pages, at a CPU lock's SURFACE_DOWNLOAD, a release, a
SURFACE_PAGES that names the pages again, and a guest's synchronize. The table
had no row for it. Row 31 names the copy's command buffer as its one wait, with
B1's rule that a copy whose command buffer ended in an error lands nothing more
and is answered failed, and B1's four tests that hold it.
(cherry picked from commit 6fb8578fcd1ac41b12e5bb1e9a26dae59e6dd233)
Every code counted in a boot's degradation counts is listed in
docs/conventions.md and in answer.rs's degradation_counts doc. The log class's
fixes count thirteen new codes (vt-decode-failed, vt-encode-failed,
vt-encoder-open-failed, uploads-written-dropped, managed-texture-two-copies,
refused-object-named, dynamic-library-create-failed, vt-message-refused,
function-handle-unmade, vt-message-unread, vt-encoder-property-refused,
video-cache-acquire-refused, video-nvenc-copy-refused), and three codes counted
before were listed in neither place: vt-decode-stall-held,
video-landing-stall-held and video-landing-failure-untold.
(cherry picked from commit 63182562aebe6352f0711a54bce7ea2e7c156ff6)
A refused ID3D11DeviceContext4::Signal failed a draw or a clear into a cache's
planes before its flush, leaving its work recorded and not submitted. The
VA-API arm landed the picture by the CPU's copy, and the context's next flush
then ran the draws with no wait for them, writing a cache whose picture the
CPU had already landed, from a pool texture that may by then hold another
picture.
The refused signal now ends an event query made with the draws, the flush
submits the work all the same, and the wait polls the query under the same
5 s bound: Ok once the GPU passed it, counted as video-drawn-waits-queried. A
query refused too is Unwaited, on which the process ends with the named death,
unless the device was removed. PlaneDraw::new now also fails where the device
makes no event query.
Seen on the Windows mini with the signal refused in a test (potluck job
m3-max-84428): the draw returned Err before the GPU ran its context's stream.
(cherry picked from commit c5d2983b8ad9d5ca5dba9551686bf14e804c34cc)
On Windows, a picture's Direct3D 11 draw into a cache's planes waited for its
fence on an event: CreateEventW, SetEventOnCompletion and WaitForSingleObject,
each made after the flush had submitted the draws. Where one failed, as it can
when the host runs short, the draw answered Err while the GPU still ran it.
The VA-API arm then cleared the zeros the textures owed and landed the picture
by the CPU's copy into the same textures, with nothing waiting for the draw,
which could then write over the CPU's picture from a pool texture that may by
then hold another picture. A clear of owed zeros waited the same way.
Such a wait now polls the fence's value instead, for DEVICE_WAIT (5 s), the
video crate's bound of a frame's work, on the draws' runtime's clock, which
PlaneDraw::new now takes. The draw or clear answers Ok once the fence reaches
its value, Failed where the device was removed, as before, and Unwaited past
the bound, on which reims-vgpu ends the process with a named death: nothing
would tell when the GPU is done with the textures. Each wait that polled is
counted as video-drawn-waits-polled, the first failure of each call logged.
Seen on the Windows mini with CreateEventW refused in a test (potluck job
m3-max-84428): the draw returned Err before the GPU ran its context's stream.
(cherry picked from commit 0f4f05e52c92c56cc3ee5f3ca4e0f19d80dc939f)
005049a93b and bb8738f7eb hold a stalled write's answer until the device is
done with it, so rows 2, 3 and 10 (an arm64 guest's VideoToolbox decode into
the lent pages, and its message in hand at a reset) and rows 14 and 17 (an
x86-64 guest's landing into its output's pages, and a landing in flight at a
reset) have a wait now, with the tests that hold it; row 13 says a stalled
failure is signalled only then.
Gap B (18a2d29cfc) has a faulted walk's stand-in wait for the work its walk
handed a session, or the failure's post wait for it on the CPU, so row 13
states that wait with its three tests, row 17 the settle's wait through the
stand-in, and rows 21, 22, 24 and 25, which read "none" for the faulted walk,
point at row 13. Row 22 names the encode-wait test (8f3eb42f3b).
(cherry picked from commit ceda663d282c7d0c31f334edb2666577b5574706)
The batch rewrites gpu_copy.rs's module doc (one failed copy's scratch and
arguments kept, the GPU copies ended at a second) and takes a wait that
returns with its command buffer unfinished as a failed one, so row 19 quoted a
sentence the tree no longer holds and the handovers check failed. Row 19 is
re-quoted from the tree and states the one-kept-then-end rule; rows 6, 16 and
23 add the unfinished wait, and the intro says how it is taken. The rows name
the batch's new tests: the gather pass and the caches copy counted or kept on
an unfinished wait, gpu_copy's four, and the encoders' kept fillers (rows 26
and 27), whose sessions upload their later frames.
A kept decoder served a new session of its format only with surfaces
enough, so a guest's 400x258 HEVC thumbnail, which asks for 8, still made
its decoder in its first session (cuvidCreateDecoder, 43 ms on an RTX 3090)
while the wallpaper's 1024x1024 decoder of 5 surfaces was kept
(m3-max-83451).
A kept 4:2:0 decoder at 8 or 10 bits with fewer surfaces than asked is now
taken and reconfigured to the asked count with the asked size, before its
first decode (Made::fit). NVIDIA's headers document that a reconfiguration
may raise the count: dynlink_nvcuvid.h of ffnvcodec-headers 13.1.15.0,
lines 505-507, on CUVIDPARSERPARAMS::bMemoryOptimize, "use
cuvidReconfigureDecoder() to increase the decode surfaces if needed (perf
may get impacted)", quoted at the take. A reconfiguration NVDEC refuses
destroys the kept decoder and makes one with the asked surfaces, so no
picture is decoded on the old count; a test fails the reconfiguration and
counts the make. The take left out a kept decoder of another GPU by
counting its surfaces as none, which a decoder that adds surfaces would
take; it now leaves it out by its GPU (pick_on_gpu), with a test.
VP9 is left out (adds_surfaces), decided before the take: on an RTX 3090
with driver 620.70.06, a kept VP9 decoder made with 2 surfaces and
reconfigured to the 11 a libvpx stream asks, cuvidReconfigureDecoder
returning success, refused the stream's second sample, a superframe whose
frames take surfaces 1 and 2, with CUDA_ERROR_INVALID_VALUE, where a
decoder made for the stream decodes it (m3-max-83719). VP9 takes only a
kept decoder with surfaces enough, as do monochrome, 4:2:2, 4:4:4 and 12
bits of their own size (D32); a test keeps a 2-surface VP9 decoder and
checks that the stream makes its own and decodes to libvpx's frames.
Measured on an RTX 3090, driver 620.70.06 (m3-max-83840; the same tests pass
on this tree, m3-max-84002): a kept 1024x1024 decoder made with 2 surfaces,
raised to as many as the stream asks, decodes H.264 High, HEVC Main and Main
10 and AV1 streams, every picture held until no surface is free (14, 8 and
8, and 17 each for SVT-AV1's streams at 8 and 10 bits), to the pictures of a
decoder made for them, and is taken for 400x272 with 8 surfaces in 3.4-4.1
ms, its reconfiguration included, against 10.8-12.4 ms for one made. A
400x258 HEVC stream's first picture, from its decoder's start through its
decode and read-back, took 7.1-7.4 ms on a kept 1024x1024 decoder raised
from 5 surfaces, 6.9-7.2 ms on one with surfaces enough and 14.1-15.0 ms on
one made (m3-max-83971, a probe).
What the guest sees: a session of a new size and more surfaces than the
kept decoder of its format has starts without a decoder made. In a macOS
26.7.2 guest's boot with this change's first form, whose HEVC take is this
one (m3-max-83913), the thumbnail's first session, 25.8 s after the GPU's
last work, took the kept 1024x1024 decoder of 5 surfaces and raised it to
8: its first decode call took 11.7 ms (cuvidReconfigureDecoder 11.66 ms)
against 42.8-43.4 ms with cuvidCreateDecoder (m3-max-83275, m3-max-83451),
but its first picture's map took 31.6 ms against under 1 ms, and the
session ended 101.5 ms after its make, against 77.7 and 98.6 ms. A later
session of that boot, 26.7 s after the last work, made and reconfigured
nothing and still took 30.4 ms to land its first picture: after such an
idle the first landing pays about 30 ms unless a make came before it.
(cherry picked from commit 1703dc3b211ade4276049fc1f3a4a066525dde68)
The table gains the x86-64 guests' remaining hand-overs, 8 rows:
- on Linux, VA-API's scratch copier: the video processing into the scratch,
and the kernel's copy from it into the output's caches;
- on Windows, the Direct3D 11 draw into a cache's surface;
- the readers of a picture whose command buffer completed at its decode;
- a section for the encode: its source, the staging out of the caches, the
access unit and the result, and an encode at a reset.
The section both guests share moves to rows 26 to 30, and row 13's test is
named by its whole module path.
Rows that read none, each already with its owner: 20, the draw whose wait's
calls fail once it is submitted or whose signal is refused; 21, 22, 24 and 25
for a walk that faults after the session took its work (row 13's path); and
19's failed wait, which no rt wait takes.
(cherry picked from commit 44d901ed8c5b01bab953d2cad1e1e3305faae3be)
docs/video/hand-overs.md lists each point where one API writes a picture or
an encode's source and another reads it: the writer, the reader, the one wait
between them, the sentence that documents the wait, the test that holds it,
and what the reader gets when nothing landed. A row whose wait reads none has
a path on which the reader can get the picture while the writer may still
write it.
It holds the hand-overs read so far, 22, as the tree is now:
- the arm64 guests' paravirtual decode: the lent surface, NVDEC's copies,
VA-API's video processing, the 4:4:4 scratches and their gather, a Mac
host's VideoToolbox picture and its copy, the lend itself, a reset;
- their encode's source, and an encode at a reset;
- the x86-64 guests' decode landings: the session's event, pages, device
caches, staging, a reset;
- what both guests share: the runtime's copies into NVENC's and VA-API's
inputs, the CPU's upload, and the CPU's read backs of VA-API's and NVDEC's
pictures.
On the rt platform no command buffer's wait fails (its wait returns once the
command buffer has ended), so a row's path for a failed wait is the testkit
platform's alone; the table says so once, above the rows.
AGENTS.md's row of the video docs names the new file.
(cherry picked from commit 05ffc21d6bb1b6181b7b219853b710779adadede)
On the rt platform a lost device is not recovered: it ends each later command
buffer in an error. For the 4:4:4 gatherer that is a pass whose wait returned
and which ended in an error (Ungathered::Failed). Its picture fails and
nothing is kept out of use. The failure was reported only by the VideoToolbox
decoder's line, "a VideoToolbox decode failed". That line has no kind of its
own, so every decode failure of the boot shared one kind. It was logged once a
decoder a reason, and the later ones were not counted at all.
Gatherer::gather now counts each such pass as video-gpu-gathers-failed. It
also logs a warn whose kind is the error's class, so the library's logger
writes each class's first line and counts the rest. This is a failure path
that a walk reports. The NVDEC and VA-API (XYUV) 4:4:4 routes both go through
it. docs/conventions.md and answer.rs list the code.
What changes for the guest: nothing. Each such picture fails as before.
Test: a_pass_that_ends_in_an_error_is_counted_and_logged_once_a_kind (stand-in
device). Four passes end in an error, with nothing kept out of use and one
arguments buffer for all. The test checks that each is counted and that the
logger's hook sees one line.
(cherry picked from commit 18e18ef8f8e31e617ef166130fff5287a8e70038)
A VA-API decode session's GPU copier (vaapi/gpu_copy.rs) kept the scratch of
every copy that failed once submitted, whether its wait failed or it ended in
an error, and made a new scratch for the next picture. A GPU that kept failing
grew the list by one dma-buf scratch a picture for the session's life. On rt,
where a lost device ends copies in an error, that was the path taken. Under a
failed wait the copier also wrote its arguments buffer again for the next
copy while the GPU might still be reading it, the same hazard the gatherer had
before 4bb5db49fc.
The copier now follows video_host::OutOfUse:
- A copy whose wait returned and that ended in an error is done on the GPU,
so the next picture's copy reuses its scratch and arguments.
- A copy whose wait failed has its scratch and its arguments kept out of use
while the session lives, and the next picture's copy makes new ones.
- At a second copy whose wait failed, the session's GPU copies end. That
copy's buffers stay where they lie. The ending is counted once as
video-gpu-copies-ended, which the degradation counts report, and logged
once a kind. Each later picture is declined, so it lands by the CPU's copy,
the landing's third way.
rt's wait never fails, so on rt these failed-wait paths are a guard.
What changes for the guest: a picture whose copy failed still fails. After a
second failed wait in a session, its later pictures land by the CPU's copy
instead of going to the GPU. The bytes are the same either way. The VA-API
test that ends a session's copies checks this on each picture declined after
the ending: a new session's copier copies that picture on the GPU, the cache
is read back, and it must match the CPU's copy byte for byte
(ReadBack::copy_coded_into, which the landing's third way runs). The copier's
existing test, now on the same helper (copy_as_the_cpu), checks every copied
picture the same way. On the host, a run of errored copies keeps no scratch
per picture.
The new code is listed in docs/conventions.md, docs/video/vaapi.md and
answer.rs's counted kinds. answer.rs also gains the three codes of 4bb5db49fc,
which it was missing.
Tests:
- On the stand-in device:
a_copy_whose_wait_fails_keeps_its_scratch_and_arguments_out_of_use,
a_second_copy_whose_wait_fails_ends_the_session_s_gpu_copies,
a_copy_that_ends_in_an_error_takes_its_scratch_and_arguments_again.
- On a VA-API host (ignored), with the test hooks fail_next_wait and
fail_next_copy:
a_picture_whose_copy_s_wait_fails_fails_and_a_second_ends_the_session_s_gpu_copies,
a_picture_whose_copy_ends_in_an_error_fails_and_its_scratch_is_taken_again.
(cherry picked from commit 658f749d30426f478cae3568c0270d5dbd8b9517)
The docs of the video arms' kept-out-of-use paths (video_host's OutOfUse,
Stage and STAGING_ENDED_CODE, gather, xyuv, nvidia and videotoolbox) said that
on the rt platform a command buffer's wait fails when the device is lost. No
such wait fails there. RtCommandBuffer::wait_until_completed returns Ok in
every case and counts a wait that rt refuses. rt's own wait
(metal2vulkan-runtime's CommandBuffer::wait_until_completed at the pinned
dfbc157464) loops until the command buffer has finished, and a lost device
ends its command buffers in an error, which that loop returns on. So on rt a
lost device's pass or copy takes the path of one that ended in an error. The
failed-wait paths, and the bound on what they keep, run only on the testkit's
stand-in device; on rt they are a guard.
The docs now say this: OutOfUse's at length, the others by pointing at it.
xyuv's stalled driver write (the VA crate's Error::Stalled) is a bounded wait
of VA-API's, not a command buffer's, so its wording stays.
Nothing changes for the guest or the host.
(cherry picked from commit 2425c5f7c1069f6e4dcb0f8194ea946aaa2a8e29)
Pin U, from dfbc157464 (T): 56 commits, no merges: c6a7995260 and its
bless commit, which touches only the translator's tables.
What changes for the guest:
- A kernel's [[stage_in]] attribute read through an indexed step
(MTLStepFunctionThreadPositionInGridXIndexed or ...YIndexed) at a step
rate past 1 is now fetched: element origin + index[min(position / rate,
size - 1)], as an M3 Max reads it (metal2vulkan's stage-in-region-clamps,
rows at rates 2 and 3). Before, the compute pipeline state was nil with
an NSError (rt's Gap::StageIn, IndexedStepRate).
- A texture of the private usage bit BlockWritesOnly (0x10000) takes a
kernel's write as one of ShaderWrite does, and takes an index: the
guest's where it places one, else one of the platform's own. Before, a
texture of the bit alone had no index (resourceIndex and gpuResourceID
0), and a write through it was refused at the dispatch
(TextureUsageAtSlot).
- A thread-local global of the thread address space compiles, each
thread's own from its initializer; before, rt refused the module
(ModuleRecord code 7).
- A device-coherent texture's reads and writes (MSL 3.2
memory_coherence_device) compile, coherent at device scope; before,
UnknownIntrinsic. A coherent access beside a storage image compiles too;
before, NotImplemented Lowering(MemoryModel).
- A kernel's or vertex function's calculate_clamped_lod through a runtime
sampler compiles under the identity domains, reading the sampler word's
minimum level; before, refused.
- A padded form's (R10Unorm_X6, RG10Unorm_X12, their _sRGB twins) linear
mip filter blends two levels, and a bfloat form's reads the nearest
level. The device makes no texture of these formats, so no guest
reaches it.
What changes on our side:
- reaches() counts BlockWritesOnly with ShaderRead and ShaderWrite, as rt's
reached does, so new_texture asks rt for an index for a texture of the
bit alone; without it, rt refuses the make (Refusal::TextureIndex).
shaders_reach_read_write_unknown_and_colour_target_usage and
textures_and_their_indices_on_vulkan hold it.
- rt's StageInKind::IndexedStepRate and the translator's
Feature::KernelStageIn are gone. The diagnostics' StageIn-IndexedStepRate
gap cannot occur and goes with its docs and the ledger's line.
a_kernel_s_stage_in_is_fetched_by_the_stage_in_region_on_vulkan fetches
an indexed step at rate 3 (the recording's row xi_rate3_o2_r4_g12) in
place of expecting the refusal; refusals_count_by_kind counts the two
forms left.
- The counts line folds rt's six restoring-make metrics as
rt-restoring-makes, rt-restoring-make-drain-ns, rt-restoring-make-wait-ns,
rt-restoring-make-wait-submissions, rt-restoring-makes-shared and
rt-restoring-make-shared-wait-ns, after the Shared coherence codes.
over_copies_fold_into_the_counts_by_their_rise holds them.
(cherry picked from commit 391961f3365b8366a9673b444b67cd7d13f5e6af)
The x86 device's own video sessions had the same gap. VA-API's zero-copy
processing into an output's pages (VaPicture::land) and NVDEC's copies
into its registered pages (write_in_place) sent a stall past DEVICE_WAIT
straight up, its work kept on Lingering; only the landings in device
caches held for it. The landing loop then cleared the planes and signalled
the session's event, so the guest's decode command buffer completed,
failed, about 5 s into the stall while the write could still land, after
a reset too.
The landing loop takes a KeptMark before each landing, and a landing that
failed with work kept since it (hold_stalled_landing) is counted
(video-landing-stall-held), logged once a boot, and held on
hold_while_kept up to STALL_HOLD before the clear and the signal; past it
the process dies. A landing that failed in device caches held there
already, so nothing is held twice. TEARDOWN_WAIT goes from 10 s to 15 s,
DEVICE_WAIT and STALL_HOLD, so a session's end waits a held landing out
instead of logging that its last picture did not land and detaching.
What the guest sees: a stalled picture's failure reaches its command
buffer up to 10 s later than the 5 s it took, once nothing of the host's
writes the output; a device that never finishes ends the process at 15 s.
A test pins that a reset's release of waits sets no session's event, so
the reset's settle waits for the decode's command buffer, and so for the
landing.
(cherry picked from commit 36ee87e5fc967b6edede54174db124be3d31c4b9)
S5-1 (06cdbdc075, b13fe6059b, 9a849a50a7) kept out of use the buffer of each
GPU pass or copy that failed once committed: the 4:4:4 gatherer's arguments, the
NVIDIA arm's and the XYUV route's 4:4:4 scratches, and a host video session's
staging buffer. Those lists had no bound: each failed pass parked a frame-sized
buffer for the life of the decoder or session, and the next picture made a new
one, so a GPU that keeps failing grew host memory without limit. They parked
too where the wait returned and the command buffer ended in an error, when the
GPU is done with the buffer.
The four places now share one rule (video_host::OutOfUse):
- A buffer is kept out of use only where the wait itself failed (on the rt
platform, a lost device). A pass or copy whose wait returned and which ended
in an error fails its picture or frame as before, and its buffer is used
again. The XYUV route's scratch after a driver's write that failed is kept
only where the write stalled (VaError::Stalled, as work_ended reads it); a
write that failed otherwise has stopped.
- One buffer is kept at most. At a second failed wait the route ends, as the
XYUV route's Gathered::Ended ends it at a refused scratch: the second buffer
stays where the route holds it, used no more, so a failing GPU holds two
buffers, not one a picture.
- Gatherer::gather answers Ungathered::Failed (its wait returned, the pass
ended in an error), Running (its wait failed, its arguments kept) and Ended
(a second: the gatherer submits nothing more).
The NVIDIA arm's route takes an ended state like the XYUV route's, kept while
the decoder lives. Its scratch refusal ends it the same way, where it dropped
the route before, and with it buffers the GPU may still read. The VideoToolbox
arm (videotoolbox.rs) keeps nothing out of use and is unchanged.
What changes for the guest: nothing on a live device. After a second failed
wait (on the rt platform, a lost device), a VideoToolbox decoder on the NVIDIA
arm or the XYUV route takes its later 4:4:4 pictures the CPU's way, as where
the device refused its scratch: lands_4_4_4_by_gpu answers false and the
surfaces come with no buffer over them. Before, each went to the GPU through a
new scratch. A host video session stops staging: each later picture that
stages a plane for a device cache fails to land at once, handed failed as it
was at its copy's failed wait before, and each later encode frame staged out of
a device cache fails, with no new staging buffer.
What changes for the host: each ending is counted, its first logged at warn
under its kind: video-staging-ended, video-nvdec-gathers-ended and
video-xyuv-gathers-ended (docs/conventions.md), each a failure path.
Tests (S5-1's tests of unbounded parking change here):
- gather: a_pass_whose_wait_fails_keeps_its_arguments_out_of_use (now
Running), a_second_pass_whose_wait_fails_ends_the_gatherer,
a_pass_that_ends_in_an_error_takes_its_arguments_again;
- video_host: a_route_keeps_one_buffer_out_of_use_and_ends_at_a_second,
a_second_copy_into_caches_whose_wait_fails_ends_the_staging,
a_copy_into_caches_that_ends_in_an_error_stages_in_its_buffer_again,
a_session_whose_staging_ended_fails_each_later_staged_picture;
- xyuv: a_second_scratch_out_of_use_ends_the_route on the stand-in device;
and, ignored (a VA-API GPU that writes XYUV),
a_picture_whose_wait_fails_fails_and_a_second_ends_the_route (was
a_picture_whose_pass_fails_once_submitted_fails_and_its_scratch_goes) and
a_picture_whose_pass_ends_in_an_error_fails_and_its_scratch_is_taken_again;
- nvidia, ignored (an NVIDIA GPU):
a_4_4_4_picture_whose_wait_fails_fails_and_a_second_ends_the_gpu_s_writes
(was a_4_4_4_picture_whose_pass_fails_once_submitted_fails_and_its_scratch_
goes) and
a_4_4_4_picture_whose_pass_ends_in_an_error_fails_and_its_scratch_is_taken_
again.
The GPU tests fail an ended pass through the gatherer's new test hook,
Gatherer::fail_next_pass; the stand-in tests through graphics::tests's
completing, which completes committed buffers with an error.
(cherry picked from commit 7a6409f1ac11af0758d08821dba3a629fe672fc5)
The device answers a VT_MESSAGE it cannot read with VT_STATUS MALFORMED, and
the host never sees it. The guest's kext counts that message as posted, so
it holds each lend the message named until a rels names it, and none ever
came. Each such message kept its lends, out of the kext's 64, until the kext
stopped.
Where the message's RgfxVtMessage struct reads, the device now sends a rels
for the nonzero lends it names, among its first surface_count, before the
VT_STATUS. A guest that did not take VT_MESSAGES gets nothing, as before.
What the guest sees: a rels naming the lends of an unreadable message,
ahead of its MALFORMED answer, so the kext gets those lends back.
A device reset left every paravirtual VideoToolbox session running. The
reset contract (reims-vgpu-graphics device.rs) says device_reset drops what
the host keeps for the guest's processes, and that the settle returns only
once nothing begun before the reset can write the guest's memory. Neither
held for these sessions. The guest's kext lets go of every lend at its stop,
but a session open at a panic or a hard reset kept its thread, its hardware
decoder, its kept views and its lent surfaces. A decode in flight at the
reset could still write a picture into the lent surface's pages after the
reset returned, and the rebooted guest may already be using those pages.
Both device_reset and the settle now end every session, as -all does
(paravirt::Host::end_sessions). A closed session sends nothing more, and its
requests end at once. Its thread carries out no message past the one in
hand and gives back what each message lent. The settle waits, within the
reset's 30 s bound on the platform's clock, for each closed session's thread
to end, so the reset returns only once no session can write. A session still
holding a message past the bound ends the process, as GPU work past the
bound does: a write a hardware decoder or GPU copy has begun cannot be taken
back.
What the guest sees: nothing of the boot before writes its memory after the
reset returns, and a message for an old session's UUID is answered as one
with no session.
vt-lends less vt-lends-given-back is not a leak count on its own. A walk
ends with QMP quit while the guest runs, and the device's release there can
end the open sessions before the exit counts line is written. Their rels
then go on an ended link, which sends nothing, and a reset closes every
older link the same way. So lends that were in flight at the quit or the
reset show in that difference without any leak, and the line cannot say
which.
A leak is a lent surface the host drops without letting go of it. The S8-1
reply in the race was one: no rels names it, and the kext holds the lend
until it stops. The host now notes each surface as it lets go of it, in
LentSurface::letting_go, before the rels is sent, whether or not it is sent.
A GuestSurface dropped without that note counts vt-lends-dropped-held, and
the first one is logged. The count is exact on any counts line, whatever
sessions are open. vt_message now checks its message's runs before it makes
its surfaces, so a refused message drops none unnoted. Nothing changes for
the guest.
The guest's kext holds at most 64 lends of IOSurfaces at once for its
VideoToolbox messages, and once they are all taken, it answers every further
message kVTParameterErr without posting it. A lend the host never gives back
keeps its slot taken until the kext stops, so a leak slowly turns the guest's
hardware video off. Nothing on the host showed how many lends it held.
The host now counts each lend a VT_MESSAGE gives it as vt-lends, the most
it held at once as vt-lends-live-most, and each lend a rels it sent gave
back as vt-lends-given-back. This covers the rels a refused message sends
too. vt-lends less vt-lends-given-back is what the host holds, plus any
rels that went on a link a reset or the device's end had closed. Nothing
changes for the guest.
A deferred IOSurface block whose SURFACE_PAGES carries runs that are not
whole guest pages summing to its surface's bytes, or that carry no page, is
answered INVALID_ARGUMENT with nothing made. Until now that refusal showed
only as a warning, logged once per boot and then folded into the repeated
lines, so a walk could not say how often a surface was refused this way, or
how big those surfaces were.
The host now counts each such refusal as surface-carry-refused, and the
surface's bytes as surface-carry-refused-bytes, on the degradation counts
line. Nothing changes for the guest: the answer is the same refusal as
before. A deferral refused for its flags is not counted under these codes.
A guest's previews make one short video session after another, each with
buffers of its own, and each size's video-processing context went with its
last import. So every session's first run was a new context's first run in
the driver, a few milliseconds on radeonsi. Measured before, on the Radeon
780M (Mesa 26.2.6, m3-max-83333): a 400x258 HEVC thumbnail's frame took 5.54
to 6.83 ms from its take to its signal across 12 sessions of one size, its
run's vaEndPicture 4.83 to 6.14 ms of that.
The imports' table now keeps the contexts of the 4 sizes imported last
(KEPT_CONTEXTS) past their last import, at most 4 at once beside those live
imports hold, and holds no surface: a context is made on none. A size
imported again moves to the back; a size imported past the 4 pushes out the
one imported longest ago, destroyed once no import holds it; the rest go with
the table, which the VA-API arm holds, so at the arm's teardown. No time
bounds it: the decoder cache's idle epoch is Windows' alone, where no dma-buf
is lent and so no import or processing context is made. A unit test fills
the table past its cap, and the 780M's hardware test pushes a kept context
out with 4 other sizes.
What 4 kept contexts, each run once, freed as they went, by the driver's
fdinfo for the process: nothing on the Radeon 780M (radeonsi, m3-max-83634),
and 7,244 KiB of drm-total-system0, 28 KiB of it resident, on the Iris Xe
(i915, intel-media-driver 26.3.5, m3-max-83635), about 1.8 MiB a context.
Measured after, the same thumbnail on the same 780M, in one job alternating
A (this change) and B (the tree without it), each arm a boot of 6 sessions 4
s apart and 6 back to back (m3-max-83795): with it, every session but a
boot's first took 1.11 to 1.97 ms from its take to its signal (median 1.55
ms, 22 sessions), against 5.29 to 6.83 ms without it (median 6.12 ms); a
boot's first session of the size, on a new context, took 5.8 to 6.8 ms in
both. The guest's warm qlmanage thumbnail took 0.072 to 0.081 s with it and
0.075 to 0.090 s without.
With the kext's 1 s bound gone, a lock waits as long as the host's span
lasts, and nothing on the host bounds that span: read from the runtime's
code, a make whose batch holds an upload into memory another API shares
waits for guest GPU work submitted with it. design.md now says the wait is
not bounded by the host, and gives the 57.9 ms span as what one walk on an
Iris Xe showed, not as a limit.
The span the docs gave came from one arm of the walk, with a reason for it
the walk did not establish. The longest span the walk measured on the Iris
Xe is 57.9 ms, its cause not yet split: design.md and HOLD_BEGIN_BOUND's
comment now give that alone, and design.md no longer says what the make
waits on.
design.md's hold section held a placeholder for the longest span a lock
waits on the hold. A guest's walk on a Linux host's Iris Xe, with the
runtime's restoring make no longer sharing its batch with the guest's command
buffers, measured 57.3 ms at the longest and 62.2 ms over its 8 spans, no
begin's wait given up and nothing declined no-lock-hold.
HOLD_BEGIN_BOUND's comment now says what holds: how the runtime's restoring
make waits, and the span the walk measured against the bound, with no runtime
commit, date or job in it.
A read-write CPU lock waited 1 s at most on a raised hold word, then went
on with the word still raised. The bound was there because any process
holding the surface could store RAISED in the block's header and keep it up.
Now only the kext and the host write the word, so nothing but the host's
span keeps it raised, and a lock that goes on inside the span loses its
writes to the span's copy back.
A lock now waits as long as the host's span lasts. The wait still ends once
the word is lowered, the device stops or resets, or the thread is aborted.
kPastBound, the bounded wait, its count and the kext's log line for a lock
past the bound are gone, so a walk's count of such locks reads 0 from now.
What the guest sees: no lock goes on with the word raised.
Both kext sets, guest/prebuilt and guest/prebuilt-arm64e, are built again
from this tree.
The hold word lay at byte 8 of a cached block's header, which every process
holding the surface maps writable: any holder could store RAISED there and
hold the other holders' read-write CPU locks of the surface. The word now
lies in the block's own part, which no process maps. Each block laid out in
place keeps a 4 KiB hold page past the span its holders map and before its
runs, and the word is the page's first u32, at region offset runs_offset -
RGFX_SURFACE_HOLD_ROOM, where the host finds it from SURFACE_PAGES. The kext
maps the page with the header and stores 0 there as it caches the block, so
only the kext and the host write the word.
The hold moves to FEATURES_EXT bit 2 (feature bit 66). Bit 1, the hold in
the header, is retired: no host offers it, a write of it takes nothing, and
it is never reused. A mixed pair therefore takes no hold. A guest with an
older kext on this host, or this kext on an older host, gets no image made
in place over a cached surface's pages (declined no-lock-hold) and no
answered creates of textures over pages buffers. Mixed pairs come only from
a stale install, since reims-ctl carries the kext sets with the host.
The host refuses a word that would lie in the block's first 4 KiB, where the
header is: such a block has no hold word, is counted (rt-shape-hold-no-word)
and its makes that copy are declined no-lock-hold. Our kexts lay out none.
The host lowers the word on every exit of a make whose span it opened: rt's
after, or the fence's own drop where the make fails or unwinds past it. As
before, a lock's wait also ends where the device stops or resets, or the
thread is aborted; rgfxHoldSleep now carries those ends, and the native test
holds them. The kext logs the live in-place blocks and what their hold pages
take of the region, and the host logs its holds with the no-word count, so
one boot per guest reads both.
What the guest sees: each in-place block takes 4 KiB more of the region on
x86-64, and 0 or 16 KiB on arm64, where blocks are whole 16 KiB pages; no
process can hold another's locks through the word. The option ROM's record
takes the wire header's new hash; the ROM's bytes are unchanged. Both kext
sets are built again with the next commit.
A read-write CPU lock of a cached surface waits while the block's hold word
is raised, 1 ms a sleep, ending only once the word is lowered, the thread is
aborted or the device stops. The word lies in the block's header, which each
process holding the surface maps writable: a process that stored RAISED there
held every other holder's read-write locks of the surface, WindowServer's
among them, for as long as it kept the word up. A Mac's locks wait for no
other process.
A lock now waits 1 s in all at most, then goes on with the word raised,
logging the boot's first such lock and counting each. Guests' walks measured
host spans of up to 63.9 ms on an Iris Xe (m3-max-83207) and 33.0 ms on a
UHD 630 (m3-max-83316), while the make shares its batch with the guest's
command buffers: the bound is about 15 times that. What the guest sees: a
lock on a word held up past 1 s goes on; a real span over 1 s, possible only
while rt shares its batch with a guest command buffer of over 1 s, could lose
that lock's write. The native test holds the bound and a span inside it.
Both kext sets are built again.
The kext admits kRgfxSubmitAnswered for a texture over a pages buffer and
waits for its COMPLETE with no deadline. The host answers such a create only
while the buffer it names is the context's (answers_create). A Submit read
the context open under the list lock and posted after, and releaseContext,
which waits for the context's asks but not for Submits, could post the
context's CONTEXT_CLOSE in between. The create then reached the host after
the close, found no buffer, and was never answered: the creating thread
waited until its process ended.
An answered Submit is now an ask (rgfxSubmitOpen): begun only while the
context is open and its close has not begun, and ended once its wait ended,
so the close waits for its answer and its create goes before the
CONTEXT_CLOSE. The host answers it while the context is open, so the wait
ends. Other Submits read the context as before. The native test stages a
close arriving while an answered Submit sits between its read and its post.
What the guest sees: no answered create hangs at a close. Both kext sets are
built again.
A kept NVDEC decoder now serves a new decoder of its codec, chroma format
and bit depth whose size is no larger on either side, with surfaces
enough, for 4:2:0 at 8 and 10 bits; other formats take a kept decoder of
their own size alone, as before (docs/video/bugs.md, D32). One of the
asked size is taken first, then the smallest larger one, so a larger one
stays for a larger stream. A taken decoder is reconfigured to the asked
size before its first decode where it was last set to another, and its
pictures decode into its larger surfaces at that size. Where that
reconfiguration fails, the kept decoder is destroyed and one is made.
What changes for the guest: a first video session of a new, smaller size,
after a larger session of its codec, format and depth whose decoder has
surfaces enough, no longer pays cuvidCreateDecoder, 43.3 ms of a 400x258
HEVC session's first decode call on an RTX 3090 (m3-max-83275). A kept
1920x1088 decoder taken for 400x264, its reconfiguration included, took
0.08-0.09 ms, against 18-25 ms for one made in the same process
(m3-max-83382). The pictures are the same: the hardware tests decode
H.264, HEVC Main and Main 10 streams of NVENC's, VP9 profile 0 and 2 and
the size-changing VP9 stream, and AV1 Main streams on a kept larger
decoder, each against its own MD5s (m3-max-83425). Left at the larger size
and reconfigured only to map, a 400x258 H.264 stream read back other
pictures (m3-max-83368), hence the reconfiguration at the take.
It does not reach the x86-64 macOS 26.7.2 guest's Quick Look thumbnail of
that 400x258 movie: its first session asks for 8 surfaces, and the one
larger decoder of its format kept by then, the wallpaper's 1024x1024 HEVC
at 8 bits, has 5 (m3-max-83451).
A static or global object with a destructor is destroyed as the process exits,
while the app's other threads may still run the bundle's code: a command
buffer's completion, a decode, a log line. A thread that then took one of the
bundle's static locks would end the process with "mutex lock failed: Invalid
argument" as the app quit, so a guest app could abort at quit, with a crash
report. No run has shown it. A review after the shell_tests race found 42 such
objects in guest/bundle/src: locks, a condition variable, sets, strings, class
tables, a shared pointer, and the video driver's session and driver lists. None
has a destructor whose work the exit needs (a flush, a file's close).
Each is now never destroyed (static T &x = *new T(), as RgfxLibraryStream's
lock already was). A guest sees nothing new while it runs; at its exit the
bundle frees none of them, and a thread still in the bundle finds them whole.
tests/bundle_exit_check.sh, first in the bundle's make test, fails where the
bundle imports ___cxa_atexit, which the compiler calls to register a destructor
at exit, and names the objects that do: on the tree before this commit it fails
for x86_64 and arm64, naming 30 objects. The bundle is the guest's only
user-space code; the kexts do not exit. Both guest kext sets are rebuilt
(RgfxGate carries the bundle), and docs/lessons.md has the trap.
A test's command queue can outlive the test: the block that runs a command
buffer's record on the queue's completion queue holds the queue until it
returns, and the test's wait wakes inside the record. The test can then return
and free its stack serializer, rings and region, and the queue's end, on the
completion queue's thread, posts its barrier fences' destroys through the freed
serializer. shell_tests aborted with "mutex lock failed: Invalid argument"
once in 30 runs on the M3 Max beside a CPU load, right after
test_commit_behind_an_untaken_write_fails.
protocol_tests' QueueFixture and its four tests that build their fixtures by
hand now never free what a queue borrows, as queue_tests' and shell_tests'
fixtures already did and as the guest's device never frees its serializer. The
bundle's code is unchanged: a guest's queues borrow the device's serializer,
which lives as long as the process. The trap goes in docs/lessons.md.
metal2vulkan-runtime records where what it makes can answer otherwise than
Metal on the host's GPU, its precision notes, fixed at the make and never
decided at a draw, and pin R gives each a stable degrade code. Nothing here
read them, so a boot's log said nothing of them.
The rt platform now reads them right after each make that succeeds: compute
and render pipeline states, sampler and depth-stencil states, textures (views
among them) and a render encoder's pass. Each note is counted under rt's own
code, metal2vulkan-degrade-<note>, kept as rt names it so the counts line
matches rt's catalogue, and the process's first of each code writes one line
on stderr. The process holds one rt device, so that is once per device.
What the host's log shows: for each code, once,
reims-vgpu: <call>: metal2vulkan-runtime made it with a precision note
(<code>): its answers there can differ from Metal's on this device; the
first of its kind, each make that carries it counted
and, on the degradation counts line, each code with how many makes carried
it. Nothing is read or counted at a draw, a dispatch or a blit, rt's notes of
commands are not counted, and there is no setting. The tests show one first
line per code, counts that run, and draws and dispatches under noted states
counting nothing.
The placement writes below the VFS, which skips its read-only check, and it
wrote into /System/Library/Caches without making that check itself, where the
BaseSystem's install makes it for /Library. Every release we keep firmlinks that
path to the Data volume, so no boot has reached a read-only place, but where the
path resolved to the sealed system volume the kext would write into it.
rgfx_place.h's steps now ask the file system whether the volume a path resolves
to takes writes (KernelPlace::writable: vfs_isrdonly of the path's mount, or of
its nearest existing ancestor's): placing on a read-only volume writes nothing
there and leaves the tree at /Library/GPUBundles, and a placed tree on one does
not move back, so the install stages nothing and the placement stays as it was.
place_test covers both over a directory whose volume answers read-only while
its writes still succeed, as the kext's do. For the guest: nothing changes on
the releases we keep; the check adds one lookup per pass.
A make in place copies a cached surface's pages out and back around its image's
first layout move. A BLOCK_RELEASE of the block, or a SURFACE_PAGES that names
the block's pages again, did not wait for that span: either one's answer lets
the guest take the pages back, and the make's copy back could then write the
bytes it saved over what the guest wrote there next.
Both now wait for the span before they are answered, as a begin that uses the
block does, at most the same bound, and count as the begin's waits do. The
tests take a release and a naming of the pages inside a make's span on a thread
of their own and find each answered only after it.
A command buffer that writes a surface's device cache can end between the
host's decision to make a texture in place over the surface's pages and the
make's fence. The cache then holds a write the pages lack, and nothing kept a
download of the surface out of the make's span: the download copied the write
into the pages, and the make's copy of the bytes back undid it, while the host
held the pages as having it. The guest's lock then read the old bytes.
The fence now refuses the make as busy wherever the decision's own "behind"
rule holds at the fence: the shape takes the host's own image, and a later
begin moves it in place once the pages hold the write. A block free of that
holds no write the pages lack, so a download inside the span copies nothing.
The test runs the write's begin on a sibling decoder between the decision and
the fence, and a download inside the span, and reads the write in the pages.
The first red test of a CPU write lost inside a make in place passed before any
fix (job m3-max-82675): the fake platform's import of the pages was a buffer of
its own, so the make's save and write-back never reached the pages the guest's
lock wrote. docs/lessons.md now says how to spot the next such test.
On a host whose GPU shares the CPU's memory, rt makes a texture in place over
a cached surface's pages by copying the bytes under it out and back around the
image's first layout move. A guest write to those bytes inside that span was
lost (the two tests of the commit before), where a Mac keeps it. The make now
runs rt's RestoreFence around the span, which keeps its writers out:
- The guest's read-write locks. A new device feature, FEATURES_EXT bit 1
(SURFACE_HOLD), is taken in a new register, DRIVER_FEATURES_EXT (0x05c).
Where the driver took it, the host raises a hold word in the cached block's
header (offset 8) before the copy out, rereads the surface's CPU generation
after a full fence, and refuses the make as "unsettled" where a lock moved
it. A lock that finds the word raised sets WAITED and waits. The host lowers
the word once the bytes are back and, where a lock waited, posts
SURFACE_HOLD_LOWERED (0x413), whose vector wakes it.
- The device's own writers. The make is refused as "busy" where a command
buffer that uses the cache is begun and not ended, or a copy into its pages
or a fill from them is in flight. Otherwise the block is marked made, and a
begin that uses it waits for the span's end, at most 100 ms.
- The thread that made a texture over a buffer of its own pages. Where the
driver took the hold, the host answers each TEXTURE_FROM_BUFFER and
LINEAR_TEXTURE_FROM_BUFFER over a BUFFER_OVER_PAGES buffer with a COMPLETE
once carried out, so the thread's writes after its create follow the span.
This is a device-wide rule (A), not a per-block flag (A'): on Linux, whether
a block's make restores (its import by address, not as dma-bufs) depends on
the views' folds at their budget and on rt's refusals, which come after the
pages are answered, so no answer can carry it exactly. The rule only waits
more, and its waits are counted (rt-pages-texture-creates-answered, -ns).
A driver that does not take the hold, as the kexts before this change, gets no
make that would copy the bytes out and back: it is declined as no-lock-hold,
and the shape takes the platform's own image. That is decided up front where
every import of pages lies in host memory (a Mac, Windows), and per block on
Linux once a make over the block's import ran the fence.
What the hold does not cover: a guest thread writing those bytes with no lock,
or another device's DMA, inside the span; and a read under a read-only lock
then may see other bytes. docs/known-issues.md says so, with the hosts.
The two red tests pass. New tests cover a lock ahead of the hold, a command
buffer and a copy in flight, a begin inside the span, the device's register
and event, and the answered creates. Each writer kind's tests fail with its
check switched off (job m3-max-82923).
A step in front of an atomic replace removed the live tree the replace was to keep, and the rename's lookups followed a final link. Both were found in review; the lesson names place_test's red and green runs and how to spot the next one.
A failed update on a placed system left no bundle at all. To write at the
bundle's path as before, the install removed the link and the placed tree,
the live bundle, before it staged; a stage or final rename that then failed
(a write error, a full Data volume) left nothing in /Library/GPUBundles or in
the placed directory, so that boot had no Metal device. Before placement the
swap always kept the old tree whole, as installBundle's comment promises.
The install now removes the link and moves the placed tree back to the
bundle's path, so the swap exchanges it whole and a failed install leaves it
there; the pass then places whichever tree is at the bundle's path, the new
one or the old. A link that cannot be removed, or a tree that cannot move
back (the link is made again), leaves the placement as it was and stages
nothing, and a link still at the bundle's path when the staged tree is to go
in stops the rename. A placement that finds no tree at the bundle's path
moves nothing, so a placed tree left by a pass that ended between the move
and the link stays for the next install to move back.
The rename looks both ends up without following a final link, as rename(2)
does: a followed link at the target handed VNOP_RENAME(X) the link's target,
a directory elsewhere, under the link's name and parent. The AppleGVA
preference's atomic write shares the rename.
The steps' order moves to rgfx_place.h, over the file system as a parameter,
and tests/place_test.cpp runs it over real directories with each step made to
fail in turn.
The oracle doc's Q9 "ours" column and Q30, and the register's %spi-no-dylibs
reason, still told what the device answered before the runtime became its
platform. Each now says what the code answers, citing it:
- maxArgumentBufferSamplerCount is 3999, the runtime's sampler indices, not 0;
- the sparse tile sizes are 0x0x0, the AMD's: the runtime has no sparse
textures, and the device info carries no tile;
- supportsFunctionPointers is the runtime's YES, and supportsDynamicLibraries
its NO, beside the lane's NO for supportsRaytracing;
- Q30: the device makes no dynamic library: both dylib queries answer NO, and
a make that reaches the host answers its refusal, where the old paragraph
said every answer was the AMD's;
- %spi-no-dylibs: the base's NO is the lane's answer, as no dynamic library
is made, where it said the lane made a compute pipeline's.
On an arm64 guest on macOS 27, Preview and Quick Look quit when they show
a 3D model: macOS draws part of the model's lighting into a texture format
that Metal lets programs write only on a GPU that reports an Apple family,
and our device reports none until it can do everything a family promises
(docs/graphics-kext/design.md, item 10). Intel Mac guests show the models.
Q5 said our stack makes memoryless textures. At pin 208360ab6d
metal2vulkan's runtime refuses one at its create (Gap::MemorylessTexture),
and the platform answers the guest nil, counted under rt-refused-gap
(rt_refused_texture_create), so the note says that.
design.md item 10 still said Apple3 waited on indirect command buffers. The
lane has carried them, with a compute one's memory barriers and binary
archives, since they joined WIRED in device_info.rs, which already says it
carries Apple1's to Apple3's pieces and holds every Apple family at none
until each piece up to Apple7's is carried. The item now says the same, and
names the first pieces it lacks, Apple4's tile pipelines and imageblocks.
On a full system RgfxGate now places the Metal bundle's tree under
/System/Library/Caches/ai.aneesiqbal.reims-graphics and links
/Library/GPUBundles/reims-graphics.bundle to it, and Metal maps the
executable by the placed path. amfi-map counted WindowServer's mappings of
GPUBundles/reims-graphics.bundle alone, so every arm64 boot with the
placement read "maps the bundle 0 times" and failed, while
windowserver-metal and metal-app passed on the device (arm64 26.6.2 under
TCG on the 780M). It now counts mappings by either path.
The placement was checked by walks that ran no check-boot; docs/lessons.md
gains the trap, and docs/qemu.md says which paths the check reads.