A segment no longer starts with a barrier. Each segment with commands
ends with one global VkMemoryBarrier2 from every write to every later
command and the host (read and write), with no per-buffer barrier; the
upload of zero fills and a block's fill each end with one to every later
command. A barrier's second scope reaches every later submission on the
queue, so the start barrier was redundant.
The segment-end barrier goes on every segment with commands, not only on
one that wrote: a read-only segment still owes the execution dependency
before a later command buffer writes what it read.
Metrics::barriers counts the queues' work only; a block's fill, made
apart from any command buffer, is not counted, so the count stays
deterministic. The states test now expects 2 barriers for 2 segments.
Verified: not yet compiled; the lint and legs follow.
The planner's decision on (c): no driver free runs on the completion thread, since NVIDIA's frees
take 1-11 ms and would delay every later completion, and a submission on another thread waits
behind at most one free.
- A fourth runtime thread, the reaper, destroys event semaphores (the events gauge falls with
each) and command pools past the idle ones kept, one at a time, in the order given. Every
EventInner drop and every surplus recorder goes to it, whichever thread gives it up.
- A last handle dropped on the completion thread (a handler or listener) hands the whole teardown
to the reaper: it stops and joins the other threads, gives the consumer's blocks back, and the
core drops there. Every gauge still reads zero only once vkDestroyDevice has returned.
- Stops wait for a thread only where it is not the calling thread, by a per-thread role in a
constant thread-local without a destructor. The reaper stops last, after its queue is empty;
frees given after that are made at the core's drop.
- The handler teardown test now takes a block and checks it is unmapped once, on the reaper.
Verified: cargo fmt; the compile and device jobs follow.
The six half-output blend cases differ from Metal on the RTX 3090 (59 sites) and on the Iris Xe
under ANV (62 sites). The ledger had no rows for either venue, so the conformance replay failed
there. Every site is the device's own blend, which the native-arithmetic contract makes the
answer, so each gets a row: 59 scoped `NVIDIA GeForce RTX 3090`, with answers equal to the
RTX 5080 Laptop's rows (no venue pattern covers those two without the RTX 2080, which no run
here measured), and 62 scoped `Iris(R) Xe`. docs/CONFORMANCE-COVERAGE.md is re-derived for them.
How the sites were shown to be the device's blend, by a measurement build (not committed) that
read every stored code back and set it beside plain float models of the blend:
- The `one-zero`, `min` and `max` sites store the source or the destination through the
attachment alone, and store Metal's codes on both devices, so both operands reach the blend
exact.
- RTX 3090 (NVIDIA 620.70.06): the exact blend rounded once to the attachment's precision gives
98.0% of the 16-bit words and 98.7% of the 32-bit ones. Into a 16-bit target the blend colour is
truncated to `half`; the runtime hands vkCmdSetBlendConstants Metal's float colour unchanged, so
the truncation is the device's. Every word that differs from Metal's is within 1.01 ulps of
that model at the largest operand's magnitude. A -0 + +0 sum stores -0, which is the 32768 and
2147483648 of the zero-1msa and sas-1msa rows.
- Iris Xe (Mesa 26.2.6): the float blend truncated toward zero into a 16-bit target gives 97.6% of
those words. The exact blend rounded to nearest gives every 32-bit word.
- On both devices every differing word is within two ulps of Metal's at the largest operand's
magnitude. That is inside the bound of the `half-output-fast-math-blend` precision note (three
half ulps, two float ulps). The note is announced on both devices: the cases' allowance for it
fired on all six cases (3090: 12 of 12 allowances fired; Iris: 6 of 12, the six silent ones are
shared-in-system-memory, which an integrated GPU does not announce).
Verified:
- conformance replay of the six cases exits 0, each run holding one GPU: ms01 RTX 3090
m3-max-41210, ms01 Iris Xe m3-max-41211, um870 RTX 3090 m3-max-41218.
- cargo nextest run -p metal2vulkan-conformance --all-features: 1043 passed (m3-max-41208).
The first run, before the document was re-derived, failed only
the_conformance_coverage_document_is_what_the_sources_derive (m3-max-41199).
- Measurements: m3-max-41151, 41171 and 41176 (um870 3090), 41174 (ms01 3090), 41175 (Iris).
These ran at tree 9326ca7fd8, which this commit's tree equals.
At b216007f0a the rt suite on ms01 was killed at 3 GiB and then at 5 GiB, and
on the UHD 630 at 4 GiB and then 6 GiB: each rt test device makes a 256 MiB
Private and a 256 MiB Shared block, at nextest's default parallelism (20 on
ms01, 12 on the mini), all in system memory on an integrated GPU. 1.5x per
step takes two lost legs to get there; 2x takes one, and the next measured run
brings the size back to 1.3x its peak.
Verified: the script parses; arithmetic read against jobs m3-max-41113,
41148 (ms01) and 41115, 41116 (UHD 630).
The new runtime's Gauges gained command buffers and events (and holds textures,
samplers, pipelines and descriptor slots); the harness named only buffers and
blocks. It now prints them all, so the matrix's @drop and @100/@200 checks
cover each kind as the runtime grows.
The window server commits many small command buffers per frame, each of one or
two small dispatches. The new `frame` workload is that shape in compute: a run
is 160 command buffers of two `lcg_step` dispatches over 256 words, checked
against a CPU reference. A plan now says how many dispatches each command
buffer of a run holds (`per_command_buffer`); a split run's GPU time is its
first command buffer's start to its last one's end. Plan::validate refuses a
plan of no dispatch or of empty command buffers.
Where the runtime keeps one total of its pipeline barriers (the new runtime's
Metrics::barriers; the old runtime counts by kind, so it prints none), each
plan workload prints `M2V-MATRIX metric harness-<runtime>/<workload>/barriers_per_run`,
the barriers per timed run, so the matrix fails on any increase. For `frame`
that is barriers per frame.
Also fixes the run-count line's format string from the commit before, which
named four arguments with three specifiers and did not compile.
A run over every dispatch shape of the harvested set counts the pipelines each
runtime creates; it needs no settled time, and settling 1,337 workloads for at
least half a second each, up to five on an integrated GPU, held a node
exclusively for tens of minutes. --no-settle runs the --warmup runs alone.
Verified: compile job after this commit; the harvested per-shape run on ms01's
Iris with --no-settle.
The dated nightly's clippy asks for as_chunks over chunks_exact with a
constant length, and the command's doc linked the constant it no longer
imports.
Verified: clippy in three cfgs and rustdoc in the compile job after this
commit.
Two command buffers in flight held the Iris within 1% between two runs of one
sha, but um870's integrated GPU read its bandwidth workload 5.2% apart: the
second run's p10 matched the first's, and its clock dropped partway through
the timed runs, after the warm-up had settled. A workload's matrix time (and
the table's steady column) is now the lowest median of its timed runs'
consecutive windows of 10, the median of at least 5 runs where there are
fewer than 10.
The planner wants each runtime's pipeline count on the harvested runs, from
its own counters: Device::pipelines_created (the old runtime's
variant_pipelines_made, the new runtime's Metrics::pipelines_created), and
after the plan workloads a M2V-MATRIX metric
harness-<runtime>/<authored|described>/pipelines_created line, so the matrix
fails a set whose count grows.
Verified: unit test of the steady time (a clock drop partway through keeps the
faster level); two runs of the same sha on um870 and the Iris, and the
metric's lines, in the GPU jobs after this commit.
Settling the warm-up held um870's integrated GPU within 3% between two runs of
one sha, but the Iris still read 1.39x apart on bandwidth and 1.29x on the
dispatch chain, each run settled with a narrow spread: its clock held a
different level in each process. Each run waited for its command buffer
before encoding the next, so the GPU idled between runs. Each run is now
committed while the GPU runs the one before it, and its time is read once
that one completes; the GPU stays busy, as under a program that keeps it busy.
Verified: two runs of the same sha on the Iris and on um870 in the GPU jobs
after this commit; device tests in the compile job.
A dispatch carries its kernel's function-constant values (index, raw
MTLDataType, bytes); the harness makes one pipeline per kernel and values,
through newFunctionWithName:constantValues:error: where there are values.
A description gives them as constant INDEX TYPE HEX lines before the
dispatch, as the harvested kernels need: 30 of the benchmark's 100 use
constants. The old runtime takes them as FunctionConstantValues by index.
Verified: the description unit tests parse constants onto their dispatch
alone and refuse one after the last dispatch and bad hex (compile job after
this commit); the old runtime's specialization runs in the harvested
workloads on ms01.
Integrated GPUs read up to 1.27x apart between matrix runs of unchanged code:
five warm-up runs left the timed ones before the clock had risen. A workload
now warms up for at least --warmup runs and half a second, then until the
medians of its last two windows of 10 runs are within 3%, for at most five
seconds (unsettled warm-ups are marked ~ in the table). The matrix time line
needs at least 5 timed runs. Creation workloads warm up the same way.
The gauges read after the 100th and 200th timed runs print as
M2V-MATRIX gauge harness-<runtime>/<workload>/<gauge>@100 and @200 lines, so
the matrix judges leaks. A runtime whose gauges outlive its device (the new
runtime's counters) prints them after the device dropped as
harness-<runtime>/device/<gauge>@drop; the old runtime's end with it.
Verified: unit tests of the settling rule and of a warm-up without it; the
new runtime's device test reads every gauge 0 after the drop (compile job
after this commit); timing stability on um870 and the Iris in the GPU jobs
after this commit.
clippy reads vec![0..len] as a likely vec![0; len]; the free list starts as
the one range 0..len, collected from iter::once.
Verified: clippy in the compile job after this commit.
The device trait splits in two: Device (name, newBufferWithLength:options:,
gauges) and ComputeDevice (libraries, pipelines, queues). The new runtime
makes buffers only so far, so rt.rs implements Device alone, and
run::Buffers runs its creation workloads; a plan on it fails with that
reason. Once its command buffers and compute encoder land it implements
ComputeDevice and Buffers goes.
The new runtime places a buffer where its consumer says, in a block the
consumer took; the harness is that consumer here. It places each buffer at
the lowest free range of a block of its storage mode, 256-byte aligned,
taking a pooled block when none holds it and a dedicated block past a pooled
block's length, and frees the range (or releases the dedicated block) when the
buffer is dropped. A buffer made after one of its length was dropped takes the
same range, which the runtime zeroes: the creation workloads' reused range.
The physical device is the first of the most preferred type that opens, as
the old runtime chooses. --runtime new names it.
Verified: unit test of the free ranges (lowest fit, merging both ways); device
test on the new runtime (creation workloads start zero, a range given back is
taken again, live buffers lie apart, a dedicated block past 256 MiB) in the
compile job after this commit.
The 2080's rt suite ended 1, not 137, at b216007f0a: it peaked at its 2 GiB
reservation, and NVIDIA's driver, pinning host memory for the 256 MiB Shared
blocks, answered the limit with VK_ERROR_OUT_OF_DEVICE_MEMORY rather than the
kill. The matrix counted it as a plain failure, kept the 2 GiB for the next
run (a run at its reservation kept it), and failed the leg on four tests.
Wanting RAM is now a peak at the reservation plus either the kill or a failed
allocation in the output (OUT_OF_DEVICE_MEMORY, OUT_OF_HOST_MEMORY, or Rust's
"memory allocation of N bytes failed"); such a run gets its one rerun and
sizes the next at 1.5x. A failure at the ceiling with no failed allocation
stays a failure: lavapipe's suites peak at their reservation as a rule.
Verified: the script parses; the rule is read against job m3-max-41114
(peak 2.0 of 2 GiB, exit 1, four ERROR_OUT_OF_DEVICE_MEMORY panics).
The test charged each call with the growth of the old runtime's device-wide count of kernels
made. On a device with an empty scratch cache the view check runs on its own thread from the
device's making; once the busy work ends it sends its timed dispatches, which build the decode
kernels the heap's PVRTC/ETC2 textures and the ASTC view queued, and whichever call was running
was blamed (rebind_bytes_no_copy at c944d63548, new_buffer_with_bytes (Managed) at bfe63b5097,
on the matrix's lavapipe leg). The test now waits for the check first, as its sibling
a_new_heap_texture_s_staged_copy_lands_in_its_first_move_s_submission already does. Test-only;
the old runtime is untouched.
Verified: cause found by probe job m3-max-41127 (msi-laptop, the matrix's lavapipe environment,
39 runs, 6 failures, each a decode kernel built on m2v-view-check during the blamed call). The
fixed test is exercised by the next matrix lavapipe leg.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.
Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
The new runtime's form: pointers are device addresses used directly and a texture's or sampler's
handle is its gpuResourceID (docs/RESOURCE-ID.md). The variants come beside the old domains,
which stay until the cutover; nothing lowers under them yet.
- PointerDomain::Identity and HandleDomain::Identity.
- Device::new refuses one identity domain without the other (InvalidDescriptor) and the identity
domains on a device without bufferDeviceAddress and shaderInt64 (Unsupported{IdentityDomains},
naming both features as one alternative).
- A compile under the identity domains is Unsupported{IdentityDomains}, not implemented, at the
start of analysis, so no old form is ever emitted under them. Later steps lift it as the
lowering lands.
- The profile fingerprint covers the domains (tested).
- docs/API.md's policy section names the domains; docs/REFUSALS.md and the reach table carry the
new refusal; api_signatures regenerated.
Verified (this commit's tree, rebased with the ledger commit before it onto b216007f0a):
- msi 41071: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc -D warnings,
nextest -p metal2vulkan in full, 3,663 of 3,663 (the golden table included: no cell moved; the
new test the_identity_domains_come_as_a_pair_on_a_device_with_addresses among them).
- msi 41072: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- msi 41073: the conformance crate's ledger tests, 7 of 7.
The 52 known-gaps.tsv rows for MoltenVK on the Apple M3 Max (half-output-blends-r16f, -rg16f,
-rgba16f) now open with "TEST VENUE, NOT A PRODUCT GAP": MoltenVK is a test venue, so the rows
record the venue's answer and no precision note or README entry carries them.
The blend-colour rows also say what their large differences are: cancellation near zero in the
device's `float` blend, not overflow or NaN and not our conversion. At RGBA16Float's alpha, source
-1.0625 over destination 0.869140625 with blend colour 0.45 sums to -9.8e-5 exactly; the device's
`float` blend stores -9.763e-5 (0x8666) and Metal, rounding the blend colour to `half`, -3.34e-6
(0x8038): 1,582 codes apart near zero, 9.4e-5 in value, under one `half` unit in the last place at
the operands' magnitude. A `float` model of the blend over the case's own inputs reproduces the
1,582 against Metal's recorded codes. The one-zero site, the output through the attachment's own
conversion with no blend, holds no row on MoltenVK, so the output reaches the attachment exactly.
Verified:
- msi 41073 at the next commit's tree (this ledger plus the identity domains, on b216007f0a): the
conformance crate's ledger tests, 7 of 7 (the ledger parses and every row names a real case and
its gap); 40976 the same at the ledger change alone on 0524d5a1c2.
A play of one recorded stream on a 780M with an empty translation cache and an empty Mesa
cache (m3-max-41100, at a8ad095897) recorded 2523 dispatches, 71967 draws, 28321 render passes
and 8503 submissions; the two warm plays after it recorded 2079, 71742, 27871 and 7036. The
stream's counts were equal in all three, every group and frame line (0 of 7932 differ); the
executed counts differ in 285 lines cold against warm and in 11 between the two warm plays.
So cold caches change the totals, not only where a few draws land, and the spec now says so.
The test that checks which command buffers complete together indexed a group's counts as one
map; since the report split them, the runtime's submissions are in `executed`. Found by the
tests' build on every node (m3-max-41083, 41084, 41085: E0608 in replay/tests.rs).
A correction to the previous commit's message: over the seven plays at one tip, the barrier
totals differ by a few too (69804 to 69810); the other totals were equal.
Each report line (completed group, frame, total) now holds two sets of counts. `stream`: the
calls played, the command buffers committed, the encoders made, the draws and dispatches their
calls issued, and the player's own relocated, misaligned and written counts, all fixed by the
stream, so equal on every play on any runtime. `executed`: the runtime's counters (for the old
runtime, the Vulkan commands it recorded and the pipelines it made). The separate `calls N` line
goes: the total's stream calls are the calls played.
Why: the old runtime's executed counts are not repeatable at one tip. Seven plays of one
recorded stream on a 780M at one tip gave equal totals, but in some plays a few draws (with
their barriers) moved from one group to a group 15 later, and once from one frame to the next.
The moving groups are the ones that make a pipeline, and they differ in `draws_unkept_making`
(2 against 1): draws recorded through a pipeline's general form while its own was still being
made on the runtime's pool, which keep nothing to draw again
(metal2vulkan-runtime's pipeline/render/residual.rs). Where a background making lands is
timing. The commits, submissions per group and the player's waits did not differ. The matrix
compares the stream's counts only.
The consumer quiesces before exit(); an atexit handler holds only where registered after the
driver loaded (after Device::new), as the README now says.
Verified: cargo fmt; the lint job follows.
The consumer quiesces before exit(); a quiesce in an atexit handler is a fallback that holds
only where it was registered after the driver loaded. Measured with the exit test's child process
(M2V_EXIT_RUNS=50, both registration points) on NVIDIA's driver: after Device::new, 50 of 50
clean on the RTX 2080 (m3-max-40942) and the RTX 3090 (m3-max-40944); before Instance::new, 0 of
50 on both, each a SIGSEGV before the handler printed.
Verified: the two probe jobs named.
The teardown test from a completed handler passed on every Linux leg and then aborted at process
exit (Iris Xe: double free; RX 550: SIGSEGV; legs m3-max-40938, 40941): the completion thread,
which finishes a teardown that starts in a handler, was still in vkDestroyDevice when the zero
source's gauge fell and the test process exited, so the driver's exit teardown ran beside it.
Windows passed (40946): ExitProcess stops the other threads first.
The zero source's gauge now falls after vkDestroyDevice, so every gauge at zero means the
teardown made its last Vulkan call; the docs tell a consumer whose last handle drops in a
handler to wait for that before it drops its instance or exits.
Verified: cargo fmt; the legs follow.
clippy's drain_collect: the scheduled, ended and fire lists and the watch list at the thread's end
are taken with mem::take rather than drained into new vectors.
Verified: cargo fmt; lint job m3-max-40916 named these five sites and nothing else.
Step (c) of the new runtime's compute core.
What:
- CommandQueue (newCommandQueueWithMaxCommandBufferCount:, its bound on uncompleted command
buffers), CommandBuffer (enqueue, commit, handlers, waits, status, error), Event and
SharedEvent (signaled_value, set_signaled_value, wait_until_signaled_value,
notify_listener).
- A command buffer records at once into segments split at event waits and signals. The submit
thread holds a segment whose waits are not met, and its queue behind it, while the segments
before it run (reims F1). A wait the host's value meets submits no semaphore wait; a GPU
signal not above the highest value submitted or set is left out, so the semaphore only rises.
- The completion thread retires by a progress semaphore, follows submitted event signals (a
listener runs at a mid-buffer signal, reims F2), runs handlers with no lock held, and is
woken through a host-signalled timeline semaphore only when a wait needs it.
- A command buffer keeps each block it uses until it retires. A zeroed Private buffer's fill is
an upload submitted ahead of every later commit, whose segments start with a barrier; each
segment ends with a barrier to the host.
- Device::quiesce(timeout) (F9), with every wait bounded, no join of a thread still running, no
thread-local that exit() tears down, idempotent, freeing nothing; unmap runs on the caller for
every block handed out, once (a handed set replaces the per-idle flag).
- The last handle dropped in a handler: the completion thread finishes the teardown itself (F8).
- CommandQueue::abandon (F14); a loss ends held work, in-flight work once the device is idle,
host waits on pending signals, and later commits, with DeviceLost { in_flight } (F13).
- Refusals Committed, OtherDevice, NoCommandBuffers with their basis; Error::Quiesced;
docs/REFUSALS.md and the API signature table regenerated; the README's contract.
Verified: cargo fmt; refusal_surface --check. The compile and device jobs follow.
What: refusal_surface.py reads the new runtime's Error and makes a section of
docs/REFUSALS.md for each variant whose payload is one enum the runtime
declares: today Refused(Refusal) and Limit(Limit), and any family added later
(a Gap included) without a list of names to keep. Each of their variants
declares its basis, as Problem's do, and --check fails on one that does not.
The translator's Limit section no longer counts rt's Limit sites. A rustdoc
link [text](path) in a summary reads as its text; three existing rows lose a
link the file could not follow.
Why: AGENTS.md wants every new refusal in REFUSALS.md, and the scan of rt read
the floor's Missing only, so EmptyBuffer, BufferPastBlock, BlockLen and
BlockIds were missing. Their basis lines cite the M3 Max measurements the old
runtime records for the same answers (newBufferWithLength:0 and a placement
past the heap's end answer nil), the device's limits, and our 32-bit numbers.
How verified: the script regenerates, --check and --selftest pass locally;
the refusal_surface test runs in the compile job.
A no-copy buffer plays as a buffer of its length (its host memory is not in the stream), and the
runtime refuses option bit 24 on such a buffer, as Metal ends the process there; b2 stopped at
its 354th call on one. The bit is dropped for a no-copy buffer alone, so the replay keeps the GPU
writes Metal drops from that memory; the spec says so. A heap keeps the bit, which the runtime
takes.
Found by the b2 play on gem10's 780M (job m3-max-40908).
The recorder renames a placement on a block (newBufferWithLength:options:offset:) and keeps its
receiver, the block; the backend took it on the device, and b2 stopped at its 88th call. A no-copy
buffer, [nil, length, options, nil], plays as a buffer of that length.
Found by the b2 play on gem10's 780M (job m3-max-40905).
The stopping call is the one after the count: on a long stream the selector alone does not say
where the play stopped.
Verified by the unit test of a refused selector (the count stops before it).
The spec and the player follow what the recorder writes (reims-vgpu bec103226; b2 was recorded
at 50fc14009, the same format but for refused guest-RAM copies): structs and descriptors are maps
keyed by the recorder's camelCase field names, nil for an unset optional field; f32 values are
f64; descriptors Metal makes as objects (texture and render pass descriptors) are platform
records changed by setter records; a drawable never seen made is a texture of its descriptor;
the host's plumbing (padded, exportable and dma-buf buffers, an unshared queue) plays as the plain
Metal call it stands for; the host's scheduling records play as nothing; no call answers a
resource ID, and a descriptor's resource index places its object.
The guest-RAM copies are [buffer, [[byte, data], ...]] in and [buffer, [[byte, [start, end]],
...]] out. m2v.copyBytes:toBuffer:offset: and m2v.copyToHost: are gone: the host has no such
methods. The gpuResourceID answer check and PlayError::ResourceId are gone with the answers.
The old runtime's backend becomes a module: argument and map readers (args), descriptors
(texture, render pass setters, render and compute pipelines, depth-stencil, sampler, buffer and
heap descriptors, function constants and descriptors, surface planes), and the command buffer,
compute, blit and render encoders' calls. Each mapping follows how the host's platform applies the
recorded value to the runtime.
For each selector, how many calls had each shape of arguments and answers: kinds, list structure
and map keys, none of the data. It says what a stream asks of a player without showing what a
guest's stream holds, so the description can leave the host that keeps the stream.
737ccbf81a (the resource ID word) added metal/resource_word.rs under metal/mod.rs, which the
runtime-sources inputs reach, without listing it, so
candidate::engine::artifact::tests::the_runtime_sources_are_the_committed_ones failed on
development (found by the replay lane's whole-suite run, m3-max-40953). Nothing in the old
runtime calls it (only the new ID spec's tests and docs do), so it joins the not-runtime list
with that reason; the runtime-sources pin does not move.
Verified: cargo fmt; the test reruns in the next suite run on development.
The stage-output change (one 32-bit form, a6277b1a10..c6e86ab3a8) removed a profile field, which
moves every profile's key in golden_hashes.tsv; CONTRIBUTING.md re-blesses on development after
merges. The engine inventory and the air_input printouts did not move.
Verified: potluck job m3-max-40932 on m3-max at 0524d5a1c2 (inventory=0 golden=0 printouts=0).
A closure returning a borrow of its argument does not elide the lifetime,
which the device cfgs' build of the test refused.
Verified: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd in the job after
this commit.
The described test wrapped the whole authored fixture, seven kernels, as
each metallib function's bitcode. The translator checks that a metallib
function's module declares one entry point (AirAbi::check_container) and
refuses it (Abi(ContainerMismatch)) otherwise. The test passed only while the
old runtime's disk shader cache held these kernels' translations, which the
authored test makes from the same AIR without a container; development's
SEMANTICS_VERSION and ARTIFACT_FORMAT_VERSION bumps emptied that cache, and
the matrix's lavapipe leg ran the described test first.
Each function's bitcode is now the fixture's text with that kernel alone:
the other kernels' definitions, their !air.kernel nodes and their
threadgroup globals left out, assembled by llvm-as.
Verified: under --cfg m2v_cpu_icd on lavapipe with an empty shader cache, the
old test fails with ContainerMismatch and this one passes, then the harness's
tests with LP_NUM_THREADS=1 (job after this commit).
The old runtime's backend for the replay player waited for each committed command buffer with
its own 60-second bound, outside gpu/wait.rs, and the player, its unit tests and its device
tests spelled the stream's wait records whole, which the check that every device wait is
bounded (gpu::tests::device_waits_exist_only_in_the_bounded_wait_module) reads as waits.
The backend now takes the device's type and waits through gpu::wait::runtime under the hang
protocol, for the stream's commits and the player's readbacks alike; command-replay passes its
--device-type, the device tests the cfg's TEST_DEVICE. The stream's wait records are named by
WAIT_COMPLETED and WAIT_SCHEDULED, spelled in pieces: they are record names, and the player's
own waits are its backend's.
The landed packet changed a runtime-sources input, so the committed digest no
longer described the sources and `the_runtime_sources_are_the_committed_ones`
would fail. Recomputed over the same inputs and committed by land-pkt.sh.
They are generated from the whole case set, and the set grew on `development`
while this branch was in flight, so the copy committed here counted a smaller
one.
Verified: regenerating at this tip leaves no change beyond the `Generated at`
stamp.
The translator declared a `half` color output with 16-bit float lanes where the device enabled
storageInputOutput16 and shaderFloat16: a second form chosen by a query that is not one of the four
the owner's rule 2 allows (the 3090, 2080, RX 550 and lavapipe lack it; MoltenVK, RADV and ANV
have it). Every interface variable is now 32-bit on every device: a `half` output is widened to
`float`, which holds every `half` exactly, and no module needs StorageInputOutput16.
- lower::stage_io: plan::half_variable, IoObject::User::half and the 16-bit store are gone, and
io_elem takes no width. StageIo::half_outputs and the profile's input_output_16bit are gone;
the link contract checks 32-bit float lanes only.
- SEMANTICS_VERSION 2145 and ARTIFACT_FORMAT_VERSION 527 (the artifact codec lost a field). The
golden table needs its re-bless on development: every profile's key moved with the profile's
lost field.
- The HalfOutputPrecision and HalfOutputFastMathBlend notes, docs/API.md's degrade catalogue,
docs/FAST-PATHS.md and the half-output-blends conformance case say what the device receives
now; their statements about the 16-bit form are gone.
- known-gaps.tsv: 52 rows for MoltenVK on the Apple M3 Max. With the 16-bit output MoltenVK stored
Metal's codes at every word of half-output-blends-*; with the `float` output its blend is the
device's own (half-output-fast-math-blend) at 17, 17 and 18 sites of the R16Float, RG16Float and
RGBA16Float cases, largest differences 1 to 1,582 codes at the stored value (the blend-colour
sites the largest). Its 32-bit float cases still store Metal's codes.
Verified (code at c55bc28e43, ledger rows added at 2754676210, this commit's tree):
- msi 40877: clippy -p metal2vulkan --all-targets --all-features -D warnings, rustdoc
-D warnings, nextest -p metal2vulkan in full: 3,661 of 3,662 pass; the one failure is
golden_hashes_match_the_table (every profile's key moved), for the re-bless on development.
- msi 40827: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- XTX (RADV NAVI31) 40843: runtime_lane color_writes (every `half`, NaN and infinity included),
half_output_blends and extended_range_blends, 16 of 16 pass; the conformance replay of the six
half-output-blends cases exits 0 against the RADV rows, so every row's count and largest
difference held.
- RTX 3090 (ms01) 40844: the same 16 lanes pass; the replay's 59 divergent sites are exactly the
RTX 5080's 59 rows (the ledger holds no 3090 rows; NVIDIA never had the 16-bit form).
- M3 Max on MoltenVK: 40833 before the rows (52 new gaps, all in the 16-bit float cases), 40862
with them (exit 0, every count held on the second run).
- msi 40875: the conformance crate's ledger tests, 7 of 7.
Under the identity binding domains a guest computes a texture's or sampler's gpuResourceID itself,
with no round trip: the index the consumer grants in the low 32 bits and a word in the high 32 bits
that is a pure function of the Metal descriptor. The guest's port needs the word specified and a
file of vectors both sides check.
- metal::resource_word::TextureWord::of(pixel_format, swizzle): bits 0-11 Metal's border texels
after the swizzle (the existing border_texels rule), bit 12 the out-of-bounds alpha of a format
without alpha, bits 16-31 the MTLPixelFormat raw value, so a texture's word is never 0. None for
the placeholders and the formats the translator holds no texture of or only copies.
- The sampler word is the existing SamplerWord, unchanged.
- docs/RESOURCE-ID.md: the ID's layout, the index classes (0 nil; storage-capable textures 1 to
4,095, valid in both arrays; other textures 4,096 to 65,535; samplers 1 to 3,999), both words'
bits and the level rule, and the vectors file. README's documentation table lists it.
- crates/metal2vulkan/tests/resource_words.tsv: 392 vectors (every pixel format with a word under
the default swizzle, each channel of seven formats from each other source, every sampler field
through its values, the level clamps around the points the nearest level turns at, and one
descriptor with every field changed). tests/resource_words.rs recomputes every line through the
public API and holds the file equal to what the generator writes; an ignored test blesses it.
- api_surface lists the new module; api_signatures regenerated.
Verified:
- msi job 40810 at the same tree: clippy -p metal2vulkan --all-targets --all-features -D warnings,
rustdoc -D warnings, nextest 18 of 18 (resource_words, the TextureWord unit test, api_surface,
api_signatures).
- msi job 40811 at the same tree: clippy under --cfg m2v_gpu and --cfg m2v_cpu_icd.
- msi job 40809: the bless test wrote the vectors; the combined sampler line (0x58f6ab53) and the
A8Unorm and R8Unorm texture lines checked by hand against the bit tables.
A job that printed a leg's device lines and was then killed before the leg's M2V-SUITE line ran
nothing of that leg, yet the leg was judged on its other suites: on 248d41074f the 3090 and the
UHD 630 read PASS on their harness suites alone while their rt jobs (m3-max-40768, 40800) had
been killed for RAM. Such a leg now fails with the job and its exit.
Verified: the script parses; the next matrix run on development's tip exercises it.
The matrix judges a gauge only at a point (@100, @200, @drop) and failed every GPU leg and
lavapipe on 248d41074f for the memory tests' pointless keys: blocks_live, pool_full and
pool_settled are mid-test counts the tests already assert exactly, and blocks_teardown is the
leak check. The mid-test lines are gone; the teardown line reads blocks_teardown/{buffers,blocks}@drop.
Verified: cargo fmt; the matrix rerun on the tip reads these keys (next run).
Jobs are sized from their last measured runs: 1.3x the peak, at least 2 GiB. On 248d41074f
the held workspaces sat at a commit the tip does not descend from, so the GPU legs got fresh
ones, and the rt jobs on ms01 (m3-max-40768) and the Windows host (m3-max-40800) went over
their 2 GiB in their first two seconds (potluck why: over memory, 2 GiB and 2.1 GiB of 2) and
lost their legs. Such a job now runs once more with the room its kill gives it (1.5x), and the
leg is judged on that run.
Verified: the script parses; exercised by the next matrix --legs rerun on 248d41074f.
The cross-GPU time rule took its median from the run's own GPU legs, so `run --legs` of one GPU
had fewer than three and never judged time. The median now takes every GPU leg of the sha's
note, with each leg's base, and only the legs of this run are judged.
The harness suite counts no tests, so its verdict read "harness 0/0"; a suite that ran no test
now shows its exit code.
Verified: unittest of scripts/matrix passes; `show 73e0af4b66` prints the new form.