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

The Intel labs Haskell research compiler

Published: 23 September 2013 Publication History

Abstract

The Glasgow Haskell Compiler (GHC) is a well supported optimizing compiler for the Haskell programming language, along with its own extensions to the language and libraries. Haskell's lazy semantics imposes a runtime model which is in general difficult to implement efficiently. GHC achieves good performance across a wide variety of programs via aggressive optimization taking advantage of the lack of side effects, and by targeting a carefully tuned virtual machine. The Intel Labs Haskell Research Compiler uses GHC as a frontend, but provides a new whole-program optimizing backend by compiling the GHC intermediate representation to a relatively generic functional language compilation platform. We found that GHC's external Core language was relatively easy to use, but reusing GHC's libraries and achieving full compatibility were harder. For certain classes of programs, our platform provides substantial performance benefits over GHC alone, performing 2x faster than GHC with the LLVM backend on selected modern performance-oriented benchmarks; for other classes of programs, the benefits of GHC's tuned virtual machine continue to outweigh the benefits of more aggressive whole program optimization. Overall we achieve parity with GHC with the LLVM backend. In this paper, we describe our Haskell compiler stack, its implementation and optimization approach, and present benchmark results comparing it to GHC.

References

[1]
T. A. Anderson. Optimizations in a private nursery-based garbage collector. In ISMM, pages 21--30. ACM, 2010.
[2]
T. A. Anderson, N. Glew, P. Guo, B. T. Lewis, W. Liu, Z. Liu, L. Petersen, M. Rajagopalan, J. M. Stichnoth, G. Wu, and D. Zhang. Pillar: A parallel implementation language. In LCPC, volume 5234 of LNCS, pages 141--155. Springer-Verlag, 2007.
[3]
A. Appel and T. Jim. Shrinking lambda expressions in linear time. JFP, 7(5), Sept. 1997.
[4]
N. Benton, A. Kennedy, S. Lindley, and C. Russo. Shrinking reductions in SML.NET. In IFL 2004, volume 3474 of LNCS, pages 142--159. Springer-Verlag, 2005.
[5]
L. Bergstrom and J. Reppy. Arity raising in Manticore. In IFL 2009, volume 6041 of LNCS, pages 90--106. Springer-Verlag, 2010.
[6]
M. C. Bolingbroke and S. L. Peyton Jones. Types are calling conventions. In Haskell Symposium, pages 1--12. ACM, Sept. 2009.
[7]
A. Dijkstra, J. Fokker, and S. D. Swierstra. The architecture of the Utrecht Haskell compiler. In Haskell Symposium, pages 93--104. ACM, Sept. 2009.
[8]
C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In PLDI, pages 237--247. ACM, June 1993.
[9]
M. Fluet and S. Weeks. Contification using dominators. In ICFP, pages 2--13. ACM, Sept. 2001.
[10]
N. Glew and L. Petersen. Type-preserving flow analysis and interprocedural unboxing (extended version), Mar. 2012. arXiv: 1203.1986 {cs.PL}, http://arXiv.org/.
[11]
N. Glew, T. Sweeney, and L. Petersen. A multivalued language with a dependent type system. In Dependently Typed Programming. ACM, Sept. 2013.
[12]
K. Jensen, P. Hjresen, and M. Rosendahl. Efficient strictness analysis of Haskell. In Static Analysis, volume 864 of LNCS, pages 346--362. Springer-Verlag, 1994.
[13]
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.
[14]
S. Marlow and S. Peyton Jones. The new GHC/Hugs runtime system. URL http://research.microsoft.com/apps/pubs/default.aspx?id=68449. Jan. 1998.
[15]
S. Marlow and S. Peyton Jones. Making a fast curry: Push/enter vs. eval/apply for higher-order languages. JFP, 16(4-5):415--449, July 2006.
[16]
S. Marlow and S. L. Peyton Jones. Multicore garbage collection with local heaps. In ISMM, pages 21--32. ACM, June 2011.
[17]
J. Meacham. JHC: John's Haskell compiler, 2007. URL http://repetae.net/computer/jhc/.
[18]
W. Partain. The nofib benchmark suite of Haskell programs. In Functional Programming, Glasgow 1992, Workshops in Computing, pages 195--202. Springer-Verlag, 1993.
[19]
L. Petersen and N. Glew. GC-safe interprocedural unboxing. In CC, volume 7210 of LNCS, pages 165--184. Springer-Verlag, Apr. 2012.
[20]
L. Petersen, T. A. Anderson, H. Liu, and N. Glew. Measuring the Haskell gap. Manuscript available from the authors, June 2013.
[21]
L. Petersen, D. Orchard, and N. Glew. Automatic SIMD vectorization for Haskell. In ICFP. ACM, Sept. 2013.
[22]
S. Peyton Jones and W. Partain. Measuring the effectiveness of a simple strictness analyser. In Functional Programming, Glasgow 1993, Workshops in Computing, pages 201--221. Springer-Verlag, 1 994.
[23]
S. Peyton Jones, N. Ramsey, and F. Reig. C--: A portable assembly language that supports garbage collection. In PPDP, volume 1702 of LNCS, pages 1--28. Springer-Verlag, Oct. 1999.
[24]
S. Peyton Jones, A. Reid, F. Henderson, T. Hoare, and S. Marlow. A semantics for imprecise exceptions. In PLDI, pages 25--36. ACM, May 1999.
[25]
S. L. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. JFP, 2(2):127--202, Apr. 1992.
[26]
J. C. Reynolds. Definitional interpreters for higher-order programming languages. In ACM Annual Conference, pages 717--740. ACM, 1972.
[27]
M. Sulzmann, M. M. T. Chakravarty, S. Peyton Jones, and K. Donnelly. System F with type equality coercions. In TLDI, pages 53--66. ACM, Jan. 2007.
[28]
D. A. Terei and M. M. Chakravarty. An LLVM backend for GHC. ACM Sigplan Notices, 45(11):109--120, 2010.
[29]
A. Tolmach. An external representation for the GHC Core language. URL http://www.haskell.org/ghc/docs/papers/core.ps.gz. Sept. 2001.
[30]
S. Weeks. Whole-program compilation in MLton. In ML Workshop, pages 1--1. ACM, Sept. 2006.
[31]
Y. Wu and J. R. Larus. Static branch frequency and program profile analysis. In MICRO, pages 1--11. IEEE, Nov. 1994.

Cited By

View all

Index Terms

  1. The Intel labs Haskell research compiler

    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. compiler optimization
    2. functional language compiler
    3. haskell

    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)11
    • Downloads (Last 6 weeks)2
    Reflects downloads up to 24 Dec 2024

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media