Commit Graph
987 Commits
Author SHA1 Message Date
Anees Iqbal 706353df2c 🆕 Size the guest's Shared pool's range from the GPU's Shared heap
The pool's range was a fixed 64 GiB of guest physical addresses, whatever the
host GPU: more than a GPU whose Shared heap is 24 GiB can ever fill, and less
than one whose heap is larger. The range now follows the heap the pool's
blocks come from: metal2vulkan-rt's Shared memory type, the first type with
HOST_VISIBLE, HOST_COHERENT and HOST_CACHED that a buffer of the device's
usage can use, on the GPU device the library opens. The bound is the heap's
size, not VK_EXT_memory_budget's budget: the range is address space held for
the VM's life, while a budget is momentary, moved by other processes, and on
Intel's Windows driver answered past its heap's size; RAM is bounded at each
block's take.

The config's pool range is now the room the host can give. The create opens
the GPU device, takes the heap rounded up to 2 MiB of that room (warning once
where the room is smaller, and giving no pool where no type is host-cached),
and rvg_graphics_device_pool_range answers what it took. The range is read
after the create rather than asked of the library before it, which would open
the GPU device twice or keep one alive without a device. QEMU offers the room
from pci-hole64-end to three quarters of the guest's physical addresses, then
reserves the range the library took, rounded up to 1 GiB, in
etc/reserved-memory-end, still at realize before the firmware runs. The
x-pool-size property goes; 0 and 0 still mean no pool in the C API.

What the guest sees changes: the firmware's reserved-memory-end, and so where
OVMF may put its 64-bit PCI window, follows the host GPU's Shared heap instead
of a fixed 64 GiB.
2026-11-18 16:52:12 -08:00
Anees Iqbal 09205507d3 📝 Say where reims-ctl starts arm64 VMs, and under what [ci skip]
README.md, docs/qemu.md's "arm64 guests" and reims-restore's design say that
reims-ctl restores an arm64 VM from an IPSW and starts it on vmapple with
Ambrosia: under HVF on an arm64 Mac, KVM on arm64 Linux and TCG on x86-64
Linux, and that install-ctl.sh builds the qemu-system-aarch64 it runs there.
2026-11-18 15:58:03 -08:00
Anees Iqbal 776156792b 📝 Record what HVF's map and unmap of a block cost a running VM [ci skip]
metal2vulkan's runtime cutover maps the host-visible blocks it gives the
device into the guest one block at a time, as WHPX does today. The M3's
measurement of that form under HVF (11-18, Hypervisor.framework alone) found
the map cheap at any size, the unmap about 70 ns a touched page, no vCPU
stall and no refault of other mappings, and a first touch of about 1.2 us a
16 KiB page. docs/qemu.md holds the VM measurements.
2026-11-18 15:37:12 -08:00
Anees Iqbal 7efe324717 🆕 Count the buffers made over read-only guest pages, and their KiB
At the runtime's cutover every host makes a no-copy buffer over pages the
guest maps read-only over a copy of them, the Mac included, where today it
imports them in place. To know what that copy costs a guest, the decoder now
counts each such buffer it makes, once a boot, in the degradation counts'
line: `read-only-pages-buffers` (how many were made) and `read-only-pages-kib`
(their bytes' sum in KiB, rounded up).

A BUFFER_OVER_PAGES over a block the kext marks RGFX_SURFACE_PAGES_READ_ONLY
is the only such object: the bundle sends read-only Shared memory there with
bit 24, and a heap, an indirect command buffer's slots or a Managed object's
CPU copy over the block is refused. The count is taken there, in the decoder
every host shares, so it means the same on Linux, Windows and macOS.

The counts' line is where they go: docs/conventions.md lists every kind
counted since the process began there, not degradations alone (the rings'
`vblank-dropped` and `*-post-waited` among them), and says no count goes
elsewhere. On macOS the buffers are no degradation; on Linux and Windows the
runtime also counts their copies, with failed imports, under its own code.

answer.rs gains count_kind_by, which adds an amount to a kind's count.
Diagnostics only: no ring message, value or answer the guest sees changes.
2026-11-18 15:19:15 -08:00
Anees Iqbal aa28476e9d 📝 Name Windows beside Linux and macOS in the window and OS docs [ci skip]
The swapchain, the window's presenter, the display's sink and the window
system's extensions present on Windows too, through SDL's Win32 surface
(os/windows.rs's WINDOW_SURFACE_EXTENSIONS), but their docs said "either OS"
or named Linux and macOS alone. rust-toolchain.toml still named the Metal
platform, deleted on 11-07. caps.rs's table gave a host's naming of its
device by Metal's registry ID (open_device, a handshake) as the reason for
the stand-in; no host names its device so now, and the reason that holds is
that Metal's core count and driver sizes for that GPU are found by that ID.
Comments and docs only.
2026-11-18 14:56:42 -08:00
Anees Iqbal 5d38c7e825 📝 Say the library's hosts are Linux, Windows and macOS [ci skip]
The owner's word (Telegram 1924, relayed by metal2vulkan): the hosts are
Linux, Windows and macOS, and on macOS the library runs on Vulkan, not Metal.
README and the crates' and docs' notes said VMs run on Linux and that the Mac
build was for development and tests. They now say x86-64 guests run on Linux
and Windows hosts and arm64 guests on Apple silicon Macs, and that the Vulkan
platform runs natively on Linux and Windows and over MoltenVK on macOS.
rust-toolchain.toml names Windows' target as shipping too, and a reims-ctl
test's note says the test, not the installer, is Linux-only. AGENTS.md waits
for the owner's own word.
2026-11-18 14:28:11 -08:00
Anees Iqbal cb7f52c9a6 🆕 Name the recorder's build in each recording's stats file
metal2vulkan's stream table reads which recorder made a recording off its
files. The stats file now starts with recorder_commit, the commit the library
was built from, and a recorder_fix line for each change to what a stream holds
since format version 2, in landing order (recorder::FIXES, which each such
change extends in its own commit). cargo xtask dist stamps the commit for its
Cargo steps in RVG_BUILD_COMMIT (git rev-parse HEAD, -dirty where a tracked
file differs); other builds write unknown. Cargo and kache key the Vulkan
crate on the variable, so a dist at another commit compiles it again. The
stream itself and the device's behaviour are unchanged.
2026-11-18 13:56:40 -08:00
Anees Iqbal 6245436399 🆕 Put the platform's GPU times on the device's clock in one place
metal2vulkan's new runtime counts its GPU times on CLOCK_MONOTONIC on Linux
(its ruling of 2026-11-18: lavapipe calibrates no CLOCK_MONOTONIC_RAW domain),
while the device's clock, which the guest's kext maps the device's times by, is
CLOCK_MONOTONIC_RAW. At the cutover every GPU time the platform answers has to
be moved onto the device's clock before the guest sees it.

reims-vgpu-graphics's clock::runtime does that by a paired read (the
platform's clock, the device's, the platform's again; the least bracket of
three), fresh at each conversion, and names the platform's clock in one
constant, PLATFORM. Its one call is the CB_COMPLETE record's GPU start and end
in the decoder: the only platform GPU time that reaches the guest. One pair
moves both, so the run's length, which is what the guest reads, stays exact.

The runtime the library runs today counts the device's clock on Linux and
Windows, so PLATFORM is Domain::Device and the times pass unchanged: no value
the guest sees changes. The cutover sets it to Domain::Monotonic on Linux;
should the new runtime count CLOCK_MONOTONIC_RAW there, the module goes.
2026-11-18 01:00:46 -08:00
Anees Iqbal 285f0bdd69 🆕 Carry a no-copy Managed buffer's create-time bytes on two copies
On a device that keeps two copies of a Managed buffer (hasUnifiedMemory NO),
a no-copy Managed buffer's GPU copy takes the pages' bytes at its create, but
from zeroFrom on, and only didModifyRange: changes it afterwards. The stream
carried a no-copy buffer's bytes only as the writes before its first use, so a
player could not rebuild what the GPU copy held when the guest's CPU writes
since the create were never flushed to it.

Such a buffer's create record now carries the bytes the create copied, read
while the call holds them, a blob where long, as a copied buffer's contents
are: newBufferWithDescriptor:'s contents (the bytes before zeroFrom, nil where
that is 0) and newBufferWithBytesNoCopy:length:options:deallocator:'s first
argument (all of them). Shared and Private no-copy buffers, and any on a device
that keeps one copy, are recorded as before, and the writes before first use
are unchanged.
2026-11-18 00:45:55 -08:00
Anees Iqbal 0ba37884af 🆕 Record each device's identity at each segment's start
A player makes a stream's resources in the forms the recording device made
them, and the device's answers decide some of those forms: a Managed buffer is
one copy where the GPU shares the CPU's memory and two where it does not. The
stream named neither, so a player on another GPU could only guess them.

The recorder now writes an m2v.deviceIdentity call record on each device,
answering its name (the one the guest's device info gives) and
hasUnifiedMemory, right after the record that made the device, and again as the
first records of each later segment, one per device then live, so a segment
read on its own names them too. The format stays version 2: a reader that does
not use the record skips it, and its keys are answers.
2026-11-18 00:45:55 -08:00
Anees Iqbal 5544fb6672 📝 Record when the 5300M takes a Managed texture's bytes [ci skip]
oracle_storage mtexcap on the AMD Radeon Pro 5300M: a replaceRegion: made after
the commit is seen, whole or partial, until the command buffer is submitted (a
wait on an unsignalled shared event holds it unscheduled until the signal), and
not once the GPU has started it: the bytes are taken at the submission, as a
Managed buffer's. The Intel UHD Graphics 630, one copy, sees every replace.
2026-11-18 00:43:58 -08:00
Anees Iqbal 35b6935c8b 📝 Record when the 5300M takes a Managed buffer's bytes [ci skip]
metal2vulkan's planner is ruling on when the new runtime takes a Managed
buffer's CPU bytes on a discrete GPU. capture's new steps, run at 4 KiB
and 64 MiB on the 5300M and the Intel 630, answer it: the 5300M takes the
bytes at the submission, after the commit returns (a write at once after
the commit is seen whole, one 20 ms after scheduling is not), and a second
didModifyRange: does not reach a command buffer already running. The
Intel 630, one copy, sees every write.

Q2 gets the three steps' rows, the 64 MiB answers of all eight, the job
ids, the 64 MiB run's memory, and the window's timings. The sentence that
said no step writes between the commit and the submission now says step 5
does, and that the 5300M's spin once saw the CPU's flag write.
2026-11-17 23:43:54 -08:00
Anees Iqbal 9fbd2c1390 📝 Record the 2 GiB maxBufferLength and the trap it closes [ci skip]
The oracle table's row for our device now reads 2147483648 (c795bf3d5), and
its relaxation names the cap and why. A lessons entry records the trap: a
size the device answered (12821200896 on the RTX 5080) passed what the
platform's shaders address, and only an access past 4 GiB in a buffer shows
it.
2026-11-17 16:10:29 -08:00
Anees Iqbal 5cfbd942cb 📝 Record that a KVM call in the device file breaks non-KVM QEMUs [ci skip]
reims-graphics-pci.c is built once into every QEMU target, so the pool's
KVM quirk call broke qemu-system-aarch64's link on x86-64 Linux hosts,
and only an aarch64 build saw it. Say how to spot the next one.
2026-11-17 12:36:09 -08:00
Anees Iqbal b27a603cb4 🆕 Record the commands a CPU encodes into indirect command buffers
With REIMS_VGPU_RECORD set, the commands the guest's CPU encodes into an
indirect command buffer never reached the stream: an ICB_WRITE's went through
IndirectRenderCommand::encode and IndirectComputeCommand::encode, which had no
hook, and an ICB_SLOTS slot's call was recorded with its commands as nil (its
iterator prints nothing). The buffer's records live in the runtime, which no
memory write carries, so a replay executed commands it never saw.

Each send of commands to a buffer is now a call record on it,
indirectRenderCommandAtIndex: or indirectComputeCommandAtIndex:, with the
arguments [index, commands] that metal2vulkan's format names (section 8): the
commands in the order the platform carried them out, each a map of one pair,
the command's Metal selector and the list of its arguments read from its fields
(objects as stream ids, sizes and regions as maps). A command sent on its own
is a list of one; a slot's call lists the commands it took, read as it took
them, out of line over one iterator type. No m2v. selector is added.

With the variable unset nothing changes: one relaxed load and a branch, and the
platform's sends keep their shape.
2026-11-17 09:57:46 -08:00
Anees Iqbal 00d59542bc 🆕 Record Private buffers around dispatches of linked kernels
metal2vulkan replays the benchmark's lockstep kernels to check its forms against
Metal, and 28 of them link functions and bind Private buffers, whose bytes no CPU
can read, so no recording held them and those replays could not be checked.

With REIMS_VGPU_RECORD set, each recorded dispatch of a compute pipeline made
with linked functions (outside a block of command predication) now splits its
compute encoder around a blit before and after it, which copies each bound
Private buffer range (from its offset to the buffer's end, 256 MiB a dispatch at
most) into a Shared buffer of the recorder's own. At the command buffer's
completion the recorder writes both byte runs into the blobs directory and an
m2v.privateBytes record per range: receiver the buffer, arguments [the
dispatch's position among the stream's call records, {location, length}, the
before blob, the after blob]. A fresh compute encoder takes the guest's bindings
and residency again, as predication's refresh gives them; a recording process
keeps those bindings in a command buffer that holds no predication. Only these
dispatches: one per dispatch binding a Private buffer would split and copy far
more than the stream costs. stats.txt counts private_ranges, private_bytes and
private_skipped.

With the variable unset nothing changes: the hooks read the recorded call,
which is None there.
2026-11-17 09:24:15 -08:00
Anees Iqbal 4b866b6914 🐛 Fail the command buffer a predicated loop overran in
A loop of command predication that ran past the iterations laid down for
it set a flag in its command buffer's state buffer, and a completed handler
of the platform's own read the flag and ended the process. That handler ran
on the runtime's thread outside every refusal scope, so a guest whose loop
ran on, or anything that wrote the flag, ended QEMU. The state buffer is host
data the GPU writes, and after the runtime's cutover every byte on the device
is guest-writable.

The flags are now read where the runtime's own failures are read, once the
command buffer completed with none: by each completed and completion-seen
handler's read, and by status, error and waitUntilCompleted. An overrun is a
failure that is none of Metal's, dying where it is read, as the others do.
What the guest sees: inside the graphics lane's refusal scope, which every
guest command buffer's handlers carry, the read is refused and the command
buffer completes with status Error and an internal error (RGFX_CB_INTERNAL),
after its event signals and in its queue's order, and QEMU goes on. Each
such command buffer is counted once as the degradation
predication-loop-overrun. Outside every scope (the library's own tests) it
still ends the process, now at the first read of the completion.

The death test now dies at the wait, and two tests pin the refused
completion and a loop that ends within its copies.
2026-11-17 09:08:30 -08:00
Anees Iqbal 1b532d111f 🆕 Read every CPU's PAT through the accelerator's user client
The kext sets the guest PAT's entry 2 to write-back on every CPU, and
nothing the guest could run showed whether every CPU holds it. CpuPats,
selector 15 on the 'RGFX' client (the next number every WebKit sandbox
allows), reads each online CPU's PAT on that CPU in an mp_rendezvous_no_intrs
action, into a record sized to the kernel's CPU count (real_ncpus), by CPU
number: a CPU whose number lies past it is counted, never written past the
record or shifted past a mask's width. It answers an administrator's process
alone, as the read stops every CPU for a moment; arm64, with no PAT, answers
kIOReturnUnsupported. The x86-64 kext sets kext feature bit 13, CpuPats.

guest/bundle/tools/pat_probe.c checks every online CPU holds entry 2
write-back and entry 6 write-combining, and times stores and loads over a
write-back block of the region beside process memory, on any kext.
pat_test holds the record's rules; user_client_words_test the number and
the bit; design.md's registry gives both out.
2026-11-17 08:56:29 -08:00
Anees Iqbal ba4f1a31ee 🐎 Set the guest PAT's entry 2 to write-back on every CPU
xnu's x86-64 pmap maps every page it does not manage through PAT entry 2
for any ask but write-combined, and xnu's PAT holds UC- there. So the
device's region, which QEMU backs with host RAM, was uncached wherever the
kext asked for write-back: its rings, the cursor, the device info and every
block the bundle maps write-back. AMD's nested paging and WHP apply the
guest's memory type: through entry 2 the region ran at 78-202 MB/s on AMD
KVM and on WHP, against 43-46 GB/s and 16.5/8.8 GB/s write-back. KVM on an
Intel host ignores it for RAM-backed pages and ran at write-back speed
either way.

ReimsGraphics' start now sets entry 2 to write-back on every online CPU,
before the region's first mapping, in an mp_rendezvous_no_intrs action
with the SDM's sequence for a PAT change, and leaves entry 6 write-combining
as xnu sets it. A priority sleep/wake interest runs it again at each wake,
for a wake from S3, which resets every CPU's PAT; reims-ctl keeps S3 off, and
through its dark wake and a CPU's offline and online the measured guests
kept the rewrite and xnu wrote no PAT, so no CPU-start hook is needed. What
the guest observes: the region's write-back mappings are write-back on AMD
and Windows hosts. Every other user of entry 2 is device registers the host
traps, or RAM a driver asks uncached, which QEMU reads write-back.

The calls are com.apple.kpi.unsupported's (mp_rendezvous_no_intrs) and
IOKit's, which the kext links already. The comments and design.md that
called the region uncached now say under which PAT it is.
2026-11-17 08:56:29 -08:00
Anees Iqbal 3f44b9cbdd 📝 Record the guest's Shared pool's range and its measured adds [ci skip]
docs/qemu.md says where the device reserves the pool's range and why it
adds no e820 entry, how a piece is added and removed under KVM and WHPX,
and what the pool's measurement arm measured on um790's 780M and the Mac
mini 2018, with a UEFI probe of a guest's accesses across a piece's map,
add, unmap and removal under WHPX.
2026-11-17 06:35:09 -08:00
Anees Iqbal 6f3d1ca802 📝 Describe the guest's Shared pool in the architecture and QEMU's head
Architecture 7.3 names the pool's thread and 15.1 says how the pool places,
keeps and gives back its blocks, and the order of its release. QEMU's
device file lists the pool's range among what the device gives the guest,
and its teardown's taking the pieces out.
2026-11-17 06:35:09 -08:00
Anees Iqbal 426724ff52 🆕 Map the guest's Shared pool's blocks into a range the host reserves
metal2vulkan's new runtime allocates the GPU memory the guest's Shared
buffers live in, and the device maps those blocks into the guest (plan D2,
route 1). This is the host side of that pool: the guest's side, and the
wire it reads the range and its pieces from, come with the D2 guest work.

The library: a pool per device (crates/reims-vgpu/src/pool.rs) over the
range the host reserved. Its thread takes Shared blocks from a block source
and asks the host to map each at the lowest free 2 MiB-aligned address
(pool_add); the host says when the guest's address space has it
(rvg_graphics_device_pool_added). The source's unmap hook takes a piece out
of the lookups, waits for every hold on it, asks the host to unmap it
(pool_remove) and returns once the host says it is gone
(rvg_graphics_device_pool_removed); only then may the source free the block.
The pool keeps one empty piece as headroom, asks for a block more when the
guest uses the last empty one, and gives back a piece that stayed empty for
5 s above the lowest empty one. The source's calls and hook have
metal2vulkan-rt's shape (take_block, release_block, BlockMappings::unmap,
BlockInfo); until the device runs on that runtime the source is the
process's own memory (HostBlocks), so only the source changes then.

The C API: RvgGraphicsDeviceConfig and RvgGraphicsCallbacks go to their fifth
version (pool_physical_address and _length; pool_add and pool_remove), with
rvg_graphics_device_pool_added, _pool_removed and _pool_grow (the host's ask
for more pool now, which QEMU's x-pool-grow property drives).

QEMU (vendor/qemu): the device reserves 64 GiB past the RAM and the host
bridge's default 64-bit window, raises etc/reserved-memory-end past it so
OVMF's 64-bit window goes above it, turns KVM's zap-every-slot quirk off, maps
each piece as a RAM region of its own (a pure add) on its main loop, and under
WHPX runs the hypervisor's map outside the BQL. Its teardown takes every piece
out before the release, which frees the blocks before the process exits.

For the guest: the firmware's 64-bit PCI window starts past the reserved
range, 32 GiB or more higher than before; nothing else changes until the
guest's side maps the pool.
2026-11-17 06:35:09 -08:00
Anees Iqbal b8aa508721 📝 Note the system mapper wait of a kext before the platform expert [ci skip]
A probe kext that allocated an IOBufferMemoryDescriptor at its kmod start hung a
macOS 26.7.2 boot in IOMapper::checkForSystemMapper, which only the platform
expert's start releases. Record the trap and how to spot it, for any kext work
that moves a start earlier.
2026-11-17 06:28:21 -08:00
Anees Iqbal 14b69ece14 🆕 Record the platform's calls as a replay stream (format v2)
metal2vulkan's replay lane plays a guest's Metal work back on its own
runtime without a guest. It needs the calls our decoder makes on the
Vulkan platform, in order, with the guest memory the GPU reads, written in
its replay format v2.

The recorder is off until the host sets REIMS_VGPU_RECORD to a directory;
off, each hooked platform method costs one atomic load and a branch. On,
each process writes <dir>/<pid>.NNNN.m2vr segments (1 GiB each) from a
writer thread every 50 ms, libraries' bytes into the blobs directory beside
<dir>, and its counts into <dir>/<pid>.stats.txt.

- The hooks are in the Vulkan platform's trait impls (112 methods), and
  a thread-local depth records only the outermost call, the one core
  made. Arguments are written by their type: handles as object ids,
  bytes and strings as themselves, the rest from their Debug text.
- Before a commit, the recorder waits for the command buffers that ran
  before it and could still write what it reads, then writes the 4 KiB
  chunks of the memory it reaches that changed since the stream last held
  them. Only the ranges the GPU wrote are taken as the stream's once
  their command buffer completed, so CPU writes made meanwhile are kept.
- Blocks over guest memory and buffers in them are written as
  m2v.newBlockWithLength:storageMode: and m2v.newBufferInBlock:..., and
  each present the device's display shows, with a window or without one,
  as m2v.present of the surface's texture.
- format::summary reads a stream back; an ignored test prints it for a
  recording, on the host that made it.
- It never asks a buffer for its GPU address, which keeps a dma-buf
  import alive for good; addresses come from the calls that set them.

What the guest and the host observe is unchanged: the recorder only reads.
2026-11-17 05:56:10 -08:00
Anees Iqbal d1e692f573 📝 Freeze the old runtime and pin development commits [ci skip]
metal2vulkan is replacing its runtime with a new crate that has one path
for every device. reims-vgpu's rules now say what that means here until the
cutover: the current runtime takes regression fixes only, from one lane at
most, and nothing extends its device tables, device checks or queue-sharing
policies. reims-vgpu builds its side of the new contract: runtime-owned
memory mapped into the guest, device-image textures synced at the guest's
events, and host-assigned addresses with one VkDevice per guest process.
At the cutover that replaces guest memory in place, which conventions.md
now says.

The pin rule now states what the owner set on 2026-11-17: the pin is an
exact commit on metal2vulkan's development, on the remote before ours is
pushed, and a regression it brings is fixed forward rather than routed
around by holding or rolling back the pin.
2026-11-17 03:09:03 -08:00
Anees Iqbal cef35d7975 🐛 Hold Windows VA teardowns while another context lives
On the UHD Graphics 630 host, QEMU ended in an access violation inside
Intel's Direct3D 12 video driver as a guest's 4K H.264 session ended beside
its next: a decoder let go while another lived on the display broke the
other's next vaEndPicture. A test of two threads' decoders, each let go
round after round while the other decodes, ends the same way under vaon12,
and keeps ending so with every call made alone, with no teardown inside
another context's picture, and with the other contexts' pictures done
first. Kept until no context lived, every teardown passed.

So on Windows a context's, a config's or a pool's destroy asked for while
another context lives on the display is held, and made in the order asked
once the last live context's teardown is asked for; the log says so once a
process. What changes for the host: the process no longer ends there, and an
ended session's surfaces stay allocated while another session lives. Linux
is unchanged: the same test passes on radeonsi with every teardown made at
once.
2026-11-17 02:25:05 -08:00
Anees Iqbal dd9778ab21 🆕 Write a Windows fault's module, offset and callers on stderr
QEMU on the UHD Graphics 630 host ended with exit status 0xc0000005 as one
4K H.264 session followed another, and nothing said where: Windows Error
Reporting wrote no report and no event for it. The panic hook's install now
adds a vectored exception handler that writes, once per site, the faulting
module and offset, the callers the modules' unwind tables name, and the
thread's name, then leaves the exception to the process's other handlers, so
the process ends or goes on as before. Its first lines named D3D12Core.dll,
called from Intel's igd12dxva64.dll under vaEndPicture.

The lines are diagnostics, which the contract leaves free. The test faults a
child process on purpose and reads its lines.
2026-11-17 02:25:05 -08:00
Anees Iqbal 2996b35452 🆕 Decode an arm64 guest's HEIC tiles on the host's NVDEC
A HEIC tile session on an NVIDIA host answered kVTUnimplementedErr, as NVDEC's
guest decoder landed only whole pictures, and the guest's ImageIO decoded the
image in software. NVDEC's pictures now narrow their crop to a tile's region
(AnnexBPicture::crop_within), which then lands as a whole picture does: by
the GPU's copy into the surface's pages registered with CUDA, else the CPU's
copy. Both arms narrow through one rule, core::surfaces::crop_within: a region
from an even column and row of the crop, inside it, of a sample or more.
2026-11-17 02:10:28 -08:00
Anees Iqbal d3372a8d1d 🆕 Decode an arm64 guest's HEIC tiles on the host's VA-API
An arm64 guest's CMPhoto decodes a HEIC image's grid through a
VTTileDecompressionSession, whose paravirtual decoder sends the host dsts,
dtil and dtfi. The host answered each kVTUnimplementedErr, so ImageIO decoded
every HEIC in software (a 6016x6016 desktop picture took 218 s under TCG).

A decoder session now starts a tile session where the arm lands a part of a
picture: it sends TDrs (the output buffers' attributes and the tiles it
decodes: the arm's sizes, and the alignments Apple's hardware decoder asks,
measured on an M3 Max on macOS 27.0.1) and answers noErr. Each dtil decodes
its tile and lands the ,tcd columns and rows from ,tco at ,obp of the surface
it lends, emits it (TDem: ,til, status, info, ,uiu) and is answered noErr;
dtfi has no tile left to finish. On VA-API the frame's crop narrows to the
region (Frame::crop_within), which then lands as a whole picture does, by the
driver's video processing in place or the CPU's copy. NVDEC lands no parts
yet and keeps answering kVTUnimplementedErr, which leaves its guests on the
software decode.
2026-11-17 02:10:28 -08:00
Anees Iqbal 0966a6f4b9 🐎 Encode on NVENC's fastest preset up to the middle quality
A guest encodes one frame at a time: AppleGVA submits a frame and waits for
it before the next, on a real Mac as in our guest, so a frame's encode time
is its rate, and NVENC's preset is the one lever on it. The middle quality,
which an x86 guest's encodes always ask and VideoToolbox's default sits at,
took P4. It now takes P1, and qualities above the middle spread over P1 to
P7, so an app that asks for the best still gets P7.

What the guest sees changes: its encodes' bitstreams differ, and they come
faster. Measured on the RTX 3090 against a MacBook Pro's Radeon Pro 5300M,
same source, matched bitrates (fps, PSNR Y):
- 3840x2160 30 Mbit/s: P4 41-42 fps 44.95 dB, P1 46 fps 44.73 dB; the Mac
  72-76 fps 43.40 dB.
- 1920x1080 6 Mbit/s: P4 162 fps 43.61 dB, P1 168 fps 43.44 dB; the Mac
  177-275 fps 41.91 dB.
P1 still beats the Mac's quality by 1.3 to 1.5 dB. NVENC's own single-frame
time at P1 for 4K, about 15 ms on the 3090, is itself above the Mac's whole
chain of about 13 ms a frame, so the 3090 cannot meet the Mac's 72-76 fps at
4K one frame at a time; what is left of the gap is in our chain.
2026-11-17 01:07:41 -08:00
Anees Iqbal e06e9c5ef7 📝 Record NVDEC's failures beside the device's own copies [ci skip]
The decode-back's failures were NVDEC's answers to decodes starved by the
device's own copies of caches into the guest's RAM, a case like U21's: say so
in U21 with the measured runs (the causal switch, the no-VM replay beside CUDA
copies, the paced boot), and keep the trap in lessons.md: failures clustered
at a workload's end or in bursts are lined up against the device's own GPU
work before the stream or the driver is suspected.
2026-11-17 00:10:17 -08:00
Anees Iqbal cf7ae2fd41 🐛 Land an H.264 picture NVDEC failed as NVDEC left it
A guest's H.264 session on NVDEC got zeros for a picture NVDEC answered
failed (status 8 or 9), and every later picture refused until the next IDR:
AppleGVA's H.264 path reads no failure from the driver (D25), so each reached
the client as a decoded frame of zeros. A Mac's hardware H.264 decoder hands
such a picture on with no error, decoded as it could, and decodes on from it
until the next IDR (measured on the MacBook Pro of 2019, macOS 26.7.1, job
m3-max-38757: a P picture cut to half its slice, or with 64 bytes changed,
and those after it came back with status 0, 26.5 to 29.7 dB from the
undamaged stream, none all zeros).

What changes for the guest: on NVDEC, an H.264 picture whose decode NVDEC
answers failed now lands in its output as NVDEC left it, and the pictures
after it are decoded from it, where they were zeros. The host counts and logs
each such landing. HEVC's sessions still refuse such a picture, as their
guest path reports the failure to VideoToolbox. The pacing of the releases'
copies before this removed the cause of the failures seen in the decode-back.
2026-11-17 00:10:17 -08:00
Anees Iqbal 738140c093 🐛 Pace the releases' copies of device caches into their pages
A decoder's process lets its output surfaces' blocks go together, and the
kext lets go at once those past its caps that a client still holds (a
VideoToolbox decode-back holding every frame of a 2160p H.264 stream). Each
release then copied a written 12.4 MB cache into the guest's RAM, back to
back on the transfer queue: 61 copies kept an RTX 3090 79 to 100% busy for
400 ms, NVDEC decodes of the guest's session made meanwhile took 60 to 377
ms, and some answered failed (status 8), so the guest got zeros for frame
296 (Y 5.17 dB). The same stream on NVDEC with no VM, beside CUDA copies of
the same size and rate into host memory, failed none.

A release that may copy now takes a turn: at once where none is out and the
last release's copy landed as long ago as it held the GPU, else on a thread
of its own, in the order asked, waiting at most 2 s, far inside the 10 s the
kext waits for the answer. The pages take the same bytes; a burst's answers
come later, and its copies take at most half the GPU's time.
2026-11-17 00:10:17 -08:00
Anees Iqbal 57754fe1d5 📝 Say how Windows pools share and land their pictures [ci skip]
vaapi.md: a Windows pool's surfaces are shared Direct3D 12 textures, the
stand-in for a lost frame is the GPU's copy there, and the GPU's landing
copies from a frame's texture. devices.md: Windows pictures land by the
runtime device's GPU, the CPU's copy where the device imports none.
2026-11-16 23:33:47 -08:00
Anees Iqbal 90e5187b7c 📝 Note that a path normalized on read misses its recorded bytes [ci skip]
reims-ctl's registry now reads a Windows VM's directory with `\` alone, and
the pid file match against QEMU's command line, which still named the old
form, missed a running VM until it took `/` and `\` as one. Only one test on
Windows, mixed by accident, showed it: the lesson says where to look next time.
2026-11-16 23:30:08 -08:00
Anees Iqbal 9736d718d8 🐛 Lend a large surface's pages to the host through a run table
A VT_MESSAGE is one command on ring 0, at most 16 KiB, so it carries about
1,000 page runs: the message's own and those of each surface it lends. A
surface whose pages make more (a large frame's, its pages scattered: a 4K
frame of 10-bit samples is about 1,500 pages of 16 KiB) was refused by the
arm64e kext, which answered the guest's VideoToolbox kVTParameterErr and
sent the host nothing. A decode whose output buffers are such surfaces then
failed every frame: the host's Dbuf went unanswered and each frame was
emitted -12902. Measured on arm64 macOS 15.6.1 under TCG on a 780M host: a
4K Main 10 stream's hardware decode lost all 6 frames so, and the guest's
wallpaper video extension, a client of the service, failed the same way.

The kext now writes such a surface's runs into a run table, wired memory of
its own that it frees as it lets go of the lend, and sends the table's runs
with RGFX_VT_SURFACE_RUN_TABLE in the record's run_count instead. The host
reads the table from guest RAM as it takes the message, and refuses a table
that does not hold the surface's bytes. Each surface a message lends gets
an even share of the room the message's own runs leave.

For the guest: surfaces of any size lend. A host that predates the flag
refuses such a message as malformed, as the kext refused it before.
2026-11-16 23:02:52 -08:00
Anees Iqbal 57ef9a3cb6 🆕 Send an arm64 guest's cursor chain to the host
The arm64e kext refused layer 1's XYZ2Blend, the cursor's chain from XYZ to
the display's profile, because the display applies no chain and that one is
not the identity: WindowServer logged "Failed to set ICC matrix" at each
login and more at each switch of the profile, and the cursor showed sRGB's
colours as they are.

Where the host offers CURSOR_COLOR, the kext takes it on arm64 and takes
each block of layer 1's chain it reads (Src2XYZ's curve and matrix,
XYZ2Blend's matrix and curve) without judging it, and posts the chain at
the first swap after it changed, before that swap's cursor, as a display
engine latches a layer's colour with the flip. It posts the chain off until
it is whole and where it is the identity within 2^-14. The x86-64 kext
does not take the feature, and against a host without it layer 1 is judged
as before.

check-boot's icc check keeps its limit of one matrix line, which now stands
for layer 0's XYZ2Blend that can come a swap before its Src2XYZ.
2026-11-16 23:01:59 -08:00
Anees Iqbal 24a572fe23 🆕 Convert an arm64 guest's cursor through its colour chain
An arm64 WindowServer gives the cursor, layer 1 of the display, a colour
chain of its own: standard sRGB's curve and matrix to XYZ, then XYZ's matrix
and curve to the display's profile. Unlike layer 0's, that chain is not the
identity (0.0024 off at login, 0.25 to 0.35 after a switch to Display P3 or
Generic RGB), so a cursor shown as its pixels came showed sRGB's colours on
a P3 display, and the guest's kext had to refuse the chain's blocks, which
WindowServer logs as "Failed to set ICC matrix".

The device now offers CURSOR_COLOR (feature bit 55, every host offers it)
and takes command 10, CURSOR_COLOR: a display's cursor chain as WindowServer
set it, its curves' forms and parameters and its two matrices as f32 bits.
The host converts each cursor image through it in f64 on the CPU, each
colour once, before the screen is handed the image, so the host's cursor
callbacks and the window's drawn cursor show it converted; a new chain hands
the last image again, converted. Black and white stay exact, and a chain
that leaves every pixel as it is (curves of no form, an identity product)
is no chain and costs nothing. `on` 0 and a reset turn it off. A chain from
a guest that did not take the feature, as the x86-64 kext, is dropped.

What the host sees: FEATURES_HI offers bit 23, and cursor_glyph and
cursor_glyph_at also come when the guest sets a new chain. The guest's side
follows in the next commit.
2026-11-16 23:01:59 -08:00
Anees Iqbal 5ed8f86f59 📝 Say where the device's video runs on Windows [ci skip]
devices.md says what a Windows host's video runs on (VA-API alone, through
libva-win32 and vaon12) and what the UHD 630's driver answers; vaapi.md how
the module loads libva there and what it leaves out without dma-bufs;
backends.md and AGENTS.md's map that the VA-API module builds for Windows.
2026-11-16 22:11:27 -08:00
Anees Iqbal 4420ed055a 🆕 Serve an arm64 macOS 14 guest's VideoToolbox on the host's video
The arm64e kext published the VideoToolbox paravirtual service on macOS 15
and later, so macOS 14 guests decoded and encoded in software. An arm64
macOS 14.6.1 guest under TCG on a 780M host, given the service, decoded and
encoded H.264 and HEVC to the checks 26.6.2 passes; its VideoToolbox sends
protocol version 3 and no guest info with a session's create, which the
host takes.

rgfxVtServesRelease now serves Darwin 23 and later, every arm64 release the
kext loads on. For the guest: an arm64 macOS 14 guest on a host whose video
arm decodes H.264 or HEVC now has the service, its VideoToolbox lists the
host's decoders and encoders as hardware, and its sessions run on the host.
The native test holds the new boundary.
2026-11-16 22:09:29 -08:00
Anees Iqbal 449b122a6e 🐎 Cut no part where no encoder follows
The bundle puts a buffer's ask for its submission (SUBMITTED) last, after its
last encoder, on every buffer of a queue that presents, WindowServer's among
them. The walk cut a part at any encoder's end with an op after it, and
deal() cut chunks at an encoder's end before the stream's last op, so a cut
at the last encoder's end left a last part of framing ops alone: no GPU work,
a vkQueueSubmit of its own, and a paced walk waited to commit it. On
perfdiff's walks at 196c253bc that was 3,736 of the 31,222 parts of an Iris
Xe desk walk (1,558 of 4,680, a third, in its Safari video step) and 1,676 of
55,784 on a Radeon 780M, every one a split buffer's last part; f37e9a586,
before the walk was paced, had as many.

A part is now cut only at an encoder's end that another encoder follows
(encoder_follows), by a cut and by a deal: the ops after the last encoder go
with it into the last part, as in a buffer committed whole, so what they
signal still follows its work and nothing the guest sees changes its order.

Measured on a Radeon 780M (um790, a macOS 26.7.2 guest, walkreg's desktop
walk, two walks before and two after, interleaved: m3-max-38862 and 38864
against 38863 and 38865), in the window drag: empty parts 873 and 901 to 0,
parts 11,251 and 11,243 to 10,339 and 10,333, submissions 891 and 876/s to
805 and 813/s; presents 25.8 and 25.9/s to 25.8 and 25.7/s, and the GPU time
a present 14.9 and 15.4 ms to 14.9 and 15.7 ms at the median.
2026-11-16 21:00:30 -08:00
Anees Iqbal 4c54465962 🆕 Serve an arm64 macOS 15 guest's VideoToolbox on the host's video
The arm64e kext published the VideoToolbox paravirtual service on macOS 26
and later alone, so macOS 15 guests decoded and encoded in software. An arm64
macOS 15.6.1 guest under TCG on a 780M host, given the service, decoded and
encoded H.264 and HEVC to the checks 26.6.2 passes, its VideoToolbox running
the host's sessions as 26's does.

rgfxVtServesRelease now serves Darwin 24 and later. For the guest: an arm64
macOS 15 guest on a host whose video arm decodes H.264 or HEVC now has the
service, its VideoToolbox lists the host's decoders and encoders as
hardware, and its sessions run on the host. macOS 14 still decodes in
software. The native test holds the new boundary.
2026-11-16 20:58:27 -08:00
Anees Iqbal c163db0527 🆕 Encode an arm64 guest's VideoToolbox frames on NVENC
On an NVIDIA host the device listed no VideoToolbox encoder, so an arm64
guest's apps found no hardware encoder and encoded in software. The NVIDIA
arm now answers one encoder for each codec NVENC encodes a profile of, each
session on an NVENC encoder of its own (NvGuestEncoder):
- the guest's settings map onto NVENC's as an x86 guest's do, and Quality
  onto the same preset and tuning (speed_of), the middle where it is unset;
- a frame goes NVENC's two ways: copied by the GPU from the buffer over the
  lent surface's pages into memory NVENC reads, else read by the CPU;
- key frames are placed by the codec module's KeyFrames, NVENC's parameter
  sets go into the configuration record (Record), and no B-frames.

What changes for the guest: on an NVIDIA host, `encs` lists the H.264 and
HEVC encoders NVENC has, and VTCompressionSession's hardware encoders open
and encode there.
2026-11-16 20:19:27 -08:00
Anees Iqbal 1aec9c204e 🎨 Share the VideoToolbox encoders' parts between the video arms
The VA-API arm's guest encoder kept its source checks, its view of the
source's planes, its encoder list and its Quality conversion to itself, and
the codec module's encoder kept its configuration record inside it. NVENC's
guest encoder, next, needs each of them, and also the NVIDIA arm's GPU fill
and preset choice of its host encodes, so they move where both arms reach
them, unchanged:
- the video crate's codec::encode::record::Record: the avcC or hvcC of the
  parameter sets the hardware writes, and samples without them;
- reims-vgpu's graphics::vt_encode: the encoder list, Quality as a
  percentage, and a source frame's planes, checked, in a buffer over the
  surface's pages and in host bytes;
- the NVIDIA arm's speed_of (the preset and tuning of the device's quality)
  and Fills::encode_filled (a frame copied by the GPU, else declined).

Nothing the guest or the host observes changes.
2026-11-16 20:19:26 -08:00
Anees Iqbal 88340bffa9 🐎 Pace a walk in parts that runs far ahead of the GPU
On the Mac mini's UHD 630, a guest command buffer of 794 dispatches went to
the GPU in three parts of 22, 855 and 924 ms: a walk cut no part while work
its queue committed was incomplete, so the rest of the buffer went whole.
metal2vulkan submits every queue's work on the one VkQueue in submission
order, so the buffers committed after such walks waited up to 523 ms for
their parts, and WindowServer's frames with them. Smaller parts alone would
not help them: everything committed after the walk still waits for all its
parts.

Behind incomplete work, a walk now cuts a part once its estimated GPU time
reaches 16 ms, a refresh, the estimate being the GPU time the buffer's completed
parts took against their walk, else its queue's last such rate; and once its
walk reaches 2 ms whatever the estimate, as a compute encoder's GPU time follows
its grid, not its walk (consecutive parts of the 630's burst took 0.4 to 102
times their walk, and one part walked 16.6 ms took 642 ms). Each part boundary
costs about 0.1 ms of a long buffer on a Radeon 780M, which 4 ms parts made 2.5%
there. A walk on its queue's lane then waits after a cut while two or more of
its parts are out and their estimated GPU time is over 16 ms, or the oldest of
them was committed 16 ms ago or more, so a buffer of another queue committed
meanwhile waits for about two parts. The age covers an estimate that lags:
learnt only from parts seen complete, it put a 541-dispatch walk's parts on the
630 at 0.6 ms each, and the walk committed 22 of them within 44 ms while the GPU
took up to 164 ms for one. The wait is the lane's job's, so the lane's next
buffer walks meanwhile.

A walk is never paced once it waited for or signalled an event by an op,
since a part's completion may then hang on a buffer not yet committed; and
it goes on unpaced once a buffer of its context waits for its last commit,
at the split's gate, in the commit order, or for its tickets or range
messages, which a paced walk would otherwise hold up. A wait from its begin,
for a cache's fill or another queue's buffer, does not keep it from pacing:
what such a wait waits for is committed, or commits without waiting for the
walk once the walk goes on unpaced. A wait ends at once at a reset, the
queue's end or a failed part, and after 500 ms with none of its parts seen
complete, and the walk then goes on unpaced. Parts cut behind incomplete
work are committed unmarked, as their completions are what the walk waits
for.

On the mini, in the run of each boot's present probe that met the burst, the
longest gap between frames fell from 933 ms to 584 and 500 ms (two boots), the
probe's longest wait from 1004 ms to 517 and 434, and dropped frames from 62 to
4 and 10; the 794-dispatch buffer went in 80 and 90 parts. Its longest parts,
380 and 417 ms of GPU for 1 to 2 ms of walk, are what a frame committed behind
one still waits for: no estimate from the walk foresees them.

On a Radeon 780M, dispatch_cost's heavy shape, a buffer of 2600 dispatches, now
goes to the GPU in about 17 parts instead of 3 and takes 183.9 ms against 181.7
(medians of three runs, 1.1 to 1.4% apart in each), an accepted cost of bounding
how long a compositor's frame waits behind such a buffer. Its fluid shape and
composite_cost are level there, and so are Geekbench's Fluid Simulation and
Particle Physics (four passes each: 30.81 to 31.02 s against 30.77 to 30.92, and
22.59 to 22.73 s against 22.49 to 22.87). On the M3, over MoltenVK, whose
completions arrive late, the heavy shape takes 129.2 ms against 133.3 and the
fluid one 41 to 46 ms against 45 to 58; composite_cost is level.

Real x86 Macs make a later command buffer wait behind a long one too
(metal2vulkan's measurements: a UHD 630's tiny buffer waits 231 to 234 ms
behind another queue's 244 ms one, a Radeon Pro 5300M's 92 to 99 ms; only
the M3 runs them alongside), so this is a smoothness gain inside Metal's
envelope, not a parity fix. What the guest sees changes only in time: a
paced buffer's last part, and so its completion, comes as the GPU catches up.
2026-11-16 19:19:34 -08:00
Anees Iqbal 02e97ee449 🐎 Keep VideoToolbox's host messages off the control ring
An encode's frame at 1080p and 8 Mbit/s goes to the guest as two or more
16 KiB VT_MESSAGE events. Two of them do not fit the control completion
ring's 32 KiB at once, so an encode filled that ring about once a frame:
control-ring-full and control-ring-post-waited 592 times in an arm64 26.6.2
boot's encode bench (potluck job m3-max-38178). A full ring holds back the
display's VBLANKs and the presents' answers while the guest encodes.

Feature bit 54, VT_RING, which the device offers wherever its host offers
VT_MESSAGES and the arm64e kext takes with it, moves those messages into
the VideoToolbox ring: a 2 MiB ring at region offset 0x20000, in the room
between the control completion ring's span and the guest's allocations,
which the kexts already map with the control rings. It is the device's
memory, so the kext wires none of the guest's RAM for it and frees nothing
at the service's stop or its unload. Each message there is followed on the
control completion ring by a 24-byte VT_RING event (0x40f) carrying the
ring's count through it. The kext takes the ring through that count as it
takes the event, so the messages keep their place among the control
ring's events. A message that finds the ring full goes onto the control
completion ring as before, after the VT_RINGs of the messages ahead of it,
and the spell is counted as vt-ring-full. A guest or host without the bit
gets VT_MESSAGE events as before.

What the guest observes: the feature bit offered with VT_MESSAGES, and the
host's messages in the VideoToolbox ring with VT_RING events instead of
VT_MESSAGE events, in the same order.
2026-11-16 18:48:18 -08:00
Anees Iqbal f37e9a586a 📝 Read a Windows host's event log in record order [ci skip]
The Mac mini's 11-15 outage during a recovery boot read as a hard hang
followed by a planned upgrade, from records filtered by time stamp. Those
records were the install night's, stamped from the firmware clock 8 hours
ahead before Windows first synced its time. In record order the log shows a
sleep, a wake and a power-button shutdown, and two recovery boots on today's
tree ran clean.
2026-11-16 18:25:39 -08:00
Anees Iqbal 3c60f57f72 🐛 Drop a bad UPLOADS_WRITTEN record, and run its buffer
065432241 failed a command buffer at its begin where a record of its
UPLOADS_WRITTEN named no Managed buffer, or bytes past one. A buffer answered
CB_SUBMITTED at its doorbell has posted its CB_SUBMITTED and CB_SCHEDULED by
then, so it failed with them where a buffer its queue's thread took failed
without them: the fuzz caught it
(an_answer_at_the_doorbell_keeps_the_order_of_a_take, case 11 of the
default seed).

The record is dropped now, logged once, as the host drops a
BUFFER_DID_MODIFY_RANGE it refuses, and the buffer runs and completes as it
would behind that message, the same whether or not it was answered at its
doorbell. The records beside it are carried out. Only a guest that names an
object its bundle never made a chunk of sees the difference.
2026-11-16 17:45:04 -08:00
Anees Iqbal a4a91ef8e2 🆕 Name a command buffer's set*Bytes extents in its own stream
On a discrete GPU the bundle's set*Bytes chunks are Managed, and each
commit told the host the bytes written in each with a
BUFFER_DID_MODIFY_RANGE on ring 0 ahead of the buffer. That cost a
one-dispatch command buffer 41 to 44 us of commit-to-wait on the RX 7900
XTX and RTX 3090 hosts. Traced on the XTX, the held message's timer and the
kext call that posts it added 11 to 12 us each before the host took the
buffer, and the buffer then waited 18 to 26 us at the gate for the context
lane that carried the range out.

UPLOADS_WRITTEN (feature bit 53, FEATURES_HI bit 21) lets the buffer's own
stream carry them: op 0x000f, before the first encoder, as many
RgfxUploadWritten records (buffer, bytes from its start) as its length
holds. The host carries each out as the platform's didModifyRange: as it
begins the buffer, before its commit; a record that names no Managed
buffer, or bytes past one, fails the buffer, and none of its records is
carried out. Every host offers the bit and both kexts take it. The bundle
names the bytes there where its chunks are Managed, and sends the range
messages as before where the host did not offer it.

The guest sees the same results: the same bytes reach the GPU's copy before
the buffer's work. The host takes those ranges from the buffer, and ring 0
carries no range message for them.
2026-11-16 17:45:04 -08:00
Anees Iqbal 240881885e 🐎 Copy set*Bytes data into a discrete GPU's memory at commit
On a Mac with a discrete GPU, Metal's driver copies setBytes: data into
the GPU's own memory: on the AMD Radeon Pro 5300M it read at 1.00x of a
Private buffer. A Shared buffer read over the bus came in at 1.05x at
4 KiB, and up to 1.5x at 64 KiB on a dependent chain (constant-read probe,
macOS 26.7.1). Our bundle put those bytes in Shared upload chunks in guest
RAM, so on a discrete host the GPU read every one of them over PCIe.

Where the device answers hasUnifiedMemory NO (the identity flag that also
makes the host keep two copies of a Managed buffer), a queue's upload
chunks are now Managed buffers. The arena notes how far each chunk's runs
filled it as the runs end. At each commit it sends a didModifyRange: of
each chunk's written extent, which goes on the control ring ahead of the
command buffer. The host's Managed path then copies that range into the
GPU's copy before the buffer's commands. A chunk still goes back to its
pool only once the host has completed its buffer, so a later buffer never
rewrites bytes an earlier one is still reading.

What changes for the host on such a device: the chunks' creates carry
Managed storage, and each commit that used set*Bytes is preceded by one
BUFFER_DID_MODIFY_RANGE per chunk it used. Hosts whose GPU shares the
CPU's memory see no change.
2026-11-16 17:45:04 -08:00