egg: Fast and Extensible Equality Saturation
arXiv:2004.03082 · doi:10.1145/3434304
Abstract
An e-graph efficiently represents a congruence relation over many expressions. Although they were originally developed in the late 1970s for use in automated theorem provers, a more recent technique known as equality saturation repurposes e-graphs to implement state-of-the-art, rewrite-driven compiler optimizations and program synthesizers. However, e-graphs remain unspecialized for this newer use case. Equality saturation workloads exhibit distinct characteristics and often require ad-hoc e-graph extensions to incorporate transformations beyond purely syntactic rewrites. This work contributes two techniques that make e-graphs fast and extensible, specializing them to equality saturation. A new amortized invariant restoration technique called rebuilding takes advantage of equality saturation's distinct workload, providing asymptotic speedups over current techniques in practice. A general mechanism called e-class analyses integrates domain-specific analyses into the e-graph, reducing the need for ad hoc manipulation. We implemented these techniques in a new open-source library called egg. Our case studies on three previously published applications of equality saturation highlight how egg's performance and flexibility enable state-of-the-art results across diverse domains.
25 pages, 15 figures, POPL 2021
References in corpus (1)
Cited by in corpus (19)
- Synthesizing Quantum-Circuit Optimizers
- babble: Learning Better Abstractions with E-Graphs and Anti-Unification
- Top-Down Synthesis for Library Learning
- Pure Tensor Program Rewriting via Access Patterns (Representation Pearl)
- The Dawn of AI-Native EDA: Opportunities and Challenges of Large Circuit Models
- Theory Exploration Powered By Deductive Synthesis
- WebAssembly Diversification for Malware Evasion
- WASM-MUTATE: Fast and Effective Binary Diversification for WebAssembly
- Synthesizing Analytical SQL Queries from Computation Demonstration
- Self-Supervised Learning to Prove Equivalence Between Straight-Line Programs via Rewrite Rules
- The Inefficiency of Genetic Programming for Symbolic Regression
- Improving Genetic Programming for Symbolic Regression with Equality Graphs
- CESAR: Control Envelope Synthesis via Angelic Refinements
- Metatheory.jl: Fast and Elegant Algebraic Computation in Julia with Extensible Equality Saturation
- rEGGression: an Interactive and Agnostic Tool for the Exploration of Symbolic Regression Models
- Invited Paper: Initial Steps Toward a Compiler for Distributed Programs
- Optimizing Navigational Graph Queries
- CoolerSpace: A Language for Physically Correct and Computationally Efficient Color Programming
- Series-Parallel-Loop Decompositions of Control-flow Graphs