Last updated: 2026-06-12
Inference Runtime
Lib
ZINC_RT reference-runtime module.
Exposes the M0 engine, IR, CPU ring, and scalar CPU kernels through one importable package so `forward_zinc_rt` can exercise the runtime without pulling the same files into multiple Zig modules.
12 exports shown
constant
engine
pub const engine = @import("engine.zig") Top-level runtime handle and tier-selection helpers.
Other zinc_rt submodules go through this surface to obtain the active execution tier (CPU reference, T1 PM4, T2 UMQ, Metal, etc.).
constant
ir_op
pub const ir_op = @import("ir/op.zig") IR opcode definitions used by the M0/M1 decode graph.
Op kinds are stable identifiers shared by the emitter and the validator.
constant
ir_graph
pub const ir_graph = @import("ir/graph.zig") IR graph container — nodes plus their op/argument metadata.
`forward_zinc_rt` emits one of these per token before lowering to the tier the engine selected.
constant
kmd
pub const kmd = @import("kmd.zig") Kernel-mode-driver glue.
Houses helpers and constants shared by the ring backends (UMQ user queues, KFD compute queues) so they describe submissions in one place.
constant
ring
pub const ring = @import("ring/mod.zig") Common ring-submission surface — what every concrete ring backend (CPU, UMQ, KFD, CS) implements so the engine can speak to them uniformly.
constant
cpu_ring
pub const cpu_ring = @import("ring/cpu.zig") Reference CPU ring used by the scalar M1 forward path.
Executes ops synchronously on the host so we have a ground-truth correctness oracle for the GPU rings.
constant
umq
pub const umq = @import("ring/umq.zig") T2 user-mode queue ring backed by `DRM_IOCTL_AMDGPU_USERQ`.
The "blessed" direct path when amdgpu firmware admits compute user queues.
constant
kfd
pub const kfd = @import("ring/kfd.zig") T1 PM4 ring backed by `/dev/kfd` (the ROCm/tinygrad ABI).
Fallback when UMQ is rejected; talks PM4 packets to the compute scheduler directly.
constant
cs
pub const cs = @import("ring/cs.zig") Generic libdrm compute-stream submission used by the PM4 backends.
Wraps context create/submit so the ring backends share one BO/syncobj path.
constant
pm4_packet
pub const pm4_packet = @import("ring/packet.zig") PM4 packet builders (NOPs, indirect-buffer dispatch, COPY_DATA, fences).
Consumed by both the UMQ and KFD rings to produce wire-compatible command-buffer bytes.
constant
kernels
pub const kernels = @import("isa/cpu_zig/mod.zig") Scalar CPU kernels (dequantization, matvec, softmax, etc.) used by the reference forward path and by GPU-tier correctness checks.
constant
fast_pool
pub const fast_pool = @import("fast_pool.zig") Tiny fixed-size worker pool used to fan out per-layer / per-expert work in the scalar M1 decode path without paying allocator/scheduler overhead.