The three handler-waits rows read "never-returned" in 49672 (f82dd9c768, lavapipe) without
running rt at all: rt_side left Side::handler_wait at the trait default, which answers
Unavailable("handler_wait"), and an Err where Metal never returned is the compliant verdict. So
these rows covered nothing of rt's.
- rt_side::handler_wait makes the shape as the old runtime's side does (runtime_side.rs): a
command buffer with one 64-byte fill, whose scheduled or completed handler waits on that same
command buffer and sends back what the wait answered; the side's own wait for the command
buffer and for the answer are each bounded (WAIT, 60 s), so a wait rt neither refused nor
returned from reads as never returning instead of hanging the suite.
- rt answers at once in each: a wait in a scheduled handler is Refusal::InScheduledHandler; a
completed handler's waitUntilCompleted on its own command buffer returns, the command buffer
being complete. The planner ruled that answer kept (no rt change), so known-gaps-rt.tsv holds
handler-waits-completed-until-completed on every venue as an accepted difference, quoting
Apple's sentence for waitUntilCompleted, and rt's wait_until_completed doc names where Metal's
call never returns.
Verified: nothing yet; conf-check.sh (clippy x3, the conformance tests, and a lavapipe replay of
the three cases) follows.
An open record in status.tsv now names the ratio its row was owned at (the new `owned` column,
filled for the existing entries from the matrix note of b0c08e51b5). The harness budget names a
row past its limit that an open record holds and fails nothing while the ratio it is judged by,
after its re-time, is within 3% of the owned ratio (results.OWNED_WORSE); more than 3% worse, the
row fails its leg again. A known gap's row fails only past a ceiling a ruling gave it
(HARNESS_CEILINGS), as before; one without a ruled ceiling is listed and fails nothing. The
report's table shows the owned ratio and whether the row is within it, and after the table names
every open record and gap whose rows are within their limits on every leg of their card that
timed them, for removal (results.entries_within).
A cross-GPU outlier of a harness row's time on the new runtime no longer fails a leg from one
pass: once every leg is in, the legs with one have their harness timed once more (Run.retime: a
node's legs in turn, the nodes at once, each job holding its node alone), and an outlier fails
only where both passes agree (results.time_outliers with the first pass); one that only one pass
has is parked and named. Outliers of other records fail at once, as before.
Verified: the matrix's unit tests (test_results.py, test_matrix.py), run from scripts/matrix in
a potluck job; new tests cover the owned verdicts (within, worse, re-timed, a first take), the
gaps with and without a ruled ceiling, the removal list, the two-pass outlier rule and the
re-time's jobs.
After the play, the new runtime's backend ends its device (NewRuntime::end) and now hands back
what it read once the device dropped (Ended: every rt::Gauges field by name, threads as the
slots still held, whether all read zero, whether it quiesced). command-replay writes one line per
gauge into the report, "M2V-MATRIX gauge replay-rt/device/GAUGE@drop N", the matrix's own record
form (scripts/matrix/results.py's RECORD pattern; its rule fails a gauge not 0 at @drop), so any
play job's output can be checked by that rule. The teardown error now names only the gauges not
at zero. The old runtime's counts end with its device, so its plays print none.
Tests: a unit test of the lines' form and the error's naming; the rt device test of a play that
ends with a command buffer held asserts every line is "M2V-MATRIX gauge KEY@drop 0". The stream
guide's report section says so. Checked by the lane's check job (named in the report to main).
On the UHD 630 leg (Windows, libtest: every test in one process, one at a time) the test binary
aborted at tests::mipmaps (m3-max-50267 at ec4a540e1b, m3-max-50304 at 63fe797d12): "Unable to
load cmd_blit_image", a panic in an extern "system" function, which cannot unwind. The layouts
test set RECORDING and never cleared it, so every device made after it in the process took the
recorder's table, in which vkCmdBlitImage was an unrecorded command left unloaded; since
4df69ca062 rt records vkCmdBlitImage (generateMipmapsForTexture:). nextest runs each test in a
process of its own, so the Linux legs never met it.
- The recorder records vkCmdBlitImage (its source and destination layouts), as the module's
contract asks of every layout-naming core command rt records; vkCmdBlitImage2 stays unrecorded.
- The test sets RECORDING through a guard that clears it when the test ends, unwinding included.
Verified: nothing yet; the UHD leg follows.
replay's census C: the window server (b3) makes 425 textures over its no-copy buffers, and every
no-copy buffer is now an import, so refusing them (Gap::TextureOverBuffer in d335594515) would
refuse the window server's textures. They take rt's existing copy form instead: an image of its
own, which the device copies the buffer's bytes into before the submissions that use it and back
after a command writes it, counted in Metrics::over_copies. The buffer stays the import itself.
The runtime makes no image in imported memory. Such an image would be made for the import's
handle (VUID-vkBindImageMemory-memory-02728), so in the undefined layout
(VUID-VkImageCreateInfo-pNext-01443). An acquire from VK_QUEUE_FAMILY_FOREIGN_EXT is not used: it
needs a matching release (7.7.6), which host writes do not make (host memory imported by its
address is shared with the host as host access), and it leaves an aliasing resource's contents
undefined (7.7.6). Whether an in-place form exists stays open with the planner until the copy's
cost is measured.
- check_over answers the copy for a buffer in an imported block; Gap::TextureOverBuffer's doc
goes back to its old cases; new_texture's doc and the README say how such a texture is made,
and the README records it as a known gap.
- Tests: the import device tests run on every platform (host memory from std::alloc; the
shared-file mapping test unix-only), so the Windows UHD leg runs them. A texture over imported
host memory is copied on every device, reads the host's own bytes, its writes reach the host,
and both copies count in over_copies.
- REFUSALS regenerated for the import limits (the rebase took development's at d335594515).
Verified: nothing yet; the check job and the device legs follow.
c80eae3e98's check (m3-max-49028) passed everything but clippy under --cfg m2v_gpu and
m2v_cpu_icd: releasing() returned (Option<Box<dyn FnOnce() + Send>>, Arc<AtomicBool>), a type
clippy::type_complexity refuses. The crate's own alias for that box names it.
Verified: nothing yet; the next check job follows. The device legs run on c80eae3e98's archives,
whose test code differs from this commit's only in the alias.
m3-max-48960 (73dd097c82) failed CLIPPY_GPU and CLIPPY_CPU_ICD with E0618 at tests/import.rs:316
and :465: a second release() call in a scope whose first bound release. Renamed; tests only.
Product code compiled there (CLIPPY_ALL, CLIPPY_NOFEAT, DOC, the rt and harness suites 0).
Three consumer-facing statements of what rt does now:
- Known gap: rt caps a buffer at MAX_BUFFER_LENGTH (2 GiB) where the M3's Metal allows
38.88 GiB (maxBufferLength 41,747,087,360 bytes, measured by reims), about twenty times as
much. The cap is the translator's 32-bit offsets from a bind address, which bought 4.3-6.6% on
AMD and more on the RTX 3090 in the constant-reads probe, where a 64-bit sum without them was
8.9% slower on the RX 7900 XTX (the planner's figures). Nothing changes in code.
- maxMemoryAllocationCount: imported blocks count too, and why rt counts its own (Vulkan leaves
an allocation past the count undefined, VUID-vkAllocateMemory-maxMemoryAllocationCount-04101,
and VK_ERROR_TOO_MANY_OBJECTS is not promised). The count, its typed refusal
(Limit::MemoryAllocations) and its gauge (Gauges::blocks) were already built
(memory::allocate; device tests in tests::memory); 4,096 is the lowest venue (Mesa's Mac driver).
- The consumer's mappings: a kept block keeps its region; BlockMappings::unmap runs only when the
block ends (its allocation freed, or its bytes given back for a take of another length), so a
take of its length hands back the same block, mapped already. Read from memory.rs: retire()
is called only from the unkeep path, a spilled block's give-back, free_idle and teardown.
Docs only.
Metal's newBufferWithBytesNoCopy:length:options:deallocator: is the memory it was made over. rt
had no import; reims refused every no-copy buffer. Two calls now make a block over the
consumer's memory, which the consumer places buffers in with new_buffer as in a block it took:
- Device::import_host_memory(pointer, len, release) (unsafe; VK_EXT_external_memory_host):
the first type the pointer's query offers that is host-visible, host-coherent and listed by
the buffer's requirements. contents is the pointer.
- Device::import_dma_buf(fd: OwnedFd, len, release) (unix; VK_KHR_external_memory_fd and
VK_EXT_external_memory_dma_buf): only the FIRST type the fd's query offers, and only where it
is host-visible, host-coherent and listed; otherwise Limit::ImportType with nothing attempted.
On NVIDIA (620.70.06) one failed dma-buf import into a later offered type broke every later
ordinary allocation of that type, rt's Shared type among them (probe fail4, job 48691-era),
so the rule attempts nothing it is not sure of. The fd: the driver owns it after Ok; after a
refusal or a failed query rt closes it; after a failed import rt closes it only where it
still names the same file (fstat dev and inode), as a driver may close it itself.
Both return the block with the memory type index taken, and refuse before any allocation:
Limit::NoImport (extensions not enabled, or vkGetPhysicalDeviceExternalBufferProperties not
IMPORTABLE for rt's buffer usage), Limit::ImportType, Limit::ImportAlignment (0 bytes, off
minImportedHostPointerAlignment, or below the buffer's requirements), Limit::BlockLen. Each
import is one VkDeviceMemory through memory::allocate, so it counts against
maxMemoryAllocationCount (Limit::MemoryAllocations before the driver is called) and
Gauges::blocks; Gauges::imports counts the live ones. The last handle's drop hands the block to
the block-maker thread, which destroys its buffer, frees the memory (counted as a free for
submissions_during_frees) and then runs release, Metal's deallocator; at teardown the thread that
tears down does. BlockMappings::unmap never runs for an import. The three extensions join
floor::OPTIONAL_EXTENSIONS (enabled where listed). new_buffer's zeroing goes by whether the host
maps the block (a dma-buf block is zeroed by the GPU fill), and a texture over a buffer in an
imported block is Gap::TextureOverBuffer (an image bound to imported memory must be made for
its handle).
Tests: unit tests of both rules over the venues' measured answers; device tests (unix) of a host
import (GPU fill reaches the pointer, release only after the free, gauges back), an ordinary
32 MiB Shared allocation after an import of a shared file mapping whatever its answer (RADV
refuses it at the import), the import counted against a faked maxMemoryAllocationCount, and
(Linux, /dev/udmabuf) a dma-buf imported into its first offered type or refused at the query
with a Shared allocation and a host import after it.
README (Imported blocks, the floor's extensions, the known-gap line), REFUSALS.md and
api_signatures.tsv regenerated. Verified: nothing yet (no local builds); the check job and the
device legs follow.
clocks.rs said the Windows CPU clocks' step "was not measured". The first Windows run measured it:
job m3-max-50344 (homelab-mac-mini-2018, Intel UHD Graphics 630, driver 101.2145, Windows 11),
`conformance times --leg ours --runs 1 --show host-page-writes-kernel-store-writable`, read the
thread clock as 0 us for five calls (buffer, host_buffer, library, read_buffer, render) and as
exactly 15,625 us, 1/64 s, for a compute_pipeline call whose wall time was 8,465 us.
GetThreadTimes counts in 100 ns units but moves by the scheduler's tick, so a per-call `on cpu`
figure there is 0 or whole ticks, not the call's CPU time. The doc now says so; the code is
unchanged. Docs only.
Verified: the figures are job m3-max-50344's output; no build needed for a doc comment (fmt run).
CI's Windows clippy line (`cargo clippy --target x86_64-pc-windows-gnullvm|msvc -p metal2vulkan
... --all-targets --all-features -- -D warnings`) failed in crates/metal2vulkan/tests/cli.rs:
`Mutability`, `RenderPipelineDescriptor` and `ReproBundle` were imported at the top of the file,
and their only user, `a_runtime_bundle_replays_the_refusal_on_the_device_it_names`, is
`#[cfg(unix)]` (it runs a bundle's `repro.sh`), so on Windows the three imports were unused and
`-D warnings` stopped the build. They are now imported inside that test. Nothing else changes.
Verified: job m3-max-50254 (msi, at a55a6945bb) showed the failure, STEP
clippy-x86_64-pc-windows-gnullvm EXIT=101 and clippy-x86_64-pc-windows-msvc EXIT=101, three
unused imports each, while the Linux steps were 0; the re-check at this commit follows as a job.
The conformance command did not build for Windows: `src/clocks.rs` read the two CPU clocks with
`libc::clock_gettime` and the load average with `getloadavg`, and `src/host_pages.rs` mapped a
no-copy buffer's pages with `libc::mmap`, none of which `libc` has on Windows. So the Windows host
(a supported metal2vulkan-rt host) could not replay the suite.
On Windows the thread's and the process's CPU clocks are `GetThreadTimes` and `GetProcessTimes`
(kernel plus user, in 100 ns units), and the pages are a committed `VirtualAlloc` released with
`VirtualFree`, the forms metal2vulkan-runtime already uses. Windows keeps no load average, so
`host_load` answers `None` there, which the timing report already reads as "this host answers no
load average" and the per-call gate already judges on what the host does answer. `libc` is now a
unix-only dependency and `windows-sys` a Windows-only one, as in the runtimes.
A new unit test holds both CPU clocks to answering and moving while the thread computes, so a host
form whose call fails or reads a constant is seen. CI's Windows clippy now names the conformance
crate, so the Windows build is held from Linux.
Verified: unverified at this commit; the compile check and the Windows run follow.
On the old runtime's player, a heap with a recorded range is now made by what the stream places
in it (read ahead), whatever its type:
- its buffers go in a heap at the recorded address and of the recorded size, each at its
recorded offset, never laid out again (a pinned span never grows);
- its textures go in a heap outside the pinned space, laid out for the runtime's sizes as the
texture-only rule did. It is one heap, so textures placed at one offset still share.
Buffer-only = the pinned heap alone, texture-only (or nothing placed) = the outside heap alone,
mixed = both. Backend::holds_no_buffer becomes Backend::split_heap(heap, HeapSplit); the old
backend holds a split heap as Object::Heap(buffers' heap, textures' heap), and useHeap: uses
both. A buffer the runtime refuses at its recorded offset in its heap now stops the play typed
(PlayError::Unpinned with the runtime's reason) instead of as a Runtime error.
Why: u4's old arm stopped at f1033 on mixed heap #188906 (4 MiB placement, 2600 buffers and 1000
textures over its life): the relayout grew it for the runtime's texture sizes, and the pinned
heap's grown span met #188909, recorded 0x8968 bytes past the heap's Metal span. u2 and u3 carry
the same heap twice each, u4 again at f1059.
The report line becomes "pinned N of N; K heaps' textures outside; S textures whose recorded
range (by the runtime's texture sizes) met a live buffer's". S comes from the read-ahead: a
texture's range is the heap's recorded address plus its offset for the runtime's size answer
(the stream holds no texture size), a buffer's its recorded range; reported, not a stop. The
heap code moves to replay/heaps.rs (relay, placement helpers, HeapSplit, Overlaps).
Safe by census (jobs 50282-50286, every stream on five nodes, 29 names): every heap is a
placement heap; no call takes a heap as receiver except the placements, none names a heap as an
argument, and no heap or size getter is recorded; the only calls on heap resources are
m2v.privateBytes on heap buffers and texture views of heap textures, neither compared. The
automatic-heap half rests on its unit test, as REPLAY-STREAM.md now says.
Tests: unit tests for the three shapes (textures alone, buffers alone with an alignment that
would move them, mixed with a larger texture and a met buffer) and for automatic heaps; a
lavapipe device test of a mixed heap whose texture the runtime makes larger, with a buffer
pinned right past the heap's recorded span that keeps its address. The negative control (no
split told, the whole heap relaid) must fail them; the check job and its inner codes are named
in the report to main.
The planner's ruling on the format capabilities: nothing is built until a
count shows a guest asking for a format the device lacks; what is true today
is said where the method is read. The description, flags included, is an
Apple GPU's; a format this device lacks is still described, and is refused
where a texture of it is made, with Gap::TextureFormat.
Doc only. Verified: this commit's tree is 33d80430d7's, whose check
m3-max-50365 passed every inner code (clippy x3, rustdoc -D warnings,
rt lib tests 117/117, doctests, api_signatures).
The new runtime answers heapBufferSizeAndAlignWithLength:options:
(Device::heap_buffer_size_and_align(length, options) -> SizeAndAlign) so a consumer places its
heap buffers by rt's answer. The answer is Metal's measured one: the conformance recording
device-heap-buffer-sizes.json (an Apple M3 Max, macOS 27.0.1, three runs) answers the length
unrounded and an alignment of 256 for lengths 1, 15, 255, 256, 257, 511, 4096 and 1 MiB under the
default, Private, Managed, write-combined and untracked options; the old runtime answers the same.
The size is therefore the length, not the length rounded up to 256.
The alignment is a constant, HEAP_BUFFER_ALIGNMENT in buffer.rs, with its reason beside it: rt
takes a buffer at any byte of a block, and every per-use rule it has holds for a buffer at a
multiple of 256 of its block (whose own first byte lies at a multiple of 64 KiB of its
allocation): a bound argument's alignment of at most 16 (Refusal::BufferOffsetAlignment),
indirect arguments at a multiple of 4 and indices at a multiple of their size
(Refusal::ArgumentPlace), a fill's 4-byte words and a copy's texel block. Vulkan bounds
minUniformBufferOffsetAlignment, minStorageBufferOffsetAlignment and minTexelBufferOffsetAlignment
at 256 (the required limits table, "max"), so no device asks more. An answer that moved with the
host would buy nothing, and a later placement rule changes it in one place. The options are
Metal's raw MTLResourceOptions, which the answer does not read. The doc names the Metal
counterpart and what differs: nothing, but that the answer is the same on every device.
A unit test holds the answers for 0, 1, 15, 255, 256, 257, 511, 4096, 1 MiB, MAX_BUFFER_LENGTH
and u64::MAX. The rt README names the call beside new_buffer and among the heap answers the
consumer takes from rt. api_signatures.tsv blessed: one record added. docs/REFUSALS.md
regenerated with no change.
Verified: unverified at this commit; the compile check and the tests follow as a job.
The new runtime answers Metal's two format SPI calls, MTLPixelFormatGetInfoForDevice
(Device::pixel_format_info(raw) -> PixelFormatInfo) and
MTLGetTextureLevelInfoForDeviceWithOptions (Device::texture_level_info(&TextureLevelQuery) ->
TextureLevelInfo), so a consumer's textures piece can take them from rt. They are moved as they
are from metal2vulkan-runtime's pixel_format_info.rs: the measured table of the 264 values an
Apple M3 Max describes under macOS 27.0.1, the level rule, the three public types (PixelFormatInfo
and TextureLevelInfo non_exhaustive with public fields, INVALID, describes_a_format, words,
TextureLevelQuery with plane_2d) and their tests (src/tests/pixel_format_info.rs). Both are pure
functions: no Vulkan call, no device query, the same answer on every device. The old runtime is
not touched and keeps its copy until the cutover deletes it.
What changed in the move: rt has no device generations, so the methods call the functions
directly; the old crate-private helpers no rt code uses (describes, depth_or_stencil and its
DEPTH_OR_STENCIL bits) are not carried, and the one test that read describes reads
pixel_format_info itself. Two doc examples on the methods compile as a crate outside rt and read
every field of both answers and build a TextureLevelQuery field by field, so a consumer can use
every answer. The rt README's Textures section names both calls, and its known gaps of textures
the values 630 to 645, which an Apple M4 describes and these answer INVALID. api_signatures.tsv
is blessed: 34 records added, none removed or changed. docs/REFUSALS.md regenerated with no
change (no refusal moved).
Which PixelFormatInfo fields are capabilities rather than byte layout, from the code and the
tables we hold (nothing built for this):
- name is the format's identity; words are layout (a block's bytes, width, height and depth for
a format of blocks; else the texel's bytes, a packed word and two words Metal does not name).
- cast_class is the class of formats a view may reinterpret the format as: a view capability,
but Apple's GPU's, fixed per format.
- flags is Apple's word. The code names three bits only: 0x400 (a format of blocks: layout) and
0x20 and 0x40 (depth and stencil aspects). No document and none of our code names the rest; they
are the bits that may carry Metal's per-format capabilities on that GPU (render, blend, filter,
multisample, write), and nothing here decodes them.
Does any field say yes where rt says no on a floor driver? At the level of the description,
yes: a described format answers a full description (describes_a_format, its name and words)
where rt makes no texture of it. The driver profiles under
crates/metal2vulkan-validation/profiles report textureCompressionASTC_LDR and
textureCompressionETC2 false on RADV, NVIDIA and lavapipe, so rt's Device::new_texture answers
Gap::TextureFormat there for the 48 ASTC formats and the ETC2 and EAC formats (expected from
texture.rs's plan(), which takes the translator's format table and the device's image format
query; not run). On every device rt makes no texture of a format whose texels the shader converts
(the extended-range BGRA10_XR family, the 4:2:2 formats GBGR422 and BGRG422), nor of PVRTC, which
Vulkan has only through an IMG extension; all of them are described here. For the unnamed flag
bits the question cannot be answered from what we hold: it needs a probe on the Mac naming the
bits, and rt's per-format answers on each floor driver, which the profiles do not record (they
hold features and properties, no format feature tables), so a floor-driver run of the format
feature queries would be needed as well.
Verified: unverified at this commit; the compile check and the tests follow as a job.
The GPU legs' archive held metal2vulkan-rt alone, so the replay player's
stream device tests (metal2vulkan-validation's runtime_lane::replay_streams,
17 on the old runtime, and runtime_lane::rt_replay, 24 on the new) ran on
lavapipe only. A break in the player or a runtime's stream path that only a
GPU shows waited for a lane's play of a recorded stream to find it, as the
old arm's pin stop did. The archive now holds the validation crate too, and a
leg runs the runtime's tests and those two modules (DEVICE_TEST_FILTER). The
Windows leg is unchanged until the validation crate is shown to build there.
status.tsv, by the planner's ruling of 2026-11-18:
- 10de:1e87 frame_5cb is a gap row: the runtime guide's known gaps carry it
(crates/metal2vulkan-rt/README.md, NVIDIA's latency per submission).
- 8086:a7a0 frame_5cb and 10de:2204 create_state/first are within their
limits; their closed lanes' names are cleared (a row gets an owner when it
goes over).
- identity's rows wait for their card's native table, the guest-visible test;
"Iris swing unresolved" was stale.
Verified: see the check job named in the landing message (unit tests of the
matrix script, the archive built with both packages under --cfg m2v_gpu, the
filter's selection listed, and the selected tests run on a GPU).
identity's scripts lost 50152's record when they deleted the job's temporary directory, where
report.txt lay. The planner ruled that the player prints each report line and each frame-end line
to stderr as well as to report.txt, so no script can lose them.
ReportFile, the one writer of report.txt, now implements Write. Each write goes to the file and
then to stderr, and the player's frame lines go through it (with_frame_lines takes the report
rather than its file). A failed stderr write never fails the file's. REPLAY-STREAM.md section 10
and the binary's docs say where the lines go.
Test: the range test's helper runs command-replay and asserts that its stderr carries every
report.txt line, in order. All its plays stop before a device opens, so no device is needed.
glbench-3090-r4's old arm stopped at f198: buffer #22759, pinned at 0x4020086d8000 (32 KiB past
heap #22754's recorded end), met the span the old runtime held for #22754. #22754 is a placement
heap that holds six RGBA16Float textures and no buffer. The player lays placement heaps out again
for the runtime's texture sizes, and grew it from 2 MiB to about 2.5 MiB; pinned at its recorded
address, the grown heap held #22759's pages. In Metal the two never meet.
The rule (the planner's): on the old arm a heap is pinned only where the stream places a buffer
in it. A texture has no address and a heap answers none, so no address the program holds lies in
a heap without buffers, and pinning it buys nothing. The read-ahead finds those heaps from the
stream alone, never from the runtime's size answers or what the space holds, so the old arm's
address layout is the same on every card. The player tells the backend before the making
(Backend::holds_no_buffer). The old backend makes the heap outside the space, and the address map
keeps its recorded range at its recorded address, so the address census is unchanged. A heap that
holds a buffer keeps its recorded address and the typed stop where its grown span meets another
pin.
The report's pinned line now says "pinned N of N; K heaps without buffers outside: ...".
REPLAY-STREAM.md sections 5, 9 and 10 say so.
Tests:
- a_heap_without_buffers_is_made_outside_the_recorded_addresses (player, no device). The test
backend pins. A texture-only heap is told and made outside; a heap with a buffer, and its
buffer, are made at their recorded addresses. A word into the outside heap's range is still
counted, and no word moves.
- a_heap_without_buffers_leaves_the_next_pin_its_address (old runtime, device). A 64-KiB pinned
heap holds only a 256-KiB texture, and a buffer is pinned at the first granule past the heap's
recorded span. Without the fix the grown heap's span holds the buffer's and the play stops.
A state of Metal's rasterizationEnabled NO was a VkPipeline of a static
rasterizerDiscardEnable, which leaves the fragment shader and fragment
output state out of the pipeline: its colour formats then count as none
against the pass's (VUID-vkCmdDraw-colorAttachmentCount-06179), and the
depth, stencil and blend state the encoder records as dynamic before every
draw is no state of the pipeline at all (VUID-vkCmdDraw-None-08608). The
validation layer reported both at the draw of a vertex function that stores
with rasterization disabled (rt's new device test, at d79a8faf73: the UHD
630 in m3-max-50124 and the M3 Max in m3-max-50120); the stores reached
their buffer.
Such a state now takes VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE (Vulkan
1.3's, no feature), always gives its colour blend state, and the encoder
sets the discard where it binds the pipeline, since a bind of a pipeline
whose discard is static leaves the dynamic value undefined. A state with
rasterization keeps its static discard and is made as before. The README's
list of a pipeline's dynamic state names it.
A vertex or post-tessellation vertex function may write and atomically
update device memory in Metal. rt never enabled
VkPhysicalDeviceFeatures::vertexPipelineStoresAndAtomics, so the translator
refused every such render state as StageStoresAndAtomics, "needs
AnyOf([[Feature(VertexPipelineStoresAndAtomics)]])": 13 tessellation
conformance cases, whose post-tessellation vertex functions record their
domain points and patch tags with stores, were refused on every rt venue.
Every floor driver reports the feature: lavapipe (Mesa 26.2.4), RADV 26.2.6
(RX 7900 XTX, 780M Phoenix, 780M HawkPoint, RX 550), NVIDIA 620.70.06 (RTX
2080, RTX 3090) and 615.71.09 (RTX 5080 Laptop), ANV 26.2.6 (Iris Xe),
Intel's Windows driver (UHD 630) and KosmicKrisp 26.3.1 (M3 Max): venue
dumps m3-max-48727 to 48731, 48736 and 48737, and query m3-max-50101 for
the RX 550. So it joins the floor's required features, BelowFloor naming it
where a device lacks it, and the README's floor table names it.
Tests: the floor test's device at the floor states it and its
missing-feature case names it; a device test draws
rvc_draw_bases' draw_bases_in_a_vertex_function with rasterization
disabled, each vertex of two instances storing its ids and the draw's bases
to its own slot, which fails without the feature (the state is refused).
glbench-780m-r2's old arm stops after 379 frames at setLineWidth:, Apple's private
line width ("not played on a render encoder"; play 50122, player 8fd5b8b587).
The old runtime has RenderCommandEncoder::set_line_width, which draws the width
as Metal does. The backend now plays the call through it. This is a player
change only.
Test: render_encoder_setters_play_with_their_effects gains a pass. A line 3
wide crosses the 4 by 4 target through row 1's centres, and rows 0 to 2 are
checked green, where a line 1 wide draws row 1 alone.
Clippy (check 50096, --cfg m2v_gpu and --cfg m2v_cpu_icd) refused the doc
paragraph after the list as list items without indentation, and the cases'
tuple type as too complex. A blank doc line ends the list, and the tuple is
the local type Case.
render_encoder_setters_play_with_their_effects bound the colour attachment
setter's arguments as `args`, shadowing the case's draw arguments, so the
draw call passed an array where a slice was meant (E0308 under --cfg m2v_gpu
and --cfg m2v_cpu_icd, check 50080). The attachment arguments are `attachment`.
The old arms stopped one render-encoder call at a time:
- glbench-3090-r4 after 335 frames at setViewports:count: (play 50055,
player 90298cb0df);
- earlier, setColorStoreAction:atIndex: and setDepthStoreAction:.
Comparing the selectors the two backends play gives sixteen render-encoder
calls that the new backend plays, the old backend refused, and the old runtime
has. The backend now plays all of them through the old runtime's own calls:
- setViewports:count:, setScissorRects:count:;
- setCullMode:, setFrontFacingWinding:, setTriangleFillMode:,
setDepthClipMode: (and SPI), setDepthBias:slopeScale:clamp:,
setBlendColorRed:green:blue:alpha:;
- set{Vertex,Fragment}Bytes:length:atIndex:, setVertexTexture:atIndex:;
- the single vertex and fragment sampler forms, with and without LOD clamps;
- setVertexSamplerStates:withRange: and its form with clamps;
- drawPrimitives:...:baseInstance:;
- drawIndexedPrimitives:...:baseVertex:baseInstance: (a negative base vertex
as recorded).
The single-viewport, single-scissor and sampler-list parsers became shared
helpers. This is a player change only; drawPatches, the tessellation factor
buffer, parallel encoders, setStageInRegion:, synchronizeTexture: and
optimizeContentsForGPUAccess: stay refused.
Test: render_encoder_setters_play_with_their_effects (device,
runtime_lane::replay_streams, on the old runtime). Eight passes draw the owned
fixture cof_offsets, each into a 4 by 4 target cleared red, and each target is
checked for its setter's effect: bytes, a left-half viewport, a top-half
scissor, culling under each winding, lines around the target, base instance 1,
base vertex -3. The setters with no visible effect play before the first draw.
rt_replay's metallib helper now takes the fixture's path (library_of).
The tessellation-rendered-patches case (d0317d17a6) added the public fixture
engine/tess_rendered_patches: its inventory and golden-hash rows and its
air_input printout are new. The authored compile census re-blesses six rows
whose artifact hashes moved with the translator commits since the last bless;
no row's status changed (the two StageStoresAndAtomics refusals stand).
Verified: bless job m3-max-50098 (inventory=0 golden=0 printouts=0) and
census job m3-max-50099 (census-exit=0), both at a3ff94f510 on the M3.
The recorder will note a buffer whose address may escape into the program's memory: once in the
buffer's life, at the first gpuAddress read (kind 0), argument-encoder write (1), gpuResourceID
read of a texture over it (2) or residency-set add (3); the whole buffer escapes. No stream
carries the note yet.
The player now reads m2v.bufferEscaped: the receiver must be a made object and the one argument
a kind from 0 to 3, else the stream is invalid. Once a buffer's note is read, a written word that
looks like an address (the census's aligned words) whose value lies in that buffer's recorded
range stops the play with PlayError::NotedWord {target, offset, value, buffer, kind}. Moving such
a word is not built: no stream exercises it, and the move gets built with the first stream that
does. AddressMap::noted_word finds the word at any nesting level. The lookup runs only once a
note was read, so a stream without notes pays nothing for it.
The report counts the notes (Report::escape_notes); the addresses line ends "the stream predates
the escape note" where there are none, "escape notes N" otherwise.
Test (unit, a synthetic stream): a note, then a write of a word into the noted buffer stops,
naming the word; the same kind of word into a buffer with no note played as written before it;
a kind past 3 and a note of an unmade object are invalid streams. docs/REPLAY-STREAM.md section 5
holds the record and the stop, section 10 the line.
Verification: the replay checks run as a potluck job on this commit.
The player rewrote every 8-byte word of written bytes whose value lay in a live recorded range.
On a stream recorded before the escape note a word's value cannot tell an address from data,
and on u4 that rewrote two 32-bit indices of an index array into an address of the play, which a
kernel later read through out of bounds (the rewrite-off control played u4 whole with no fault).
Now no written word moves on its value, on either runtime:
- The address map's word pass is a census that writes nothing (AddressMap::census). It counts
address_looking_words (aligned 8-byte words in a live range) and misaligned_address_words in
the same bytes as before: writes, copied contents, guest-RAM copies and Private bytes before a
dispatch into objects that answered a gpuAddress, and set*Bytes data. Both are stream-fixed,
equal on both runtimes.
- What moves are typed address arguments (tag 8), through the map: relocated_words now counts
only those that moved, so it is zero on the old runtime, whose ranges are at their recorded
addresses.
- unrelocated_writes is deleted: no written word is relocated anywhere, so it meant nothing.
- A Private range's bytes after a dispatch are compared as recorded.
- The report's relocation line becomes "addresses address_looking_words=N
misaligned_address_words=N address_arguments=N relocated_words=N differing_ids=N: written
words play as recorded; the stream predates the escape note".
Tests:
- unit: written words play as recorded and are counted; a typed address argument moves with its
object (and one in no range stays); guest-RAM copies and copied contents play as recorded;
the census counts by alignment.
- device, rt: a data word in a live range plays as written (sha check); the census is the same
on the old and new runtimes (and the old pinned both objects).
- The rt granule test read the runtime's addresses through relocated words; it now checks the
places line's slack (each place spans its length rounded up to its recorded granule).
docs/REPLAY-STREAM.md sections 5 and 10 and docs/VALIDATION.md say the new form.
The escape note (m2v.bufferEscaped) and the stop on a word into a noted buffer follow in their
own commit.
Verification: the replay checks (clippy in three configurations, replay unit tests, the replay
device tests on lavapipe, rustdoc) run as a potluck job on this commit.
every_case_carries_a_cost_recording names each case a whole-set
`cost --write` has not covered. tessellation-rendered-patches lands without
a cost record (a record is a whole-set measurement, and `cost --alone`
folds into one that does not exist yet), so it joins the cases authored
after the last whole-set run; the next whole-set run fills it and the test
then asks for the name to go.
The suite's tessellation cases read the tessellator's domain points with
rasterization off; none renders a patch. This case draws the owned fixture
tess_rendered_patches (a triangle patch of three control points fetched per
patch control point, a colour fetched per patch and passed flat) into an
8 by 8 RGBA8Unorm target under a recorded stream's patch-draw state
(fractionalOdd up to 64, factors per patch, counter-clockwise), with the
factors 8 bytes into their buffer. Two passes: `drawn` draws patches 0 and 1
(patch 1's zero edge factor culls it), then patch 3 alone from patch start 3;
`back-culled` culls back faces and draws all four, where patch 3 is patch 2
mirrored. Every texel is 0 or 255 per channel and no slanted edge meets a
texel centre, so the answer is exact whatever the tessellator's inner
points.
Recorded on the M3 Max (macOS 27.0.1) in job m3-max-49694, with its times;
a test holds the recorded texels to the module's description of Metal's
answer. The case lands without a cost record: a cost record is a whole-set
measurement, and `cost --alone` folds into one that does not exist yet.
docs/CONFORMANCE-COVERAGE.md regenerated.
rt's render encoder takes a tessellation factor buffer and patch draws
(set_tessellation_factor_buffer, draw_patches), but the conformance suite's
rt side answered both render steps as Unavailable, so every case that draws
patches read as refused on `conformance replay --rt`. The side now hands
each step to the encoder: the factor buffer with its offset and instance
stride, and the patch draw with its control-point count, patch start and
count, patch index buffer and offset, instances and base instance, as the
old runtime's side plays them.
A fragment function's second output for colour attachment 0
([[color(0), index(1)]]) is Metal's dual-source blending. rt never enabled
VkPhysicalDeviceFeatures::dualSrcBlend, so the translator refused every such
render state as DualSourceBlending, "needs AnyOf([[Feature(DualSrcBlend)]])",
on devices that have it (the replay streams' #78848 on the 780M and #108626
on the 3090). Every floor driver measured reports it: lavapipe (Mesa 26.2.4
and 26.2.6), RADV (RX 7900 XTX, 780M, RX 550), NVIDIA 620.70.06 (RTX 2080,
RTX 3090) and 615.71.09 (RTX 5080 Laptop), ANV (Iris Xe), KosmicKrisp 26.3.1
(M3 Max): feature queries 49863, 49864, 49865, 49866, 49881. So it joins the
floor's required features, with BelowFloor naming it where a device lacks it,
and the README's floor table names it.
Tests: the floor test's device at the floor states it and its missing-feature
case names it; a device test draws stage_io_fragment_dual_source's two outputs
blended by Source1Color and Source1Alpha, each texel a quarter of the first
output, which fails without the feature (the state is refused).
The old runtime's player now makes every buffer with a recorded range at its recorded address.
The test recorded its two output buffers 4 KiB apart, inside one pin's span, which the runtime
refuses (PlayError::Unpinned stopped the play). Metal's pins lie at least a granule apart, so
the second buffer is recorded 32 KiB past the first. The addresses play no other part in the test.
Verification: the replay device tests on lavapipe run as a potluck job on this commit.
The player's old backend made each object where the runtime had room and relocated every
8-byte word that lay in a live recorded range. A data word whose value happened to lie in one
(two 32-bit indices in a pixel-sized index array) was rewritten into an address of the play,
and a later kernel read through it out of bounds.
Now the old backend makes every object that answered a gpuAddress at that address
(AddressPlacement::At): device buffers of every making form, blocks and heaps, the
descriptor's pinnedGpuAddress aside, so heaps take their answer too. Every other object, and
the player's own staging, readback and host buffers, go Outside ([2^47, 2^48), past every span
a pin can take). A refused pin, or an object made at another address than it recorded, stops
the play with PlayError::Unpinned naming the object; no other placement is tried. The address
map still runs, with each range's base its recorded address, so it moves no word, every
address argument plays as recorded, and relocated_words and the other stream-fixed counts stay
equal across runtimes. The report adds "pinned N of N".
The new runtime's backend is unchanged (Backend::places_at_recorded defaults to false).
Tests (device, old runtime): the pointer-chain test now also asserts its four objects pinned;
a data word in a live range plays as written; a pin inside another's span stops typed.
docs/REPLAY-STREAM.md sections 5 and 10 describe the form and the report line.
Verification: the replay checks (clippy in both cfgs, the replay unit tests, the replay
device tests on lavapipe, rustdoc) run as a potluck job on this commit.
A device test's link line (every_device_streams_a_capture_past_the_ring, m3-max-50040, rt at
e57ebfc095): on the RTX 5080 Laptop GPU's internal link, 64 MiB copied from a Shared buffer into a
Managed buffer's device copy took 4.49 ms, then 3.94 ms, on the GPU (14.94 and 17.01 GB/s). The 3090
in its Thunderbolt 3 enclosure takes 33.4 ms for a 63.3 MiB ring-full, so the internal link takes
about an eighth of the time.
NVIDIA's first take of a new 16 MiB Private buffer. On the 3090 and the 2080 the first take ran
1.10 to 1.34 times old's. A probe on ac1896537f split it. The fill rides in the take's own
submission: one vkQueueSubmit2 with one submit info, the upload leading the command buffer, and
23-26 us on the GPU. The added time is that submit call itself: 603 us on the 3090 and 579 us on the
2080, against a median of 2 to 3 us. The call began 67 us (75 us) into the block-maker's next 16 MiB
Private vkAllocateMemory of 661 us (647 us), which the take had set off by leaving the class under
8 MiB free, and returned 9 us (7 us) after that allocation. Driver 620.70.06, um870's 3090 and
um790's 2080, jobs m3-max-50032 and 50033 (probe 71841cbe6b).
The planner ruled it a known gap, not a fix: the hold is bounded by one allocation per block made,
which is the time the take would spend allocating on its own thread, and the only dodges are a
timer or an idle guess. So:
- the rt README's known gaps of memory blocks say it;
- 10de:1e87's and 10de:2204's create_private_16MiB/first_take take a ceiling of 1.40;
- their status rows read gap.
The capture ring's wait. A probe play of one consumer's stream on the 3090 (m3-max-50027, probe
db1d5c1929 on ac1896537f) timed each of 258 ring-fulls. The ring-full is 63.3 MiB. Its copy took
33.4 ms on the GPU, 1.99 GB/s, of the 33.6 ms the commit waited (medians). The queue behind earlier
work took 0.03 ms, the submission 0.04 ms and the wake 0.13 ms. The card sits in a Thunderbolt 3
enclosure whose link runs at 20 Gb/s (boltctl). The README's known gaps now give the numbers.
Verified: the numbers above, from those jobs' probe lines.
A capture that found no room in the ring waited for the oldest span's submission, then reclaimed
the ring by the completion thread's count. The wait returns once the semaphore passes; the count
moves only when the completion thread gets round to it. Until then each pass found the same span,
waited again (returning at once) and counted another wait: a spin. On a loaded host it ran long
(an r3 play on the 3090 counted 373,001 capture waits in one frame); on an idle one it was 109 of
110 oldest-span waits.
The capture now keeps the highest value it waited for, after an oldest-span wait and after its own
ring-full's, and reclaims by that or the completion thread's count, whichever is higher, as the
staging ring's wait already does. The semaphore having passed, the GPU's copies out of those spans
have completed, so the host may write them again.
The device test every_device_waits_once_for_each_ring_full_while_completions_lag holds the
completion thread (a test-only lock it meets at the top of its round while work is in flight)
across a commit naming three rings' worth, and asserts one capture wait per ring-full sent.
With clamped samplers and the colour store action played, glbench-3090-r4's
old arm still stops after 320 frames, now at setDepthStoreAction: ("not
played on a render encoder"; play 50021, player a9b2f70f9a). The old runtime
has set_depth_store_action and set_stencil_store_action. The backend now plays
setDepthStoreAction: and setStencilStoreAction: through them. This is a player
change only.
Test: an_encoder_s_depth_and_stencil_store_actions_play (device,
runtime_lane::replay_streams, on the old runtime). A depth-only pass
(Private Depth32Float) and a stencil-only pass (Private Stencil8) each have
an unknown store action that their encoder sets to store. Their clears (0.25
and 0x5a) are checked after.
With swizzled views and generated mipmaps played, the old arms stop at two
render encoder calls the old runtime has but the old backend refused ("not
played on a render encoder"):
- glbench-3090-r4 after 320 frames, at setColorStoreAction:atIndex:;
- web3d-3090-r3 after 454 frames, at
setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:
(plays 49966, player 8c37a92b36).
The backend now plays them as the old runtime's set_color_store_action and
set_fragment_sampler_states with the clamps. Clamps must be floats, one per
sampler. This is a player change only.
Test: an_encoder_s_store_action_and_clamped_samplers_play (device,
runtime_lane::replay_streams, on the old runtime). A pass whose colour
attachment's store action is unknown (4) binds two fragment samplers with
LOD clamps, then sets store (1). The cleared green is checked after.
The player's old-runtime backend refused
newTextureViewWithPixelFormat:textureType:levels:slices:swizzle:resourceIndex:
("not played on a texture") and generateMipmapsForTexture: ("not played on a
blit encoder"). The old runtime has both: Texture::new_texture_view_with_swizzle,
new_texture_subview_with_placement with a swizzle, and
BlitCommandEncoder::generate_mipmaps. These refusals were where the old arms
stopped: glbench-3090-r2 at f289, glbench-3090-r4 at f317, glbench-780m-r2 at
f360, and web3d-3090-r3 after 454 frames.
The backend now plays the public swizzle form and the private one with its
resource index, reading the swizzle with the descriptor's reader (now one
function for both), and generateMipmapsForTexture: as generate_mipmaps. This
is a player change only; the old runtime is untouched.
Tests (device, runtime_lane::replay_streams, on the old runtime):
- a_view_s_swizzle_is_what_a_kernel_samples: a stream with the two swizzled
views of a red RGBA8Unorm texture, each sampled by the owned fixture
a4_pixel_fetch into a buffer, checked against (0, 1, 1, 0) and (1, 0, 1, 1);
- a_blit_s_generated_mipmaps_fill_the_levels_below_the_first: a stream that
generates a one-colour texture's mipmaps, then checks views of levels 1
and 2.
Clippy (manual_chunks_exact... as_chunks) refused chunks_exact(4) in
every_device_draws_the_sample_count_of_its_state under --cfg m2v_gpu and
--cfg m2v_cpu_icd (check 49876). The words are read as as_chunks::<4>().
A render pipeline whose fragment function reads get_num_samples() carries
RuntimeFact::SampleCount. State creation already sets that fact's value: it
specializes SpecKey::SampleCount from the descriptor's rasterSampleCount, and
a draw renders the state only into a pass of that count (renders_into). But
draws() did not list the fact among those a draw supplies, so it refused the
state as RenderPipelineKind::DrawInput. That refusal was the stop at state
#73638 of the replay stream web3d-3090-r3 (frame 453; a probe player named
the fact at render.rs's dependency match).
draws() now accepts the fact.
Test: every_device_draws_the_sample_count_of_its_state. The owned fixtures
spc_num_samples (get_num_samples() into R32Uint) and ido_draw_order
(ido_full's fullscreen triangle, ido_samples' per-sample copy) are drawn
twice. A state of rasterSampleCount 1 writes 1 to every pixel of a 1-sample
target. A state of 4 writes 4 to every sample of a 4-sample target. Vulkan
requires no 4-sample integer colour attachment, so a device without one
draws only the one sample. Without the fix, both states fail at creation
with DrawInput.
The pulled-variant test expected the de-indexed form's key to stay
Unsupported{IdentityDomains}, as if it read the draw's indices. ima's fragment
function reads no primitive ID, so under that key the vertex function reads no
index (no CaptureIndexAddress): it only pulls every attribute (item 8 of
pipeline::link::vertex). It was refused only because a pulled fetch's own
source was a descriptor and then read the root table; with both fixed it
compiles: both layouts pulled through their buffers' pushed addresses at their
pushed strides, no bind offset, no descriptor, both modules L3-valid. The
private list form, which reads the indices at CaptureIndexAddress, stays
refused. msi job 49761 showed the key compiling at d80e4557a5.
The key hashes SEMANTICS_VERSION, which this series bumps to 2186, so its
pinned value moves, as it did at 2183 (cc2d0fde45). The fixture's bytes are
unchanged.
Verified: msi job 49761 printed the new key (30069692...) as the test's left
side at d80e4557a5.
Metal's default factor step function is constant: every patch reads the
factors at the buffer's offset. The test's two patches meant per-patch factors
(the second culled by its own zero edge factor), but its descriptor kept the
default, so the second patch read the first's factors and drew over the
target, on every driver (Iris Xe and lavapipe in 49822, KosmicKrisp in 49762),
as Metal draws that state. Probes on KosmicKrisp (49777) showed each patch
drawn alone as the constant step reads it.
A source buffer in device-address form was read through its root entry in the
root table (RootTableAddress), the form of a replay variant and of a profile's
range fallback. Under the identity domains no root table is placed: every
device-address slot reads its own SlotGuestBase, which place_slots pushes for
an own source too. The fetch then read an unplaced field, an internal error
(KosmicKrisp leg 49741: "a strategy reads the unplaced push field
RootTableAddress" on the patch draws).
Under identity the fetch now reads from the slot's own pushed address plus
its displacement, the word below the read (psb::prepare_at), uncontained as
Metal contains no fetch, which is what the rt README states for a vertex fetch
outside its buffer.
A source buffer that no accessed slot shares was a read-only storage view of
its own, a descriptor, on every profile but a replay variant's. Under the
identity domains every slot is its device address and no descriptor is held,
so a post-tessellation function's evaluation stage, which pulls its control
points and patches, was refused as IdentityDomains even with its pushed
strides admitted. Under identity such a source is now its device address
(SlotGuestBase, its bind offset removed), as a replay variant's is through its
root entry.