Skip to content

Repository files navigation

Adaptive Compiler Optimization

A production Haskell library for adaptive optimization in Hoopl-style dataflow pipelines.

What this project is

This repository delivers adaptive optimization techniques for production dataflow workflows:

  • Adaptive fixpoint iteration: momentum-style damping to reduce oscillation in cyclic CFGs
  • Scheduled fuel: phase budgets that start aggressive and taper as optimization stabilizes
  • Learned rewrite policy: profile-guided rewrite selection with exploration/exploitation balance
  • Bounded join: guardrails that cap unstable fact growth in problematic domains
  • Container-polymorphic rewrite banks: higher-kinded Foldable abstractions without changing runtime behavior

The goal is to preserve Hoopl's abstractions while improving convergence behavior, optimization efficiency, and operational predictability in production settings.

Why this stands out in Haskell

Most Haskell compiler optimization examples focus on fixed iteration schedules and static pass ordering. To our knowledge, this project is an uncommon end-to-end example of adaptive dataflow control in the Haskell ecosystem, while still using the same core ingredients compiler engineers already trust: lattices, monotone transfer functions, and composable rewrites.

Project status

  • Stage: Production
  • API stability: Stable for production integration
  • Performance data: Evaluated using the repository's production benchmark protocol

Build

cabal build

Or using the build script:

./build.sh

Run

The executable supports modular execution:

# Run all components
cabal run optimize

# Or directly after building
./optimize

# Run specific components
./optimize dataflow         # Adaptive dataflow analysis only
./optimize graph            # Shape-indexed graph evaluation only
./optimize examples         # Concrete benchmark examples only
./optimize help             # Display command options

Benchmark and Evaluation

Production-style benchmarking with reproducible artifacts:

# Standard benchmark (5 runs, 2 warmups)
./bench.sh

# High-confidence evaluation (15 runs, 3 warmups)
./bench.sh -n 15 -w 3

# Custom output and labels
./bench.sh -o bench-results/my-eval -l "custom-label"

# Full options and reporting protocol
./bench.sh --help

Benchmark results are structured JSON and CSV artifacts. See BENCHMARK.md for schema and reproducibility checklist.

Documentation map

  • QUICKREF.md - compact formulas, parameter ranges, and implementation notes
  • VISUAL.md - diagrams for convergence, scheduling, and rewrite selection flow
  • TECHNICAL.md - deeper rationale, constraints, and implementation guidance
  • BENCHMARK.md - reproducible benchmark workflow and reporting checklist
  • SUMMARY.md - one-page project brief
  • INDEX.md - repository navigation guide

Acknowledgments

This project builds on ideas introduced by the Hoopl framework:

License

MIT. See LICENSE.

About

Adaptive compiler optimization

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages