Read-only memory under a no-copy buffer lies over a copy on rt wherever the
GPU cannot import it as it is, and every commit that uses the copy compared
all of its pages with their base. Much of that memory is a file's pages on
the guest's read-only system volume, which nothing can change while the
buffer lives, so the compare buys nothing there.
What the guest sees: the device offers feature bit 31, UNCHANGING_PAGES, with
READ_ONLY_PAGES, and the kext takes it (kext feature 1 << 19). At a no-copy
buffer's make over read-only memory, the bundle asks the guest's kernel once
whether the range is one file-backed region whose maximum protection has no
write (a shared mapping, or a private one whose maximum was lowered), whose
every page is the file's own, on a volume mounted read-only (proc_pidinfo's
fsid against getfsstat; no path is opened). Such a block is the app's own
memory, as before, marked RGFX_SURFACE_PAGES_UNCHANGING (and
_COPY_ON_WRITE); the kext's wire of a private mapping makes the process's
copy, as a Mac's does. Any other read-only block carries why not in its
flags' bits 8 to 11, which the host only counts.
What the host does: an unchanging block's copy is filled once, as its view is
made, never compared at a commit, and written again whole at the completions
of the command buffers that can write it, which drops the GPU's writes as
before. The views' summary counts the other read-only blocks by why, and
each texture over one (read-only-pages-textures-why-N, with one line per
format, size and why).
A private mapping whose maximum protection still has write is not provably
unchanging, since its process could raise its protection and write its copy:
it stays a plain read-only block, why "writable max protection".
Where the device took IMPORT_ADDRESSES_LATER, a pages block is answered
before its view is imported, with no GPU address, so the bundle cannot place
the buffers over it at the view's address as it made them. It now lets the
host place them:
- a buffer over such a block goes in BUFFER_OVER_PAGES at gpu_address 0, which
the host places at the view's address plus the buffer's offset; no address
of the process's is picked for it;
- a Shared one asks its address of the host (PAGES_BUFFER_ADDRESS) at its
first gpuAddress read, the argument encoder's and a texture over it
included, and keeps the answer; a read with no answer is 0 and asks again;
- a Managed one, where the host makes Managed buffers at their copy's address
(MANAGED_AT_COPY), asks its copy's address as it is made.
What the guest sees: on metal2vulkan-rt's platform, newBufferWithBytesNoCopy:
returns without waiting for the block's import, and the first read of the
buffer's gpuAddress waits for it instead. The addresses are the host's, as
they were where the block's answer carried one; on the default platform
nothing changes.
On a GPU that shares the CPU's memory a Managed buffer is its bytes, so its
GPU address is its CPU copy's. The guest's bundle picked it an address of its
own, in a Private block, which metal2vulkan-rt cannot keep for a buffer that
lies over the copy's bytes: rt made the buffer at the copy's address, while
the guest's pointers held the pick, and each pick held a Private take.
Feature bit 63, MANAGED_AT_COPY, names the other form: where the guest took
it, a MANAGED_BUFFER_CREATE's gpu_address is its CPU copy's, the guest takes
no address for the buffer, and the address goes back with the copy. Both
kexts carry the bit, the bundle's serializer, slabs and no-copy buffers post
the copy's address, and the device tells its host the features the driver
took as it becomes ready (Host::driver_ready), before any message, so the
host's decoder can read the creates in that form.
No host offers the bit in this commit, so nothing changes for a guest. The
wire header changes, so the ROM's record and the guest's prebuilt sets are
rebuilt in their own commit.
Where the device caches every surface in place (SURFACE_CACHE_EVERY), no
host texture lies over a surface's pages: each is a view of an image the host
fills from the plane's place and pitch in the cache and writes back there, by
copies that address them in texels of the view's format. The host's linear
texture alignment, 256 bytes, then turned surfaces into copies for nothing:
15 of the 259 copy views of an rt boot, an x420 3840x2160 video output with
plane 0 at 568256 bytes and rows of 8000 among them, and rt refuses every
texture over a copy.
Under the feature a plane's offset and rows need only be multiples of 16
bytes, the largest texel of a format of texels, so every view's fill and
write-back address the plane whatever format of texels it takes. Without
the feature nothing changes.
For the guest: such a surface's view is in place, cached, where it was a
copy counted for alignment.
Where the device caches every surface the kext gives in place, a view that is
a copy is the fallback. It is still made, never nil, and counted by why:
alignment, unsupported, refused by the kext, or no room in the kext (now
apart from refused). The first of each reason goes out at the default level
with the surface's format and shape, and so does the minute's copies line
where a copy was made in it. A walk's guest log, which keeps the default
level, then shows what still takes copy blocks on rt.
RgfxHeap declares no gpuAddress property: the address is the private
RgfxMetalHeapInternals method, so the Shared-heap-of-the-pool test asks it there,
as the guest's frameworks do.
An Apple GPU's device (an arm64 guest's) makes a Shared heap, which until now
was a block of the device region, HEAP_OVER_HOST_MEMORY. Since the arm64
guest takes the Shared pool too, that heap was the last of the bundle's
buffers and heaps the region held where the pool is on.
What the guest sees: where the device has the pool (the slabs' one source),
newHeapWithDescriptor: of Shared storage takes a block of the pool of the
heap's size rounded up to 64 KiB and makes it one HEAP_OVER_POOL of the heap's
size, type and options, at the block's GPU address where the host gives one
(POOL_ADDRESSES), else at the process's pick. The heap's gpuAddress is that
address, its buffers lie at their offsets from it, and its bytes are the
block's, which the host zeroed. Its drop gives the block back, and no address
where the host gave it. A heap the pool has no block for, past the 4 GiB
longest block, or with no address left, is nil, as Metal's heap is where its
memory runs out; nothing falls back to the region. Where the pool is off, a
Shared heap is a region block as before. A new shell test makes one at the
host's address and its buffer, and the two nils.
A queue's upload chunk, where set*Bytes: puts its bytes, is a buffer of the
device's slabs, and where the slabs had none for it, a block of the device
region of its own. Where the slabs are the Shared pool's alone (the commit
before), that block was the one region use left for an upload chunk.
What the guest sees: where the pool is on, a chunk the pool has no block for
is none, with no BUFFER_OVER_HOST_MEMORY over a region block, and the command
buffer whose bytes found no room completes with MTLCommandBufferErrorOutOfMemory,
as it did where the region was full, and as Metal's does where its memory runs
out. RgfxSlabs::inRegion says which the slabs are. A new shell test takes a
chunk of a pool that refuses and then gives a block. Where the pool is off,
chunks fall back to the region as before.
On metal2vulkan-rt a no-copy buffer's GPU address is the device address of the
host's import of its pages, which only the host knows, so a guest pick cannot
match it. Where the kext and the device both took IMPORT_ADDRESSES, the bundle
asks PagesBlock for its third output, the GPU address the host gave the block's
view, and makes each BUFFER_OVER_PAGES over the block there plus the pointer's
offset in its page, with no pick of its own and none given back at its destroy.
What the guest sees changes: a no-copy Shared buffer over writable memory the
kext wires answers a gpuAddress in [2^43, 2^44) on the Vulkan platform (at its
pages' import on rt) instead of a pick in the context's range, and two no-copy
buffers over the same bytes, which join one block, answer the same gpuAddress.
A Managed no-copy buffer's own address stays its GPU copy's pick; only its CPU
copy, the Shared buffer over the pages, moves. Read-only memory, copied memory
and blocks given no address keep their picks, and a guest without the bit sees
nothing change.
design.md gains the "Import addresses" paragraph, PagesBlock's third output and
the kext's bit 18.
On the arm64 device, a command buffer named in SURFACE_USE only the cached
IOSurfaces it encoded a use of. A surface the GPU reached only through a
residency set the buffer used, or its queue held, was never named: its device
cache kept the generation of its last named use, and a copy-mode surface's
copy was not synced, so the GPU read what it held before the CPU's writes.
What the guest observes changes: at its commit, a buffer names each texture
over an IOSurface, or view of one, committed to a residency set it uses or its
queue holds, as a resource it reads. A cached surface's cache is filled first
where the CPU wrote it since, and a copy syncs. The set keeps its committed
IOSurface members as its own commit changes them, so a buffer's commit reads
them without walking the set. The x86 device makes no residency sets, and is
unchanged.
A cached IOSurface's device cache was filled at the read-write lock that
moves the surface's generation, not at its unlock. A command buffer committed
while a CPU held the lock filled the cache with the pages mid-write, and the
CPU's writes after it reached the GPU only at the surface's next lock.
What the guest observes changes: the first command buffer committed after the
unlock that uses the surface now reads the CPU's writes made under the lock.
The bundle tracks a cached surface's unlock seed from a commit that found it
locked for writing, as copy mode does, and that buffer's SURFACE_USE carries
the new RGFX_SURFACE_USE_REFILL flag. The host fills the cache again at the
generation it holds, unless a command buffer that may write it was committed
since its last copy into the pages, whose write a fill would lose.
The flag is under the new feature bit RGFX_FEATURE_SURFACE_REFILL (bit 58),
which every host offers and both kexts take; the bundle sets it only where
its kext took the bit and answers the surface seeds. The bundle counts the
surfaces named mid-write and the refills, and the host its refills and the
refills it kept from, in their summaries.
The host reads a no-copy buffer's bytes in place. The guest's Metal can hand
that buffer's identity to the app, or write it where the GPU reads, with no
message naming the buffer, and from then on the GPU may reach the buffer
through memory alone. The host had no way to know which buffers that happened
to. This commit adds a note for it, so the host can tell them apart.
The note is RGFX_CMD_BUFFER_ESCAPED (0x23b), RgfxBufferEscaped of 32 bytes:
the buffer's object id and the act, one of GPU_ADDRESS, ARGUMENT_ENCODER,
RESOURCE_ID and RESIDENCY_SET. The device offers it as
RGFX_FEATURE_BUFFER_ESCAPED (bit 56), and both kexts carry it. The submit gate
takes it in a batch, like a Managed range's write: unwaited, a fixed size,
naming no block and making no object.
The bundle marks each covered buffer as it is made (_rgfxEscape, set by
rgfxOwesEscapeNote) where the host took the feature. The first of these acts
in the buffer's life posts the note, before the act returns:
- a read of the buffer's gpuAddress;
- an argument encoder's setBuffer(s) of it, or setTexture(s) of a texture or
view over it;
- a read of such a texture's or view's gpuResourceID;
- the buffer, or such a texture, joining a residency set.
Every later act is one relaxed load.
Wire order holds the note ahead of any command buffer that could use the
identity. The note goes on ring 0, posted or held in the serialiser to go
before the next commit's messages, and the device carries out a command buffer
only after every ring-0 message its process posted before it. Across threads,
the act's slow path posts the note under the buffer's lock and then clears the
mark with a release store. Every commit takes an acquire fence before it posts,
so a commit after an act that found the mark clear posts after the note.
The covered buffers are the app's no-copy buffers over its own pages
(BUFFER_OVER_PAGES, writable or read-only, bit 24) and over bytes already in
a block of the process (BUFFER_OVER_HOST_MEMORY). Managed buffers, heaps over
pages, IOSurface shadows and buffers placed in a slab's heap
(BUFFER_AT_OFFSET) are not covered.
A slab buffer made with an address of its own is covered too: a Shared buffer
past 2 MiB over a slab of the process's own pages, a device buffer, or a
no-copy buffer's shadow (RgfxSlabSource::Made's ownsAddress). It reaches the
host as the same BUFFER_OVER_PAGES or BUFFER_OVER_HOST_MEMORY message as an
app's no-copy buffer, and the host takes every such message alike. Leaving
slab buffers out would leave the host unable to read the mark as "this
buffer's identity never left".
The host marks the buffer's entry escaped, once for its life, and a later
note changes nothing. A note for an object that is not such a buffer is a bad
reference. A note for an object whose create the host refused is dropped, as
any naming of one is. Escapes are counted in the degradation counts line and
in the recorder's stats (`counted <code> <n>` lines), with no new stream
records:
- buffer-escaped-gpu-address, -argument-encoder, -resource-id and
-residency-set, by the act that noted the escape;
- buffer-escaped-read-only-pages, the escaped buffers over a copy of their
pages;
- no-copy-buffers, every no-copy buffer made, of which the escapes are a
share.
Each act's first escape is also logged at info.
This changes nothing the guest observes. No one waits for the note, it has no
reply, and the mark changes no answer, object, address or command. Both
prebuilt sets and the option ROM's record are rebuilt from these sources. The
ROM's bytes do not change: its record changes only by the wire header's hash.
A guest's render pipeline drew its patches with Metal's default tessellation
state, whatever its descriptor set: power-of-two partitions, a maximum factor
of 16, no factor scale, constant factors per patch and clockwise output. The
bundle never sent the seven tessellation fields, so the device never saw them.
For the same reason the device never saw maxVertexCallStackDepth or
maxFragmentCallStackDepth, and created every pipeline with a depth of 1.
The bundle now reads each of these properties and sends it. Each tessellation
field travels as Metal's raw value, and tessellationFactorScaleEnabled as a new
flag, RGFX_RENDER_PIPELINE_TESSELLATION_FACTOR_SCALE (bit 8). The depths are
read only where the descriptor answers their selectors (macOS 12 and later);
older guests send 1.
The decoder passes every value through FullRenderPipelineDesc to the runtime's
RenderPipelineDescriptor. A state equal to Metal's defaults becomes the
runtime's `None`, so a pipeline that sets nothing is created exactly as
before. A raw value the runtime has no enumerator for dies at the send, as
every other enumerated field does. The recorder's tag-13 map carries the
values as three keys after privateState: `tessellation`,
`maxVertexCallStackDepth` and `maxFragmentCallStackDepth`.
Guests now see patches tessellated with the partition mode, maximum factor,
factor scale, step function, winding and control point index type that their
pipeline sets. They also see pipelines created with the call stack depths
they asked for.
The tessellation fields and the call stack depths share this commit because
they share one wire record. RgfxRenderPipelineCreate grows from 464 to 496
bytes, with eight u32s appended at offset 464, and both prebuilt sets and the
option ROM's record are rebuilt from these sources. The ROM's bytes do not
change.
Neither x86 Mac's Metal device responds to gpuCoreCount: the AMD Radeon
Pro 5300M's and the Intel UHD 630's answer respondsToSelector: NO under
macOS 26.7.1 (oracle_caps, m3-max-37201 and 37202). The bundle has
answered it on every guest since f692b4de0, from the M3 Max's answer,
the one device it was measured on then.
What the guest now sees: an x86-64 guest's device does not respond to
gpuCoreCount, and a call raises an unrecognized selector, as on the
x86 Macs, where it answered the host's count (a GPU's CUs or SMs, 0 on
Intel). An arm64 guest's device, an Apple GPU's, answers the host's
count as before.
macOS 12 and 13 guests' iconservicesagent and com.apple.dock.extra send
the device's private compileVisibleFunction:withDescriptor:error: at
start-up, from Metal's own link of Core Image's kernels, and the bundle
answered it unsupported while supportsFunctionPointers answers YES (17
boots of 11-15/16). Both x86 Macs answer each of its three forms with no
error for any function and descriptor, keep the function in the archive
of the archive form, and call the handler form's one-argument handler
with nil on the caller's thread (oracle_binfn, macOS 26.7.1, Q47).
What the guest now sees, where the host makes function pointers:
- the three compile forms answer as the Macs do and compile nothing,
as the host compiles a binary function where a pipeline links it;
the archive form keeps the function as addFunctionWithDescriptor:
keeps it, and the handler runs before the call returns;
- newComputePipelineStateWithAdditionalBinaryFunctions:error: answers
the pipeline itself, as the AMD 5300M's does (the Intel 630 makes
another; the Macs diverge), where it answered nil and an error;
- the device's functionHandleWithFunction: and its resource-index form
raise an unrecognized selector, as both Macs' devices do, where they
answered nil.
Where the host makes none, each answers the unsupported error as before.
A function specialised by constant values answered as active an attribute that
Metal's compiler leaves inactive once it folds the values: the bundle read the
AIR itself, and its reading keeps reads that are dead only after folding.
RealityKit's vsRealityPbr, under its usdz preview's constants, answered color
active where the AMD 5300M answers it inactive; unspecialised, it answered the
15 attributes its metadata declares where Metal answers none.
Where a function's library has Metal's own library (the one Metal compiled,
linked or stitched, or one Metal makes over the bytes of a library of a file,
of data or of a bundle), its attributes are now those of Metal's own function
of the same name and constant values. The metadata and the AIR's
specialisation remain where there is no such library. oracle_fnreflect gains
v_deadfold, whose attributes' reads are dead only after folding, and the
shadow test checks that every function asks Metal's own.
RealityKit's usdz Quick Look preview asks the reflection of fullScreen2Vert, a
vertex function of amplification_id, and the bundle answered nil ("a built-in
air.amplification_id was not measured"); the preview stayed black. Measured on
the AMD 5300M under macOS 26.7.1: amplification_id and amplification_count are
built-ins 21 and 22 of uint, in a vertex function's pipeline reflection and its
own, and in a fragment function's own reflection, where its pipeline's lists
them nowhere; a kernel's dispatch_simdgroups_per_threadgroup and
dispatch_quadgroups_per_threadgroup are listed nowhere. The reflection now
answers them so, where it answered nil.
On x86-64 macOS 11.7.11 a function of a library compiled from source
answered nil for vertexAttributes and stageInputAttributes, where Metal
answers its attributes: that release's compiler writes no VATT or VATY tag
into the library's metadata, so the bundle read no declaration. 12.7.6,
13.7.8, 14.8.9, 15.8.2 and 26.7.2 write them (oracle_fnreflect's source
library on each, its attributes equal to the AMD 5300M's). A library Metal
compiled, linked or stitched keeps Metal's own library as its shadow; where
the metadata declares no attributes for a function, they are now those of
Metal's own function of the same name and constant values there (each
attribute's name, index, type, use and patch flags), made Metal's objects
as before. A specialised function's are Metal's own specialised function's,
not the unspecialised declaration specialised through the AIR: on 11.7.11
Metal's unspecialised function leaves out an attribute under a function
constant, which 26.7.2's answers. Where the metadata declares them, the
shadow is not asked, so the releases that write the tags answer as before.
The shell test has Metal compile two sources, strips their libraries'
VATT and VATY tags, and requires every function and specialisation to
answer Metal's own through the shadow, each specialisation asked of it;
with the tags kept, the shadow is never asked of a function that declares
attributes.
A render pipeline answered the host platform's imageblockSampleLength, 4 for
one BGRA8 colour attachment, on the x86 guest's device too, where the AMD
5300M and the Intel 630 answer 0 for every pipeline: they have no tile memory.
The x86 guest's device now answers 0, and an Apple GPU's device, the arm64
guest's, keeps the host's answer, the M3 Max's 4.
vertexAttributes and stageInputAttributes answered nil, logged unsupported,
where the x86 Macs and the M3 Max answer an attribute object for each stage
input attribute. RealityKit's Quick Look of a usdz asks a vertex function's
attributes, and SceneKit, VFX and ShaderGraph read them to build their
vertex descriptors.
A function made by name now answers the attributes its library's public
metadata declares (the VATT and VATY tags, read beside the CNST table), which
is what Metal answers on all three Macs for every function of six libraries.
A function specialised by constant values answers them as the values
specialise its AIR: an attribute under a false predicate is left out, one only
removed code reads is inactive, a control point's stays active. The objects
are Metal's own (MTLVertexAttributeInternal for a vertex function, the same
for both getters; MTLAttributeInternal for a kernel's stage input), their
_flags bits measured on the 5300M and the M3 Max. Fragment functions answer
nil, as do kernels for vertexAttributes. Where Metal lacks the class or an
instance variable, or a specialisation's AIR is not read, the answer is nil,
logged once.
The AIR test checks every function's stage input nodes against its VATT tag,
and the shell test checks every function of four libraries, and thirteen
specialisations, against Metal's own answers on the Mac.
On a GPU without unified memory the runtime makes a Managed buffer's GPU copy
by copying all of its CPU copy over the link as the buffer is made. Most of
those bytes are zeros the guest never wrote: on the RX 7900 XTX, Geekbench 7.1
Metal's making copies carried ~4.5 GB beyond what the guest marked written, up
to ~0.94 s of GPU time (one 131 ms job copied six new buffers' 631 MB, 12 MB
of it written). The guest knows which bytes read zero; the host cannot.
What changes for the guest and the host:
- MANAGED_BUFFER_CREATE takes a tail, RgfxManagedBufferZero at byte 56
(RGFX_MANAGED_BUFFER_ZERO_OFFSET): its CPU copy reads zero from zero_from to
the length as the create is posted. The bundle sends it with every create:
0 for a buffer made with no bytes, whose slab range take() zeroed; the
length, which says nothing, for one made with bytes or over the app's own
memory. The kext's SubmitBatch takes the create at its new size, 64 bytes.
- The host passes a zero_from below the length to the platform
(BufferDesc::zero_from), and the Vulkan platform to the runtime
(HostMemory::with_zero_from): the GPU copy starts with zeros the GPU writes
there, rather than with those bytes copied in. A guest write there reaches
the GPU copy by a didModifyRange:, as on a Mac's discrete GPU, whose GPU
copy is made at the buffer's making; before, a write made before the host
took the create reached it too. A GPU that shares the CPU's memory keeps one
copy, unchanged, and a create without the tail (an older guest's) is copied
in whole, as before. An older host reads the create and ignores the tail.
Tests: the decoder passes the tail's offset and none without it or at the
length; the platform's zero bytes are the device's on a GPU of its own memory;
the serialiser, the slabs and the device buffers send each make path's value.
Both guest sets and the ROM's record are rebuilt in the next commit.
metal2vulkan d0ef5e0145 bounds a texture over a buffer of 16 KiB or more
as the M3 Max does: a 2D texture and a texture buffer at their last texel,
whatever the bytes per row past it, and a heap's buffer at its heap's size
from the buffer's start, where it counted bytesPerRow * height against the
length rounded up to 16 KiB. The bundle answered nil wherever the old bound
refused, on both guests, so it held back textures the host now makes.
rgfxTexelsPastAllocation now counts that end against rgfxHostAllocation:
the heap's size for a heap's buffer, the length rounded up to 16 KiB for any
other. The runtime counts a buffer over pages (a no-copy buffer, or one over
the device's region) from the host pointer's offset in its 16 KiB page,
which the guest does not know and which only adds to the bound, so the
bundle keeps the length rounded up for those and posts nothing the host
refuses. 2D arrays keep their slices' end, and a texture whose texels end
inside the length stays made.
For the guest: on either guest, a texture buffer or 2D texture over a
buffer of 16 KiB or more whose last texel ends inside the allocation is now
made where its rows' padding runs past it, and a heap's buffer of 16 KiB or
more takes textures to its heap's size, both answered nil before.
Under an Apple GPU's rules the bundle made a texture over a buffer under
16 KiB however far its texels ran past the length, where the M3 Max
answers nil: a texture buffer over a 4096-byte buffer past 128 KiB, for
one. oracle_pastlen measured the M3's bound (macOS 27.0.1, arm64): the
texture is nil where it ends past the buffer's resourceSize, counted from
the buffer's start. That is the 128 KiB pool for a buffer under 16 KiB,
the heap's size for a heap's buffer, the 16 KiB pages a no-copy buffer's
bytes meet, and the length rounded up to 16 KiB for the rest. A 2D texture
or a texture buffer ends at its last texel, a linear 2D array at its
slices' end.
For the guest: an arm64 guest's device now answers nil for those
textures, sending nothing. The x86 guest's device, whose reference x86
Macs make them, is unchanged.
getBytes: and replaceRegion: of a texture over a buffer copied every byte
in place in the guest's memory, past the buffer's length too, where the
host's platform keeps those texels in a tail of the texture's own, which
every GPU path reads and writes. Past the length the CPU so read and wrote
another allocation's bytes, which no GPU path saw.
oracle_pastlen shows every oracle keeps one memory there inside the
buffer's allocation (the AMD 5300M and the Intel 630 under macOS 26.7.1,
the M3 Max under macOS 27.0.1), while past it the x86 Macs keep two that
disagree. For a buffer the device makes, the bytes inside the length are
still copied in place, and those past it go through a blit on the device's
copy queue that the call waits for, so the guest sees one memory past the
length on every device. It costs one round trip per call whose region has
a byte past the length.
A no-copy buffer's bytes past its length are the app's own memory, which
Metal's CPU copies reach in place on all three oracles, each dying of
SIGBUS where the app's mapping ends, so those copies stay in place.
For the guest: over a buffer of the device's, getBytes: past the length
now reads what the GPU wrote there and a kernel reads what replaceRegion:
wrote, and the guest's memory past the buffer is no longer touched. Over a
no-copy buffer nothing changes.
The bundle's copy of Metal's descriptor validation gave a texture buffer
(MTLTextureTypeTextureBuffer) the 2D width limit, 16384, and ended the process
past it. A guest's MoltenVK makes each texel buffer view as a texture buffer as
wide as the view's elements, and a user's Minecraft died there at a 46626-wide
R8Sint one.
Metal takes far wider ones: the AMD 5300M and the Intel 630 under macOS 26.7.1
and the M3 Max under 27.0.1 answer maxTextureBufferWidth 268435456 (2^28) and
make texture buffers up to that many elements of any format at the device's, a
Private heap's and a Shared buffer's creators, ending the process one element
past it with the width line every type gives (oracle_texdesc --texbuf, jobs
m3-max-31563, 31564 and 31565). The bundle now does the same under both rule
sets: what changes for the guest is that texture buffers from 16385 to 2^28
elements are made instead of ending the process, and the words past 2^28 name
268435456. The answers past the device's maxBufferLength and past an Apple
GPU's allocation of a buffer stay as they were.
The shell tests that held the old limit had none for a texture buffer; they now
check the measured cases at the validation and the 46626-wide view over a
buffer, made and carried to the host with its width.
The present hold makes a queue's next frame wait for the drawable's
present-scheduled report, which comes only after the presenting buffer is
scheduled. A buffer that does not ask for its CB_SUBMITTED is scheduled at the
platform's submission, and that can wait for the queue's earlier work on the
GPU. On the RTX 3090 host, the Modern Rendering sample's presenting buffer sat
behind its frame's 89 ms pass and was scheduled at the pass's end, 88.6 ms
after its commit. The GPU then stood idle 19 to 22 ms a frame, 12.3 -> 10.2
fps against the set without the hold. Metal schedules a buffer that waits for
nothing within a fraction of a millisecond of its commit, whatever its queue
runs before it.
What changes for the guest:
- Once a buffer of a queue presents a drawable, it and every buffer the queue
commits after it ask for their submission (RGFX_OP_SUBMITTED), where the
device answers it.
- The host then schedules each one at its take where it waits for nothing and
no buffer before it on its queue owes its scheduling. Such a buffer becomes
Scheduled, and its present is made, at its take instead of at the
platform's submission.
- Queues that never present ask as before: only commitAndWaitUntilSubmitted's
buffers ask.
A GPU-bound app's window reached the screen at about half the app's rate:
our bundle's presentDrawable: posted every later buffer of the queue at
once, so the app ran as many frames ahead of WindowServer as its queue
held, and WindowServer's composite waited behind them on the host's GPU.
Metal's base command buffer asks each drawable it presents for a
present-scheduled report (addPresentScheduledHandler:, CoreAnimation's),
and its queue submits nothing after the presenting buffer until the
report comes. Measured on the MBP16's AMD 5300M and Intel 630 (macOS
26.7.1): with the report 200 ms after the present, a buffer committed
right behind it was scheduled at 200.7 to 210.5 ms, against 0.3 to 1.3 ms
with an immediate report, and both commits returned in 0.03 ms.
What changes for the guest: a buffer committed after a presenting one
stays committed, unsubmitted, until CoreAnimation reports the present
serviced, as on a Mac. Every drawable a buffer presents is now asked
for addPresentScheduledHandler:, as Metal asks it; a buffer that failed
before its present gives the signal from its scheduled handler.
The bundle's fake drawables gain addPresentScheduledHandler:, and a new
test holds the later buffers through the present until the report, for a
report on demand, at add, at present, and behind a host-failed buffer.
The AIR reader refused a texture argument that sits in a raster order
group (`[[texture(n), raster_order_group(g)]]`). Its function's pipelines
answered no reflection. QuartzCore's inplace_copy_lpf and inplace_copy_lph
fragments, the last two entry points the sweep of macOS 27's metallibs found
refused, take one.
The reader now takes the group after a texture's access. The reflection
answers the texture as it answers one in no group: the AMD 5300M and the
Intel 630 make r_rog_texture's pipeline and list the texture that way
(m3-max-31210, 31211), and MTLTextureBindingInternal has no field for a
group.
What changed for the guest: on either guest, pipelines of such fragments
now answer a reflection that lists the texture. Before, they answered none.
The AIR reader refused the nodes of an explicit imageblock, of a fragment
function's imageblock data and of a view of a master struct. Pipelines of
those functions answered no reflection, and the device logged "its nodes
were not read". A sweep of macOS 27's metallibs found about 270 such
entry points: QuartzCore's blur kernels, CoreComposite's and VectorKit's
tile views, among others.
The reader now takes the imageblock's layout, its data size and the
master struct. The reflection builder makes them from Metal's own classes,
as the oracles answer them (tools/pipeline_reflection_check's new cases):
- on an Apple GPU, a kernel's explicit imageblock is an
MTLImageBlockArgument of binding type 17 and kind 1, at index 0, of its
data's size and its struct; a false function constant leaves it out.
Neither x86 Mac makes a pipeline of one, so an x86 guest's still answers
none;
- a fragment function's imageblock data is an MTLImageBlockDataArgument of
binding type 16, its master struct in imageBlockMasterStructMembers when
it views one, on either guest: the M3 Max and the Intel 630 make those
pipelines, and the AMD 5300M makes the master view's.
What changed for the guest: these pipelines now answer a reflection that
lists their imageblock. Before, they answered none. The x86 checks match
the AMD GPU in every value, and the Intel GPU in every value but its known
postVertexDumpStride (m3-max-31210, 31211). Of the entry points the sweep
found refused, 2 are left: QuartzCore's textures in a raster order group,
which the next commit reads.
newArgumentEncoderWithBufferIndex:reflection: answered the binding of the
library's reflection of the function, whose argument buffer arrays have
their element's size as their stride. Metal answers the binding a pipeline
of the function reflects, its arrays of stride 0: the AMD 5300M and the
Intel 630 under macOS 26.7.1 (c13's oracle_bundle argbuf.reflection,
argbuf.binding and argbuf.binding.lib) and the M3 Max under macOS 27.0.1
(m3-max-31079) alike.
What the guest sees: the reflection out-parameter is now the binding built
from the function's AIR as its pipelines' reflection is (on an arm64 guest
with the M3's alignment), an array of textures in it of stride 0; where that
is not made, the library's binding as before. The shell test holds the
stride over oracle_reflection's k_argument_buffer, and the protocol test the
binding over air_arguments' every_access.
A fragment function's input of a colour attachment's value ([[color(n)]])
did not read where function constants compute n, or where the input is in a
raster order group, and pipelines of such a function answered no reflection:
41 of macOS 27's framework fragments (RenderBox's 35, PencilKit's, CoreRE's)
take an index function constants compute and 9 (CoreRE's) a raster order
group (the reflection sweep, m3-max-31057 and 31073). Metal's compiler writes
the index as the global its initialiser sets, as for a binding's index, and
the group as air.raster_order_group n after it (read: f_fetch_at and
f_fetch_group, macOS 27.0.1). The reader now takes both, the group only on a
colour attachment's input, where Metal lists the input nowhere (measured:
f_fetch); a binding in a raster order group still does not read.
What the guest sees: a render pipeline made with reflection options of such
a fragment function answers its reflection, the colour attachment's input
listed nowhere, where it answered nil; and its functions made with constants
are checked for overlapping arguments, as Metal checks them. oracle_reflection's
f_fetch_group and f_fetch_at hold it in the AIR test and the shell test, and
pipeline_reflection_check compares them with Metal's (r_fetch_group,
r_fetch_at).
The AIR reader stopped at 8 levels of layouts and argument buffers' members,
and a pipeline of an entry point nested deeper answered no reflection: 39 of
macOS 27's framework entry points (VFX 30, CoreUSDEdit 9; the reflection
sweep over every system .metallib on the M3 Max, m3-max-31057 and 31073),
which all read at 12. The limit only bounds the recursion, so it is now 32,
named kRgfxAirNesting, in the reader, in the count of a struct of members'
ids and in whether an argument buffer's members write a texture.
What the guest sees: a render, compute or mesh pipeline made with reflection
options of such an entry point answers its reflection, built as for the
shallower argument buffers, where it answered nil; textures in those
argument buffers that the function only reads are no longer taken as
written. oracle_reflection's k_deep_ab, a chain of seven argument buffers,
holds both in the AIR test and the shell test, and pipeline_reflection_check
compares it with Metal's (c_deep_ab).
What changes for the guest and the host: replaceRegion: of a texture over a
Managed buffer whose rows run past the buffer's length now posts
BUFFER_DID_MODIFY_RANGE for the rows' span up to the length, and nothing for
rows wholly past it. Before, it told the whole span, past the buffer's end.
The host refuses a range past the buffer whole (decode/managed.rs,
did_modify_range), so even the bytes the write put inside the length never
reached the GPU's copy, and the next GPU read saw stale texels where Metal's
sees the write.
Such textures are made by both forms: a 2D texture past the length, and since
the commit before last a texture buffer. Their texels past the length lie in
the host's tail of the texture, which no range of the buffer names, so the
range stops at the length. The host's strict check stays as it is.
Test: test_buffer_texture_replace_region_past_the_length_tells_the_length
covers three textures over a 4096-byte Managed buffer:
- a texture buffer of 4 RGBA32Float texels from 32 bytes short of the length
tells 32 bytes;
- one wholly past the length tells nothing;
- a 2D texture whose rows written cross the length tells its span up to the
length.
What changes for the guest: a texture over a buffer whose texels end past an
Apple GPU's allocation of a buffer of 16 KiB or more (its length rounded up to
16 KiB) answers nil and posts nothing. Before, the bundle answered a texture
and posted its create, which the host refused, so the guest held a refused
object whose uses were dropped. This covers a 2D texture by
newTextureWithDescriptor:offset:bytesPerRow:, and a 2D texture, 2D array or
texture buffer by the linear SPI; the public form's texture buffer already
answered this nil. All of them now take one rule, rgfxPastAllocation:.
Why nil: the M3 Max answers nil there (a texture buffer and a 2D texture over
16384 and 20000 bytes, scratch probe tbpa, job m3-max-30902;
metal2vulkan measured the arrays). The runtime at ce54ad8b25 answers nil there
on every device (BufferTextureProblem::PastAllocation), so the host's
platform cannot make one. The AMD 5300M and the Intel 630 make every one of
them (jobs m3-max-30900, 30901): a class 2 divergence, recorded in Q11, and
the runtime's to take. Short of the allocation, and past any buffer under
16 KiB, the textures are made as before.
No test held the old answer: none made such a texture. New tests:
- the bundle's test_textures_past_a_buffers_allocation_answer_nil checks both
forms;
- reims-vgpu-vulkan's textures_past_their_buffers_allocation_are_nil_as_the_m3s
holds the host's answer to the same rule, so a runtime that changes it
fails here.
What changes for the guest: newTextureWithDescriptor:offset:bytesPerRow: of
a texture buffer whose texels run past the buffer's length answers a texture
and posts TEXTURE_FROM_BUFFER, where the bundle answered nil and posted
nothing. Both x86 Macs make it (4 RGBA32Float texels at offset 4064 of a
4096-byte buffer, dgpu-oracle.md Q11), and so does the M3 Max
(metal2vulkan's probes/texture_buffer_past_length.m). The host's platform has
made it since metal2vulkan RUNTIME 1808 (pin 37), keeping the texels past the
length in a tail of the texture's own, so the refusal the nil stood in for is
gone. The 11-07 opengl lane hit that refusal.
It stays nil, posting nothing, where the texels end past an Apple GPU's
allocation of a buffer of 16 KiB or more (its length rounded up to 16 KiB).
The M3 answers nil there, and the runtime at ce54ad8b25 answers nil there on
every device, so the device cannot make it. The x86 Macs do make it there
(scratch probe tbpa, jobs m3-max-30900 to 30902): a class 2 divergence,
recorded in Q11.
The tests that held the old answer change with it.
test_buffer_texture_buffers now expects the texture made, with its create,
over 4096 bytes from 4064 and 12288 and over 20000 bytes from 19968, and nil
past the allocation. The new reims-vgpu-vulkan test
a_texture_buffer_past_its_buffers_length_is_made_as_metals makes the measured
shape over host memory and checks four things:
- a kernel's read and a blit read the buffer's bytes inside the length, and
zero past it;
- a CPU write of the buffer reaches the next read;
- a blit's write lands in the buffer inside the length and in the tail past
it, and changes no byte outside the buffer;
- one past a 16 KiB buffer's allocation is nil.
The completion thread pumps and arms every live queue's completion ring on
each pass, and the ring headers are uncached memory to the guest: a store
there costs about 0.3 us on an AMD host, a load 0.1 us (design.md). A ring
the last pass armed and found empty is armed still while the host publishes
nothing, as the host clears `armed` only in a post, so the pass now reads
its `producer` alone, and a pump that took nothing leaves `consumer` as it
was. The host sees the same counts and the same arm.
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.
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 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.
Metal's descriptor validation, which runs without the debug layer, ends the
process at every usage bit it names none for. The exceptions are 0x8, which
it takes and leaves out of the answer, and 0x4000, 0x8000 and 0x10000, which
it takes and answers. It names the bits in one line ("MTLTextureUsage has
unknown bits 0x1c0."). It also ends the process at ShaderAtomic on any
format but R32Uint and R32Sint, and on an Apple GPU RG32Uint; the x86 Macs
name RG32Uint in words of their own. This was measured alike on the M3 Max
(macOS 27.0.1), the AMD 5300M and the Intel UHD 630 (26.7.1), over an
IOSurface and over none, in oracle_surftex's sixth and seventh rounds:
0x40, 0x80, 0x100, 0x200 to 0x2000, 0x20000 to 0x100000, 0x1000000,
0x80000000, and BGRA8Unorm, R32Float, RGBA8Uint, R8Uint, R16Uint, RG32Sint,
RGBA32Uint and format 500 with the atomic bit.
The bundle ended the process at 0x80 alone and made the rest, so a guest
held textures no Mac makes. Now every creator ends where the Macs end, in
their words and order, on x86 and arm64 guests. An arm64 guest still makes
an atomic RG32Uint texture, as the M3 does.
An R32Uint texture over a BGRA surface made with ShaderRead, ShaderWrite and
ShaderAtomic answered usage 0x23 in the arm64 guest, where the M3 answers
0x3. The class is wider than surfaces: the M3 Max (macOS 27.0.1), the AMD
5300M and the Intel UHD 630 (26.7.1) all leave ShaderAtomic (0x20) and 0x8
out of every texture's usage answer, over an IOSurface of each kind and over
none, in Managed, Shared and Private storage, and so do the texture's views
(oracle_surftex's sixth and seventh rounds: 0x23 answers 0x3, 0x20 answers
0, 0x29 answers 0x1). Bits 0x4000, 0x8000 and 0x10000 are answered as given.
x86 and arm64 guests both answered the bits as given. The answer now masks
them, while the wire keeps the usage the descriptor gave, so the host's
texture still takes the atomic bit. isCompressed reads the usage the texture
was made with, as it did through the answer before.
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.
Both x86 Macs load the install names of a library read from a file alone:
a kernel whose library was made of bytes or of source refuses its pipeline
though the named file is there. An arm64 guest's device answers as an
Apple GPU, and the M3 Max makes both pipelines, bare and with the library
preloaded, and they run as the file's (oracle_fnptr Apple, macOS 27.0.1).
The arm64 guest's pipelines now load such a library's @executable_path
names; its @loader_path names, of which a library of no file has no
directory, still refuse it, as nothing measured them. An x86 guest's
pipelines refuse as before, which the test keeps beside the Apple answer.
Both x86 Macs' function handles raise an unrecognized selector at
gpuResourceID, and so did ours on every guest. An arm64 guest's device
answers as an Apple GPU, and the M3 Max's handles answer 0, for a compute
pipeline's linked functions and a render pipeline's fragment functions
alike (oracle_fnptr Apple, macOS 27.0.1).
The arm64 guest's handles now answer 0; an x86 guest's still raise, which
the test keeps beside the Apple answer.
Apple's GL renderer asks a depth/stencil state it binds whether it reads
and writes depth and stencil. Both x86 Macs' states answer YES to all four
for every descriptor, and so did ours on every guest. An arm64 guest's
device answers as an Apple GPU, and the M3 Max's states answer what the
descriptor does (oracle_bundle Apple ds.queries and ds.grid, 717
descriptors under macOS 27.0.1): writesDepth is the depth write;
readsDepth is that, or a depth compare other than Always and Never; a face
writes the stencil where its write mask is not 0 and an operation is not
Keep, and reads it where it writes it, or its read mask is not 0 and its
compare is neither Always nor Never.
The arm64 guest's states now answer that; an x86 guest's still answer YES,
which the test checks for each descriptor beside the Apple answer.
An arm64 guest's device answers as an Apple GPU, whose Metal reference is
the M3 Max. Its pipeline reflection answers a constant buffer's alignment,
and its pointer type's, as the pointee's (16 for a struct of float4x4
members, 8 and 4 for others), where both x86 Macs answer 32: measured by
tools/pipeline_reflection_check Apple under macOS 27.0.1, whose only other
differences are compiler flags in instance variables no getter reaches.
The arm64 guest's pipelines now reflect the M3's alignment; an x86 guest's
answer stays 32, which the test checks beside the Apple one.
Guest-visible on an arm64 guest (and wherever the device answers an Apple
family): a texture of a depth or stencil format over a buffer's bytes, by the
public newTextureWithDescriptor:offset:bytesPerRow: and the linear SPI, now ends
the process with the M3 Max's words ("Linear texture: cannot create
compressed, depth, or stencil textures, pixelFormat (...) disallowed",
_mtlValidateStrideTextureParameters), sending nothing, where the bundle made
it: an Apple GPU's descriptor validation takes depth and stencil textures in
Shared storage, so the x86 Macs' end at the storage never came.
Measured: the M3 Max under macOS 27.0.1 with no validation layer ends the
process there at Depth16Unorm, Depth32Float, Stencil8, Depth32Float_Stencil8
and X32_Stencil8 in Shared storage over a Shared buffer, and at Depth32Float by
the linear SPI (oracle_bundle Apple buftex.depth*, linear.depth, 11-13). x86
guests keep the x86 Macs' end at the descriptor's validation
(buffer-texture-depth).
Guest-visible on an arm64 guest (and wherever the device answers an Apple
family): minimumLinearTextureAlignmentForPixelFormat: now answers the device's
alignment for the formats the M3 Max answers and ends the process at the rest
as it does, where the bundle took the x86 Macs' set. It answers 111 more raw
values: those the x86 Macs lack but Invalid, D24S8 and X24S8 (B5G6R5, A1BGR5,
ABGR4, sRGB R8 and RG8, Unspecialized, the two-plane and XR10 formats) and
values of no name in the SDK (26, 44, 66, 116, 501, 504, 521, 524, 546 to 548,
560, 562 to 613, 615 to 629). It ends at PVRTC, EAC, ETC2 and ASTC with the
compressed formats' words, and at 651 and 652 with the depth/stencil words,
where it said Invalid.
Measured: the M3 Max under macOS 27.0.1 with no validation layer, at each raw
value from 0 to 799 and 1000, 1023, 4096 and 65535, one child process each
(oracle_bundle Apple linalign, 11-13): 175 answered (16 each), 82 compressed,
7 depth/stencil, the rest Invalid. rgfxLinearAlignmentAnswer classifies a
value for a device; test_linear_alignment_as_an_apple_gpu checks every value
against the M3's table and that the x86 Macs' 64 stay where the device
answers no Apple family.
Guest-visible on an arm64 guest (and wherever the device answers an Apple
family): newHeapWithDescriptor: with Shared storage now makes a heap over a
block of the device region (RGFX_CMD_HEAP_OVER_HOST_MEMORY), whose buffers'
contents lie there, where the bundle ended the process with the x86 Macs'
"Heap Descriptor Validation\nShared storage mode disallowed".
The M3 Max under macOS 27.0.1 makes a 4 MiB Shared heap, Shared buffers in it
whose contents the CPU reaches, and a Shared texture in it (oracle_bundle Apple
heap.shared, 11-13). The heap over host memory is the path the bundle took for
every Shared heap before 0f9108bdf moved the x86 guests to the x86 Macs' end;
it is restored for Apple GPUs alone. x86 guests keep the end
(heap-shared); test_shared_heaps_on_an_apple_gpu checks the new heap.
Guest-visible on an arm64 guest (and wherever the device answers an Apple
family): newTextureViewWithPixelFormat: and its forms in
MTLPixelFormatInvalid now answer nil, sending nothing, where the bundle ended
the process with the x86 Macs' words ("texture view pixelFormat
(MTLPixelFormatInvalid) not castable").
The M3 Max under macOS 27.0.1, with no validation layer, answers nil for that
view (oracle_bundle Apple view.noformat, 11-13), and ends the process at the
view's other rules in the x86 Macs' words: a format of another class, levels
or slices past the texture's, a type of another family and a cube of slices
not a multiple of six (view.class, view.levels, view.slices, view.type and
view.slicecount). rgfxEndAtViewMetalEnds takes the texture's device for it.
x86 guests keep the x86 Macs' end; test_views_as_an_apple_gpu checks the new
answer beside the old test, and two of the shared rules on an Apple GPU.