Affiliation:
1. Peking University, Beijing, China
2. University of California at San Diego, San Diego, USA
Abstract
Intermediate data structures are a common cause of inefficiency in functional programming.
Fusion
attempts to eliminate intermediate data structures by combining adjacent data traversals into one; existing fusion techniques, however, are based on predefined rewrite rules and hence are limited in expressiveness.
In this work we explore a different approach to eliminating intermediate data structures, based on inductive program synthesis. We dub this approach
superfusion
(by analogy with
superoptimization
, which uses inductive synthesis for program optimization). Starting from a reference program annotated with data structures to be eliminated, superfusion first generates a
sketch
where program fragments operating on those data structures are replaced with holes; it then fills the holes with constant-time expressions such that the resulting program is equivalent to the reference. The main technical challenge here is scalability because optimized programs are often complex, making the search space intractably large for naive enumeration. To address this challenge, our key insight is to first synthesize a
ghost function
that describes the relationship between the original intermediate data structure and its compressed version; this function, although not used in the final program, serves to decompose the joint sketch filling problem into independent simpler problems for each hole.
We implement superfusion in a tool called SuFu and evaluate it on a dataset of 290 tasks collected from prior work on deductive fusion and program restructuring. The results show that SuFu solves 264 out of 290 tasks, exceeding the capabilities of rewriting-based fusion systems and achieving comparable performance with specialized approaches to program restructuring on their respective domains.
Funder
National Key Research and Development Program of China
National Natural Science Foundation of China
National Science Foundation
Publisher
Association for Computing Machinery (ACM)
Reference58 articles.
1. Umut A Acar. 2005. Self-adjusting computation. Ph. D. Dissertation. Carnegie Mellon University.
2. SyGuS-Comp 2017: Results and Analysis
3. Scaling Enumerative Program Synthesis via Divide and Conquer
4. Matej Balog, Alexander L. Gaunt, Marc Brockschmidt, Sebastian Nowozin, and Daniel Tarlow. 2017. DeepCoder: Learning to Write Programs. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. https://openreview.net/forum?id=ByldLrqlx