Commit Graph
201 Commits
Author SHA1 Message Date
Anees Iqbal fffc41b341 🆕 Add oracle_archtype, the probe of a device's compiler target
MTLAssetUpgraderD ends with SIGABRT in every guest that installs an app: for
each .metallib of the app it asks Metal's archive reader about the file for
every device, and Metal's loader asserts on the device's
targetDeviceArchitecture, which the reims-graphics device answers nil.

The probe prints what a device answers there (the class, its members and
their values) and what the archive and dynamic library readers answer for
named files and for an archive and a dynamic library the device serializes
itself, each read in a child process, so a Mac's answers and the guest's can
be compared and the guest's abort is reproduced without an app install.
2026-11-14 13:39:38 -08:00
Anees Iqbal 8366731632 🆕 Let oracle_surfresolve resolve into plane 1 of a 420v surface
Its first round measured plane 0 of a surface with planes; a texture over a
later plane is the platform's other planar shape, so the probe asks it too:
plane 1 of a 128 x 32 420v surface, whose 16 rows of 128 bytes hold a 16 x 16
RGBA16Float texture.
2026-11-14 10:04:24 -08:00
Anees Iqbal 740f167a5b 🆕 Add the oracle probe of resolves into surface textures
The Vulkan platform drops a 4x BGRA8 attachment's resolve into a texture of
another format (RGBA16Float, BGR10_XR, BGR10_XR_sRGB) where the M3 Max was
measured to leave the texture untouched, but its measurements covered only a
texture over an IOSurface without planes in Shared or Managed storage. The
guest's surfaces now reach the platform as buffers, whose storage the device
picks (Private over a device cache), and the guest's own textures may lie over
a plane of a surface with planes or be Private.

oracle_surfresolve measures the rest: one case a process, the resolve
texture of its own, over a surface without planes, or over plane 0 of a 420v
surface, Shared, Managed and Private, by MultisampleResolve and
StoreAndMultisampleResolve, against a resolve of the same format.
2026-11-14 10:04:24 -08:00
Anees Iqbal e2ef6ac2bf 🆕 Let oracle_twinwrites write through an argument buffer and into 500
metal2vulkan refuses a write of every two-plane YCbCr texture reached through
an argument buffer, and asked what Metal stores there before taking the slot
answers for it. oracle_twinwrites gains `argbuf`, a kernel's write() through an
argument buffer that holds the texture, made resident for writing, and 500
(YCBCR8_420_2P over a '420v' surface), whose slot writes Metal drops, so one
run compares the two routes. Written from scratch.
2026-11-14 09:23:15 -08:00
Anees Iqbal 265065139c 🆕 Add the oracle probes of two-way failures and twin writes
oracle_failways measures a command buffer the GPU fails two ways at once: a
render pass storing into bit-24 memory beside encoders made under protection
options, each encoder followed by an event signal. The Vulkan platform died at
such a commit because nothing measured which failure wins. oracle_twinwrites
records what Metal stores into a 4:4:4 surface's planes through the _sRGB twins
523 and 527, whose writes the runtime refuses for want of those bytes. Both are
written from scratch, and build.sh builds them with the other probes.
2026-11-14 09:15:10 -08:00
Anees Iqbal 788561ff8f 📝 Record Metal's order of waits against handlers that block [ci skip]
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.
2026-11-14 07:50:59 -08:00
Anees Iqbal d89f0bdb7f 🆕 Add an oracle probe of waits against handlers that block
The guest's completion delivery runs a command buffer's completed handlers
before its waiters wake, and its fast path for a buffer with no handler waits
behind every earlier record of its queue. Whether Metal orders them so is what
decides how far that path can be cut. oracle_waits measures it on a Mac:
waitUntilCompleted and waitUntilScheduled against completed and scheduled
handlers that block, and a later buffer's waits against an earlier buffer's
handler that blocks.
2026-11-14 07:50:59 -08:00
Anees Iqbal a1da511c2a 🆕 Add oracle_readonly, the probe of writes into read-only memory
What Metal does with a GPU or CPU write into read-only memory (a no-copy
buffer or heap made with MTLResourceOptions bit 24, or over pages the
process maps read-only) decided where the Vulkan platform faulted, dropped
or ended the process, and only the M3 Max had been measured. oracle_readonly
asks every such write on any Mac, one shape a process against a writable
control: a render pass's stores and resolves of every action, colour, depth
and stencil, by the descriptor and late; a draw's, a kernel's and a blit's
texture writes; the CPU's replaceRegion:; and whether the queue runs on and
its second fault revokes it. oracle_readonly.sh DEVICE runs every shape.
dgpu-oracle.md Q38 holds what it found on the M3 Max, the Radeon Pro 5300M and
the UHD Graphics 630 (m3-max-29292 to m3-max-29294, m3-max-29309 to
m3-max-29311). It is written from scratch, in plain Metal.
2026-11-14 07:25:13 -08:00
Anees Iqbal 7c6149b53f 🆕 Add gameload's --private, its GPU-read Shared buffers made Private
A discrete GPU reads gameload's Shared buffers in system memory: the frame's
constants and the materials' argument buffers, which every vertex and fragment
reads, and the ICBs' argument buffers, which each encode thread reads. On the
RTX 3090 behind a Thunderbolt link, gameload's frame takes 46 ms of GPU time
against the RX 7900 XTX's 9.9 ms, and the link carries many small reads a
frame. --private frame,materials,args puts each in a Private buffer instead,
copied from its Shared one by a blit at the start of the frame (once where the
CPU writes it once), so a run with it measures what those reads cost.
2026-11-14 05:03:33 -08:00
Anees Iqbal 9e942f2447 🐛 Refuse overlaps of half constants and function tables at newFunction
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.
2026-11-14 01:59:32 -08:00
Anees Iqbal a28ecb8955 🆕 Add gameload's cicb, a compute ICB of concurrent dispatches
G1, the host's replay of GPU-encoded indirect command buffers, has a compute
half that gameload's icb shape (draws only) never reaches. cicb is that shape:
a kernel encodes CICB_COMMANDS concurrent dispatches into a compute indirect
command buffer, every fifth reset, and a later compute encoder sets the
pipeline and its buffers at non-zero offsets and executes it. The commands
inherit the pipeline, and the encoder's buffers unless -b, where the kernel
sets each command's three buffers itself.

The dispatches sum their input into one word for each frame in flight, which
the CPU checks against its own sum as the frame slot comes back. A replay that
drops a command, a grid or an offset then fails the run (exit 1, cicb_bad)
instead of only running slower. -c sets the command count (512 by default),
which the frame constants carry in what was their pad word. The tools' README
names the new shape.
2026-11-13 18:30:24 -08:00
Anees Iqbal 7809cef902 📝 Record what aliased surface textures see in one command buffer [ci skip]
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.
2026-11-13 17:49:41 -08:00
Anees Iqbal 33cc8eff6e ✅ Ask what a wide reader reads past the plane's texels
The x86 Macs keep the CPU's bytes past the texels in the surface after a wide
texture writes them; the aliasing cases now count, where the wide texture
reads, the runs whose read of the bytes past the texels gave the CPU's.
2026-11-13 17:49:41 -08:00
Anees Iqbal 4679e24068 ✅ Count the texels and the bytes past them apart after an alias
The x86 Macs left the surface without the wide texture's writes after the
command buffer of an aliasing case, where the M3 held them: the count of the
surface after each run now takes the plane's texels and the bytes past them
apart, and counts the runs whose bytes past the texels still hold the CPU's.
2026-11-13 17:49:41 -08:00
Anees Iqbal 45cd68878c ✅ Ask oracle_surftex what aliased surface textures see in one CB
A texture over an IOSurface plane wider than the plane's texels gets a home of
its own on a host whose device cache lays the plane out at the GPU's pitch, so
the host has to know whether Metal shows one encoder's writes through one
texture to the next encoder's reads through another texture over the same
plane, in one command buffer. The aliasing cases write an L008 surface of
128-byte rows through an RG8 texture of the whole rows or an R8 texture of the
plane's texels, by a blit or a clear, and read them back through the other in
the next encoder, tracked and Untracked with a fence, 16 runs each.
2026-11-13 17:49:41 -08:00
Anees Iqbal f2d3443a05 🆕 Add gameload, a game-shaped Metal load beside the oracles
The perf ledger's AAA rows (heap shadows, format views, chunk imports, heap
compression, per-draw cost) each wait on a run that makes the load an AAA
Metal port makes, and none of our walks makes it. gameload is that load, our
own code: offscreen, a fixed number of frames, each frame's CPU, wait,
frame-to-frame and GPU times printed with their p50, p90 and mean, and the
measured window's start and end on the wall clock so a host's logs of the same
span can be cut to it.

A frame holds placement-heap streaming (slots made again at their offsets and
uploaded, BC7 where the device has it, a placed vertex buffer, transient
textures from an automatic heap made aliasable), render targets placed in a
heap, a 4x MSAA scene with depth resolved, composited through an sRGB view and
with a UI pass into a BGRA view, a GPU-encoded indirect command buffer, 4000
CPU draws and 1000 shadow draws over argument buffers, compute
post-processing and a blit stream with a read-back. Each of the eight shapes
turns off by name, so a run with one off measures its share; -b makes the
indirect command buffer inherit no buffers.

make -C guest/bundle/tools/gameload builds one universal binary (arm64 and
x86_64) for an Apple-silicon Mac, the Intel oracle and both guests. It has a
Makefile of its own because guest/bundle/Makefile is a source the prebuilt
guest sets record, and a target there would mean rebuilding both sets. The
tools' README gives the command lines the measured runs used.
2026-11-13 17:47:40 -08:00
Anees Iqbal 5b381d1e86 ✅ Ask oracle_surftex every usage bit Metal names none for
The sixth round showed all three Macs end the process at usage bits 0x40
and 0x100, drop 0x8 from the answer and keep 0x4000 and 0x10000, and end
it at the atomic bit for every format but R32Uint, R32Sint and, on an
Apple GPU, RG32Uint. The seventh round asks each other bit alone, three
at once, and more formats with the atomic bit, so the bundle's rule
covers the class and not the bits seen so far.
2026-11-13 16:44:56 -08:00
Anees Iqbal 585a37a370 ✅ Ask oracle_surftex which usage bits a surface texture keeps
The arm64 guest answered usage 0x23 for an R32Uint texture over a BGRA
surface asked for ShaderRead, ShaderWrite and ShaderAtomic, where the M3
answers 0x3. One case can't say which bits Metal drops, for which formats,
or whether the surface or the format decides. The sixth round asks the
atomic bit across formats, storage modes and surfaces, with and without
PixelFormatView, bits Metal has no name for, the same descriptors over no
surface, and a view of the texture over the surface.
2026-11-13 16:44:56 -08:00
Anees Iqbal d672b9d661 ✅ Probe each resource kind's purgeable states in oracle_bundle
The arm64 walk found a visible function table keeping the Volatile state it
is told on the guest, where the M3 Max's stays NonVolatile. Before the
bundle's answers change, purgeable.kinds measures the states every kind of
resource the device makes answers, buffers, views, textures over buffers and
IOSurfaces, heaps and what they hold, and indirect command buffers, so the
rule comes from measurements on each reference GPU.
2026-11-13 14:24:45 -08:00
Anees Iqbal 11d137d7b8 ✅ Probe what Metal's base device answers under a feature profile
The arm64 guest's device answers the x86 Macs' feature profile, 10002,
where the M3 Max answers 10. Metal reads the profile at device creation and
keys limits, families and feature queries on it; this probe prints what the
base device answers under each profile asked, so the change to 10 can be
weighed against what the device itself answers.
2026-11-13 13:05:57 -08:00
Anees Iqbal ea05c9f1c8 🐛 Reflect a constant buffer's own alignment on an Apple GPU
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.
2026-11-13 13:02:55 -08:00
Anees Iqbal f29a3d17b6 ✅ Probe the depth/stencil queries over a grid of descriptors
ds.queries' 15 descriptors leave the M3 Max's rule open where a test cannot
pass or fail (Never, Always) and where masks are 0; the grid asks every
compare, operation set and mask, so the rule is read from measurements,
not guessed.
2026-11-13 13:02:55 -08:00
Anees Iqbal 450543058e ✅ Probe depth/stencil queries, ids and tiled bytes in oracle_bundle
The arm64 guest's device answers as an Apple GPU, so each answer it gives
has to be measured on the M3 Max's own Metal first. These cases ask what a
depth/stencil state answers to the four queries Apple's GL renderer sends,
to resourceIndex and uniqueIdentifier, and what the device's tiled texture
SPI over bytes and a buffer's tiled SPI answer.
2026-11-13 13:02:55 -08:00
Anees Iqbal 5fc13039ec 🆕 Time a retain right after a setVertexBytes in encode_probe
A locked instruction right after a store to a write-combined page waits for
the page's write-combining buffers to drain, which may cost ~90 ns on an AMD
host where the guest's write-combined mappings stay write-combined. setBytes
copies its bytes into a write-combined upload chunk, so the new case
render.setVertexBytes.16.retained follows each 16-byte setVertexBytes with a
CFRetain and a CFRelease, to set against render.setVertexBuffer.retained's
cost of the same two locked instructions after a write-back store.
2026-11-13 12:38:11 -08:00
Anees Iqbal e5bcaf123d 📝 Record an Apple GPU's answers where x86 rules differ [ci skip]
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.
2026-11-13 12:10:36 -08:00
Anees Iqbal 597d929efd 🆕 Ask oracle_surftex which odd two-plane textures an Apple GPU makes
A fifth round of 74 cases: each 4:2:0 and 4:2:2 two-plane format over a 420v
surface's luma plane at an odd height, at an odd width, as a render target, at
an odd size as a shader-written and a shader-read texture, and each 4:4:4 and
XR10 one at an odd size, shader-written. The M3 Max answered nil for a 63 x 63
render target of every subsampled format, and for 500 written by a shader:
these cases tell which side and usage decide it.
2026-11-13 12:10:35 -08:00
Anees Iqbal 6b9ec7fcdc 🆕 Ask the oracle probes where an Apple GPU's answers differ
oracle_surftex gets a fourth round of 45 cases: the compressed formats only an
Apple GPU has (ASTC, ETC2, EAC, PVRTC) over a surface with planes and without,
the cube types over a plane, and two-plane textures of odd sizes, as render
targets and not, over each kind of plane. oracle_bundle gets a Shared heap
(heap.shared), buffers and textures of options holding bit 17, 18 or 19, the
tiled and linear texture SPI's answers (tiled.responds), and the depth and
stencil formats over a Shared buffer by the public form and Depth32Float by
the linear SPI. The x86 Macs answered most of these (or end the process at
them); the arm64 guest's rules need the M3 Max's.
2026-11-13 12:10:35 -08:00
Anees Iqbal 5a683edc68 🐛 Make mps.fn expect Metal's refusal of the zero constants
The pipelines tool's mps.fn case gives every MPS kernel each of its constants
as 0. Metal refuses that for cnnConvArray_32x32_128, whose arguments src and
another texture then share texture 0 (measured: macOS 26.7.1, the 5300M). The
case counted that as a refused pipeline. It now lists each refused
specialisation, with the first line of its error, as spec_refused. A refused
pipeline fails the case. Both of the walk's processes now answer the same, as
Metal does.
2026-11-13 08:43:21 -08:00
Anees Iqbal 170976bcae 🆕 Measure where Metal refuses arguments at one location
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]
2026-11-13 08:43:21 -08:00
Anees Iqbal 6f27b78d53 🆕 Time a bind wrapped in a retain and a release in encode_probe
An app's reference counting may wrap an encoder call in a retain and a
release of its argument, two locked instructions on the encoding thread.
render.setVertexBuffer.retained times setVertexBuffer:offset:atIndex: so
wrapped, to set what they cost in a guest against a real Mac.
2026-11-12 16:14:00 -08:00
Anees Iqbal f187cc950f 🆕 Add encode_probe, the hot encoder calls' cost in ns a call
Nobody knows what the guest's Metal bundle costs the guest's CPU per Metal
call against a real Mac's Metal: the host's per-draw cost is measured, the
guest's share is not. encode_probe times runs of one encoder call each
(buffer, bytes, texture, sampler and pipeline sets, draws, compute sets and
dispatches, encoder make and end, command buffer make and commit) and prints
ns a call from wall and thread CPU time, so a guest and a real Mac run the
same binary and compare call by call.
2026-11-12 16:14:00 -08:00
Anees Iqbal 20433e54fe 🐛 Make icb_probe's indirect command buffers Shared
The Intel UHD 630 encodes nothing into a Private buffer's commands from the
CPU: every case drew nothing there. A Shared buffer is what a CPU encode
takes on every Mac, as Apple's samples make theirs.
2026-11-12 15:33:37 -08:00
Anees Iqbal 14133206c5 🆕 Time icb_probe's encodes of an ICB that binds 31 buffers a kind
A buffer of 16384 commands that may bind 31 vertex and 31 fragment buffers
passes the cap on one slot table, so the device takes its encodes as records
on ring 0: the wide case times that route against the slots' at the same
encodes.
2026-11-12 15:33:37 -08:00
Anees Iqbal 987618f7ca 🆕 Add icb_probe, the cost of CPU encodes into ICBs and IOSurfaces
The guest's CPU encodes into an indirect command buffer write its slots in a
block of the device region, which the guest's kernel maps uncached, as is a
surface's copy where the host takes it not in place. The probe times them a
command at a time against a real Mac: an ICB of draws, of inherited draws and
of dispatches, encoded again each repetition as a renderer does each frame
and then executed and checked, a range reset, and a CPU write of an IOSurface
read by the GPU, at rows every host takes in place and at rows a host whose
linear textures align to 128 bytes or more copies.
2026-11-12 15:33:37 -08:00
Anees Iqbal 146d57b243 🆕 Probe which CPU bytes a Managed buffer's GPU copy takes
A Managed buffer written again after its didModifyRange: shows when Metal's
two-copy Managed buffers take the CPU's bytes: at the call, at the commit or as
the GPU runs. oracle_storage's capture case writes A, calls didModifyRange:,
and writes B before the commit or after it while the command buffer's first
kernel spins, then reads the buffer in a kernel; A alone and B with a second
didModifyRange: are its controls. [ci skip]
2026-11-12 13:43:49 -08:00
Anees Iqbal 29f080bae9 🐛 Take mps.fn's kernels from the libraries Vision loads them from
MPSCore's default.metallib holds none of the twelve kernels (5300M, macOS
26.7.1): Vision takes its convolutions from MPSNeuralNetwork's library and its
TARR_ kernels from Espresso's.
2026-11-12 12:45:37 -08:00
Anees Iqbal 4fe0ecdaec 🆕 Time MPS kernels' functions and pipelines in the pipelines tool
Vision's person segmentation spends 0.3 to 0.7 ms a compute pipeline create in a
guest, against 0.02 ms natively, while the guest's round trip to the host
(rt.query) is 0.035 ms and a create the host made before (cp.const's second
process) 0.1 ms. mps.fn times the creates' steps over MPSCore's own kernels, in
Vision's order: the function, its specialisation and its pipeline, so a run
shows which step holds the time.
2026-11-12 12:45:37 -08:00
Anees Iqbal d787b79365 🆕 Time a query that compiles nothing in the pipelines tool
rt.query asks heapTextureSizeAndAlignWithDescriptor: of a fresh width each
repetition, which no cache answers: on a guest, the device's round trip to
the host with no work there, the floor under each pipeline create's wait,
which cp.const and cp.warm measure beside it.
2026-11-12 12:45:37 -08:00
Anees Iqbal 7ff8cfb02e 🐛 Reflect post-tessellation vertex functions' control points
A post-tessellation vertex function's control point input
(air.patch_control_point_input) takes two nodes the AIR reader did not
follow, its control point function's and its attributes', so the reader
gave up on the whole entry point and its pipelines got no reflection: a
creator asked for reflection answered nil where Metal answers one.

The reader now follows them, keeping each attribute of the control point,
and reads the entry's patch type (air.patch). The reflection answers what
the AMD 5300M, the Intel 630 and the M3 Max agree on, measured with
pipeline_reflection_check's patch cases (m3-max-22312, 22313, 22314): the
control points and the patch's attributes are no bindings, the vertex
descriptor's buffers are unused though the function reads them,
position_in_patch and patch_id are built-ins 14 and 13, and the dump stride
adds the patch's position, 12 bytes for a triangle and 8 for a quad, taken
or not. Two new probe functions (a triangle patch that takes no position,
and a quad that takes one it never reads) pin the last rule.

What the guest observes: those pipelines' reflection, where it got nil.
2026-11-12 12:45:37 -08:00
Anees Iqbal 6e04a8ea7d 🆕 Probe compute pipelines' threadgroup fields and patch reflection
oracle_threads makes compute pipelines of salted kernels, each a first
compile in a child of its own, to measure what requiredThreadsPerThreadgroup,
maxTotalThreadsPerThreadgroup against the kernel's attribute and the device's
limit, and macOS 27's forwardProgressUsage, contentionRelief and
optimizeForPersistentKernel make: the refusals, the process's end and the
made pipeline's answers. The bundle keeps the required size guest-side and
checks none of it.

pipeline_reflection_check gains three post-tessellation vertex functions'
cases (r_patch, r_patch_points, r_patch_buffers) over new functions of
oracle_reflection.metal, to measure Metal's reflection of their control
point and patch inputs, which the AIR reader does not follow yet.
2026-11-12 12:45:37 -08:00
Anees Iqbal fac39ba521 🆕 Ask the M3 when a queue lets a removed residency set go
The guest run of oracle_residency showed the M3's queue still holding a set
right after its last removal, where the arm64 device's queue let it go at
once. The hold case now asks when the M3's queue lets it go: a moment later,
once the queue makes a command buffer, and once one of its buffers completes;
for a set added and removed twice, and for one whose queue's buffers wait
behind another queue's.
2026-11-12 10:14:40 -08:00
Anees Iqbal cc3c03cb75 🆕 Ask a command buffer's internal residency set use of the M3
The bundle's command buffer passes useInternalResidencySet: on to
useResidencySet:, as Metal's base buffer does, and the arm64 buffer raises at
a nil set there, as Metal's does. cb-use-internal and cb-use-internal-nil ask
whether Metal's internal form takes nil the same way.
2026-11-12 10:14:40 -08:00
Anees Iqbal 3e89acf88a 🆕 Measure a residency set's sizes and what a layer sends it
The first run on the M3 Max showed a set's allocatedSize counting memory, not
allocations (a heap's buffer and a texture's view add nothing beside their heap
and texture, and two small buffers count one block), and a CAMetalLayer making
a set of its device and adding its drawables' textures. The sizes case measures
the rule on more shapes, and layer-spy which members QuartzCore and Metal send a
set, by caller, so the guest's set answers the ones a layer uses. A huge initial
capacity spun the M3's child for minutes, so each case now ends itself after
30 s.
2026-11-12 10:14:40 -08:00
Anees Iqbal b182706613 🆕 Probe what a device answers for residency sets
The arm64 guest's device answers nil to newResidencySetWithDescriptor:error:,
where Apple silicon's Metal makes a set, and apps built for Apple silicon on
macOS 15 and later use one. Before the bundle makes its own, oracle_residency
measures what a set answers on a Mac: its classes and members, its count,
contents and size after each add, remove and commit, its residency requests,
what holds what, the queue's, command buffer's and encoders' residency calls,
a CAMetalLayer's set and the calls on bad inputs, each case in a child
process. It runs the same on the guest's device.
2026-11-12 10:14:40 -08:00
Anees Iqbal b3354ddddd 🆕 Probe what a device answers for function pointers and dylibs
The lane's function pointers and dynamic libraries copy what the x86 Macs'
devices answer, and the answers have to be measured on them and compared in a
guest. oracle_fnptr makes compute pipelines that link three functions, their
handles and visible function tables of 0 to 4096 entries, dispatches calling
through tables bound at an index, in a range and through an argument buffer,
a render pipeline's handles and tables (ORACLE_FNPTR_NO_RENDER skips them: the
Intel UHD Graphics 630 ends the process there), and a dynamic library made of
a library and read from a file, a kernel linked against it preloaded and by
install name, the same kernel's library made of its file's bytes, a compile
of source against the dynamic library (the messages it sends it, through a
proxy, and what its private airData answers), and the refusals: a library
that is not dynamic, a missing file, a missing directory to serialize into, a
name that loads nothing. build.sh builds its libraries, the dynamic one with
its install name and a kernel linked against one that is gone.
2026-11-12 08:14:18 -08:00
Anees Iqbal 2021c68def 🆕 Probe what a device's rasterization rate maps answer and draw
A probe of our own for the dGPU oracle, oracle_ratemap: the layer counts a
device supports, its maps' and descriptors' classes and members, a map's
answers and parameter data, a triangle drawn through a map and decoded in the
shader, and the calls that may end the process, each in a child process. It
runs the same on the guest's device.

What the AMD Radeon Pro 5300M answers (macOS 26.7.1) is Q28 of
docs/graphics-kext/dgpu-oracle.md: its maps are the identity whatever their
samples, 16,472 bytes of parameter data aligned to 256, layer counts 0 to 2,
and the process ends at a map of no layers' creation, at a copy into a Private
buffer and at the physical-to-screen map past the layers. Where the M3's
compile (the platform's) answers otherwise, both bound the contract; the doc
says what the lane answers of each.
2026-11-12 08:14:05 -08:00
Anees Iqbal 580927122d 📝 Record the rows IOSurface works out on the oracles
oracle_rows ran on the 5300M, the 630 and the M3 Max: a surface made with no
rows named takes IOSurface's own 64-byte rows on the Intel Mac (192 bytes for
an RGhA surface 18 texels wide), whichever GPU's process made it, though both
GPUs align a linear texture's rows to 256; the M3 takes 128. So no Mac's GPU
sets the rows, and the rows a client names (CoreAnimation's, CoreVideo's)
stay its own. Q27 records the numbers; build.sh builds the probe and the
README lists it.
2026-11-12 07:56:02 -08:00
Anees Iqbal c60b4fd0ca 🆕 oracle_rows: the rows IOSurface works out where none are named 2026-11-12 07:49:22 -08:00
Anees Iqbal f42822579c 🆕 Add an oracle probe of Metal's answers at each URL a call takes
oracle_urls runs each call of a device, a library and a binary archive that
takes a URL (library and archive loads and writes, the IO handles, dynamic
and binary libraries, Metal 4 archives) at each form of URL: nil, a path of
no scheme, a file URL, another scheme's URL of a path and a URL of no path,
with the file there and not. Each case runs in a child process of its own, so
a call that ends the process at a failed assertion shows its words. The
guest's bundle matches its answers from what it prints on the AMD 5300M, the
Intel 630 and the M3 Max.
2026-11-12 05:35:38 -08:00
Anees Iqbal cc36035eb4 🐛 Wait for the probe's window before check-boot counts its frames
Under TCG on a quiet homelab-um870-1, arm64 macOS 14.6.1's full-screen
probe window was first shown 2.1, 4.4 and 8.1 s after it was ordered front
in three boots, and not within the probe's 11 s in a fourth, which dropped
all 245 frames and failed metal-app (m3-max-17482). The probe ran 3 to 4
minutes after QEMU started, while the guest's post-login launches kept over
200 processes runnable on its 4 vCPUs. Counting frames over a fixed time
from the window's start read that delay as a device that shows nothing.

present_probe -v SECONDS now renders while it waits up to SECONDS for its
window to be shown (its occlusion state turning visible, or a frame's
nonzero presentedTime), then warms up a second and measures. Its line gives
the wait as visible_s, or none. check-boot runs it with -v 60, and fails a
window not shown in that time as such. Without -v the probe measures as
before, so the lane gate's runs are unchanged but for the new key.
2026-11-11 17:05:46 -08:00