[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/2892208.2892225acmconferencesArticle/Chapter ViewAbstractPublication PagesccConference Proceedingsconference-collections
research-article

Restrictification of function arguments

Published: 17 March 2016 Publication History

Abstract

Pointer aliasing still hinders compiler optimizations, in spite of years of research on pointer disambiguation. Because the automatic disambiguation of pointers is a difficult endeavor, several programming languages offer programmers mechanisms to distinguish memory references, such as the “restrict” keyword in C. However, the use of such mechanisms is prone to human mistakes. In this paper we present a suite of automatic techniques that mitigate this problem. We have designed, implemented and tested three different ways to disambiguate pointers passed as arguments of functions. Our techniques combine static analyses to infer symbolic bounds of memory regions and code versioning. We generate a clone for each function whose arguments we can disambiguate and optimize it assuming the absence of aliasing among formal parameters. At runtime, we use the results of the symbolic interval tests to decide which version of a function we should call: the original one or the “restricted” clone, whenever we can prove that no aliasing can occur at runtime. An implementation of our restrictification methods in LLVM shows that we can vectorize up to 63% more operations than what could be accomplished using the -O3 optimization level of said compiler. When applying the optimization on OpenCV benchmarks, we have observed speedups as great as 40%.

References

[1]
P. Alves, F. Gruber, J. Doerfert, A. Lamprineas, T. Grosser, F. Rastello, and F. Pereira. Runtime pointer disambiguation. In OOPSLA. ACM, 2015.
[2]
L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, 1994.
[3]
A. W. Appel and J. Palsberg. Modern Compiler Implementation in Java. Cambridge University Press, 2nd edition, 2002.
[4]
W. Blume and R. Eigenmann. Symbolic range propagation. In IPPS, pages 357–363, 1994.
[5]
R. Bodik, R. Gupta, and V. Sarkar. ABCD: eliminating array bounds checks on demand. In PLDI, pages 321–333. ACM, 2000.
[6]
T. Chen, J. Lin, W.-C. Hsu, and P.-C. Yew. An empirical study on the granularity of pointer analysis in c programs. In LCPC, pages 157–171. Springer, 2005.
[7]
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.
[8]
D. Gallagher, W. Chen, S. Mahlke, J. Gyllenhaal, and W.-m. Hwu. Dynamic memory disambiguation using the memory conflict buffer. In ASPLOS, pages 183–193. ACM, 1994.
[9]
T. Grosser, A. Groesllinger, and C. Lengauer. Polly - performing polyhedral optimizations on a low-level intermediate representation. Parallel Processing Letters, 04(22):X, 2012.
[10]
B. Guo, Y. Wu, C. Wang, M. J. Bridges, G. Ottoni, N. Vachharajani, J. Chang, and D. I. August. Selective runtime memory disambiguation in a dynamic binary translator. In CC, pages 65–79. Springer, 2006.
[11]
B. Hackett and A. Aiken. How is aliasing used in systems software? In FSE, pages 69–80. ACM, 2006.
[12]
B. Hardekopf and C. Lin. The ant and the grasshopper: fast and accurate pointer analysis for millions of lines of code. In PLDI, pages 290–299. ACM, 2007.
[13]
B. Hardekopf and C. Lin. Flow-sensitive pointer analysis for millions of lines of code. In CGO, pages 265–280, 2011.
[14]
M. Hind. Pointer analysis: Haven’t we solved this problem yet? In PASTE, pages 54–61. ACM, 2001.
[15]
N. D. Jones and S. S. Muchnick. A flexible approach to interprocedural data flow analysis and programs with recursive data structures. In POPL, pages 66–74. ACM, 1982.
[16]
R. Karrenberg and S. Hack. Whole-function vectorization. In CGO, pages 141–150. IEEE, 2011.
[17]
C. Lattner and V. S. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO, pages 75––88. IEEE, 2004.
[18]
F. Logozzo and M. Fähndrich. Pentagons: A weakly relational abstract domain for the efficient validation of array accesses. Sci. Comput. Program., 75(9):796–807, 2010.
[19]
C. Margiolas and M. F. P. O’Boyle. Portable and transparent hostdevice communication optimization for GPGPU environments. In CGO, pages 1–10. ACM, 2014.
[20]
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.
[21]
J. Nickolls and W. J. Dally. The GPU computing era. IEEE Micro, 30: 56–69, 2010.
[22]
A. Nicolau. Run-time disambiguation: Coping with statically unpredictable dependencies. Transactions on Computers, 38(5):663–678, 1989.
[23]
J. Noble, J. Vitek, and J. Potter. Flexible alias protection. In ECCOP, pages 158–185. Springer-Verlag, 1998.
[24]
F.M.Q. Pereira, and D. Berlin. Wave Propagation and Deep Propagation for Pointer Analysis. In CGO, pages 126–135. ACM, 2009.
[25]
G. Piccoli, H. Nazaré, R. Rodrigues, C. Pousa, E. Borin, and F. Pereira. Compiler support for selective page migration in NUMA architectures. In PACT, pages 369–380. ACM, 2014.
[26]
R. Rugina and M. C. Rinard. Symbolic bounds analysis of pointers, array indices, and accessed memory regions. TOPLAS, 27(2):185–235, 2005.
[27]
S. Rus, L. Rauchwerger, and J. Hoeflinger. Hybrid analysis: Static and dynamic memory reference analysis. In ICS, pages 251–283. IEEE Computer Society, 2002.
[28]
B. Steensgaard. Points-to analysis in almost linear time. In POPL, pages 32–41, 1996.
[29]
J. Whaley and M. S. Lam. Cloning-based context-sensitive pointer alias analysis using binary decision diagrams. In PLDI, pages 131–144. ACM, 2004.
[30]
Y. Wu and J. R. Larus. Static branch frequency and program profile analysis. In MICRO. IEEE, 1994.
[31]
Q. Zhang, M. R. Lyu, H. Yuan, and Z. Su. Fast algorithms for dyckcfl-reachability with applications to alias analysis. In PLDI, pages 435–446. ACM, 2013.
[32]
X. Zheng and R. Rugina. Demand-driven alias analysis for C. In POPL, pages 197–208. ACM, 2008.

Cited By

View all
  • (2023)Rapid: Region-Based Pointer DisambiguationProceedings of the ACM on Programming Languages10.1145/36228597:OOPSLA2(1729-1757)Online publication date: 16-Oct-2023
  • (2023)Side-channel Elimination via Partial Control-flow LinearizationACM Transactions on Programming Languages and Systems10.1145/359473645:2(1-43)Online publication date: 26-Jun-2023
  • (2022)The road not taken: exploring alias analysis based optimizations missed by the compilerProceedings of the ACM on Programming Languages10.1145/35633166:OOPSLA2(786-810)Online publication date: 31-Oct-2022
  • Show More Cited By

Index Terms

  1. Restrictification of function arguments

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    CC '16: Proceedings of the 25th International Conference on Compiler Construction
    March 2016
    270 pages
    ISBN:9781450342414
    DOI:10.1145/2892208
    • General Chair:
    • Ayal Zaks,
    • Program Chair:
    • Manuel Hermenegildo
    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

    In-Cooperation

    • IEEE-CS: Computer Society

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 17 March 2016

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Aliasing
    2. Cloning
    3. Compiler
    4. Optimization
    5. Static analysis

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    CGO '16

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)7
    • Downloads (Last 6 weeks)2
    Reflects downloads up to 02 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)Rapid: Region-Based Pointer DisambiguationProceedings of the ACM on Programming Languages10.1145/36228597:OOPSLA2(1729-1757)Online publication date: 16-Oct-2023
    • (2023)Side-channel Elimination via Partial Control-flow LinearizationACM Transactions on Programming Languages and Systems10.1145/359473645:2(1-43)Online publication date: 26-Jun-2023
    • (2022)The road not taken: exploring alias analysis based optimizations missed by the compilerProceedings of the ACM on Programming Languages10.1145/35633166:OOPSLA2(786-810)Online publication date: 31-Oct-2022
    • (2018)Towards automatic restrictification of CUDA kernel argumentsProceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering10.1145/3238147.3241533(928-931)Online publication date: 3-Sep-2018
    • (2018)[Engineering Paper] RECKA and RPromF: Two Frama-C Plug-ins for Optimizing Registers Usage in CUDA, OpenACC and OpenMP Programs2018 IEEE 18th International Working Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM.2018.00029(187-192)Online publication date: Sep-2018
    • (2017)Demand-driven less-than analysisProceedings of the 21st Brazilian Symposium on Programming Languages10.1145/3125374.3125379(1-8)Online publication date: 21-Sep-2017
    • (2017)DawnCCACM Transactions on Architecture and Code Optimization10.1145/308454014:2(1-25)Online publication date: 26-May-2017

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media