[commit: ghc] ghc-8.2: Fix cost-centre-stacks bug (#5654) (9a1ac01)
git at git.haskell.org
git at git.haskell.org
Wed Mar 29 23:41:28 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/9a1ac01fbc806e5a267b8a943d8f5269fef0e61f/ghc
>---------------------------------------------------------------
commit 9a1ac01fbc806e5a267b8a943d8f5269fef0e61f
Author: Simon Marlow <marlowsd at gmail.com>
Date: Thu Dec 15 11:17:19 2016 -0500
Fix cost-centre-stacks bug (#5654)
This fixes some cases of wrong stacks being generated by the profiler.
For background and details on the fix see
`Note [Evaluating functions with profiling]` in `rts/Apply.cmm`.
This does have an impact on allocations for some programs when
profiling. nofib results:
```
k-nucleotide +0.0% +8.8% +11.0% +11.0% 0.0%
puzzle +0.0% +12.5% 0.244 0.246 0.0%
typecheck 0.0% +8.7% +16.1% +16.2% 0.0%
------------------------------------------------------------------------
--------
Min -0.0% -0.0% -34.4% -35.5% -25.0%
Max +0.0% +12.5% +48.9% +49.4% +10.6%
Geometric Mean +0.0% +0.6% +2.0% +1.8% -0.3%
```
But runtimes don't seem to be affected much, and the examples I looked
at were completely legitimate. For example, in puzzle we have this:
```
position :: ItemType -> StateType -> BankType
position Bono = bonoPos
position Edge = edgePos
position Larry = larryPos
position Adam = adamPos
```
where the identifiers on the rhs are all record selectors. Previously
the profiler gave a stack that looked like
```
position
bonoPos
...
```
i.e. `bonoPos` was at the same level of the call stack as `position`,
but now it looks like
```
position
bonoPos
...
```
I used the normaliser from the testsuite to diff the profiling output
from other nofib programs and they all looked better.
Test Plan:
* the broken test passes
* validate
* compiled and ran all of nofib, measured perf, diff'd several .prof
files
Reviewers: niteria, erikd, austin, scpmw, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2804
GHC Trac Issues: #5654, #10007
(cherry picked from commit 394231b301efb6b56654b0a480ab794fe3b7e4db)
>---------------------------------------------------------------
9a1ac01fbc806e5a267b8a943d8f5269fef0e61f
compiler/codeGen/StgCmmClosure.hs | 6 +-
includes/Cmm.h | 6 ++
rts/Apply.cmm | 107 +++++++++++++++++++++
.../profiling/should_run/{T5654.hs => T5654-O0.hs} | 0
.../profiling/should_run/T5654-O0.prof.sample | 28 ++++++
.../profiling/should_run/{T5654.hs => T5654-O1.hs} | 0
.../profiling/should_run/T5654-O1.prof.sample | 27 ++++++
.../tests/profiling/should_run/T5654.prof.sample | 28 ------
.../tests/profiling/should_run/T680.prof.sample | 50 +++++-----
testsuite/tests/profiling/should_run/all.T | 4 +-
10 files changed, 200 insertions(+), 56 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9a1ac01fbc806e5a267b8a943d8f5269fef0e61f
More information about the ghc-commits
mailing list