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 congruence closure algorithm 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 the flexibility of e-class analyses supports diverse domains and how egg can provide up to 3000x speed ups.
翻译:电子文集有效代表了许多表达式的共通关系。 虽然电子文集最初是在1970年代后期开发的,用于自动化理论验证器。 这是一种最新技术,称为平等饱和再利用电子图集,以实施最新工艺、重写驱动的编译器优化和编程合成器。 但是,电子文集对于这个较新的使用案例来说仍然没有专门化。 平等饱和工作量具有不同的特点,往往需要临时的电子文集扩展,以纳入纯合成再写器以外的转换。 这项工作提供了两种技术,使电子文集能够快速和扩展,专门用于平等饱和。 一种称为重新利用平等饱和、重写驱动的编编译器优化和编程合成器的新摊合算法,它利用了平等性饱和法最新技术的不同工作量,为当前技术提供了无谓的加速。 一种称为电子类分析的一般机制将特定领域的分析纳入电子文集,减少了对临时操作的需要。 我们在一个新的开放源图书馆中应用了这些技术,称为蛋。 我们以前出版的3个关于平等学系的案例研究支持了如何灵活度和40个等级分析。