Files
reims-vgpu/scripts/feature-matrix
Anees Iqbal 1bf7f90ce5 contract: the protocol vocabulary cannot name a backend, and now the compiler says so
Component: crates/reims-vgpu (contract, runtime/compute_exec) plus the new
crates/reims-vgpu-contract. Pathway: all three. Structural; no guest-visible
behavior and no rail-specific term.

Contract: the catalogue's F0 item asks for a backend-neutral semantic vocabulary
— decoded enums, descriptors, geometry, pixel formats, pass actions, page
arithmetic, exact refusal values — with Vulkan handles, SPIR-V, memory
placement, descriptors, queue families, image layouts and host capability policy
kept out of it. `contract/`'s own doc already said "pure data and pure functions
only — no guest state, no GPU, no QEMU", and every module in one crate could
reach every other, so the rule held only while someone was reading.

Owner: the crate graph. Behaviour changed: none at runtime. `src/contract/`
becomes `reims-vgpu-contract`, depending on the wire views, the paging walk, and
the decline vocabulary — nothing else is in scope, so a contract check cannot
name an `ash` type, a Metal object, a QEMU type or this device's state by
accident. It is re-exported as `crate::contract`, so no call site moves.

The move produced one thing the doc could not. `Extent3` is shared between this
decoder and the backend it dispatches through, and `compute_exec` carried an
inherent `impl Extent3` whose two constructors refuse with `ComputeStatus` and
read a decoded `Size3` — device vocabulary the contract crate cannot name. The
orphan rule rejected it. They are now `extent_from_wire` and
`extent_from_indirect` free functions in the decoder that owns those types, with
the same arithmetic and the same refusals; the extent type stays shared and only
the narrowing that produces it from this device's wire moved.

`iosurface_pages`' fixtures took the arm64e page size from `model`, which
re-exports the shift from `contract::gva` and widens it locally for its own
address arithmetic. The test now derives the same `u64` from the same shift on
this side of the boundary, so the two still cannot disagree in value.

Test: no new behaviour, so no new regression test; the counts are the claim.
2274 tests in `reims-vgpu` before, 2165 plus 109 in `reims-vgpu-contract` after
— the same 2274, none dropped or silently cfg'd out. The feature matrix's
support-crates cell counts the new crate too.

Verified: `cargo test -p reims-vgpu --no-default-features
--features backend-vulkan,host-window -- --test-threads=1` (2165 + 97, 0
failed); `cargo test -p reims-vgpu-contract -p reims-vgpu-env -p
reims-vgpu-observe -p reims-vgpu-paging -- --test-threads=1` (109 + 13 + 45 +
36, 0 failed); all three main clippy arms plus `-p reims-vgpu-contract`, all
with `-D warnings`; `scripts/feature-matrix/feature-matrix.sh` all cells PASS;
`cargo fmt --all` and `--check`; the rustdoc link pass, whose unresolved-link
multiset is byte-identical to the parent's; a release staticlib build carrying
no test log path.

Not verified: no VM boot and no conformance battery were run.
`reims-vgpu-wire`'s twelve oracle-fixture failures remain inherited debt,
unchanged and untouched.
2026-08-31 14:42:41 +03:00
..
2026-07-26 15:24:53 +03:00

feature-matrix.sh

Compile every supported reims-vgpu arm and fail if any of them does not build.

Why

The project supports three arms, one per host GPU API actually available:

Arm feature set host
Metal --features backend-metal macOS only
Vulkan / MoltenVK --no-default-features --features backend-vulkan,host-window macOS
Vulkan / native same Linux

vendor/qemu/hw/display/meson.build picks the feature set from REIMS_VGPU_BACKEND, and day-to-day work compiles exactly one arm. The crate spells all(feature = "backend-metal", target_os = "macos") well over a hundred times, so a rename or a cfg change can break an arm nobody builds and stay broken indefinitely — which is what happened to the default build. Running this script is part of "done" for any change that touches cfg-gated code.

There is deliberately no fourth arm. backend-metal off macOS has no Metal to call, so it is a compile_error! in src/lib.rs rather than a host stub that links and cannot draw.

Run

scripts/feature-matrix/feature-matrix.sh              # check + per-arm test counts
scripts/feature-matrix/feature-matrix.sh --no-counts  # compile gate only (faster)
scripts/feature-matrix/feature-matrix.sh --build      # cargo build (link-level)

Output is one line per arm, then the test census:

[feature-matrix] PASS metal / aarch64-apple-darwin                   warnings=108
[feature-matrix] PASS vulkan,host-window / aarch64-apple-darwin      warnings=0
[feature-matrix] PASS vulkan,host-window / x86_64-unknown-linux-gnu  warnings=0

[feature-matrix] tests enumerated per arm:
[feature-matrix]   metal / aarch64-apple-darwin       lib=672   all_targets=685
[feature-matrix]   vulkan,host-window / aarch64…      lib=920   all_targets=992
[feature-matrix]   vulkan,host-window / x86_64…       (cross-compiled — cannot run here)

Which arms a host can build depends on the host. An Apple host builds all three (the Linux one by cross check). A Linux host builds only the native Vulkan arm: Metal is Apple-only and cannot be cross-checked to a host that has no Metal, so it is reported n/a rather than skipped silently.

Notes

  • Warnings do not fail an arm. The count is printed on every run so a jump stays visible. cargo replays nothing for an up-to-date unit, so an arm that was already built reports warnings=cached rather than a false 0.
  • The cross target defaults to x86_64-unknown-linux-gnu. Override with CROSS_TARGET=.... The script fails with the rustup target add command when the target is missing rather than silently skipping the arm.
  • This is a compile gate only. It says nothing about runtime behavior on any arm; a Vulkan change still needs a live boot on the host that owns the pathway.
  • It checks --all-targets, so the test modules are covered too. A bare cargo check can leave arm-specific test code uncompiled while product code still compiles green.
  • Compiling is not testing, which is why the counts are printed. A test that compiles on an arm but is cfg'd out still tests nothing, so a cfg change can empty an arm while every arm stays green. Watch for a dropped count. The gap between the arms (248 lib tests) is the genuinely Vulkan-only surface, not drift.
  • Counting links the test binaries, which is slower than checking; use --no-counts when you only need the compile gate. The cross-compiled arm cannot be counted because its binaries do not run on this host.