HackerPapers

arXiv:2004.03082cs.PL

egg: Fast and Extensible Equality Saturation

Max Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt, Zachary Tatlock, Pavel Panchekha

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.

arXiv comments
25 pages, 15 figures, POPL 2021
Journal reference
POPL 2021
DOI
doi:10.1145/3434304
Subjects
cs.PLProgramming Languages

On Hacker News

Linked by 5 identifiable commenters in 5 comments across 4 threads, from Mar 2021 to Dec 2023. Found in 1 HN submission from Oct 2020 to Oct 2020. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments4 threads

    • I was about to comment that this reminds me of Aaron Hsu’s Dyalog compiler, but it’s mentioned right there in the README as one of the inspirations. IMHO, compilers are about an order of magnitude slower than they could be, and this type of tree representation could be one key…

      jiggawattsView on HNParent context

    • Equality graphs (e-graphs) for theorem proving and equality saturation and other equality-related things. They're awesome data structures that efficiently maintain a congruence relation over many expressions > At a high level, e-graphs extend union-find to compactly represent…

      romesView on HNParent context

    • Yes, at least these egg-based projects are usign this idea, but it looks like it's just one of the options: https://souffle-lang.github.io/docs.html http://www.philipzucker.com/souffle-egg4/ https://arxiv.org/pdf/2004.03082.pdf

      superlopuhView on HNParent context

  1. Egg: E-Graphs Good 1 comment
  2. Reflections on IDEA vs VS Code 1 comment
    • The author frames this as a contest between two architectures: either spend a lot of effort building custom developer tools, or repurpose the compiler as a server for multiple clients. Both approaches have their tradeoffs: the first, as the author mentions, violates DRY [1]. The…

      brzozowskiView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.