Last updated: 2026-07-19

Inference Runtime

Engine

All API Sections

ZINC_RT — the ZINC Runtime.

Owns tier selection and the top-level runtime handle used by future IR emitters and ring backends.

9 exports 3 methods src/zinc_rt/engine.zig

9 exports shown

enum

Tier

#
pub const Tier = enum

Execution tier the engine will dispatch through.

`t1_pm4` and `t2_umq` are the two direct AMDGPU paths; `t_cpu` is the reference scalar fallback; `t_metal`, `t_intel`, and `t_cuda` are reserved for the corresponding native backends.

src/zinc_rt/engine.zig:16

struct

Options

#
pub const Options = struct

Caller-supplied configuration for `Engine.init`.

Currently just the desired tier; future fields (worker counts, ring depths, telemetry hooks) live here.

src/zinc_rt/engine.zig:27

struct

Capabilities

#
pub const Capabilities = struct

Runtime capability bits surfaced to harnesses and server integration code.

The batch planner is present, but continuous batched model execution is not wired into `forward_zinc_rt` yet.

src/zinc_rt/engine.zig:34

constant

supports_multitenant_batch_planning

#
pub const supports_multitenant_batch_planning = true

True when ZINC_RT can plan multitenant batches.

src/zinc_rt/engine.zig:46

constant

supports_multitenant_batched_execution

#
pub const supports_multitenant_batched_execution = false

True only when ZINC_RT can execute multiple tenants in one continuous inference loop.

This remains false until M3 wires the planner into `forward_zinc_rt` and the server runtime.

src/zinc_rt/engine.zig:50

struct

Engine

#
pub const Engine = struct

Top-level runtime handle.

Owns the allocator the engine was built with and the selected tier; future revisions will also own the ring backend.

src/zinc_rt/engine.zig:54

Methods

3

method

Engine.init

#
pub fn init(allocator: std.mem.Allocator, options: Options) !Engine

Construct an engine pinned to the requested tier.

Parameters
allocator
Allocator used for any engine-owned state.
options
Configuration block; `options.tier` selects the backend.
Returns

A ready-to-use `Engine`.

src/zinc_rt/engine.zig:62

method

Engine.deinit

#
pub fn deinit(self: *Engine) void

Release any engine-owned state and poison the handle.

Safe to call once per successful `init`.

src/zinc_rt/engine.zig:71

method

Engine.capabilities

#
pub fn capabilities(self: *const Engine) Capabilities

Return static runtime capability bits for the selected build.

src/zinc_rt/engine.zig:76

function

parseTier

#
pub fn parseTier(value: []const u8) !Tier

Parse a textual tier identifier (e.g.

from `ZINC_RT_TIER` or a CLI flag) into a `Tier`. Accepts both short (`t1`, `t2`) and canonical (`t1_pm4`, `t2_umq`) names; `auto` defers to `autoTier`. not a recognised name.

Parameters

value
String to parse.

Returns

The selected `Tier`, or `error.UnknownZincRtTier` if `value` is

src/zinc_rt/engine.zig:88

function

tierFromEnv

#
pub fn tierFromEnv() !Tier

Read `ZINC_RT_TIER` and parse it, falling back to `autoTier` when unset.

Returns

The selected `Tier`, or a parse error from `parseTier`.

src/zinc_rt/engine.zig:101

function

autoTier

#
pub fn autoTier() Tier

Probe the host for direct-execution paths and return the best available tier.

Tries T2 UMQ first (the blessed AMDGPU user-queue path), falls back to T1 PM4 over `/dev/kfd` when UMQ admission is refused, and finally to the scalar CPU reference. so T2 admission usually fails and we end up on T1 PM4.

Returns

The best tier the current host can run today.

Notes

On the bench node the amdgpu firmware rejects compute user queues,

src/zinc_rt/engine.zig:113