GHC issueshttps://gitlab.haskell.org/ghc/ghc/-/issues2022-02-24T00:55:22Zhttps://gitlab.haskell.org/ghc/ghc/-/issues/20059Add native BIGNUM_BACKED release jobs for alpine on 9.0 and 9.22022-02-24T00:55:22ZZubinAdd native BIGNUM_BACKED release jobs for alpine on 9.0 and 9.2Prior to https://gitlab.haskell.org/ghc/ghc/-/commit/43139064a95220cfa8b633840a76eb75d5affd0d we didn't have `BIGNUM_BACKEND=native` builds for alpine at all, contrary to the claims of the download page.
This is fixed on master, and I'...Prior to https://gitlab.haskell.org/ghc/ghc/-/commit/43139064a95220cfa8b633840a76eb75d5affd0d we didn't have `BIGNUM_BACKEND=native` builds for alpine at all, contrary to the claims of the download page.
This is fixed on master, and I've fixed it on 8.10 with https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5925 and !6088. However, since the CI configuration has changed since 8.10, these fixes cannot be forward ported. The easiest solution would be to backport 43139064a95220cfa8b633840a76eb75d5affd0d to the `ghc-9.0` and `ghc-9.2` release branches.9.0.2Ben GamariBen Gamarihttps://gitlab.haskell.org/ghc/ghc/-/issues/19895Runtime perf: Foldable instance (minimum) allocations increased in ghc-8.10+2021-06-21T01:53:06ZharendraRuntime perf: Foldable instance (minimum) allocations increased in ghc-8.10+## Summary
In streamly library the `minimum` method of Foldable instance regressed drastically because allocations increased from 0 to a large number. The code works well in ghc-8.8. The regression first occurred in ghc-8.10 and is pres...## Summary
In streamly library the `minimum` method of Foldable instance regressed drastically because allocations increased from 0 to a large number. The code works well in ghc-8.8. The regression first occurred in ghc-8.10 and is present in subsequent compilers.
## Steps to reproduce
```
$ git clone https://github.com/composewell/streamly-ghc9-regression.git
$ cd streamly-ghc9-regression
$ git checkout foldable-minimum
```
Compile with ghc-8.8:
```
$ ghc-8.8.3 --make -O2 -ddump-to-file -ddump-simpl -dsuppress-all -dsuppress-uniques Main.hs
$ time ./Main +RTS -s
1
50,960 bytes allocated in the heap
3,312 bytes copied during GC
44,408 bytes maximum residency (1 sample(s))
25,224 bytes maximum slop
0 MB total memory in use (0 MB lost due to fragmentation)
```
Compile with ghc-8.10:
```
$ ghc-8.10.4 --make -O2 -ddump-to-file -ddump-simpl -dsuppress-all -dsuppress-uniques Main.hs
$ time ./Main +RTS -s
1
9,651,072 bytes allocated in the heap
693,568 bytes copied during GC
44,408 bytes maximum residency (2 sample(s))
29,320 bytes maximum slop
2 MiB total memory in use (0 MB lost due to fragmentation)
```
The [core produced by ghc-8.8](https://github.com/composewell/streamly-ghc9-regression/blob/f36fdc1ae52f4faf8147b98b0e0dddeac1707eff/minimum.ghc-8.8.dump-simpl) removes all constructors. Whereas [in 8.10 core](https://github.com/composewell/streamly-ghc9-regression/blob/f36fdc1ae52f4faf8147b98b0e0dddeac1707eff/minimum.ghc-8.10.dump-simpl) some laziness is seen and the `Just'` and `Nothing'` constructors are not removed.
## Expected behavior
ghc-8.10+ compilers should produce code as efficient as ghc-8.8.
## Environment
* GHC version used: ghc-8.10.49.0.2https://gitlab.haskell.org/ghc/ghc/-/issues/19873Code that fuses with GHC-8 no longer fuses with GHC-92021-07-20T08:00:39ZharendraCode that fuses with GHC-8 no longer fuses with GHC-9## Summary
See #19790 and #19861 for background. I updated the repo (https://github.com/composewell/streamly-ghc9-regression) with reproduction code for another regression. This time it is in the `after_` operation, a bit more complicat...## Summary
See #19790 and #19861 for background. I updated the repo (https://github.com/composewell/streamly-ghc9-regression) with reproduction code for another regression. This time it is in the `after_` operation, a bit more complicated repro code than the previous ones.
## Steps to reproduce
You can pull [the repo](https://github.com/composewell/streamly-ghc9-regression) (`after` branch which is also the same as master as of now) and use the following command to build it:
```
$ cabal build --with-compiler <compiler>
```
This will build the Main executable and also produce .dump-simpl files which can be found in the dist-newstyle directory tree. After doing this step you can also build it directly using `ghc` but make sure that you are providing the same optimization options as in the cabal file. For example:
```
$ ghc --make -O2 -fspec-constr-recursive=16 -fmax-worker-args=16 -ddump-to-file -ddump-simpl Main.hs
```
The core generated by [ghc-8](https://github.com/composewell/streamly-ghc9-regression/blob/25f2319ccf2f510be406e385608ecefbf69b904f/after.ghc-8.dump-simpl) and [ghc-9](https://github.com/composewell/streamly-ghc9-regression/blob/25f2319ccf2f510be406e385608ecefbf69b904f/after.ghc-9.dump-simpl) are quite different.
Both of these cores do not fuse all the constructors. However, we use a [compiler plugin](https://github.com/composewell/fusion-plugin) which inserts a pass after the simplifier phase0. It simply marks some bindings of interest with an INLINE pragma and runs the simplifier pass after doing so. You can build the repo code with fusion-plugin like this:
```
$ cabal build --with-compiler <compiler> --flag fusion-plugin
```
Or with ghc directly:
```
$ ghc --make -O2 -fspec-constr-recursive=16 -fmax-worker-args=16 -ddump-to-file -ddump-simpl -fplugin Fusion.Plugin Main.hs
```
ghc core-to-core verbose dump can provide more details about what's happening in each pass.
Using GHC-8 with the plugin, the above code fuses completely and produces [this core](https://github.com/composewell/streamly-ghc9-regression/blob/25f2319ccf2f510be406e385608ecefbf69b904f/after.ghc-8.fusion-plugin.dump-simpl). However, with GHC-9 this code does not fuse even with the plugin, it produces [this core](https://github.com/composewell/streamly-ghc9-regression/blob/25f2319ccf2f510be406e385608ecefbf69b904f/after.ghc-9.fusion-plugin.dump-simpl).
Let me know if I can help in any further investigation.
## Expected behavior
GHC-9 should produce code as efficient as GHC-8. The core produced by GHC-9 even without the fusion-plugin is quite different which can possibly provide some clue why it won't fuse even after everything of interest is inlined by the fusion-plugin.
## Environment
* GHC version used: ghc-9.3+ghc/ghc!56589.0.2Ben GamariBen Gamari