[GHC] #9476: Implement late lambda-lifting
GHC
ghc-devs at haskell.org
Fri Aug 31 11:18:28 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):
I think Nicolas played around with those parameters, concluding that this
wiki:LateLamLift#llf-nr10-r6 was the best configuration.
I played around with settings like the number of vars to abstract over
when I was still testdriving the Core transformation. IIRC, the desired
cutoff was 5 arguments in total, because any excess arguments are passed
on the stack. But now that the transformation works reliably, I think I
can play around with it some more again.
There are some knobs to turn: There's `-fstg-lift-lams-args(-any)`
(default: number of available registers for argument passing, currently
hard-coded to 5) which takes an upper bound for the number of arguments
the function may have ''after'' lifting. Also no distinction if the
function is recursive or not (yet?).
As well as `-f(no-)stg-lift-lams-known` (default: no) which controls if we
are willing to turn known calls into unknown calls. This happens when we
lift a function that abstracts over a known function:
{{{
let f x = ...
mapF xs = ... f x ...
in mapF [1,2,3]
==>
mapF_up f xs = ... f x ...
let f x = ...
in mapF_up f [1,2,3]
}}}
Lifting `mapF` turns the call to `f` into an unknown call.
Wrt. the other heuristics I employ, peek here if you're interested:
https://github.com/sgraf812/ghc/blob/1e45f1fe3133a263694d05d01b84a245d4244098/compiler/simplStg/StgLiftLams.hs#L413-L420
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9476#comment:25>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list