Move the runtime from eeb7934025 to 0a1851164d, six commits of metal2vulkan's development. What changes for the guest: - A draw, compute dispatch or tile dispatch whose pipeline the driver is still making 4.5 s after its command buffer's commit runs nothing, and the command buffer runs on (PipelineWaitPolicy::Bounded, the runtime's default, announced draw-dropped-still-making or dispatch-dropped-still-making). A state's creation likewise returns after 4.5 s with its predicted pipeline still being made. Before, a cold compile (11.59 s on an M2 Pro's MoltenVK boot) held the command buffer past the guest's 10 s check of its FIFO. - A draw whose pipeline the driver failed to make after the draw returned runs nothing, and the command buffer runs on (draw-dropped-unmade), where it failed before. - A no-copy buffer, heap or buffer rebind whose import fails (out of memory, or a driver out of mappings) is made over a copy of the pages in the device's own memory (copied-host-pages), where the call was refused before. - Nothing else in the span moves what a guest observes. On NVIDIA's driver on the RTX 5080 Laptop GPU, the 2.2 to 3.7 ms stall the driver spends in every 1,024th signalling submit of a queue is taken by empty submits while the queue is idle, not by a batch. A discrete GPU zeroes new buffers by a fill. A warm render state is linked from its recorded stages. The shader cache is keyed by its translator, so a runtime-only change no longer turns it cold. The four kinds are placed in DIES: by default each is relayed and counted, and in strict mode it ends the process, where a difference the guest can see does. Unplaced, they fail every_degradation_kind_is_placed_once. A strict process, every test of this crate among them, waits for each pipeline until it is made (PipelineWaitPolicy::Exact), so a slow compile under the check's load never dies there as a dropped draw. REIMS_VGPU_EXACT names the same exact form as pipeline_waits, and the accuracy ledger records the fast form's bound. A no-copy buffer over host memory with a page not mapped, or mapped without read access, is answered nil before the runtime is asked, as Metal answers it, where development asked the runtime and answered nil at its refusal. At 0a1851164d a placed buffer the runtime refuses keeps its range held, so the next buffer Metal places at that address met a conflict and died (measured on the M3 Max: no_copy_buffers_over_pages_without_access_are_nil_as_metals). Those pages are the only refusal there answered without dying, so nothing else meets the held range. metal2vulkan has the report. The import gate the runtime now takes (HostMemory::with_import_gate) is wired in the next commit.
23 KiB
Accuracy ledger
A ledger, not a journal: rows are edited in place. Each row is one place where the Vulkan
platform's default trades exactness against Metal for compile time (pipeline making) or GPU
time. The fast form is the default. The accurate form stays behind its opt-in switch, and both
are kept always. An accurate form becomes the default only where it costs nothing measurable in
compile or GPU time. Where the runtime answers with the device's own arithmetic, sampling and
conversions and keeps no exact form (the owner's native-arithmetic rule), the difference is a
precision note within the bound it records, listed under "The device's own answers", with no
switch. An accuracy difference is logged (metal2vulkan-degrade-<code>, first line,
then counted) and the process runs on. The process ends only where Metal itself ends it, or where
an operation cannot run at all. REIMS_VGPU_STRICT=1 ends it at each difference instead, for
tests.
Switches: REIMS_VGPU_EXACT=<field>[,<field>...] sets the runtime's DevicePolicy field to its
exact form at device creation. The runtime's own ledger, with every bound in full, is
metal2vulkan's docs/FAST-PATHS.md at the pinned commit. Costs are the RTX 5080 Laptop GPU's,
cold, from that file: the making of the big glass pipelines (A2X, Xgc14, Xgc15), then GPU time
per draw.
Two runtime defaults are not taken, and have no switch: completion and heap compression. Every
device takes CompletionPolicy::Exact, each command buffer in a kernel submission of its own and
seen complete at its own end, as Metal's, where the runtime's default (Grouped) on Mesa's drivers
sends up to four ready together and sees each but the last complete only once the last completed.
When a command buffer is seen complete is what the guest observes of its work (the stamps and
interrupts core writes as it completes), and this platform does not diverge from Metal there, in
timing as in order: the rows below trade values alone. The grouped form also bought no frame rate in
a guest's drag on the Iris Xe (15.7-17.3 frames a second grouped, 16.4-17.6 exact), for 0.4-1.7 ms
of the runtime's scheduler CPU a frame.
Every device also takes HeapCompressionPolicy::Uncompressed: a heap's colour texture that Metal
keeps losslessly compressed (allowGPUOptimizedContents, no ShaderWrite, PixelFormatView or
ShaderAtomic usage, 16 texels or more a side) takes an image the driver keeps uncompressed in the
heap's bytes, as one Metal keeps uncompressed does, where the runtime's default (Compressed) takes
the driver's compressed image on a driver whose compressed images may keep their texels apart from
their memory (ANV). That image changes what heapTextureSizeAndAlignWithDescriptor: answers the
guest: on the Iris Xe 0x4100 bytes at 0x10000 for a 64x64 BGRA8Unorm texture, and 0x8100 at
0x10000 for a 64x64 R32Uint one of seven levels, where the uncompressed images answer 0x4080 and
0x8000 at 0x1000, as before this default came (Metal: 0x4080 and 0x5800 at 0x80). An answer stays as
it was until the guests boot with the new one. A write through a buffer or texture over its bytes
may also leave the compressed image's texels as they were (HeapTextureCompressed). The compressed
image cleared a 2048x2048 RGBA8Unorm render target in a Private heap in 26.9 us against 676 us
on the Iris Xe, and copied into another in 648-649 us against 674-693 us.
| Fast default | Accurate switch | Bound of the fast form | Cost of the accurate form (5080) |
|---|---|---|---|
| Batches of one queue ordered by their ends on a driver measured to start no kernel submission of a queue before the one before it completed (ANV, RADV, NVIDIA): each ends with a barrier before every later command of its queue, so a dependent batch begins with no barrier of its own | batch_order (a barrier for each access a batch's work depends on in an earlier batch's) |
none: on those drivers each batch starts once the one before it completed under either form, so order, results and GPU times are the same. Not announced | UHD 770 (ANV), 67 command buffers a frame over 520 host imports: 67 command buffers submitted a frame against 129, a frame through completion 2.13-2.22 ms against 2.27-2.38 ms |
A texture over the guest's pages that only samples or reads them (no RenderTarget, ShaderWrite or ShaderAtomic) held as a linear image over the pages, on a device whose own check, run once per driver and release, finds that an image's first move leaves every byte alone while the CPU writes beside it (the owner's ruling, 2026-10-26: in place, trusting the driver) |
host_page_textures (a shadow: the texels copied in at each command buffer's first use and merged back after each write, on every device) |
none on a device whose check passes: Vulkan lets an imported image's first layout transition read and write every byte bound to it (VUID-VkImageCreateInfo-pNext-01443), which would undo a CPU write made beside it; the check shows the driver does not, and a texture made before its verdict is a shadow |
the copy-in at each command buffer's first use: Safari on testufo.com at 1680x1050 and 120 Hz read about 45 MB a frame from host memory over PCIe on the RTX 5080, against a 7 MB framebuffer (SM 24-34%, metal2vulkan f6a96b7da8) |
A chain of half additions, subtractions and products under fast math, on a device without shaderFloat16, held at float precision and rounded where a value leaves it (FastMathRewrites) |
half_chains (each operation rounded where it is computed, by the device's OpQuantizeToF16) |
the roundings the chain skips, and a value past half's range inside the chain stays finite |
not measured |
| A draw's or dispatch's pipeline still being made 4.5 s after its command buffer's commit: the command runs nothing in that command buffer, and later ones run it once made; a state's creation returns after 4.5 s with its predicted pipeline still being made | pipeline_waits (each creation makes its predicted pipeline before it returns, and a command buffer waits for each pipeline until it is made; a strict process takes it whatever the switch says) |
a draw or dispatch dropped from the command buffers committed before its compile lands, announced (draw-dropped-still-making, dispatch-dropped-still-making): the slowest render state's compile on an M2 Pro's cold boot under MoltenVK took 11.59 s (metal2vulkan's FAST-PATHS) |
no GPU cost; the creating thread and the command buffer held for the whole compile, up to 11.59 s on that M2 Pro boot, past the guest's 10 s FIFO check |
| An extended-range blend source rounded as a loaded colour | none yet: parked (the 5080 effort first; no 5080 boot reaches it) | 1 code | not measured |
| Bicubic near-tie rounding | none yet: parked (the 5080 effort first; no 5080 boot reaches it) | 1 grid step (1/4080) within 2^-21 of a tie | not measured |
all takes every switch at once.
The device's own answers (no switch)
The runtime answers each of these with the device's own arithmetic, sampling or conversion and
records its precision note, within the bound below (metal2vulkan's docs/FAST-PATHS.md at the
pinned commit has each in full). On MoltenVK most are Metal's own answers and announce nothing.
| The device's answer | Bound against Metal's |
|---|---|
| The device's sampler (filter, footprint, level, anisotropy, sRGB, comparisons) | linear filter 1 code, sRGB 1.83; the rest unmeasured |
| The device's filter of a two-plane YCbCr texture, under the device's sampler (on MoltenVK, Metal's own sampler over the texture's converted texels) | 1.18 codes of Metal's sum on the RTX 3090, 0.88 on RADV, 1.06 on ANV; on MoltenVK one step of the format's grid (0.1245 codes on 1/2048, 0.016 on 1/8192), a half result 0.1245 codes, and a half sample of one texel of an _sRGB twin through a runtime sampler rounds a tie to even (one half ulp) |
| The device's conversion of a texel's codes | 1 f32 ulp (8/16-bit), 0.18 code (5/6-bit packed) |
The device's fixed-function conversion of a normalized vertex attribute's codes (UCharNormalized through Short4Normalized, UChar4Normalized_BGRA, Int1010102Normalized, UInt1010102Normalized) |
1 f32 ulp at some codes on a driver whose conversion multiplies by the reciprocal; Metal's and Vulkan's rule is the correctly rounded quotient |
| Device maths library, division, fma | Vulkan's precision table (e.g. Atan 4096 ulp) against Metal's 4-6 |
| Device NaN bits; device min/max/clamp | NaN bits, ±0 and denormal picks; on ANV and RADV a half read from its bits widens by the device's conversion, every value but a NaN exact, a NaN's bits the device's (ANV quiets a signalling one) |
Device dot, mix, fast::sqrt |
dot (3n−1)·2^-24·Σ, mix 2^-21, sqrt 4.5 ulp |
| Device half rounding, widening and folding; a half texel's NaN | AMD and Intel (RADV, ANV) round a computed half through an f32→f16→f32 conversion pair under Vulkan's 16-bit float controls (round to nearest even, denormals and signed zeros kept), which the spec makes exact, under either form and announcing nothing (0 mismatches outside NaN inputs over every half and every half +, −, × pair on Iris Xe, the 780M and the 7900 XTX). The RTX 5080 rounds exactly (8192 of 8192 narrowed sums are Metal's). The RTX 3090, on the same 615.71.09 driver, and lavapipe drop the rounding: a half result keeps float precision, its differences compounding across operations. A value past half's range stays finite until a half store saturates it to infinity. Elsewhere 1 half ulp. NaN bits; half denormals may flush |
| The device's blend of a safe-math half output into a blended 16-bit float attachment | at the largest operand: 16-bit float 2.5 half ulps on NVIDIA (blend-colour factors), 2 on AMD, Intel and lavapipe; 32-bit float 1 ulp on NVIDIA, 2 elsewhere |
The device's decode of a 16-bit float texel (R16Float, RG16Float, RGBA16Float, RGBX16Float) that a half or float read answers |
a NaN texel reads as the decode's NaN, where Metal hands back the texel's own code: 0x7e00 for every NaN on MoltenVK (the M3 Max: 515, 1,026 and 2,045 of 4,096 words at each read site of the R16, RG16 and RGBA16 probes), the texel's bits at RADV's reads; every other value the texel's (DeviceNanEncoding) |
A multisampled Depth32Float texture the program only reads, held in a depth image on a device whose depth images may not keep its texels (no unrestricted depth range, or a driver not measured to keep a denormal) |
a fill's or a copy's denormal stored as a zero, and a value outside [0, 1] as the depth image keeps it (DepthDenormals, RestrictedDepthUpload), measured on RADV for render-target textures, which the switch does not cover |
| A decoded twin of compact codes for a texture of a format the device lacks, which the runtime holds in a carrier: an ASTC LDR texture's (not an sRGB one's) of 8-bit codes, an EAC 11-bit one's of 16-bit normalized codes (Apple's GPUs have the formats: no twin on MoltenVK) | an ASTC channel within 1/510 of Metal's 12-bit value, an EAC 11-bit one within half a 16-bit step (DecodedTexelPrecision) |
The device's load and store of a single-sampled signed normalized (R8Snorm to RGBA16Snorm) or RGB9E5Float colour attachment that a drawing pass loads: the texels its draws do not write keep their bytes (on MoltenVK the pass is Metal's: no difference) |
one code, at a minimum code alone (-128 or -32768 kept where Metal stores -127 or -32767, both -1.0), and a shared-exponent word kept unnormalized (the same value); only uploaded or copied bytes hold either (SnormMinimumKept, SharedExponentKept) |
The device's AVERAGE resolve of a multisampled colour attachment whose format has Metal's resolve rule (on MoltenVK Metal's own resolve: no difference; an attachment a fetching pass holds in sample planes takes Metal's rule under either form) |
at 2 and 4 samples a unorm, snorm or packed 16-bit channel within one code of Metal's and an sRGB one within two (NVIDIA at 4 samples; one elsewhere) on RADV, ANV, NVIDIA and lavapipe, each rounding an 8-bit tie down; a float channel in its last bits, unbounded; wholly at a NaN or infinite sample (DeviceRoundedResolve) |
Differences no switch can fix (device capabilities, undefined values) are not speed choices. They
are listed in the runtime's docs/FAST-PATHS.md, "Not speed choices", and are logged the same way.
Logged gaps on our side (no accurate form yet; not speed choices)
Each is logged once per kind and counted, and the work runs. REIMS_VGPU_STRICT=1 ends the
process there instead.
| What runs instead of Metal's answer | Where |
|---|---|
| A line width other than 1 draws 1 pixel wide | reims-vgpu-vulkan draw encoding |
A half colour output stored past the bound its rounding was measured within, as blended or converted at its attachment, stores the runtime's half rounding |
draw encoding |
A draw in a pass that loads and stores a bfloat colour attachment leaves the codes its draws do not write, where Metal's tile store moves those of the tiles a draw reaches through half |
draw encoding |
A render pass over a rasterization rate map reset after the pass took it and before its command buffer's submission, in an encoder the runtime could not encode again (an encoder opened while a buffer of the device was detached, or one that left work for a host step), draws by the map as it took it, where Metal's GPU draws by the map as reset (rate-map-reset-unencoded) |
the runtime's rate-mapped passes |
Under textureWriteRoundingMode 2, a half-float attachment of a sample count no one measured at the mode resolves by the runtime's rules |
render states |
| A heap texture of unmeasured size or layout takes the runtime's size and layout | heaps |
| A draw or tile dispatch in a varying-rate pass runs on the runtime's own regions | rate maps |
| A blit fill packed in another format repeats the packed texel | blits |
| A late resolve texture beside a dropped resolve leaves the colour resolve dropped | render passes |
A texture of protection options from newTextureWithDescriptor: or newSharedTextureWithDescriptor: is made unprotected, as Metal's other creators make it, where Metal answers nil without the protected-content entitlement; its contents are not kept from the host |
device textures |
The uniqueIdentifier of a pipeline state made with indirect command buffer support, which the guest reads, is the runtime's offset in its own allocation of such states, not Metal's address (unmeasured-unique-identifier); one value for the state's life, unique among live states, the last released taken again first by kind, as Metal's |
pipeline states |
The uniqueIdentifier of an indirect command buffer made after a command buffer that encoded a render encoder was scheduled, after a resource state encoder opened, or once Metal's encoders' ranges passed what the runtime models, which the guest reads, is the runtime's, where Metal's takes more by what the device drew (unmeasured-unique-identifier); elsewhere it is Metal's address, the encoders before it taking ranges of Metal's range as an M3 Max's take them. Relayed at every such buffer (inexact-icb-identifier-after-encoder) |
indirect command buffers |
A threadgroup memory length of a compute indirect command buffer past its last command's at a word Metal keeps there of a command's pipeline, dispatch or imageblock size, or of a copy, is the runtime's, unwritten, after a setter of the command that writes the word, and after a copy into the command its pipeline words and the copy's word, where Metal's keeps the destination's pipeline words where the source's are 0; over a buffer that inherits its pipeline state a blit's copy or reset moves the words at other places than Metal's, and in a buffer made resident for writing Metal's GPU may write them (measured on the M3 Max, macOS 27.0.1). Relayed at each such read until core sets it again (inexact-icb-length-past-last-command) |
indirect command buffers |
A threadgroup memory length 36 or 37 of a command of a compute indirect command buffer that does not inherit its pipeline state, read after a copy into the command was encoded and before core set it again or a reset cleared it, is the runtime's 0, where Metal's copy carries it from a command that names no pipeline state (measured on the M3 Max, macOS 27.0.1). Relayed at each such read (inexact-icb-copied-length) |
indirect command buffers |
A function that reads a sampler state through its ID in an argument buffer reads the neutral sampler where the device's sampler tables do not map the state for its command: more sampler states live than the command's set-1 sampler arrays hold, an ID the tables do not reach, a sampler the device cannot make, or a cubic state beside a fragment stage (unlisted-argument-sampler) |
argument samplers |
A blit between a buffer and a two-plane XR10 texture that Metal's measured rows do not cover moves the runtime's rows: into a level 32 texels wide or wider whose rows meet at Metal's addresses, the earlier row's bytes stand, where Metal's GPU writes them in an order that varies from run to run; out of a texture of the device's memory, the bytes between its rows that a copy from another texture wrote read as its fills and blits with a buffer left them, where Metal's read the copy's; and a texture of more than one level, a view, a 1D or 3D texture or a surface's moves its texels at the rows it holds them in, where Metal's blit addresses its rows ⌊4w/16⌋·16 bytes apart (two-plane-buffer-blit) |
blits |
A heap's two-plane XR10 texture of more than one level, or a 1D array, keeps its first level's texels in the heap's bytes as Metal's CPU copies and GPU writes lay them and its later levels apart from them, a 1D array's GPU reads reading each texel, where Metal's paths address those texels at bytes that differ by path (heap-two-plane-layout) |
heaps |
A draw under the last provoking vertex that the runtime draws otherwise than Metal: a line from its last vertex to its first (provoking-vertex-lines); flat inputs, a computed primitive ID or a selected layer or viewport from another vertex, barycentric weights beside flat inputs Metal's but for rounding, and, at a mode from 2 up (its top bit set or not), which it draws as mode 1 and patches as mode 0, a draw whose shape Metal's third way draws otherwise as far as its state reads it: a triangle strip, lines, sized points, the triangles of a state that selects a layer or viewport, and mesh draws, not measured there (provoking-vertex-unmatched, at the draw) |
the runtime's provoking vertex |
A command predication record of the runtime's whose condition word lies past its buffer, the 256 bytes Metal rounds a lone buffer up to, or its heap reads zero, where Metal reads what its address space holds there (predication-word-past-buffer). No record reaches the runtime's predication yet: this platform's own carries it |
the runtime's predication |
A no-copy buffer, heap or rebind over pages the process maps read-only, imported as dma-bufs of its pages, lets the GPU's writes reach the pages, where after Metal's the CPU reads them as they were (read-only-pages-written). This platform imports a writable twin of such pages on Linux, and a command that may write through one dies where it is encoded, so none reaches it: a draw or dispatch through one bound at a slot its functions may store through, by the runtime's slot writes, a blit into one, a pass whose attachment, resolve or visibility results lie in one. Metal completes such a draw, dispatch, fill or pass's visibility results and drops their writes, fails the command buffer of a pass that stores a colour attachment back to one (Store), resolves into one or has a depth or stencil attachment in one, and completes one whose colour attachment there is DontCare (measured on the M3 Max, macOS 27.0.1; a depth or stencil attachment under DontCare unmeasured); a draw through one bound only at slots its functions cannot store through runs |
host imports (Linux) |
Under textureWriteRoundingMode 2, a pipeline that covers by alpha, whose function writes a float alpha to a half-float colour 0 stored as written, covers by the alpha rounded to the half Metal stores, where Metal's coverage reads it before rounding: a fragment within half a half step of a threshold may cover one sample more or fewer (coverage-reads-rounded-alpha) |
render states |
A multisampled pipeline's fragment function that reads [[sample_mask]], which Metal runs once per covered sample (it reads [[sample_id]] or a sample-qualified varying, or writes memory), and returns an output runs once per pixel, its body once per covered sample, and writes the last pass's outputs to every sample Metal's runs keep, where Metal writes each sample's from its own run: equal where every pass computes the same outputs. On MoltenVK a function that writes memory runs as written, exact (looped-sample-outputs) |
render states |
A blend the fragment function computes, of an attachment it reads through the pixel interlock (MoltenVK, RADV, ANV), in a format whose Metal blend arithmetic the runtime has not built (32-bit float, 16-bit normalized, 8-bit snorm, 10-bit, packed float, A8Unorm, an 8-bit unorm one written by fewer than four lanes, or a 16-bit float or 8-bit unorm one under a blend of the second source), is the shader's generic blend in float, and a four-channel 8-bit _sRGB one's under a blend of the second source in a module compiled with fast math is the 8-bit unorm blend's rounded forms over the decoded texel, where Metal's for these is not measured (unmeasured-fetch-blend) |
draw encoding |
A multisample resolve of an extended-range colour attachment whose resolve Metal averages from values finer than the codes it holds (BGRA10_XR's alpha, an _sRGB twin's colour) is the runtime's resolve of the codes after the pass: where a pixel's samples differ, an alpha within a code of Metal's and an _sRGB colour within a code in 99.5% of channels and up to 7 codes off where the samples' values nearly cancel (measured by the runtime on the M3 Max, macOS 27.0.1); a linear form's colour is Metal's (extended-range-resolve) |
render passes' resolves |
A render pass that loads and stores a two-plane YCbCr colour attachment and draws re-encodes the planes' codes of every 32 by 32 tile of the rectangle bounding its draws' scissors from the texels it loaded, where Metal re-encodes only the tiles a draw's primitives reach and keeps the others' bytes (ycbcr-load-tiles) |
YCbCr passes |
A draw that blends into a two-plane YCbCr colour attachment blends the pass's floats, where Metal's tile blends halfs (an 8-bit format's in half arithmetic, a 10-bit one's in float rounded toward zero): a blended texel's codes can miss Metal's by one (ycbcr-blend-rounding) |
YCbCr passes |
The runtime's answers passed on where Metal's differ (no fix of ours)
Where the runtime answers otherwise than Metal and the difference is the runtime's to fix, this platform passes its answer on, as it passes on every refusal of the runtime's: it adds no fallback or death of its own until the pin carries the runtime's fix. Nothing logs these. Each has a test that compares the cases with Metal's answers; its ignore reason names the runtime commit with the fix, and it is un-ignored at the pin that carries that commit.
None is open at the pinned commit. An entry says what the guest gets instead of Metal's answer, the runtime's fix, and its test.