Last updated: 2026-06-12

Inference Runtime

Packet List

All API Sections

Dynamic packet list for building per-token decode sequences.

T-CPU forward passes use this to accumulate packets before submitting them to the CPU ring for execution.

1 exports shown

struct

PacketList

#
pub const PacketList = struct

Growable buffer used to assemble a `PacketBatch` for one decode step.

Lowering code pushes packets in execution order, interleaves explicit `barrier` entries between dependent dispatches, and then publishes the resulting slice via `slice()` to whichever ring will run the batch.

src/zinc_rt/ring/packet_list.zig:12

Methods

7

method

PacketList.init

#
pub fn init(allocator: std.mem.Allocator) PacketList

Create an empty list bound to the given allocator.

outlive the list.

Parameters
allocator
Owner of the underlying ArrayList storage; must
Returns

A `PacketList` with zero packets queued.

src/zinc_rt/ring/packet_list.zig:20

method

PacketList.deinit

#
pub fn deinit(self: *PacketList) void

Release the backing storage and poison `self` for use-after-free debug.

Parameters
self
List to tear down; must not be reused afterwards.

src/zinc_rt/ring/packet_list.zig:29

method

PacketList.append

#
pub fn append(self: *PacketList, packet: ring.Packet) !void

Push a payload-bearing packet (embed, rms_norm, lm_head, etc.) onto the end of the list.

Parameters
self
List receiving the packet.
packet
Fully populated packet to enqueue; the value is copied.

src/zinc_rt/ring/packet_list.zig:38

method

PacketList.appendBarrier

#
pub fn appendBarrier(self: *PacketList) !void

Append a `.barrier` marker that forces the ring to drain prior packets before continuing.

buffer (for example, between attention output and the next RMSNorm).

Parameters
self
List receiving the barrier.
Notes

Used between producer/consumer kernels that share a tensor

src/zinc_rt/ring/packet_list.zig:47

method

PacketList.slice

#
pub fn slice(self: *const PacketList) []const ring.Packet

Borrowed view of the current packet sequence.

Parameters
self
List to inspect.
Returns

A slice that stays valid until the next mutation of the list.

src/zinc_rt/ring/packet_list.zig:54

method

PacketList.len

#
pub fn len(self: *const PacketList) usize

Number of packets currently queued, including any barriers.

Parameters
self
List to inspect.
Returns

Packet count.

src/zinc_rt/ring/packet_list.zig:61

method

PacketList.clear

#
pub fn clear(self: *PacketList) void

Drop all queued packets while keeping the allocated capacity, so the list can be reused for the next decode step without re-allocating.

Parameters
self
List to reset.

src/zinc_rt/ring/packet_list.zig:68