Skip to main content

Mojo struct

DeclarativeSchedule

struct DeclarativeSchedule[is_fp8: Bool, lgkm_a: Int, lgkm_b: Int]

Constraint-based pipeline: algorithm declares ops, target supplies costs.

The algorithm specifies WHAT ops exist — just the tag and buffer metadata (stage, subtile, channel, k_offset). No resource kinds, no latencies, no roles.

The TargetProfile specifies HOW the hardware executes them — per-op costs (resource, latency, role) via the cost model, and pipeline structure (depth, MMA grid, buffer strategy) via the pipeline config. One factory call (e.g., mi355x_target()) provides everything.

The framework then:

  1. Annotates logical ops with the cost model (annotate_ops)
  2. Reorders into MMA-block-interleaved execution order (double_buffer_reorder)
  3. Derives optimal scheduling via CSP backtracking (optimal_schedule_with_halves)
  4. Derives wait counts from schedule order (derive_wait_counts)

Usage: comptime schedule = build_scheduleis_fp8, lgkm_a, lgkm_b

Implemented traits

AnyType, ImplicitlyDestructible, PipelineSchedule

Methods

__init__

__init__(out self, config: ScheduleConfig = ScheduleConfig(SchedulingStrategy.CSP, 85, True, 0, False, 0, 8, 6, 0, 0, False), target: TargetProfile = mi355x_target(4, 4, 1))

__init__(out self, config: ScheduleConfig, hw_config: PipelineConfig, cost_model: TargetCostModel)

config

config(self) -> PipelineConfig

Returns:

PipelineConfig

declare_ops

declare_ops(self) -> List[OpDesc]

Algorithm description: WHAT ops exist, with buffer metadata only.

Returns 24 logical ops (2 halves x 12 ops) from the ping-pong op table. No resource kinds, no latencies, no roles — those come from the TargetProfile's cost model. See _logical_half() for the table.

Returns:

List

build_body

build_body(self) -> List[OpDesc]

Apply cost model to logical ops, then reorder for execution.

  1. declare_ops() → logical ops (no hardware costs)
  2. annotate_ops() → ops with resource/latency/role from cost model
  3. double_buffer_reorder() → MMA-block-interleaved execution order

Returns:

List

schedule_config

schedule_config(self) -> ScheduleConfig

Return tuning knobs with lgkm counts from type params.

Returns:

ScheduleConfig

Was this page helpful?