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)
103 lines
3.8 KiB
TOML
103 lines
3.8 KiB
TOML
[package]
|
|
name = "metal2vulkan-runtime"
|
|
version = "0.2.0"
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
authors.workspace = true
|
|
description = "The Metal API on Vulkan: Metal's objects and calls run on a Vulkan device through ash"
|
|
readme = "README.md"
|
|
repository.workspace = true
|
|
documentation = "https://docs.rs/metal2vulkan-runtime"
|
|
keywords = ["metal", "vulkan", "gpu", "graphics"]
|
|
categories = ["graphics", "api-bindings"]
|
|
# No crate root can appear unannounced, so validation's product fingerprint follows exactly the
|
|
# runtime's module tree (build_support.rs). Each example is listed below.
|
|
autobins = false
|
|
autoexamples = false
|
|
# The runtime's tests read the repository's profiles, fixtures and guide beside this directory.
|
|
exclude = ["/target/", "**/*.air", "**/*.metallib", "**/*.spv"]
|
|
|
|
[lib]
|
|
name = "metal2vulkan_runtime"
|
|
path = "src/lib.rs"
|
|
|
|
# Runnable examples for consumers (README.md, "Examples"): each runs the owned fixture
|
|
# validation/fixtures/public/examples/runtime_examples.metal on the system default device, from the
|
|
# workspace checkout (its committed LLVM text, assembled by `llvm-as`), or a metallib passed as the
|
|
# first argument.
|
|
[[example]]
|
|
name = "compute_dispatch"
|
|
path = "examples/compute_dispatch.rs"
|
|
|
|
[[example]]
|
|
name = "render_to_texture"
|
|
path = "examples/render_to_texture.rs"
|
|
|
|
[[example]]
|
|
name = "indirect_command_buffer"
|
|
path = "examples/indirect_command_buffer.rs"
|
|
|
|
[[example]]
|
|
name = "heap_placement"
|
|
path = "examples/heap_placement.rs"
|
|
|
|
[[example]]
|
|
name = "adopted_buffer"
|
|
path = "examples/adopted_buffer.rs"
|
|
|
|
# Not a consumer's example: the host A/B benchmark, the same Metal workloads natively on Metal
|
|
# and through the runtime, with a table of the two (examples/host_ab/main.rs).
|
|
[[example]]
|
|
name = "host_ab"
|
|
path = "examples/host_ab/main.rs"
|
|
|
|
# Not a consumer's example: a command buffer's fixed cost on the submit and completion path, from
|
|
# commit to its handler, and the CPU of the runtime's threads per command buffer
|
|
# (examples/submit_path.rs).
|
|
[[example]]
|
|
name = "submit_path"
|
|
path = "examples/submit_path.rs"
|
|
|
|
# Not a consumer's example: the CPU cost of an indirect command buffer's command setters, a
|
|
# render and a compute command encoded field by field (examples/icb_setters.rs).
|
|
[[example]]
|
|
name = "icb_setters"
|
|
path = "examples/icb_setters.rs"
|
|
|
|
# Not a consumer's example: command queues sharing `VkQueue`s, each workload under the policy its
|
|
# arguments name (examples/queue_share.rs).
|
|
[[example]]
|
|
name = "queue_share"
|
|
path = "examples/queue_share.rs"
|
|
|
|
[dependencies]
|
|
# The translator, through its public API only: the compiler checks that the runtime
|
|
# reaches nothing else. `ash` gives `ash_interop`'s conversions and `DeviceDescription::query`.
|
|
metal2vulkan = { version = "0.2.0", path = "../metal2vulkan", features = ["ash"] }
|
|
# `ash/loaded` opens the Vulkan loader with `dlopen` when a device is created; nothing is linked at
|
|
# build time.
|
|
ash = { workspace = true, features = ["std", "loaded"] }
|
|
# No-copy buffers take the host's page size on unix; elsewhere they are
|
|
# refused typed. It also registers the exit guard's exit handler on unix.
|
|
libc.workspace = true
|
|
# The shader cache's entry names and the binary archive's keys.
|
|
sha2.workspace = true
|
|
|
|
[dev-dependencies]
|
|
serde_json.workspace = true
|
|
# `llvm-as` for the device tests' owned fixture (`tests/pipeline_wait_order.rs`).
|
|
metal2vulkan-devtools = { path = "../metal2vulkan-devtools" }
|
|
|
|
# The host A/B benchmark's native side (examples/host_ab): Metal itself, on macOS.
|
|
[target.'cfg(target_os = "macos")'.dev-dependencies]
|
|
block2 = "0.6"
|
|
objc2 = "0.6"
|
|
objc2-foundation = "0.3"
|
|
objc2-metal = "0.3"
|
|
|
|
# The device tests compile only under the validation crate's GPU safety cfgs (`tests/mod.rs`).
|
|
[lints.rust]
|
|
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(m2v_gpu)", "cfg(m2v_cpu_icd)", "cfg(m2v_gpu_hazards)", "cfg(m2v_no_recycle)"] }
|
|
|