Last updated: 2026-06-12
Inference Runtime
Rope
T-CPU RoPE (Rotary Positional Embedding) implementation.
Applies in-place rotary embeddings to query or key head data.
2 exports shown
struct
Params
pub const Params = struct Inputs for one in-place RoPE pass over a Q or K tensor.
function
run
pub fn run(params: Params) !void Apply rotary positional embeddings in place to every head in `params.data`.
For each head and each frequency pair `(a, b) = (data[i], data[i + rope_dim/2])`, rotates by `theta = position * inv_freq[i]`: writes `(a*cos - b*sin, a*sin + b*cos)`. Uses the half-rotation layout (NeoX-style), matching the Vulkan kernels.