IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

pjoin

def pjoin[State: ReduceOp, params: ContextParams, //](mut state: State, mut ctx: Context[params])

Cross-thread join for a single monoid state, tier-appropriately.

Called by the body after rowwise.reduce, once per state. The cooperative tiers (warp, block) emit a hardware-backed warp/block reduce; the tiled and serial tiers no-op (one thread per output). Split-K does a within-block reduce then a cross-block partials-buffer join, setting ctx._is_last_block so rowwise.once gates emission.

This is a separate call rather than a parameter to rowwise.reduce because a mut *states: *States variadic copies arguments into the pack at the call site, so mutations inside reduce wouldn't propagate back. Single mut state: State passes by mut reference cleanly.

Parameters:

  • ​State (ReduceOp): The monoid type being joined.
  • ​params (ContextParams): The comptime dispatch parameters.

Args:

  • ​state (State): The body's monoid accumulator. On return, holds the cross-thread-joined value on every thread (cooperative tiers) or its own value (tiled/serial tiers).
  • ​ctx (Context[params]): The dispatch bundle. Mutated for the split-K case so rowwise.once knows which block is the canonical writer.