Last updated: 2026-06-12

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.

6 exports 2 methods src/zinc_rt/engine.zig

6 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:14

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:25

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:31

Methods

2

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:39

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:48

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:59

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:72

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:84