Commit Graph
4652 Commits
Author SHA1 Message Date
Anees Iqbal 892a0eefb0 🐛 Make BC textures over a surface where they answered nil
Since c13-contract (ae37ce1c2) the bundle answered nil for a BC1 to BC7
texture over an IOSurface or one of its planes, before it took a view of the
surface. Metal on the x86 Macs makes these wherever the rows fit, over a
surface with planes or without, in Managed or Private storage
(oracle_surftex, Q20). The nil was the host's limit: pin 14's runtime made
no texture of one over a surface's rows (NotLinear). metal2vulkan's stack
34, at this branch's pin, makes them in the x86 Macs' form, row j of blocks
at the plane's row j (on MoltenVK as a shadow image), and the bundle's own
CPU access takes the same rows since 187d1ee33. Runtime gaps are
metal2vulkan's, and ours go at the pin that fixes them.

What changes for the guest: newTextureWithDescriptor:iosurface:plane: of a
BC format answers a texture and posts its create, where it answered nil and
logged "no texture (descriptor)". The shapes stack 34 still refuses (a BC
texture over a plane at an offset or rows off 16 bytes, or wider than the
plane's rows) are posted and refused as the host's other refused shapes are
(decode/refused.rs). On the Metal platform, whose buffer creator answers nil
for BC as Metal's IOSurface creator does (87b24e27e), the texture is a
refused create too.

Test: test_iosurface_block_compressed_textures_are_made fails at the base,
where the bundle answers nil.
2026-11-05 21:59:37 -08:00
Anees Iqbal bbb493d81a ✅ Test that Vulkan makes BC textures over a surface
A BC1 or BC7 texture over a surface's rows, through the buffer that stands
for the surface, is made at metal2vulkan's stack 34, as the x86 Macs make
it (dgpu-oracle.md, Q20): over a surface without planes, and over plane 1
of a surface with planes. It reads back row j of its blocks from the
plane's row j, as theirs do. The bundle sends these textures once it stops
answering nil for them, so the test pins the host's half.

Test: bc_textures_over_a_surface_s_rows_are_made.
2026-11-05 21:59:37 -08:00
Anees Iqbal efb9634ac2 ✅ Pin Metal's nil for BC textures over a surface
The bundle is about to send BC textures over a surface to the host, which
the Vulkan runtime makes as the x86 Macs do since metal2vulkan's stack 34.
The Metal platform makes a texture over a surface's plane through the
buffer that stands for the surface, with newTextureWithDescriptor:offset:
bytesPerRow:. Measured on the M3 Max under macOS 27 with no validation
layer, that creator answers nil for a BC1 or BC7 texture and does not end
the process, as Metal's IOSurface creator answers nil over the surface
itself (dgpu-oracle.md, Q20). So on the Metal platform the guest's BC
texture over a surface is a refused create (decode/refused.rs), and nothing
dies.

Test: bc_textures_over_a_surface_s_plane_are_metals, which compares the
platform's answer with Metal's IOSurface creator's on the same host.
2026-11-05 21:59:37 -08:00
Anees Iqbal 6813776e3c 🐛 Size a surface texture's CPU access in its own format's texels
A texture over an IOSurface read and wrote its rows on the CPU (getBytes,
replaceRegion) in the surface's elements, not the texture's texels. A
texture of a narrower format than the surface's element wrote past the
caller's rows: an R8Unorm texture over a 'BGRA' surface copied four bytes a
texel into a buffer of one a texel. A wider format copied too few bytes, and
a surface whose elements are not single pixels (a 4:2:2 one) gave none.
Metal reads and writes the texture's own texels, row j of them at the
plane's row j.

What changes for the guest: getBytes and replaceRegion of a texture over a
surface read and write the blocks of the texture's own format
(rgfxPixelFormatBlock) at the plane's rows, over a 4:2:2 surface too. A
texture of a format with no block there (depth or stencil, Private over a
surface) reads and writes nothing.

It is also the ground for block-compressed textures over a surface, whose
rows of blocks lie at the plane's rows.

Test: test_iosurface_cpu_access_in_the_texture_s_format fails at the base,
where the R8Unorm read writes past the caller's 256 bytes.
2026-11-05 21:59:37 -08:00
Anees Iqbal 163b4c21eb 🐎 Keep the refused-object checks off the walk's common path
Our decoder still spent 66 instructions a draw more than car 11's on a
compositor's stream (draw_cost's ws shape, Metal arm, M3 Max release, decoder
above the platform), most of them what 94b7cb0b6 added and e551d6faa left.
Measure-only variants on e551d6faa's change split them: about 35 were the render
walk's checks at each op (a drawing op's test, and the marks' two flags read
again), about 20 the bindings' marks.

- While no slot of the encoder's state holds a refused object, the render walk
  runs the loop it ran before 94b7cb0b6, with an op's refused raise contained,
  and reads one flag after each op it carries out. From an op that leaves one
  held, the pass goes on in an out-of-line copy of the checking walk.
  vertex_draw is inlined at both: with two callers it went out of line, and each
  op's look went through a call (127 instructions a draw more, measured).
- The marks keep whether draws drop in one flag, set where a slot is marked, a
  mark ends or the encoder skips the rest. drops_draws reads it, and replaces on
  purpose car 14's skips() || (any() && holds_state()), whose holds_state()
  walked the set after each op while only a buffer, texture or sampler slot was
  marked. The flag keeps texture-nil's rule: a mark sets it only for a pipeline,
  depth/stencil or tessellation factor slot (Slot::drops_draws), an unmark
  recomputes it from the set, and skip_rest sets it.
- Bindings through an iterator match their resolve in place, as single bindings
  do (bind!), and Marks::bound goes. A binding that names its slot nowhere else
  builds it only in its cold arms. The tests bind through a helper of their own.

Measured the same way, in instructions a draw:
  b4aff9c7f (car 13)                944.0
  006378020 (car 14)                830.5
  with this                         780.4 (789.9 without the one flag)
  6f8118d14 (car 11)                764.4

Nothing the guest or host observes changes: the same bindings mark, end a mark
and refuse, and the same draws and dispatches drop or run. The refused objects'
tests pass, texture-nil's among them:
a_refused_resource_binds_nil_and_drops_no_draws and
what_names_a_refused_create_is_dropped_and_its_command_buffer_completes.
2026-11-05 21:59:37 -08:00
Anees Iqbal 93dd656cd5 🐛 Answer the sampler count metal2vulkan's sampler arrays hold
maxArgumentBufferSamplerCount on the Vulkan platform was the least of
maxDescriptorSetUpdateAfterBindSamplers, its per-stage limit and
maxSamplerAllocationCount. metal2vulkan places a live sampler state at
an element of every set-1 sampler array, from 1 up: element 0 is the
neutral sampler, an array has at most the handle search's 65536
elements, and a function reads no such array on a device without a
runtime, partially bound, update-after-bind array indexed non-uniformly.
So the count was one too high on every device (4000 for 3999 on an RTX
5080, 32768 for 32767 on lavapipe), far too high where the limits pass
the search's reach (500000 for 65535 under MoltenVK on the M3 Max), and
not 0 where the device reads no sampler array.

The answer is now the least of 65536, the two limits and the sampler
allocations, less the neutral's element, 0 where the device lacks one of
those four features, and 0 rather than a wrap where nothing is left.

For the guest: its device answers metal2vulkan's own count. A state past
the count reads through an argument buffer as the neutral sampler, which
the runtime announces as unlisted-argument-sampler, of answer.rs's DIES:
relayed, and in strict mode the death of the call that made the state.
The old answer told a guest it could keep that many states listed, so a
guest that made up to it, past metal2vulkan's count, could reach it.
2026-11-05 21:59:37 -08:00
Anees Iqbal 46b5590aa4 🎨 Order display_cost.rs's imports as rustfmt does
c14-display-perf's new display_cost.rs listed reims_vgpu_core::platform's braced
import before the platform submodules' imports, and the car's rustfmt (the
toolchain's) puts it after them, so the car's fmt step failed. No code changes.
2026-11-05 21:59:37 -08:00
Anees Iqbal 9beab79d22 📝 Number texture-nil's oracle sections Q24 and Q25 after shared events
c14-shared-events and c14-texture-nil each added a Q23 to dgpu-oracle.md. The
car keeps shared events' Q23 and numbers texture-nil's two sections after it:
the texture descriptors each creator refuses are Q24, and what a command buffer
does with nil objects is Q25. The references in dgpu-oracle.md, design.md, the
decoder's refused.rs and the shell tests follow, and the report's probe list
names oracle_events, which shared events added to the oracle's README and
build.sh.
2026-11-05 21:59:37 -08:00
Anees Iqbal 9e226f2f98 📝 Record what a command buffer does with nil objects [ci skip]
oracle_nilbind measured what the AMD 5300M and the Intel 630 do with nil where a
command buffer names an object: Q25 records it and what the decoder now does with
a refused one. Q24 adds the block-compressed and texture-buffer answers over a
buffer, and where the bundle answers nil beside them.

Car 14's stack: Q25 and Q24 were the lane's Q24 and Q23; c14-shared-events
holds Q23 on the car.
2026-11-05 21:59:37 -08:00
Anees Iqbal 019bfa1b38 🐛 Draw with nil where a binding names a refused resource
A binding of a buffer, texture or sampler whose posted create the host refused
bound nil and dropped the encoder's draws and dispatches until the slot was
bound again. Metal on the AMD 5300M and the Intel 630 runs a draw or dispatch
with nil bound there (oracle_nilbind, docs/graphics-kext/dgpu-oracle.md, Q25):
a texture reads zero on both, a buffer zero on the AMD. The decoder now binds
nil and runs them, as it does the guest's own nil; the slot stays marked, so
an offset op there still sets nothing. A refused pipeline state, depth/stencil
state or tessellation factor buffer still drops the draws.

For the guest: the draws and dispatches after a binding of a refused buffer,
texture or sampler reach the GPU, reading the platform's nil there
(metal2vulkan's zero image, sampler and buffer; Metal's own on the Metal
platform).

Car 14's stack: fix G (e551d6faa) had made Marks::drops_draws skips() || any(),
with the slot set reached only out of line; the lane's slot scan goes in a cold
Marks::holds_state, so drops_draws stays skips() || (any() && the scan), and
the struct's and the render walk's comments say both lanes' rules. Q25 was the
lane's Q24 (c14-shared-events holds Q23).
2026-11-05 21:59:36 -08:00
Anees Iqbal 31115cc8df 🐛 Answer nil for a block-compressed texture over a buffer
The bundle posted a BC1 to BC7 texture over a buffer's bytes, which the host's
platform makes none of (Metal's over a buffer, and metal2vulkan's linear
images), so the host refused it and every draw that named the texture was
dropped. The AMD 5300M answers nil for one over a Shared buffer, 64 x 64 and
62 x 64 (oracle_texdesc buffer bc1.*), where the Intel 630 makes it: the
envelope holds nil, and the bundle answers it, sending nothing.

For the guest: newTextureWithDescriptor:offset:bytesPerRow: of a
block-compressed format is nil. Both x86 Macs make a single block's (2 x 2),
which is now nil too.
2026-11-05 21:59:36 -08:00
Anees Iqbal 5a208f8829 📝 Record which texture descriptors each creator refuses [ci skip]
oracle_texdesc measured the descriptor validation every texture creator runs on
the AMD 5300M and the Intel 630, rule by rule and in order, which the bundle now
copies. Q24 records it, and Q12 says whose words the bundle now gives.

Car 14's stack: c14-shared-events holds Q23 on the car, so the lane's Q23 and
Q24 are Q24 and Q25 here, in these commits' bodies and in car 14's doc fix after
the lane's commits, which renumbers the doc's headings and references; the doc
keeps both sections, shared events' first.
2026-11-05 21:59:36 -08:00
Anees Iqbal 476bafaad7 🐛 End every texture creator at the x86 Macs' descriptor validation
A texture create is posted, not waited for, so a descriptor the host refused
left the app holding a texture whose every draw was dropped, where Metal on the
x86 Macs ends the process at its descriptor validation. The bundle copied a few
of its rules (three-channel formats, multisample compressed formats, depth in
CPU storage), and the IOSurface creator a subset of its own.

Every texture creator now runs one copy of
-[MTLTextureDescriptorInternal validateWithDevice:]: the device's, both of a
heap's, a buffer's public form and its linear and tiled SPI, and the creator
over an IOSurface. It follows the AMD 5300M and the Intel 630 under macOS
26.7.1 at the device, a Private heap and a Shared buffer (oracle_texdesc, 107
descriptors): every rule broken a line, in their order, in one assertion; the
sample counts the device makes; Depth24Unorm_Stencil8 and X24_Stencil8 lacked,
as on the Intel. A heap's creators then end the process at a descriptor of
another storage mode than the heap's, and a texture type past TextureBuffer
ends it with no words, as there.

For the guest: a process that sent the host a texture create Metal does not
make now ends at the create with Metal's words, and the host is sent nothing.
2026-11-05 21:59:36 -08:00
Anees Iqbal 6bffecada8 🆕 Add oracle_nilbind, what a command buffer does with nil objects
A command buffer naming an object whose posted create the host refused stands
the object in as nil. What Metal does with nil there (a draw or dispatch
reading or writing a texture, sampler or buffer bound nil, a pass with a nil
attachment, a nil pipeline state, a blit from or to nil) is measured here on
the x86 Macs and the M3. [ci skip]
2026-11-05 21:59:36 -08:00
Anees Iqbal 77f12120d4 🐛 Answer nil for a texture with no GPU address left
A device-placed texture and a Managed texture's GPU copy take a GPU address
of the context's range, which runs out at address-space exhaustion. Their
creates took the address unchecked and posted 0, where a heap, a buffer and
every other create that picks an address answer no object.

What changes for the guest: at exhaustion such a texture is nil, as Metal
answers one it cannot place, and nothing is posted; its resource id goes back
for the next texture. A texture in a heap takes no address and is unchanged.

Test: test_creates_with_no_address_post_nothing fails at the base, where both
creates post with address 0.
2026-11-05 21:59:36 -08:00
Anees Iqbal 07bae0cdc9 🆕 Add oracle_texdesc, the descriptors each texture creator refuses
What the device's, a Private heap's and a Shared buffer's texture creators
make, answer nil for, or end the process at, by the descriptor alone. The
bundle's creators copy the x86 Macs' answers, and oracle_surftex measured
them only over an IOSurface. [ci skip]
2026-11-05 21:59:36 -08:00
Anees Iqbal 94d9df7c3b 🐎 Draw a colour with no matrix through a table of every value
CoreDisplay now sends its display profile's gamma tables to the pipe on every
boot (the display answers plane gamma as an AMD Mac's does), so the window's
draw goes through the display's colour on every frame: each pixel ran up to
three interpolated table stages, two buffer reads a channel each.

A colour with no matrix maps each channel on its own, and what the draw reads
takes only 256 values per channel (the scanout's bytes, an 8-bit unorm surface)
or 1024 (a 10-bit unorm surface, drawn at its own size). The sink now draws the
colour once into an n x 1 table in the drawable's format, through the colour's
own pipeline, from a ramp of every value, and then draws each frame through it:
one texel read a channel (displayPipeLutFragment and its scanout twin). Entry k
is what the pass draws for value k, so the drawable's bytes are the pass's,
which the new tests check on Metal and on the Vulkan platform, for the scanout
and each carried format over every value. A draw rebuilds the table until a
command buffer that drew it completes, so a dropped draw never leaves it
unbuilt. A colour with a matrix, a surface of another format or size, or a
drawable that is not 8-bit unorm still take the pass.

Nothing the guest or the host observes changes: the window's and the host's
reads' bytes are the pass's. The Vulkan platform's shaders.metallib is written
again (cargo xtask metallibs) for the two new functions.

The display_frame_cost bench gains the table's cases, and takes its cases in
turns frame by frame, each through a sink of its own, so the GPU's clock and
the host's load fall on each case alike.
2026-11-05 21:59:36 -08:00
Anees Iqbal e1b6d7363a 🆕 Log at debug where each display present's time goes
present_probe at -f 30 measures a frame more latency on the kext lane than on
a Mac (18.15 ms against 10.6 at 120 Hz), and nothing in the host's logs says
whether the host answers the present a refresh late or the guest's compositor
sends it late. Each present's answer now logs, at debug on its own target
(reims_vgpu::graphics::present_timing), how long after the device's last
refresh its PRESENT_SURFACE was taken, how long its writers took to finish,
when the window's draw of it finished, and the refresh that answered it,
counted from its take. The times are read on the platform's clock; at the
users' level (info) the line is never formatted.

Nothing the guest or the host observes changes: the answers come at the
refreshes they came at.
2026-11-05 21:59:36 -08:00
Anees Iqbal 8970ba8391 🐎 Answer a landed download on its ring-0 doorbell's thread
A CPU lock of a surface whose pages already hold its device cache (a decoder's
output whose early copy has landed, or a cache nothing wrote) still waited for
the control thread to wake and take its SURFACE_DOWNLOAD: p50 95.4 us from
the doorbell to the COMPLETE on the 5080 (decode-perf), most of it the idle
core's wake.

A DOORBELL write of ring 0 through mmio_write_taking now takes ring 0's next
message on the writing thread and answers it there, where it is a
SURFACE_DOWNLOAD the host has carried out already (Host::surface_downloaded,
new, default false), the control thread sleeps with every answer of what it
took posted (Submit::asleep, set and cleared under the ring's lock), the
block's lane has nothing left and the control completion ring has room.
Every lock is tried, the message is copied onto the stack, and nothing is
allocated or freed. The host's answer is the caches' own (downloaded_now):
true only where its download would answer at once with nothing to copy and
nothing to wait for, keeping the download's counts as it does. The interrupt
is raised with no lock held. In every other case the control thread takes
the download as before.

What changes for the host: a ring-0 DOORBELL write through
rvg_graphics_device_mmio_write_taking may now post a COMPLETE and call
raise_interrupt inside the call, as a queue's doorbell write already may (the
header, docs/api.md). The guest sees its answer sooner; its order among ring
0's answers is as the control thread gives it. QEMU 22ae1fd1 takes ring 0's
doorbell with an ioeventfd, so under QEMU nothing changes until
reims-graphics-pci sends that write through _mmio_write_taking too.

Tests: a_landed_download_is_answered_on_its_doorbell_s_thread and
a_doorbell_s_thread_leaves_a_download_the_control_thread_must_take
(reims-graphics), a_landed_download_s_answer_at_its_doorbell_allocates_nothing
(reims-vgpu). a_landed_download_s_doorbell_to_its_answer now measures both
writes, in turns over five rounds each.

Car 14's stack: device.rs keeps both new methods beside each other,
c14-submit-path's mark_idle and mark_awake (a queue's ring, efd360f45) and this
commit's download_on_doorbell (ring 0); ring_taking sends ring 0 to
download_on_doorbell and a queue's ring to answer_on_doorbell, as before.
2026-11-05 21:59:36 -08:00
Anees Iqbal 88f87cf0d7 ✅ Measure a display frame's cost with and without the colour pass
display_frame_cost, a measurement run by hand on Metal: the window's draw of
a 3840x2400 frame from the scanout, a BGRA8 and a 10-bit surface, with the
colour off and with an identity matrix drawn through the colour pass, as the
CPU's encode-to-commit counts (CPU ns, instructions, cycles) and the GPU's
run, over 300 frames each. draw_cost's thread counters are visible to the
graphics module for it.
2026-11-05 21:59:36 -08:00
Anees Iqbal fe8d304087 🐎 Stage an identity colour matrix off: the window draws no pass for it
WindowServer sets identity colour matrices during its fades (17 of them on an
x86-64 macOS 26 guest, with no gamma table), and since the display pipe's
colour came in, each one turned the colour on, so the window drew every frame
through the colour shaders from the first fade on.

A matrix stage a transaction sets to the identity is now staged off, as a
stage of no entries is. What changes for the host: with only identity stages
set, the window and the host's reads of the display (QEMU's console,
rvg_graphics_device_read_display) draw as with no colour, the scanout's blit,
a BGRA8 surface's copy or the present shaders, in place of the colour pass.
Red, green and blue are the same bytes (the identity gives every finite input
back exactly: the_identity_matrix_changes_no_pixel compares both draws on
Metal for every 8- and 10-bit level, every half in [0, 2) and every scanout
byte); the alpha a read gives is the guest's own again where the pass made it
0xff, as with no colour. The window's layer is opaque, so it shows no
difference. A matrix off the identity, and any gamma table, still draws
through the pass. The guest sees nothing new: the stage is off as the reset
leaves it.

A linear gamma ramp stays on: its interpolation is the identity only to
within a few ulps and it clamps, so leaving it out could change a pixel of a
float surface.

Tests: an_identity_matrix_is_staged_off (fails before: the identity was
staged on), on_metal_an_identity_colour_matrix_reads_as_no_colour (fails
before: the read's alpha was 0xff), the_identity_matrix_changes_no_pixel.
2026-11-05 21:59:36 -08:00
Anees Iqbal 023663e5ad 📝 Describe shared events across processes [ci skip]
design.md's new section says how a shared event crosses processes: the port
is a connection of the kext's, which the bundle checks before it calls on it,
one host event per name, its values posted to every holder, and the port's
hold of the event, which outlives a maker killed with SIGKILL; and the residual
of a value read across processes. The user client table lists the 'RGSE'
selectors and kext feature 1 << 6. dgpu-oracle.md's Q23 records what the 5300M
and the 630 answered.
2026-11-05 21:59:36 -08:00
Anees Iqbal d4398c6465 🆕 Hand shared events to other processes, as Metal does
eventPort, newSharedEventHandle, newSharedEventWithHandle: and
newSharedEventWithMachPort: answered nil or raised unrecognized selectors. They
now answer as the AMD 5300M and the Intel 630 do under macOS 26.7.1
(oracle_events, identical on both), where the kext and the host carry ports:

- eventPort is the kext's port for the event, asked once and the same name at
  each ask, which the event holds one send reference of;
- the handle is Metal's own MTLSharedEventHandle over it, which takes its own
  reference, keeps the label, and crosses NSXPC as Metal's does;
- an event made of a port or a handle is the same host event at its value,
  holds one more reference, and is labelled as the handle (nil from a port);
  made of this process's own port it is the event's alias, which reads the
  other's sets at once, as Metal's two events do;
- MACH_PORT_NULL, a dead name, a port the process receives, a port that names
  no shared event, and a nil handle answer nil, the references as they were;
  the bundle asks its own connection whether a port is the kext's
  (IOConnectAddClient) before it calls on it, so another process's own port is
  answered nil, where an IOKit call on it would kill the process;
- the event adopts NSSecureCoding and codes only through an NSXPCCoder, raising
  NSInvalidArgumentException with Metal's words otherwise.

The values other processes give the event come on a queue of the device's own,
its listen queue. A value set in another process reaches this one as the host
posts it, where Metal's shared page is read at once: a read right after the
other's set may see the value before it.
2026-11-05 21:59:36 -08:00
Anees Iqbal c3befe17b9 🆕 Give each handed-out shared event a port of the kext's
A shared event's port is a connection of a new user-client type, 'RGSE'
(0x52475345), on the accelerator. The kext can give a process no port of an
object of its own: copyPortNameForObjectInTask is in com.apple.kpi.private
alone (the macOS 26.7.1 KDK's symbol sets), which check-imports refuses. Its
Export (0x113) posts SHARED_EVENT_NAME and answers once the host took the name;
its Import (0x114), by any task that holds the port, posts SHARED_EVENT_IMPORT.

The port is the capability. A call on it proves the caller holds it, and the
kext posts only through the client of the calling task that holds the context
the call names (rgfxPortCallerHolds), with that client's asks, which its close
waits for. Submit refuses the three messages, so no process names or makes an
event in another's context, or imports one it was not handed.

The accelerator's client answers IOConnectAddClient of a port: success only
for a shared event's port of its accelerator. The kernel looks the port up in
the caller's space and sends it nothing, so the bundle asks it before it calls
on a port it was handed: an IOKit call on a port that is no kernel object kills
the caller (measured on the 5300M and the 630, oracle_events connect), where
Metal answers nil.

The port holds the name until IOKit frees the connection, once no task holds a
send right of it, and its free posts SHARED_EVENT_UNNAME. Its close, and IOKit's
word that its creator died, only detach it from the accelerator, so a port
another process holds outlives an exporter killed with SIGKILL.

The kext takes SHARED_EVENT_NAMES where offered and sets kext feature 1 << 6.
2026-11-05 21:59:36 -08:00
Anees Iqbal 816af84651 🆕 Name shared events across processes on the host
The device offers FEATURES_LO bit 26, SHARED_EVENT_NAMES. Ring 0 then carries
three messages only the kext builds: SHARED_EVENT_NAME names a process's shared
event device-wide (answered COMPLETE), SHARED_EVENT_IMPORT makes another
process's new shared event of the name (answered SHARED_EVENT_VALUE, with the
host event's value), and SHARED_EVENT_UNNAME, context 0's, lets go of the name
once no process holds the port the kext gave out for it.

Every holder's id is the one host event, so the processes' command buffers
signal and wait on one GPU timeline, as Metal's do. The values one holder's
buffers signal and its CPU sets go to every other holder as EVENT_SIGNALLED for
its own id, on the completion ring of the queue it named (its listen queue),
each tried at once and kept for a thread of the host's where the ring has no
room, so a process that stops taking its rings holds up no other process.

A name holds the event as a holder does, so an event made of the port after
its maker let go of it works, as the oracle measured (oracle_events refs): the
host event lives as long as the port. A close leaves an event another context
or a name holds as it is, and the last hold's going sets it past every value,
so a closed context's buffer that waits on it still finishes.

For the guest: FEATURES_LO reads bit 26 too, and a driver that takes it may
post the three messages; nothing else changes.
2026-11-05 21:59:36 -08:00
Anees Iqbal fa37211c2f 🐛 Keep oracle_events' answers through a call that never returns
The connect case's calls each run on a thread of their own, and a call that
never returns keeps its detail text: it is on the heap, not in a block's
captures, which clang refuses for an array. The probe links IOKit for them, and
IOConnectAddClient, which takes the port as its argument, never its
destination, now runs first, so a port the next calls kill the process on is
still answered.
2026-11-05 21:59:36 -08:00
Anees Iqbal 13e04ee270 🆕 Ask oracle_events about a killed exporter and foreign ports
The third round of the probe: an event made from a port whose exporter was
killed, before and after the kill, and what IOKit's object and connection calls
answer for a connection, a task port and a port the caller receives, which the
bundle's own port checks have to match.
2026-11-05 21:59:36 -08:00
Anees Iqbal ff95cf3345 🆕 Ask oracle_events what a handle's make sends its event
The second round of the probe: a handle made by initWithSharedEvent: over an
object of the probe's own, which logs what the handle asks of it, sent across
XPC as a real handle is, and the refs a port held by handles and events made
from them takes, freed as the probe's events are, by the ownership the
selectors' names give.
2026-11-05 21:59:36 -08:00
Anees Iqbal 9dfaa621e5 🆕 Add oracle_events, a probe of shared events across processes
What a Mac's Metal answers for a shared event used by two processes: its
eventPort and handle, the events made back from either, their coding, and
the value, listeners and GPU waits two holders share. It runs unchanged on
the guest's device, so it is the guest's check of the same.
2026-11-05 21:59:36 -08:00
Anees Iqbal 2168898a00 ⬆️ Build on metal2vulkan b10227d09f's runtime
Pin move 15: stacks 31 to 34 on top of 52969c03d7, in place of pin 14.
RUNTIME_VERSION 1773, SEMANTICS_VERSION 1970.

A queue's context is marked done with a transition before the command buffer's
waiters return (2b85b05ff9), which closes a completion-order race: a handler
thread let go of a command buffer's hold, so its waiters returned, before it
marked the queue's line done, and a command buffer of another queue that waited
for it through an event could then complete ahead of it, its completion seen
first (the runtime's completion_order test, 1 round in 50 on the RTX 5080
Laptop GPU beside other work). The guest now sees such a command buffer
complete after the one it waited for, as on Metal.

Textures over IOSurface planes that Metal makes are made where the runtime
refused them (715d2c3332 to 122d2f53e6): BC1 to BC7 over a plane's rows (on
MoltenVK a shadow image whose copies move the plane's rows of blocks), a texture
buffer, a 1D texture whose row fits the plane's, and a 2D array of one slice,
each over the bytes the runtime measured on an AMD Radeon Pro 5300M, an Intel
UHD 630 and the M3 Max. Each was refused as a texture Metal refuses over a
buffer (a compressed format, a type but 2D), which died at its creator here
(gpu/device.rs texture_over_plane). Every other shape Metal makes over a
planar surface's plane (rows wider than its bytesPerRow, more levels, other
types) has no one layout across those GPUs and is refused as the runtime's gap,
RuntimeGap::SurfacePlaneShape, which the creator answers nil and relays as a
refused creation, dying only in strict mode. A texture past the surface's end
is still refused.

A draw's resident uses are settled by the keys that changed since the last
draw, not by the whole resident set, and a draw's check against its pass's
geometry writes walks the uses of what its encoder made resident once an
identity (icb-stall-fix): on the RTX 5080 Laptop GPU the renderBundles page's
host step, 5001 indirect draws over 5006 resident uses, took about 242 ms a
frame at pin 14 and 22 ms after it (the runtime's measurement). A host step
records the chunks it keeps apart at an inline step's cost, hands back the
reads of chunks it keeps nothing of, and keeps draws that read textures through
the heap (resident-x7): on the M3 Max under MoltenVK the replayed_textured
page's first kept step took 3.6 ms where every step inline took 25.7 ms (the
runtime's measurement).

A render pipeline whose blended BGR10_XR, BGRA10_XR or two-plane XR attachment
(or an _sRGB twin) no first output writes, and a BGRA10_XR attachment under a
write mask of some channels, are made where the runtime refused them
NotImplemented(Format) (3356ec3db9, 6a29575e5a; SEMANTICS_VERSION 1970 at
74781c850d): the unwritten attachment takes no blend and an empty mask, as
Metal leaves it unmodified, and the masked one its fields' mask. The guest's
creator answered nil with the refusal as its NSError, relayed as a refused
creation; it now gets the pipeline, as from Metal. A padded or bfloat
attachment's unwritten blend and a mask of some of BGR10_XR's codes stay
refused.

An encoder looks up no host alias for a command whose every use of bytes names
a key found quiet, until the aliases' version moves (aliases-quiet). A shadow
over a tracked Private buffer of the runtime's own, an IOSurface plane's device
cache among them, stands across command buffers: a command buffer's first copy
in moves nothing where the image still holds every texel and nothing submitted
since wrote it, and such a plane copies back with no merge (shadow-sync). On the
RTX 5080 Laptop GPU a padded 3840x2400 plane's shadow syncing took 343 us an
idle frame before and 52 us after, 383 and 71 us a write frame (the runtime's
bench). A buffer whose VkBuffer was handed out never stands: here that is the
video decode's output into a surface's device cache
(graphics/vulkan/video.rs), which the decode's own copy writes. Writes in place
into logged host pages are reported to their logs at the commit and once after
they ran, not also at each batch and at the completion, so nothing is reported
ahead of the completed handlers. A command buffer's kernelStartTime reads 0
until its kernelEndTime is shown, waiting for an event or not, as Metal shows
neither before both (small-fixes-2); here only the host's timing lines read
the kernel times, in completed handlers, and the GPU times the guest reads are
unchanged.

The API grows by RuntimeGap::SurfacePlaneShape and WorkCounts' new counters
(replayed_heap_draws_unshared, _writing, _noted, _over_sampler_tables and
_table_textures, host_alias_lookups, resident_keys_settled,
shadow_copies_in_against_standing, shadow_copies_in_skipped_by_standing,
shadow_texels_skipped_by_standing and
shadow_texels_first_copied_in_private_surfaces), which the work log's lines
take with no change here. It loses nothing, and no degradation kind,
RuntimeDriverDefect, DriverFact, DeviceProperties or DevicePolicy field is
added, removed or renamed, so answer.rs and answer/native.rs place nothing
new and the accuracy ledger is unchanged.

Cargo.lock is unchanged: the runtime's manifests are the same at both commits,
and the lock keeps its metal2vulkan source lines stripped.

No run ends where it did not: no kind joins DIES or DIES_BY_DEFAULT, and the
surface shapes above go from a death at the creator to a texture or a relayed
nil. The last good boot, car 13's gate on the RTX 5080 Laptop GPU (b4aff9c7f),
logged no fatal line, relayed inexact-half-output-blend and
inexact-unique-identifier, and relayed no refused creation, so none of the XR
pipelines above.
2026-11-05 21:59:36 -08:00
Anees Iqbal 57e2bcce59 🐎 Find a library's function and its bitcode by name in O(1)
After the AIR read cache (104f648f8), a library's lookup of a function's
module was mostly a walk of its .metallib's function list to the name:
1.39M instructions (73 us) a lookup on the M3, on average over macOS 27's
framework libraries, all of them cache hits (m3-max-2221). Libraries of many
functions (MPSImage's 1,837) pay O(n) per lookup, and finding a function's
table entry walked the table by name too.

The shared function table now indexes both when it is read, once per content
key: each function's entry by name, and its bitcode as rgfxMetallibBitcode
finds it (RgfxMetallibBitcodeIndex: the first function of a name answers, and
none past a group that does not read, as the walk). Bytes of another length
or header than those the index walked are walked as before.

Lookups find what they found before: the AIR test checks that the index
answers what rgfxMetallibBitcode answers for every name of its libraries, of
the committed metallibs and of 2,000 libraries with spoilt function lists.
Only when the list is walked changes, never what a lookup finds.
2026-11-05 21:59:36 -08:00
Anees Iqbal e4d8932355 🐛 Count a module's decoded code against the AIR cache's budget
Since 81618ace7 a cached module also holds its decoded code
(RgfxAirEntries::code) where it declares function constants. The cache
counted only the module's bytes against its 16 MiB, so its memory was no
longer bounded as the header said: decoded code grows with the function
bodies, not the metadata. Each kept module now costs its bytes plus what
its code's containers hold (rgfxAirModuleCost), and the budget bounds that
sum. Only which modules the cache keeps changes, never a read's answers.

The AIR test's whole-value comparison of one read with each reader did not
cover the fields 81618ace7 and 19ef218a6 added: a node's globals and render
target, an entry's function, and the code. It now compares them, the code by
what rgfxAirSpecialise answers for each entry point. The cache test budgets
by cost, and checks that every_access, which declares a constant, costs more
than its bytes.
2026-11-05 21:59:36 -08:00
Anees Iqbal c073fcd2a7 🐎 Answer buffers that use a device cache at the doorbell
The doorbell's answer on the vCPU left every command buffer that used a cached
surface block to its queue's thread, so on a GPU with memory of its own video's
buffers and WindowServer's composites got their CB_SUBMITTED only at their
take. A buffer that uses caches is now answered there where it waits for no
copy of them at its begin: none needs a fill for it, their last fills are done,
and no copy asked of them is one it follows. Every lock it looks at is tried.

What the guest sees: such a buffer gets its CB_SUBMITTED on the doorbell's
thread, before its queue's thread takes it, as one that uses no cache does. A
copy asked between the answer and the begin (a fill a host device's write over
the pages asks, a present's fill, a download, a release) is still followed at
the begin where the buffer must follow it, the buffer waiting for it on the GPU
with its answer given.
2026-11-05 21:59:36 -08:00
Anees Iqbal 1261fd0125 🐎 Order device caches' copies on the GPU, not at begins
On a GPU with memory of its own, a command buffer whose use of a surface
needed its device cache filled waited at its begin, on its queue's thread,
for every buffer begun before it that used the cache, and any begin behind a
download or a release waited for the writers that copy followed. WindowServer's
buffers once waited 13.5 s this way behind a WebGPU page's long buffer
(measured on the RTX 5080 Laptop GPU host).

Every use of a cache is now numbered as it is counted, a buffer's uses
together. A copy that a buffer begun and not finished holds up is asked, not
waited for: it is made in the finish of the last buffer it follows, after its
commit, in the order the copies were asked. The buffers counted after it wait
for it on the GPU, on the cache's own shared event, which the copy's command
buffer signals: one that reads what a fill writes, or may write what any copy
reads. A buffer finished while a copy it waits for is not yet made stays
counted until it is, so no copy waits for it ahead of that copy on the
transfer queue, and it takes no early copy on the read-back queue. Where the
platform makes no shared event, the begin waits on the CPU as before, counted
in the cache log line with the fills made behind buffers.

What the guest sees changes in timing only, the order of copies against the
buffers' uses kept:
- a buffer begun behind such a copy, which it reads or may write over, gets
  its CB_SUBMITTED at its scheduling, as a buffer waiting for a fill does,
  where it got it at its take after the wait on the host's CPU; a buffer that
  only reads behind a download or a release waits for nothing;
- a present's fill behind a walk no longer waits on the control thread;
- a writer of a read-back surface finished before the copy it waits for is
  made takes no early copy: the download after it copies its write out.

Measured with FakePlatform on the M3: a begin needing a fill behind another
queue's walk held 1 s blocked for 1652 ms with one wait on the CPU; now it is
begun at once with none
(a_begin_waits_on_the_cpu_for_no_other_queue_s_long_walk).
2026-11-05 21:59:36 -08:00
Anees Iqbal 80d9f171bc ✅ Time the busy buffer in the behind submit probe
submitted.tiny.behind's rounds took twice as long on car 13's tip as on car
12's (n 8059-8955 against 14742-20172 per 5 s), while its ret, the tiny
buffer's commitAndWaitUntilSubmitted, is at most about 70 us of a round.
The case now also prints the busy buffer's commit to its GPUStartTime, its
GPUStartTime to its GPUEndTime and the whole round. Those split the extra
time between the host's submission, the GPU's fills and the completions.
2026-11-05 21:59:36 -08:00
Anees Iqbal d0f61d5b5c 🐎 Mark a queue's ring idle through a walk on its thread
Since car 12 (757de8422) a queue's service thread walks and commits a
short buffer that waits for nothing itself. b5182273d then let the queue's
claim go before that walk, so a doorbell rung during the walk could answer
the next buffer. But the guest rings a queue's doorbell only while the host
marks the ring idle (consumer_idle 1), and the service thread kept it
marked busy through the walk and the commit. A buffer published during
them got no doorbell, and its CB_SUBMITTED waited for the take after the
commit. On the RTX 5080 host that is submit_probe's submitted.tiny.behind:
p50 26-32 us and p90 48-175 us against the control's 18 and 27-35, with a
second hump at 128-256 us (car 13 rerun, c13t-sublk).

When the host lets the claim go, the ring is now marked idle, with a full
fence before the look at the ring, as before the thread sleeps. The mark is
cleared when the thread takes the claim back. A buffer published during the
walk is rung for and answered inside its doorbell write, on the vCPU's
thread, where it waits for nothing, as behind a walk on a lane thread.

What the guest sees: such a buffer's CB_SUBMITTED comes inside the
doorbell write, before the walk ahead of it ends, not after that buffer's
commit. The guest also rings once for each buffer it publishes during such
a walk, as it does for a sleeping thread.

The walk test now rings only where the ring is marked idle, as the guest's
writer does, and fails without the mark. The behind measurement rings that
way too.
2026-11-05 21:59:36 -08:00
Anees Iqbal 9387234982 ✅ Measure a handed-over record's cost
A decoder buffer whose submission handler runs inside a commit on a thread
the raise is not named for hands its records to its queue's service thread.
The measurement times the commit call and the commit to CB_SCHEDULED for
that and for a commit on a device thread, which posts inline, with the
queue's thread asleep before each round, as between frames.
2026-11-05 21:59:36 -08:00
Anees Iqbal 04357d78b4 ✅ Pin where a foreign commit's records are posted
Three tests on the fake, whose commit now marks itself as the Vulkan
platform's does and can take the held submissions inside the next commit
(World::release_submissions_at_next_commit), as the runtime takes ready
batches inside commit_and_submit:
- a commit on the window's render thread, holding a lock, takes a decoder
  buffer: its records come from the queue's service thread, which raises
  there, never inside the commit, and can take the lock once the commit
  lets go;
- the host's read of the display takes one whose ring is full: it returns
  at once, calls nothing back, and the records follow once the guest makes
  room;
- a commit on the queue's own thread takes one: its records post there, and
  nothing is handed over.
2026-11-05 21:59:36 -08:00
Anees Iqbal d4d451f636 🐛 Post a buffer's records off a commit on a foreign thread
Since the pin that made the Vulkan platform commit with commit_and_submit,
the runtime runs, inside a commit, the submission handlers of every ready
batch, any command buffer's of the process. A graphics decoder buffer's
handler then posted its CB_SUBMITTED and CB_SCHEDULED onto its queue's
completion ring, and raised the queue's vector, on whichever thread
committed: the window's render thread, a PG device's thread, a frame
commit, or the host's thread inside rvg_graphics_device_read_display. The
header names none of those for RvgGraphicsRaiseFn, and read_display "calls
back: never". A full ring also made that thread wait for the guest.

A platform commit that may run handlers inside the call is now marked on its
thread (core's platform::command::committing, used by the Vulkan platform's
commit). A decoder buffer's handler that runs inside a marked commit on a
thread the header does not name hands its records to the queue's service
thread, which posts them and raises; every later post onto that ring goes
behind them, so the ring's order is kept. It waits for nothing. On the
device's own threads the handler posts inline as before, with no added wake.
The queues count the records handed over and, at most once a second, log
at info (reims_graphics::handed) the running total and the longest any
record waited for a thread to post it since the last line. Metal's handlers run on Metal's threads, so
nothing changes there.

The Vulkan test of a commit's checks now also checks the mark.
2026-11-05 21:59:36 -08:00
Anees Iqbal a84222fffb ✅ Pin that a Vulkan commit checks and submits inline
The Vulkan platform commits through the runtime's commit_and_submit
(1672c60d5). At the pinned runtime, where no other submission pass is under
way, the committing thread submits the device's ready batches itself. It runs
their submission checks and submission handlers inside the commit, whichever
command buffer they belong to. So a check or handler that took a lock its
commit's caller holds would deadlock.

None does. The check takes its command buffer's note and the detach
registry's lock. The tiler's handler takes the process's space. The
decoder's handlers take their records' locks and the completion ring's. No
commit's caller holds any of them across a commit. The callers that do hold
a lock across one hold the device caches' lock, across early copies and
fills, and the display read's texture.

The test commits holding a lock and has the submission handler find it held
on the committing thread, inside the call, with the runtime's count of
batches checked at commit up by one. The docs that put the check on the
scheduler's thread now say where it runs.
2026-11-05 21:59:36 -08:00
Anees Iqbal 2a2415f400 🐎 Post an asking buffer's CB_SCHEDULED with its CB_SUBMITTED
A command buffer that asks for its CB_SUBMITTED and waits for nothing got
that record at its take, or on its doorbell's thread, but its CB_SCHEDULED
only once the platform had taken its work: from the submission handler, on
the runtime's thread. On the RTX 5080 host that put a tiny buffer's
scheduled handler 0.34-0.39 ms after commitAndWaitUntilSubmitted on an idle
queue (car 12 and car 13, submit_probe's submitted.tiny.idle), against
0.20 ms on an AMD 5300M Mac and 0.05 ms on Apple's paravirtualized device.

Such a buffer now gets its CB_SCHEDULED right after its CB_SUBMITTED, at
the take or on the doorbell's thread, as long as no buffer begun before it
on its queue still owes its own record. Each queue counts the begun buffers
that owe one (Line's owed), so its records stay in commit order. A buffer
with nothing left to post runs no submission handler. Its ticket in its
process's commit order is issued at the take, as the CB_SUBMITTED there
already needed.

A buffer that does not ask keeps its CB_SCHEDULED to its scheduling.
Posting it at the take would need its ticket there too. A walk held on one
of a process's queues would then hold up the commits of its other queues
(a_walk_held_in_a_draw_holds_up_no_other_queue).

What the guest sees: an asking buffer that waits for nothing turns
Scheduled, and its scheduled handlers and waitUntilScheduled run, with its
commitAndWaitUntilSubmitted, before the platform has its work. Metal makes
it Scheduled within a fraction of a millisecond of its commit. Nothing the
guest orders depends on the difference (design.md, "Loose"). Such a buffer
whose walk then faults is now scheduled before its failure.
2026-11-05 21:59:36 -08:00
Anees Iqbal 2c71d28217 ✅ Measure a lone buffer's doorbell to its CB_SCHEDULED
A lone buffer's scheduled handler ran about 390 us after its commit in the
guest on the RTX 5080 host (car 12's submit_probe), against 198 on an AMD Mac
and 52 on Apple's paravirtualized device. On the host the CB_SCHEDULED waits
for the platform's submission, after the walk, the commit and the runtime's
record and submit. The bench, ignored and run by hand in a release build,
times the device's share from the doorbell write to the record on the ring,
for a buffer that asks for its CB_SUBMITTED and one that does not, with the
walk made to take 150 us by a spin, standing for the runtime's work.
2026-11-05 21:59:36 -08:00
Anees Iqbal 4ed0e6923a 🐎 Schedule a buffer with no scheduled handler where it is seen
A buffer with a completed handler paid two hops to its queue's completion
queue, one for its CB_SCHEDULED and one for its CB_COMPLETE, though its
scheduling runs nothing of the app's when it has no scheduled handler. Such a
buffer's scheduling now runs on the completion thread as it takes the record,
where none of the queue's records still waits on the completion queue, as the
records of a buffer with no handler at all already do.

What the guest sees: for a buffer with no scheduled handler, the status turns
Scheduled and waitUntilScheduled returns from the completion thread, one
thread wake sooner. Behind a record of its queue still to run, it waits its
turn as before, so the status still flips in the ring's order among the
handlers. The completed handler still runs on the completion queue.
2026-11-05 21:59:36 -08:00
Anees Iqbal 09eb85c73c ✅ Time the guest's buffer scheduling and completion
The car 12 probe put a lone buffer's commit-to-scheduled-handler at about
390 us p50 on the RTX 5080 host, against 198 on an AMD Mac. Part of that is the
guest's own hops: the completion thread's wake, then the queue's completion
queue for each record. shell_tests --queue-timing [rounds] times them on the
bundle's real queue, reader and completion thread, with the kext's wait stood
in for: how long after the host's post of a CB_SCHEDULED, then a CB_COMPLETE,
the handlers run and waitUntilScheduled and waitUntilCompleted return, for a
buffer with both handlers, one with a completed handler alone and one with
none. It is a measurement, run by hand, never in make test.
2026-11-05 21:59:36 -08:00
Anees Iqbal e852bb405f 🐎 Bind decoder objects without passing whole results
94b7cb0b6, which refuses a binding of an object Metal would refuse and drops
the draws that use it, added about 177 instructions a draw to our decoder on a
compositor's stream (draw_cost's ws shape, Metal arm, M3 Max release, decoder
above the platform: 765.7 at its parent, 942.4 at it). Each binding looked up
the marks, each op's answer was passed whole to contain, and Marks::bound,
which the op decoders call out of line, passed each binding's whole result (a
Raise's size) through memory.

Now the marks keep whether they hold any, so a binding with none marked reads
one flag; marking, unmarking and handling a refused raise are cold and out of
line; each walk matches an op's answer where the op wrote it and passes only a
raise to contain; single bindings match their resolve in place through bind!;
and render_ops reads whether a pass drops draws after each op it carries out,
not at each draw it gathers.

Measured the same way, 944.2 instructions a draw at b4aff9c7f, 837.7 with this
(764.4 at car 11's 6f8118d14). The rest of the growth, about 73, is left for a
follow-up.

Nothing the guest or host observes changes: the same bindings mark, end a mark
and refuse, and the same draws drop. The decoder's and the refused objects'
tests pass unchanged.
2026-11-05 21:59:36 -08:00
Anees Iqbal 18872e171b 📝 Trace QEMU system-wide, never with per-task perf events [ci skip]
Car 13's WindowServer frames run (c13t-wsframes, RTX 5080 host) traced QEMU
with `perf record -p` and 47 tracepoint-class events, which every new thread
inherited. The host's lane threads come and go in bursts, and each exit then
freed its events in perf_event_exit_task: 0.12 to 12 s an exit, 22 to 23 of
24 CPUs at once, the vCPUs starved and the guest frozen for 1.3 to 10 s, read
in the guest as frames of up to 9.5 s. Every frame over 200 ms in that run
came from the recorder. Say so where the docs say how WindowServer is
measured, with what a host trace does instead.
2026-11-05 21:59:36 -08:00
Anees Iqbal fadd0bbb10 ✅ List only the imageblock entry points as unread in the AIR test
c14-air-cache's test of every committed metallib (1cb31349f) lists the entry
points whose nodes do not read, among them rounding.metallib's and
rounding_safe.metallib's three framebuffer-fetch fragments, whose `[[color(0)]]`
input (`air.render_target`) the node reader did not follow. c14-reflection
(19ef218a6) taught the reader that input, so on car 14 those six read, and the
test failed at the first (m3-max-2483: "rounding.metallib: fetch_half_fragment:
its nodes do not read"). The three explicit-imageblock kernels still do not
read, as c14-reflection's message says.

Car 14's stack: a test fix where c14-air-cache meets c14-reflection.
2026-11-05 21:59:36 -08:00
Anees Iqbal bf214206db ✅ Check specialised reflections against Metal's answers
The shell tests now make k_specialised and v_specialised under two sets
of constant values and expect what the 5300M and the 630 answer: an
index kIndex + 1 computes, an argument under kOn || kOff kept or left
out, and which arguments a switch, a select and an optional constant
leave used. air_arguments_test checks rgfxAirSpecialise directly (the
arguments used, the globals the initialisers leave, no values given),
and specialises 4000 spoilt copies of k_specialised's module without a
crash or a hang.
2026-11-05 21:59:36 -08:00
Anees Iqbal 0932f1cd0c 🐛 Reflect nested argument buffers, tables and colour reads
A pipeline's reflection answered nil where a function had an argument
buffer of a struct of members, a C array of members, an array of
samplers or a pointer to an argument buffer of its own, a function table
or an acceleration structure, a texture of 64-bit atomics, or a fragment
function that reads its colour attachments: the AIR reader refused the
fragment node, and the reflection had no answer measured for the others.

Each now answers what Metal answers on the x86 Macs (measured on the
5300M and the 630 with tools/pipeline_reflection_check, every getter and
instance variable alike):
- a struct of members is a struct of its own argument buffer members,
  at ids from its first, a C array of them an argument buffer array of
  the ids an element takes as its index stride;
- a C array of a member is an argument buffer array whose details are
  the element's binding, of a constant's size's stride;
- a metal::array of samplers is an array of index stride 1, as textures';
- a pointer to an argument buffer is a pointer member of its binding;
- function tables and acceleration structures are bindings of their
  own types, read only, as kernel and fragment arguments and as an
  argument buffer's members;
- a texture of ulong is of MTLDataTypeULong (the 630's answer; the 5300M
  makes no pipeline of one, nor of a fragment table);
- a fragment function's colour attachment reads are listed nowhere.

For the guest: those pipelines now answer a reflection where they
answered nil. An imageblock still answers nil: neither x86 Mac makes a
pipeline of one.
2026-11-05 21:59:36 -08:00
Anees Iqbal 3f9781016d ✅ Measure argument buffers' further members
pipeline_reflection_check now also makes c_nested_more, an argument buffer
of C arrays of samplers and of pointers to argument buffers, a struct of
members that holds one and a C array, and a C array of those structs, and
c_ab_tables, function tables and acceleration structures as an argument
buffer's members, so that Metal's answers for them are measured on the
x86 Macs alongside the kinds c_nested and c_tables measure.
2026-11-05 21:59:36 -08:00