Docs: the runtime is metal2vulkan-rt; HOWTO's sections on the deleted runtime give way to rt's README

metal2vulkan-runtime is deleted, so the user-facing docs name metal2vulkan-rt as the runtime:
- README.md: the crate table's runtime row is metal2vulkan-rt (not published yet); two published
  crates; the git dependency and both README links name it; the runtime needs a Vulkan 1.3 device
  with its README's floor; the sentence on the deleted runtime's repro bundles goes.
- CONTRIBUTING.md: the layout lists metal2vulkan-rt and metal2vulkan-conformance; the gate drops
  `-p metal2vulkan-runtime` and gains the conformance suite's line, as AGENTS.md's gate has it;
  two published crates for the signatures and the license copies; the refusal check reads the
  runtime's refusal enums (the deleted runtime's `Problem` is gone).
- docs/VALIDATION.md: the gate as CONTRIBUTING's; "the new runtime" is the runtime in the matrix
  rules and the command replay (the record keys and `harness --runtime new` keep their names).
- docs/HOWTO.md: the sections on the deleted runtime's shader cache, host memory (no-copy
  buffers, unmapping, copied host buffers, guest RAM) and exported memory described its API
  alone; each is now a pointer to rt's README (The cache directory, Imported blocks, Exported
  blocks and Exported surfaces), stating only what that README states. Section 4 loses the
  deleted runtime's repro bundles; section 8 loses its pipeline names, its start-up checks, its
  suspend-time measurements of its own calls and its exit-handler probe, keeping the driver facts.
- docs/ARCHITECTURE.md and the CI workflow's comment name the runtime as metal2vulkan-rt.

Left for the translator's commit (part 2): FAST-PATHS.md and the DevicePolicy text in README,
CONTRIBUTING and VALIDATION's golden-table paragraph ("The old runtime's translations do not
move"), which follows the matrix's old-path rule.

Verified: the compile job is named in the hand-off.
This commit is contained in:
Anees Iqbal committed 2026-11-20 07:58:56 -08:00
1 parent 3620f4dc6b
commit 4d3daeace8
6 files changed
+53 -1186

No files matched your search

+1 -1
View File
@@ -227,7 +227,7 @@ jobs:
- name: Doc tests
run: cargo test --workspace --all-features --doc
# Device-executing validation tests, and the new runtime's floor check, on lavapipe.
# Device-executing validation tests, and the runtime's floor check, on lavapipe.
# `DeviceType::Cpu` matches only a CPU physical device, and the runtime's device tests under
# `m2v_cpu_icd` check only CPU devices, so this never reaches a GPU even on a runner that has
# one. macOS CI runs no device tests.
+10 -7
View File
@@ -32,13 +32,14 @@ they bind people too.
│ │ ├── tests/ # integration tests through the public API, golden tables
│ │ └── examples/ # api_preview.rs, which docs/API.md quotes
│ ├── metal2vulkan-air/ # the AIR front end
│ ├── metal2vulkan-runtime/ # the Metal API on Vulkan (README, examples)
│ ├── metal2vulkan-rt/ # unpublished: the runtime, the Metal API on Vulkan (README)
│ ├── metal2vulkan-validation/ # unpublished: cases, executors, corpus tools
│ │ ├── fixtures/public/ # our own synthetic fixtures (.ll, .air.ll, .metal, .spvasm)
│ │ ├── profiles/ # committed Khronos device profiles
│ │ └── corpus/ # authored cases and observations (local/ is private, ignored)
│ ├── metal2vulkan-conformance/ # unpublished: the Metal conformance suite
│ ├── metal2vulkan-devtools/ # unpublished: tool runner, fixture assemblers
│ └── metal2vulkan-harness/ # unpublished: the runtimes' compute harness (crate docs)
│ └── metal2vulkan-harness/ # unpublished: the runtime's compute harness (crate docs)
├── docs/ # guides and generated references
├── scripts/ # developer utilities and generators
├── Cargo.toml # the virtual workspace
@@ -53,8 +54,9 @@ cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
RUSTDOCFLAGS='-D warnings' cargo doc --workspace --all-features --no-deps
scripts/api-docs # the translator's API reference; fails on a link to a hidden item
cargo nextest run -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-rt -p metal2vulkan-runtime -p metal2vulkan-devtools -p metal2vulkan-harness --all-features
cargo nextest run -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-rt -p metal2vulkan-devtools -p metal2vulkan-harness --all-features
cargo nextest run -p metal2vulkan-validation --all-features
cargo nextest run -p metal2vulkan-conformance --all-features
cargo test --workspace --all-features --doc
```
@@ -170,7 +172,7 @@ Edit the source, then regenerate:
| `crates/metal2vulkan-validation/profiles/*.json` | `scripts/regen-device-profiles/` | gpuinfo reports and local captures |
`crates/metal2vulkan/tests/api_signatures.tsv` is written the same way: the signature-level public
surface of the three published crates and of `metal2vulkan-rt`, by
surface of the two published crates and of `metal2vulkan-rt`, by
`python3 scripts/api-signatures/signatures.py --bless` (`--check` to verify, `--selftest` for the
derivation's own tests), from those crates' sources alone.
`crates/metal2vulkan/tests/api_signatures.rs` says what it pins, what it cannot see, and what
@@ -178,7 +180,7 @@ blessing it asserts; a removed or changed line is a breaking change of a publish
API `metal2vulkan-rt` is published with at the cutover.
Four docs are checked by tests. `docs/REFUSALS.md` must be the surface the sources state, and
every variant of the runtime's `Problem` must end its doc comment with a `Basis:` line that says
every variant of the runtime's refusal enums must end its doc comment with a `Basis:` line that says
where the belief that Metal refuses that input comes from and cites its evidence
(`crates/metal2vulkan/tests/refusal_surface.rs`, which says what it cannot see; a basis that is
not settled is `Basis: unknown (why)`, never nothing). `docs/FAST-PATHS.md` must name every
@@ -204,6 +206,7 @@ metal2vulkan is dual-licensed, `GPL-2.0-or-later OR LGPL-3.0-or-later`, at the r
can be redistributed and modified under either.
The license files sit at the root and, because cargo packages each crate from its own directory,
as copies in every published crate (`crates/metal2vulkan`, `crates/metal2vulkan-air` and
`crates/metal2vulkan-runtime`). Change them at the root and copy them over; a validation test (`published_crates`) holds every copy equal to the root's file
as copies in every published crate (`crates/metal2vulkan` and `crates/metal2vulkan-air`). Change
them at the root and copy them over; a validation test (`published_crates`) holds every copy equal
to the root's file
and the notice's SPDX line equal to the manifests' `license`.
+6 -8
View File
@@ -14,12 +14,12 @@ of a Vulkan device.
| Crate | Directory | What it is |
|---|---|---|
| `metal2vulkan` | [`crates/metal2vulkan`](crates/metal2vulkan) | The translator. A Metal-shaped API (device, library, pipeline descriptors, binding plans) that compiles compute, render, tessellation, tile and mesh pipelines for a described Vulkan device: SPIR-V per stage, one pipeline layout, fixed-function state, and per-draw descriptor writes and push constants. The `cli` feature builds the `metal2vulkan` command. |
| `metal2vulkan-runtime` | [`crates/metal2vulkan-runtime`](crates/metal2vulkan-runtime) | The Metal API on Vulkan: devices, command queues and buffers, encoders, buffers, textures, heaps, pipeline states and events, run on a Vulkan device through `ash`. It uses only the translator's public API. |
| `metal2vulkan-rt` | [`crates/metal2vulkan-rt`](crates/metal2vulkan-rt) | Not published yet. The Metal API on Vulkan, with one path for every device: devices, memory blocks and buffers, textures, sampler states, command queues, command buffers and events, encoders and pipeline states, run on a Vulkan device through `ash`. It uses only the translator's public API. |
| `metal2vulkan-air` | [`crates/metal2vulkan-air`](crates/metal2vulkan-air) | The AIR front end: the metallib container, the bitcode reader, a typed IR, AIR's metadata ABI, intrinsics and canonicalization. For tools that read AIR without translating it. |
| `metal2vulkan-validation` | [`crates/metal2vulkan-validation`](crates/metal2vulkan-validation) | Not published. Authored cases run on Metal and on Vulkan and compared, and bounded audits over a private corpus. |
| `metal2vulkan-devtools` | [`crates/metal2vulkan-devtools`](crates/metal2vulkan-devtools) | Not published. The external-tool runner and fixture assemblers the tests share. |
The three published crates share one version and are released together; `metal2vulkan` pins
The two published crates share one version and are released together; `metal2vulkan` pins
`metal2vulkan-air` exactly.
What the translator promises:
@@ -44,7 +44,7 @@ revision:
[dependencies]
metal2vulkan = { git = "https://github.com/steelbrain/metal2vulkan", rev = "<sha>" }
# For the Metal API on Vulkan:
metal2vulkan-runtime = { git = "https://github.com/steelbrain/metal2vulkan", rev = "<sha>" }
metal2vulkan-rt = { git = "https://github.com/steelbrain/metal2vulkan", rev = "<sha>" }
```
Features of `metal2vulkan`, none needed by the library:
@@ -55,7 +55,7 @@ Features of `metal2vulkan`, none needed by the library:
- `cli`: the `metal2vulkan` command (enables `serde`).
Requirements: Rust 1.98 or newer. The libraries run no external tool. The runtime opens the Vulkan
loader at run time and needs a Vulkan 1.2 device.
loader at run time and needs a Vulkan 1.3 device with what its README's Floor lists.
## Command line
@@ -99,8 +99,6 @@ metal2vulkan kernel.ll kernel.spv --profile device.json --emit-meta kernel.json
- Success prints a line with `PASS` and exits 0. Failure prints `metal2vulkan: FALLBACK (<why>)`,
writes nothing, and exits 2; a failure after the inputs are read also writes a repro bundle
under `$TMPDIR/metal2vulkan-repros` (or `METAL2VULKAN_REPRO_DIR`), whose `repro.sh` replays it.
metal2vulkan-runtime writes the same bundle for a creation it refuses where
`METAL2VULKAN_REPRO_DIR` is set.
- `metal2vulkan --help` lists every option.
## Library
@@ -131,14 +129,14 @@ let pipeline = device.compile_compute_pipeline(&descriptor, &Budget::standard())
cargo run -p metal2vulkan --example api_preview # needs llvm-as on PATH
```
For the runtime, start at [its README](crates/metal2vulkan-runtime/README.md).
For the runtime, start at [its README](crates/metal2vulkan-rt/README.md).
## Documentation
| Document | Read it when |
|---|---|
| [docs/API.md](docs/API.md) | You use the translator's API: devices, libraries, pipelines, binding, caching, errors; and the runtime's degrade notices |
| [Runtime README](crates/metal2vulkan-runtime/README.md) | You use the Metal API on Vulkan |
| [Runtime README](crates/metal2vulkan-rt/README.md) | You use the Metal API on Vulkan |
| [docs/HOWTO.md](docs/HOWTO.md) | You integrate: tools, caching, failures, isolation, the runtime's shader cache |
| [docs/RUNTIME-PORTING.md](docs/RUNTIME-PORTING.md) | You port Metal calls (Objective-C or metal-rs) to the runtime |
| [docs/RESOURCE-ID.md](docs/RESOURCE-ID.md) | You compute a texture's or sampler's `gpuResourceID` on the guest's side |
+2 -2
View File
@@ -92,8 +92,8 @@ rest is `crates/metal2vulkan/src/`.
The translator core (`lower`, `memory`, `spirv`, `spv`, `structurize`) and every submodule of a
public module are crate-private; no feature or cfg exposes them. The runtime
(`crates/metal2vulkan-runtime`), validation and devtools use the public API only. A test that
needs an internal item is one of the crate's own tests (`src/tests/`).
(`crates/metal2vulkan-rt`), conformance, validation and devtools use the public API only. A test
that needs an internal item is one of the crate's own tests (`src/tests/`).
## Decisions come from structure and the device
+22 -1157
View File
File diff suppressed because it is too large. Load diff
+12 -11
View File
@@ -25,8 +25,9 @@ every option.
```sh
cargo fmt --all
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo nextest run -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-rt -p metal2vulkan-runtime -p metal2vulkan-devtools -p metal2vulkan-harness --all-features
cargo nextest run -p metal2vulkan -p metal2vulkan-air -p metal2vulkan-rt -p metal2vulkan-devtools -p metal2vulkan-harness --all-features
cargo nextest run -p metal2vulkan-validation --all-features
cargo nextest run -p metal2vulkan-conformance --all-features
cargo test --workspace --all-features --doc
```
@@ -203,7 +204,7 @@ holds them, then times each GPU in a job of its own.
| Leg | Runs | Built |
|---|---|---|
| Each GPU of a Linux node | `metal2vulkan-rt`'s tests and the replay player's stream device tests (`metal2vulkan-validation`'s `replay::rt_replay`) under `--cfg m2v_gpu`, under the validation layer, the GPU chosen by `VK_DRIVER_FILES` and, on Mesa, `MESA_VK_DEVICE_SELECT='vendor:device!'`; then, in a job that holds the node alone (`--exclusive`) and times this one GPU, the harness's timed workloads (`crates/metal2vulkan-harness`) on the new runtime (`harness --runtime new`), the leg's suite `harness` | Once per commit on a CPU node: the tests as a nextest archive, the harness as a release build; both carried to the GPU nodes, which only run them. The archive holds its build's paths, so every node lays the tree out at the same per-commit path. Its binaries run only where the builder's do: a node of another CPU builds its own, in a job that holds no GPU |
| Each GPU of a Linux node | `metal2vulkan-rt`'s tests and the replay player's stream device tests (`metal2vulkan-validation`'s `replay::rt_replay`) under `--cfg m2v_gpu`, under the validation layer, the GPU chosen by `VK_DRIVER_FILES` and, on Mesa, `MESA_VK_DEVICE_SELECT='vendor:device!'`; then, in a job that holds the node alone (`--exclusive`) and times this one GPU, the harness's timed workloads (`crates/metal2vulkan-harness`) on the runtime (`harness --runtime new`), the leg's suite `harness` | Once per commit on a CPU node: the tests as a nextest archive, the harness as a release build; both carried to the GPU nodes, which only run them. The archive holds its build's paths, so every node lays the tree out at the same per-commit path. Its binaries run only where the builder's do: a node of another CPU builds its own, in a job that holds no GPU |
| The Windows host's GPU | The same tests (under the validation layer) and harness, built on the host under MSYS2 CLANG64 (the pinned nightly's `x86_64-pc-windows-gnullvm` toolchain) | On the host, in a job that holds no GPU |
| `lavapipe` | The gate's suites and the device tests (`metal2vulkan-rt`'s under the validation layer) in one build under `--cfg m2v_cpu_icd` (`cargo nextest run --workspace`, then the doctests), `LP_NUM_THREADS=1` | In place, on the builder |
| `lint` | The gate's `cargo fmt --all --check`, clippy with `-D warnings` plain, under `--cfg m2v_gpu` and under `--cfg m2v_cpu_icd`, and Rustdoc with `-D warnings`, each its own suite | In place, on the builder, beside its other jobs |
@@ -242,10 +243,10 @@ changes the harness sets the base for the next.
| Kind | What it counts | Fails when |
|---|---|---|
| `metric` | A deterministic count per frame or per command buffer: submissions, passes, barriers, bytes copied, pipelines created; and the replay player's totals of a play on the new runtime (`replay-rt/STREAM/RANGE/NAME`, [REPLAY-STREAM.md](REPLAY-STREAM.md) section 10), each one two plays of one stream at one commit on one card gave alike, printed only by a play that finished its range and skipped nothing | It is larger than the base's; a replay total, when it differs from the base's either way, or when the base has it and the leg does not (`EQUAL_METRICS`) |
| `metric` | A deterministic count per frame or per command buffer: submissions, passes, barriers, bytes copied, pipelines created; and the replay player's totals of a play (`replay-rt/STREAM/RANGE/NAME`, [REPLAY-STREAM.md](REPLAY-STREAM.md) section 10), each one two plays of one stream at one commit on one card gave alike, printed only by a play that finished its range and skipped nothing | It is larger than the base's; a replay total, when it differs from the base's either way, or when the base has it and the leg does not (`EQUAL_METRICS`) |
| `instructions` | User-space CPU instructions per draw or per dispatch, and per harness run, the p50 over the row's timed runs: the whole process's (`harness-<runtime>/<row>/per_run`), and where the runtime names its threads, theirs with the harness's thread (`.../own_per_run`) and the rest, a driver's own threads (`.../others_per_run`) | It is more than 1% over the base's; the harness's counts are judged by the instructions gate instead (below) |
| `gauge` | Live objects of one resource kind, the key ending in the point it was read at: `@100` and `@200` (loop iterations), `@drop` (after the device dropped) | `@drop` is not 0, or `@200` differs from `@100`; for the memory pool's `blocks`, which frees allocations an earlier workload left idle once the most bytes in use over its window falls and the device is quiet for 20 ms, only `@200` over `@100` |
| `time` | A duration in microseconds: what a program waits on in a harness workload's run, timed on the host: for the frame rows (`frame`, `frame_5cb`), their throughput, two runs in flight, from one run's last completed handler to the next's, and their latency from idle as rows of their own (`<row>_from_idle`), one run in flight, from its first commit to its last completed handler; for another workload that times its command buffers, its last command buffer's commit-to-complete time (the others' lateness is a column of the harness's table and no record), else the host wall time a run adds (a run's GPU time is a record of its own, `harness-gpu-<runtime>/<row>`, parked here) | Only as a cross-GPU outlier: its ratio to the base's is more than 1.25 times the median of that ratio over at least 3 GPUs. A leg with such an outlier of a harness row's time on the new runtime has its harness timed once more after every leg is in, and an outlier fails the leg only where both passes agree |
| `time` | A duration in microseconds: what a program waits on in a harness workload's run, timed on the host: for the frame rows (`frame`, `frame_5cb`), their throughput, two runs in flight, from one run's last completed handler to the next's, and their latency from idle as rows of their own (`<row>_from_idle`), one run in flight, from its first commit to its last completed handler; for another workload that times its command buffers, its last command buffer's commit-to-complete time (the others' lateness is a column of the harness's table and no record), else the host wall time a run adds (a run's GPU time is a record of its own, `harness-gpu-<runtime>/<row>`, parked here) | Only as a cross-GPU outlier: its ratio to the base's is more than 1.25 times the median of that ratio over at least 3 GPUs. A leg with such an outlier of a harness row's time has its harness timed once more after every leg is in, and an outlier fails the leg only where both passes agree |
| `size` | The size a harness row whose size follows the device ran at (`long_4cb`) | Never: it says what work the row's times measured |
| `locks` | The lock budget's locked instructions per million added commands (`lock_budget/draw`, `lock_budget/bound_draw`, `lock_budget/dispatch`; rt's `tests::locks`), the whole process's in user space, on a node whose matrix setup names its CPU's event in `M2V_LOCK_EVENT` (`cpu_core/r21d0`, `r1e25`) | The test fails past 0.25 per added command, on every node alike; on a node whose setup names the event, a GPU leg missing any of the three fails; elsewhere each budget test passes counting nothing and prints `M2V-MATRIX uncounted lock_budget/<key>`, which the leg's line shows as `not counted` |
@@ -256,9 +257,9 @@ warm first-use records and the rows' GPU times, both below. A parked gauge's cha
and `@200`, or a parked time's cross-GPU outlier, is named on the leg's line and fails no leg; a
parked gauge's `@drop` still fails.
The harness's first-use records (`harness-new/<set>/first_use_*`: how many of the new runtime's
The harness's first-use records (`harness-new/<set>/first_use_*`: how many of the runtime's
first pipeline uses waited, and for how long) depend on the driver's shader cache, which outlives a
run. The harness times the new runtime's rows in one process, `harness --runtime new`, with a fresh
run. The harness times the runtime's rows in one process, `harness --runtime new`, with a fresh
empty cache directory (`MESA_SHADER_CACHE_DIR` for Mesa, `__GL_SHADER_DISK_CACHE_PATH` for NVIDIA;
on the Windows host, `LOCALAPPDATA` and `USERPROFILE` point into it, which the Intel driver's cache
follows), and a fresh empty store for the runtime's own pipelines (the harness's `--store`), so its
@@ -280,8 +281,8 @@ included, are given that size (the harness's `--size`); each run records it as
A harness row's time is judged by the `time` rule alone, as a cross-GPU outlier, and a row whose
time was recorded more than once fails, with no one time to show. The frame and burst rows
(`WALL_ROWS` in `scripts/matrix/results.py`), where the new runtime counted them (Linux, a node
that grants the counter), must also pass the instructions gate, on the new runtime's own
(`WALL_ROWS` in `scripts/matrix/results.py`), where the runtime counted them (Linux, a node
that grants the counter), must also pass the instructions gate, on the runtime's own
instructions per timed run: those of the threads it started, which `Gauges::threads` names, and of
the harness's thread (`instructions harness-new/<row>/own_per_run`). A driver's own threads are
left out (`.../others_per_run`): they swing by millions of instructions per run between processes
@@ -289,13 +290,13 @@ left out (`.../others_per_run`): they swing by millions of instructions per run
most 1.03 times its stored count (`scripts/matrix/instructions.tsv`: one count per row where the
legs agree within 3%, else one per driver family). A stored count only ratchets down: a leg more
than 1% under it is named, and nothing raises it without a ruling; a row with none stored is named.
A new runtime that records its whole count but not its own fails the row. Every row records its
A run that records its whole count but not its own fails the row. Every row records its
counts; only these are gated on them.
Each row's GPU time, the p50 over its timed runs of a run's first GPU start to its last GPU end, is
recorded as `time harness-gpu-<runtime>/<row>` where the row has one; it is parked, shown and not
judged. `run` and `show` print, under each leg's line, every harness row's time, its GPU time and,
where the leg counted them, its instructions per run (with the new runtime's own).
where the leg counted them, its instructions per run (with the runtime's own).
The old runtime's translations do not move. The golden hash table compiles through
`Device::new`, the old runtime's path. When its test reports a cell that changed under an unchanged
@@ -492,7 +493,7 @@ re-record on that venue.
### Command replay
- `command-replay play` plays a replay stream ([REPLAY-STREAM.md](REPLAY-STREAM.md)) on a Vulkan
device through the new runtime and writes its report: the runtime's counters for each group of
device through the runtime and writes its report: the runtime's counters for each group of
command buffers it waited for, each frame and the whole play, the census of written words that
look like addresses (they play as recorded) and the address arguments it moved,
and a SHA-256 of each checked buffer or texture against the recorded one. `command-replay dump`