Last updated: 2026-09-07
Metal Runtime
Metal Device
Metal device wrapper — macOS Apple Silicon GPU backend.
This module owns Metal device initialization and capability queries used by the loader, diagnostics, and Metal inference runtime.
3 exports shown
enum
GpuFamily
pub const GpuFamily = enum(u32) Public Apple GPU family buckets exposed by the Metal shim.
struct
MetalCapabilities
pub const MetalCapabilities = struct Capability snapshot queried once from the active Metal device.
struct
MetalDevice
pub const MetalDevice = struct Active Metal device wrapper plus capability metadata used by the backend.
Methods
8method
MetalDevice.init
pub fn init(allocator: std.mem.Allocator, _: u32) !MetalDevice Initialize the system-default Metal device and query its public capabilities.
method
MetalDevice.deinit
pub fn deinit(self: *MetalDevice) void Destroy the active Metal device context.
method
MetalDevice.maxBufferSize
pub fn maxBufferSize(self: *const MetalDevice) u64 Return the largest single Metal buffer size reported by the driver.
method
MetalDevice.totalMemory
pub fn totalMemory(self: *const MetalDevice) u64 Return the total unified memory size reported for the active device.
method
MetalDevice.recommendedMaxWorkingSetSize
pub fn recommendedMaxWorkingSetSize(self: *const MetalDevice) u64 Return the recommended working-set cap reported by Metal.
method
MetalDevice.maxThreadgroupMemoryLength
pub fn maxThreadgroupMemoryLength(self: *const MetalDevice) u64 Return the per-threadgroup shared-memory limit reported by Metal.
method
MetalDevice.hasUnifiedMemory
pub fn hasUnifiedMemory(self: *const MetalDevice) bool Return whether the active device exposes unified CPU/GPU memory.
method
MetalDevice.supportsRaytracing
pub fn supportsRaytracing(self: *const MetalDevice) bool Return whether the active device reports public raytracing support.