ABSTRACT
We show how to compile high-level functional array-processing programs, drawn from image processing and machine learning, into C code that runs as fast as hand-written C. The key idea is to transform the program to destination-passing style, which in turn enables a highly-efficient stack-like memory allocation discipline.
- Johan Anker and Josef Svenningsson. 2013. An EDSL approach to high performance Haskell programming. In ACM Haskell Symposium. 1–12. Google ScholarDigital Library
- Henry G Baker. 1992. Lively linear lisp: ‘look ma, no garbage!’. ACM Sigplan notices 27, 8 (1992), 89–98. Google ScholarDigital Library
- Lars Birkedal, Mads Tofte, and Magnus Vejlstrup. 1996. From Region Inference to Von Neumann Machines via Region Representation Inference (POPL ’96). ACM, NY, USA, 171–183. Google ScholarDigital Library
- Charisee Chiw, Gordon Kindlmann, John Reppy, Lamont Samuels, and Nick Seltzer. 2012. Diderot: A Parallel DSL for Image Analysis and Visualization (PLDI ’12). ACM, 111–120. Google ScholarDigital Library
- Koen Claessen, Mary Sheeran, and Bo Joel Svensson. 2012. Expressive Array Constructs in an Embedded GPU Kernel Programming Language (DAMP ’12). ACM, NY, USA, 21–30. Google ScholarDigital Library
- Duncan Coutts, Roman Leshchinskiy, and Don Stewart. Stream Fusion. From Lists to Streams to Nothing at All (ICFP ’07). Google ScholarDigital Library
- Cormac Flanagan, Amr Sabry, Bruce F Duba, and Matthias Felleisen. 1993. The essence of compiling with continuations. In ACM Sigplan Notices, Vol. 28. ACM, 237–247. Google ScholarDigital Library
- Matthew Fluet, Greg Morrisett, and Amal Ahmed. 2006. Linear regions are all you need (ESOP ’06). Springer, 7–21. Google ScholarDigital Library
- D Friedman and S Wise. 1975. Unwinding stylized recursions into iterations. Comput. Sci. Dep., Indiana University, Bloomington, IN, Tech. Rep 19 (1975).Google Scholar
- Andrew Gill, John Launchbury, and Simon L Peyton Jones. 1993. A short cut to deforestation (FPCA). ACM, 223–232. Google ScholarDigital Library
- Clemens Grelck and Sven-Bodo Scholz. 2006. SAC—A Functional Array Language for Efficient Multi-threaded Execution. Int. Journal of Parallel Programming 34, 4 (2006), 383–427. Google ScholarDigital Library
- Dan Grossman, Greg Morrisett, Trevor Jim, Michael Hicks, Yanling Wang, and James Cheney. 2002. Region-based Memory Management in Cyclone (PLDI ’02). ACM, NY, USA, 282–293. Google ScholarDigital Library
- Gaël Guennebaud, Benoit Jacob, and others. 2010. Eigen. URl: http://eigen. tuxfamily. org (2010).Google Scholar
- Niels Hallenberg, Martin Elsman, and Mads Tofte. 2002. Combining Region Inference and Garbage Collection (PLDI ’02). ACM, NY, USA, 141–152. Google ScholarDigital Library
- Troels Henriksen, Martin Elsman, and Cosmin E. Oancea. 2014. Size Slicing: A Hybrid Approach to Size Inference in Futhark (FHPC ’14). ACM, New York, NY, USA, 31–42. Google ScholarDigital Library
- Troels Henriksen and Cosmin E. Oancea. 2014. Bounds Checking: An Instance of Hybrid Analysis (ARRAY ’14). ACM, NY, USA.Google Scholar
- Troels Henriksen, Niels G. W. Serup, Martin Elsman, Fritz Henglein, and Cosmin E. Oancea. 2017. Futhark: Purely Functional GPU-programming with Nested Parallelism and In-place Array Updates (PLDI 2017). ACM, New York, NY, USA, 556–571. Google ScholarDigital Library
- Martin Hofmann and Steffen Jost. 2003. Static Prediction of Heap Space Usage for First-order Functional Programs (POPL ’03). ACM, New York, NY, USA, 185–197. Google ScholarDigital Library
- Kenneth E Iverson. 1962. A Programming Language. In Proceedings of the May 1-3, 1962, spring joint computer conference. ACM, 345–351. Google ScholarDigital Library
- C Barry Jay. 1999. Programming in FISh. International Journal on Software Tools for Technology Transfer 2, 3 (1999), 307–315.Google ScholarCross Ref
- C. Barry Jay and Milan Sekanina. 1997. Shape Checking of Array Programs. Technical Report. In Computing: the Australasian Theory Seminar, Proceedings.Google Scholar
- Oleg Kiselyov and Chung-chieh Shan. 2008. Lightweight monadic regions. In ACM Sigplan Notices, Vol. 44. ACM, 1–12. Google ScholarDigital Library
- James R Larus. 1989. Restructuring symbolic programs for concurrent execution on multiprocessors. Ph.D. Dissertation. Google ScholarDigital Library
- Yasuhiko Minamide. 1998. A Functional Representation of Data Structures with a Hole (POPL ’98). 75–84. Google ScholarDigital Library
- Manuel Montenegro, Ricardo Peña, and Clara Segura. 2008. A type system for safe memory management and its proof of correctness (PPDP ’08). ACM, 152–162. Google ScholarDigital Library
- Manuel Montenegro, Ricardo Peña, and Clara Segura. 2009. A simple region inference algorithm for a first-order functional language. In International Workshop on Functional and Constraint Logic Programming. Springer, 145–161. Google ScholarDigital Library
- Markus Puschel, José MF Moura, Jeremy R Johnson, David Padua, Manuela M Veloso, Bryan W Singer, Jianxin Xiong, Franz Franchetti, Aca Gacic, Yevgen Voronenko, and others. 2005. SPIRAL: Code generation for DSP transforms. Proc. IEEE 93, 2 (2005), 232–275.Google ScholarCross Ref
- Jonathan Ragan-Kelley, Connelly Barnes, Andrew Adams, Sylvain Paris, Frédo Durand, and Saman Amarasinghe. 2013. Halide: A Language and Compiler for Optimizing Parallelism, Locality, and Recomputation in Image Processing Pipelines (PLDI ’13). Google ScholarDigital Library
- Daniele G Spampinato and Markus Püschel. A basic linear algebra compiler for structured matrices. In CGO ’16. ACM. Google ScholarDigital Library
- Filip Srajer, Zuzana Kukelova, and Andrew Fitzgibbon. 2016. A Benchmark of Selected Algorithmic Differentiation Tools on Some Problems in Machine Learning and Computer Vision. (2016).Google Scholar
- Arvind Sujeeth, HyoukJoong Lee, Kevin Brown, Tiark Rompf, Hassan Chafi, Michael Wu, Anand Atreya, Martin Odersky, and Kunle Olukotun. 2011. OptiML: An Implicitly Parallel Domain-Specific Language for Machine Learning (ICML ’11). 609–616. Google ScholarDigital Library
- Josef Svenningsson. 2002. Shortcut Fusion for Accumulating Parameters & Zip-like Functions (ICFP ’02). ACM, 124–132. Google ScholarDigital Library
- Bo Joel Svensson and Josef Svenningsson. 2014. Defunctionalizing Push Arrays (FHPC ’14). ACM, NY, USA, 43–52.Google Scholar
- Don Syme. 2006. Leveraging .NET Meta-programming Components from F#: Integrated Queries and Interoperable Heterogeneous Execution (ML ’06). ACM, 43–54. Google ScholarDigital Library
- Jonathan Taylor, Richard Stebbing, Varun Ramakrishna, Cem Keskin, Jamie Shotton, Shahram Izadi, Aaron Hertzmann, and Andrew Fitzgibbon. 2014. Userspecific hand modeling from monocular depth sequences (CVPR ’14). 644–651. Google ScholarDigital Library
- Mads Tofte, Lars Birkedal, Martin Elsman, and Niels Hallenberg. 2004. A Retrospective on Region-Based Memory Management. Higher Order Symbol. Comput. 17, 3 (Sept. 2004), 245–265. Google ScholarDigital Library
- Mads Tofte and Jean-Pierre Talpin. 1997. Region-Based Memory Management. Information and Computation 132, 2 (1997). Google ScholarDigital Library
- Bill Triggs, Philip F McLauchlan, Richard I Hartley, and Andrew W Fitzgibbon. 1999. Bundle adjustment—a modern synthesis. In Inter. workshop on vision algorithms. Springer, 298–372. Google ScholarDigital Library
- Pedro B Vasconcelos. 2008. Space cost analysis using sized types. Ph.D. Dissertation. University of St Andrews.Google Scholar
- Philip Wadler. 1984. Listlessness is better than laziness: Lazy evaluation and garbage collection at compile-time. In Proc. of ACM Symp. on LISP and functional programming. 45–52. Google ScholarDigital Library
- Philip Wadler. 1988. Deforestation: Transforming programs to eliminate trees. In ESOP’88. Springer, 344–358. Google ScholarDigital Library
- Philip Wadler. 1990. Linear types can change the world. In IFIP TC, Vol. 2. Citeseer, 347–359.Google Scholar
- David Walker and Greg Morrisett. 2000. Alias types for recursive data structures. In Inter. Workshop on Types in Compilation. Springer, 177–206. Google ScholarDigital Library
Index Terms
- Destination-passing style for efficient memory management
Recommendations
From functional to imperative: combining destination-passing style and views
ARRAY 2022: Proceedings of the 8th ACM SIGPLAN International Workshop on Libraries, Languages and Compilers for Array ProgrammingProgramming in low-level imperative languages provides good performance but is error-prone. On the other hand, functional programs are usually free from low-level errors but performance suffers from costly programming abstractions. Compiling high-...
Exploiting Implicit Parallelism in Dynamic Array Programming Languages
ARRAY'14: Proceedings of ACM SIGPLAN International Workshop on Libraries, Languages, and Compilers for Array ProgrammingWe have built an interpreter for the array programming language J. The interpreter exploits implicit data parallelism in the language to achieve good parallel speedups on a variety of benchmark applications.
Many array programming languages operate on ...
An EDSL approach to high performance Haskell programming
Haskell '13: Proceedings of the 2013 ACM SIGPLAN symposium on HaskellThis paper argues for a new methodology for writing high performance Haskell programs by using Embedded Domain Specific Languages.
We exemplify the methodology by describing a complete library, meta-repa, which is a reimplementation of parts of the repa ...
Comments