skip to main content
research-article

Shallow embedding of DSLs via online partial evaluation

Published:26 October 2015Publication History
Skip Abstract Section

Abstract

This paper investigates shallow embedding of DSLs by means of online partial evaluation. To this end, we present a novel online partial evaluator for continuation-passing style languages. We argue that it has, in contrast to prior work, a predictable termination policy that works well in practice. We present our approach formally using a continuation-passing variant of PCF and prove its termination properties. We evaluate our technique experimentally in the field of visual and high-performance computing and show that our evaluator produces highly specialized and efficient code for CPUs as well as GPUs that matches the performance of hand-tuned expert code.

References

  1. L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, University of Copenhagen, 1994.Google ScholarGoogle Scholar
  2. L. Birkedal and M. Welinder. Hand-writing program generator generators. In PLILP, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. A. Bondorf and J. Jørgensen. E fficient analyses for realistic off-line partial evaluation. JFP, 1993.Google ScholarGoogle Scholar
  4. W. L. Briggs, H. Van Emden, and S. F. McCormick. A Multigrid Tutorial, volume 2. SIAM, June 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. K. J. Brown, A. K. Sujeeth, H. J. Lee, T. Rompf, H. Chafi, M. Odersky, and K. Olukotun. A heterogeneous parallel framework for domain-specific languages. In PACT, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J. Carette, O. Kiselyov, and C.-C. Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. In APLAS, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. H. Chafi, Z. DeVito, A. Moors, T. Rompf, A. K. Sujeeth, P. Hanrahan, M. Odersky, and K. Olukotun. Language virtualization for heterogeneous parallel computing. In OOPSLA, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. Consel. A tour of Schism: a partial evaluation system for higher-order applicative languages. In PEPM, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. W. R. Cook and R. Lämmel. Tutorial on online partial evaluation. In DSL, 2011.Google ScholarGoogle ScholarCross RefCross Ref
  10. K. Czarnecki, J. O’Donnell, J. Striegnitz, and W. Taha. DSL implementation in MetaOCaml, Template Haskell, and C ++. In Domain-Specific Program Generation, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  11. P. Danilewski, M. Köster, R. Leißa, R. Membarth, and P. Slusallek. Specialization through dynamic staging. In GPCE, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. Z. DeVito, J. Hegarty, A. Aiken, P. Hanrahan, and J. Vitek. Terra: A multi-stage language for high-performance computing. In PLDI, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Y. Futamura. Partial evaluation of computation process—an approach to a compiler-compiler. Systems, Computers, Controls, 1999. Reproduction of the 1971 paper.Google ScholarGoogle Scholar
  15. J. Gibbons and N. Wu. Folding domain-specific languages: Deep and shallow embeddings. In ICFP, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. R. Glück. A self-applicable online partial evaluator for recursive flowchart languages. Softw., Pract. Exper., 42, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. C. Hofer, K. Ostermann, T. Rendel, and A. Moors. Polymorphic embedding of DSLs. In GPCE, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. B. T. Howard and J. C. Mitchell. Operational and axiomatic semantics of pcf. In LFP, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. P. Hudak. Modular domain specific languages and tools. In Software Reuse, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. Johnsson. Lambda lifting: Transforming programs to recursive equations. In FPCA, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. N. D. Jones. Mix ten years later. In PEPM, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. D. Jones and A. J. Glenstrup. Program generation, termination, and bindingtime analysis. In GPCE, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. N. D. Jones, P. Sestoft, and H. Søndergaard. Mix: A self-applicable partial evaluator for experiments in compiler generation (extended abstract). In MFPS, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Inc., 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. J. Jørgensen. Similix: a self-applicable partial evaluator for Scheme. In Partial Evaluation, 1998.Google ScholarGoogle Scholar
  26. U. Jørring and W. L. Scherlis. Compilers and staging transformations. In POPL, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. V. Jovanovi´c, A. Shaikhha, S. Stucki, V. Nikolaev, C. Koch, and M. Odersky. Yin-Yang: Concealing the deep embedding of DSLs. In GPCE, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Karrenberg and S. Hack. Whole-function vectorization. In CGO, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. M. Katz and D. Weise. Towards a new perspective on partial evaluation. In PEPM, 1992.Google ScholarGoogle Scholar
  30. SYCL TM Specification. Khronos, 2015. Version 1.2.Google ScholarGoogle Scholar
  31. Y. Klonatos, C. Koch, T. Rompf, and H. Chafi. Building e fficient query engines in a high-level language. PVLDB, 7(10):853–864, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. R. Leißa, M. Köster, and S. Hack. A graph-based higher-order intermediate representation. In CGO, 2015.Google ScholarGoogle ScholarCross RefCross Ref
  33. M. McCool. A retargetable, dynamic compiler and embedded language. In CGO, 2011.Google ScholarGoogle Scholar
  34. R. Membarth, O. Reiche, C. Schmitt, F. Hannig, J. Teich, M. Stürmer, and H. Köstler. Towards a performance-portable description of geometric multigrid algorithms using a domain-specific language. JPDC, 74(12):3191–3201, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. R. Membarth, O. Reiche, F. Hannig, J. Teich, M. Körner, and W. Eckert. HIPA cc : A domain-specific language and compiler for image processing. TPDS, 2015.Google ScholarGoogle Scholar
  36. G. Ofenbeck, T. Rompf, A. Stojanov, M. Odersky, and M. Püschel. Spiral in Scala: towards the systematic construction of generators for performance libraries. In GPCE, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. J. Palsberg and M. I. Schwartzbach. Binding-time analysis: Abstract interpretation versus type inference. In ICCL, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  38. G. D. Plotkin. LCF considered as a programming language. Theoretical Computer Science, 1977.Google ScholarGoogle Scholar
  39. J. Ragan-Kelley, C. Barnes, A. Adams, S. Paris, F. Durand, and S. Amarasinghe. Halide: A language and compiler for optimizing parallelism, locality, and recomputation in image processing pipelines. In PLDI, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. G. Ramalingam. On loops, dominators, and dominance frontiers. ACM Trans. Program. Lang. Syst., 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. T. Rompf and M. Odersky. Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs. In GPCE, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. T. Rompf, A. K. Sujeeth, K. J. Brown, H. Lee, H. Chafi, and K. Olukotun. Surgical precision JIT compilers. In PLDI, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. E. Ruf. Topics in Online Partial Evaluation. PhD thesis, Stanford University, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. A. Shali and W. R. Cook. Hybrid partial evaluation. In OOPSLA, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. O. Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie Mellon University, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. A. K. Sujeeth, H. Lee, K. J. Brown, H. Chafi, M. Wu, A. R. Atreya, K. Olukotun, T. Rompf, and M. Odersky. OptiML: an implicitly parallel domain-specific language for machine learning. In ICML, 2011.Google ScholarGoogle Scholar
  47. W. Taha and T. Sheard. MetaML and multi-stage programming with explicit annotations. In Theoretical Computer Science, 1999.Google ScholarGoogle Scholar
  48. W. Tait. Intensional interpretations of functionals of finite type i. J. Symb. Log., 1967.Google ScholarGoogle ScholarCross RefCross Ref
  49. S. Tobin-Hochstadt, V. St-Amour, R. Culpepper, M. Flatt, and M. Felleisen. Languages as libraries. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. U. Trottenberg, C. W. Oosterlee, and A. Schüller. Multigrid. Academic Press, Dec. 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. T. Würthinger, C. Wimmer, A. Wöß, L. Stadler, G. Duboscq, C. Humer, G. Richards, D. Simon, and M. Wolczko. One VM to rule them all. In SPLASH, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Shallow embedding of DSLs via online partial evaluation

    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

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 51, Issue 3
      GPCE '15
      March 2016
      184 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2936314
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        GPCE 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
        October 2015
        184 pages
        ISBN:9781450336871
        DOI:10.1145/2814204

      Copyright © 2015 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 26 October 2015

      Check for updates

      Qualifiers

      • research-article

    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!