On rt, newArgumentEncoderWithArguments: and a function's
newArgumentEncoderWithBufferIndex: were an unbuilt piece
(rt-unbuilt-argument-layout). The host answered ARGUMENT_LAYOUT as refused,
the guest's encoder was nil, and a kernel then read through an argument
buffer whose words nobody wrote. On a guest's probe the RX 550 read zeros,
and the 780M faulted on the null pointers and timed out its gfx ring.
What changes for the guest: both calls now answer metal2vulkan's layout.
That is ArgumentBufferLayout::from_descriptors for descriptors, and
Function::argument_buffer_layout for a function's argument buffer, the
layout the function's translation reads. Every argument kind maps to the
core kind of the same name, nested layouts with their holders. Where Metal
makes no encoder, the call still answers nil, now counted under
rt-refused-metal; the translator's own failures are counted under
rt-refused-translation.
The unbuilt piece and its ledger row go. The tests read
tests/shaders/argument_buffers.metallib. sum_args answers 16 bytes,
aligned to 8, pointers at 0 and 8, from the function and from descriptors.
mixed_args lays out a pointer array, a constant, a texture and a nested
argument buffer. On the Vulkan platform, both kernels read back the words
written at those offsets.
Walk A on the 2080 at metal2vulkan 9ea53f7acd booted the same guest twice,
with rt's cache directory empty and then kept. The planner closed the
two-step make and the early create reply on these numbers: a second boot's
makes in the benchmark's first load cut sum 442 ms against 4124 ms, so cold
makes are a first boot's cost. docs/qemu.md keeps VM measurements.
The NVIDIA crate keeps the first runtime it is opened with in a static for
the process's life (nvidia::wait's RUNTIME), and with it the rt platform the
test handed it: that platform is never dropped, so no last drop races the
exit there. rt_test_end::drop_last at the NVDEC and NVENC tests waited for a
hold that never ends, and 6 of 6 failed its 30 s bound on an RTX 3090. Drop it
from them; the VA-API tests, whose video threads do end, keep it. The module
docs and docs/lessons.md now say so.
A test that hands its platform to the video crate leaves the threads of
what it made there (a VA display's call thread, an NVDEC or NVENC
session's) holding the platform after the test returned. Where the last of
them ends as the process exits, its drop destroys rt's instance and closes
the Vulkan loader beside the exit's handlers, and with NVIDIA's driver
installed beside another the exit then runs code of libEGL_nvidia.so.0,
unmapped by then: on the Iris Xe, graphics::vaapi's tests of writes into
dma-buf caches printed ok and died of SIGSEGV in 3 of 9 processes
(measured with LD_DEBUG=files and their cores).
rt_test_end::drop_last waits until the test's own hold is the platform's
last and drops it on the test's thread; each video test of the rt
platform ends with it. Nothing the guest or the host sees changes.
iHD's decodes write their render target Y-tiled whatever the linear import
says (U30, measured on the Iris Xe), so its target check fails every kind and
its pictures reach the device's caches by its video processing alone, into
each cache's surface, whose planes lie as iHD's runs write them. The docs
said those pictures were copied by the runtime device's GPU on iHD, which the
Linux open never made; they now say which way each layout takes.
A copy of read-only memory kept a base, compared every page with it at each
commit that used it, and at completion compared again to drop the GPU's
writes. The owner's rule is no compare-and-skip on read-only copies: memory
that is not provably unchanging is copied whole at each commit that uses it.
What the guest sees: the GPU's writes to read-only memory are still dropped,
as Metal's are, but now at the next commit that uses the memory, when its
bytes are written into the range again, not at the completion of the command
buffer that wrote them. A command buffer that writes read-only memory still
in flight when another commit uses it has those writes overwritten. The
writable memory and the writable shadows keep their merge, unchanged.
On the host (rt, copied.rs): a dropping copy keeps no base, copies all of its
pages at each commit, does nothing at completion, and no longer holds its
command buffer's handlers back. Counted for each kind (writable, read-only,
unchanging): rt-copied-*-commits, the bytes (writable-compared-bytes,
read-only-copied-bytes, and restored-bytes, as before) and rt-copied-*-sync-ns,
and the read-only commits and bytes by the block's why
(rt-copied-read-only-why-N-*), which the surface pages' import hands the
copy.
In the bundle (RgfxMemoryShadow): a read-only shadow keeps no agreed copy and
is copied whole at each sync. The process's commits, write-backs, bytes and
time for each kind are logged as "RGFX: memory shadows, totals" within a
minute of a change.
Read-only memory under a no-copy buffer lies over a copy on rt wherever the
GPU cannot import it as it is, and every commit that uses the copy compared
all of its pages with their base. Much of that memory is a file's pages on
the guest's read-only system volume, which nothing can change while the
buffer lives, so the compare buys nothing there.
What the guest sees: the device offers feature bit 31, UNCHANGING_PAGES, with
READ_ONLY_PAGES, and the kext takes it (kext feature 1 << 19). At a no-copy
buffer's make over read-only memory, the bundle asks the guest's kernel once
whether the range is one file-backed region whose maximum protection has no
write (a shared mapping, or a private one whose maximum was lowered), whose
every page is the file's own, on a volume mounted read-only (proc_pidinfo's
fsid against getfsstat; no path is opened). Such a block is the app's own
memory, as before, marked RGFX_SURFACE_PAGES_UNCHANGING (and
_COPY_ON_WRITE); the kext's wire of a private mapping makes the process's
copy, as a Mac's does. Any other read-only block carries why not in its
flags' bits 8 to 11, which the host only counts.
What the host does: an unchanging block's copy is filled once, as its view is
made, never compared at a commit, and written again whole at the completions
of the command buffers that can write it, which drops the GPU's writes as
before. The views' summary counts the other read-only blocks by why, and
each texture over one (read-only-pages-textures-why-N, with one line per
format, size and why).
A private mapping whose maximum protection still has write is not provably
unchanging, since its process could raise its protection and write its copy:
it stays a plain read-only block, why "writable max protection".
Moves both metal2vulkan revs from 5004f224a7 to 9ea53f7acd, 9 commits further
on its development branch, named checked by its job m3-max-59486. The lock is
unchanged: no manifest changes in the range, and it still carries no source
lines for the metal2vulkan packages. The range changes no API this tree calls:
it adds Feature::DivergentInterpolation and four Metrics fields, and deletes
DriverWorkaround::InterpolationNeedsTheWholeQuad, which nothing here names.
On rt, for the guest:
- Divergent interpolation is refused on every device (f3b9e0253a). A fragment
function that reads an interpolant at a sample or an offset
(interpolate_at_sample, interpolate_at_offset) outside its first block, or
after a discard_fragment in it, is refused by the translator as
Unsupported::not_implemented(Feature::DivergentInterpolation), where Metal
makes it: the render pipeline state's creator answers its NSError, counted
under rt-refused-translation, as the translator's other refusals are. Before,
rt lowered the shape on every device, and RADV's sample and offset reads
there read garbage where the quad's helper invocations had left. The same
reads in the first block, before any discard, are made as before.
docs/accuracy-ledger.md lists the refusal with rt's.
- A looping fragment function's sample-qualified varyings are read at every
sample a pipeline of the device may have, before the loop, on every device
(f3b9e0253a); rt read them inside the loop, where the helper invocations of
a partly covered quad have left. The workaround that keyed this on RADV's
release was set by nothing since the driver-fact tables went, and is
deleted (7aa9abf911 re-pins its runtime sources' hash).
- SEMANTICS_VERSION goes from 2204 to 2205, so rt's shader and pipeline caches
miss once more: the first run on each host translates its pipelines again
(2258522299 re-pins the old render key at it).
- Metrics::held_starts and Metrics::held_start_gap_nanos (3d93acd6be): the
sends of a group a queue held behind its three submissions in flight, and
the GPU's nanoseconds from the latest end of the work submitted before each
to its own first start.
- Metrics::pipeline_creation_nanos and Metrics::translation_nanos (33cdabd1fd,
9ea53f7acd): a pipeline's make split between the driver's
vkCreate*Pipelines calls and rt's calls into the translator (its reads of a
kernel's inputs and partition and of a render variant, its lowerings, links
and plans), failed calls included; the cache digests count none.
- The four counters change nothing the GPU runs, or when. The next commit
writes them in rt's part of the 10 s summary.
- The event-wait deletion (a075319ea1, no semaphore wait submitted for an
event's value) came with the pin before, at 5004f224a7; c919913869 corrects
rt's docs after it and drops a check for waits no segment has any more.
Nothing more changes for the guest.
- c0e1b47df5 and 96d335ef46 are rt's own tests: its layouts ledger keeps each
image's steps in queue order, and an imported-alias test follows the
compositor's order. Nothing changes for the guest.
rt binds a heap texture at its absolute place in the block's memory, so a
Private heap the guest pins must start at a multiple of every alignment the
GPU answers for a heap texture. The guest pins at 256 KiB from its block's
first byte; the test checked three shapes on the GPU it held.
The test now sizes each SDK pixel format with four usages as 1D, 2D, 2D
array, multisample, multisample array, cube, cube array and 3D textures, of
one level and of every level, and fails where the GPU asks more than the
guest's kHeapAddressAlign, or more than a heap of its own starts at. It
places a texture of each alignment answered at offset 0 and at the alignment
in a heap pinned in a known block at the guest's alignment and in a heap of
its own, and in a heap pinned on the old 32 KiB granule checks that rt's
refusal is counted apart, as rt-refused-heap-texture-place. A GPU whose
images ask more than 256 KiB then fails the checks before a boot meets it.
Measured largest on 2026-11-20 at rt d83fb05: 256 KiB on the RX 7900 XTX and
the RX 550, 64 KiB on the Radeon 780M and the Iris Xe, 16 KiB on the M3 Max
(KosmicKrisp), 1 KiB on the RTX 2080 and the RTX 3090. None is above the
guest's pin, so neither the device's answers nor the guest change; the
module doc records the numbers.
The rename of metal2vulkan-rt to metal2vulkan-runtime lengthened each mention
by five columns, and 43 lines of comments, docs and string literals ran past
the tree's 100 (the C API's two paragraphs were rewrapped in a16076ff37). Each
moves its last words to the next line of its paragraph, cascading where that
line runs over in turn; no word changes. A string literal moves words only
across its backslash-newline continuations, so every string reads as before:
each file's comment words, code tokens and decoded strings were compared
before and after, all equal. No log line, message or test changes.
Moves both metal2vulkan revs from d83fb05624 to 82e7c39216, 65 commits on its
development branch, named green by its checks (m3-max-59311). The runtime's
crate takes its published name there (9a1c8fe6dc): metal2vulkan-rt 0.0.0 is
now metal2vulkan-runtime 0.2.0, its library metal2vulkan_runtime. The
dependency key, the crate's paths (each still `as rt`), the lock's entry and
the docs, comments, log lines and scripts that named the crate follow it. The
rename changes no API.
On rt:
- A command buffer waiting for a shared event's value whose signal is
submitted is Scheduled as it is submitted (4730af16e7): its scheduled
handlers run on the submit thread then, and its queue's later command
buffers are no longer held behind it. A wait for a value that neither the
host set nor a submitted signal promises stays held, Committed, as before
(counted in Metrics::event_holds, fb4b77048c). GPU order and completion are
unchanged. The docs that said rt's completion thread runs a held command
buffer's scheduled handlers now say its submit thread does.
- Copies over buffers are tracked by the memory a buffer lies in, never its
id (7e38a29b69): a texture over one buffer sees a draw through a texture
over another buffer over the same bytes, in one command buffer and across
a held group.
- A kernel that reads buffers through an argument buffer's pointer members,
or through a gpuAddress the CPU wrote into a constant buffer, now makes
(3cdca62567, c0403a1c98); the translator refused it (IdentityDomains).
- A refused kernel input names its kind (98895eb6d2, 1c26e1dc54):
Gap::KernelInput { kind }, so the refusal's text, in the log and in the
NSError's description, carries the kind. It is still counted as
KernelInput.
- Memory goes back sooner. The release of a texture or block that an unsent
upload holds sends the upload at once (0277c68696). A texture longer than
a 16 MiB block has its block to itself and gives it back at its release
(61949e8ba4). Every free of device memory on a normal path is made by the
block-maker thread, and counted against the submits it meets (4c808ffa6d,
09735ad792). New gauges tell texture blocks apart from the consumer's
Private takes (b3f6c859dd).
- ComputePipelineState::dispatch_variant, the key of the VkPipeline a dispatch
runs (82e7c39216), which this tree does not call yet.
- The translator's old path is deleted (0b94d919d9 to 16c831165d): its
profile comes from Vulkan queries alone, with no policy switches and no
driver-fact tables. SEMANTICS_VERSION goes from 2201 to 2203 and
RUNTIME_VERSION from 2540 to 2541, so rt's shader and pipeline caches miss
once: the first run on each host translates its pipelines again.
The rest is metal2vulkan's own: its conformance declarations and ledger, its
generated documents and the tests of each change. The NSError texts the guest
receives, and the comments of the wire header and the guest's sources that the
prebuilt kext sets and the option ROM record, keep the old name here; commits
of their own change them.
design.md said host device addresses never reach the guest (section 6 and the
handles paragraph). On rt a pin lies at the guest's pick only where a block the
host knows holds its range; any other pinned buffer is made at the driver's own
device address, which the guest's GPU work then sees in place of its pick, and
the platform counts it (rt_platform::buffer, "A pinned address"). Both places
now say that. Docs only.
On the rt platform a dispatch's first use of a shape (its threadgroup size,
threadgroup memory lengths and grid) makes the kernel's VkPipeline on the walk's
thread, and the buffer's commit, with its process's wait for it, waits for that
make.
As a queue's service thread begins a buffer with a compute encoder, its
pre-pass (graphics::decode::prepass) reads the dispatches through the
message's views of the table and hands each shape not handed before to the
compile pool, one compile a shape, which calls the state's prepare_dispatch
while the walk goes on: rt makes the VkPipeline at the size the dispatch
gives, and lowers nothing. A dispatch then finds its pipeline made, or waits
for the one thread making it. It is bounded: a compute state's entry
remembers the last 64 shapes handed, a buffer hands 32 at the most, and the
pool runs these makes on all its threads but one, after every library and
pipeline create.
The walk waits for none of it. Right after the walk and commit, before the
message lets go of anything, the pre-pass is closed: the shapes no thread took
are dropped, and the walk's thread waits for those being made, so a compute
state the guest destroyed during the walk is still let go of where its view
closes, and the indices it gives back go back in the same order. Each wait is
counted (dispatch-prepass-waited, -wait-ns, -wait-max-ns), and the first of
each walk end (committed, refused, faulted) is logged.
Nothing the guest or the host sees changes: prepare_dispatch reports nothing,
and each dispatch's results and errors are decided in the walk as before. The
tests on the fake platform hold that each buffer completes as before, and that
a make the walk never reaches ends before the buffer's views close.
docs/conventions.md names the one exception to "compiles run only inside the
wait that needs them".
A take of a piece of its own length now blocks only the guest call that
asked, but that call still waits for the host driver's allocation of its
length: on the 2080, 139.5 ms of a 547 MiB take's 271.5 ms wait for its
piece, and on the RX 550, 64.4 ms of 65 ms. Those are the measurements from
before the pool's change; the next gate walk measures them again.
A take that grew the pool was carved only once the host said its piece was in,
and its worker zeroed it after that, so the host's add and the zeroing ran one
after the other on the take's path: on the 2080's gate walk the zeroing of
context 39's 560320 KiB take took 22.78 ms, and a 256 MiB add took 2.3 ms on
the 780M (11-19).
Now the pool's thread carves the take at its piece's first byte as it places
the piece, before it asks the host's add, and the take's worker zeroes the
carve while the host maps the piece; the take is still answered only once the
host said the piece is in. The zeroing's time counts as the take's zeroing
(pool-take-wait-zero-ns), and only the rest of its wait for the piece as its
growth (pool-take-wait-growth-ns and the pool-take-waited line), so the wait
codes' test checks the growth with the zeroing.
For the guest: a take that grows the pool is answered at its own piece's first
byte. Before, it took the first fit once the piece was mapped, which under a
race could be bytes another take freed meanwhile, or, with another context's
take carved first in the new piece, a further piece of its own.
A take that fits no piece waited for its own piece on the pool's one thread,
which served every ask in turn: the headroom's 16 MiB blocks from rt (each up
to 72 ms where rt's maker makes one), then the take's own block, and a piece
going back blocked the thread until its holds and the host's remove were done.
On the 2080's gate walk, context 39's take of 560320 KiB waited 271.54 ms for
its piece, of which 139.5 ms was rt's allocation of its block; the rest was
the wait behind that thread's other work and the add.
Now the take's worker takes the block of its own length from the source, with
the pool's lock let go of, so only that take waits for its allocation. A new
thread, reims-vgpu.graphics-pool-ahead, takes the blocks of the pool's own
asks (the headroom and the host's pool_grow). The pool's thread places the
takes' blocks before the taker's, and gives a piece back a step at a time: it
asks the host's remove once no hold is left and gives the block back once the
host removed it, waiting for neither, with the 1 s warning kept.
For the host: pool_add and pool_remove stay on reims-vgpu.graphics-pool, one
at a time, in the order the pieces are placed, each add before its remove.
A take's block may now be placed ahead of headroom blocks asked before it,
so the order of the adds, and the pool offsets the guest's takes get, can
differ under a race from before. The new tests fail on the code before this
(job m3-max-58851): another context's take, the headroom and a give-back now
go on while a take's own block is being made.
FEATURES_LO bit 9 was listed as reserved in design.md and is now
IMPORT_ADDRESSES_LATER. A guest that takes it beside IMPORT_ADDRESSES:
- gets a pages block's SURFACE_PAGES answered before the host makes the
block's view and its import, at gpu_address 0;
- makes its buffers over the block at gpu_address 0, and the host places each
at the view's address plus its offset;
- asks for a buffer's address with a new ring-0 query, PAGES_BUFFER_ADDRESS
(0x23d, RgfxPagesBufferAddress), answered by an RgfxPagesAnswer.
Why: on Iris, rt's import of a 17 MiB block of 4244 runs took 15.96 ms of
the block's 16.19 ms answer, and the guest's call waited for all of it. With
this bit, the import runs on the host after the answer is given.
This commit alone changes nothing for a guest: the host offers no new bit
yet, and no kext takes it. The header is cbindgen's (cargo xtask header).
cutdel's WIP 9 renames rt_platform/swapchain.rs's "No device recovery, no
drawable fetch" to "No device recovery", with the drawable fetch gone; the
ledger's device-loss row cited the old heading.
cutdel's newest tip deletes vaapi.rs's crop_extent with the old
platform's copier; the route's text named it as where the crop is
fitted. The crop is still the CPU copy's, so the sentence keeps that
and loses the name.
The cutdel branch deletes VulkanPlatform, metal2vulkan-runtime and the rt
feature, so RtPlatform over metal2vulkan-rt is the only platform. These
docs still described the old one: its answer policies, its exact
switches, MoltenVK on the Mac, its in-place guest memory, its records
cache, its device recovery and its Metal-answer tests.
- conventions.md: the guest-memory-in-place rule is replaced by the rt
rule (rt allocates GPU memory, the device maps its blocks into the
guest, textures sync at the guest's events, and there is one VkDevice
per process). The degradation codes are now rt-unbuilt and rt-refused,
and the deleted codes are dropped.
- accuracy-ledger.md: restated for rt, which has no switches. It keeps
the device's own arithmetic notes (tagged as measured before rt), the
19 unbuilt pieces and rt's refusal kinds, and device loss.
- api.md, README.md: REIMS_VGPU_EXACT, _CENSUS_DIR and _TRACE_DEGRADE
are gone, and STRICT now covers running out of memory only. The let-go
and the quiesce describe one platform.
- architecture.md, development.md, testing.md, qemu.md: KosmicKrisp in
place of MoltenVK; RtPlatform, rt_window and RtBlocks in place of
VulkanPlatform, the old window sink and HostBlocks; no Metal-answer
comparisons and no opt-in GPU-fault tests.
- lessons.md: the four lessons about deleted code only (the Metal
comparison after MoltenVK, the runtime's shadows, device recovery and
the in-place check) are dropped. The lessons that still bind mark
their deleted names.
- video/vaapi.md, graphics-kext/design.md: the GPU plane copy and the
compositor mirror are marked as gone.
- AGENTS.md: only the Vulkan platform's "Where things are" row changes.
A released block's device cache was dropped on the surface worker under its
block's key, and so were the views and the SURFACE_PAGES and BUFFER_OVER_PAGES
jobs, on the worker's four threads. A video session's caches go together at its
end: on Windows each is a Direct3D 11 target pair whose drop flushes both
immediate contexts under the plane draws' lock, 6 ms at the median and up to
100 ms under that contention. On the UHD 630 the held pass's 240 pairs kept all
four threads busy, and the next session's first SURFACE_PAGES, taken 15-19 ms
after its open and done in 0.02 ms, waited 512-586 ms for a thread to post its
answer; the guest's first copy took 516-600 ms.
The caches now go on a worker of their own, reims-vgpu.graphics-let-go-<i>,
each block's in its order: at a BLOCK_RELEASE, and once a block is named again
without a cache, whose drop ran inline on its ring-0 lane before. Their drops
answer nothing and no job waits for them, so a pages job no longer waits behind
them. The Linux arms' caches, VA-API's dma-buf imports and NVDEC's, go the same
way through the same let-go. A view's drop stays on the surface worker under
its block's key, as its mapping may go back to the idle pool the block's next
SURFACE_PAGES takes.
The planner measured the copies on the M3's walk: while apps opened, from
24% to 152% of a 1080p frame's bytes; in steady animation, under 1%. On a
Mac the guest's pages reach the GPU by host pointer, and that kind of import
has no handover that keeps an image's bytes, so the platform copies them.
Linux hosts import through dma-bufs where the pages lie in one, and an
in-place form there is being built.
docs/known-issues.md's Mac section becomes "On a Mac", with the macOS 26
floor and this as its two parts. Windows is named as a fact of the code:
rt_platform/buffer.rs's import_pages takes the pages by pointer on every
host but Linux's dma-buf path (buffer.rs:1483-1491); the copy amounts are
measured on the Mac only.
docs/known-issues.md and install-ctl.sh's warnings said that on a Mac with
no KosmicKrisp, macOS 15 or earlier or a mesa without the driver, VMs get no
GPU. They do not start: the library's device has no GPU device to open
(reims-vgpu's GraphicsDevice::with_platform refuses with HostResources), so
rvg_graphics_device_create refuses, and QEMU's reims-graphics-pci fails its
realize, which ends QEMU before the guest runs. reims-ctl gives every arm64
VM that device, and arm64 VMs are what a Mac runs.
The doc's heading and paragraph and the installer's two warnings now say the
VMs do not start.
The cutover makes the rt platform the library's platform, and with it some
things a user meets that the README did not say: on a host of several GPUs
the VM takes a discrete GPU over an integrated one, untimed, so a host whose
integrated GPU is the faster one gets the slower card; three open bugs of 4K
H.264 video on a Windows host; the host memory the guest's Shared pool holds
beyond the VM's RAM, with its 64 MiB headroom and 5 s release delay; and on a
Mac, Mesa's KosmicKrisp, which Homebrew builds only on macOS 26 and later.
docs/known-issues.md says each in the user's voice, with how to pick the
other GPU through reims-ctl's --gpu or --env, and the README's Beta note
links it in one sentence.
The pool asked its source for 64 MiB pieces. metal2vulkan-rt's unit is 16 MiB:
a take of up to a unit lands in a unit rt's block maker made ahead, with no
Vulkan call, while a longer take makes an allocation of its own length on the
pool's thread and rt frees it as one call once it has been idle 250 ms. A
driver may hold the device's submissions for the whole of such a call, longer
the longer it is: on an RTX 3090 a free on rt's slow path held a submit 72 ms
for 64 MiB and 20.6 ms for 16 MiB, and rt's ALLOCATION_LEN records a 16 MiB
Shared allocation holding one 3.3 ms at the median and one of 256 MiB 51 ms
(measured).
A piece the pool asks for itself is now one unit, BLOCK_LEN, read from rt
(MemoryClass::Shared.block_len()). The headroom keeps the bytes it kept, 64 MiB
(HEADROOM), as four empty pieces: the pool asks a unit for each piece the
headroom is short, counting the asks its thread has yet to serve and the one it
serves, and gives back only the empty pieces above the lowest 64 MiB of them. A
take longer than a unit still has a piece of its own length.
What the host sees: pool_add and pool_remove carry 16 MiB pieces where they
carried 64 MiB ones, four adds at the guest driver's take of POOL where there
was one, and, as the guest's use grows and shrinks, up to four times the adds
and removes for the same bytes, each piece a mapping of its own (QEMU: an
unmergeable RAM region, a KVM memory slot in each address space).
What the guest sees: a block's offset in the pool, and its GPU address where
the guest took POOL_ADDRESSES, follow the 16 MiB pieces. Blocks that shared a
64 MiB piece now lie in up to four, and a take longer than 16 MiB, which fitted
the old piece, has a piece of its own past the headroom's.
The tests that held the one 64 MiB piece count the headroom's pieces, and
a_piece_is_one_rt_unit pins the unit, the headroom's bytes and the long take's
own piece.
The owner ordered the cutover: the library's platform is RtPlatform, over
metal2vulkan-rt, from this commit on. The rt feature of reims-vgpu-vulkan,
reims-vgpu and reims-vgpu-c is now on by default, so `cargo xtask dist`,
`make`, the installers' builds and QEMU's link all make every handle on
RtPlatform. Every test set that builds those crates with their default
features now runs rt's tests where it ran the old platform's.
For the guest everything the device answers and draws now comes from rt:
pipelines through rt's translator, memory from rt's pool, surfaces and imports
through rt's paths, on the host's Vulkan driver on Linux and Windows and on
Mesa's KosmicKrisp on a Mac. The old platform, VulkanPlatform over
metal2vulkan-runtime, still builds without the feature until its code is
deleted, which comes next. Anything wrong on rt is fixed forward.
fce2381013 tells the guest of a drawn picture's decode before its draw, so a
player that holds each 4K picture no longer waits for the draw between its
decodes. Measured on the Intel UHD 630 (Vulkan driver 101.2145, Mesa 26.2.7's
vaon12), 2026-11-20, in two exclusive boots of a macOS guest with it and two
of the same tree without it, four held passes of each file a boot:
- held 4K HEVC played at 57.5 to 69.8 fps with it, against 27.9 to 44.3;
- held 4K H.264 at 89.1 to 127.6 fps, against 62.8 to 121.7.
check.js matched 240 of 240 frames in each of its four checks a boot on both
trees. What is left of a held picture's time is the driver's decode, which
the entry said the device cannot shorten.
docs/video/bugs.md gave U28 to two upstream bugs. The first, iHD and
radeonsi decoding nothing of a 4096x4096 H.264 picture, keeps U28: D25,
devices.md, vaapi.md, lessons.md and h264.rs cite it. The second, radeonsi's
decodes writing an imported surface only within the bytes its planes as
declared span from the luma plane's first byte, becomes U29, with the two
comments that cite it (the VA crate's target.rs and the arm's tests).
Comments and docs only.
On the rt platform on Windows, a picture whose output's planes lie in a
cache's surface over Direct3D 11 textures lands by a draw from the texture
the driver decoded it into. The landing waited for the decode, drew, and only
then did the guest hear of the frame: a command buffer of the decode alone
posted its CB_COMPLETE at its platform end, behind the session's signal. A
player that holds each picture keeps one decode in flight, so each picture
took the decode, the draw (4.4 to 5.2 ms of a 4K HEVC picture on a UHD 630)
and the guest's own work in turn (docs/video/bugs.md, B96).
The landing now tells of the decode done between its wait for the decode and
its draw, as the VA-API arm's video processing on Linux does as it issues its
copy. What changes for the guest: such a command buffer's CB_COMPLETE goes as
the decode is done, in its queue's order, with GPU times of 0, while the draw
runs. Nothing else moves. The session signals the decode once the draw is
done and the platform holds what it wrote, and the buffer's end, its surface
timeline and every read of the output wait for that signal: a command buffer
of another queue that uses the output (a blit or copy from its texture or its
buffer among them), a decode into it, a lock's download and a present. No
reader sees the picture half drawn. A draw that fails falls back to the CPU's
copy, still before the signal; a picture that fails to land after its
CB_COMPLETE fails the session's next decode in its stead, counted as
video-landing-failure-carried, as on Linux.
No test held the old order: the drawn landing needs vaon12 and a decode. New
tests: a session posts a picture's completion at its decode-done tell and
signals the decode only once the rest of its landing is done; and a blit of
another queue from the output, its texture's texels and its buffer's bytes,
copies only behind its wait for the decode's buffer's end, which that buffer
signals only behind its wait for its session's value. The tests of a reader
on another queue, a decode, a download and a present after a completion at
the decode hold for the draw as for the copy.
A large surface's whole-extent shape had its block taken ahead, on a worker
pool of its own after its SURFACE_PAGES answer, so that the ring could place
the shape's image in it instead of taking a block at the make. On a 3090 walk
(the desktop, a browser and a 3D benchmark), no placement into a block taken
ahead saved a make: 33 images placed so at 2648x1618 took 1.47 ms each,
against 1.21 ms for the 8 of that shape made with a block taken at the make;
2 at 3648x2038 took 1.64 ms against 1.67 ms; and the two shapes whose makes
took longest were never placed so. 54 blocks were taken ahead (1755 MiB), and
19 of them went back unused (1141 MiB).
The take ahead, its worker pool (reims-vgpu.graphics-shape-blocks-<i>),
ApiPlatform's shape_block and placed_shape_image_in, rt's ImageBlock, and
their codes (rt-shape-blocks-ahead*, rt-shape-image-makes*) are removed. A
new shape's image is made on the thread that asks for it: it is placed in a
block taken at its make where its fill copies more than zeros, and is the
platform's own otherwise, as before the take ahead. The guest sees the same
values.
The device choice now passes over a device a display's window cannot present
on, so with KosmicKrisp's manifest where Homebrew's mesa puts it the default
platform opens MoltenVK. docs/qemu.md and install-ctl.sh's comment said it
timed KosmicKrisp as the faster and took it; they now say it passes it over,
with the M3 Max boot that shows it (m3-max-57194: 16 of 16 checks, the
full-screen Metal app at 60 fps with 600 frames and none dropped), and keep
the earlier numbers as what it did before. mesa stays out of what the script
installs, as the default platform does not use it.
metal2vulkan's development b676eda182 refused a colour render target made with
no texture index. The blit seam's tests made theirs directly with the runtime and
failed on every rt device, but they are ignored on macOS, so only the Linux and
Windows legs of the pin's batch could see it. The lesson says how to find such
tests before a pin's batch.
install-ctl.sh's comment said the default platform takes the first GPU of
its kind the loader lists. It times each GPU the loader lists and takes the
fastest (device_choice.rs), and a boot measured what that does when Homebrew's
mesa puts KosmicKrisp's manifest where the loader reads it: on the M3 Max the
default platform took KosmicKrisp, on which a display's window cannot present,
and check-boot's full-screen Metal app ran at 30 fps with dropped frames and
failed, where on MoltenVK it runs at 60 fps with none dropped.
The comment now says so, and docs/qemu.md records the boot beside the rt
build's, which passed all 16 checks on the KosmicKrisp the install links.
The rt platform loads the Vulkan loader and Mesa's KosmicKrisp only from
beside QEMU's binary or from ../lib (rt_driver.rs), and nothing put them
there: lanes linked them beside QEMU by hand.
On a Mac, install-ctl.sh now links both into the lib directory of the QEMU
it installs, and make qemu (or make vulkan-links) into build/lib, which is
../lib from build/qemu and from the arm64 build directory docs/qemu.md
configures beside it. Each link points into its Homebrew formula's opt
directory, so brew upgrade reaches it: the loader to vulkan-loader's, the
driver to mesa's. Homebrew's mesa formula is Mesa's release built unpatched
(26.3.1, the release the M3 boots on rt used), and its macOS 26 and later
bottles build KosmicKrisp, so no Mesa build of our own is needed.
Neither installs mesa: with its manifest in Homebrew's share, the system
loader lists KosmicKrisp ahead of MoltenVK (measured on the M3 Max), and the
default platform would take it in MoltenVK's place before the cutover.
Where Homebrew has no KosmicKrisp, no link to it is made and rt makes its
own instance, as before. Linux and Windows installs are unchanged: the new
code runs only where uname says Darwin.
The staged copies' spare pieces were topped up on a thread of their own
after each copy. One 780M walk made 72 scratch pieces beside 27 spares
topped up, and on the 780M a buffer make holds the process's submits
through the driver's lock (6 submits, median 6.50 ms, max 9.76 ms), so a
make on any thread holds up the guest's work.
The two kept pieces now circulate instead. The first two pieces made are
whole 16 MiB pieces, kept; a copy takes an idle kept piece and gives it
back to the kept ones when its command buffer completes. Nothing is made
after a copy, and the top-up thread
(reims-vgpu.graphics-staging-spares-<i>) is gone. A copy that finds no
kept piece idle makes a scratch piece of the length it needs on its own
thread and lets it go once its copy is done, counted as before. Scratch
pieces given back under the caches' lock are let go of after it.
What changes for the guest: its copies make no staging buffers but the
first two kept pieces and the scratch pieces of copies that find none
idle, and nothing makes buffers between copies; the first two copies
make a whole 16 MiB piece where they made the length they needed.
Counters: rt-staging-spares-unused is gone; rt-staging-spares-dropped
(-kib) counts kept pieces let go of without coming back, and
rt-staging-piece-get-ns and -max-ns time each copy's getting a piece.
Held 4K HEVC played at 35.3 fps with the spares made ahead (m3-max-56925).
B96 records where a picture's time goes: the wait for the driver's decode,
7.7 to 11.9 ms a pass, which the host alone shows is the driver's
(18.9 to 19.4 ms with one in flight, m3-max-56739), and our draw into the
output's textures, 4.4 to 5.2 ms, with the fix that would take the draw
off the frame's chain.
A drawn cache's ask that found no spare made its own surface on the ring
while the spares' thread could be making the very spare it asked for. Two
makes at once contend in the driver: in held 4K H.264 on the UHD 630
(m3-max-56925, round 1 pass 2), 78 makes on the ring took 29.2 ms each and
the spares' thread's 162 took 21.0 ms, where the same pass made each on
the ring at 9.8 ms before the spares (m3-max-56661), and the pass fell
from 76.1 to 44.3 fps.
So an ask whose make is running waits for it and takes its spare, bounded
at ten slices of 10 ms, past which it makes its own as before. Counted:
video-drawn-spares-waited, the asks that waited, with
video-drawn-spares-wait-ns their wait and video-drawn-spares-wait-max-ns
the longest, so a boot shows each take waits about one make.
On Windows a video cache's surface over two Direct3D 11 textures is made at the
guest's first texture over one of its planes, on the ring-0 thread that carries
that texture make out, and the guest's next messages wait for it. A player that
holds every picture it decoded takes a new IOSurface, and so a new surface, for
each picture. Measured on the UHD 630 (2026-11-19, a macOS guest's 4K playback,
pictures held): the targets' make took 9.3 to 9.8 ms on the ring and their
import about 0.7 ms a picture between the HEVC stream's decodes, of a 26 to 33
ms gap from one decode op to the next, as the guest keeps one HEVC decode in
flight; the H.264 stream's first round made them in 14.7 to 18.2 ms.
Each ask now takes a spare made ahead for the same plane shapes, formats and
device recoveries, where one is kept, and hands the makes that bring its spares
back up to the depth to a thread of their own
(reims-vgpu.graphics-drawn-spares-<i>), which nothing waits for; an ask that
finds none makes its own as before. The depth is the guest's decodes in flight
at its last decode (the session's value less its event's signalled value), at
least one and at most 8 spares in all, which bounds their memory; the makes run
one at a time under the device's reset gate held shared. The guest sees the
same surfaces: only the thread and the time of their make change. Counted as
video-drawn-spares-used, -missed, -made and -dropped.
A carve passed over the zeroer's claimed chunk to the next fit past it, so where
a take's first fit held some of that chunk, the block's offset and GPU address,
which reach the guest, depended on how far the zeroer had got. The 3090 leg
caught it: a_block_of_a_source_with_no_addresses_takes_the_hosts_next_pick
found the freed block's bytes carved at 0x10000, not 0, the zeroer writing the
lower half of them as the take came.
Such a take now waits for the chunk's write, as a take only the chunk kept out
of every piece already did, and is carved at its first fit: one chunk's write
at most, counted with the other claim waits, and blocks lie where they would
with no zeroer. The wait's count goes down from there to the take's carve with
the pool's lock held, so the zeroer claims no new chunk under the waiting take.
With 64 MiB pieces, most of a take's bytes lie in a piece no block held
before, which the take's worker zeroed while the guest waited: on a 3090
walk the take path zeroed 3794 MiB (928 MiB with 256 MiB pieces), and the
takes' zeroing waits rose from 41.5 to 120.6 ms. The pool's zeroer only
zeroed a freed block's bytes in a piece another block still held.
The zeroer now zeroes, ahead of the takes, every byte no block holds and
no zeroing reached in each piece a block lies in and in the headroom, the
lowest empty piece, from its place on, before the host maps it. It
zeroes no other empty piece: one above the headroom goes back whole past
its delay, untouched. It takes the lowest such run first, the one a
take's first fit meets, from the run's top down.
It no longer writes with the pool's lock held: it claims a 64 KiB chunk
and holds its piece under the lock, writes it with the lock let go of,
and marks it zeroed under the lock again. A carve passes over the
claimed chunk, so no byte is zeroed twice and the chunk's piece goes back
only once the write is done. Where the claimed chunk alone keeps a take
out of every piece, its worker waits for that one write instead of
asking for a piece, counted (pool-take-claim-waits, -wait-ns).
The zeroer's bytes are counted as pool-zeroed-ahead-bytes (was
pool-zeroed-after-free-bytes), its writes' time as pool-zero-write-ns and
-write-max-ns, and its holds now cover the pick and the mark alone.
A refused pipeline's AIR alone does not reproduce its refusal when the guest's
call adds what refuses it: a kernel that compiles with default function
constants can be refused for the values or descriptor fields the guest passed.
Under the same off-by-default switch, REIMS_VGPU_REFUSED_AIR_DIR, each refused
compute or render state now also writes a record into records.txt next to
refused.txt, once per distinct record. The record holds the creator and the
refusal; for each stage, its function, whether it was made specialized, each
function-constant value with its index, declared name, type and bytes, and each
declared constant left undefined; the same for each linked function; and each
field of the descriptor rt was given. The records are the guest's data: they
are written only to that directory on the host, never to stderr or the log.
The rt-diag refused-air line now also counts the records.
On rt, a cache's first shape over rt's 16 MiB unit makes its image in a
Private block of its own, taken on the decoding thread: a 34.5 MiB image's take
took 24.6 ms on a ring on a Radeon 780M, and the longest of rt's takes in a boot
45.7 ms, each a stall on the guest's path. A cache's surface pages give its
whole-extent shape before a draw needs it, so after the SURFACE_PAGES answer the
device asks a worker pool of its own (four threads, keyed by the block) to take
that shape's block, holding the reset gate shared. The ring places the shape's
image in the block when the take has landed, and makes its own as before when it
has not: it never waits for the take. A block no image takes is given back.
New codes count the shape images the ring makes (all, over rt's unit, and in a
block taken ahead: count, ns and longest), the blocks taken ahead (count, ns,
longest and KiB), and those that came late, did not fit, were refused or went
unused.
The arm64 macOS 26 boot on rt refused 5685 draws, the first of them as
reading a colour attachment through its texture (FetchedAttachment), and
nothing said which attachments those were: rt refuses one that is no 2D
texture, renders another level or slice, has no index, shares its image
with another target, or that the device reads no attachment through. The
boot diagnostics now count each such draw by each colour target's class
(how its texture was made, type, samples, level and slice, index, whether
its image's usage reads and writes, its usages, a shared image), with a
first line per pipeline state, as they do the attachment reads.
They also count rt's refusals of Metal's and its limits by variant, where
the counts line has one rt-refused-metal and one rt-refused-limit, and
the sampler states made, with those that clamp to their border colour by
the colour.
And a diagnostic switch, off by default: REIMS_VGPU_REFUSED_AIR_DIR keeps
the metallib of each function of a pipeline state the translator refused,
once per library, with a line per refusal, in air-<pid> in the directory
it names, so the refusal can be read on the host that met it. It is the
guest's code: it stays on that host, and nothing commits or copies it.
rt writes nothing when its VkDevice is lost, and the platform answered the
lost work with codes alone, so a run that lost its device left no trace on
the host but the guest's own silence: two walks froze that way with nothing
in their logs to say why.
The first command buffer that fails with the device lost now writes one
line on stderr, once for the device, beside the platform's other
degradation lines: it names the GPU (name, PCI vendor and device IDs) and
how many command buffers were committed and not complete at that moment.
Each command buffer that fails so is counted under rt-device-lost, so the
boot's degradation counts say how much work the loss ended. The ledger's
rt device-loss row says so in place of "nothing logs or counts the loss".
The row named what the guest ran in the two rt walks that lost their device.
The ledger keeps walk facts generic, so it now says only that the guest's
running app logged nothing for its last ~3 minutes, until the walk stopped it.
The rt device-loss row said no rt boot had lost its device. Two had, while
every command buffer the loss ended still answered 11: m3-max-53777 on the
3090 and m3-max-54078 on the XTX. In each, the running benchmark stopped
making progress for its last three minutes. The row now says that, and that
what the guest does with 2 and 1 is not measured.
Each many-passes test submits 706 passes, each after a 1x1 encoder, as
one vkQueueSubmit of 1413 command buffers. Beside the rest of the Windows
tests on the UHD Graphics 630 that submit lost the device in 7 of 90 tests
over five runs, and the suite's longest test lost its own device in 4 of
the 5, once with no loss of theirs. Neither a 28 GiB commit limit nor
anything in the System log changed or explained it, and the new runtime's
path for the same passes lost nothing in 117 tests beside the same tests.
Alone the tests passed 18 of 18, so on Windows they now run with nothing
else in flight, as the Mac's GPU-faulting test did. The lesson records how
to tell such a loss from paging.
The process's rt platform keeps its device until a host releases its last
graphics device, which no unit test does, so every rt test process reached
the C library's exit with the device live, which rt does not support. On an
RTX 3090 two tiled-texture tests printed ok and then died of SIGSEGV, rt's
memory thread in vkDestroyBuffer while the main thread ran the driver's EGL
exit handler (2 of 2067 tests of one run).
In a test process run as nextest runs it (--exact), the test's thread now
keeps the process's platform and each platform a test makes of its own
(rt_test_end::platform) in a thread-local whose destructor, run after the
test's function and before libtest's join, lets go of each device as a
host's release does, on a thread of its own. A device still held after 30 s
fails the test with _exit(101), running no exit handler. Unix only: Windows
runs thread destructors under the loader lock.
on_vulkan_a_test_s_rt_device_goes_before_its_process_exits runs a child that
takes the device, runs a blit and returns, and checks from the child's exit
handler that rt tore the device down; it fails on the tree before this on
any GPU.
Test infrastructure only: nothing the guest or the host observes changes.
The owner ruled that the cutover ships with no recovery after a GPU device
loss. The ledger listed only the default platform's recovery, so this adds a
row for rt beside it. On rt the device is never made again. The lost work
fails 2 then 1, and every later commit fails at once with 1. A new object is
made only where the driver's Vulkan calls still make one. The window presents
nothing more, while the guest's presents are still answered at each refresh.
The process runs on until the VM ends. What the guest's apps do after that is
not measured.
The pass that zeroes the scanout's room for a new WindowServer was described
from the code, without a measured frequency. A walk on the 3090 under KVM
(job m3-max-50552) read the guest's kernel buffer before and after each step,
and checked that each read continued the one before it. A logout with
autologin off made one pass, and was given the VRAM range once. The login typed
at the login window kept the same WindowServer and made no pass. The boot's
count was not read, because the 128 KiB buffer had dropped the boot's lines.