Last updated: 2026-06-12

Inference Runtime

Swiglu

All API Sections

T-CPU SwiGLU implementation.

This is the scalar reference activation used by MoE and dense MLP paths before tier-specific kernels are trusted.

2 exports shown

struct

Params

#
pub const Params = struct

Inputs and outputs for one SwiGLU activation.

Parameters

gate
Gate-projection vector fed through SiLU.
up
Up-projection vector multiplied by the SiLU-gated values.
output
Destination vector; all three slices must be the same length.

src/zinc_rt/isa/cpu_zig/swiglu.zig:11

function

run

#
pub fn run(params: Params) !void

Compute `output[i] = silu(gate[i]) * up[i]` where `silu(x) = x / (1 + exp(-x))`.

Reference SwiGLU used by MoE and dense MLP paths to validate tier-specific kernels.

Parameters

params
Gate, up, and output slices of equal length; see `Params`.

Returns

`error.ShapeMismatch` when the three slices differ in length, otherwise void.

src/zinc_rt/isa/cpu_zig/swiglu.zig:21