Tests: the refused device's memory view has three doors, and a device opens through it only by the floor's choice

What: cached_types_incoherent moves from tests/mod.rs into tests::command::on_device and is no
longer crate-visible. The tests reach it through three doors alone:
- each_device_under_the_view, the one way a test opens a device through the view; the floor's
  choice over the viewed types decides the arm, and a refused make is asserted and printed;
- viewed, which returns a device's memory properties read through the view (the coherence test's
  read of the types a device under m2v_shared_view reads); it takes and returns a value, so it is
  no DeviceOptions::memory;
- suite_view, compiled only under m2v_shared_view, the suite-wide hook in Device::new that gives
  every device the view where the test gives none.
The doc mentions of the old path (coherence.rs, floor.rs, the settle test, docs/VALIDATION.md)
name the new one.

Why: the planner's ask after the second red of this class today. kkview (cb3d913139) fixed two
view tests that opened KosmicKrisp through the view raw, and the settle test (f78d45b9e0) was a
third, landed beside that fix. With the view private, a new test cannot pass it to
DeviceOptions::memory in the device cfgs; it has to take each_device_under_the_view. The
m2v_shared_view hook stays a door of its own because that cfg runs the whole unchanged suite
through the view on cards the floor opens under it (docs/VALIDATION.md), which no per-test helper
gives. Test only; the runtime does not change.
This commit is contained in:
Anees Iqbal committed 2026-11-25 16:54:02 -08:00
1 parent 5f3ffaaa28
commit 6db36df158
6 files changed
+69 -48

No files matched your search

+11 -10
View File
@@ -51,16 +51,17 @@ hang the host. So everything that opens a device is explicit, bounded and refusa
| `--cfg m2v_gpu --cfg m2v_shared_view` | `metal2vulkan-runtime`'s devices read their memory types as the refused device's | a real GPU | to test Shared memory's coherence, in its own target directory |
`m2v_cpu_icd` and `m2v_gpu` are mutually exclusive; `m2v_gpu_hazards` adds to `m2v_gpu` and means
nothing alone. So does `m2v_shared_view`: every device `metal2vulkan-runtime`'s tests make with
no memory view of their own (`DeviceOptions`'s test-only `memory`) reads its memory types through
`tests::cached_types_incoherent`, which takes `HOST_COHERENT` from every host-visible,
host-coherent, host-cached type, as a Meteor Lake GPU under Mesa's Intel driver and i915 lists
them. Shared storage then takes a cached type that is not coherent, so the unchanged device suite
runs Shared memory's flushes and invalidates (the runtime README, "Shared memory's coherence") on
a GPU whose memory is coherent in fact; Vulkan allows both calls on a coherent type. Lavapipe
cannot run it: its one memory type also holds the parameter ring, which needs a coherent type.
Under the view a card whose host-pointer and dma-buf queries offer only its cached types refuses
every import; run it with the import families filtered. Lint the gated code without running it, in its own target directory:
nothing alone. So does `m2v_shared_view`: every device `metal2vulkan-runtime`'s tests make with no
memory view of their own (`DeviceOptions`'s test-only `memory`) reads its memory types through
`tests::command::on_device::cached_types_incoherent`, which takes `HOST_COHERENT` from every
host-visible, host-coherent, host-cached type, as a Meteor Lake GPU under Mesa's Intel driver and
i915 lists them. Shared storage then takes a cached type that is not coherent, so the unchanged
device suite runs Shared memory's flushes and invalidates (the runtime README, "Shared memory's
coherence") on a GPU whose memory is coherent in fact; Vulkan allows both calls on a coherent type.
Lavapipe cannot run it: its one memory type also holds the parameter ring, which needs a coherent
type. Under the view a card whose host-pointer and dma-buf queries offer only its cached types
refuses every import; run it with the import families filtered. Lint the gated code without running
it, in its own target directory:
```sh
CARGO_TARGET_DIR=target/gpucfg RUSTFLAGS='-Dwarnings --cfg m2v_gpu' \