Advertisement

Embedding Foreign Code

  • Robert Clifton-Everest
  • Trevor L. McDonell
  • Manuel M. T. Chakravarty
  • Gabriele Keller
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8324)

Abstract

Special purpose embedded languages facilitate generating high-performance code from purely functional high-level code; for example, we want to program highly parallel GPUs without the usual high barrier to entry and the time-consuming development process. We previously demonstrated the feasibility of a skeleton-based, generative approach to compiling such embedded languages.

In this paper, we (a) describe our solution to some of the practical problems with skeleton-based code generation and (b) introduce our approach to enabling interoperability with native code. In particular, we show, in the context of a functional embedded language for GPU programming, how template meta programming simplifies code generation and optimisation. Furthermore, we present our design for a foreign function interface for an embedded language.

Keywords

Abstract Syntax Tree Input Array Dead Code CUDA Code Accelerate Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bjesse, P., Claessen, K., Sheeran, M., Singh, S.: Lava: hardware design in Haskell. In: Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming. ACM (1998)Google Scholar
  2. 2.
    Chakravarty, M.M.T., Keller, G., Lee, S., McDonell, T.L., Grover, V.: Accelerating Haskell array codes with multicore GPUs. In: DAMP: Declarative Aspects of Multicore Programming. ACM (2011)Google Scholar
  3. 3.
    Chatterjee, S., Prins, J.: COMP663: Parallel Computing Algorithms. Department of Computer Science, University of North Carolina at Chapel Hill (2009)Google Scholar
  4. 4.
    Claessen, K., Sheeran, M., Svensson, B.J.: Expressive array constructs in an embedded GPU kernel programming language. In: DAMP: Declarative Aspects and Applications of Multicore Programming. ACM (2012)Google Scholar
  5. 5.
    Claessen, K., Sheeran, M., Svensson, J.: Obsidian: GPU programming in Haskell. In: IFL: Implementation and Application of Functional Languages (2008)Google Scholar
  6. 6.
    Cole, M.I.: Algorithmic Skeletons: Structured Management of Parallel Computation. The MIT Press (1989)Google Scholar
  7. 7.
    Collins, A., Grewe, D., Grover, V., Lee, S., Susnea, A.: Nova: A functional language for data parallelism. Tech. rep., NVIDIA (2013)Google Scholar
  8. 8.
    Cooley, J.W., Tukey, J.W.: An algorithm for the machine calculation of complex Fourier series. Mathematics of Computation (90) (1965)Google Scholar
  9. 9.
    Frigo, M., Johnson, S.G.: The design and implementation of FFTW3. Proceedings of the IEEE 93(2), 216–231 (2005); Special issue on “Program Generation, Optimization, and Platform Adaptation” Google Scholar
  10. 10.
    Gill, A., Bull, T., Kimmell, G., Perrins, E., Komp, E., Werling, B.: Introducing Kansas Lava. In: Morazán, M.T., Scholz, S.-B. (eds.) IFL 2009. LNCS, vol. 6041, pp. 18–35. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  11. 11.
    Mainland, G.: Why it’s nice to be quoted. In: Haskell Symposium, p. 73. ACM Press, New York (2007)Google Scholar
  12. 12.
    Mainland, G., Morrisett, G.: Nikola: Embedding compiled GPU functions in Haskell. In: Haskell Symposium. ACM (2010)Google Scholar
  13. 13.
    McDonell, T.L., Chakravarty, M.M.T., Keller, G., Lippmeier, B.: Optimising Purely Functional GPU Programs. In: ICFP: International Conference on Functional Programming (September 2013)Google Scholar
  14. 14.
    NVIDIA: CUDA C Programming Guide (2012)Google Scholar
  15. 15.
    NVIDIA: CUBLAS Library (2013)Google Scholar
  16. 16.
    NVIDIA: CUFFT Library (2013)Google Scholar
  17. 17.
    Rafler, S.: Generalization of Conway’s “Game of Life” to a continuous domain–SmoothLife (2011)Google Scholar
  18. 18.
    Ragan-Kelley, J., Barnes, C., Adams, A., Paris, S., Durand, F., Amarasinghe, S.: Halide: a language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines. In: PLDI 2013. ACM (2013)Google Scholar
  19. 19.
    Rompf, T., Sujeeth, A.K., Amin, N., Brown, K.J., Jovanovic, V., Lee, H., Odersky, M., Olukotun, K.: Optimizing data structures in high-level programs: New directions for extensible compilers based on staging. In: POPL 2013. ACM (2013)Google Scholar
  20. 20.
    Sengupta, S., Harris, M., Zhang, Y., Owens, J.D.: Scan primitives for GPU computing. In: Symposium on Graphics Hardware. Eurographics Association (2007)Google Scholar
  21. 21.
    Sheard, T., Peyton Jones, S.: Template meta-programming for Haskell. In: Proceedings of the 2002 ACM SIGPLAN Workshop on Haskell, pp. 1–16. ACM (2002)Google Scholar
  22. 22.
    Thies, W., Karczmarek, M., Amarasinghe, S.: StreamIt: A language for streaming applications. In: Nigel Horspool, R. (ed.) CC 2002. LNCS, vol. 2304, pp. 179–196. Springer, Heidelberg (2002)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Robert Clifton-Everest
    • 1
  • Trevor L. McDonell
    • 1
  • Manuel M. T. Chakravarty
    • 1
  • Gabriele Keller
    • 1
  1. 1.School of Computer Science and EngineeringUniversity of New South WalesAustralia

Personalised recommendations