Commit Graph
6432 Commits
Author SHA1 Message Date
Anees Iqbal 7a3e31ff2e validation: resource_word.rs is a file the old runtime reaches but never runs
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.
2026-11-17 07:18:12 -08:00
Anees Iqbal bfe63b5097 Re-bless the golden tables at 0524d5a1c2
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).
2026-11-17 07:07:49 -08:00
Anees Iqbal 0524d5a1c2 harness: the described test names a definition with a nested fn
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.
2026-11-17 07:04:53 -08:00
Anees Iqbal 1399ab016c harness: the described test's metallib holds one module per kernel
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).
2026-11-17 07:04:53 -08:00
Anees Iqbal 531e41ee93 validation: the replay's waits for command buffers go through the bounded wait module
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.
2026-11-17 07:03:37 -08:00
Anees Iqbal 066122aad6 AGENTS.md: docs/RESOURCE-ID.md in the doc table
The resource ID's spec landed with a6277b1a10. Doc-only change.
2026-11-17 07:03:30 -08:00
Anees Iqbal 77e3a23e5b Re-pin the runtime sources at the landing tip
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.
2026-11-17 07:02:45 -08:00
Anees Iqbal 21082c0094 Re-derive the generated documents at the landing tip
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.
2026-11-17 07:02:13 -08:00
Anees Iqbal 6f5bd20321 stage io: one 32-bit form for every stage output
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.
2026-11-17 07:01:32 -08:00
Anees Iqbal 737ccbf81a metal: the resource ID word, its spec and test vectors
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.
2026-11-17 07:01:32 -08:00
Anees Iqbal c944d63548 matrix: a leg whose suite never reported fails
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.
2026-11-17 06:45:22 -08:00
Anees Iqbal e1648adeb4 metal2vulkan-rt: the memory tests' leak records are read at the device's drop
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).
2026-11-17 06:45:22 -08:00
Anees Iqbal 248cee5cbf matrix: a job killed over its RAM runs once more, sized from that kill
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.
2026-11-17 06:35:58 -08:00
Anees Iqbal 248d41074f matrix: a run of some legs is timed against the note's other GPUs; untested suites show their exit
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.
2026-11-17 06:19:58 -08:00
Anees Iqbal c8321149f7 matrix: a job kind's default minutes stay its timeout floor
The timeout was 1.5x the longest of the kind's last three runs, at least 5 minutes. A held
workspace makes most builds incremental (the msi build of 793a1f7980 took 1.8 minutes), so the
next build was given 5 minutes, which a full rebuild after a translator change would overrun and
waste the run. The kind's default (build 30, Windows build 60, lavapipe 60, GPU 15, timing 20
minutes) is now the floor; measured runs only raise it.

Verified: the script parses; unittest of scripts/matrix passes. The sizing itself runs on the
next matrix run.
2026-11-17 06:19:58 -08:00
Anees Iqbal 4406486e8c docs: the matrix's harness suite and time records 2026-11-17 06:19:58 -08:00
Anees Iqbal 56b979574e metal2vulkan-rt: the teardown gauges name their point, @drop, as the matrix reads them 2026-11-17 06:19:58 -08:00
Anees Iqbal 6a5e230514 matrix: the harness's timed workloads per GPU in an exclusive job; time records in microseconds 2026-11-17 06:19:58 -08:00
Anees Iqbal bb30a0b040 matrix: a GPU job prunes carry mirrors left by jobs that never ran 2026-11-17 06:19:58 -08:00
Anees Iqbal 391cc679e7 matrix: a chain's own failure fails its legs; no stats for a job that never started 2026-11-17 06:19:57 -08:00
Anees Iqbal aaa6350ee6 matrix: record the driver version; read dispatch errors from the reply 2026-11-17 06:19:57 -08:00
Anees Iqbal b4b22c7b2c matrix: the per-commit matrix runner and the user-space instruction counter (WIP) 2026-11-17 06:19:57 -08:00
Anees Iqbal 4dcd5a74b9 AGENTS.md: docs/REPLAY-STREAM.md in the doc table
The replay stream format and its player landed in 84fc9a95fc; the doc table names every doc an
agent reads. Doc-only change.
2026-11-17 06:15:44 -08:00
Anees Iqbal 84fc9a95fc validation: replay streams name the guest RAM copies; a present reads nothing
The recorder writes the host's copies between the guest's RAM and a buffer as blit-encoder
records: m2v.copyFromGuestRam ([runs, buffer, offset, data]), m2v.copyFromGuestRamAt ([placed runs,
buffer, data]) and m2v.copyToGuestRam ([buffer, placed runs]), a run being [start, end] host
addresses of which only the length counts. docs/REPLAY-STREAM.md names them, with the data the
next recording carries. The player relocates the data of every upload (these two and
m2v.copyBytes:toBuffer:offset:) by one rule, where its buffer answered a gpuAddress, and counts its
bytes as written; the old runtime's backend copies them through a staging buffer, piece by piece,
and copies m2v.copyToGuestRam into host memory nothing reads.

m2v.present is now recorded wherever the device's display shows a guest present, a nil texture
where the stream never made it, so frames are counted once: the player closes the frame and
reads nothing (a readback per frame would add a copy Metal does not make).

Tests: a unit test plays the three copy-ins into a block and an addressless buffer (relocated,
counted apart 4 past 8, untouched) and refuses data of another length than its runs; a device
test lays a buffer out with a fill, both guest RAM copies, a fill copy and a copy back, and reads
it back as expected.
2026-11-17 06:14:55 -08:00
Anees Iqbal a934dea858 validation: replay device tests take the queue plan
A play's readbacks take a command queue beside the stream's, which the lane's queue limits put on
the one shared VkQueue on NVIDIA (metal2vulkan-queue-limits-reached on the RTX 3090 and RTX 2080,
jobs m3-max-40608 and m3-max-40607); the tests make their devices at the plan (at_plan).
2026-11-17 06:14:55 -08:00
Anees Iqbal 1de964bbff validation: command-replay picks its subcommand with a plain match (clippy type_complexity, job m3-max-40574) 2026-11-17 06:14:54 -08:00
Anees Iqbal 9f6e6a8b37 validation: replay clippy (a boxed blit encoder, pairs as chunks, slices from refs) and the relocation test's offsets
Clippy -D warnings in job m3-max-40563; the address map test put its aligned and its 4-past-8 address
the other way round from its assertions (the counts held).
2026-11-17 06:14:54 -08:00
Anees Iqbal 27ba730d44 validation: the replay reader asks whether a segment is the last before borrowing it
The segment count was read while the segment was borrowed mutably (E0502, job m3-max-40546).
2026-11-17 06:14:54 -08:00
Anees Iqbal 964ae2c241 validation: replay streams v2, their player and the old runtime's backend
What: docs/REPLAY-STREAM.md specifies the binary replay stream (version 2): segments of records
(names, blobs by SHA-256 of the exact bytes, calls), tagged values, the address and resource-ID
model, CPU writes, surfaces before the platform cutover, commits, events and frames. The new
`replay` module of the validation crate holds its reader and writer, the address map, the player
(relocation of 8-byte-aligned address words in live recorded ranges, counting rewritten words and
the 4-mod-8 values it leaves; exact resource IDs; waits only for command buffers that can
complete, so one held on an event never stops another queue; counters per waited group, per frame
and in total, readbacks excluded; SHA-256 checks), and a backend over the old runtime's public API
(compute and blit encoders, blocks as placement heaps, textures at recorded IDs, events). A
selector it does not play is a typed refusal naming it.

`command-replay` now plays and dumps v2 streams; the v1 JSON manifest runner is deleted (nothing
in the tree or the lanes used it).

Tests: unit tests write their own streams (round trip, segments and a cut tail, refused kinds and
versions, the blob directory and its hash check, nested ranges, relocation counts, event-held
command buffers, frames, releases and host splits). Device tests (`runtime_lane::replay_streams`,
under m2v_gpu or m2v_cpu_icd) play written streams on the old runtime: a device pointer written
at a recorded block address is relocated and the kernel's output is the case's Metal output, on
two devices alike; a command buffer held on a CPU-set shared event does not stop another queue's;
textures are made at recorded resource IDs 77 and 5 and read back as written.
2026-11-17 06:14:54 -08:00
Anees Iqbal ec40b7de6d Interface: what a function reads and writes beyond its bound slots
Each stage interface, and a pipeline's together, states whether its
function may read or write a resource through anything but its bound
slots: a pointer or texture it loads from memory or makes from an
integer (an argument buffer's resources, an address stored in a buffer,
a resource ID), an indirect command buffer, ray tracing, or a call it
cannot see into. Decided from the specialized entry's memory plan: an
access whose pointer or texture handle may have a dynamic or call root.
With each slot's access, these are the two static facts the new
runtime's compute encoder needs to place a barrier only on a hazard.

SEMANTICS_VERSION 2144 (interface facts), ARTIFACT_FORMAT_VERSION 526
(two fields in StageInterface and PipelineInterface).
2026-11-17 06:14:08 -08:00
Anees Iqbal a933b864a4 harness: a described buffer filled zero is left as made
Metal makes a new buffer zero, so a zero fill needs no copy in the harness
and no upload: a described workload's buffers reach hundreds of MiB, and
holding their zeros doubled its memory and added a copy before its first run.

Verified: the description unit test asserts the zero buffer has no contents
(compile job after this commit).
2026-11-17 06:10:21 -08:00
Anees Iqbal 71eb64cd42 harness: a workload with no dispatch is refused as such, bindings or not
The per-dispatch reading refused a workload of bindings and no dispatch as
setting a binding after its last dispatch; it has no dispatch, which the
refusal says again.

Verified: the description refusal unit test in the compile job after this
commit.
2026-11-17 06:10:21 -08:00
Anees Iqbal 463599f647 harness: each dispatch's bindings a fresh local, moved once its dispatch is read
Draining the pending bindings trips clippy's drain_collect, which asks for
mem::take, a placeholder move this tree does not use. Each dispatch now reads
its lines into a Vec of its own, moved into the dispatch once the dispatch
line is read; at the end of the lines, bindings left over are the refusal
they were.

Verified: clippy and the description unit tests in the compile job after this
commit.
2026-11-17 06:10:21 -08:00
Anees Iqbal 5e94f0d887 harness: buffer creation workloads, old runtime against new
Shared buffers of 4 KiB, 1 MiB and 64 MiB made and released in turn, so each
takes the range the last one left: Session::create times each
newBufferWithLength:options: call by wall clock, checks the new buffer starts
zero (every word the first time, one word a 4 KiB page after), writes it all
over and releases it. The first creation of the length writes and releases a
buffer before the loop, so even the checked one reuses a dirtied range. The
command runs them after the authored workloads and prints their p10, p50 and
p90 and the gauges at the 100th and 200th, with
M2V-MATRIX time harness-<runtime>/create_<size> lines; --only selects them.

Verified: unit test of the zero check over a host buffer; the device test
creates each size once on the old runtime (compile job after this commit).
2026-11-17 06:10:21 -08:00
Anees Iqbal c546c13905 harness: a dispatch drains the pending bindings (clippy new_instead_of_clear)
Moving the pending bindings into the dispatch and assigning a new Vec trips
clippy's new_instead_of_clear on the dated nightly; draining them leaves the
Vec empty for the next dispatch without a reassignment.

Verified: clippy in the compile job after this commit.
2026-11-17 06:10:21 -08:00
Anees Iqbal a20f8503f8 harness: described workloads over metallibs, and outputs compared between runtimes
What: a description file names workloads over metallibs in a directory (description.rs): per
workload its metallib, buffers (length, storage mode, fill: zero, seeded words, seeded floats
in [0, 1), or hex), the setBuffer/setBytes calls before each dispatch, dispatchThreadgroups or
dispatchThreads with an optional repeat, and the buffers runtimes compare (exactly, or as
floats within a tolerance, NaN matching NaN). Both are the command's arguments
(--workloads DIRECTORY --description FILE); nothing in the tree names such a workload. Each
workload's plan, which holds its buffers' starting contents, is made once at parse to check it
and again when it runs.

The harness owns its device, the authored library and the metallibs plans named (run.rs), behind
an object-safe Session, so the command runs each workload on every runtime it names in turn
(--runtime old[,RUNTIME...]) and prints its rows only once each runtime's outputs after the first
run matched the first runtime's (compare_outputs). Plans carry their library (Source) and their
outputs.

Why: the benchmark's harvested kernels have no CPU reference; the old and the new runtime check
each other on the same inputs instead.

Verified: see the lane report (compile job and GPU legs).
2026-11-17 06:10:21 -08:00
Anees Iqbal c43fccb7c2 metal2vulkan-rt: the consumer's instance and device extensions, enabled where offered
What: Instance::new takes any instance extension, not only the window system's: it
enables the floor's and each one the consumer names that the loader offers, once,
and Instance::extensions lists those enabled. DeviceOptions::extensions names
device extensions beyond the floor's. A DeviceExtension is a name and, through
DeviceExtension::with_features, its feature structure: the members the consumer
needs set, and a test of the device's answer. Device::new enables each where the
device lists it and, for one with features, where vkGetPhysicalDeviceFeatures2's
answer passes the test, chaining the consumer's structure in front of the floor's;
it passes over the rest. Device::extensions lists those enabled, the floor's first.

Why: reims's review (F12): present fences need VK_EXT_swapchain_maintenance1 with
its swapchainMaintenance1 feature, and the instance's surface_maintenance1 and
get_surface_capabilities2. Without them, retiring a swapchain waits for the
presenting queue to go idle, which on a shared queue covers every guest's GPU
work. The consumer names an extension's dependencies too.

How verified: the device test enables, on every device of the cfg's kind, a
missing name, a floor name again, and swapchain_maintenance1 with its feature
where the instance has its dependency, and expects exactly the floor's plus what
the device offers; the instance likewise with the two surface extensions. The API
signature table is blessed for the new items and Instance::new's renamed
parameter.
2026-11-17 06:01:27 -08:00
Anees Iqbal 650c070dcb metal2vulkan-rt: the runtime-queue test helper only under the device cfgs; a struct literal for test options
clippy -D warnings (job m3-max-40633): the helper was unused in plain test
builds, and the memory tests reassigned a field of a default DeviceOptions.
2026-11-17 05:58:26 -08:00
Anees Iqbal c052143c75 metal2vulkan-rt: memory blocks, the pool that makes them ahead, and buffers as views
What: Device::take_block and release_block hand out memory blocks of two classes,
Private (the floor's device-local type, never mapped) and Shared (the host-visible,
coherent, cached type, mapped for the block's life), each one VkBuffer with every
buffer usage and a device address over an allocation of its own. Up to BLOCK_LEN
(256 MiB) a block is pooled: the block-maker thread ("m2v-blocks") keeps one ready
per class, off every caller's path, so a take waits only when none is ready. Past
it a block is dedicated: the length rounded up to 64 KiB, made in the call, up to
maxMemoryAllocationSize and maxBufferSize (Limit::BlockLen). Device::new_buffer
makes a Buffer, a (block, offset, length) view with no Vulkan object: gpu_address
is the block's address plus the offset, contents its mapping plus the offset, or
None in Private.

Every block reads zero when handed out, new or taken again, as Metal's new buffers
do: Shared zeroed through its mapping (which also makes every page resident before
anyone holds it), Private by a GPU fill submitted on the runtime's queue and waited
for. new_buffer(.., zeroed: true) zeroes exactly the buffer's range before it
returns: through the mapping in Shared; in Private a fill of the whole 4-byte words
inside the range and copies of the bytes beside them from a 16-byte zero source.
Heap placements pass false. A length of 0 and a range past the block are refused
(Refusal::EmptyBuffer, Refusal::BufferPastBlock), as Metal answers nil.

A released block takes effect once its last buffer is gone (buffers hold it).
The block-maker thread then zeroes a pooled block and keeps it, with its number,
address and mapping, while its class has fewer than two idle; the rest, and every
dedicated block, it frees after the consumer's BlockMappings::unmap, which
DeviceOptions carries. Block numbers are never reused (Limit::BlockIds). Teardown
stops and joins the block-maker thread, waits for the GPU, then frees every block
on the dropping thread, calling unmap for each the consumer was handed, and
destroys the device.

Counters: blocks and buffers gauges, blocks_made and submissions metrics are now
written.

Cleanup: floor::check already refuses a device with no graphics+compute family,
so Device::new takes capabilities.queue_family and keeps only the spare-queue
decision for presenting; queue_plan and Error::NoGraphicsComputeQueue are gone.
Device::new takes DeviceOptions.

Not here: the reuse of a released block waits only for its buffers; waiting also
for the last command buffer that used it arrives with command buffers.

The API signature table is blessed for the new items, the removed variant and
Device::new's new parameter; docs/REFUSALS.md regenerates unchanged (its rt scan
reads the floor's Missing only).
2026-11-17 05:55:07 -08:00
Anees Iqbal 08bde281aa metal2vulkan-rt: std430 uniform blocks, explicit threadgroup layout and the private memory type in the floor; Device keeps its memory types
Every lab capture (3090, 2080, XTX, RX 550, 780M twice, HawkPoint, Iris Xe,
UHD 630 under Windows, lavapipe) offers uniformBufferStandardLayout and
VK_KHR_workgroup_memory_explicit_layout with all four of its features, which
the translator emits for std430 uniform blocks and explicitly laid-out
threadgroup blocks. So the floor requires them: the extension joins
DEVICE_EXTENSIONS, and Features gains workgroup_layout, read only from a
device that lists the extension (a device-extension structure may be queried
only there). Each is named when missing, with a unit case.

MemoryTypes gains `private`: the first device-local type a BUFFER_USAGE
buffer can use, for the core lane's Private storage. Vulkan guarantees one, so
it is named (as a MemoryType) only on a device that breaks that rule.

Device::new chains vulkan11 and workgroup_layout into device creation, then
chooses the memory types on the device with floor::memory_types (destroying
the device if that refuses), and keeps them; Device::memory_types returns
them. The device test checks each type's flags and prints all three.

docs/REFUSALS.md and api_signatures.tsv are regenerated over development's
new rt types.
2026-11-17 05:38:05 -08:00
Anees Iqbal 374e29a988 metal2vulkan-rt: the floor's shader features, queue family, timestamps and memory types
The floor now also requires what the translator's shaders and the runtime's
core need of every device:

- shaderInt16, shaderInt8, storageBuffer16BitAccess (Vulkan 1.1 features,
  now read and enabled through Features::vulkan11), storageBuffer8BitAccess,
  scalarBlockLayout, vulkanMemoryModel and vulkanMemoryModelDeviceScope. The
  translator emits 8- and 16-bit access only in storage and physical storage
  buffers in practice (uniform views are u32 or uvec4, push fields are 32- or
  64-bit), so the uniform and push-constant 8/16-bit features stay out; it
  does use device scope.
- timestampComputeAndGraphics, and timestampValidBits of at least 36 on the
  first queue family with graphics and compute, which Capabilities names
  (queue_family). A device with no such family is Missing::QueueFamily.
- a host-visible, host-coherent, host-cached memory type (Shared storage)
  and a device-local, host-visible, host-coherent one (the parameter ring),
  each usable by a buffer of BUFFER_USAGE: every Vulkan 1.3 buffer usage plus
  device addresses. Vulkan answers buffer memory types only for a created
  device, so check() finds a type with each set of flags and carries the
  memory properties, and memory_types(device, &capabilities) chooses the
  first usable type of each with vkGetDeviceBufferMemoryRequirements.
  Missing::MemoryType names the flags.

Each shortfall is named in BelowFloor, with a unit case; the README's Floor
section states every item and tests::floor holds it to the code. The device
test now also creates each device with the floor's features and extensions
and chooses its memory types on it.

CI's lavapipe step (ci.yml and scripts/linux-gate-ci) runs the rt crate's
device tests too. refusal_surface.py reads metal2vulkan-rt and writes the
floor's Missing as section 10 of docs/REFUSALS.md; signatures.py pins
metal2vulkan-rt's public surface in api_signatures.tsv.

Verified: see the lane report (compile job, device legs on every lab GPU,
lavapipe and the Windows UHD 630).
2026-11-17 05:33:25 -08:00
Anees Iqbal 793a1f7980 metal2vulkan-rt: device tests format flags without Debug 2026-11-17 05:26:58 -08:00
Anees Iqbal 49a879bd0c metal2vulkan-rt: the instance, one device for everything, and its counters
Instance::new loads the loader and makes the instance at the floor's version with
the floor's and the consumer's surface extensions; physical_devices lists
PhysicalDevice handles that keep their instance alive. Device::new checks the
floor, makes one VkDevice with the floor's feature chain, and takes the first
graphics+compute family: one queue for the runtime and a second for presenting
where the family has one, else the same queue behind the same lock. raw() and
with_present_queue() give the consumer its handles; has_unified_memory() answers
from the device type. Teardown waits idle with every queue held, then destroys
the device. Counters (metrics and gauges, relaxed atomics) outlive the device.
2026-11-17 05:26:58 -08:00
Anees Iqbal eb7621de3b harness: the old runtime's gauges are its blocks with placements, not its kept empty ones 2026-11-17 05:22:15 -08:00
Anees Iqbal e1194be831 harness: doc links name Harness::run 2026-11-17 05:22:15 -08:00
Anees Iqbal ed7187a4e1 harness: authored workloads as named structs (clippy type_complexity) 2026-11-17 05:22:15 -08:00
Anees Iqbal 017ff31e2f wip harness crate 2026-11-17 05:22:15 -08:00
Anees Iqbal e21b8be64b harness fixture: companions and TOOLCHAIN from regen-air-fixtures --dir harness (job m3-max-40434) 2026-11-17 05:22:15 -08:00
Anees Iqbal ff0c532d71 harness fixture: the authored workloads' kernels (MSL, companions to come) 2026-11-17 05:22:15 -08:00
Anees Iqbal fe26a21c55 metal2vulkan-rt: tests::floor's device test checks the devices of its cfg's kind 2026-11-17 05:05:38 -08:00