skip to main content
research-article

Runtime pointer disambiguation

Published:23 October 2015Publication History
Skip Abstract Section

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.

Skip Supplemental Material Section

Supplemental Material

References

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

Index Terms

  1. Runtime pointer disambiguation

    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

    • Published in

      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
      • 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

      Copyright © 2015 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 23 October 2015

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

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

    Learn more

    Got it!