Skip to main content
Log in

Acyclic orientation graph coloring for software-managed memory allocation

  • Research Paper
  • Published:
Science China Information Sciences Aims and scope Submit manuscript

Abstract

This paper presents a novel compiler algorithm, called acyclic orientation graph coloring (AOG coloring), for managing data objects in software-managed memory allocation. The key insight is that softwaremanaged memory allocation could be solved as an interval coloring problem, or equivalently, an acyclic orientation problem. We generalize graph coloring register allocation to interval coloring memory allocation by maintaining an acyclic orientation to the currently colored subgraph. This is achieved with some well-crafted heuristics, including Aggressive Simplify that does not necessarily preserve colorability and Best-Fit Select that assigns intervals (i.e., colors) to nodes by possibly adjusting the colors already assigned to other nodes earlier. Our algorithm generalizes and subsumes as a special case the classical graph coloring register allocation algorithm without notably increased complexity: it deals with memory allocation while preserving the elegance and practicality of traditional graph coloring register allocation. We have implemented our algorithm and tested it on Appel’s 27921 interference graphs for scalars (augmented with node weights). Our algorithm outperforms Memory Coloring, the best in the literature, for software-managed memory allocation, on 98.64% graphs, in which, the gaps are more than 20% on 68.31% graphs and worse only on 0.29% graphs. We also tested it on all the 73 DIMACS weighted benchmarks (weighted graphs), AOG Coloring outperforms Memory Coloring on all of the benchmarks, in which, the gaps are more than 20% on 83.56% graphs.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Banakar R, Steinke S, Lee B-S, et al. Scratchpad memory: design alternative for cache on-chip memory in embedded systems. In: Proceedings of the 10th International Symposium on Hardware/Software Codesign, Estes Park, 2002. 73–78

    Chapter  Google Scholar 

  2. Dally W J, Labonte F, Das A, et al. Merrimac: supercomputing with streams. In: Proceedings of the ACM/IEEE Conference on Supercomputing, Phoenix, 2003. 35

    Google Scholar 

  3. Cuvillo J D, Zhu W, Ziang H U, et al. Fast: a functionally accurate simulation toolset for the cyclops64 cellular architecture. In: Proceedings of Workshop on Modeling, Benchmarking, and Simulation, Madison, 2005. 11–20

    Google Scholar 

  4. Makino J, Hiraki K, Inaba M. GRAPE-DR: 2-pflops massively-parallel computer with 512-core, 512-Gflops processor chips for scientific computing. In: Proceedings of the ACM/IEEE Conference on Supercomputing, New York, 2007. 1–11

    Google Scholar 

  5. Barker K J, Davis K, Hoisie A, et al. Entering the petaflop era: the architecture and performance of roadrunner. In: Proceedings of the ACM/IEEE Conference on Supercomputing, Austin, 2008. 1–11

    Google Scholar 

  6. Verma M, Wehmeyer L, Marwedel P. Dynamic overlay of scratchpad memory for energy minimization. In: Proceedings of the 2nd IEEE/ACM/IFIP International Conference on Hardware/software Codesign and System Synthesis, Stockholm, 2004. 104–109

    Chapter  Google Scholar 

  7. Kandemir M, Ramanujam J, Irwin J, et al. Dynamic management of scratch-pad memory space. In: Proceedings of the 38th Conference on Design Automation, Las Vegas, 2001. 690–695

    Google Scholar 

  8. Li L, Gao L, Xue J L. Memory coloring: a compiler approach for scratchpad memory management. In: Proceedings of the 14th International Conference on Parallel Architectures and Compilation Techniques, Washington, 2005. 329–338

    Google Scholar 

  9. Li L, Nguyen Q-H, Xue J L. Scratchpad allocation for data aggregates in superperfect graphs. In: Proceedings of the ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, San Diego, 2007. 207–216

    Google Scholar 

  10. Li L, Feng H, Xue J L. Compiler-directed scratchpad memory management via graph coloring. ACM Trans Archit Code Optim, 2009, 6: 1–17

    Google Scholar 

  11. Li L, Xue J L, Knoop J. Scratchpad memory allocation for data aggregates via interval coloring in superperfect graphs. ACM Trans Embed Comput Syst, 2011, 10: 28

    Google Scholar 

  12. Wan Q, Wu H, Xue J L. WCET-aware data selection and allocation for scratchpad memory. In: Proceedings of the International Conference on Languages, Compilers, and Tools for Embedded Systems, Beijing, 2012. 41–50

    Google Scholar 

  13. Chaitin G J. Register allocation & spilling via graph coloring. In: Proceedings of the SIGPLAN Symposium on Compiler Construction, Boston, 1982. 98–101

    Google Scholar 

  14. Chow F C, Hennessy J L. The priority-based coloring approach to register allocation. ACM Trans Program Lang Syst, 1990, 12: 501–536

    Article  Google Scholar 

  15. Briggs P, Cooper K D, Torczon L. Improvements to graph coloring register allocation. ACM Trans Program Lang Syst, 1994, 16: 428–455

    Article  Google Scholar 

  16. George L, Appel A W. Iterated register coalescing. ACM Trans Program Lang Syst, 1996, 18: 300–324

    Article  Google Scholar 

  17. Smith M D, Ramsey N, Holloway G. A generalized algorithm for graph-coloring register allocation. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, Washington, 2004. 277–288

    Google Scholar 

  18. Wang L, Yang X J, Xue J L, et al. Optimizing scientific application loops on stream processors. In: Proceedings of the ACM SIGPLAN-SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, Tucson, 2008. 161–170

    Google Scholar 

  19. Yang X J, Wang L, Xue J L, et al. Comparability graph coloring for optimizing utilization of stream register files in stream processors. In: Proceedings of the ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, Raleigh, 2009. 111–120

    Google Scholar 

  20. Yang X J, Wang L, Xue J L, et al. Comparability graph coloring for optimizing utilization of software-managed stream register files for stream processors. ACM Trans Archit Code Optim, 2012, 9: 5

    Google Scholar 

  21. Fabri J. Automatic storage optimization. SIGPLAN Not, 1979, 14: 83–91

    Article  Google Scholar 

  22. Garey M R, Johnson D S. Computers and Intractability: a Guide to the Theory of NP-Completeness. New York: W. H. Freeman & Co., 1979

    MATH  Google Scholar 

  23. Gergov J. Algorithms for compile-time memory optimization. In: Proceedings of the 10th Annual ACM-SIAM Symposium on Discrete Algorithms, Philadelphia, 1999. 907–908

    Google Scholar 

  24. Kierstead H A. A polynomial time approximation algorithm for dynamic storage allocation. Discrete Math, 1991, 87: 231–237

    Article  MathSciNet  Google Scholar 

  25. Buchsbaum A L, Karloff H, Kenyon C, et al. Opt versus load in dynamic storage allocation. In: Proceedings of the 35th Annual ACM Symposium on Theory of Computing, San Diego, 2003. 556–564

    Google Scholar 

  26. Lefebvre V, Feautrier P. Automatic storage management for parallel programs. Parallel Comput, 1998, 24: 649–671

    Article  MATH  Google Scholar 

  27. Golumbic M C. Algorithmic Graph Theory and Perfect Graphs (Annals of Discrete Mathematics, Vol 57). Amsterdam: North-Holland Publishing Co., 2004

    Google Scholar 

  28. Squire M B. Generating the acyclic orientations of a graph. J Algorithms, 1998, 26: 275–290

    Article  MATH  MathSciNet  Google Scholar 

  29. Barbosa V C, Szwarcfiter J L. Generating all the acyclic orientations of an undirected graph. Inf Process Lett, 1999, 72: 71–74

    Article  MathSciNet  Google Scholar 

  30. Stanley R P. Acyclic orientations of graphs. Discrete Math, 1973, 5: 171–178

    Article  MATH  MathSciNet  Google Scholar 

  31. Linial N. Hard enumeration problems in geometry and combinatorics. SIAM J Algebr Discrete Methods, 1986, 7: 331–335

    Article  MATH  MathSciNet  Google Scholar 

  32. Hack S, Goos G. Optimal register allocation for ssa-form programs in polynomial time. Inf Process Lett, 2006, 98: 150–155

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Li Wang.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wang, L., Xue, J. & Yang, X. Acyclic orientation graph coloring for software-managed memory allocation. Sci. China Inf. Sci. 57, 1–18 (2014). https://doi.org/10.1007/s11432-014-5131-7

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11432-014-5131-7

Keywords

Navigation