[Git][ghc/ghc][wip/req_smp] 25 commits: Add 'docWithStyle' to improve codegen

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Mon Jan 16 15:25:34 UTC 2023



doyougnu pushed to branch wip/req_smp at Glasgow Haskell Compiler / GHC


Commits:
f7ceafc9 by Krzysztof Gogolewski at 2023-01-11T22:36:59-05:00
Add 'docWithStyle' to improve codegen

This new combinator

docWithStyle :: IsOutput doc => doc -> (PprStyle -> SDoc) -> doc

let us remove the need for code to be polymorphic in HDoc
when not used in code style.

Metric Decrease:
    ManyConstructors
    T13035
    T1969

- - - - -
b3be0d18 by Simon Peyton Jones at 2023-01-11T22:37:35-05:00
Fix finaliseArgBoxities for OPAQUE function

We never do worker wrapper for OPAQUE functions, so we must
zap the unboxing info during strictness analysis.

This patch fixes #22502

- - - - -
db11f358 by Ben Gamari at 2023-01-12T07:49:04-05:00
Revert "rts: Drop racy assertion"

The logic here was inverted. Reverting the commit to avoid confusion
when examining the commit history.

This reverts commit b3eacd64fb36724ed6c5d2d24a81211a161abef1.

- - - - -
3242139f by Ben Gamari at 2023-01-12T07:49:04-05:00
rts: Drop racy assertion

0e274c39bf836d5bb846f5fa08649c75f85326ac added an assertion in
`dirty_MUT_VAR` checking that the MUT_VAR being dirtied was clean.
However, this isn't necessarily the case since another thread may have
raced us to dirty the object.

- - - - -
9ffd5d57 by Ben Gamari at 2023-01-12T07:49:41-05:00
configure: Fix escaping of `$tooldir`

In !9547 I introduced `$tooldir` directories into GHC's default link and
compilation flags to ensure that our C toolchain finds its own headers
and libraries before others on the system. However, the patch was subtly
wrong in the escaping of `$tooldir`. Fix this.

Fixes #22561.

- - - - -
905d0b6e by Sebastian Graf at 2023-01-12T15:51:47-05:00
Fix contification with stable unfoldings (#22428)

Many functions now return a `TailUsageDetails` that adorns a `UsageDetails` with
a `JoinArity` that reflects the number of join point binders around the body
for which the `UsageDetails` was computed. `TailUsageDetails` is now returned by
`occAnalLamTail` as well as `occAnalUnfolding` and `occAnalRules`.

I adjusted `Note [Join points and unfoldings/rules]` and
`Note [Adjusting right-hand sides]` to account for the new machinery.
I also wrote a new `Note [Join arity prediction based on joinRhsArity]`
and refer to it when we combine `TailUsageDetails` for a recursive RHS.

I also renamed

  * `occAnalLam` to `occAnalLamTail`
  * `adjustRhsUsage` to `adjustTailUsage`
  * a few other less important functions

and properly documented the that each call of `occAnalLamTail` must pair up with
`adjustTailUsage`.

I removed `Note [Unfoldings and join points]` because it was redundant with
`Note [Occurrences in stable unfoldings]`.

While in town, I refactored `mkLoopBreakerNodes` so that it returns a condensed
`NodeDetails` called `SimpleNodeDetails`.

Fixes #22428.

The refactoring seems to have quite beneficial effect on ghc/alloc performance:

```
     CoOpt_Read(normal) ghc/alloc    784,778,420    768,091,176  -2.1% GOOD
         T12150(optasm) ghc/alloc     77,762,270     75,986,720  -2.3% GOOD
         T12425(optasm) ghc/alloc     85,740,186     84,641,712  -1.3% GOOD
         T13056(optasm) ghc/alloc    306,104,656    299,811,632  -2.1% GOOD
         T13253(normal) ghc/alloc    350,233,952    346,004,008  -1.2%
         T14683(normal) ghc/alloc  2,800,514,792  2,754,651,360  -1.6%
         T15304(normal) ghc/alloc  1,230,883,318  1,215,978,336  -1.2%
         T15630(normal) ghc/alloc    153,379,590    151,796,488  -1.0%
         T16577(normal) ghc/alloc  7,356,797,056  7,244,194,416  -1.5%
         T17516(normal) ghc/alloc  1,718,941,448  1,692,157,288  -1.6%
         T19695(normal) ghc/alloc  1,485,794,632  1,458,022,112  -1.9%
        T21839c(normal) ghc/alloc    437,562,314    431,295,896  -1.4% GOOD
        T21839r(normal) ghc/alloc    446,927,580    440,615,776  -1.4% GOOD

              geo. mean                                          -0.6%
              minimum                                            -2.4%
              maximum                                            -0.0%
```

Metric Decrease:
    CoOpt_Read
    T10421
    T12150
    T12425
    T13056
    T18698a
    T18698b
    T21839c
    T21839r
    T9961

- - - - -
a1491c87 by Andreas Klebinger at 2023-01-12T15:52:23-05:00
Only gc sparks locally when we can ensure marking is done.

When performing GC without work stealing there was no guarantee that
spark pruning was happening after marking of the sparks. This could
cause us to GC live sparks under certain circumstances.

Fixes #22528.

- - - - -
8acfe930 by Cheng Shao at 2023-01-12T15:53:00-05:00
Change MSYSTEM to CLANG64 uniformly

- - - - -
73bc162b by M Farkas-Dyck at 2023-01-12T15:53:42-05:00
Make `GHC.Tc.Errors.Reporter` take `NonEmpty ErrorItem` rather than `[ErrorItem]`, which lets us drop some panics.

Also use the `BasicMismatch` constructor rather than `mkBasicMismatchMsg`, which lets us drop the "-Wno-incomplete-record-updates" flag.

- - - - -
1b812b69 by Oleg Grenrus at 2023-01-12T15:54:21-05:00
Fix #22728: Not all diagnostics in safe check are fatal

Also add tests for the issue and -Winferred-safe-imports in general

- - - - -
c79b2b65 by Matthew Pickering at 2023-01-12T15:54:58-05:00
Don't run hadrian-multi on fast-ci label

Fixes #22667

- - - - -
9a3d6add by Bodigrim at 2023-01-13T00:46:36-05:00
Bump submodule bytestring to 0.11.4.0

Metric Decrease:
    T21839c
    T21839r

- - - - -
df33c13c by Ben Gamari at 2023-01-13T00:47:12-05:00
gitlab-ci: Bump Darwin bootstrap toolchain

This updates the bootstrap compiler on Darwin from 8.10.7 to 9.2.5,
ensuring that we have the fix for #21964.

- - - - -
756a66ec by Ben Gamari at 2023-01-13T00:47:12-05:00
gitlab-ci: Pass -w to cabal update

Due to cabal#8447, cabal-install 3.8.1.0 requires a compiler to run
`cabal update`.
- - - - -
1142f858 by Cheng Shao at 2023-01-13T11:04:00+00:00
Bump hsc2hs submodule

- - - - -
d4686729 by Cheng Shao at 2023-01-13T11:04:00+00:00
Bump process submodule

- - - - -
84ae6573 by Cheng Shao at 2023-01-13T11:06:58+00:00
ci: Bump DOCKER_REV

- - - - -
d53598c5 by Cheng Shao at 2023-01-13T11:06:58+00:00
ci: enable xz parallel compression for x64 jobs

- - - - -
d31fcbca by Cheng Shao at 2023-01-13T11:06:58+00:00
ci: use in-image emsdk for js jobs

- - - - -
93b9bbc1 by Cheng Shao at 2023-01-13T11:47:17+00:00
ci: improve nix-shell for gen_ci.hs and fix some ghc/hlint warnings

- Add a ghc environment including prebuilt dependencies to the
  nix-shell. Get rid of the ad hoc cabal cache and all dependencies
  are now downloaded from the nixos binary cache.
- Make gen_ci.hs a cabal package with HLS integration, to make future
  hacking of gen_ci.hs easier.
- Fix some ghc/hlint warnings after I got HLS to work.
- For the lint-ci-config job, do a shallow clone to save a few minutes
  of unnecessary git checkout time.

- - - - -
8acc56c7 by Cheng Shao at 2023-01-13T11:47:17+00:00
ci: source the toolchain env file in wasm jobs

- - - - -
87194df0 by Cheng Shao at 2023-01-13T11:47:17+00:00
ci: add wasm ci jobs via gen_ci.hs

- There is one regular wasm job run in validate pipelines
- Additionally, int-native/unreg wasm jobs run in nightly/release pipelines

Also, remove the legacy handwritten wasm ci jobs in .gitlab-ci.yml.

- - - - -
b6eb9bcc by Matthew Pickering at 2023-01-13T11:52:16+00:00
wasm ci: Remove wasm release jobs

This removes the wasm release jobs, as we do not yet intend to
distribute these binaries.

- - - - -
496607fd by Simon Peyton Jones at 2023-01-13T16:52:07-05:00
Add a missing checkEscapingKind

Ticket #22743 pointed out that there is a missing check,
for type-inferred bindings, that the inferred type doesn't
have an escaping kind.

The fix is easy.

- - - - -
37fa1afa by Sylvain Henry at 2023-01-16T15:25:30+00:00
testsuite: req_smp --> req_target_smp, req_ghc_smp

See #22630 and !9552

This commit:
 - splits req_smp into req_target_smp and req_ghc_smp
 - changes the testsuite driver to calculate req_ghc_smp
 - changes a handful of tests to use req_target_smp instead of req_smp
 - changes a handful of tests to use req_host_smp when needed

The problem:
 - the problem this solves is the ambiguity surrounding req_smp
 - on master req_smp was used to express the constraint that the program
 being compiled supports smp _and_ that the host RTS (i.e., the RTS used
 to compile the program) supported smp. Normally that is fine, but in
 cross compilation this is not always the case as was discovered in #22630.

The solution:
 - Differentiate the two constraints:
   - use req_target_smp to say the RTS the compiled program is linked
   with (and the platform) supports smp
   - use req_host_smp to say the RTS the host is linked with supports smp

WIP: fix req_smp (target vs ghc)

add flag to separate bootstrapper

split req_smp -> req_target_smp and req_ghc_smp

update tests smp flags

cleanup and add some docstrings

only set ghc_with_smp to bootstrapper on S1 or CC

Only set ghc_with_smp to bootstrapperWithSMP of when testing stage 1
and cross compiling

test the RTS in config/ghc not hadrian

re-add ghc_with_smp

fix and align req names

fix T11760 to use req_host_smp

test the rts directly, avoid python 3.5 limitation

test the compiler in a try block

align out of tree and in tree withSMP flags

mark failing tests as host req smp

testsuite: req_host_smp --> req_ghc_smp

Fix ghc vs host, fix ghc_with_smp leftover

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/darwin/nix/sources.json
- .gitlab/darwin/toolchain.nix
- + .gitlab/gen-ci.cabal
- .gitlab/gen_ci.hs
- .gitlab/generate_jobs
- + .gitlab/hie.yaml
- .gitlab/jobs.yaml
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Data/Graph/Directed.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/Validity.hs
- compiler/GHC/Types/CostCentre.hs
- compiler/GHC/Types/Name.hs
- compiler/GHC/Types/Name/Occurrence.hs
- compiler/GHC/Unit/Types.hs
- compiler/GHC/Utils/Misc.hs
- compiler/GHC/Utils/Outputable.hs
- docs/users_guide/9.6.1-notes.rst
- hadrian/src/Settings/Builders/RunTest.hs
- libraries/base/tests/all.T
- libraries/bytestring
- libraries/process


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/244e5f1e10c86811d949f9fdc0cb05800feb09de...37fa1afa29557f200b99d0468d90a9ab347bdbf5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/244e5f1e10c86811d949f9fdc0cb05800feb09de...37fa1afa29557f200b99d0468d90a9ab347bdbf5
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/20230116/0deaa65a/attachment-0001.html>


More information about the ghc-commits mailing list