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 struct
ContextParams
struct ContextParams
Comptime half of Context. Bundled into one template parameter so callers write Context[params] instead of threading eight separate comptime args.
Tier discriminator (GPU): _tier (a ReduceTier) picks exactly one
of warp / serial / split-K, or Block (also every CPU tier).
emit_tile_width > 1 further marks the tiled (SIMD-on-outputs) tier,
independent of _tier. The same fields exist on CPU but only
emit_tile_width and simd_width matter; _tier is always Block.
_tier is a _-prefixed scaffolder internal (set by the tier
picker) β a body never reads it.
target (comptime) is the dispatcher's switch β "cpu" selects
the CPU backend, anything else the GPU backend.
Fieldsβ
- βaxis (
Int): Axis being reduced. - βemit_tile_width (
Int): Rows-per-thread.1for warp/block/serial/split-K tiers,> 1for the tiled tier (SIMD-on-outputs). - βBLOCK_SIZE (
Int): Threads per block (kernel-launch shape). GPU-only;1on CPU. - βsimd_width (
Int): SIMD width. On GPU, the block tier's axis-direction load width (ignored by tiled/warp/serial). On CPU, the width the scaffolder walks the axis with. - βtarget (
StaticString):"cpu"or"gpu"β picks which backend the unifiedrowwise.{reduce, pjoin, once, launch}dispatches to.
Implemented traitsβ
AnyType,
Copyable,
Deinitable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
TrivialRegisterPassable
Methodsβ
__init__β
def __init__(axis: Int, emit_tile_width: Int, BLOCK_SIZE: Int, simd_width: Int, target: StringSpan[ImmStaticOrigin], tier: ReduceTier = ReduceTier.Block, num_phases: Int = Int(0)) -> Self
Initializes a ContextParams from per-tier comptime values.
Args:
- βaxis (
Int): Axis being reduced. - βemit_tile_width (
Int): Rows-per-thread (1for cooperative tiers). - βBLOCK_SIZE (
Int): Threads per block. - βsimd_width (
Int): SIMD width for the block tier's axis load. - βtarget (
StringSpan[ImmStaticOrigin]):"cpu"or"gpu". - βtier (
ReduceTier): Tier discriminator (ReduceTier.Blockby default β every CPU tier and the GPU tiled/cooperative tiers). - βnum_phases (
Int): Per-element-output split-K total phase count (<= 1disables the tier).