skip to main content
10.1145/2503778.2503789acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

An EDSL approach to high performance Haskell programming

Published: 23 September 2013 Publication History

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.
[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.
[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.
[4]
K. Claessen and D. Sands. Observable sharing for functional circuit description. In Advances in Computing Science--ASIAN'99, pages 62--73. Springer, 1999.
[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.
[6]
C. Elliott, S. Finne, and O. De Moor. Compiling embedded languages. Journal of Functional Programming, 13 (3): 455--481, 2003.
[7]
P. Hudak. Domain-specific languages. Handbook of Programming Languages, 3: 39--60, 1997.
[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.
[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.
[10]
J. Launchbury and S. L. Peyton Jones. Lazy functional state threads. In ACM SIGPLAN Notices, volume 29, pages 24--35. ACM, 1994.
[11]
B. Lippmeier and G. Keller. Efficient parallel stencil convolution in haskell. In ACM SIGPLAN Notices, volume 46, pages 59--70. ACM, 2011.
[12]
G. Mainland. nikola. http://github.com/mainland/nikola.
[13]
G. Mainland and G. Morrisett. Nikola: Embedding compiled gpu functions in haskell. In ACM Sigplan Notices, volume 45, pages 67--78. ACM, 2010.
[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.
[15]
B. O'Sullivan. criterion. http://hackage.haskell.org/package/criterion.
[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.
[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.
[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.
[19]
J. Svenningsson and E. Axelsson. Combining deep and shallow embedding for edsl. In Trends in Functional Programming, LLNCS. Springer, 2012.
[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.
[21]
H. Thielemann. synthesizer. http://www.haskell.org/haskellwiki/Synthesizer,.
[22]
H. Thielemann. synthesizer-llvm. http://hackage.haskell.org/package/synthesizer-llvm,.

Cited By

View all
  • (2019)Efficient differentiable programming in a functional array-processing languageProceedings of the ACM on Programming Languages10.1145/33417013:ICFP(1-30)Online publication date: 26-Jul-2019
  • (2019)Functional Reactive EDSL with Asynchronous Execution for Resource-Constrained Embedded SystemsSoftware Engineering, Artificial Intelligence, Networking and Parallel/Distributed Computing10.1007/978-3-030-26428-4_12(171-190)Online publication date: 23-Aug-2019
  • (2017)Machine fusionProceedings of the 19th International Symposium on Principles and Practice of Declarative Programming10.1145/3131851.3131865(139-150)Online publication date: 9-Oct-2017
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

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
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 23 September 2013

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. array programming
  2. edsl
  3. meta programming
  4. optimization

Qualifiers

  • Research-article

Conference

ICFP'13
Sponsor:
ICFP'13: ACM SIGPLAN International Conference on Functional Programming
September 23 - 24, 2013
Massachusetts, Boston, USA

Acceptance Rates

Haskell '13 Paper Acceptance Rate 13 of 33 submissions, 39%;
Overall Acceptance Rate 57 of 143 submissions, 40%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)16
  • Downloads (Last 6 weeks)1
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2019)Efficient differentiable programming in a functional array-processing languageProceedings of the ACM on Programming Languages10.1145/33417013:ICFP(1-30)Online publication date: 26-Jul-2019
  • (2019)Functional Reactive EDSL with Asynchronous Execution for Resource-Constrained Embedded SystemsSoftware Engineering, Artificial Intelligence, Networking and Parallel/Distributed Computing10.1007/978-3-030-26428-4_12(171-190)Online publication date: 23-Aug-2019
  • (2017)Machine fusionProceedings of the 19th International Symposium on Principles and Practice of Declarative Programming10.1145/3131851.3131865(139-150)Online publication date: 9-Oct-2017
  • (2017)Destination-passing style for efficient memory managementProceedings of the 6th ACM SIGPLAN International Workshop on Functional High-Performance Computing10.1145/3122948.3122949(12-23)Online publication date: 7-Sep-2017
  • (2016)High-performance client-side web applications through Haskell EDSLsACM SIGPLAN Notices10.1145/3241625.297601551:12(62-73)Online publication date: 8-Sep-2016
  • (2016)High-performance client-side web applications through Haskell EDSLsProceedings of the 9th International Symposium on Haskell10.1145/2976002.2976015(62-73)Online publication date: 8-Sep-2016
  • (2016)Everything old is new again: quoted domain-specific languagesProceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation10.1145/2847538.2847541(25-36)Online publication date: 11-Jan-2016
  • (2014)Defunctionalizing push arraysProceedings of the 3rd ACM SIGPLAN workshop on Functional high-performance computing10.1145/2636228.2636231(43-52)Online publication date: 3-Sep-2014
  • (2022)From functional to imperative: combining destination-passing style and viewsProceedings of the 8th ACM SIGPLAN International Workshop on Libraries, Languages and Compilers for Array Programming10.1145/3520306.3534502(25-36)Online publication date: 13-Jun-2022
  • (2016)High-performance client-side web applications through Haskell EDSLsACM SIGPLAN Notices10.1145/3241625.297601551:12(62-73)Online publication date: 8-Sep-2016
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media