The fork's nvme device completed a write that found the host disk full to the
guest as Write Fault, and pflash_cfi01 logged 'Could not update PFLASH' and
dropped the variable. Both now follow the drive's error action: under -drive's
default werror=enospc the VM pauses (io-error, the drive's io-status nospace,
which reims-ctl reads to name the file), and the resume runs the write again
(fork 51d47e28, 1e223049, 0beafad0).
The kext gave each process's context a number once, counting up from 1, and
never again. A number is the top 24 bits of the context's 64-bit object ids
(RGFX_CONTEXT_OBJ_ID_SHIFT) and of its doorbell page's bind, so the 2^24th open
of a boot carried ids past 64 bits, onto other contexts' ids.
Numbers now run below 2^24, in turn from where the last was taken, wrapping
past the last to 1 and skipping those held. A number is held from its open
until both the device has answered its close OK (no framebuffer started, or a
late answer, counts as well; a refused close keeps it) and its user client is
freed, so no call of the client's, and no create it posted behind its close,
can reach the device once another process takes the number. Where every number
is held, or the 2048 the kext keeps, the open is refused with
kIOReturnNoResources, as when no unit of GPU addresses is free: the bundle
answers that process no Metal device, and a later open takes a number once one
is given back. A live number is never given out twice.
context_numbers_test pins it near the top: the last numbers below 2^24, the
wrap to 1 past those held, a number reused only after both holds drop, and
every number held refused with nothing changed.
A queue's service thread hands the host its queue's OBJECT_DESTROY when its
loop ends, in no order against its context's CONTEXT_CLOSE. A thread held in a
command buffer while the guest destroys the queue and its process closes went
on to hand that destroy after the close was answered, and once the kext gives
the context's number to another process (the next commit), such a late destroy
could end that process's queue of the same id.
The close now marks every queue of its context whose thread has not yet handed
its destroy, a queue the guest destroyed first among them, under a lock of the
queue's that the thread hands the destroy under: the destroy reaches the host
before the close, or not at all, as the host drops the queue with the
context's objects at the close. Pinned by
a_closed_context_s_queue_hands_no_destroy_after_the_close, which fails with the
check taken out (the destroy handed after the close).
rustfmt joins two assignments the batch's commits left split, and clippy's
type_complexity refuses the VideoToolbox caps table's inline tuple type, so the
table's row gets a type of its own. Nothing changes for the guest or the host.
RgfxGate carries the Metal bundle, which now refuses a pipeline that links a
function made by name that declares constants, and ends the process at a
view of several slices of a linear 2D array. make -C guest prebuilt and
prebuilt-arm64e rebuilt both sets from this tree (m3-max-80177), and
prebuilt-check passed on them.
A view of a range of more than one slice of a 2D array over a buffer, made
by the linear form, answered nil. Metal asserts at it on the M3 Max and an M4,
plain and validated ("sliceRange.length == 1", measured by metal2vulkan), and
neither x86 Mac makes such an array, so every Mac on record ends the process
there. The bundle now ends it too, before anything is sent, after the view
rules both x86 Macs share.
A view of every slice named by its pixel format alone still answers nil:
Metal's answer for that form is not measured, and it goes to the oracle
probe.
For the guest: a process that asks for such a view now ends at the call, as
on a Mac, where it went on with nil. The shell test that held the nil keeps
only the pixel-format form, and a death test checks the range.
A linked function made with constant values that set none of the constants
it declares, or by a descriptor without values, options or a specialized
name, reached the host with no constants. The host then made it by its name,
and the Vulkan runtime refused the pipeline that linked it, where Metal makes
that pipeline and the function reads its unset constants as undefined. Stage
functions were fixed the same way in e6d1572dd5. This was the last path that
still made a function by name.
The host now makes each linked function as it makes a stage's function: with
its constant values, even when there are none. That covers pipelines and
function handles. A function made by name that declares constants would then
be made with them undefined. So the bundle now refuses a pipeline that links
such a function, as it refuses one of such a stage function, in the same
words with the role "linked function", and sends nothing. Metal's answer for
a linked function made that way is not measured; the host's runtime refused
that pipeline before this change too.
For the guest: a pipeline that links a function made with values that set
none is made, and the function reads its unset constants as undefined, as on
Metal. The decoder test links tests/shaders/linked_optional.metal's function
by name, sent with no constants and then with one, on the Vulkan platform.
The two fake-platform tests that held the by-name make now expect the make
with constant values. The bundle's shell test checks the refusal in each list
of each creator, and the record sent for a function made with no values.
No header of the macOS 27.2 SDK states what a GPU write into memory a
process maps read-only, or into a no-copy buffer of bit 24, does:
MTLDevice.h says only that newBufferWithBytesNoCopy wraps an existing part
of the address space, and bit 24 is no public MTLResourceOptions value. The
accuracy ledger's read-only-pages-written entry now says so, and words the
known gap as the planner ruled it: a GPU write into memory the guest mapped
read-only stays visible until the next commit that uses the copy.
The video crate gained a macOS module, videotoolbox, and reims-vgpu its arm,
graphics/videotoolbox.rs, with the Mac host's decode. AGENTS.md's "Where
things are" named only the Linux and Windows modules and arms, and the
checks table had no check for the new module: a change to it or its arm is
checked by tools/vt-check.sh on a Mac, which decodes its streams on the
hardware against ffmpeg's MD5s.
An arm64 macOS 27.0.1 guest's boot on the M3 (m3-max-80121) decoded seven
H.264 and HEVC streams to ffmpeg's MD5s on the arm and played and recorded a
movie of each codec with no bad frame, so formats.md's H.264 and HEVC Main and
Main 10 cells name it, and D29 gives its count of GPU-copied pictures and KiB.
formats.md also names the arm's caps_of among the arms' caps.
The arm64 kext serves its paravirtual VideoToolbox decoders only where the
device's video caps hold an H.264 or HEVC decode entry with a profile
(rgfxVtServesDecoders), so with no caps written an arm64 guest on a Mac host
decoded in software. The arm now writes one decode entry per codec the host's
hardware decoder answers a profile of: H.264 Baseline, Main and High at level
6.2 and HEVC Main and Main 10 at level 6.2, with NV12 where a 4:2:0 8-bit
profile is offered and P010 where a 10-bit one is, all from the probe's
answers.
devices.md says what the arm offers, how the host answers it and how a
picture lands; formats.md fills the M3 Max's column and narrows N2 to what is
not built; bugs.md records the GPU copy as D29 with its bytes a picture; and
conventions.md and answer.rs name the arm's counts' codes.
An empty array expanded under set -u stops bash 3.2, the system's, which a
job's shell on the Mac is: every 8-bit stream's encode failed. The arrays now
expand as ${a[@]+"${a[@]}"}.
The planner's acceptance of the Mac arm asks for MD5 conformance.
tools/vt-check.sh writes the streams of h264-check.sh and hevc-check.sh of
each profile, chroma format and depth the arm offers, with their encoder
options, decodes each on a session that requires the hardware decoder, and
compares its frames with ffmpeg's MD5s, or x265's reconstruction where
ffmpeg's decode differs, as hevc-check.sh does. lib.sh now says it serves the
decoder checks, not VA-API's alone.
declines matched a stream by chroma format and depth alone, so an HEVC range
extensions stream at 4:2:0 and 8 bits passed on Main's offer and failed only
at its first decode, where the host's session refused it. The host answered
for a profile, chroma format and depth together, and a stream is now taken
only where one offer has all three.
The planner's ruling records the GPU copy as a known gap with its bytes
(docs/video/bugs.md, D29) and gates the CPU's copy as a degradation.
video-vt-pictures-gpu-copied and video-vt-gpu-copied-kib count each picture
the GPU copied and its rows' KiB, and the CPU's code becomes
video-vt-pictures-cpu-copied, named as the other arms' picture codes are.
The decoder keeps one command queue for its copies, where one was made for
each picture. The ignored test lands a stream's pictures through the arm into
a lent surface's pages, in VideoToolbox's layout (one copy a plane) and at
rows 256 bytes wider (one a row), and by the CPU's copy with no buffer handed
over, each byte against VideoToolbox's own read back and the bytes outside
the planes untouched (m3-max-80012: H.264 8-bit, HEVC Main 10, H.264 High 10
and HEVC Main 4:2:2 10).
reims-vgpu's new graphics::videotoolbox arm serves an arm64 guest's
paravirtual decoders on a Mac host. It lists the probe's answers by profile
at each codec's top level, declines any other stream at its session's start,
and copies each picture from a buffer over VideoToolbox's IOSurface into the
Shared buffer over the guest's lent surface on the device's GPU: one copy a
plane where the pitches agree, else one a row. VideoToolbox takes no memory
of the caller's for its pictures, so the copy is the one a picture the
planner accepted. The CPU's copy through the host's view of the pages is the
fallback, counted and logged once a reason.
GuestDecoder gains lands_by_gpu, so vt.rs hands the buffer over for every
surface of such a decoder, and GraphicsVideo gains guest_decoder_list, so the
arm's decoder list comes from its offers, not from caps it does not write: no
x86-64 guest runs on a Mac host.
VideoToolbox lists no profiles of its decoders. The probe makes a session
that requires the hardware decoder for each stream the arm would list (H.264
Baseline, Main and High at 8 bits and High 10; HEVC Main, Main 10 and Main
4:2:2 10), from parameter sets of its own for a 64x64 picture, and the host's
answer is the sessions it makes, so the arm offers only what the host takes,
with no model names in code. The M3 Max makes all seven (m3-max-79934).
A Mac host had no video arm, so an arm64 guest's paravirtual VideoToolbox
decoded in software there (owner 3447). The video crate's new videotoolbox
module, built on macOS, makes a decoder session that requires the hardware
decoder from a stream's parameter sets, for a destination of the guest's own
buffer attributes (its format and size, rows aligned to 64 bytes and planes to
256), decodes each access unit synchronously, and hands out the picture's
IOSurface and its planes. The bindings are hand-written extern "C" of
VideoToolbox's, CoreMedia's, CoreVideo's, IOSurface's and CoreFoundation's C
API: no new crate. Its ignored test decodes a stream on the hardware against
ffmpeg's framemd5 (m3-max-79925).
A no-copy buffer or heap of option bit 24 pinned in a known block of
writable pages keeps the GPU's writes. The docs and the line counted under
rt-no-copy-read-only said Metal's GPU drops them, which is the M3 Max's
answer alone: on the 5300M and the UHD 630 bit 24 does nothing, and every
GPU write lands in the buffer's pages (dgpu-oracle.md, Q38). The case is
inside what the Macs answer, so nothing changes in what it does; the docs,
the accuracy ledger and the line now say whose answer it is.
copy_on's last argument, the rounds' queues beside whether it ends its
encoder, is a type clippy's type_complexity refuses under -D warnings: a
type alias names the queues.
oracle_iosurface gains three steps: sy (a blit's synchronizeResource: of the
process's texture, alone in its command buffer), and gws and gcs (a blit's
write and a render pass's clear, each followed by synchronizeResource: in
the same command buffer). sync365.txt runs them against a control with no
synchronize: the 5300M answered (m3-max-79926) that after the synchronize
and the buffer's completion a read with no lock sees the GPU's write, and
without it the old bytes until the surface's lock. The host's synchronize
copy follows that answer.
A guest's synchronizeResource: or synchronizeTexture:slice:level: of a
texture over an IOSurface did nothing on the host for a cached surface: the
write stayed in the device cache (or the texture's shape image) until a CPU
lock asked for a download. A Mac's synchronize makes the write reach the
surface's memory once the command buffer completes: measured on the 5300M
(macOS 26.7.1, m3-max-79926), a read with no lock saw the GPU's write after
the command buffer completed when it synchronized, and the old bytes until
the surface's lock when it did not.
What the guest sees now: after synchronizeResource: (or
synchronizeTexture:slice:level:) and the command buffer's completion, a read
of the IOSurface with no lock sees the GPU's write, as on the 5300M.
The walk encodes the copy at the sync op, inside the guest's own blit
encoder, after the work before the op: the shapes the walk saw written so
far and the dirty ones go into the cache's buffer (which takes the pages
first where a straight fill left it lacking them), and the buffer goes into
the pages, through their view or by their runs. Where the pages are
copied (staged), the copy goes into staging pieces, and the CPU lands them
in the pages once the command buffer completes, before its CB_COMPLETE is
posted. The cache keeps its record, so the next download copies the write
again. A refused copy fails the command buffer as a refused download
would. Counted as synchronized.
The device answered areRasterOrderGroupsSupported yes on every host, the
M3 Max's answer. But rt's translator orders a fragment function's raster
order groups only inside the fragment shader pixel interlock, and refuses
a pipeline of them on a device without it. An RX 550 on RADV (Mesa
26.2.6) reports no pixel interlock, so a guest there that was told yes
had its raster-ordered pipelines refused.
The device now answers yes where rt's device creation enabled
fragmentShaderPixelInterlock, and no elsewhere, as Metal has a GPU
without raster order groups answer; the bundle's SPI raster order groups
feature follows the same flag. The answer stays yes on the 780M, the RX
7900 XTX, the Iris Xe and the NVIDIA cards, and is now no on the RX 550
(RADV POLARIS12) and on a Mac host over KosmicKrisp, which lists neither
VK_EXT_fragment_shader_interlock nor the feature. x86-64 and arm64 guests
read the same flag, so both are told no there.
The AMD Radeon Pro 5300M and the Intel UHD 630 answer yes (macOS 26.7.1,
oracle_caps, potluck jobs m3-max-79873 and 79874); neither lacks them.
raster_order_groups_are_rt_s_answer holds the answer; no test held the
old one.
The messages target fuzzes every type ring 0 carries out, but six creates
never got past the decoder's first checks at random: a texture's resource id
and pixel format, a heap to place a buffer in, a buffer to lay a texture
over, and a pipeline's library and function names are rarely right in
fuzzed words. In m3-max-79886's run TEXTURE_CREATE, BUFFER_AT_OFFSET,
TEXTURE_FROM_BUFFER and the render, compute and mesh pipeline creates were
carried out 0 times in 98 to 115 tries each, so their make paths and every
message mutated from a made object of theirs went unfuzzed.
setup now also makes library 9 (bytes the fake platform takes as a library,
which finds every function name) and placement heap 10 (1 MiB, Private), and
one in four of the messages not mutated from earlier ones is a well-formed
create of one of the six (seeded) over setup's objects: a 64x64 BGRA8
texture, a Private buffer at a page of the heap, a texture over buffer 2's
first bytes, or a render, compute or mesh pipeline of the library's
functions. What the decoder carries out of them joins the case's messages
that later ones are mutated from. The target now also fails where a seeded
create is never carried out.
Tests (m3-max-80112, homelab-um870-1, fake platform): the fuzz's six targets
pass; the messages carried out each create 238 to 378 times over 384 cases.
Red, with the seeds replaced by fuzzed messages: the target fails, naming
the render, compute and mesh pipeline creates (0 carried out); the other
three were carried out 1 to 3 times, through setup's new library and heap.
rustfmt is clean on the file.
Where the guest took IMPORT_ADDRESSES_LATER, a pages block's SURFACE_PAGES was
answered as soon as its runs were carried out, and its view was then mapped
and imported on the same surface worker job before the block settled. The
surface worker runs at most four threads, so four blocks' view makes held
every thread, and the next block's SURFACE_PAGES waited for one behind them,
however short its own carry-out. On the RTX 3090's gcl boot (rowb-3090,
m3-max-79853) carry-outs took at most 2.1 ms, view makes 14.9 ms at the
median and up to 351 ms, and 64 answers took over 50 ms, up to 133 ms: of the
225 over 20 ms, 163 waited while four or more other blocks' views were being
made.
The view made after the answer now runs on the views worker
(reims-vgpu.graphics-views-<i>), a worker of its own under the block's key,
which holds the block's settle until the view is made: the messages that
name the block wait for it as before, and the surface worker's thread goes
on to other blocks' SURFACE_PAGES. A job of the block's on the surface worker
(its BUFFER_OVER_PAGES, or its next SURFACE_PAGES) that finds one of the
block's on the views worker runs behind it there (Worker::behind, one step
under the worker's lock), so the block's jobs keep their order across the two
workers; a SURFACE_PAGES run there makes its view itself, so no views
worker's job hands one to the views worker. The views worker runs at most
POOL_THREADS (4) threads, as every worker does, and holds at most
VIEWS_WAITING (256) jobs waiting (Worker::bounded): a hand-over that finds
that many waits on its surface worker's thread until one is taken, counted
and logged at debug. The busiest 100 ms of the same boot carried out 140
SURFACE_PAGES. No setting changes either number. The view's make takes the
reset gate shared, recursively, as the surface worker's jobs do, and where
the device was reset since the SURFACE_PAGES' begin it makes nothing.
What the guest observes: a LATER SURFACE_PAGES is answered without waiting
for other blocks' views; its own block's later messages wait for its view as
before. What the host observes: raise_interrupt may come on a views worker's
thread (a SURFACE_PAGES or a BUFFER_OVER_PAGES run behind a view there posts
its answer or its command buffer's failure), named in reims_vgpu.h, api.md
and RAISE_THREADS. QEMU's raise_interrupt callback takes a call from any of
the library's threads (the irqfd's write, the WHPX request under msi_lock, or
a BH), as it does from the surface workers', so its side needs no change.
Nothing changes where the guest did not take IMPORT_ADDRESSES_LATER.
Tests:
- a_pages_block_s_answer_waits_for_no_other_block_s_view: four blocks' view
imports held, a fifth block's SURFACE_PAGES is answered, no surface worker
cap hit, the views worker at four threads, and a BUFFER_OVER_PAGES over a
held block made only after its view.
- a_reset_ends_pages_views_made_after_their_answers_cleanly: a reset waits
for the view being made; the view waiting on the views worker and the
buffer behind it make nothing after the reset; both blocks settle.
- a_device_released_while_pages_views_are_made_after_their_answers_ends_clean:
the release waits for neither view, and the device's control goes once
both views' jobs end.
- worker: a_bounded_worker_s_hand_over_waits_for_room,
a_job_behind_a_key_runs_after_its_jobs_or_here_where_it_has_none.
make -C guest prebuilt and prebuilt-arm64e on the M3 (job m3-max-80045) at
the class's tree. In both sets, RgfxGate's Metal bundle now keeps every write
the kext refuses in one queue until it goes, failing commits behind it with
MTLCommandBufferErrorInternal. Nothing else in the sets changed: Graft and
ReimsGraphics are byte for byte as before.
A refused write into an object was lost. An indirect command buffer's
records and slots and a visible function table's entries were dropped with a
log line, and a shared event's setSignaledValue: was dropped with none. The
kext refuses a control-ring post once its ring has stayed full for 5 s, or
once the device has stopped. Later command buffers then ran the ICB's old
commands or the table's old entries. A buffer already posted that waited on
the event's value never ran, even once the host read again.
Row 318's queue of refused Managed notes now holds every such write, in one
first-in-first-out order: ICB_WRITE, ICB_SLOTS(_IN_PAGES), FUNCTION_TABLE_SET
and SHARED_EVENT_SET_VALUE besides the range, region and didModifyData. A
waiting write is posted before the next write, a destroy or a commit, and
from a timer once a second while any waits. The timer means an event's value
still reaches the host when nothing else is posted. A destroy now waits behind
the waiting writes, since a record or a table entry may name its object, and
drops the writes into its own object. A refused ICB_SLOTS of several buffers
waits as one message for each buffer. The device's stop ends the timer and
drops what waits.
What changes for the guest: while such a write waits, a commit fails its
command buffer unposted with MTLCommandBufferStatusError and
MTLCommandBufferErrorInternal, as for a refused Managed note before. Once the
kext takes posts again, the writes go in order before the next buffer. At
most 4096 writes or 16 MiB wait. Past that, a write is lost and every later
commit fails Internal. After the device's stop every commit fails the same
way. A write is never dropped while later work runs. Nothing changes where
the kext takes every post.
What the guest sees now: after a decode into an IOSurface whose device
cache knows the surface's layout (the kext gave it, or a decode wrote the
surface whole), where the decode op says the surface holds the coded
picture's rows past its crop (output_rows), a download or a release copies
those rows into the pages too, as far as the surface holds rows for each
plane: a 1080p 420v output's luma rows 1080 to 1087 and chroma rows 540 to
543. Before, the cache's copies moved each plane's crop rows alone, so the
pages kept what they held below the crop, where a Mac's decoder writes the
coded rows into the surface. That held both in a cache laid out at the
GPU's pitch (radeonsi's 2048-byte rows for NV12's 1920) and in a cache in
the pages' layout whose layout is known.
From that decode on, a fill moves the same rows into the cache, so both
directions move the same bytes. A decode whose picture lands in the cache's
own surface writes nothing of the buffer and records nothing. A decode that
lands the crop alone by a copy leaves those rows as the cache held them
(the pages' after a fill, else the make's zeros), and the download moves
those. The caches' counts line counts the decodes that widened a cache's
copies. Ledger row 789.
metal2vulkan-runtime at its development commit cffa762bda: G (9a89d5e25c,
CI only) and the heap-alias fix. A heap texture placed over another's bytes
now leaves the undefined layout at its first use rather than in an upload,
which ends AMDVLK's loss of texels over aliased heap textures. RADV, ANV
and NVIDIA keep their answers; the runtime's public API is unchanged, so
nothing here changes with it.
187b37f1c9 drops a command naming a cache's buffer that lacks its pages
before its memory is asked. The refused-memory test's shaped cache, whose
first use filled its shapes straight from the pages, met that drop first
and never reached the refused memory it checks. A deferred block's cache,
whose pages are not named, lacks none, so its blit still meets the refused
memory and fails with MTLCommandBufferErrorOutOfMemory. Ledger row 1115.
What the guest sees now: an op that names an IOSurface device cache's
buffer itself, while that buffer lacks the pages its shapes took straight
from them and no begin has readied it, is dropped, and its command buffer
fails with MTLCommandBufferErrorInternal. It used to run over the zeros of
the buffer's memory's make and complete as if it had read the surface.
The op is met inside its encoder, where no copy of the pages can go ahead
of it, so failing the buffer is the one answer that does not hand the guest
wrong bytes as done. It is counted under rt-shape-lacking-named as before,
its first logged, and the buffer's memory stays unmade, so the next copy
through it takes the pages first.
The bundle never names such a buffer: its id goes out only in
TEXTURE_FROM_IOSURFACE creates. The test that held the zeros read becomes
a_command_naming_a_buffer_that_lacks_the_pages_is_dropped_and_fails_its_buffer,
and the copied-through-once test's command now names a deferred block's
buffer, which lacks no pages. Ledger row 1115.
The bundle now answers maxComputeThreadgroupMemory from the device info, so
the oracle table's row gives the device info's answer for each guest instead
of the Metal base's 65536. This lands in one batch with the bundle's getter.
The device info's max_compute_threadgroup_memory slot carried the
platform's 65536 bytes, Metal's on the M3 Max, on every host, while the
runtime refuses a kernel's threadgroup memory past
maxThreadgroupMemoryLength, which the device answers as rt's told limit
(32,752 or 32,768 bytes). Both x86 Macs answer the two alike, 65536 and
65536 (AMD Radeon Pro 5300M and Intel UHD 630, macOS 26.7.1, oracle_caps,
potluck jobs m3-max-79873 and 79874), so an x86-64 guest's framework may
size a kernel by either.
For an x86-64 guest the slot now holds the device's
maxThreadgroupMemoryLength; an arm64 guest's keeps the platform's 65536,
the M3 Max's pair. No guest reads the slot yet: the guest's
maxComputeThreadgroupMemory is still its Metal base's 65536, until the
bundle answers it from the slot.
compute_threadgroup_memory_follows_the_guest holds the new slot; no test
held the old one.
The device answered supportsTextureWriteRoundingMode: yes for modes 1
and 2, the M3 Max's answer. No pipeline create on the wire carries a
rounding mode, so the host's pipelines round as the runtime's default,
toward zero, whatever the descriptor asks: a guest told yes for mode 2
(round to nearest even) got a pipeline that rounds toward zero, and the
bundle logged the mode as unsupported.
The guest's device now answers no for modes 1 and 2, for both guests and
on every host, as the AMD Radeon Pro 5300M and the Intel UHD 630 answer
(macOS 26.7.1, oracle_caps, potluck jobs m3-max-79873 and 79874). The
answer is the lane's, in device_info's table, until a pipeline create
carries the mode to the runtime, which takes it. No test held the old
answer; no_texture_write_rounding_mode_is_carried holds the new one.
The device answered supportsPrimitiveType: yes for the raw types 5 to 8,
the M3 Max's answer, but the runtime draws only the public types 0 to 4
and refuses a draw of any other as a primitive type Metal has none of. A
guest framework told yes would have encoded draws that drew nothing.
The guest's device now answers yes for 0 to 4 and no for 5 to 9, as the
AMD Radeon Pro 5300M answers (macOS 26.7.1, oracle_caps, potluck job
m3-max-79873); the Intel UHD 630 answers yes for 5 to 9 (m3-max-79874).
The answer is the same on every host and for both guests.
a_roomy_device_answers_metal_s_counts held the old answer.
make -C guest prebuilt and prebuilt-arm64e on the M3 (job m3-max-79916) at
this stack's tree. In both sets, RgfxGate's Metal bundle now fails a queue's
buffers in flight at the device's stop, ends a commit's wait for ring room
and a queue's finish there, makes no argument encoder of a descriptor value
past 32 bits, fails commits behind a Managed write the kext did not take,
logs a refused IOSurface lock, and answers maxComputeThreadgroupMemory from
the device info. Nothing else in the sets changed: Graft and ReimsGraphics
are byte for byte as before.
maxComputeThreadgroupMemory (MTLDeviceSPI, `Q16@0:8` in macOS 27's
Metal.framework, both slices) came from Metal's base, which answers its
feature profile's 65536 whatever the host takes. Both x86 Macs answer it
the same as maxThreadgroupMemoryLength (the AMD 5300M and the Intel 630,
macOS 26.7.1, oracle_caps).
The device now answers it from the device info's
max_compute_threadgroup_memory slot. What changes for the guest: an x86-64
guest reads the device's maxThreadgroupMemoryLength there (32752 or 32768,
where it read 65536), the same as its own maxThreadgroupMemoryLength. An
arm64 guest sees no change: the host gives it the M3 Max's 65536. With no
device info it answers 32768, as maxThreadgroupMemoryLength does. The host
fills the slot in lane devanswers' commit, which lands in the same batch.
protocol_members.txt lists the getter as implemented, and the caps-blob
test reads the slot.
A Managed texture's replaceRegion:, a texture's didModifyData and a Managed
buffer's didModifyRange: tell the host to copy the CPU's bytes to the GPU's
copy. The kext refuses a post once its control ring has stayed full for 5 s
(a host that stopped reading), and also once the device has stopped. On a
refusal the bundle dropped the message without a word: the region and
didModifyData always, and the range when the held messages would not fit
with it. Every command buffer committed afterwards read a stale GPU copy.
Such a write now waits in the serializer (postWaitingNotes). It goes first
at the next such write and at each commit, and is dropped when its object is
destroyed. What changes for the guest: while a write waits, a command
buffer's commit fails it unposted with MTLCommandBufferStatusError and
MTLCommandBufferErrorInternal, as a buffer behind a held create already
fails. Once the kext takes posts again, the writes go before the next buffer,
which runs as before. Past 4096 waiting writes, the next one is lost and
every later commit fails. Nothing changes where the kext takes every post.
test_commit_behind_an_untaken_managed_write_fails covers each kind.
newArgumentEncoderWithArguments: cut each descriptor's data type, index,
array length, access, texture type and block alignment to the wire's 32
bits. So a value past 2^32 wrapped, and the guest got the layout of another
argument where the host, given the value, makes no encoder (rt_platform's
argument.rs counts it as Metal's refusal).
What changes for the guest: such a descriptor now gets nil, logged once,
and the host is asked nothing. Every descriptor within 32 bits gets the same
answer as before. test_argument_encoder_query covers an index, an array
length and a block alignment past 32 bits.
When an IOSurface's lock was refused, three things were skipped without a
word: a copy view's upload from the pages, the write-back of a CPU write
into the copy, and a cached view's flush of the GPU's writes into the
pages. Skipping is right, as none of them can be done without the lock, but
nothing in the log said so.
lockSurface now logs the first refusal at each of these sites, with the
surface's id, the lock's options, kr and what is left undone. Nothing else
changes for the guest.
The queue's finish waited on its committed buffers' group with no deadline
and never took the queue's completion ring. Every other wait for a command
buffer takes the ring itself where no completion thread drives it (none
could be made, or the thread was destroyed). With no thread, the buffers
finish waited for completed only if another thread took their records, so
finish could wait for good.
finish now takes the ring meanwhile as the buffers' waits do
(rgfxWaitFor), looking again every millisecond, and with a driving thread
it looks each second whether the thread has gone.
What changes for the guest: where no thread drives the ring, finish
returns once the host has completed the buffers committed before it. It
used to wait for good. With a driving thread nothing changes. queue_tests'
new test runs finish on an undriven queue.
A commit that found its queue's submission ring full waited for the host to
take from it, with no deadline: on the host's room record where the device
holds SUBMIT_ROOM, else in sleeps between looks. Once the device stopped,
the host took nothing more, and the ring may already be gone from the
process with the context's window, so the committing thread looked at it for
good. The same held for a waiting thread's scheduled ask.
A queue's reader now stops the ring's room events with itself
(RgfxReplyReader::stop). A post waiting for room ends there, and a post
after it answers at once, looking at no ring word and ringing no doorbell
(RgfxRingWriter::post). Every queue now has room events, as the stop's
channel; whether the post waits for room records still follows SUBMIT_ROOM,
so the waiting is unchanged.
What changes for the guest: a commit waiting for room on its queue's ring
at the device's stop returns, and its command buffer fails with
MTLCommandBufferErrorInternal ("Discarded (victim of GPU error/recovery)"),
as a buffer committed after the stop does (previous commit). Before, the
commit never returned. serializer_tests' new test runs the writer's wait
across the stop with and without room records, and queue_tests' new test
runs a commit's.
When the kext closed a process's completions (the device's stop, or the
context's release), the completion thread ended and left its readers
undriven, so each wait for a command buffer took the queue's ring itself.
No record could come there any more, and the kext also takes the context's
window, the rings in it, out of the process. waitUntilCompleted,
waitUntilScheduled and commitAndWaitUntilSubmitted spun on the ring for
good, -commandBuffer polled it every millisecond for slots the buffers in
flight never gave back, and the queue's finish slept for good, where they
did not read memory the process no longer mapped.
The completion thread now stops every reader at that point, and each one
added after (RgfxReplyReader::stop). A stopped reader reads its ring no
more and fails every command buffer it still awaits, in ring order, as a
GPU recovery's victim. A buffer committed after the stop fails at its
commit, with nothing put on its ring. Such a failure touches nothing of
the buffer's surfaces or copies.
What changes for the guest: at the device's stop, each command buffer in
flight or committed afterwards completes with MTLCommandBufferStatusError
and MTLCommandBufferErrorInternal ("Discarded (victim of GPU
error/recovery)"), the bundle's answer for work a stopped device never
took. Its scheduled and completed handlers run, and every wait for it
returns. Before, the buffer never completed. A buffer committed after
the stop no longer goes on its ring, and its waiter no longer takes
records from the ring.
shell_tests' test_completion_thread_stops held the old behaviour (a buffer
committed after the stop completed from a record its waiter read off the
ring). It now holds the failure, and keeps the ring-taking waiter for a
destroyed thread. queue_tests' new test runs every wait above across the
stop, alone with `shell_tests --waits`.