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:
- Annotates logical ops with the cost model (annotate_ops)
- Reorders into MMA-block-interleaved execution order (double_buffer_reorder)
- Derives optimal scheduling via CSP backtracking (optimal_schedule_with_halves)
- 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
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:
build_body
build_body(self) -> List[OpDesc]
Apply cost model to logical ops, then reorder for execution.
- declare_ops() → logical ops (no hardware costs)
- annotate_ops() → ops with resource/latency/role from cost model
- double_buffer_reorder() → MMA-block-interleaved execution order
Returns:
schedule_config
schedule_config(self) -> ScheduleConfig
Return tuning knobs with lgkm counts from type params.
Returns:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!