skip to main content
research-article

RVSDG: An Intermediate Representation for Optimizing Compilers

Published:01 December 2020Publication History
Skip Abstract Section

Abstract

Intermediate Representations (IRs) are central to optimizing compilers as the way the program is represented may enhance or limit analyses and transformations. Suitable IRs focus on exposing the most relevant information and establish invariants that different compiler passes can rely on. While control-flow centric IRs appear to be a natural fit for imperative programming languages, analyses required by compilers have increasingly shifted to understand data dependencies and work at multiple abstraction layers at the same time. This is partially evidenced in recent developments such as the Multi-Level Intermediate Representation (MLIR) proposed by Google. However, rigorous use of data flow centric IRs in general purpose compilers has not been evaluated for feasibility and usability as previous works provide no practical implementations.

We present the Regionalized Value State Dependence Graph (RVSDG) IR for optimizing compilers. The RVSDG is a data flow centric IR where nodes represent computations, edges represent computational dependencies, and regions capture the hierarchical structure of programs. It represents programs in demand-dependence form, implicitly supports structured control flow, and models entire programs within a single IR. We provide a complete specification of the RVSDG, construction and destruction methods, as well as exemplify its utility by presenting Dead Node and Common Node Elimination optimizations. We implemented a prototype compiler and evaluate it in terms of performance, code size, compilation time, and representational overhead. Our results indicate that the RVSDG can serve as a competitive IR in optimizing compilers while reducing complexity.

References

  1. Frances E. Allen. 1970. Control flow analysis. In ACM Sigplan Notices, Vol. 5. ACM, 1--19.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B. Alpern, M. N. Wegman, and F. K. Zadeck. 1988. Detecting equality of variables in programs. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, 1--11.Google ScholarGoogle Scholar
  3. Helge Bahmann, Nico Reissmann, Magnus Jahre, and Jan Christian Meyer. 2015. Perfect reconstructability of control flow from demand dependence graphs. ACM Transactions on Architecture and Code Optimization 11, 4 (2015), 66:1--66:25.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W. Baxter and H. R. Bauer, III. 1989. The program dependence graph and vectorization. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, 1--11.Google ScholarGoogle Scholar
  5. Philip L. Campbell, Ksheerabdhi Krishna, and Robert A. Ballance. 1993. Refining and Defining the Program Dependence Web. Technical Report. University of New Mexico.Google ScholarGoogle Scholar
  6. Larry Carter, Jeanne Ferrante, and Clark Thomborson. 2003. Folklore confirmed: Reducible flow graphs are exponentially larger. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages, Vol. 38. ACM, 106--114.Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jeronimo Castrillon. 2013. Programming Heterogeneous MPSoCs: Tool Flows to Close the Software Productivity Gap. Ph.D. Dissertation. RWTH Aachen Univeristy.Google ScholarGoogle Scholar
  8. Jong-Deok Choi, Vivek Sarkar, and Edith Schonberg. 1996. Incremental computation of static single assignment form. In Proceedings of the International Conference on Compiler Construction. Springer-Verlag, 223--237.Google ScholarGoogle ScholarCross RefCross Ref
  9. Clang. 2017. Clang: A C Language Family Frontend for LLVM. Retrieved October 30, 2019 from https://clang.llvm.org.Google ScholarGoogle Scholar
  10. GNU Compiler Collection. 2018. Retrieved August 5, 2019 from https://gcc.gnu.org/.Google ScholarGoogle Scholar
  11. Daniel Cordes, Peter Marwedel, and Arindam Mallik. 2010. Automatic parallelization of embedded software using hierarchical task graphs and integer linear programming. In Proceedings of the ACM/IEEE International Conference on Hardware/Software Codesign and System Synthesis. 267--276.Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. K Zadeck. 1991. Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. Technical Report.Google ScholarGoogle Scholar
  13. Jack Bonnell Dennis. 1980. Data flow supercomputers. Computer 13, 11 (1980), 48--56.Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Shuhan Ding, John Earnest, and Soner Önder. 2014. Single assignment compiler, single assignment architecture: Future gated single assignment form. In Proceedings of the International Symposium on Code Generation and Optimization. ACM.Google ScholarGoogle Scholar
  15. Jeanne Ferrante, Karl J. Ottenstein, and Joe D. Warren. 1987. The program dependence graph and its use in optimization. ACM Transactions on Programming Languages and Systems 9, 3 (1987), 319--349.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Paul Havlak. 1993. Construction of thinned gated single-assignment form. In Proceedings of the International Workshop on Languages and Compilers for Parallel Computing-Revised Papers. Springer, 477--499.Google ScholarGoogle Scholar
  17. S. Horwitz, J. Prins, and T. Reps. 1988. On the adequacy of program dependence graphs for representing programs. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, 146--157.Google ScholarGoogle Scholar
  18. S. Horwitz, T. Reps, and D. Binkley. 1988. Interprocedural slicing using dependence graphs. Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation 23, 7, 35--46.Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Neil Johnson and Alan Mycroft. 2003. Combined code motion and register allocation using the value state dependence graph. In Proceedings of the International Conference on Compiler Construction. Springer-Verlag, 1--16.Google ScholarGoogle ScholarCross RefCross Ref
  20. Neil E. Johnson. 2004. Code Size Optimization for Embedded Processors. Technical Report. University of Cambridge, Computer Laboratory.Google ScholarGoogle Scholar
  21. Richard Johnson, David Pearson, and Keshav Pingali. 1994. The program structure tree: Computing control regions in linear time. Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, 171--185.Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis 8 transformation. In Proceedings of the International Symposium on Code Generation and Optimization.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasilache, and Oleksandr Zinenko. 2020. MLIR: A Compiler Infrastructure for the End of Moore’s Law. arxiv:cs.PL/2002.11054Google ScholarGoogle Scholar
  24. Alan C. Lawrence. 2007. Optimizing Compilation with the Value State Dependence Graph. Technical Report. University of Cambridge.Google ScholarGoogle Scholar
  25. LLVM. 2018. Retrieved April 5, 2020 from https://bugs.llvm.org/show\_bug.cgi?id=31851.Google ScholarGoogle Scholar
  26. LLVM. 2018. Retrieved April 5, 2020 from https://bugs.llvm.org/show\_bug.cgi?id=37202.Google ScholarGoogle Scholar
  27. LLVM. 2018. Retrieved April 5, 2020 from https://bugs.llvm.org/show\_bug.cgi?id=31183.Google ScholarGoogle Scholar
  28. Naraig Manjikian and Tarek S. Abdelrahman. 1997. Fusion of loops for parallelism and locality. IEEE Transactions on Parallel and Distributed Systems 8, 2 (1997), 193--209.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Steven S. Muchnick. 1997. Advanced Compiler Design and Implementation. Morgan Kaufmann.Google ScholarGoogle Scholar
  30. R. Namballa, N. Ranganathan, and A. Ejnioui. 2004. Control and data flow graph extraction for high-level synthesis. In IEEE Computer Society Annual Symposium on VLSI. 187--192.Google ScholarGoogle Scholar
  31. Karl J. Ottenstein, Robert A. Ballance, and Arthur B. MacCabe. 1990. The program dependence web: A representation supporting control-, data-, and demand-driven interpretation of imperative languages. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, 257--271.Google ScholarGoogle Scholar
  32. Guilherme Ottoni, Ram Rangan, Adam Stoler, and David I. August. 2005. Automatic thread extraction with decoupled software pipelining. In Proceedings of the ACM/IEEE International Symposium on Microarchitecture. IEEE, 105--118.Google ScholarGoogle Scholar
  33. Louis-Noël Pouchet. 2017. Polybench/C 4.2. Retrieved November 11, 2019 from http://web.cse.ohio-state.edu/pouchet.2/software/polybench/.Google ScholarGoogle Scholar
  34. Nico Reißmann. 2012. Utilizing the Value State Dependence Graph for Haskell. Master of Science Thesis in Computer Science. University of Gothenburg 8 Chalmers University of Technology, Göteborg, Sweden. https://gupea.ub.gu.se/handle/2077/30117.Google ScholarGoogle Scholar
  35. Nico Reissmann. 2017. jlm. Retrieved April 5, 2020 from https://github.com/phate/jlm.Google ScholarGoogle Scholar
  36. Nico Reissmann, Thomas L. Falch, Benjamin A. Bjørnseth, Helge Bahmann, Jan Christian Meyer, and Magnus Jahre. 2016. Efficient control flow restructuring for GPUs. In Proceedings of the International Conference on High Performance Computing and Simulation. 48--57.Google ScholarGoogle ScholarCross RefCross Ref
  37. B. K. Rosen, M. N. Wegman, and F. K. Zadeck. 1988. Global value numbers and redundant computations. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, 12--27.Google ScholarGoogle Scholar
  38. Radu Rugina and Martin C. Rinard. 2001. Recursion unrolling for divide and conquer programs. In Proceedings of the International Workshop on Languages and Compilers for Parallel Computing-Revised Papers. Springer-Verlag, 34--48.Google ScholarGoogle Scholar
  39. V. Sarkar. 1991. Automatic partitioning of a program dependence graph into parallel tasks. IBM Journal of Research and Development 35, 5-6 (1991), 779--804.Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. M. Sharir. 1980. Structural analysis: A new approach to flow analysis in optimizing compilers. Computer Languages 5, 3 (1980), 141--153.Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Magnus Själander, Magnus Jahre, Gunnar Tufte, and Nico Reissmann. 2019. EPIC: An Energy-Efficient, High-Performance GPGPU Computing Research Infrastructure. arxiv:cs.DC/1912.05848Google ScholarGoogle Scholar
  42. James Stanier. 2012. Removing and Restoring Control Flow with the Value State Dependence Graph. Ph.D. Dissertation. University of Sussex.Google ScholarGoogle Scholar
  43. James Stanier and Alan Lawrence. 2011. The value state dependence graph revisited. In Proceedings of the Workshop on Intermediate Representations. 53--60.Google ScholarGoogle Scholar
  44. James Stanier and Des Watson. 2013. Intermediate representations in imperative compilers: A survey. Computing Surveys 45, 3 (2013).Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. R. Tarjan. 1972. Depth-first search and linear graph algorithms. SIAM Journal on Computing 1, 2 (1972), 146--160.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Peng Tu and David Padua. 1995. Efficient building and placing of gating functions. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, 47--55.Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Mark N. Wegman and F. Kenneth Zadeck. 1991. Constant propagation with conditional branches. ACM Transactions on Programming Languages and Systems 13, 2 (1991), 181--210.Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Daniel Weise, Roger F. Crew, Michael Ernst, and Bjarne Steensgaard. 1994. Value dependence graphs: Representation without taxation. In Proceedings of the ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, 297--310.Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Ali Mustafa Zaidi. 2015. Accelerating Control-Flow Intensive Code in Spatial Hardware. Technical Report. University of Cambridge.Google ScholarGoogle Scholar
  50. Ali Mustafa Zaidi and David Greaves. 2015. Value state flow graph: A dataflow compiler IR for accelerating control-intensive code in spatial hardware. ACM Transactions on Reconfigurable Technology and Systems 9, 2 (2015), 14:1--14:22.Google ScholarGoogle Scholar
  51. F. Zhang and E. H. D’Hollander. 2004. Using hammock graphs to structure programs. IEEE Transactions on Software Engineering 30, 4 (2004), 231--245.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. RVSDG: An Intermediate Representation for Optimizing Compilers

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Article Metrics

          • Downloads (Last 12 months)115
          • Downloads (Last 6 weeks)8

          Other Metrics

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader

        HTML Format

        View this article in HTML Format .

        View HTML Format
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!