srdatalog.ir.mir.passes¶
MIR optimization passes. Mirror src/srdatalog/mir/{pre_reconstruct_rebuild, clause_order_reorder, prefix_source_reorder}.nim. Each operates on a seq[LoweredStep] (represented in Python as list[tuple[MirNode, bool]]).
Order (matches Nim’s registerMirOptimizePass priorities): 0. insert_pre_reconstruct_rebuilds
apply_clause_order_reordering
apply_prefix_source_reordering
balanced_scan_pass — DEFERRED (DSL lacks balanced pragma)
Module Contents¶
Functions¶
Run the ported MIR optimization passes in Nim order. |
|
Apply balanced-scan -> positioned-extract transform to every ExecutePipeline. No-op when the Python DSL hasn’t emitted a BalancedScan (current default: never, since balanced-scan lowering isn’t wired in). |
|
Reorder every ColumnJoin/CartesianJoin’s sources by the enclosing
ExecutePipeline’s clause_order. Mutates in place; returns |
|
Move prefixed sources to the front of every ColumnJoin/CartesianJoin (avoids “galloping from root” on unprefixed sources). Mutates in place. |
|
After every PostStratumReconstructInternCols step, insert any RebuildIndex(FULL) ops for indices of this relation that subsequent strata will read but that this stratum didn’t merge to FULL. |
API¶
- srdatalog.ir.mir.passes.apply_all_mir_passes(steps: list[tuple[srdatalog.ir.mir.types.MirNode, bool]]) list[tuple[srdatalog.ir.mir.types.MirNode, bool]][source]¶
Run the ported MIR optimization passes in Nim order.
- srdatalog.ir.mir.passes.apply_balanced_scan_pass(steps: list[tuple[srdatalog.ir.mir.types.MirNode, bool]]) list[tuple[srdatalog.ir.mir.types.MirNode, bool]][source]¶
Apply balanced-scan -> positioned-extract transform to every ExecutePipeline. No-op when the Python DSL hasn’t emitted a BalancedScan (current default: never, since balanced-scan lowering isn’t wired in).
- srdatalog.ir.mir.passes.apply_clause_order_reordering(steps: list[tuple[srdatalog.ir.mir.types.MirNode, bool]]) list[tuple[srdatalog.ir.mir.types.MirNode, bool]][source]¶
Reorder every ColumnJoin/CartesianJoin’s sources by the enclosing ExecutePipeline’s clause_order. Mutates in place; returns
stepsfor chain convenience.
- srdatalog.ir.mir.passes.apply_prefix_source_reordering(steps: list[tuple[srdatalog.ir.mir.types.MirNode, bool]]) list[tuple[srdatalog.ir.mir.types.MirNode, bool]][source]¶
Move prefixed sources to the front of every ColumnJoin/CartesianJoin (avoids “galloping from root” on unprefixed sources). Mutates in place.
- srdatalog.ir.mir.passes.insert_pre_reconstruct_rebuilds(steps: list[tuple[srdatalog.ir.mir.types.MirNode, bool]]) list[tuple[srdatalog.ir.mir.types.MirNode, bool]][source]¶
After every PostStratumReconstructInternCols step, insert any RebuildIndex(FULL) ops for indices of this relation that subsequent strata will read but that this stratum didn’t merge to FULL.