Last updated: 2026-06-05

Sampling

Argmax

All API Sections

T-CPU ARGMAX implementation.

The CPU oracle selects token IDs from logits with deterministic tie behavior that GPU tiers can match during validation.

2 exports shown

struct

Params

#
pub const Params = struct

Inputs and outputs for one ARGMAX call.

Parameters

logits
Flat vector of vocabulary scores; must be non-empty.
output
Destination for the chosen token index (overwritten on success).

src/zinc_rt/isa/cpu_zig/argmax.zig:10

function

run

#
pub fn run(params: Params) !void

Scan the logits vector and write the index of the largest element to `params.output`.

Ties resolve to the earlier index, matching the GPU oracle.

Parameters

params
Logits vector and output index slot; the vector must contain at least one value.

Returns

`error.EmptyInput` when `params.logits.len == 0`, otherwise void.

src/zinc_rt/isa/cpu_zig/argmax.zig:19