Abstract
To optimize code effectively, compilers must deal with memory dependencies. However, the state-of-the-art heuristics available in the literature to track memory dependencies are inherently imprecise and computationally expensive. Consequently, the most advanced code transformations that compilers have today are ineffective when applied on real-world programs. The goal of this paper is to solve this conundrum through dynamic disambiguation of pointers. We provide different ways to determine at runtime when two memory locations can overlap. We then produce two versions of a code region: one that is aliasing-free - hence, easy to optimize - and another that is not. Our checks let us safely branch to the optimizable region. We have applied these ideas on Polly-LLVM, a loop optimizer built on top of the LLVM compilation infrastructure. Our experiments indicate that our method is precise, effective and useful: we can disambiguate every pair of pointer in the loop intensive Polybench benchmark suite. The result of this precision is code quality: the binaries we generate are 10% faster than those that Polly-LLVM produces without our optimization, at the -O3 optimization level of LLVM.
Supplemental Material
Available for Download
Artifact containing a VM with a build of our three techniques and test scripts.
- A. V. Aho, M. S. Lam, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques, and Tools (2nd Edition). Addison Wesley, 2006. Google Scholar
Digital Library
- P. Akritidis, M. Costa, M. Castro, and S. Hand. Baggy bounds checking: An efficient and backwards-compatible defense against out-of-bounds errors. In SSYM, pages 51–66. USENIX, 2009. Google Scholar
Digital Library
- P. Alves, R. Rodrigues, R. Sousa, and F. M. Q. Pereira. A case for a fast trip count predictor. IPL, 10(1016):8, 2014.Google Scholar
- L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, 1994.Google Scholar
- A. W. Appel and J. Palsberg. Modern Compiler Implementation in Java. Cambridge University Press, 2nd edition, 2002. Google Scholar
Cross Ref
- R. Bayer. Symmetric binary b-trees: Data structure and maintenance algorithms. Acta Informatica, 1(4):290–306, 1972. Google Scholar
Digital Library
- J. L. Bentley and J. H. Friedman. Data structures for range searching. ACM Comput. Surv., 11(4):397–409, 1979. Google Scholar
Digital Library
- U. Bondhugula, A. Hartono, J. Ramanujam, and P. Sadayappan. A practical automatic polyhedral parallelizer and locality optimizer. SIGPLAN Notices, 43(6):101–113, 2008. Google Scholar
Digital Library
- L. Ceze, J. Tuck, J. Torrellas, and C. Cascaval. Bulk disambiguation of speculative threads in multiprocessors. In ISCA, pages 227–238. IEEE, 2006. Google Scholar
Digital Library
- M. Chabbi and J. M.Crummey. Deadspy: a tool to pinpoint program inefficiencies. In CGO, pages 124–134. ACM, 2012. Google Scholar
Digital Library
- T. Chen, J. Lin, X. Dai, W.-C. Hsu, and P.-C. Yew. Data dependence profiling for speculative optimizations. In Compiler Construction, pages 57–72. Springer, 2004.Google Scholar
- T. H. Cormen. Introduction to algorithms, chapter III.14, pages 348–355. MIT press, 2009.Google Scholar
- R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. TOPLAS, 13(4):451–490, 1991. Google Scholar
Digital Library
- J. Da Silva and J. G. Steffan. A probabilistic pointer analysis for speculative optimizations. In ASPLOS, pages 416–425. ACM, 2006. Google Scholar
Digital Library
- M. Fernández and R. Espasa. Speculative alias analysis for executable code. In PACT, pages 222–231. IEEE, 2002. Google Scholar
Digital Library
- J. Ferrante, J. Ottenstein, and D. Warren. The program dependence graph and its use in optimization. TOPLAS, 9(3): 319–349, 1987. Google Scholar
Digital Library
- T. Grosser, A. Groesllinger, and C. Lengauer. Polly - performing polyhedral optimizations on a low-level intermediate representation. Parallel Processing Letters, 04(22):X, 2012.Google Scholar
- T. Grosser, S. Pop, J. Ramanujam, and P. Sadayappan. On recovering multi-dimensional arrays in polly. IMPACT, 2015.Google Scholar
- T. Grosser, S. Verdoolaege, and A. Cohen. Polyhedral AST generation is more than scanning polyhedra. TOPLAS, 37(4): 12:1–12:50, 2015. Google Scholar
Digital Library
- P. J. Guo. A Scalable Mixed-Level Approach to Dynamic Analysis of C and C++ programs. PhD thesis, MIT, 2006.Google Scholar
- M. W. Hall. Managing interprocedural optimization. PhD thesis, Rice University, 1991. Google Scholar
Digital Library
- S. Horwitz. Precise flow-insensitive may-alias analysis is NPhard. TOPLAS, 19(1):1–6, 1997. Google Scholar
Digital Library
- A. S. Huang, G. Slavenburg, and J. P. Shen. Speculative disambiguation: a compilation technique for dynamic memory disambiguation. In ISCA, pages 200–210, 1994. Google Scholar
Digital Library
- R. Karrenberg and S. Hack. Whole-function vectorization. In CGO, pages 141–150. IEEE, 2011. Google Scholar
Digital Library
- R. Kennedy, S. Chan, S.-M. Liu, R. Lo, P. Tu, and F. C. Chow. Partial redundancy elimination in SSA form. TOPLAS, 21(3): 627–676, 1999. Google Scholar
Digital Library
- P. A. Kulkarni, D. B. Whalley, G. S. Tyson, and J. W. Davidson. Exhaustive optimization phase order space exploration. In CGO, pages 306–318. IEEE, 2006. Google Scholar
Digital Library
- W. Landi and B. G. Ryder. Pointer-induced aliasing: A problem classification. In POPL, pages 93–103. ACM, 1991. Google Scholar
Digital Library
- C. Lattner and V. S. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO, pages 75––88. IEEE, 2004. Google Scholar
Digital Library
- S. Lee, S.-J. Min, and R. Eigenmann. Openmp to gpgpu: a compiler framework for automatic translation and optimization. In PPoPP, pages 101–110. ACM, 2009. Google Scholar
Digital Library
- J. Lin, T. Chen, W.-C. Hsu, P.-C. Yew, R. D.-C. Ju, T.-F. Ngai, and S. Chan. A compiler framework for speculative analysis and optimizations. In PLDI, pages 289–299. ACM, 2003. Google Scholar
Digital Library
- C. Margiolas and M. F. P. O’Boyle. Portable and transparent host-device communication optimization for GPGPU environments. In CGO, pages 1–10. ACM, 2014. Google Scholar
Digital Library
- R. Metzger and S. Stroud. Interprocedural constant propagation: an empirical study. LOPLAS, 2(1-4):213–232, 1993. Google Scholar
Digital Library
- M. Mock, M. Das, C. Chambers, and S. Eggers. Dynamic points-to sets: A comparison with static analysis and potential applications in program understanding and optimization. In PASTE, pages 66–72. ACM, 2001. Google Scholar
Digital Library
- S. Nagarakatte, J. Zhao, M. M. Martin, and S. Zdancewic. Softbound: Highly compatible and complete spatial memory safety for c. In PLDI, pages 245–258. ACM, 2009. Google Scholar
Digital Library
- H. Nazaré, I. Maffra, W. Santos, L. Barbosa, L. Gonnord, and F. M. Q. Pereira. Validation of memory accesses through symbolic analyses. In OOPSLA, pages 791–809. ACM, 2014. Google Scholar
Digital Library
- G. C. Necula, S. McPeak, and W. Weimer. Ccured: Type-safe retrofitting of legacy code. In POPL, pages 128–139. ACM, 2002. Google Scholar
Digital Library
- C. E. Oancea and L. Rauchwerger. Logical inference techniques for loop parallelization. SIGPLAN Not., 47(6):509– 520, 2012. Google Scholar
Digital Library
- C. E. Oancea and L. Rauchwerger. Scalable conditional induction variables (CIV) analysis. In CGO, pages 213–224. ACM, 2015. Google Scholar
Digital Library
- F. M. Q. Pereira and D. Berlin. Wave propagation and deep propagation for pointer analysis. In CGO, pages 126–135. IEEE, 2009. Google Scholar
Digital Library
- L.-N. Pouchet. Polybench/C: the polyhedral benchmark suite, 2014. Available on-line.Google Scholar
- S. Rus, L. Rauchwerger, and J. Hoeflinger. Hybrid analysis: Static and dynamic memory reference analysis. In ICS, pages 251–283. IEEE, 2002. Google Scholar
Digital Library
- K. Serebryany, D. Bruening, A. Potapenko, and D. Vyukov. Addresssanitizer: a fast address sanity checker. In USENIX ATC, pages 28–28. USENIX Association, 2012. Google Scholar
Digital Library
- R. Surendran, R. Barik, J. Zhao, and V. Sarkar. Inter-iteration scalar replacement using array ssa form. In Compiler Construction, pages 40–60, 2014.Google Scholar
Cross Ref
- S. Verdoolaege. isl: An integer set library for the polyhedral model. In ICMS, pages 299–302. Springer, 2010. Google Scholar
Digital Library
- S. Verdoolaege, J. C. Juega, A. Cohen, J. I. G´omez, C. Tenllado, and F. Catthoor. Polyhedral parallel code generation for CUDA. TACO, 9(4), 2013. Google Scholar
Digital Library
- M. Wolfe. High Performance Compilers for Parallel Computing. Adison-Wesley, 1st edition, 1996. Google Scholar
Digital Library
- Y. Yang, P. Xiang, J. Kong, and H. Zhou. A GPGPU compiler for memory optimization and parallelism management. In PLDI, pages 86–97. ACM, 2010. Google Scholar
Digital Library
- Q. Zhang, M. R. Lyu, H. Yuan, and Z. Su. Fast algorithms for dyck-cfl-reachability with applications to alias analysis. In PLDI, pages 435–446. ACM, 2013. Google Scholar
Digital Library
- X. Zheng and R. Rugina. Demand-driven alias analysis for c. In POPL, pages 197–208. ACM, 2008. Google Scholar
Digital Library
Index Terms
Runtime pointer disambiguation
Recommendations
Runtime pointer disambiguation
OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsTo optimize code effectively, compilers must deal with memory dependencies. However, the state-of-the-art heuristics available in the literature to track memory dependencies are inherently imprecise and computationally expensive. Consequently, the most ...
Semi-sparse flow-sensitive pointer analysis
POPL '09Pointer analysis is a prerequisite for many program analyses, and the effectiveness of these analyses depends on the precision of the pointer information they receive. Two major axes of pointer analysis precision are flow-sensitivity and context-...
Semi-sparse flow-sensitive pointer analysis
POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesPointer analysis is a prerequisite for many program analyses, and the effectiveness of these analyses depends on the precision of the pointer information they receive. Two major axes of pointer analysis precision are flow-sensitivity and context-...






Comments