[Git][ghc/ghc][wip/nested-cpr-2019] 2 commits: Nested CPR
Sebastian Graf
gitlab at gitlab.haskell.org
Thu Dec 17 13:26:44 UTC 2020
Sebastian Graf pushed to branch wip/nested-cpr-2019 at Glasgow Haskell Compiler / GHC
Commits:
34d1c78d by Sebastian Graf at 2020-12-17T12:00:22+01:00
Nested CPR
Move tests from stranal to cpranal
Accept FacState
Factor Cpr and Termination into a joint lattice
As a result, we don't even have to export Termination from Cpr. Neat!
Also I realised there is a simpler and more sound way to generate and
unleash CPR signatures.
Consider unboxing effects of WW better and get rid of hack
stuff
A slew of testsuite changes
Fix T1600
Fix primop termination
Test for DataCon wrapper CPR
Fix CPR of bottoming functions/primops
Fix DataConWrapperCpr and accept other test outputs
Accept two more changed test outputs
Update CaseBinderCPR with a new function
Don't give the case binder the CPR property
Prune CPR sigs to constant depth on all bindings
Use variable length coding for ConTags
Accept testuite output
Don't attach CPR sigs to expandable bindings; transform their unfoldings instead
Revert "Don't give the case binder the CPR property"
This reverts commit 910edd76d5fe68b58c74f3805112f9faef4f2788.
It seems we broke too much with this change. We lost our big win in
`fish`.
A more modular and configurable approach to optimistic case binder CPR
Fix T9291
Document -fcase-binder-cpr-depth in the user's guide
Testsuite changes
Refactoring around cprAnalBind
Fix case binder CPR by not looking into unfoldings of case binders
Fix T16893
Accept new test output for T17673
Accepting metric changes to advance CI
There are two ghc/alloc increases, which we might want to investigate
later on.
Metric Decrease:
T1969
T9233
T9872a
T9872b
T9872c
T9872d
T12425
T12545
Metric Increase:
T13253
T13701
T15164
Metric Increase ['max_bytes_used'] (test_env='x86_64-darwin'):
T9675
Metric Increase ['max_bytes_used'] (test_env='x86_64-linux-deb9-dwarf'):
T9675
Metric Increase ['max_bytes_used', 'peak_megabytes_allocated']:
T10370
- - - - -
9873fa2a by Sebastian Graf at 2020-12-17T14:18:25+01:00
WorkWrap CPR: Consider how a function body is used
Consider `T18894`:
```hs
module T18894 (h) where
g :: Int -> Int -> (Int,Int)
g !m 1 = (2 + m, 0)
g m n = (2 * m, 2 `div` n)
{-# NOINLINE g #-}
h :: Int -> Int
h 1 = 0
h m
| odd m = snd (g m 2)
| otherwise = uncurry (+) (g 2 m)
```
We give `g` the CPR type `#c1(#c1(*), *c1(#))`. Previously, that
wouldn't let us unbox the second component, because the division
might diverge (throw a div-by-zero exception).
But since #18894/!4493, we annotate `g` with its demand
`UCU(CS(P(1P(U),SP(U))))`.
Note that demand tells us that, *when* `g` is called, we always
evaluate the second component of the returned pair. So it's OK for W/W
to unbox it, because all call sites will force the division anyway!
This is what this commit is implementing. The changes are entirely
local to W/W.
I also added a test case, `T18174`, that tracks everything Nested CPR is
supposed to do (which is tracked in #18174).
- - - - -
30 changed files:
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Stg/Lift/Analysis.hs
- compiler/GHC/Types/Cpr.hs
- compiler/GHC/Types/Demand.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- docs/users_guide/using-optimisation.rst
- + testsuite/tests/cpranal/should_compile/T18174.hs
- + testsuite/tests/cpranal/should_compile/T18174.stderr
- testsuite/tests/cpranal/should_compile/all.T
- testsuite/tests/stranal/sigs/CaseBinderCPR.hs → testsuite/tests/cpranal/sigs/CaseBinderCPR.hs
- + testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr
- testsuite/tests/stranal/sigs/FacState.hs → testsuite/tests/cpranal/sigs/FacState.hs
- + testsuite/tests/cpranal/sigs/FacState.stderr
- + testsuite/tests/cpranal/sigs/Makefile
- testsuite/tests/stranal/should_compile/T10694.hs → testsuite/tests/cpranal/sigs/T10694.hs
- + testsuite/tests/cpranal/sigs/T10694.stderr
- + testsuite/tests/cpranal/sigs/T1600.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4d8a46f0ce883b2611ca8aeb6d4cf35a00c61294...9873fa2ae3e41d6ffc180a05e0e36414006bcffb
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4d8a46f0ce883b2611ca8aeb6d4cf35a00c61294...9873fa2ae3e41d6ffc180a05e0e36414006bcffb
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201217/b6c932ac/attachment.html>
More information about the ghc-commits
mailing list