Last updated: 2026-06-12
Hardware Detection
Diagnostics Metal
Apple Silicon diagnostics and managed-model fit reporting for Metal.
The Metal diagnostics path inspects the default device, reports unified memory and feature support, and optionally projects how a selected GGUF or managed model fits once runtime allocations and KV reservation are included.
5 exports shown
struct
Options
pub const Options = struct Configuration for a Metal diagnostics run.
struct
ManagedModelInfo
pub const ManagedModelInfo = struct Catalog metadata for a managed (downloadable) model.
struct
UnifiedFitEstimate
pub const UnifiedFitEstimate = struct Estimated unified-memory breakdown for running a model on Apple Silicon.
function
run
pub fn run(opts: Options, allocator: std.mem.Allocator) !void Run a four-step Metal preflight check (host environment, device, shader assets, model) and print a colour-coded report to stdout.
The steps are: (1) host OS and CPU arch, (2) Metal device capabilities and unified-memory budget, (3) shader source presence and MSL smoke compile, (4) GGUF or managed-model memory-fit estimate. Returns `error.DiagnosticsFailed` if any check resolves to `.fail`.
function
estimateUnifiedFit
pub fn estimateUnifiedFit( inspection: ModelInspection, recommended_working_set_bytes: u64, total_memory_bytes: u64, requested_context_length: ?u32, ) UnifiedFitEstimate Compute a conservative unified-memory breakdown for running a model on Apple Silicon.
Combines tensor weight bytes with the runtime shared-buffer and KV-cache cost at the resolved context length, then determines how many tokens could fit within the Metal working-set budget.