The renderer makes a tessellated draw's vertex and control shaders one kernel
that takes the draw's vertices as a patch control point input, and makes its
compute pipeline under a stage input descriptor. Metal compiles that input in
no kernel (m3-max-30197): its own devices define the input's control point
function from the descriptor. The device's pipeline of the kernel was refused,
and the renderer drew the draw's vertex and control stages in software.
A kernel variant with the input now keeps its module's text, and its compute
pipeline is made of the kernel made one without the input under the
pipeline's descriptor, once per descriptor: a wrapper kernel of the same name
takes the buffers the fields read and the stage input region's origin, and
the control point function, defined in place of its declaration, fetches each
field as Metal's [[stage_in]] fetch does. The pipeline answers the variant's
reflection. GL tessellated draws run on the GPU where the renderer drew them
in software.
The fetch matches the M3 Max's own [[stage_in]] kernels bit for bit, for every
attribute format and step function (gl_tests' stage input oracle,
m3-max-30314), which measured two of its conversions: Int1010102Normalized's
10-bit components are c times the float nearest 1/511, and RG11B10Float's
NaNs are 0x7fc00000.
What the guest sees changes: the device answers targetDeviceArchitecture
(MTLDeviceSPI) with an MTLTargetDeviceArchitecture, Metal's own class, of
cpuType 0x01005247, subType 0, version 1.0.0 and driverVersion 0x10000. It
answered nil, the IOGPU base's answer.
Metal's loader ends the process at nil (+[MTLLoader sliceIDForDevice:
legacyDriverVersion:airntDriverVersion:]), and MTLAssetUpgraderD, which asks
Metal's archive reader about every .metallib of an app it is told of for
every device, ended with SIGABRT at each app installed in the guest: 1-2
reports in every walk since pin 70, on Iris and the 3090.
Every Mac answers an object (oracle_archtype: AMD 5300M, Intel UHD 630, M3
Max, dgpu-oracle.md Q42), so nil is outside the envelope. The values name
each GPU's own compiler target, so the device names its own: CPU_ARCH_ABI64
with its PCI device id, which no Metal slice carries, so no archive holds a
slice Metal reads as this device's; one target whatever the host GPU; and
one version for both version fields, as the M3 Max and the Intel 630 answer.
Where the guest's Metal lacks the class or its setters, nil as before.
inherited_tests now checks the answer, and the register's line says why it
changed.
Step 3's Super Resolution walk on the Radeon 780M at development cee5813f2
(m3-max-29610) replaces the numbers from an older pin: 3480 of 6289 command
buffers waited at the gate for their context's held creates and destroys, 138
ms in all; carrying them out on the queue's thread cuts 42.5 ms of that
(simulated on the trace), under a walk's run-to-run spread. A bounded wait
without sleeping, measured against the same trace, could save at most 17 ms
for 34 ms of spinning, and was dropped.
A command buffer's queue thread waited at the gate while a ring-0 thread was
woken for its context's lane, then was woken itself once the lane was through.
Geekbench Metal's Super Resolution waits so for the BUFFER_AT_OFFSET creates and
OBJECT_DESTROYs the bundle flushes ahead of each commit: on the 780M, 4172 of
6823 buffers waited, 62.6 us at the median and 190 at the 90th percentile from
take to host begin, 12 and 38.5 of it the queue thread's own wake after the
last job (rtsr's walk A).
Now the queue thread carries out the lane's front job itself where the lane's
thread carries none out yet, the buffer waits for it, it is ready, and it is a
BUFFER_AT_OFFSET or an OBJECT_DESTROY of no queue (a queue's destroy routes its
doorbell, and the other kinds may wait long). The job is the lane's running one
meanwhile, so the lane's thread waits for it before its next: the lane keeps
one job at a time in ring order, and every wait for the lane sees it as before.
The buffer waits for the same messages, carried out through the same code
before its begin; only the thread that carries them out changes.
Tested by the new device tests in help.rs: with ring 0's threads holding off,
the buffer's thread carries its creates and destroy out in ring order, once,
before the buffer; it leaves an event's create to the lane's thread; what it
may take; and random runs of creates, destroys, slow messages and buffers keep
every buffer after its context's messages and ring 0 in order.
A 4-sample BGRA8Unorm or BGRA8Unorm_sRGB attachment's MultisampleResolve or
StoreAndMultisampleResolve into an RGBA16Float, BGR10_XR or BGR10_XR_sRGB
texture the guest made over an IOSurface ended the process at the pass's
making, named "not measured". The device makes such a texture over the
buffer that stands for the surface (new_texture_over_surface_plane), and
the drop of that resolve was measured only for textures of their own memory,
shareable ones and textures over an OS IOSurface.
oracle_surfresolve measured the rest (dgpu-oracle.md Q41). The M3 Max leaves
the texture untouched over a surface without planes and over planes 0 and 1
of a 420v surface, Shared, Managed and Private, as it does a texture of its
own (m3-max-29682, m3-max-29690). The 5300M and the UHD 630 write
RGBA16Float in every shape and make no XR texture (m3-max-29683, 29684,
29691, 29692). The GPUs differ, and the drop is the M3 Max's answer, which
costs nothing, as the runtime resolves into no other format.
So a texture over a surface's plane now tells itself apart (OverSurface;
Over::Surface and Over::Plane), and the drop takes it in any storage mode,
which the device picks (Private over a device cache), not the guest. A
dropped resolve no longer counts as a store into read-only memory: such a
pass completes with the memory unchanged, as the M3 Max completes it (Q38).
For the guest: such a pass now completes, the texture keeping its texels and
the samples kept as by DontCare or Store, where the process ended. A texture
over a buffer that stands for no surface still dies, named. The Metal
comparison test gets its IOSurface shapes back over stand-ins, and two new
tests hold the drop over surfaces and over read-only memory.
The design's account of a commit's kext call said its time in the kernel was
not yet split. The kext's kdebug stamps split it in Geekbench's Metal Super
Resolution on the 780M host: the framebuffer look-up each post made (16.1 of
33.3 us p50) was the guest kernel's own code, and the rest is the host's exits
and the system call's entry and return. It now records that split, what the
lane's cuts left (18.9 us p50, the doorbell exits and the call's entry and
return) and the commit's time before and after on the 780M and the Iris Xe.
The completion thread's arm-once paragraph now names the kext's take of ring
0's completion ring, which keeps the same rule (ReimsGraphics::takeCompletions,
RgfxCompletionArm.hpp, completion_arm_test).
A command buffer committed while the control ring held messages made two kext
calls: SubmitBatch posted the held, then the bundle published the buffer on
its queue's ring and rang the queue's doorbell through the kext. The second
call costs its kernel entry and return around the doorbell's write: measured
with the commit probe and the kext's stamps at 4.6 us p50 a commit on the Iris
Xe host (1.3 in, 2.0 the write, 1.2 out), and on the 780M host 4.5 us warm and
11.3 us after 2 ms idle (3.2 in, 2.7 out). Every commit the probe made behind
held messages rang it.
Where the kext answers kRgfxKextFeatureQueuePublish, SubmitBatch takes three
scalars more: the queue, its ring's new producer and the doorbell's flags. The
bundle writes the buffer on its ring and fences its stores, leaves the
producer, and hands the publish to the held (RgfxRingWriter::tryPost's `via`,
RgfxSerializer::publishVia). Once the kext has posted every held message it
stores the producer, fences, reads consumer_idle and rings the doorbell as the
bundle's own publish does (RgfxQueuePublish.hpp), so the host sees the held on
ring 0, then the buffer, as before. A commit with nothing held, or behind an
indirect command buffer's encodes or a refused destroy, goes as before; so
does every commit with a kext that lacks the bit. Where the kext leaves a held
message other than a destroy unposted it publishes nothing, and the bundle
takes the buffer off its ring unseen, its seqno the next buffer's and its
expected records dropped (RgfxReplyReader::forget), and fails it as before.
The buffer's posted time is stamped before the call.
The kext maps each queue's submission ring header at QUEUE_CREATE, while the
ring's block is pinned, only where the block is the client's own (ownsBlock),
in RgfxAcceleratorUserClient::keepQueueHeader. It lets the mapping go before
the pages can: at the queue's destroy (destroyQueueIfTracked), at Free of the
block the ring lies in, before the free, and at the context's close
(releaseContext, before the window and the blocks go). Each publish runs under
the client's list lock, which every drop takes. A device reset frees no block:
the mapping stays the process's ring until one of those. A queue past the
client's first 64 is published by the bundle.
Tests: queue_publish_test (the kext's publish against the bundle's own, every
consumer state and flag, and the headers' table through create, free, destroy
and close), shell_tests' test_commit_hands_its_publish_to_the_held (one call,
nothing held, a kext without the bit, a refused create, refused destroys
alone) and user_client_words_test (the bit).
On the M3 Max a kernel's write through an argument buffer of 500, 503, 507, 523
and 527 stores the same bytes into both planes as the write through a slot: the
4:4:4 formats their codes, 500 nothing. metal2vulkan asked for it before taking
the slot answers for the writes it refuses through an argument buffer; the
platform's own refusal stays as it is until the runtime stores them.
A depth attachment's StoreAndMultisampleResolve into a resolve texture over a
guest's read-only memory (bit 24, or pages mapped read-only) ended the process
where the pass was made, or at the late store action or resolve texture, as the
runtime faulted it where the M3 Max completes it with the texture unchanged.
The runtime now stores the attachment and drops the resolve (metal2vulkan
RUNTIME 2298, in this pin), so the pass is sent and the command buffer
completes with the pages unchanged, for the descriptor's action and a late one,
into the descriptor's resolve texture or one the setter's SPI named. That is the
M3 Max's answer, given to every guest; the x86 Macs write the texture.
Beside a stencil attachment that resolves, or whose store action is still
Unknown, the runtime faults the pass, and nothing measured Metal's GPU there, so
that pairing still dies at the same three sites. A late resolve texture over
such memory for an attachment the pass lacks still dies too: RUNTIME 2298 does
not reach it. The tests that held the death now assert completion with the
pages zeros, and the pairing's death at each site.
Q39 gives what the M3 Max, the AMD 5300M and the Intel UHD 630 answer for a
command buffer that protection options fail, alone and beside a store into
read-only memory, with the job ids and OS builds, and what the platform now
answers. Q40 gives the bytes Metal stores through 523 and 527 on the M3 Max,
which the x86 Macs do not make, and where the runtime refuses those writes.
The design's figure of about 1,000 imports at Geekbench Metal Super
Resolution's midpoint counted no-copy objects, not imports. A third walk on
the Radeon 780M (2026-11-14) read the imports directly, from debugfs's
amdgpu_gem_info and the runtime's dma_buf_memories_live gauge. About 580 were
live, under about 1,573 no-copy objects, of the 945 buffer objects the process
held; about 605 of those are the runtime's own memory by its gauges.
vkQueueSubmit took about 494 us a batch.
The design doc and the module doc now give those numbers. The projected gain
becomes a batch of about 250 us or less. Feature Matching, Particle Physics
and Fluid Simulation hold 2,000 to 8,700 other buffer objects that are not
the runtime's, so grouping cuts less there. The replay's 81 to 86% is stated
as a cut in the live views' imports, which is what it measured.
On RADV each live view of a pages block is a dma-buf import of its own, and
every vkQueueSubmit lists every import, at about 0.45 us each. Geekbench
Metal's Super Resolution holds about 1,000 of them at its midpoint, and its
submits took about 450 us (Radeon 780M, macOS 26.7.2 guest).
The surface worker now gathers a context's views for a short window and has
the platform put them in one shared file, so the driver lists one import per
group instead of one per view.
How a group forms:
- The BUFFER_OVER_PAGES or HEAP_OVER_PAGES job that makes a block's view
maps it and joins its context's open group (SurfaceViews::join_group).
- A group stays open 1 ms from its first member, or until its runs or bytes
reach the platform's limits.
- A job of its own, under the context's key, then seals it: group_views,
then each view's import, made as a piece of its file.
- The seal hands back the members' messages in their order, those that
joined while it sealed among them.
- The context's and the blocks' settles drop only after that, so the guest's
later messages still see each buffer as right after its create.
What takes no group: a view over 16 MiB, a view past a group's limits alone,
a cached view, a heap over the guest's RAM, a read-only block, and a bit-24
buffer (the last two are made over a copy).
What falls back:
- A view the platform leaves alone, or whose piece the runtime refuses,
leaves its group and is made alone.
- A context's close and the device's reset drop the groups being formed.
The guest sees the same objects, GPU addresses, refusals and order of events.
Only the timing changes: the first message after a burst waits up to 1 ms
more. Where the platform answers no limits (NVIDIA, ANV, the Mac), nothing
changes at all.
The views log line counts the grouped views and the groups.
docs/graphics-kext/design.md says what the guest sees, and that a member
whose buffers went keeps its pages pinned in its group's import, with each
group's bytes capped at 64 MiB.
Tests, all on the fake platform's virtual clock:
- a burst shares one group;
- contexts never share one;
- a reset or a close inside the window makes nothing;
- a refused group, and a refused piece, fall back per view;
- a view past 16 MiB and a read-only buffer take no group;
- a group closes at its limits.
design.md's region notes now say how the kext writes ring 0's submit data
(write-combined on x86-64, fenced before the producer; arm64 as before) and
what it measured: a SubmitBatch call on the 780M host went from 33.6 to
31.3 us p50, so the data's stores were a small part of it. The interrupt
notes say the completion thread arms an idle ring once and stores consumer
only on a take, which ring/interleavings.rs walks.
oracle_waits on the 5300M, the 630 and the M3 Max: a queue's statuses,
handlers and waits run in one order on its completion queue. A status changes
before its stage's handlers, waits return only after them, and a handler that
blocks holds everything of its queue after it. Our delivery keeps that order.
The probe now counts a status its polling thread never read apart.
dgpu-oracle.md Q38 records oracle_readonly's runs on the M3 Max (macOS
27.0.1) and the dGPU oracle's Radeon Pro 5300M and UHD Graphics 630 (macOS
26.7.1), each shape with its class: agreed, divergent or outside the
envelope, and the x86 finding that bit 24 does nothing there. The accuracy
ledger's read-only-pages-written row, the writes module's docs, the command
module's note on read-only store faults and design.md's no-copy buffers say
what the platform now answers: a store-out faults as the M3 Max's does, every
other GPU write completes with its write dropped, a CPU write lands where the
pages are writable, and a depth StoreAndMultisampleResolve into such memory
still ends the process until metal2vulkan completes it.
newBufferWithBytesNoCopy: over Shared memory the process maps read-only took
a slab copy that the bundle merged from the memory at every commit using it.
On macOS 12.7.6's WindowServer, which wraps clients' Core Animation backing
stores (VM_MEMORY_LAYERKIT, mapped read-only, 8-30 MB each) so and draws from
them every frame, that merge was 14.10 s of the commit path's 14.25 s over a 451 s walk, 130,850 MiB
compared, and its commit-to-post wait 2-6 ms a frame where 14.8.9's is
20-60 us (appwalk14, ms01's Iris Xe).
Where the kext makes a read-only pages block (RGFX_FEATURE_READ_ONLY_PAGES),
such memory now lies over its own pages: the bundle asks the block for
reading alone and makes its BUFFER_OVER_PAGES with Metal's private bit 24,
sent to the host alone. The buffer answers the app's options, without the
bit, as Metal's does; its contents, length, allocatedSize and GPU address
(the pointer's offset in its page) answer as before. Read-only blocks join
only read-only ones. Read-only Managed memory keeps its copy: the host's two
copies would write the CPU copy back to the pages. Where the kext gives no
block (a host without the bit), the copy stays.
What changes for the guest, beside the time: the GPU's writes to such memory
follow accuracy-ledger.md's read-only-pages-written row, as Metal's do, where
the copy kept them in the slab for later command buffers to read:
- a shader's store, a blit's fill or copy and a pass's visibility results
into it complete with their writes dropped, and later command buffers see
the memory as it is;
- a pass that stores an attachment there (Store,
StoreAndMultisampleResolve) fails its command buffer with
MTLCommandBufferErrorPageFault, where the copy let it complete;
- the CPU sees its pages unchanged, as before.
On Linux the runtime makes a bit-24 buffer over a copy of the pages today,
compared with them at each commit that uses it, so the per-commit compare
moves from the guest's process to the host's commit until metal2vulkan
imports such memory in place.
The shell tests that held "read-only memory never asks for a block" now hold
the new route: the ask for reading alone, the bit on the wire and not in the
buffer's options, and the copy where no block is given. Both guest sets are
rebuilt in the 📦 commit that follows.
A no-copy buffer over memory its process maps read-only cannot lie over its
own pages today: the kext refuses the pages block, and the host would lay a
buffer over it that takes the GPU's writes. So the bundle syncs a slab copy
of it at every commit that uses it. macOS 12's WindowServer wraps clients'
Core Animation backing stores, mapped read-only into it (8-30 MB each), that
way, and spent 14.1 s of a 451 s walk syncing them (appwalk14, 12.7.6 on the
Iris Xe). This makes the device and the kext ready to keep them in place; the
bundle takes the route in the next commit.
What changes on the wire:
- A new feature bit, RGFX_FEATURE_READ_ONLY_PAGES (bit 45, FEATURES_HI bit
13), offered wherever PAGES_BUFFERS is, and taken by the kext.
- A new SURFACE_PAGES flag, RGFX_SURFACE_PAGES_READ_ONLY (1 << 5), meaningful
with RGFX_SURFACE_PAGES_PRIVATE alone (else INVALID_ARGUMENT): the pages
block holds pages its process maps read-only.
- BUFFER_OVER_PAGES needs no new field: its options already carry
MTLResourceOptions bit 24 to the host, which hands it to the runtime as
memory whose GPU writes it drops (accuracy-ledger.md,
read-only-pages-written).
The host keeps every object over a read-only block from writing its pages: a
BUFFER_OVER_PAGES without bit 24, a HEAP_OVER_PAGES, an ICB_SLOTS_IN_PAGES
and a MANAGED_BUFFER_CREATE or MANAGED_TEXTURE_CREATE whose CPU copy lies over
one are refused, each logged as the guest error it is. The block's view stays
the writable mapping of guest RAM.
Where the kext took the bit, PagesBlock makes a block of read-only memory too:
it wires the pages with kIODirectionOut, which asks the VM system only for
read access, completes them for that direction at the unwire, and marks the
block read-only (rgfxPagesWiring). Without the bit it refuses read-only
memory as before.
Why a feature bit, though reims-ctl ships the host and the x86 set together:
the mark is where the host holds the line, not a hint. A process can post any
message on its rings, so a forged BUFFER_OVER_PAGES without bit 24 over a
read-only block would let the GPU write pages the process maps read-only, a
file's page cache among them. A host older than the mark ignores it, so the
kext makes such a block only where the host took the bit. The arm64e set also
reaches VMs through Ambrosia's config bundle, apart from the host. Old guest
sets never ask, and change nothing; a new set on an older host gets no block
and keeps its copy.
The header is regenerated, and the option ROM's record takes the header's
new hash (the ROM's bytes are unchanged); both guest sets are rebuilt with
the bundle's change, in the 📦 commit after it. Tests: the
header test, the peer and offer tests, a decoder test of what a read-only
block admits and refuses
(a_read_only_pages_block_holds_only_buffers_that_drop_their_writes), and the
kext's features and pages-block tests.
GpuDevice::new_command_queue_unshared's doc listed the device's blit and
exec queues and the process's frame queue, which no code makes since the
paravirt lane went, and left out the decoder's release queue and the window
mirror's queue, which do exist. It now names the queues made unshared today,
each with the reason its own doc gives: the window sink's and its mirror's
(on a present's path), the IOSurface device caches' transfer queue (presents
and cache-drawn frames wait for its fills) and the decoder's release queue
(no guest command buffer may hold up the signal of a closed context's
events).
design.md said the host logs each unshared queue at info on
reims_vgpu::graphics; since f75493990 the line is at debug on its own
target, reims_vgpu::graphics::queues.
What changes for the guest: newFunction now answers nil with
MTLLibraryErrorDomain 3 (CompileFailure) and Metal's own lines ("error:
buffer argument b has invalid location (<0,1>) in k\n"), by any way of
making the function, where function constant values put two present
arguments of one argument table at overlapping locations through
(a) a predicate or an index computed from a half constant,
(b) an index computed through a conversion between a float and an integer,
(c) a function table (visible or intersection) or an acceleration
structure (primitive or instance) at a buffer's location.
Before, newFunction made the function in those three cases and the
pipeline's create refused it later on the host (OverlappingArgument). Metal
refuses at newFunction (oracle Q33), and the bundle already did so for
every other case its AIR reader decides.
Why the bundle missed them: the initialisers' evaluator folded no half
constant's value; the compiler writes a float-integer conversion as a call
(air.convert.u.i32.f.f16 and the like), which it took as any value; and the
reader did not count a function table's or an acceleration structure's
location, whose table and word were not measured.
Q33's probe, oracle_overlap, gains eight functions (k_halfpred, k_halfidx,
k_fidx, k_sidx, k_vft, k_ift, k_pas, k_ias), measured on the 5300M, the 630
and the M3 Max (m3-max-28663, 28662, 28659). The three oracles agree on
every newFunction answer: function tables and acceleration structures take
locations of the buffers' table, with the word `buffer`; a half constant's
predicate and index, and an index through conversions truncated toward
zero (-1.5 gives -1), count as any other. One pipeline differs: the 630
refuses k_vft's compute pipeline where the table is called, its compiler
service dying (CompilerError 1, XPC_ERROR_CONNECTION_INTERRUPTED), while
the 5300M and the M3 make it. Making it stays inside what the x86 Macs
answer, so nothing here follows the 630 there; Q33 records it.
For the overlap check alone (rgfxAirConstantGlobals) the evaluator now
folds a half constant's value, rounds each half result to the nearest half
as LLVM folds a half, and folds air.convert of scalars between floats and
integers (a float to an integer only where the truncated value is in the
integer's range); the bodies' specialisation (reflection's used arguments)
still takes those as any value. The reader counts a function table's or an
acceleration structure's location in the buffers' table, and the check
names it `buffer`. test_overlapping_arguments_refused_as_metal compares
the eight new functions with this Mac's Metal for every value and way, and
checks the x86 Macs' words.
Still left to the host, written in Q33: an initialiser operation the
evaluator does not fold (vector or array elements, conversions of two
integers or of vectors, other calls), an air.buffer with no address space
(no form built writes one), and a function of a library Metal's link made,
which keeps no bytes.
The Vulkan platform refused a split while a unit of command predication
was open, and every compute encoder opens one, so a buffer of compute
encoders alone was never cut: Geekbench 7's Fluid Simulation commits
2,600 one-dispatch encoders in one buffer, and its GPU work waited for the
whole walk. A split now needs only no block open, no loop body being laid
down again and no unit an unbalanced record emptied
(Predication::cuttable). A unit open at the cut goes on in the next part
(Predication::go_on): its first dispatch type, work, indirect dispatch and
numbering carry over, so what Metal decides by the unit (an unbalanced
encodeEndIf after its work, a first indirect dispatch of another type)
dies where it would in the whole buffer. With no block open the GPU's skip
counter is 0, so the next part's counter, reset at its first step, stands
for the cut part's.
For the guest only timing changes, and where a walk faults after a part
was committed, that part's work has run, as for a buffer of render passes
(only invalid input reaches that).
dispatch_cost's fluid shape (1 buffer of 2,600 encoders of one dispatch,
M3 Max, MoltenVK, release, median of 5 runs of 6), through the decoder:
first take to completion 87.0 ms -> 34.8 ms; the walk's CPU 14.7 -> 8.8 us
a dispatch (164.2k -> 110.6k instructions), as the runtime's work for an
encoder grows with the encoders before it in its buffer. The small (64 x 5
encoders) and one-encoder shapes are not cut, and stay as they were.
Tested by a_unit_goes_on_in_the_next_part,
a_block_open_keeps_a_command_buffer_whole and the encode_compute dies and
goes_on cases across a split.
The design said the GL renderer's Apple settings need Apple7 and the vendor
"Apple". Its five settings records (macOS 27.0.1, arm64e) show Apple5's and
Apple7's are the same in every setting the renderer reads but the largest
point it draws, 16 pixels against 64, so Apple5 with a vendor none of AMD,
ATI, NVIDIA and Intel is the narrowest pair. The section now lists the
other settings the Apple records hold (the texture upload and mipmap path,
the seams on cube maps, the point clamp) and why the device claims neither:
Apple4's and Apple5's rows hold tile shaders, imageblocks and nonsquare tile
dispatch, which the device does not carry and the runtime refuses on every
device (its audit on an Iris Xe at metal2vulkan c796a88d6a: 26 of Apple5's
rows block), and the Apple settings send GL_POINT polygon mode as
setTriangleFillMode: 2, on which the platform dies.
Route 1's design notes described the CPU ordering the two GPUs and named the
sync-file export as the step still to take. The draw now waits for the
mirror's sync on the compositor's GPU, so the notes say how, and where the
window's thread still waits.
They record the walk pair on pin 83 that measured it, warm against warm, on
um870's RTX 3090 beside its 780M compositor and on um790's 780M beside its
XTX compositor: the render thread's wait a sync fell from 4.63 to 0.45 ms
and from 4.25 to 0.99 ms. Every sync went to the compositor as a sync file,
none after host copies, and rates and latencies held.
They also explain Mission Control's take-to-show median rising from 2.2 to
14.4 ms under route 1: its presents fall in two groups, those finished by
their take and those whose writers still run, and route 1 made the second
group faster (39.1 to 15.2 ms) and larger, so the median moved between them
while the mean fell from 18.2 to 10.0 ms. The GPU wait leaves both groups
as they were.
Where the guest took GUEST_TIMES, a queue's thread notes the host's clock as
it takes each buffer, before the gate, and as it comes back to the ring after
the buffer before it. With ring 0's clock offset (its bound read with
acquire, then the offset) it splits the buffer's time before the take:
encode (committed - made), post_wait (posted - committed), queued (behind
the queue's buffer before it, on the host) and transport (the doorbell, the
thread's wake and the ring), posted mapped to the host's clock. With no
offset held only encode and post_wait are given.
Each buffer's spans go to the host's trace as a cbguest event: queue, seqno,
the spans, the offset's bound, and held, the time from the take to the event,
so a reader places the take. Once a second a debug line of target
reims_vgpu_graphics::guest_times gives the buffers' count, each span's sum
and median, and the longest transport. Both are diagnostics: the device does
nothing else differently, and reads nothing of a guest that did not take the
bit.
The device's tests: a stamped buffer's spans reach the trace, alone and
queued behind a buffer the host holds; a buffer without the op, or a guest
without the bit, gives no event; with bound 0 there is no transport. The
module's own tests cover the spans' clamps and the line's window.
The host sees a command buffer only once a queue's thread takes it off its
ring, so the app's encode and the buffer's way to the host show as one span
with nothing pending on the host. This adds the guest's stamps that split it,
a diagnostic.
What changes for the guest:
- The device offers a new feature bit, RGFX_FEATURE_GUEST_TIMES (bit 44,
FEATURES_HI bit 12), and DRIVER_FEATURES takes it. The kext carries it.
- Where the device's word holds it, the bundle starts each command buffer's
stream with a new op, RGFX_OP_GUEST_TIMES (0x000e, 32 bytes): the guest's
clock as the buffer was made, as its commit was entered, and as its message
went on its ring. The last is written under the ring's lock, after the copy
and before producer is published; for a buffer in a block, into the block.
- After each VBLANK's reading of HOST_TIME the kext writes ring 0's new header
fields: guest_clock_offset_ns (0x18), then guest_clock_bound_ns (0x20) with
release, split out of reserved bytes. The host zeroes both as it initialises
a ring.
- The decoder walks the op as a no-op, so it changes nothing a buffer does,
and a host that did not offer the bit never sees it. Old guest sets carry
no bit, send no op and leave the fields 0.
The header is regenerated, both guest sets are rebuilt from the same sources,
and the option ROM's record takes the header's new hash; the ROM's bytes are
unchanged. The tests cover the op's and fields' layout (the header test, the
kext's vblank clock test), the bit's negotiation (the kext's features test,
the peer and memory-map tests), the stamps (the bundle's serializer and shell
tests) and the walk (a cmdbuf test, and the fuzz's streams). The host's
reading of the stamps is the next commit.
The design's route 1, the window shown by the compositor's GPU through a mirror
of the changed tiles, is built: the doc now says how the mirror is made, synced
and drawn, how the CPU orders the two GPUs until the runtime's sync file is
taken, and where it falls back.
It records the before/after walk on um870's RTX 3090, whose compositor is on its
Radeon 780M, against development at fe56cae17 on the same runtime: the link's
megabytes a present fell from 31.2 / 2.0 to 6.1 / 2.5 over the walk, the 3090's
busy time from 21.0 to 9.5 ms a present, the guest's rates held, and the render
thread waits 1.6 to 10.8 ms a present for the tiles' copy.
A prototype laid only the presented surfaces in place, with the window as
today, and walked the desktop on um870's RTX 3090.
About 169 MB crossed the link a present: 90.5 MB from the GPU beyond today's
34.8 MB window copy, and 78.8 MB to it. That is five times today's copy and
27 times what the frames change. The guest's presents over the walk fell
from 4324 to 1735, and the autoscroll from 45 to 9 a second.
The cause is the composite's own passes: the runtime's GPU renders and
blends WindowServer's frame into guest RAM over the link, loads included,
while the shadow counts stay flat. So the presented surfaces keep their
device caches, and route 1 is the route taken.
The order of encoders' writes is all three Macs' answer (class 3), the bytes
past a plane's texels the Macs' divergent one (class 2). An arm64 macOS 27.0.1
guest on the M3 now answers the eight aliasing cases as the M3 does natively
(a64walk oracles step, m3-max-27485; before, m3-max-27484, the wide texture
was refused).
dgpu-oracle Q37 records oracle_surftex's aliasing cases on the three Macs: a
write through one texture over a plane reaches the next encoder's read through
another, tracked or behind a fence, on all three; the bytes past the plane's
texels are the surface's own on the M3 and the GPU's own on the x86 Macs. It
says which answer each wide home gives. Decided 14 in the device's design and
the oracle tools' list name the wide home and its copies.
Q36 holds oracle_surftex's sixth and seventh rounds on the M3 Max, the AMD
5300M and the Intel UHD 630: the atomic bit and 0x8 left out of every
texture's answer, the formats the atomic bit takes, and the usage bits
Metal's validation ends the process at.
On an RTX 3090 or RTX 2080 behind an x4 or Thunderbolt link the walk ran 20 ms
of GPU time a present, against 2.8 ms on the RTX 5080 Laptop GPU, and moved 25
to 44 MB a present across the link. Device-cache fills and downloads were the
same on all three, so they don't explain it. The extra bytes go from the GPU
to the host: the window's swapchain is the runtime's GPU's, and where the
compositor runs on another GPU each window present moves a LINEAR copy of the
window's image (29.75 MB at 3648 x 2039) across the link. The window presents
0.93 times for each guest present, so each carries a new frame. The 3090's
link moves 1.83 GB/s from the GPU from any queue family, and NVIDIA presents
only from its graphics family, so neither another present queue nor the copy
engine would help. Only fewer bytes per present would.
The swapchain module's doc records that platform fact. design.md (Decided, 14)
records the walks, the link's and the compositor GPU's rates, and how much the
guest's frames change a present (6.27 MB of 29.7 MB on average, measured with a
build that is not landed, steelbrain/x4link-damage at 32bfa734c). It lays out
two routes for the owner to choose between, neither built: the window shown by
the compositor's GPU from a copy of the changed tiles, or from the presented
surfaces in place in guest RAM. For each it gives what is measured and what is
not, what it touches, and its fallback.
Decided 14 gains two items. The first is the measurement of surfaces in place
first on a GPU of its own memory (steelbrain/routeb, unlanded) against
development at b615cec64, one walk per GPU on an RTX 5080, an RX 7900 XTX, an
RTX 3090 and an RTX 2080. The GPU then reads the layers it composites across
its link at each present: at 16 GB/s it costs a 5080 3x the GPU time and 6% of
the presents, the XTX is level, and the two x4 links saturate at 1.6 to 2.4
GB/s with the steps' presents three to nine times fewer. In place first also
took RADV's shadows off most of the video's frames.
The second is a proposal, not built: every surface in place first and a device
cache only once the guest's use shows a surface re-read unchanged, counted on
the host, promoted through a kext notice, undone at a CPU write, with every
guest-visible value kept. Its runtime side, moving a no-copy buffer and its
textures into device memory at the same GPU address, is metal2vulkan's.
Metal's no-copy buffers answer NonVolatile to every purgeable state they are
told, on the M3 Max, the AMD Radeon Pro 5300M and the Intel UHD 630 alike
(oracle_bundle purgeable.kinds), as views, textures over buffers and heaps'
resources already do here: the host backs none of them with a purgeable
allocation of its own. The bundle's no-copy buffers kept the state told.
A visible function table answers NonVolatile on the M3 Max and the Intel 630,
where the AMD 5300M keeps the state told; the bundle answered the AMD's (2,
then 3 when asked). It now answers the M3's and the Intel's on every guest.
What the guest sees: setPurgeableState: on a no-copy buffer or a visible
function table answers NonVolatile, whatever was set before, and isPurgeable
answers NO. Every other resource keeps the state told, as before. The oracle
doc records the measurement (Q35), and both guest sets are rebuilt.
gl_cases' provoking-line-last fails in arm64 macOS 27.0.1 guests on the M3
Max and passes on the M3 Max itself. The renderer picks per-vendor settings by
the device's vendorName, then by Apple7 and Apple5, and only its Apple and
AMD settings send setProvokingVertexMode: to the encoder. Under the others it
reorders a triangle's vertices itself and leaves a line's first vertex
provoking. Our device answers the host's vendor, "AMD" for any other, and no
Apple family, so its guests take NVIDIA's settings, or Intel's on an Intel
host. The x86 Macs measured take the same: the Intel 630's Metal GL renderer
fails the same case, and the 5300M's Metal device is not of the class AMD's
settings need. The M3 Max sends the setter at every case (traced).
The same settings send GL_POINT polygon mode as setTriangleFillMode: 2, which
the M3 Max and the 630 draw as the triangle's vertex points. The Vulkan
platform has no such mode, so a guest given Intel's settings would die on it.
The arm64 guest's device answers the x86 Macs' feature profile, 10002,
where the M3 Max answers 10. oracle_profile measured what Metal's base
device answers under each: under 10 it answers 123 members the device
leaves to it as an Apple GPU's, memoryless targets, tile memory, sparse
textures, Metal 4 queues and mesh commands in indirect command buffers
among them, which the host's GPU lacks. So the profile, and the tiled
texture SPI WindowServer asks under 10002, stay as they are until the
device answers those members itself.
Q34 gains the answers arm64rules2 measured on the M3 Max under macOS 27.0.1:
the depth/stencil queries, ids and words the arm64 guest now takes, and
those the M3 gives as the x86 Macs do (a state's resourceIndex and
uniqueIdentifier, dynamic library refusals, a dylib's exported function,
texture addresses, the indirect command read-back), so they stay as they
are.
Every process's ring-0 answers, the present answers and the display's events
share the one control completion ring. When it had no room, a VBLANK was
dropped silently (the guest sees no event for that refresh) and the posts that
waited left no trace, so no boot could say whether the ring ever filled.
The device now tells its host of each kind (Host::ring_degraded,
RingDegradation): a full spell at its first post that found no room, a post
that waited once it goes on, and a dropped VBLANK. It logs each kind's first
at warn, which the library's logger writes once per kind and counts after.
reims-vgpu counts them by code (answer::count_kind) into the degradation
counts line: control-ring-full, control-ring-post-waited, vblank-dropped.
Diagnostics only: what the guest sees is unchanged.
dgpu-oracle.md gets Q34: what the M3 Max under macOS 27.0.1 answers, with no
validation layer, where the bundle took the x86 Macs' rules for an arm64 guest,
measured on 11-13 by oracle_surftex's fourth and fifth rounds and
oracle_bundle's new cases, its argbuf.ds.* and oracle_mesh's icb (m3-max-26136,
26149, 26152, 26237, 26239): textures over a surface, views, Shared heaps,
linear alignments, depth textures over a buffer, depth/stencil states in
argument buffers, mesh indirect command buffers, option bits 17 to 19, the
IOSurface buffer and tiled texture SPI, and the register's x86
respondsToSelector verdicts the M3 answers otherwise (50 of 67). Each row says
what an arm64 guest's device now answers. Q9 and Q20 point there; the probes'
README names the new cases, and the device's comment on rgfxAppleRules names the
rules it now covers.
Batch 41's overlap check (1fc43b257) runs at every newFunction with constant
values whose arguments may overlap. It ran rgfxAirSpecialise, which runs the
module's initialisers and then follows the entry point's body twice, with the
values and blind. The check reads only the initialisers' globals: each
argument's predicate, index and count. The body passes were 99.5% of its cost.
For VideoToolbox's VTMTSComputeFunction, which its pixel transfers make for
every tile of a HEIC decode, a specialisation took 35.6 ms against 0.19 ms for
the initialisers alone (measured on the M3 Max, macOS 27). The guests' heic
step slowed from 6-7 ms a tile to 52-104 ms on every GPU.
rgfxAirConstantGlobals runs the initialisers alone, through the same
Specialiser and the same reading of its memory that rgfxAirSpecialise uses for
its globals. RgfxOverlappingArgumentError takes its globals from it. The
answers are unchanged, and test_overlapping_arguments_refused_as_metal still
compares each against Metal's. A new shell test counts the bodies followed over
sixteen makes each of a function that is made and one that is refused, with the
same values: none.
The Goal still called the device "a second lane beside the Apple paravirt
lane", and Decided 1 kept arm64 guests on that lane. The paravirt lane was
deleted on 2026-11-07, and since 2026-11-08 arm64 guests from macOS 14 take
the device's arm64e set on Ambrosia (Decided 13). The Goal now describes
the device as it is; Decided 1 stays as the record it is, with a dated line
saying what superseded it.
The surface-pages passage said the host maps a surface's guest pages "as the
apple-gfx lane maps guest memory". That lane is gone, so the comparison names
nothing a reader can look up; the map QEMU gives is the whole statement.
A copy of an IOSurface synced at a commit while another process's CPU held
the surface locked for writing copied the pages half written, and kept them:
IOSurface moves the surface's seed at a read-write lock, not at its unlock,
so the seed the copy recorded was already the one the finished write leaves,
and nothing synced the copy again until the next lock.
IOSurface keeps a second seed, the unlock seed, which unlockSurface moves at
each read-write unlock (and a GPU write moves with the lock seed), so the two
differ while a CPU holds the surface locked for writing; IOSurface itself
reads them so, and the Mac's GPU families (IOAcceleratorFamily2, IOGPUFamily)
import its getter. The device cache's op 3 is no unlock: IOSurface calls it
inside the lock, after op 2, and calls nothing at the unlock (read from
IOSurface's code in macOS 26.7.1's KDK).
The kext answers a surface's two seeds (SurfaceSeeds, selector 13, kext
feature 1 << 10, set only where IOSurface exports getUnlockSeed, which the
kext references weakly). A copy synced while the two differ records the
unlock seed in its header with a mark, and each commit that uses it asks
the kext again until the unlock seed moves, then syncs once more. A copy
synced with no write lock held asks nothing, so a commit costs what it did.
A named GPU write records its seed and clears the mark, as its seed already
stood over a CPU's write held meanwhile. The surface copies report counts
the uploads made mid-write and the asks.
QEMU applies a doorbell route under the BQL before route_doorbell returns,
so a ring-0 thread may wait for the BQL inside the device. That is safe
only if the device calls the route functions holding no lock of its own,
and no device function a host calls under the BQL waits for a thread
inside one. The device module's doc now names each call site and what it
holds: a QUEUE_CREATE, OBJECT_DESTROY or CONTEXT_CLOSE on the context's
lane (a ring-0 thread or the control thread) after the queues' table and
the ended rings are let go, and a reset on the resetting thread after it
let go of ring 0, the display, the completion ring, the table and the
ended rings. QEMU's registers are lockless, and its reset holds the BQL,
which its route function sees. What a host calls under its lock waits at
most for the control thread's display message, a ring's take or post, or
the table; the last device's release waits for the threads at most 5 s.
the_host_s_lock_held_around_its_calls_while_a_route_waits_for_it_holds_up_nothing
gives the test host a stand-in BQL its route functions take: while a
create's route waits for it, the thread holding it reads and writes the
registers, rings ring 0's and the queue's doorbells and resets the device,
and a watchdog ends the process if any call never returns. The route the
create took goes once the lock is let go. The C API and api.md name the
control thread among route_doorbell's threads, and design.md says which
hosts offer DOORBELL_ASKS.
Every command queue doorbell write exited to QEMU and ran the library on
the guest's vCPU, though only a buffer that asks for its CB_SUBMITTED can
be answered there; the rest need only the queue's thread woken. Measured
on the Radeon 780M host, a doorbell QEMU takes as an ioeventfd costs the
guest 8.9 us and one run through the library 13.4 us, of a 17.1 us
commit.
The device offers DOORBELL_ASKS (feature bit 43, FEATURES_HI bit 11): a
guest that takes it writes an asking buffer's doorbell with the ring's
id and RGFX_DOORBELL_ASKS (bit 0), and every other doorbell with the id
alone. The device then answers at the doorbell only an asking write, and
gives each queue an eventfd its thread sleeps on, which it hands the host
with the ring's id (route_doorbell, a new C API callback at the end of
RvgGraphicsCallbacks, its second version). QEMU adds it as an ioeventfd
matching the id exactly, so KVM wakes the queue's thread in the kernel and
the vCPU goes back to the guest with no exit; the asking write matches no
route and reaches the library as before. A guest without the bit sees
nothing new: every doorbell is answered as before, and no queue is
routed.
The device routes at most 128 queues (KVM holds 1000 devices on its MMIO
bus, and QEMU ends the VM where KVM refuses one); a queue past them, or
one the host refuses, keeps its doorbell on the write, logged once per
kind and counted. A route goes as its queue ends, before the destroy,
close or reset is answered, and QEMU drops it under the BQL before the
callback returns, so a queue made again over the same ring gets every
write. The thread drains the eventfd and walks its ring on each wake, so
coalesced writes take every buffer in ring order.
QEMU's side is vendor/qemu d81bcaac. The guest's side, the ROM's record
and both guest sets follow.
A texture's create (TEXTURE_CREATE), a view's (TEXTURE_VIEW), a Managed
texture's and buffer's (MANAGED_TEXTURE_CREATE, MANAGED_BUFFER_CREATE) and a
Managed buffer's modified range (BUFFER_DID_MODIFY_RANGE) are messages no one
waits for, each its own Submit call: on the RX 7900 XTX host 8 to 13 us each,
812 of them and 8.8 ms a Vision process. SubmitBatch now takes them too, each
of its one size, checked as Submit checks it, a create for a context closed
since its check destroyed behind it (rgfxSubmitBatchSize). None names a block,
which spans_test keeps. The bundle holds them with the destroys and the
heap-placed buffers (RgfxSerializer::postUnwaited), in their order, posted
before anything else the process posts or asks of the kext and before any
command buffer it commits. A texture over an IOSurface still goes at once, as
a present of the surface waits for it, and so do the creates that name a block.
This changes what the guest sees under transport exhaustion only (the control
ring full for 5 s, or the device stopped), as 628b03fb3 did for heap-placed
buffers: such an object made then is answered as made, held, where its refused
post answered nil. Its refusal reaches the app where Metal's caller sees a
lost GPU's: the next post retries what is held and is refused in that same
call where the held are refused again; a create that needs the held gone to
make room is refused at once; and a commit that finds anything but destroys
held fails its command buffer, unposted, with MTLCommandBufferErrorInternal.
postHeldCreates already answered so for every held type; serializer_tests'
test_held_creates checks each kind on its own, and protocol_tests'
test_commit_behind_an_untaken_buffer_fails a texture through a commit. A
create the host refuses was answered by no one before, and is not now.
oracle_overlap makes functions whose arguments of one argument table take
overlapping locations under function constants, by every way of making a
specialised function, and prints each answer and error. The AMD 5300M and the
Intel 630 on macOS 26.7.1 and the M3 Max on macOS 27.0.1 answer the same: Metal
refuses such values where it makes the function, with one line per argument
that overlaps an earlier present one. The guest's bundle accepted them, so the
host refused the pipeline later instead. Q33 records the answers. [ci skip]
The device answers most lifecycle messages the kext waits for within tens of
microseconds of the post (a heap texture's size, a library's lookup, a
surface's pages: 60 to 110 us on the RTX 3090 host), and the answer then waited
for the interrupt, the work loop's wake and the waiter's, about 25 us more
(measured in a Vision request). postLifecycle now looks for its answer for at
most 150 us before it sleeps (RgfxAnswerLook.hpp): where the control
completion ring holds a record the work loop has not taken, it takes the ring
in the work loop's gate, as the work loop does, and else pauses the CPU. It
never waits for the gate (an IOCommandGate's attemptAction): the event hooks its
holder runs take the release table's lock and the pipe clients', which a
waiter's caller may hold, and only the sleep's deadline bounds that wait, as
before. The rest of the work loop's service follows at the interrupt the record
raised. Only a thread whose call waits for an answer looks, and only that long.
No answer or order changes. Tested by answer_look_test.
Measured, Vision cold request, RTX 3090 host (rts4, the branch without this
commit, against the branch with it; host load 3.0 and 5.4), first process /
second: a heap texture's size and alignment, 60 calls, 36.3/36.6 -> 26.2/25.3
us a call (its answer's leg after the post 12.7 -> 2.4 us); a library lookup
78.8/87.0 -> 52.0/53.1 us; a surface block's ask (its SURFACE_PAGES), 123
asks, 232/215 -> 173/178 us, 32.0/27.5 -> 25.3/24.1 ms. A pipeline create
whose compile outlasts the look is answered as before.
A heap's buffer at an offset (BUFFER_AT_OFFSET, each small buffer of a slab) is
a create no one waits for, and cost its own kext call: 3079 a Vision process,
12 to 15 us each, 40 to 48 ms a process on the RTX 3090 host, between the
destroys, which broke each held run of destroys into one call of about 11.
SubmitBatch now takes BUFFER_AT_OFFSET too, of its one size, checked as Submit
checks it, and a buffer made for a context that closed since its check is
destroyed behind it, as Submit does (RgfxSubmitGate's rgfxSubmitBatchSize;
spans_test checks no message the batch takes names a block). The bundle holds
each buffer with the destroys, in their order, and a command buffer's commit
posts what is held before the buffer goes on its ring, as the host reads a
command buffer after the control ring's messages posted before it.
This changes what the guest sees under transport exhaustion only (the control
ring full for 5 s, or the device stopped):
- before, the buffer's create was refused there and the buffer was nil; now
it is answered as made, held, as Metal makes objects on a GPU that is gone;
- before, a command buffer committed on a stopped device was never answered,
and the run hung at its wait; now a commit that finds a buffer still held
fails the command buffer, unposted, with MTLCommandBufferErrorInternal
("Discarded (victim of GPU error/recovery)"), the host's own recovery error,
as the buffer may name it;
- the next post retries what is held and is refused where it is refused
again, and a buffer that needs the held gone to make room is refused at
once, holding nothing more.
Tested by serializer_tests' test_held_buffers and protocol_tests'
test_commit_behind_an_untaken_buffer_fails.
Measured, Vision cold request, RTX 3090 host (rts2, the destroys held,
against rts4, this commit and the next two; load 3.4 and 3.0): destroys and
heap-placed buffers together 62.0 -> 17.6 ms in the first process (3079
buffers and 294 destroy calls become 688 SubmitBatch calls), 51.6 -> 16.1 ms
in the second.
Each destroy cost the guest a trip into the kext, and a post that found the
host's control thread asleep a doorbell's exit too: 14 us a destroy in a Vision
request on the RTX 3090 host, 3415 destroys and 68 to 70 ms a process, in runs
an app lets go back to back. The kext now carries SubmitBatch (selector 5,
feature bit 1 << 1): the bundle holds each destroy (RgfxRingWriter::postLater)
and posts what it holds in one call of at most 4096 bytes, before anything
else the process posts or asks of the kext (every IOConnectCall goes through
rgfxKextConn, which posts the held first), once the held fill a call, or 1 ms
after the first held. The kext checks each as Submit checks one, all before it
posts any, puts the runs on the ring under one hold of its lock with one
doorbell at most, and ends a queue's as Submit does. A texture over an
IOSurface goes at once: a present of the surface waits for its destroy.
What an object lay over goes back as its destroy is held, as it went back once
the destroy was posted: whatever takes it again is posted after the destroy,
so the host drops the object first, and every answer the guest reads (a heap's
usedSize, a new object's GPU address and resource id) is the one it read
before (shell_tests' test_held_destroys_change_nothing_seen). Where the kext
stops taking them (control ring full 5 s, or the device stopped), the rest stay
held; the next post retries them under its own bound and is refused only where
they are refused again. The one difference, under that exhaustion only: what
the held destroys lay over has gone back, so a heap's usedSize read during a 5 s
stall of ring 0 reads lower than before (design.md, "Destroys go together").
Measured, Vision cold request, RTX 3090 host (rts1 against rts2, load 3.6 and
3.4): destroys 69.6 -> 18.6 ms in the first process, 67.7 -> 14.7 ms in the
second; all kext calls 216 -> 162 and 188 -> 135 ms.
Two asks are answered before any view of a surface's pages is made: whether a
block asking for a device cache needs one before its view (CACHE with no view),
and whether a fresh block is deferred. Both read the runtime's in-place check
report as text, and recomputed how the runtime lays texels on the device's lines
and which check form a texel width takes. They saw the check's verdicts alone,
not the device's policy, a shader's writes of a width the check stores none of,
texels past the pages, rows that share bytes, or what the device's format and
limit queries refuse.
metal2vulkan 3bca3ce246 answers there:
Device::host_pages_texture_placement(backing, descriptor, plane, start,
length), the buffer's answer wherever the steps before an import or an image
decide it, made with no buffer, import or image. Both paths now ask it of each
plane, width and usage as the answer over a buffer does, through one
composition (pages_over), for each import a view may take: by pointer and as
dma-bufs where the device imports pointers, as dma-bufs alone on RADV. They
answer a cache only where every such import's answer is a shadow a cache holds
in place. In place, pending, or a refusal of every ask (HostPagesBacking,
BufferLength) leaves the pages to the view's buffer, which takes the cache at
the making's refusal as before: an in-place answer may still be a pitch, place
or dma-buf refusal that only the image or the import decides.
The view is told it starts at 0, which lies in the device's lines as any page's
first byte does where they divide a page; elsewhere the pages are left to the
import, as before. The fresh path takes the block's length for the buffer the
answer stands for. The report parser and its tests are gone; the one-dma-buf
checks of a plane's pages stay, as the runtime cannot see our source's limits.
What the guest sees changes only in speed: a block the after-import ask would
answer CACHE is answered so before a view is made for it, or deferred, and no
GPU result or device answer changes.
A block that asks whether its IOSurface needs a device cache was answered
from the runtime's in-place report, parsed as text: the check's verdicts
alone. What only the texture's making decides never reached the answer: rows
at a pitch no linear image of the GPU's takes, a place or import no image
takes, texels past the pages. Such surfaces stayed over their pages, and each
of their textures was the runtime's shadow, copied in at every command
buffer's first use and merged back after its writes.
A probe walk on the 780M (um870, macOS 26.7.2, m3-max-24453) logged 428
surface textures refused for pitch, over 110 blocks answered in place: RADV
lays a linear image's rows at multiples of 256 bytes, CoreAnimation's are
multiples of 64 (3904, 3552, 640) and CoreVideo's 1920 and 1984. A device
cache, laid out at the GPU's pitch, holds them in place.
The answer over the view is now the runtime's own placement for each plane
(Buffer::texture_placement_with_iosurface_plane, the making's decision):
a texture over the plane that only reads, and one that takes every access.
The layout gives no texel width, so each plane is asked as each of Metal's
widths its rows' texels divide into. It takes a cache where no width lies in
place, none is pending, and some width's texture is a shadow a cache holds
in place. A texture the device makes no image in place of over any memory
(its format and usage, more levels than one) leaves the surface over its
pages. The two paths that answer before any import keep the report's
verdicts until the runtime answers there too.
What the guest sees changes only in speed: more surfaces take the device
caches they already took where the verdicts refused.