For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Mojo function
once
def once[Emit: def() -> None & RegisterPassable & ImplicitlyCopyable, params: ContextParams, //](emit: Emit, ctx: Context[params])
Runs emit exactly once per (logical) output row.
- Warp tier: only lane 0 runs
emit. - Block tier: only thread 0 runs
emit. - Tiled / serial tier: each thread owns its own output(s), so
every thread that runs the body also runs
emit. - Split-K tier: only thread 0 of the last-arriving block (per
ctx._is_last_block, set byrowwise.reduce) runsemit.
emit is a value closure (its copy-captured state rides the value);
this is an in-kernel thread predicate, not a launch boundary.
The body never observes lane_id() / thread_idx.x.
Parameters:
- βEmit (
def() -> None&RegisterPassable&ImplicitlyCopyable): The value-closure type ofemit. - βparams (
ContextParams): The comptime dispatch parameters.
Args:
- βemit (
Emit): Callback to run on the canonical writer. - βctx (
Context[params]): The dispatch bundle passed to the body. The split-K branch readsctx._is_last_blockto gate emission.