Module planner

Module planner 

Source
Expand description

2026-09-28: The buffer planner: an arena offset for every materialised edge of a plan, sized once for the widest padded row count, so no buffer is reallocated after boot (the CUDA-graph constraint: captured pointers must stay valid).

An executor may add a Layout: edges it binds to buffers of its own, outputs a kernel writes in place over one of its inputs, and edges a kernel writes back to back.

Owner: metrale-circuit. Invariants:

  • Two edges whose live ranges overlap never share a byte, unless a Layout alias joins them; the edges of one alias class share their bytes by construction.
  • An edge is live from the group that writes it to the last group that reads it; an edge read or written outside the plan (its inputs from another section, and the declared outputs) is live for the whole plan. An alias class is live over the union of its edges.
  • The edges of a pack are placed back to back, in pack order, with no padding between.
  • The edges of a row pack share every row: row i of member j sits at the pack’s base plus i pack rows plus the widths of members 0..j; each member’s row_stride is the pack row. A row pack placed over an edge occupies exactly that edge’s bytes.
  • Offsets of unpacked storage are aligned to ALIGN bytes; a pack’s first edge is.

Structs§

BufferPlan
2026-09-28: The arena layout of one plan.
Layout
2026-09-28: Storage constraints an executor puts on a plan’s materialised edges.
RowPack
2026-09-28: Edges laid side by side within each row: row i holds row i of every member, in order. The members must have one row count. With over, the pack occupies that edge’s bytes (a kernel rewrites the edge in place into the members), which must be exactly the pack’s size.
Slot
2026-09-28: One placed edge.

Enums§

PlanError
2026-09-28: Why a plan could not be laid out.

Constants§

ALIGN
2026-09-28: Offset alignment, in bytes.

Functions§

live_ranges
2026-09-28: Live range of every materialised edge in plan, keyed by edge.
plan_buffers
2026-09-28: Place every materialised edge of plan, sized for max_rows rows, with no layout constraints.
plan_buffers_with
2026-09-28: Place every materialised edge of plan that layout does not bind, sized for max_rows rows.