<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>
<style>img {
max-width: 100%; height: auto;
}
body {
font-size: 0.875rem;
}
body {
-webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style='font-size: inherit; -webkit-text-shadow: rgba(255,255,255,0.01) 0 0 1px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";'>
<div class="content">
<h3 style="margin-top: 20px; margin-bottom: 10px;">
Simon Peyton Jones pushed to branch wip/T21286
at <a href="https://gitlab.haskell.org/ghc/ghc" style="color: #1068bf;">Glasgow Haskell Compiler / GHC</a>
</h3>
<h4 style="margin-top: 10px; margin-bottom: 10px;">
Commits:
</h4>
<ul>
<li>
<strong style="font-weight: bold;"><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/33105eeccad1f6886f7619f0f9ed49ddb71b80d4" style="color: #1068bf;">33105eec</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2022-09-27T11:49:00+01:00</i>
</div>
<pre class="commit-message" style='white-space: pre-wrap; display: block; font-size: 0.8125rem; color: #303030; position: relative; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: #fafafa; border-radius: 2px; margin: 0; padding: 8px 12px; border: 1px solid #dbdbdb;'>Improve aggressive specialisation
This patch fixes #21286, by not unboxing dictionaries in
worker/wrapper (ever). The main payload is tiny:
* In `GHC.Core.Opt.DmdAnal.finaliseArgBoxities`, do not unbox
dictionaries in `get_dmd`. See Note [Do not unbox class dictionaries]
in that module
* I also found that imported wrappers were being fruitlessly
specialised, so I fixed that too, in canSpecImport.
See Note [Specialising imported functions] point (2).
In doing due diligence in the testsuite I fixed a number of
other things:
* Improve Note [Specialising unfoldings] in GHC.Core.Unfold.Make,
and Note [Inline specialisations] in GHC.Core.Opt.Specialise,
and remove duplication between the two. The new Note describes
how we specialise functions with an INLINABLE pragma.
And simplify the defn of `spec_unf` in `GHC.Core.Opt.Specialise.specCalls`.
* Improve Note [Worker/wrapper for INLINABLE functions] in
GHC.Core.Opt.WorkWrap.
And (critially) make an actual change which is to propagate the
user-written pragma from the original function to the wrapper; see
`mkStrWrapperInlinePrag`.
* Write new Note [Specialising imported functions] in
GHC.Core.Opt.Specialise
All this has a big effect on some compile times. This is
compiler/perf, showing only changes over 1%:
Metrics: compile_time/bytes allocated
-------------------------------------
LargeRecord(normal) -50.2% GOOD
ManyConstructors(normal) +1.0%
MultiLayerModulesTH_OneShot(normal) +2.6%
PmSeriesG(normal) -1.1%
T10547(normal) -1.2%
T11195(normal) -1.2%
T11276(normal) -1.0%
T11303b(normal) -1.6%
T11545(normal) -1.4%
T11822(normal) -1.3%
T12150(optasm) -1.0%
T12234(optasm) -1.2%
T13056(optasm) -9.3% GOOD
T13253(normal) -3.8% GOOD
T15164(normal) -3.6% GOOD
T16190(normal) -2.1%
T16577(normal) -2.8% GOOD
T16875(normal) -1.6%
T17836(normal) +2.2%
T17977b(normal) -1.0%
T18223(normal) -33.3% GOOD
T18282(normal) -3.4% GOOD
T18304(normal) -1.4%
T18698a(normal) -1.4% GOOD
T18698b(normal) -1.3% GOOD
T19695(normal) -2.5% GOOD
T5837(normal) -2.3%
T9630(normal) -33.0% GOOD
WWRec(normal) -9.7% GOOD
hard_hole_fits(normal) -2.1% GOOD
hie002(normal) +1.6%
geo. mean -2.2%
minimum -50.2%
maximum +2.6%
I diligently investigated some of the big drops.
* Caused by not doing w/w for dictionaries:
T13056, T15164, WWRec, T18223
* Caused by not fruitlessly specialising wrappers
LargeRecord, T9630
For runtimes, here is perf/should+_run:
Metrics: runtime/bytes allocated
--------------------------------
T12990(normal) -3.8%
T5205(normal) -1.3%
T9203(normal) -10.7% GOOD
haddock.Cabal(normal) +0.1%
haddock.base(normal) -1.1%
haddock.compiler(normal) -0.3%
lazy-bs-alloc(normal) -0.2%
------------------------------------------
geo. mean -0.3%
minimum -10.7%
maximum +0.1%
I did not investigate exactly what happens in T9203.
Nofib is a wash:
+-------------------------------++--+-----------+-----------+
| || | tsv (rel) | std. err. |
+===============================++==+===========+===========+
| real/anna || | -0.13% | 0.0% |
| real/fem || | +0.13% | 0.0% |
| real/fulsom || | -0.16% | 0.0% |
| real/lift || | -1.55% | 0.0% |
| real/reptile || | -0.11% | 0.0% |
| real/smallpt || | +0.51% | 0.0% |
| spectral/constraints || | +0.20% | 0.0% |
| spectral/dom-lt || | +1.80% | 0.0% |
| spectral/expert || | +0.33% | 0.0% |
+===============================++==+===========+===========+
| geom mean || | | |
+-------------------------------++--+-----------+-----------+
I spent quite some time investigating dom-lt, but it's pretty
complicated. See my note on !7847. Conclusion: it's just a delicate
inlining interaction, and we have plenty of those.
Metric Decrease:
LargeRecord
T13056
T13253
T15164
T16577
T18223
T18282
T18698a
T18698b
T19695
T9630
WWRec
hard_hole_fits
</pre>
</li>
<li>
<strong style="font-weight: bold;"><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/f6d3af11c840b840104dc2d54409b7c0bfd3b1f6" style="color: #1068bf;">f6d3af11</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2022-09-27T11:56:59+01:00</i>
</div>
<pre class="commit-message" style='white-space: pre-wrap; display: block; font-size: 0.8125rem; color: #303030; position: relative; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: #fafafa; border-radius: 2px; margin: 0; padding: 8px 12px; border: 1px solid #dbdbdb;'>Refactor UnfoldingSource and IfaceUnfolding
I finally got tired of the way that IfaceUnfolding reflected
a previous structure of unfoldings, not the current one. This
MR refactors UnfoldingSource and IfaceUnfolding to be simpler
and more consistent.
It's largely just a refactor, but in UnfoldingSource (which moves
to GHC.Types.Basic, since it is now used in IfaceSyn too), I
distinguish between /user-specified/ and /system-generated/ stable
unfoldings.
data UnfoldingSource
= VanillaSrc
| StableUserSrc -- From a user-specified pragma
| StableSystemSrc -- From a system-generated unfolding
| CompulsorySrc
This has a minor effect in CSE (see the use of isisStableUserUnfolding
in GHC.Core.Opt.CSE), which I tripped over when working on
specialisation, but it seems like a Good Thing to know anyway.
</pre>
</li>
<li>
<strong style="font-weight: bold;"><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/7182351129c66a5933b3eba4d80cb9930b1dbe0d" style="color: #1068bf;">71823511</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2022-09-27T11:56:59+01:00</i>
</div>
<pre class="commit-message" style='white-space: pre-wrap; display: block; font-size: 0.8125rem; color: #303030; position: relative; font-family: "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; word-break: break-all; word-wrap: break-word; background-color: #fafafa; border-radius: 2px; margin: 0; padding: 8px 12px; border: 1px solid #dbdbdb;'>INLINE/INLINEABLE pragmas in Foreign.Marshal.Array
Foreign.Marshal.Array contains many small functions, all of which are
overloaded, and which are critical for performance. Yet none of them
had pragmas, so it was a fluke whether or not they got inlined.
This patch makes them all either INLINE (small ones) or
INLINEABLE and hence specialisable (larger ones).
See Note [Specialising array operations] in that module.
</pre>
</li>
</ul>
<h4 style="margin-top: 10px; margin-bottom: 10px;">30 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#182d6a315e784018aa9c8b2ad736036b97bd5d48" style="color: #1068bf;">
compiler/GHC/Core.hs
</a>
</li>
<li class="file-stats">
<a href="#446b4afbe6836b950115a619acea24ddde19dc90" style="color: #1068bf;">
compiler/GHC/Core/Opt/CSE.hs
</a>
</li>
<li class="file-stats">
<a href="#8104fa1b71db6cfc4eb90cd769463d9eb9004619" style="color: #1068bf;">
compiler/GHC/Core/Opt/DmdAnal.hs
</a>
</li>
<li class="file-stats">
<a href="#ae6d91a5d028418bbf1431347d659e744e0a3128" style="color: #1068bf;">
compiler/GHC/Core/Opt/Simplify/Iteration.hs
</a>
</li>
<li class="file-stats">
<a href="#48fbb5cdea308650de5756521feb28ec68819b9b" style="color: #1068bf;">
compiler/GHC/Core/Opt/Simplify/Utils.hs
</a>
</li>
<li class="file-stats">
<a href="#ab22d7ae4d245581b701367e386d7e886e416e76" style="color: #1068bf;">
compiler/GHC/Core/Opt/Specialise.hs
</a>
</li>
<li class="file-stats">
<a href="#5b215b0e109123e4bef5434854f18e2f61c45b88" style="color: #1068bf;">
compiler/GHC/Core/Opt/WorkWrap.hs
</a>
</li>
<li class="file-stats">
<a href="#a8e2a1e5829eb3b4809201e0f47e91b64ce11b96" style="color: #1068bf;">
compiler/GHC/Core/Ppr.hs
</a>
</li>
<li class="file-stats">
<a href="#11ffe98a94d798427bc600e4fcfe899407536346" style="color: #1068bf;">
compiler/GHC/Core/SimpleOpt.hs
</a>
</li>
<li class="file-stats">
<a href="#846e2566b022c9a12a5978ac7934d5b019fbea5c" style="color: #1068bf;">
compiler/GHC/Core/Tidy.hs
</a>
</li>
<li class="file-stats">
<a href="#2811a7297b8aa206197ac1f5dabd0818e3c7ec5a" style="color: #1068bf;">
compiler/GHC/Core/Unfold.hs
</a>
</li>
<li class="file-stats">
<a href="#940913dd549c6b1c334daafbc4b7eef29c94d924" style="color: #1068bf;">
compiler/GHC/Core/Unfold/Make.hs
</a>
</li>
<li class="file-stats">
<a href="#bbf06eb5d4f0db7bc3213b84b9f5822710ff7be8" style="color: #1068bf;">
compiler/GHC/CoreToIface.hs
</a>
</li>
<li class="file-stats">
<a href="#dd79b5199bc3b425c4536c633b39006df111a7ef" style="color: #1068bf;">
compiler/GHC/HsToCore.hs
</a>
</li>
<li class="file-stats">
<a href="#65e2067fbb7377818b6cadff0531f44029499948" style="color: #1068bf;">
compiler/GHC/HsToCore/Binds.hs
</a>
</li>
<li class="file-stats">
<a href="#72e14c3befeaebb85803171795d8fc797521568f" style="color: #1068bf;">
compiler/GHC/HsToCore/Foreign/C.hs
</a>
</li>
<li class="file-stats">
<a href="#d11de0586c9bcbcf4c5d10d94801cc1f97e8df1b" style="color: #1068bf;">
compiler/GHC/Iface/Rename.hs
</a>
</li>
<li class="file-stats">
<a href="#079d6b28856775716c78fdd4a4b35bb45a59002c" style="color: #1068bf;">
compiler/GHC/Iface/Syntax.hs
</a>
</li>
<li class="file-stats">
<a href="#d11203a9321005ba51a16d751c86f609d1f18c71" style="color: #1068bf;">
compiler/GHC/Iface/Tidy.hs
</a>
</li>
<li class="file-stats">
<a href="#06ff7bac58fd8cfe0c17b81963b03f4cce86a065" style="color: #1068bf;">
compiler/GHC/IfaceToCore.hs
</a>
</li>
<li class="file-stats">
<a href="#e63425e031ffe9350ee6b1687e506aaea75d11e1" style="color: #1068bf;">
compiler/GHC/Tc/TyCl/Instance.hs
</a>
</li>
<li class="file-stats">
<a href="#166e3514d27c63ef7e86af29830d9e8b2a31c8b1" style="color: #1068bf;">
compiler/GHC/Types/Basic.hs
</a>
</li>
<li class="file-stats">
<a href="#261c0c5029eb34eb7436b087d77314f377ff8223" style="color: #1068bf;">
compiler/GHC/Types/Id/Make.hs
</a>
</li>
<li class="file-stats">
<a href="#9d5df636ea1749572ef5d257663a2af8bbe07481" style="color: #1068bf;">
libraries/base/Foreign/Marshal/Array.hs
</a>
</li>
<li class="file-stats">
<a href="#e2f6b12889757561d508a64f69d28577e96df813" style="color: #1068bf;">
testsuite/tests/arityanal/should_compile/Arity05.stderr
</a>
</li>
<li class="file-stats">
<a href="#2779dd39638d332b4347f082443df52a088814ec" style="color: #1068bf;">
testsuite/tests/arityanal/should_compile/Arity11.stderr
</a>
</li>
<li class="file-stats">
<a href="#e866e357dffcf10a28dffedc3e9b7a5fc972bbef" style="color: #1068bf;">
testsuite/tests/arityanal/should_compile/Arity14.stderr
</a>
</li>
<li class="file-stats">
<a href="#acdf191bb1214958aea152e3eb432353a77f9cd2" style="color: #1068bf;">
testsuite/tests/deSugar/should_compile/T19969.stderr
</a>
</li>
<li class="file-stats">
<a href="#71247aaad504d89a31c398d6edd6cfc090975b86" style="color: #1068bf;">
testsuite/tests/deSugar/should_compile/T2431.stderr
</a>
</li>
<li class="file-stats">
<a href="#db69bd7fd312c8f2d70932e8b366751dd01d2d4a" style="color: #1068bf;">
testsuite/tests/indexed-types/should_compile/T7837.stderr
</a>
</li>
</ul>
<h5 style="margin-top: 10px; margin-bottom: 10px; font-size: 0.875rem;">The diff was not included because it is too large.</h5>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">
—
<br>
<a href="https://gitlab.haskell.org/ghc/ghc/-/compare/2a660d024b1efea4b6fc3460b424bfe993e06e45...7182351129c66a5933b3eba4d80cb9930b1dbe0d" style="color: #1068bf;">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.haskell.org" style="color: #1068bf;">gitlab.haskell.org</a>. <a href="https://gitlab.haskell.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link" style="color: #1068bf;">Manage all notifications</a> · <a href="https://gitlab.haskell.org/help" target="_blank" rel="noopener noreferrer" class="help-link" style="color: #1068bf;">Help</a>
</p>
</div>
</body>
</html>