What: metal2vulkan-runtime writes the FALLBACK repro bundle the command line writes for its own failures when it refuses a library or pipeline creation, where METAL2VULKAN_REPRO_DIR names a directory (unset, nothing is written). - The CLI's bundle writer moves into the library as the hidden crate-root module metal2vulkan::repro (feature serde), shared by the binary and the runtime. A bundle's directory is named by its content (metal2vulkan-repro-<16 hex>), written under a temporary name and renamed, so an identical failure is written once, across threads, processes and runs. The CLI's own bundles keep their files (input, profile.json, the descriptor files, repro.sh, repro-command.txt, failure.txt); only the directory's name changed, so a bundle written before still replays. - The CLI takes --device FILE in place of --profile: the JSON of a DeviceDescription and DevicePolicy (ReproDevice), which builds the runtime's own compile device. - The runtime hooks each creation where its refusal returns: a library of a metallib, a function's lookup, every compute and tile state (ComputePipelineState/TileState::create_adding: creations, added binary functions, archive adds) and every render state (GraphicsState::create_reflecting). It bundles Unsupported, NotImplemented and Compile refusals but a cancelled compile and a name the library lacks (Metal's own nil); never Invalid/Nil/MetalError. The bundle holds the library's bytes, device.json, the request as the CLI's options and descriptor files, and failure.txt with the call, the refusal and what the command does not replay. That list comes from a full destructuring of the compute, tile and render descriptors (and the stage functions): a new descriptor field fails to compile in repro.rs until it is replayed or listed. - Bounded: at most 32 bundles and 256 MiB per process; past either nothing more is written and one line says so. Written on the refusing thread; the call returns the same refusal; a write failure is said once. Each bundle is named in one line through the device's message sink (id name metal2vulkan-repro). The runtime's metal2vulkan dependency gains serde. - Not bundled: mesh states (no CLI mesh path), a dispatch's or draw's later variant, driver VkPipeline makings, Metal-source libraries. Docs: env_vars registry, README CLI, docs/HOWTO.md section 4, the runtime README's Errors section, the CLI help. Tests: runtime CPU tests of the bounds (a tally with the seam's limits); a lavapipe/GPU device test (ob3_stage_input with no stage-input descriptor: one bundle with the expected parts and command, device.json rebuilding the runtime's compile device by profile fingerprint and answering the same refusal, none for a second identical refusal or a missing name, none without a directory); CLI tests replaying library-written runtime bundles (compute, and render with a vertex descriptor) through repro.sh to the same FALLBACK, and --device compiling what --profile does. Verified at ae56b195e9 (msi, m3-max-32986): metal2vulkan cli, api_surface and api_signatures 25 passed; runtime repro tests 9 passed; clippy -p metal2vulkan -p metal2vulkan-runtime all targets, all features 0. Lavapipe (m3-max-32978): repro_device writes one bundle that the CLI replays to the same refusal; a second identical refusal writes nothing.
202 lines
7.8 KiB
TOML
202 lines
7.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: a kernel submission's cost beside no-copy buffers over dma-bufs, each
|
|
# a dma-buf of its own against pieces of shared files (Linux, udmabuf).
|
|
[[example]]
|
|
name = "shared_files"
|
|
path = "examples/shared_files.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"
|
|
|
|
# Not a consumer's example: what a draw costs the thread that encodes it, in three shapes of a
|
|
# guest's render work: a compositor's binds, many short command buffers, and long ones
|
|
# (examples/draw_costs.rs).
|
|
[[example]]
|
|
name = "draw_costs"
|
|
path = "examples/draw_costs.rs"
|
|
|
|
# Not a consumer's example: the GPU's bandwidth through 256 MiB buffers of each storage mode, over
|
|
# the caller's pages and the runtime's own (examples/managed_bandwidth.rs).
|
|
[[example]]
|
|
name = "managed_bandwidth"
|
|
path = "examples/managed_bandwidth.rs"
|
|
|
|
# Not a consumer's example: what `synchronize_resource` of `Managed` buffers over the caller's
|
|
# pages costs a command buffer, by how many of them the GPU wrote (examples/managed_sync_out.rs).
|
|
[[example]]
|
|
name = "managed_sync_out"
|
|
path = "examples/managed_sync_out.rs"
|
|
|
|
# Not a consumer's example: which command buffer copies `Managed` buffers' CPU writes in when the
|
|
# first one to bind them only dispatches an empty kernel, and what the next one that reads them
|
|
# costs (examples/inert_uploads.rs).
|
|
[[example]]
|
|
name = "inert_uploads"
|
|
path = "examples/inert_uploads.rs"
|
|
|
|
# Not a consumer's example: the GPU's bandwidth through 256 MiB buffers of the runtime's own memory,
|
|
# made after other buffers went (examples/private_bandwidth.rs).
|
|
[[example]]
|
|
name = "private_bandwidth"
|
|
path = "examples/private_bandwidth.rs"
|
|
|
|
# Not a consumer's example: what copies between host and device memory cost on the graphics
|
|
# queue and on a copy engine, alone and beside a compute load, on a Vulkan device of its own
|
|
# (examples/copy_engine.rs).
|
|
[[example]]
|
|
name = "copy_engine"
|
|
path = "examples/copy_engine.rs"
|
|
|
|
# Not a consumer's example: what a device's `VkQueue`s cost the driver to make, drop and hold, by
|
|
# how many it takes (examples/queue_plan_cost.rs).
|
|
[[example]]
|
|
name = "queue_plan_cost"
|
|
path = "examples/queue_plan_cost.rs"
|
|
|
|
# Not a consumer's example: what a render pass instance costs the driver's CPU, by how it is
|
|
# recorded: a primary per pass or per submission, a framebuffer made per pass or kept, or dynamic
|
|
# rendering, on a Vulkan device of its own (examples/pass_costs.rs).
|
|
[[example]]
|
|
name = "pass_costs"
|
|
path = "examples/pass_costs.rs"
|
|
|
|
# Not a consumer's example: what a chain of dependent compute dispatches costs the GPU, by how a
|
|
# command buffer holds them (an encoder each, one serial or concurrent encoder), beside the same
|
|
# chain recorded straight through Vulkan (examples/dispatch_chain.rs).
|
|
[[example]]
|
|
name = "dispatch_chain"
|
|
path = "examples/dispatch_chain.rs"
|
|
|
|
# Not a consumer's example: what a frame of indexed draws costs the GPU where a compute dispatch
|
|
# before each draw writes the draw's indices, as a layer that fixes up each draw's index buffer
|
|
# does, beside the same frame with its indices written once (examples/fixed_index_draws.rs).
|
|
[[example]]
|
|
name = "fixed_index_draws"
|
|
path = "examples/fixed_index_draws.rs"
|
|
|
|
# Not a consumer's example: what the GPU pays a draw for reading the draw's own data in the
|
|
# command buffer's upload arena, by what its fragment function reads (examples/draw_reads.rs).
|
|
[[example]]
|
|
name = "draw_reads"
|
|
path = "examples/draw_reads.rs"
|
|
|
|
# Not a consumer's example: what an indirect command buffer's records cost the GPU and the host,
|
|
# written by a kernel or the CPU and executed by a render pass (examples/icb_reads.rs).
|
|
[[example]]
|
|
name = "icb_reads"
|
|
path = "examples/icb_reads.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`;
|
|
# `serde` the FALLBACK repro bundles' writer and their `device.json` (`repro.rs`).
|
|
metal2vulkan = { version = "0.2.0", path = "../metal2vulkan", features = ["ash", "serde"] }
|
|
# `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"] }
|
|
# The shader cache's entry names and the binary archive's keys.
|
|
sha2.workspace = true
|
|
|
|
# The host's pages, clocks, threads and exit handlers on unix.
|
|
[target.'cfg(unix)'.dependencies]
|
|
libc.workspace = true
|
|
|
|
# The same on Windows: pages (`VirtualQuery`, `VirtualAlloc`), the performance counter, thread
|
|
# times and the current process's memory reads.
|
|
[target.'cfg(windows)'.dependencies]
|
|
windows-sys = { workspace = true, features = [
|
|
"Win32_Foundation",
|
|
"Win32_Security",
|
|
"Win32_System_Diagnostics_Debug",
|
|
"Win32_System_Memory",
|
|
"Win32_System_Performance",
|
|
"Win32_System_SystemInformation",
|
|
"Win32_System_Threading",
|
|
] }
|
|
|
|
[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)"] }
|
|
|