Commit Graph
6608 Commits
Author SHA1 Message Date
Anees Iqbal b60b3aadbc ✅ Count rvg_graphics_device_pool_range among the header's functions
The C harness's test holds the header at sixteen functions; the pool's range
makes seventeen, and harness.c calls it.
2026-11-18 16:52:12 -08:00
Anees Iqbal d59cbc8846 🐛 Read the GPU's Shared heap before the control takes its device
The pool's range read the heap from the GPU device after GraphicsControl took
it, which does not build; read it with the device's other answers, and lay the
new lines out as rustfmt does.
2026-11-18 16:52:12 -08:00
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 04dcd7959f 🆕 Build qemu-system-aarch64 wherever reims-ctl runs arm64 VMs
install-ctl.sh builds QEMU's aarch64-softmmu beside x86_64-softmmu on x86-64
Linux, and alone on an arm64 Mac (with HVF, signed with its entitlement) and
on arm64 Linux (with KVM), with gnutls for vmapple's AES. It installs
reims-restore where arm64 VMs run, for finish-eacs, and reims-ctl's
__record-install downloads Ambrosia there.
2026-11-18 15:57:52 -08:00
Anees Iqbal b9435743d0 🐛 Start arm64 VMs on vmapple with Ambrosia and our device again
fea9c0b2a removed vmapple with apple-gfx, and b5ad91b93 brought back only the
restore, so reims-ctl made arm64 VMs it could not start. `reims-ctl start`
(and create's --start) now runs one on QEMU's vmapple machine with Ambrosia,
reims-graphics-pci and the configuration bundle, as check-boot.sh boots one:
under HVF on an arm64 Mac, KVM on arm64 Linux and TCG on x86-64 Linux, where
create takes --ipsw. A Windows host runs no arm64 VM: its QEMU is built for
x86-64 guests alone. The VM's aux.img.trimmed is made at its first start
where it is missing, and doctor tells of Ambrosia and the bundle.
2026-11-18 15:57:52 -08:00
Anees Iqbal cea4b06f29 🆕 Carry the arm64e kext set and Ambrosia's module in reims-ctl
The configuration bundle an arm64 VM boots with holds the device's driver
module for Ambrosia, the arm64e kext set (guest/prebuilt-arm64e) and the VM's
own config.cpio kernel patches, which reims-restore writes. build.rs embeds the
set and builds the module with clang and the Rust toolchain's lld, and
prebuilt.rs writes the bundle as `make -C firmware/ambrosia config-bundle`
does. A reims-ctl for Windows, which runs no arm64 VM, carries neither.
2026-11-18 15:57:52 -08:00
Anees Iqbal 93f79ce5ed 🆕 Pin Ambrosia 0.1.3, the firmware reims-ctl's arm64 VMs boot on
An arm64 VM on QEMU's vmapple machine boots on Ambrosia's image as -bios.
reims-ctl now pins its release by version and by the SHA-256 of its zip and of
the image the zip holds, downloads the zip from the release page once, checks
both hashes and keeps the image in the data directory, so a start needs no
network. A kept image whose bytes are not the pinned ones is downloaded again.
2026-11-18 15:57:52 -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 5709b8a198 📝 Say arm64 VMs run under HVF, KVM and TCG, not on Macs alone [ci skip]
9f4196a4c said arm64 VMs run on Apple silicon Macs. The owner, Telegram 1931:
"We run arm64 via tcg and on arm64 Linux and arm64 mac." The intro now says
arm64 VMs run on Ambrosia under HVF on arm64 Macs, KVM on arm64 Linux and TCG
on other hosts.
2026-11-18 14:51:30 -08:00
Anees Iqbal 9f4196a4c2 📝 Name Linux, Windows and macOS as the library's hosts [ci skip]
AGENTS.md still said the library ships for Linux alone, that the Mac build is
for development and tests, and that nothing ships for Windows yet. The owner,
in Telegram 1924 relayed by metal2vulkan: "we already support windows and
macOS hosts. On macOS we still use vulkan instead of metal tho". His 11-17
word on the runtime rewrite: "Update agents.md and memories on either side if
they conflict with this plan."

The intro and the build-target rule now name the three hosts and each one's
target, as 5d38c7e82 did for the other docs: x86-64 VMs on Linux and Windows,
arm64 VMs on Apple silicon Macs, and the Mac on Vulkan over MoltenVK.
2026-11-18 14:37:25 -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 7d699fabea 🎨 Format the recorder's build list and its tests as rustfmt does 2026-11-18 13:59:12 -08:00
Anees Iqbal a926fd8fb9 🐛 Leave Cargo.lock out of the build commit's dirty mark
Cargo.lock is committed without metal2vulkan's git source lines, and every
build writes them back, so by the time cargo xtask dist ran its check every
tree that had built read as dirty. The lock's other changes follow Cargo.toml,
which the check still reads.
2026-11-18 13:56:40 -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 7206ff8e2b 📝 Link the command buffer's commit through its trait [ci skip]
The note on Noted linked CommandBufferObject::commit, which is the
CommandBuffer trait's method on VulkanCommandBuffer, so rustdoc could not
resolve it and the merge's doc leg failed. Link the trait's method, as the
module's other mentions of it do.
2026-11-18 13:51:44 -08:00
Anees Iqbal ab465ac3bc 🎨 Keep fail for the tests, and wrap command.rs as rustfmt does
made_encoder records a protection's failure under its own hold of the noted
state since the command buffer's checks took one lock, so fail had only the
tests' callers left, and clippy's dead-code lint failed the build with -D
warnings. It is now built for the tests alone. rustfmt also wraps two of the
noted reads. Nothing the guest or host sees changes.
2026-11-18 13:34:37 -08:00
Anees Iqbal bbcc96f9d4 🎨 Format the lock changes as rustfmt does
rustfmt wraps the render pass descriptor's resolve check, the command buffer's
noted reads and the render ops' names reads, which their commits left as
written. Nothing but layout changes.
2026-11-18 13:34:37 -08:00
Anees Iqbal 8899ab7a4c 🐎 Find a render pass's names at its command buffer's start
A command buffer's walk found the objects its compute ops name in its view
of the table at its start, 32 under each hold of the table's lock, but not
those its render ops name: each draw's first look at a pipeline, buffer,
texture or sampler took the lock between two recorded Vulkan commands, a
locked instruction there each time (lane lockcount: View::get was 0.7 of the
16-18 locks of reims's own per vkCmdDraw* on the RX 7900 XTX's draw threads).

render::names now reads every render op the walk decodes for the objects it
names, as compute::names reads compute ops, and each_named walks both. The
walk's start looks only for names its view has not found yet, so a draw's
pipeline and buffers, named again at every draw, are looked for once: up to
128 of them, of the first 1024 names.

The guest and host see nothing new: a view's answer for an id is set at its
taking, so finding it at the walk's start or at its op finds the same entry
or none, and a name no op reaches changes nothing the table keeps.
2026-11-18 13:34:37 -08:00
Anees Iqbal 771a86574e 🐎 Read a command buffer's checks under one lock
A command buffer held what it noted of its encoders (how they fail it,
its protection options, its executions to check, its progress) behind six
Mutexes. Each check of whether it may be cut took seven or more locks, a
commit_part eleven, a commit five more, and each encoder made two. On RADV a
locked instruction between two recorded commands costs about 0.49 us, as the
command buffers are write-combined memory (metal2vulkan's measurement on an
RX 7900 XTX), and lane lockcount found kept_whole_by, fails and failure among
reims's largest sites on the draw threads.

Now one Mutex holds the encoder count and what the encoders noted. A cut's
check takes it once, then asks the later reasons only while none before
holds. A commit reads its failure, the first encoder that runs nothing and
the executions to check under one hold. An encoder's making takes it once,
with no separate atomic count. The progress is a OnceLock, read with a plain
load once made, and the commit borrows it. The committed flag is stored
Relaxed, since nothing is published through it.

The guest and the host see nothing new. Each check reads the same state
and answers as before, in the same order. The command buffer fails, cuts,
folds and commits by the same rules and with the same codes. Only the
locking changed, which the contract leaves free.
2026-11-18 13:34:37 -08:00
Anees Iqbal 5852a1ba93 🐎 Hold a render pass descriptor behind one lock
A render pass descriptor held its runtime descriptor, rate map, sources and
raw values behind four Mutexes. Each attachment set took three of them, and
an encoder's creation took four, then copied the runtime descriptor and the
sources, an Arc clone and drop per texture. On RADV each locked instruction
between two recorded commands costs about 0.49 us, since the command buffers
are write-combined memory (metal2vulkan's measurement on an RX 7900 XTX),
and lane lockcount saw these sites among reims's largest on the draw
threads.

Now one Mutex holds the four. Each set takes it once. An encoder's creation
takes it once and reads the pass in place. It borrows the runtime descriptor
when the pass has no rate map and no resolve texture, since nothing is then
dropped from it, and copies it only otherwise.

The guest and the host see nothing new. The same values reach the runtime in
the same order, and a resolve is dropped, refused or kept by the same tests
as before. Only the locking inside the descriptor changed, which the contract
leaves free.
2026-11-18 13:34:37 -08:00
Anees Iqbal c7b517db4a ✅ Take a RAM's plan as listed only where its dma-buf was taken
The runtime's plan for a guest RAM is listed only where the driver also takes
the RAM's first page as one of its source's dma-bufs as the use begins
(metal2vulkan's ram_plan, ram_takes_dma_bufs). Since metal2vulkan 4da77d8518 a
dma-buf import of shared memory is refused where the first memory type the
driver offers for it is not host-coherent, as NVIDIA's 620.70.06 offers on the
RTX 3090. There the RAM is imported ahead by pointer, its chunk once, and both
buffers lie in it: the test, which took the plan from the source and the
submission check alone, expected none (batch 222's ms01 3090 leg,
m3-max-47975, and hostramrun's m3-max-47990, each its only failure).

The test now also reads the lease's host_ram_dma_buf_imports_failed, which
counts the driver's refusal of that first page, and expects the arm the
runtime's plan takes. Nothing changes for the guest or the host: the test
asserts each arm as before, on the plan the device actually took.
2026-11-18 13:18:36 -08:00
Anees Iqbal de1e1cb3ec ⬆️ Build on metal2vulkan development 4da77d8518
Moves both metal2vulkan revs from development dcd21a647e to development
4da77d8518 (43 commits). In metal2vulkan-runtime, the old runtime reims
runs, only memory.rs and its tests change (1d5226bef7): a Shared dma-buf
import takes host-coherent memory types only, and is refused with no import
tried where the first type of its order is not host-coherent. Its
degradation.rs is unchanged, so no Degradation kind is added or removed. The
translator's commits order a kernel's specialized entry once per creation
and count the reuse (a7a51225e6, a3dd881c32); each compile stays equal word
for word to its own unshared compile, and SEMANTICS_VERSION stays 2181. The
rest is the new runtime's (metal2vulkan-rt), which reims does not call yet.

What changes for the guest: on NVIDIA's 620.70.06, which lists a udmabuf of
guest pages only as its type 0 (no property flag) and refuses its type 4,
the runtime took Shared dma-buf imports of guest RAM as type 0, which
promises no coherence between the device and the host's own mapping of the
pages. On ms01's RTX 3090 (Raptor Lake, Thunderbolt, intel-iommu DMA
domain) the GPU then read and wrote those pages past the CPU's cache: the
pair os::host_ram's a_copy_by_runs_scatters_runs_inside_pages and
graphics::decode's
on_vulkan_another_context_composites_a_surface_in_place_as_it_was_drawn
read stale whole cache lines after the work's completion (41 of 42 runs and 66
of 237 steps in a loop under load at 4d1d992f9; clean with a clflush after
the CPU's writes). Those imports are refused now, and the refusal is the
one reims already handles: the device takes no views of guest pages through
dma-bufs, and guest RAM is imported by pointer in its chunks as host-visible,
coherent memory. Hosts whose IOMMU forces snooping read right before and
lose the dma-buf route as well; Private imports keep type 0.
2026-11-18 12:57:28 -08:00
Anees Iqbal 4d1d992f98 ⬆️ Build on metal2vulkan development dcd21a647e
Moves both metal2vulkan revs from development 1e8e5974fc to development
dcd21a647e (10 commits). metal2vulkan-runtime, the old runtime reims runs,
has no diff between the two, its degradation.rs included, so no Degradation
kind is added or removed. Most commits are the new runtime's
(metal2vulkan-rt: an encoder's draws, dispatches and copies execute no
locked instruction; the parameter ring makes its blocks off its lock; the
capture ring is made at the first didModifyRange; staging rings are not
zeroed), which reims does not call yet.

What changes for the guest: nothing in what the GPU computes. The one
translator change, 4b781a949c, moves a grid tile's edge test inside a branch
on its region's ragged flag. Only Device::from_queries' profile has grid
tiles; Device::new's, which the old runtime uses, has none, so its modules
are unchanged. SEMANTICS_VERSION goes 2180 -> 2181, so every shader-cache
key moves: a host's caches miss once at the first start after this and
compile again.
2026-11-18 11:16:25 -08:00
Anees Iqbal a28029af9e ⬆️ Build on metal2vulkan development 1e8e5974fc
Moves both metal2vulkan revs from development 69af14bd22 to development
1e8e5974fc (7 commits). metal2vulkan-runtime, the old runtime reims runs,
has no diff between the two, its degradation.rs included, so no Degradation
kind is added or removed. The new runtime's commits (metal2vulkan-rt: a
buffer argument bound to nothing reads the nil buffer, 64 KiB of zeros; its
tests' busy work waits on an event) and the replay's (the unbound-read
counter deleted, the writes at a completion named in REPLAY-STREAM.md) are
code reims does not call yet.

What changes for the guest: nothing in what the GPU computes. The one
translator commit, 990328afe1, adds the ThreadgroupMemory profile fact:
Device::new's profile, which the old runtime uses, keeps threadgroup
accesses contained byte for byte, and only Device::from_queries' profile
leaves them uncontained and lowers an arena of whole float words as a float
array. SEMANTICS_VERSION goes 2179 -> 2180, so every shader-cache key moves:
a host's caches miss once at the first start after this and compile again.
2026-11-18 11:05:34 -08:00
Anees Iqbal 8b8b817f03 🎨 Wrap the ICB flag's store as rustfmt does
b590ada0b's Relaxed store is one column past rustfmt's width at that indent.
2026-11-18 10:50:02 -08:00
Anees Iqbal b590ada0b3 🐎 Set a render pipeline state's ICB flag with no locked store
A render encoder's setRenderPipelineState: stored the state's
can-encode-indirect-commands flag SeqCst, which x86-64 compiles to xchg, a
locked instruction, at every pipeline state set. On RADV, whose command
buffers are write-combined memory, a locked instruction between two
recorded Vulkan commands costs about 0.49 µs (metal2vulkan's measurement on
an RX 7900 XTX). It was the one locked instruction a guest set* call ran in
reims's code on the common path; draws run none.

The flag is now stored and loaded Relaxed, as the compute encoder already
stores it: the thread encoding the commands sets and reads it in their
order, and nothing is published through it. Nothing changes for the guest
or the host.
2026-11-18 10:46:20 -08:00
Anees Iqbal e3898c7549 🐛 Record what kernels changed at their command buffer's completion
The recorder compared each 4 KiB chunk a command buffer reaches with its
comparison point before each commit, and at the completion moved the point,
with no write, only for what blits and passes write. A chunk a kernel wrote
kept its point from before the kernel, so a CPU write that put those bytes
back compared equal and was lost. metal2vulkan's replay of gb-780m-u2 found
it: the guest zeroes two Shared counter buffers between rounds of counting
kernels, the stream held only the first zeroing, and the replay lost its
device at frame 1129.

At each completion the recorder now compares, as at a commit, the chunks the
command buffer's kernels and render stages could store to, and the chunks
its blits wrote only part of, and writes each that differs from the
stream's. What its kernels and render stages could store to is what the
calls of its compute and render encoders reach, but a resource that a
useResources: names with no write usage: the recorder knows no pipeline's
arguments. A Managed buffer is left out where the device keeps two copies of
it, since the GPU never writes its CPU copy. Chunks that blits and passes
write whole are still taken without a write.

A completion's writes follow the record of the call that committed the
command buffer: those made before that record is queued wait for it. A
player waits for the command buffers that can complete before each write,
so it puts them in after its own run of the command buffer. They are plain
m2v.write records, and the header's flags stay 1.

The stats file counts the completions' time, hashed chunks, writes, and the
writes' chunks and bytes (completion_*).

This changes what a recording holds, not what the guest or the host
observes. Nothing changes while REIMS_VGPU_RECORD is unset.
2026-11-18 10:46:19 -08:00
Anees Iqbal e648b0d4b3 ⬆️ Build on metal2vulkan development 69af14bd22
Moves both metal2vulkan revs from development 98efd4de50 to development
69af14bd22 (30 commits). metal2vulkan-runtime, the old runtime reims runs,
has no diff between the two, its degradation.rs included, so no Degradation
kind is added or removed. Most commits are the new runtime's
(metal2vulkan-rt: a take's zero mark, a submission counted before
vkQueueSubmit2, a view bound after its parent kept until its command buffer
retires, attachment reads through a copy into a shadow, the image-tile depth
rule, a texture over a buffer kept in place where its linear tiling lacks
only image blits), which reims does not call yet.

What changes for the guest: nothing in what the GPU computes. Of the
commits that touch the translator, a47fc3e69d masks an argument buffer's
texture index below the set-1 image arrays in the identity form, which only
Device::from_queries' profile admits; 11dc2d46d5 adds AbsentReads, Nil on
that profile and Marked, as before, on Device::new's, so a read of an
argument function constants removed still marks the status word there.
SEMANTICS_VERSION goes 2176 -> 2179, so every shader-cache key moves: a
host's caches miss once at the first start after this and compile again.
2026-11-18 10:15:09 -08:00
Anees Iqbal ae07b81de4 ✅ Leave no core of any test's child that dies on purpose
3eba3d087 made the death harness's children leave no core. Seven other
processes die on purpose outside it: the singleton tests' and the C
API's ffi tests' children (the test binary run again), the death
harness's own overflow control, and the C harness's die-null. On b216's
RTX 3090 leg, which lifts the core limit to catch a test process's own
crash, each left a kept core with systemd-coredump.

no_core_at_spawn(&mut Command) sets the soft core limit of the process
a Command starts to 0 between fork and exec (Unix; nothing on Windows),
and every spawn of a process meant to die now goes through it. Its test
starts a shell with and without it from a parent whose limit is 1 KiB.
Nothing changes for the guest or the host: tests and the testkit alone.
2026-11-18 09:34:33 -08:00
Anees Iqbal 3eba3d087b ✅ Leave no core of a death test's child
A death test's child dies on purpose, and systemd-coredump keeps every
core it is given, so AGENTS.md runs the Linux tests at ulimit -c 0. A
leg that lifts the limit to catch a test process's own crash (the
NVIDIA exit SIGSEGV, which leaves nothing to read at 0) would then keep
a core of every child as well.

Each child now sets its own soft RLIMIT_CORE to 0 when it enters the
harness (Linux and macOS; Windows has no core limit). The test process
keeps whatever limit it was given. a_child_leaves_no_core raises its
own limit first, so it fails if the child inherits it. Nothing changes
for the guest or the host: this is the testkit alone.
2026-11-18 09:17:43 -08:00
Anees Iqbal aad99b5f8b ⬆️ Build on metal2vulkan development 98efd4de50
Moves both metal2vulkan revs from development b0175c0234 to development
98efd4de50 (46 commits). metal2vulkan-runtime, the old runtime reims runs,
has no diff between the two, its degradation.rs included, so no Degradation
kind is added or removed. Most commits are the new runtime's
(metal2vulkan-rt: one texture index class 1 to 65,535 with one owner per
index, Managed buffers' device copy placed by the consumer, a fixed 250 ms
idle age for freeing allocations, refusals of argument places off Vulkan's
multiple, push bytes skipped where the command buffer holds them), which
reims does not call yet.

What changes for the guest: nothing in what the GPU computes. Of the
commits that touch the translator, cc9ab54b86 sizes the identity domains'
storage-image array, which only Device::from_queries' profile reaches;
b527ae9f68 takes Vulkan's divisor for an instance step on that profile and
keeps Device::new's path as it was; and the compile meter's commits weigh
the lowering passes' work units for every caller, which no output is chosen
from: its one effect is the WorkUnits cap. Each weight is at most 10/16 of
a unit, so a lowering counts at most what it counted before: no shader
Device::new compiled before is refused now, and one refused for its work
units before may now compile.
SEMANTICS_VERSION goes 2173 -> 2176, so every shader-cache key moves: a
host's caches miss once at the first start after this and compile again.

Checks at this tree: Mac m3-max-46966 (2681 tests), um790 780M
m3-max-46967, ms01 RTX 3090 m3-max-46973 and ms01 Iris Xe m3-max-46975
(2576 each), with fmt, clippy (Linux, Windows), header and prebuilt
checks; rustdoc for Linux, Windows and Mac m3-max-46960. On the 3090 one
test passed and its process then died of SIGSEGV at exit, under the
leg's load (the NVIDIA exit class in the ledger); run again alone it
passed (m3-max-47012). Cold boots with no fatal line: x86-64 macOS 26.7.2
on um870's RTX 3090 (m3-max-47057) and arm64 macOS 26 on um790
(m3-max-47011, 16 of 16 checks).
2026-11-18 09:13:22 -08:00
Anees Iqbal a958b9bb86 ⬆️ Build on metal2vulkan development b0175c0234
Moves both metal2vulkan revs from development fa930a9793 to development
b0175c0234 (51 commits). metal2vulkan-runtime, the old runtime reims runs,
has no diff between the two, its degradation.rs included, so no Degradation
kind is added or removed. 24 commits are the new runtime's (metal2vulkan-rt:
Managed buffers' two copies on every non-unified device, one VkPipelineCache
per device, lowerings written off the creating thread, kernel variants
lowered at their first dispatch), which reims does not call yet.

What changes for the guest: nothing in what the GPU computes. Of the 13
commits that touch the translator, those that change its output do so on
Device::from_queries' profile alone, as their messages state: 264c28feef
(a grid tile's edge test against the region's last thread; 243145d7b1: "the
grid edge is Device::from_queries' path alone"), 212bba29c6 (Metal's
constant step as a stride-0 vertex-rate binding, under the identity domains)
and 70dffca0c2 (deep threadgroups as one row; "Device::new keeps Axes and is
byte-equal"). 2a3e0d1372 speeds the lockstep pass's pair search ("The
answers, barriers, SPIR-V and notes do not change"). SEMANTICS_VERSION goes
2171 -> 2173, so every shader-cache key moves: a host's caches miss once at
the first start after this and compile again.

Checks at this tree: Mac m3-max-46345 (2681 tests), um870 780M m3-max-46439,
um870 RTX 3090 m3-max-46448 and ms01 Iris Xe m3-max-46447 (2576 each), with
fmt, clippy (Linux, Windows), header and prebuilt checks (m3-max-46435);
rustdoc for Linux, Windows and Mac m3-max-46343; macOS 26.7.2 x86 boot on
the 3090 m3-max-46472 (0 fatal lines) and arm64 26 under TCG m3-max-46461
(16 of 16 checks).
2026-11-18 06:51:37 -08:00
Anees Iqbal 0061da1f68 🐛 Record the guest's bytes at each announce of a Managed buffer
At a didModifyRange: of a Managed buffer (an announce), metal2vulkan's player
will push the bytes the stream recorded for the range, never its own
read-back. The recorder wrote only the chunks whose bytes differed from its
comparison point, which also takes what the GPU wrote, with no write, at the
command buffer's completion. So a guest that read a Managed range back
(synchronizeResource:), left it and announced it got no write, and the
stream's last recorded bytes there were stale; a guest write that a late
refresh folded into the point was lost the same way.

Each chunk now also keeps the hash of the bytes the stream's last write of it
recorded, and an announce writes every chunk whose bytes differ from the
point or from those, or that no write recorded. Commits write as before. The
extra records are ordinary m2v.write records, which every player takes.

The header's flags carry bit 0, FLAG_ANNOUNCED_BYTES_RECORDED, so a player
applies the rule only to streams that keep it. The version stays 2: our
reader and metal2vulkan's check only the magic and the version.

A queue's command buffers run their completion-seen handlers in commit order
in the pinned runtime, so the order of the refreshes needs no change.

Nothing changes while REIMS_VGPU_RECORD is unset.
2026-11-18 05:39:55 -08:00
Anees Iqbal d1168a34a9 ⬆️ Build on metal2vulkan development fa930a9793
Moves both metal2vulkan revs from development 57ab393bd1 to development
fa930a9793 (412 commits). metal2vulkan-runtime, the old runtime reims runs,
has no diff between the two. Nearly all of the commits are the new runtime's
(its render encoder, draws and render states, behind Device::from_queries,
which reims does not call yet) and their tests. 55 change the translator.

What changes for the guest: one translator commit moves the old runtime's
output, 48833908aa. In the flattened kernel tiers that pin a required
subgroup size (Direct 32, Cluster32), a kernel's linear local index now uses
that constant in place of the SubgroupSize builtin. The values are the same
wherever the driver answers SubgroupSize correctly; it fixes the UHD 630
Windows driver, which read SubgroupSize as 0 under a required size of 32.
metal2vulkan's evidence at fa930a9793, against 57ab393bd1's tables:
- Golden table through Device::new (fresh bless m3-max-45627, empty patch):
  3432 rows kept, 0 gone, 10 new fixtures. Changed cells: 274 on each RADV
  and RTX 50 profile, 257 on each ANV profile, 217 on Pascal, 0 on lavapipe,
  MoltenVK, SwiftShader and the floor profiles. All come from 48833908aa.
- Census of refused sets through Device::new (m3-max-45630): 2369 cases,
  0 refusal changes on all 21 profile legs (Iris, RADV, NVIDIA included).
- degradation.rs has no diff, so no Degradation kind is added or removed and
  answer.rs needs no change.
- SEMANTICS_VERSION goes 2164 -> 2171, so every shader-cache key moves: a
  host's caches miss once at the first start after this and compile again.
2026-11-18 03:33:04 -08:00
Anees Iqbal 656c202d72 🎨 Wrap the own-texture imports as rustfmt does
rustfmt fills the first line of the gpu::desc import list to the width
limit; the marker commit broke it one name early, which fails the fmt step.
2026-11-18 02:02:14 -08:00
Anees Iqbal 642ef0ff9e 🐛 Mark the platform's own textures' descriptors in recordings
A texture of the platform's own (the window's cursor glyph) takes no resource
ID and no range of Metal's space, but a recording held it as a plain
newTextureWithDescriptor:. metal2vulkan's new-runtime player gives each
texture the next free index of its class, so the glyph would shift every
later texture's index by one and argument-buffer bytes would name the wrong
texture.

Its descriptor's m2v.textureDescriptor record now ends its map with the key
`outside`, true (recorder::OUTSIDE), and the create names that descriptor;
no other descriptor carries the key, and there is no new record kind. To
record that descriptor exactly, ApiPlatform::own_texture and
VulkanDevice::new_own_texture take the TextureDesc and make the descriptor
themselves (recorder::outside_descriptor records it), so the cursor no longer
makes one. With the recorder off nothing changes.

The recorder test checks the own texture's descriptor map is a guest
texture's of the same value with `outside: true` after it, that the guest
texture's has no such key, and still that the receiver and the bind are named
and both unrecorded counters are 0.
2026-11-18 01:58:29 -08:00
Anees Iqbal f0b8e3a8c1 🎨 Format the own-texture recorder test as rustfmt does
rustfmt wraps the test's lookup of a call by selector, which the merge
check's fmt step refused.
2026-11-18 01:48:47 -08:00
Anees Iqbal 248751c3c7 🐛 Name the platform's own textures in recordings
The window's cursor glyph is a texture of the platform's own
(VulkanDevice::new_own_texture), made with no recorded call. In a stream its
replaceRegion: calls had receiver 0 and every setFragmentTexture:atIndex: of
the cursor pass bound nil: metal2vulkan's replay of one stream met 2628 such
binds and 3 such replaces.

new_own_texture is now recorded as an ordinary newTextureWithDescriptor: on
the device, as new_texture is, so its result is registered and its later calls
and binds name it. No new m2v. record: the player takes the stream as it is.
With the recorder off nothing changes (the macros' relaxed load and branch).

The test records an own texture's making, a replace into it and its bind in a
render pass, and checks the stream names it in both and counts no unrecorded
reference or receiver.
2026-11-18 01:41:15 -08:00
Anees Iqbal 184d208950 🐛 Keep the runtime clock's domain constant out of the wire header
cbindgen writes reims-vgpu-graphics's public constants into
reims_graphics_wire.h, and clock::runtime's PLATFORM became one when clock
went public, so cargo xtask header --check failed. PLATFORM is crate-private
now; nothing outside the crate reads it.
2026-11-18 01:00:46 -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 15180a77ec 📝 Say why the recorder prunes an ICB's refs as it does [ci skip]
The previous commit's comments said a command holds none of what it names,
which the code does not rely on: the refs serve the command buffers that name
only the indirect command buffer, and the released ones go because a capture
skips them anyway, which keeps the refs few.
2026-11-18 00:45:55 -08:00
Anees Iqbal cb7db3a595 🐛 Reach what indirect commands bind in recordings
A command buffer that executes an indirect command buffer reached the buffer
alone in the recorder, not the buffers its commands bind, so a CPU write into
memory only such a command binds was missing from the stream before the commit,
and the replay ran the commands on stale bytes.

An indirect command buffer now keeps the objects its commands name, as a
descriptor does, and a blit's copy of its commands copies them into the
destination. A command holds none of what it names, so the objects released
since are let go of at each execution, which keeps a buffer re-encoded every
frame from piling up the ids of buffers long gone.

There are no parallel or nested encoders nor residency sets on the platform to
reach through. Memory the GPU finds by address alone, through an argument
buffer or an address in a buffer, is reached only where the guest names it with
useResource or useHeap, as the module doc now says.
2026-11-18 00:45:55 -08:00
Anees Iqbal 2cdceb2f4f 🎨 Format the recorder's GPU-write tracking as rustfmt does
The previous commit's ranged blit writes and memory tests were not as rustfmt
writes them, which cargo xtask check's rustfmt step refuses.
2026-11-18 00:45:55 -08:00
Anees Iqbal 7cf4453074 🐛 Keep CPU writes into bytes a recording's GPU work wrote
The recorder took every object a command buffer's blits or passes wrote as
the stream's, whole, when a later commit reaped it. A CPU write the guest made
into such an object after the completion and before that next commit, beside
the GPU's bytes or after them, was taken with them and never recorded, so the
replay read stale bytes.

Blits now note the byte ranges they write (buffer copies, fills, copies from
the guest's RAM; a copy into the guest's RAM writes no object), and attachments
and blits whose arguments do not read stay whole. The ranges are taken as the
stream's when the platform first sees the command buffer complete: by a hook
at the head of core's completion-seen handlers and a handler of the
recorder's own, which run before the completed handlers and before
waitUntilCompleted returns, so before the guest can learn of it from them.
Only 4 KiB chunks wholly inside a written range are taken, so a CPU write
beside a partial GPU write still reaches the stream.

The reap-time path stays for what the hook cannot take: a command buffer
whose status read final before its handlers ran, or whose handler the runtime
refused. A released one's ranges are dropped and compared again later.
Two cases still lose a write, named in the module doc: a CPU write into the
GPU-written bytes while the command buffer runs, and one made on word of the
completion (a signalled event, a status read) in the microseconds before the
handlers run. With the recorder off, the hook costs one relaxed load.

Also rustfmt's wrap of a test assertion from the previous commit.
2026-11-18 00:45:55 -08:00
Anees Iqbal 7fc1cc427b 🐛 Capture memory before split and cut commits in recordings
A command buffer that m2v.split or m2v.commitPart commits does so through a
commit nested in that call, which records nothing of its own: the recorder's
capture returned there, so the memory such a command buffer reached went into
the stream only where a later plain commit happened to reach it. m2v found
that every command buffer binding b2's ring went through m2v.split with no
capture before it, and gb's stuck one too.

The nested commit now captures as a plain one does, before the outer call's
record. The writer takes a split that made the next part and a part's commit
that answered "Cut" as commits of the receiver, so the command buffer is held
pending: later captures wait for it, and its signals count once it
completes. A next part, made by m2v.split or m2v.part, is its queue's, as the
command buffer it goes on from is, so the queue's order holds across parts.

The test records in a child process (the recorder is the process's) and
checks a CPU write ahead of the split and of the cut part.
2026-11-18 00:45:55 -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