Owner's rule (11-05): tests that fault a real GPU, hold one for long, or
allocate toward its limits never run in sweeps, lanes, stress loops or
gates; they run only when that feature is tested, on request. On the M3
Max a GPU fault's recovery fails other processes' command buffers in
flight (.config/nextest.toml has the measurement). #[ignore] is not
enough, since lanes run --run-ignored all, so the gate is a cfg: on a
real GPU a hazard compiles only under --cfg m2v_gpu --cfg
m2v_gpu_hazards. Under --cfg m2v_cpu_icd it compiles and runs as
before, so lavapipe CI keeps them.
Gated (each doc comment now says which hazard it is):
- runtime_lane::host_memory::a_gpu_fault_fails_its_command_buffer_and_the_queue_runs_on
and ::a_lost_device_s_command_buffers_let_go_of_their_pools_after_the_driver_s_completion:
GPU writes into read-only host pages, real page faults (2 and 3).
- host_memory::a_no_copy_buffer_s_pages_are_imported_when_it_is_made:
no-copy buffers of 1 to 16 GiB.
- vertex_strides::vertex_fetches_past_4_gib_of_a_buffer_are_refused and
stage_in_strides::stage_in_fetches_past_4_gib_of_a_buffer_are_refused
(and their `Large` helper): 4 GiB + 4 KiB buffers.
- heaps::the_largest_heap_lies_in_one_allocation: a heap of the device's
largest allocation, up to 4 GiB.
- cross_queue_shadows: the three tests whose spin holds one command
buffer for 1.5 s.
- framebuffer_fetch::storage_forms::a_steady_stream_takes_the_storage_form_at_its_first_lone_commit:
a single-dispatch spin of up to 1 s that only its cap ends on Apple GPUs.
- detach::table_3_a_detach_waits_for_running_work_then_refuses: single
dispatches calibrated to 500 ms (up to 2 s loaded), the cap alone ending
them on the M3 Max, where Metal ended some 0.5 s dispatches as hung.
- runtime tests::detach_lost: one dispatch of 2^25 loads (about 4.5 s on
the M3 Max) whose word the GPU does not see raised.
Made safe instead of gated:
- mesh_draws::object_grids_run_as_metal_runs_them: on a GPU without the
hazards cfg, grids past 2^20 object threadgroups are skipped (printed),
as a CPU ICD already skips them; the 70k to 262k grids and the
past-the-watchdog discards still run. The 4.6M grid took 12 s in one
command buffer on the RTX 5080 Laptop GPU.
- detach::a_resident_buffer_no_command_reaches_fails_its_submission_once_detached
takes the spin kernel without calibrating a cap (`spin_kernel`): its
word is raised, so the cap never mattered, and the calibration's
unraised runs are bounded only at 16 x 50 ms.
- cross_queue_shadows::an_encoder_after_a_signal_reads_what_another_queue_wrote_after_it
no longer calibrates a spin it never ran.
The cfg is declared for unexpected_cfgs in the runtime, validation and
conformance manifests. docs/VALIDATION.md says what a hazard is and how
to run one; CONTRIBUTING.md and .config/nextest.toml mention the cfg.
The device lane is unaffected: its builds set RUSTFLAGS to --cfg
m2v_gpu alone. No product code changed (no RUNTIME_VERSION bump; the
runtime-sources pin skips test modules).
Verified on this Mac (no test run on any GPU): cargo fmt --all; cargo
clippy --workspace --all-targets --all-features -D warnings clean plain,
under --cfg m2v_gpu, --cfg m2v_gpu --cfg m2v_gpu_hazards and --cfg
m2v_cpu_icd. cargo nextest list -p metal2vulkan-runtime -p
metal2vulkan-validation --all-features --run-ignored all: under --cfg
m2v_gpu 5022 tests, under --cfg m2v_gpu --cfg m2v_gpu_hazards 5034, and
the difference is exactly the 12 gated tests; all 12 are listed under
--cfg m2v_cpu_icd (5000 tests).
(cherry picked from commit 7b57d9a87a3dd8275a2ece547fc0bd9b9cb6808c)