[GHC] #9476: Implement late lambda-lifting

GHC ghc-devs at haskell.org
Mon Oct 8 15:30:45 UTC 2018


#9476: Implement late lambda-lifting
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  sgraf
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.2
      Resolution:                    |             Keywords:  LateLamLift
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #8763 #13286      |  Differential Rev(s):
       Wiki Page:  LateLamLift       |
-------------------------------------+-------------------------------------

Comment (by sgraf):

 You can find the latest version of the paper at
 https://github.com/sgraf812/late-lam-lift/blob/master/paper.pdf. It's
 still pretty rough and littered with TODOs, but you can take a glance at
 the two chapters I got so far. What's missing is an evaluation + the usual
 prologue and epilogue.

 While writing the paper, I realised a few things here and there that I
 could change in the transformation.

 For example, currently we can't lift functions that occur in argument
 position, i.e.

 {{{
 let f x = ... x ... a ... b ... in
 let g y z = ... in
 g f 1
 }}}

 Lifting `f` would mean having to allocate a PAP at the call site of `g`
 for `f a b`. One of our heuristics forbids the lift here, because it's
 nonsense: We immediately re-introduce the allocation we spared at each
 call site of the lifted function. The only situation I can think of in
 which this could be beneficial is when this pushes allocation from a hot
 code path into multiple cold call sites.

 Making the transformation correct here is somewhat of a nuisance, but
 probably needed in order to back my claims in section 3 (C1, in
 particular) with benchmark figures.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9476#comment:40>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list