skip to main content
research-article

An EDSL approach to high performance Haskell programming

Published:23 September 2013Publication History
Skip Abstract Section

Abstract

This 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 library. The paper describes the implementation of meta-repa and contrasts it with the standard approach to writing high performance libraries. We conclude that even though the embedded language approach has an initial cost of defining the language and some syntactic overhead it gives a more tailored programming model, stronger performance guarantees, better control over optimizations, simpler implementation of fusion and inlining and allows for moving type level programming down to value level programming in some cases. We also provide benchmarks showing that meta-repa is as fast, or faster, than repa.

Furthermore, meta-repa also includes push arrays and we demonstrate their usefulness for writing certain high performance kernels such as FFT.

References

  1. E. Axelsson, K. Claessen, M. Sheeran, J. Svenningsson, D. Engdal, and A. Persson. The design and implementation of feldspar. In Implementation and Application of Functional Languages, pages 121--136. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. J. Bentley. Programming pearls: little languages. Commun. ACM, 29 (8): 711--721, Aug. 1986. ISSN 0001-0782. 10.1145/6424.315691. URL http://doi.acm.org/10.1145/6424.315691. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. P. Bjesse, K. Claessen, M. Sheeran, and S. Singh. Lava: Hardware design in haskell. In ACM SIGPLAN Notices, volume 34, pages 174--184. ACM, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. K. Claessen and D. Sands. Observable sharing for functional circuit description. In Advances in Computing Science--ASIAN'99, pages 62--73. Springer, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. K. Claessen, M. Sheeran, and B. J. Svensson. Expressive array constructs in an embedded gpu kernel programming language. In Proceedings of the 7th workshop on Declarative aspects and applications of multicore programming, pages 21--30. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. Elliott, S. Finne, and O. De Moor. Compiling embedded languages. Journal of Functional Programming, 13 (3): 455--481, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. P. Hudak. Domain-specific languages. Handbook of Programming Languages, 3: 39--60, 1997.Google ScholarGoogle Scholar
  8. S. P. Jones, A. Tolmach, and T. Hoare. Playing by the rules: Rewriting as a practical optimisation technique in ghc. In Haskell Workshop, volume 1, pages 203--233, 2001.Google ScholarGoogle Scholar
  9. G. Keller, M. M. Chakravarty, R. Leshchinskiy, S. Peyton Jones, and B. Lippmeier. Regular, shape-polymorphic, parallel arrays in haskell. ACM Sigplan Notices, 45 (9): 261--272, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Launchbury and S. L. Peyton Jones. Lazy functional state threads. In ACM SIGPLAN Notices, volume 29, pages 24--35. ACM, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. B. Lippmeier and G. Keller. Efficient parallel stencil convolution in haskell. In ACM SIGPLAN Notices, volume 46, pages 59--70. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. G. Mainland. nikola. http://github.com/mainland/nikola.Google ScholarGoogle Scholar
  13. G. Mainland and G. Morrisett. Nikola: Embedding compiled gpu functions in haskell. In ACM Sigplan Notices, volume 45, pages 67--78. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. A. Orchard, M. Bolingbroke, and A. Mycroft. Ypnos: Declarative, parallel structured grid programming. In Proceedings of the 5th ACM SIGPLAN workshop on Declarative aspects of multicore programming, pages 15--24. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. B. O'Sullivan. criterion. http://hackage.haskell.org/package/criterion.Google ScholarGoogle Scholar
  16. A. Persson, E. Axelsson, and J. Svenningsson. Generic monadic constructs for embedded languages. In Implementation and Application of Functional Languages, pages 85--99. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. A. Reid, J. Peterson, G. Hager, and P. Hudak. Prototyping real-time vision systems: An experiment in dsl design. In Proceedings of the 21st international conference on Software engineering, pages 484--493. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Seefried, M. Chakravarty, and G. Keller. Optimising embedded dsls using template haskell. In Generative Programming and Component Engineering, pages 186--205. Springer, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  19. J. Svenningsson and E. Axelsson. Combining deep and shallow embedding for edsl. In Trends in Functional Programming, LLNCS. Springer, 2012.Google ScholarGoogle Scholar
  20. J. Svensson, M. Sheeran, and K. Claessen. Obsidian: A domain specific embedded language for parallel programming of graphics processors. In Implementation and Application of Functional Languages, pages 156--173. Springer, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. H. Thielemann. synthesizer. http://www.haskell.org/haskellwiki/Synthesizer,.Google ScholarGoogle Scholar
  22. H. Thielemann. synthesizer-llvm. http://hackage.haskell.org/package/synthesizer-llvm,.Google ScholarGoogle Scholar

Index Terms

  1. An EDSL approach to high performance Haskell programming

      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 48, Issue 12
        Haskell '13
        December 2013
        149 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2578854
        Issue’s Table of Contents
        • cover image ACM Conferences
          Haskell '13: Proceedings of the 2013 ACM SIGPLAN symposium on Haskell
          September 2013
          158 pages
          ISBN:9781450323833
          DOI:10.1145/2503778

        Copyright © 2013 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 23 September 2013

        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!