Last updated: 2026-06-12
Inference Runtime
Interface
GPU backend abstraction — comptime-resolved, zero runtime overhead.
macOS → Metal. Linux → Vulkan by default, or CUDA with `-Dbackend=cuda` (NVIDIA / WSL2, where Vulkan is CPU-only). See docs/cuda-backend.md.
5 exports shown
constant
is_metal
pub const is_metal = builtin.os.tag == .macos True when compiling for macOS (Metal backend).
constant
is_cuda
pub const is_cuda = builtin.os.tag == .linux and std.mem.eql(u8, build_options.backend, "cuda") True when compiling for Linux with `-Dbackend=cuda` (NVIDIA / WSL2).
constant
is_vulkan
pub const is_vulkan = builtin.os.tag == .linux and !is_cuda True when compiling for Linux with the Vulkan backend (the Linux default).
constant
backend
pub const backend = if (is_metal) @import("../metal/device.zig") else if (is_cuda) @import("../cuda/device.zig") else @import("../vulkan/instance.zig") Platform-specific GPU device module (Metal / CUDA / Vulkan).
constant
vk
pub const vk = if (is_vulkan) @import("../vulkan/vk.zig") else struct} Vulkan C bindings (empty struct off-Vulkan).