galley_optimize
Galley logical optimizer: applies greedy query rewriting to logical plans, with an optional exact branch-and-bound path for query bodies.
GalleyLogicFactorizer
¶
Bases: LogicFactorizer
LogicLoader stage that runs Galley on each Query body (see optimizer),
then forwards the Plan to the downstream loader ctx.
Default optimizer="bfs" is exact layered branch-and-bound; "dfs" uses the
DFS kernel. Greedy k=1 bounds are used only on the layered exact path, not
inside branch_and_bound_dfs. cost_model estimates the cost of each
reduction, and defaults to FLOPS_COST_MODEL.
Source code in src/finch/autoschedule/factorizer/galley_factorizer/galley_optimize.py
optimize_plan(plan, stats_factory, stats_bindings, use_components=True, *, optimizer='greedy', cost_model=None)
¶
Optimize a full Plan: run the Galley optimizer on each Query body, pass through non-Query bodies (Produces), and update stats bindings.
Source code in src/finch/autoschedule/factorizer/galley_factorizer/galley_optimize.py
optimize_query(query, stats_factory, stats_bindings, use_components=True, *, optimizer='dfs', cost_model=None)
¶
Rewrite a single logical Query using optimizer:
greedy, bfs, or dfs.