skip to main content
research-article

The Intel labs Haskell research compiler

Published:23 September 2013Publication History
Skip Abstract Section

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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  3. A. Appel and T. Jim. Shrinking lambda expressions in linear time. JFP, 7(5), Sept. 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. L. Bergstrom and J. Reppy. Arity raising in Manticore. In IFL 2009, volume 6041 of LNCS, pages 90--106. Springer-Verlag, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. M. C. Bolingbroke and S. L. Peyton Jones. Types are calling conventions. In Haskell Symposium, pages 1--12. ACM, Sept. 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Fluet and S. Weeks. Contification using dominators. In ICFP, pages 2--13. ACM, Sept. 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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/.Google ScholarGoogle Scholar
  11. N. Glew, T. Sweeney, and L. Petersen. A multivalued language with a dependent type system. In Dependently Typed Programming. ACM, Sept. 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Marlow and S. L. Peyton Jones. Multicore garbage collection with local heaps. In ISMM, pages 21--32. ACM, June 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Meacham. JHC: John's Haskell compiler, 2007. URL http://repetae.net/computer/jhc/.Google ScholarGoogle Scholar
  18. W. Partain. The nofib benchmark suite of Haskell programs. In Functional Programming, Glasgow 1992, Workshops in Computing, pages 195--202. Springer-Verlag, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. L. Petersen and N. Glew. GC-safe interprocedural unboxing. In CC, volume 7210 of LNCS, pages 165--184. Springer-Verlag, Apr. 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. L. Petersen, T. A. Anderson, H. Liu, and N. Glew. Measuring the Haskell gap. Manuscript available from the authors, June 2013.Google ScholarGoogle Scholar
  21. L. Petersen, D. Orchard, and N. Glew. Automatic SIMD vectorization for Haskell. In ICFP. ACM, Sept. 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. L. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. JFP, 2(2):127--202, Apr. 1992.Google ScholarGoogle Scholar
  26. J. C. Reynolds. Definitional interpreters for higher-order programming languages. In ACM Annual Conference, pages 717--740. ACM, 1972. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. D. A. Terei and M. M. Chakravarty. An LLVM backend for GHC. ACM Sigplan Notices, 45(11):109--120, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. A. Tolmach. An external representation for the GHC Core language. URL http://www.haskell.org/ghc/docs/papers/core.ps.gz. Sept. 2001.Google ScholarGoogle Scholar
  30. S. Weeks. Whole-program compilation in MLton. In ML Workshop, pages 1--1. ACM, Sept. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Y. Wu and J. R. Larus. Static branch frequency and program profile analysis. In MICRO, pages 1--11. IEEE, Nov. 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. The Intel labs Haskell research compiler

    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

      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].

      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