skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

Static interpretation of higher-order modules in Futhark: functional GPU programming in the large

Published:30 July 2018Publication History
Skip Abstract Section

Abstract

We present a higher-order module system for the purely functional data-parallel array language Futhark. The module language has the property that it is completely eliminated at compile time, yet it serves as a powerful tool for organizing libraries and complete programs. The presentation includes a static and a dynamic semantics for the language in terms of, respectively, a static type system and a provably terminating elaboration of terms into terms of an underlying target language. The development is formalised in Coq using a novel encoding of semantic objects based on products, sets, and finite maps. The module language features a unified treatment of module type abstraction and core language polymorphism and is rich enough for expressing practical forms of module composition.

Skip Supplemental Material Section

Supplemental Material

a97-elsman.webm

References

  1. Andreas Abel. 2008. Normalization for the Simply-Typed Lambda-Calculus in Twelf. Electron. Notes Theor. Comput. Sci. 199 (Feb. 2008), 3–16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Christian Andreetta, Vivien Bégot, Jost Berthold, Martin Elsman, Fritz Henglein, Troels Henriksen, Maj-Britt Nordfang, and Cosmin E. Oancea. 2016. FinPar: A Parallel Financial Benchmark. ACM Trans. Archit. Code Optim. 13, 2, Article 18 (June 2016), 27 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Danil Annenkov and Martin Elsman. 2018. Certified Compilation of Financial Contracts. In Proceedings of the 20th International Symposium on Principles and Practice of Declarative Programming (PPDP ’18). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Brian Aydemir, Aaron Bohannon, and Stephanie Weirich. 2007. Nominal Reasoning Techniques in Coq. Electron. Notes Theor. Comput. Sci. 174, 5 (June 2007), 69–77. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Nick Benton, Chung-Kil Hur, Andrew Kennedy, and Conor McBride. 2012. Strongly Typed Term Representations in Coq. J. Autom. Reasoning 49, 2 (2012), 141–159. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Guy E. Blelloch. 1989. Scans as Primitive Parallel Operations. Computers, IEEE Transactions 38, 11 (1989), 1526–1538. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Guy E Blelloch. 1990. Vector models for data-parallel computing. Vol. 75. MIT press Cambridge. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Manuel MT Chakravarty, Gabriele Keller, Sean Lee, Trevor L McDonell, and Vinod Grover. 2011. Accelerating Haskell array codes with multicore GP Us. In Proceedings of the Sixth Workshop on Declarative Aspects of Multicore Programming (DAMP ’11). ACM, 3–14. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Adam Chlipala. 2013. Certified Programming with Dependent Types: A Pragmatic Introduction to the Coq Proof Assistant. MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Koen Claessen, Mary Sheeran, and Bo Joel Svensson. 2012. Expressive Array Constructs in an Embedded GP U Kernel Programming Language. In Work. on Decl. Aspects of Multicore Prog DAMP. 21–30. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Ranald Clouston. 2013. Generalised Name Abstraction for Nominal Sets. In Foundations of Software Science and Computation Structures, Frank Pfenning (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 434–449. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Karl Crary. 2017. Modules, Abstraction, and Parametric Polymorphism. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). ACM, New York, NY, USA, 100–113. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Kevin Donnelly and Hongwei Xi. 2007. A Formalization of Strong Normalization for Simply-Typed Lambda-Calculus and System F. Electron. Notes Theor. Comput. Sci. 174, 5 (June 2007), 109–125. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Derek Dreyer, Robert Harper, Manuel M. T. Chakravarty, and Gabriele Keller. 2007. Modular Type Classes. In Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’07). ACM, New York, NY, USA, 63–70. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Martin Elsman. 1999. Static Interpretation of Modules. In Procedings of Fourth International Conference on Functional Programming (ICFP ’99). ACM Press, 208–219. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Martin Elsman and Martin Dybdal. 2014. Compiling a Subset of APL Into a Typed Intermediate Language. In Procs. Int. Workshop on Lib. Lang. and Compilers for Array Prog. (ARRAY). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Matthew Fluet and Stephen Weeks. 2001. Contification Using Dominators. In Proceedings of the Sixth ACM SIGPLAN International Conference on Functional Programming (ICFP ’01). ACM, New York, NY, USA, 2–13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Murdoch J. Gabbay and Andrew M. Pitts. 2002. A New Approach to Abstract Syntax with Variable Binding. Formal Aspects of Computing 13, 3 (01 Jul 2002), 341–363. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Jean Yves Girard. 1971. Interpretation Fonctionnelle et Elimination des Coupures de l’Arithmetique d’Ordre Superieur. In Proceedings of the Second Scandinavian Logic Symposium. North-Holland, 63–92.Google ScholarGoogle Scholar
  20. Jing Guo, Jeyarajan Thiyagalingam, and Sven-Bodo Scholz. 2011. Breaking the GP U Programming Barrier with the Autoparallelising SAC Compiler. In Proceedings of the Sixth Workshop on Declarative Aspects of Multicore Programming (DAMP ’11). ACM, New York, NY, USA, 15–24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Robert Harper and Mark Lillibridge. 1994. A Type-Theoretic Approach to Higher-Order Modules with Sharing. In Proceedings of the 21 ACM SIGPLAN Symposium on Principles of Programming Languages (POPL ’94). Portland, OR, 123–137. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Robert Harper, John C. Mitchell, and Eugenio Moggi. 1990. Higher-order Modules and the Phase Distinction. In Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’90). ACM, New York, NY, USA, 341–354. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Robert Harper and Christopher Stone. 2000. Proof, Language, and Interaction. MIT Press, Cambridge, MA, USA, Chapter A Type-theoretic Interpretation of Standard ML, 341–387. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Troels Henriksen, Martin Dybdal, Henrik Urms, Anna Sofie Kiehn, Daniel Gavin, Hjalte Abelskov, Martin Elsman, and Cosmin Oancea. 2016a. APL on GP Us: A TAIL from the Past, Scribbled in Futhark. In Procs. of the 5th Int. Workshop on Functional High-Performance Computing (FHPC ’16). ACM, New York, NY, USA, 38–43. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Troels Henriksen, Martin Elsman, and Cosmin E Oancea. 2014. Size slicing: a hybrid approach to size inference in Futhark. In Proceedings of the 3rd ACM SIGPLAN workshop on Functional high-performance computing. ACM, 31–42. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Troels Henriksen, Ken Friis Larsen, and Cosmin E. Oancea. 2016b. Design and GPGP U Performance of Futhark’s Redomap Construct. In Proceedings of the 3rd ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming (ARRAY 2016). ACM, New York, NY, USA, 17–24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Troels Henriksen and Cosmin E Oancea. 2014. Bounds checking: An instance of hybrid analysis. In Proceedings of ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array Programming. ACM, 88. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Troels Henriksen, Niels G. W. Serup, Martin Elsman, Fritz Henglein, and Cosmin E. Oancea. 2017. Futhark: Purely Functional GP U-programming with Nested Parallelism and In-place Array Updates. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, New York, NY, USA, 556–571. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Anders Kiel Hovgaard. 2018. Higher-Order Functions for a High-Performance Programming Language for GPUs. Master’s thesis. Department of Computer Science, University of Copenhagen, Universitetsparken 5, DK-2100, Denmark.Google ScholarGoogle Scholar
  30. Kenneth E. Iverson. 1962. A Programming Language. John Wiley and Sons, Inc. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Stephen Joe and Frances Y. Kuo. 2003. Remark on Algorithm 659: Implementing Sobol’s Quasirandom Sequence Generator. ACM Trans. Math. Softw. 29, 1 (March 2003), 49–57. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Thomas Johnsson. 1985. Lambda Lifting: Transforming Programs to Recursive Equations. In Proceedings of the international conference on Functional Programming Languages and Computer Architecture. Springer-Verlag New York, Inc., New York, NY, USA, 190–203. http://dl.acm.org/citation.cfm?id=5280.5292 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Rasmus Wriedt Larsen and Troels Henriksen. 2017. Strategies for Regular Segmented Reductions on GP U. In Proceedings of the 6th ACM SIGPLAN International Workshop on Functional High-Performance Computing (FHPC 2017). ACM, New York, NY, USA, 42–52. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Daniel K. Lee, Karl Crary, and Robert Harper. 2007. Towards a Mechanized Metatheory of Standard ML. In Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’07). ACM, New York, NY, USA, 173–184. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Xavier Leroy. 1995. Applicative Functors and Fully Transparent Higher-order Modules. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’95). ACM, New York, NY, USA, 142–153. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Xavier Leroy. 2000. A Modular Module System. Journal of Functional Programming 10, 3 (May 2000), 269–303. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Geoffrey Mainland and Greg Morrisett. 2010. Nikola: Embedding Compiled GP U Functions in Haskell. In Proceedings of the Third ACM Haskell Symposium on Haskell (Haskell ’10). ACM, New York, NY, USA, 67–78. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Trevor L. McDonell, Manuel MT Chakravarty, Gabriele Keller, and Ben Lippmeier. 2013. Optimising Purely Functional GP U Programs. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP ’13). Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. 1997. The Definition of Standard ML (Revised). MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Shayan Najd, Sam Lindley, Josef Svenningsson, and Philip Wadler. 2016. Everything Old is New Again: Quoted Domainspecific Languages. In Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM ’16). ACM, New York, NY, USA, 25–36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Nathaniel Nystrom, Derek White, and Kishen Das. 2011. Firepile: Run-time Compilation for GP Us in Scala. In Proceedings of the 10th ACM International Conference on Generative Programming and Component Engineering (GPCE ’11). ACM, New York, NY, USA, 107–116. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Simon Peyton Jones, Jean-Marc Eber, and Julian Seward. 2000. Composing Contracts: an Adventure in Financial Engineering (functional pearl). In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP ’00). ACM, 280–292. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Benjamin C. Pierce, Arthur Azevedo de Amorim, Chris Casinghino, Marco Gaboardi, Michael Greenberg, C ˇ at ˇ alin Hriţcu, Vilhelm Sjöberg, and Brent Yorgey. 2016. Software Foundations. Electronic textbook. Version 4.0. http://www.cis.upenn. edu/~bcpierce/sf .Google ScholarGoogle Scholar
  44. Andrew M. Pitts. 2013. Nominal Sets: Names and Symmetry in Computer Science. Cambridge University Press, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Norman Ramsey, Kathleen Fisher, and Paul Govereau. 2005. An Expressive Language of Signatures. In Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming (ICFP ’05). ACM, New York, NY, USA, 27–40. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. John C. Reynolds. 1995. Using Functor Categories to Generate Intermediate Code. In Proceedings of the 22Nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’95). ACM, New York, NY, USA, 25–36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Andreas Rossberg and Derek Dreyer. 2013. Mixin’ Up the ML Module System. ACM Transactions on Programming Languages and Systems 35, 1, Article 2 (April 2013), 2:1–2:84 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Andreas Rossberg, Claudio V. Russo, and Derek Dreyer. 2014. F-ing modules. Journal of Functional Programming 24, 5 (2014), 529–607.Google ScholarGoogle ScholarCross RefCross Ref
  49. Claudio V. Russo. 1999. Non-dependent Types for Standard ML Modules. In Proceedings of the International Conference PPDP’99 on Principles and Practice of Declarative Programming (PPDP ’99). Springer-Verlag, London, UK, UK, 80–97. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Zhong Shao. 1999. Transparent Modules with Fully Syntatic Signatures. In Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Programming (ICFP ’99). ACM, New York, NY, USA, 220–232. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Zhong Shao and Andrew W. Appel. 1993. Smartest Recompilation. In Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’93). ACM, New York, NY, USA, 439–450. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Michel Steuwer, Christian Fensch, Sam Lindley, and Christophe Dubach. 2015. Generating Performance Portable Code Using Rewrite Rules: From High-level Functional Expressions to High-performance OpenCL Code. SIGPLAN Not. 50, 9 (Aug. 2015), 205–217.Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Michel Steuwer, Toomas Remmelg, and Christophe Dubach. 2017. Lift: A Functional Data-parallel IR for High-performance GP U Code Generation. In Proceedings of the 2017 International Symposium on Code Generation and Optimization (CGO 2017). IEEE Press, Piscataway, NJ, USA, 74–85. Google ScholarGoogle ScholarCross RefCross Ref
  54. Joel Svensson. 2011. Obsidian: GPU Kernel Programming in Haskell. Ph.D. Dissertation. Chalmers University of Technology.Google ScholarGoogle Scholar
  55. David Swasey, Tom Murphy VII, Karl Crary, and Robert Harper. 2006. A Separate Compilation Extension to Standard ML. In Proceedings of the ACM SIGPLAN Workshop on ML (ML ’06). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Walid Taha and Tim Sheard. 2000. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248, 1 (2000), 211 – 242. PEPM’97. Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. William W. Tait. 1967. Intensional interpretations of functionals of finite type. Journal of symbolic logic 32 (1967), 198–212.Google ScholarGoogle Scholar
  58. Yong Kiam Tan, Magnus O. Myreen, Ramana Kumar, Anthony Fox, Scott Owens, and Michael Norrish. 2016. A New Verified Compiler Backend for CakeML. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016). ACM, New York, NY, USA, 60–73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  59. Todd L. Veldhuizen. 1999. C++ Templates as Partial Evaluation. In Proceedings of the 1999 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation. 13–18. Technical report BRICS-NS-99-1.Google ScholarGoogle Scholar
  60. P. Wadler. 1987. Views: A Way for Pattern Matching to Cohabit with Data Abstraction. In Proceedings of the 14th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL ’87). ACM, New York, NY, USA, 307–313. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. P. Wadler and S. Blott. 1989. How to Make Ad-hoc Polymorphism Less Ad Hoc. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’89). ACM, New York, NY, USA, 60–76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. Leo White, Frédéric Bour, and Jeremy Yallop. 2015. Modular implicits. EPTCS 198, 2 (December 2015), 22–63. In Proceedings of ML/OCaml Workshop 2014. arXiv:1512.01438.Google ScholarGoogle Scholar

Index Terms

  1. Static interpretation of higher-order modules in Futhark: functional GPU programming in the large

            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

            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!