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
launch
def launch[Body: RowBody, //, axis: Int, simd_width: Int, num_phases: Int, computationally_expensive: Bool = False, dtype_size: Int = Int(0), name: StaticString = "rowwise", pdl_level: PDLLevel = PDLLevel.OVERLAP_AT_BEGINNING, max_simd_width: Int = Int(0)](body: Body, shape: Coord[*shape.element_types], ctx: Optional[DeviceContext[target]] = DeviceContext[_].NoneValue)
Top-level scaffolder. num_phases picks reduce-shaped (num_phases == 1, output collapses the reduced axis, terminal emit) vs. normalize-shaped (num_phases > 1, output keeps the input shape, terminal elementwise) — see the module note above for the full picture, including the GPU tier-dispatch decision tree.
Parameters:
- axis (
Int): Axis being reduced. - simd_width (
Int): SIMD width for tile dispatch. Bodies compute this viarowwise.pick_simd_width[...]and pass it directly. - num_phases (
Int): Total phase count —1for reduce-shaped bodies (the reduce's own result is the final output);> 1for normalize-shaped bodies (num_phases - 1dependentrow.reducephases before a final per-element write). Asserted> 0. - computationally_expensive (
Bool): GPU author hint — flips the block tier's SIMD-full threshold for compute-heavy bodies. CPU ignores. - dtype_size (
Int): Normalize-shaped (num_phases > 1) only. Byte size of the body's primary dtype (size_of[dtype]()), used by the GPU phase-aware split-K byte gate; any value> 0also opts the body into the CPU pointwise split-axis tier.0(the default) leaves both tiers unreachable (softmax / log-softmax / rms_norm pass their dtype's size to engage them). Meaningless for reduce-shaped bodies. - name (
StaticString): Operation name propagated to the GPU tier kernels'@__nameso a profile row identifies the op (defaults to"rowwise"). CPU ignores. - pdl_level (
PDLLevel): GPU programmatic dependent launch level of the tier kernels (NVIDIA SM90+ only).OVERLAP_AT_BEGINNINGreleases dependent kernels right after the predecessor wait instead of at exit. CPU ignores. - max_simd_width (
Int): The widest load the body may take,0for any: the CPU wide-accumulator path widens only up to it. The GPU tiers already load atsimd_width.
Args:
- body (
Body): The per-row computation. Receives aContextand the row'sCoord; usesreduce/pjoin/once/simdto compose the algorithm. - shape (
Coord[*shape.element_types]): Tensor shape. - ctx (
Optional[DeviceContext[target]]): OptionalDeviceContext; required fortarget="gpu", unused on CPU.
Raises:
On launch or worker failure.