ABSTRACT
High-performance computing applications, such as auto-tuners and domain-specific languages, rely on generative programming techniques to achieve high performance and portability. However, these systems are often implemented in multiple disparate languages and perform code generation in a separate process from program execution, making certain optimizations difficult to engineer. We leverage a popular scripting language, Lua, to stage the execution of a novel low-level language, Terra. Users can implement optimizations in the high-level language, and use built-in constructs to generate and execute high-performance Terra code. To simplify meta-programming, Lua and Terra share the same lexical environment, but, to ensure performance, Terra code can execute independently of Lua's runtime. We evaluate our design by reimplementing existing multi-language systems entirely in Terra. Our Terra-based auto-tuner for BLAS routines performs within 20% of ATLAS, and our DSL for stencil computations runs 2.3x faster than hand-written C.
- The LuaJIT project. http://http://luajit.org/.Google Scholar
- A. Bawden and J. Rees. Syntactic closures. In LFP, 1988. Google ScholarDigital Library
- S. Behnel, R. Bradshaw, C. Citro, L. Dalcin, D. S. Seljebotn, and K. Smith. Cython: The best of both worlds. Computing in Science and Engineering, 13.2:31--39, 2011. Google ScholarDigital Library
- K. J. Brown, A. K. Sujeeth, H. J. Lee, T. Rompf, H. Chafi,M. Odersky, and K. Olukotun. A heterogeneous parallel framework for domainspecific languages. In PACT, 2011. Google ScholarDigital Library
- J. Carette. Gaussian elimination: A case study in efficient genericity with MetaOCaml. Sci. Comput. Program., 62(1):3--24, Sept. 2006. Google ScholarDigital Library
- B. Catanzaro, M. Garland, and K. Keutzer. Copperhead: Compiling an embedded data parallel language. In PPoPP, 2011. Google ScholarDigital Library
- H. Chafi, A. K. Sujeeth, K. J. Brown, H. Lee, A. R. Atreya, and K. Olukotun. A domain-specific approach to heterogeneous parallelism. In PPoPP, 2011. Google ScholarDigital Library
- A. Cohen, S. Donadio, M. Garzaran, C. Herrmann, and D. Padua. In search of a program generator to implement generic transformations for high-performance computing. In MetaOCaml Workshop, 2004.Google Scholar
- Z. DeVito, N. Joubert, F. Palacios, S. Oakley, M. Medina, M. Barrientos, E. Elsen, F. Ham, A. Aiken, K. Duraisamy, E. Darve, J. Alonso, and P. Hanrahan. Liszt: A domain specific language for building portable mesh-based PDE solvers. In SC, 2011. Google ScholarDigital Library
- J. Eckhardt, R. Kaiabachev, E. Pasalic, K. Swadi, and W. Taha. Implicitly heterogeneous multi-stage programming. New Gen. Comput., 25(3):305--336, Jan. 2007. Google ScholarDigital Library
- M. Flatt. Composable and compilable macros: You want it when? In ICFP, 2002. Google ScholarDigital Library
- M. Frigo and S. Johnson. The design and implementation of FFTW3. Proc. of the IEEE, 93(2):216--231, 2005.Google ScholarCross Ref
- R. Garcia and A. Lumsdaine. Toward foundations for type-reflective metaprogramming. In GPCE, 2009. Google ScholarDigital Library
- R. Ierusalimschy, L. H. de Figueiredo, and W. C. Filho. Lua - an extensible extension language. Software: Practice and Experience, 26, 1996. Google ScholarDigital Library
- R. Ierusalimschy, L. H. De Figueiredo, and W. Celes. Passing a language through the eye of a needle. CACM, 54(7):38--43, 2011. Google ScholarDigital Library
- S. Jones, T. Nordin, and D. Oliva. C--: A portable assembly language.In Workshop on Implementing Functional Languages, 1997. Google ScholarDigital Library
- C. Lattner and V. Adve. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In CGO, 2004. Google ScholarDigital Library
- G. Mainland. Explicitly heterogeneous metaprogramming with metahaskell. In ICFP, 2012. Google ScholarDigital Library
- R. Meyers. X macros. C/C++ Users J., 19(5):52--56, May 2001. Google ScholarDigital Library
- G. Neverov and P. Roe. Metaphor: A multi-staged, object-oriented programming language. In GPCE, 2004.Google ScholarCross Ref
- C. Newburn, B. So, Z. Liu, M. McCool, A. Ghuloum, S. Toit, Z. G. Wang, Z. H. Du, Y. Chen, G. Wu, P. Guo, Z. Liu, and D. Zhang. Intel's Array Building Blocks: A retargetable, dynamic compiler and embedded language. In CGO, 2011. Google ScholarDigital Library
- M. Poletto,W. C. Hsieh, D. R. Engler, and M. F. Kaashoek. C and tcc: A language and compiler for dynamic code generation. TOPLAS, 21 :1999. Google ScholarDigital Library
- M. Püschel, J. M. F. Moura, B. Singer, J. Xiong, J. Johnson, D. Padua, M. Veloso, and R. W. Johnson. Spiral: A generator for platformadapted libraries of signal processing algorithms. Int. J. High Perform. Comput. Appl., 18(1):2004. Google ScholarDigital Library
- J. Ragan-Kelley, A. Adams, S. Paris, M. Levoy, S. Amarasinghe, and F. Durand. Decoupling algorithms from schedules for easy optimization of image processing pipelines. In SIGGRAPH, 2012. Google ScholarDigital Library
- T. Rompf and M. Odersky. Lightweight modular staging: A pragmatic approach to runtime code generation and compiled DSLs. In GPCE, 2010. Google ScholarDigital Library
- J. Stam. Real-time fluid dynamics for games. In GDC, 2003.Google Scholar
- B. Stroustrup. Multiple inheritance for C++. In European Unix Systems Users's Group Conference, 1987.Google Scholar
- D. Syme, K. Battocchi, K. Takeda, D.Malayeri, J. Fisher, J. Hu, T. Liu, B. McNamara, D. Quirk, M. Taveggia, W. Chae, U. Matsveyeu, and T. Petricek. F#3.0 -- Strongly-typed language support for internet-scale information sources. Technical report, 2012.Google Scholar
- W. Taha. A gentle introduction to multi-stage programming. In Domain-Specific Program Generation, 2004.Google ScholarCross Ref
- W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. In Theoretical Computer Science, 1999. Google ScholarDigital Library
- S. Tobin-Hochstadt, V. St-Amour, R. Culpepper, M. Flatt, and M. Felleisen. Languages as libraries. In PLDI, 2011. Google ScholarDigital Library
- Z. Wan, W. Taha, and P. Hudak. Real-time FRP. In ICFP, 2001. Google ScholarDigital Library
- R. C. Whaley and A. Petitet. Minimizing development and maintenance costs in supporting persistently optimized BLAS. Softw. Pract. Exper., 35(2):101--121, 2005. Google ScholarDigital Library
Index Terms
- Terra: a multi-stage language for high-performance computing
Recommendations
Terra: a multi-stage language for high-performance computing
PLDI '13High-performance computing applications, such as auto-tuners and domain-specific languages, rely on generative programming techniques to achieve high performance and portability. However, these systems are often implemented in multiple disparate ...
First-class runtime generation of high-performance types using exotypes
PLDI '14: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and ImplementationWe introduce exotypes, user-defined types that combine the flexibility of meta-object protocols in dynamically-typed languages with the performance control of low-level languages. Like objects in dynamic languages, exotypes are defined programmatically ...
First-class runtime generation of high-performance types using exotypes
PLDI '14We introduce exotypes, user-defined types that combine the flexibility of meta-object protocols in dynamically-typed languages with the performance control of low-level languages. Like objects in dynamic languages, exotypes are defined programmatically ...
Comments