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 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. 1 for warp/block/serial/split-K tiers, > 1 for the tiled tier (SIMD-on-outputs).
  • ​BLOCK_SIZE (Int): Threads per block (kernel-launch shape). GPU-only; 1 on 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 unified rowwise.{reduce, pjoin, once, launch} dispatches to.
  • ​name (StaticString): Operation name propagated from the graph op (_trace_name) so the tier kernels' @__name identifies the op in profiler traces. Defaults to "rowwise" when the caller doesn't provide one. Scaffolder-internal — a body never reads it.
  • ​pdl_level (PDLLevel): Programmatic dependent launch level of the GPU tier kernels (NVIDIA SM90+ only). ON waits on the predecessor grid at entry and releases the dependent grids at exit; OVERLAP_AT_BEGINNING releases them right after the wait. NO_WAIT_OVERLAP_AT_END is unsupported, and the per-element split-K tier always releases at exit. Scaffolder-internal — a body never reads it.

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: StaticString, tier: ReduceTier = ReduceTier.Block, num_phases: Int = Int(0), name: StaticString = "rowwise", pdl_level: PDLLevel = PDLLevel.OVERLAP_AT_BEGINNING) -> Self

Initializes a ContextParams from per-tier comptime values.

Args:

  • ​axis (Int): Axis being reduced.
  • ​emit_tile_width (Int): Rows-per-thread (1 for cooperative tiers).
  • ​BLOCK_SIZE (Int): Threads per block.
  • ​simd_width (Int): SIMD width for the block tier's axis load.
  • ​target (StaticString): "cpu" or "gpu".
  • ​tier (ReduceTier): Tier discriminator (ReduceTier.Block by default — every CPU tier and the GPU tiled/cooperative tiers).
  • ​num_phases (Int): Per-element-output split-K total phase count (<= 1 disables the tier).
  • ​name (StaticString): Operation name for the tier kernels' @__name (defaults to "rowwise").
  • ​pdl_level (PDLLevel): PDL level of the GPU tier kernels.

Was this page helpful?