skip to main content
10.1145/2814270.2814285acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Runtime pointer disambiguation

Published: 23 October 2015 Publication History

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.

Supplementary Material

Auxiliary Archive (p589-alves-s.zip)
Artifact containing a VM with a build of our three techniques and test scripts.

References

[1]
A. V. Aho, M. S. Lam, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques, and Tools (2nd Edition). Addison Wesley, 2006.
[2]
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.
[3]
P. Alves, R. Rodrigues, R. Sousa, and F. M. Q. Pereira. A case for a fast trip count predictor. IPL, 10(1016):8, 2014.
[4]
L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, 1994.
[5]
A. W. Appel and J. Palsberg. Modern Compiler Implementation in Java. Cambridge University Press, 2nd edition, 2002.
[6]
R. Bayer. Symmetric binary b-trees: Data structure and maintenance algorithms. Acta Informatica, 1(4):290–306, 1972.
[7]
J. L. Bentley and J. H. Friedman. Data structures for range searching. ACM Comput. Surv., 11(4):397–409, 1979.
[8]
U. Bondhugula, A. Hartono, J. Ramanujam, and P. Sadayappan. A practical automatic polyhedral parallelizer and locality optimizer. SIGPLAN Notices, 43(6):101–113, 2008.
[9]
L. Ceze, J. Tuck, J. Torrellas, and C. Cascaval. Bulk disambiguation of speculative threads in multiprocessors. In ISCA, pages 227–238. IEEE, 2006.
[10]
M. Chabbi and J. M.Crummey. Deadspy: a tool to pinpoint program inefficiencies. In CGO, pages 124–134. ACM, 2012.
[11]
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.
[12]
T. H. Cormen. Introduction to algorithms, chapter III.14, pages 348–355. MIT press, 2009.
[13]
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.
[14]
J. Da Silva and J. G. Steffan. A probabilistic pointer analysis for speculative optimizations. In ASPLOS, pages 416–425. ACM, 2006.
[15]
M. Fernández and R. Espasa. Speculative alias analysis for executable code. In PACT, pages 222–231. IEEE, 2002.
[16]
J. Ferrante, J. Ottenstein, and D. Warren. The program dependence graph and its use in optimization. TOPLAS, 9(3): 319–349, 1987.
[17]
T. Grosser, A. Groesllinger, and C. Lengauer. Polly - performing polyhedral optimizations on a low-level intermediate representation. Parallel Processing Letters, 04(22):X, 2012.
[18]
T. Grosser, S. Pop, J. Ramanujam, and P. Sadayappan. On recovering multi-dimensional arrays in polly. IMPACT, 2015.
[19]
T. Grosser, S. Verdoolaege, and A. Cohen. Polyhedral AST generation is more than scanning polyhedra. TOPLAS, 37(4): 12:1–12:50, 2015.
[20]
P. J. Guo. A Scalable Mixed-Level Approach to Dynamic Analysis of C and C++ programs. PhD thesis, MIT, 2006.
[21]
M. W. Hall. Managing interprocedural optimization. PhD thesis, Rice University, 1991.
[22]
S. Horwitz. Precise flow-insensitive may-alias analysis is NPhard. TOPLAS, 19(1):1–6, 1997.
[23]
A. S. Huang, G. Slavenburg, and J. P. Shen. Speculative disambiguation: a compilation technique for dynamic memory disambiguation. In ISCA, pages 200–210, 1994.
[24]
R. Karrenberg and S. Hack. Whole-function vectorization. In CGO, pages 141–150. IEEE, 2011.
[25]
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.
[26]
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.
[27]
W. Landi and B. G. Ryder. Pointer-induced aliasing: A problem classification. In POPL, pages 93–103. ACM, 1991.
[28]
C. Lattner and V. S. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO, pages 75––88. IEEE, 2004.
[29]
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.
[30]
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.
[31]
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.
[32]
R. Metzger and S. Stroud. Interprocedural constant propagation: an empirical study. LOPLAS, 2(1-4):213–232, 1993.
[33]
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.
[34]
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.
[35]
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.
[36]
G. C. Necula, S. McPeak, and W. Weimer. Ccured: Type-safe retrofitting of legacy code. In POPL, pages 128–139. ACM, 2002.
[37]
C. E. Oancea and L. Rauchwerger. Logical inference techniques for loop parallelization. SIGPLAN Not., 47(6):509– 520, 2012.
[38]
C. E. Oancea and L. Rauchwerger. Scalable conditional induction variables (CIV) analysis. In CGO, pages 213–224. ACM, 2015.
[39]
F. M. Q. Pereira and D. Berlin. Wave propagation and deep propagation for pointer analysis. In CGO, pages 126–135. IEEE, 2009.
[40]
L.-N. Pouchet. Polybench/C: the polyhedral benchmark suite, 2014. Available on-line.
[41]
S. Rus, L. Rauchwerger, and J. Hoeflinger. Hybrid analysis: Static and dynamic memory reference analysis. In ICS, pages 251–283. IEEE, 2002.
[42]
K. Serebryany, D. Bruening, A. Potapenko, and D. Vyukov. Addresssanitizer: a fast address sanity checker. In USENIX ATC, pages 28–28. USENIX Association, 2012.
[43]
R. Surendran, R. Barik, J. Zhao, and V. Sarkar. Inter-iteration scalar replacement using array ssa form. In Compiler Construction, pages 40–60, 2014.
[44]
S. Verdoolaege. isl: An integer set library for the polyhedral model. In ICMS, pages 299–302. Springer, 2010.
[45]
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.
[46]
M. Wolfe. High Performance Compilers for Parallel Computing. Adison-Wesley, 1st edition, 1996.
[47]
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.
[48]
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.
[49]
X. Zheng and R. Rugina. Demand-driven alias analysis for c. In POPL, pages 197–208. ACM, 2008.

Cited By

View all

Index Terms

  1. Runtime pointer disambiguation

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
    October 2015
    953 pages
    ISBN:9781450336895
    DOI:10.1145/2814270
    • cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 50, Issue 10
      OOPSLA '15
      October 2015
      953 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2858965
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 23 October 2015

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Alias analysis
    2. dynamic guards
    3. optimization

    Qualifiers

    • Research-article

    Conference

    SPLASH '15
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 268 of 1,244 submissions, 22%

    Upcoming Conference

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)30
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 06 Nov 2024

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media