Advertisement

OpenACC Routine Directive Propagation Using Interprocedural Analysis

  • Aniket ShivamEmail author
  • Michael Wolfe
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11381)

Abstract

Accelerator programming today requires the programmer to specify what data to place in device memory, and what code to run on the accelerator device. When programming with OpenACC, directives and clauses are used to tell the compiler what data to copy to and from the device, and what code to compile for and run on the device. In particular, the programmer inserts directives around code regions, typically loops, to identify compute constructs to be compiled for and run on the device. If the compute construct calls a procedure, that procedure also needs to be marked for device compilation, as does any routine called in that procedure, and so on transitively. In addition, the marking needs to include the kind of parallelism that is exploited within the procedure, or within routines called by the procedure. When using separate compilation, the marking where the procedure is defined must be replicated in any file where it is called. This causes much frustration when first porting existing programs to GPU programming using OpenACC.

This paper presents an approach to partially automate this process. The approach relies on interprocedural analysis (IPA) to analyze OpenACC regions and procedure definitions, and to propagate the necessary information forward and backward across procedure calls spanning all the linked files, generating the required accelerator code through recompilation at link time. This approach can also perform correctness checks to prevent compilation or runtime errors. This method is implemented in the PGI OpenACC compiler.

Keywords

Automatic directive propagation Interprocedural analysis (IPA) OpenACC GPU Computing 

References

  1. 1.
    Callahan, D., Cooper, K., Kennedy, K., Torczon, L.M.: Interprocedural constant propagation. In: Proceedings of SIGPLAN 1986 Symposium on Compiler Construction, Palo Alto, CA, pp. 152–161, June 1986Google Scholar
  2. 2.
    Chandrasekaran, S., Juckeland, G. (eds.): OpenACC for Programmers. Addison-Wesley, Boston (2018)Google Scholar
  3. 3.
    Cooper, K.: Analyzing aliases of reference formal parameters. In: Conference on Record 12th Annual ACM Symposium Principles of Programming Languages, pp. 281–290, January 1985Google Scholar
  4. 4.
    Cooper, K., Kennedy, K.: Efficient computation of flow insensitive interprocedural summary information. In: Proceedings of SIGPLAN 1984 Symposium on Compiler Construction, Montreal, Canada, pp. 247–258, June 1984Google Scholar
  5. 5.
    Cooper, K., Kennedy, K.: Fast interprocedural alias analysis. In: Proceedings of ACM SIGPLAN 1989 Conference on Principles of Programming Languages, pp. 29–41, February 1986Google Scholar
  6. 6.
    Cooper, K., Kennedy, K.: Efficient computation of flow-insensitive interprocedural summary information (a correction). Technical report TR87-60, Rice University (1987)Google Scholar
  7. 7.
    Cooper, K.D., Kennedy, K.: Interprocedural side-effect analysis in linear time. In: Proceedings of ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation, Atlanta, GA, pp. 57–66, June 1988Google Scholar
  8. 8.
    CUDA toolkit documentation. http://docs.nvidia.com/cuda/
  9. 9.
    Farber, R. (ed.): Parallel Programming with OpenACC. Morgan Kaufmann, Boston (2017)Google Scholar
  10. 10.
    Hall, M., Kennedy, K.: Efficient call graph analysis. Lett. Program. Lang. Syst. 1(3), 227–242 (1992)CrossRefGoogle Scholar
  11. 11.
    Nickolls, J., Buck, I., Garland, M., Skadron, K.: Scalable parallel programming with CUDA. ACM Queue 6(2), 40–53 (2008)CrossRefGoogle Scholar
  12. 12.
    The OpenACC application programming interface, version 2.6, November 2017. https://www.openacc.org/
  13. 13.
  14. 14.
    The OpenMP application programming interface, version 4.5, November 2015. https://www.openmp.org/
  15. 15.
    Ruetsch, G., Fatica, M.: CUDA Fortran for Scientists and Engineers. Morgan Kaufmann, San Francisco (2013)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.University of CaliforniaIrvineUSA
  2. 2.NVIDIA/PGIHillsboroUSA

Personalised recommendations