Affiliation:
1. Purdue University, USA
Abstract
Series of traversals of tree structures arise in numerous contexts: abstract syntax tree traversals in compiler passes, rendering traversals of the DOM in web browsers, kd-tree traversals in computational simulation codes. In each of these settings, a tree is traversed multiple times to compute various values and modify various portions of the tree. While it is relatively easy to write these traversals as separate small updates to the tree, for efficiency reasons, traversals are often manually fused to reduce the number of times that each portion of the tree is traversed: by performing multiple operations on the tree simultaneously, each node of the tree can be visited fewer times, increasing opportunities for optimization and decreasing cache pressure and other overheads. This fusion process is often done manually, requiring careful understanding of how each of traversals of the tree interact. This paper presents an automatic approach to traversal fusion: tree traversals can be written independently, and then our framework analyzes the dependences between the traversals to determine how they can be fused to reduce the number of visits to each node in the tree. A critical aspect of our framework is that it exploits two opportunities to increase the amount of fusion: i) it automatically integrates code motion, and ii) it supports partial fusion, where portions of one traversal can be fused with another, allowing for a reduction in node visits without requiring that two traversals be fully fused. We implement our framework in Clang, and show across several case studies that we can successfully fuse complex tree traversals, reducing the overall number of traversals and substantially improving locality and performance.
Funder
National Science Foundation
U.S. Department of Energy
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference46 articles.
1. Beyond Iteration Vectors: Instancewise Relational Abstract Domains
2. A practical automatic polyhedral parallelizer and locality optimizer
3. Safe fusion of functional expressions
4. H. Comon M. Dauchet R. Gilleron C. Löding F. Jacquemard D. Lugiez S. Tison and M. Tommasi. 2007. Tree Automata Techniques and Applications. Available on: http://www.grappa.univ- lille3.fr/tata . (2007). release October 12th 2007. H. Comon M. Dauchet R. Gilleron C. Löding F. Jacquemard D. Lugiez S. Tison and M. Tommasi. 2007. Tree Automata Techniques and Applications. Available on: http://www.grappa.univ- lille3.fr/tata . (2007). release October 12th 2007.
Cited by
11 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Superfusion: Eliminating Intermediate Data Structures via Inductive Synthesis;Proceedings of the ACM on Programming Languages;2024-06-20
2. Mechanised Hypersafety Proofs about Structured Data;Proceedings of the ACM on Programming Languages;2024-06-20
3. Orchard: Heterogeneous Parallelism and Fine-grained Fusion for Complex Tree Traversals;ACM Transactions on Architecture and Code Optimization;2024-05-21
4. UniRec: a unimodular-like framework for nested recursions and loops;Proceedings of the ACM on Programming Languages;2022-10-31
5. Tree traversal synthesis using domain-specific symbolic compilation;Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems;2022-02-22