[Git][ghc/ghc][wip/base-stability] 13 commits: Add fused multiply-add instructions

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu May 11 20:35:54 UTC 2023



Ben Gamari pushed to branch wip/base-stability at Glasgow Haskell Compiler / GHC


Commits:
87eebf98 by sheaf at 2023-05-11T11:55:22-04:00
Add fused multiply-add instructions

This patch adds eight new primops that fuse a multiplication and an
addition or subtraction:

  - `{fmadd,fmsub,fnmadd,fnmsub}{Float,Double}#`

fmadd x y z is x * y + z, computed with a single rounding step.

This patch implements code generation for these primops in the following
backends:

  - X86, AArch64 and PowerPC NCG,
  - LLVM
  - C

WASM uses the C implementation. The primops are unsupported in the
JavaScript backend.

The following constant folding rules are also provided:

  - compute a * b + c when a, b, c are all literals,
  - x * y + 0 ==> x * y,
  - ±1 * y + z ==> z ± y and x * ±1 + z ==> z ± x.

NB: the constant folding rules incorrectly handle signed zero.
This is a known limitation with GHC's floating-point constant folding
rules (#21227), which we hope to resolve in the future.

- - - - -
ad16a066 by Krzysztof Gogolewski at 2023-05-11T11:55:59-04:00
Add a test for #21278

- - - - -
05cea68c by Matthew Pickering at 2023-05-11T11:56:36-04:00
rts: Refine memory retention behaviour to account for pinned/compacted objects

When using the copying collector there is still a lot of data which
isn't copied (such as pinned, compacted, large objects etc). The logic
to decide how much memory to retain didn't take into account that these
wouldn't be copied. Therefore we pessimistically retained 2* the amount
of memory for these blocks even though they wouldn't be copied by the
collector.

The solution is to split up the heap into two parts, the parts which
will be copied and the parts which won't be copied. Then the appropiate
factor is applied to each part individually (2 * for copying and 1.2 *
for not copying).

The T23221 test demonstrates this improvement with a program which first
allocates many unpinned ByteArray# followed by many pinned ByteArray#
and observes the difference in the ultimate memory baseline between the
two.

There are some charts on #23221.

Fixes #23221

- - - - -
1bb24432 by Cheng Shao at 2023-05-11T11:57:15-04:00
hadrian: fix no_dynamic_libs flavour transformer

This patch fixes the no_dynamic_libs flavour transformer and make
fully_static reuse it. Previously building with no_dynamic_libs fails
since ghc program is still dynamic and transitively brings in dyn ways
of rts which are produced by no rules.

- - - - -
38fe392d by Ben Gamari at 2023-05-11T15:22:31-04:00
testsuite: Add test to catch changes in core libraries

This adds testing infrastructure to ensure that changes in core
libraries (e.g. `base` and `ghc-prim`) are caught in CI.

- - - - -
0dbf5c03 by Ben Gamari at 2023-05-11T15:22:51-04:00
base: Introduce Data.Enum

- - - - -
e4191a50 by Ben Gamari at 2023-05-11T15:22:51-04:00
base: Add export list to GHC.Num.Integer

- - - - -
8e7834ea by Ben Gamari at 2023-05-11T15:22:51-04:00
base: Add export list to GHC.Num

- - - - -
c5d0cf91 by Ben Gamari at 2023-05-11T15:22:51-04:00
base: Add export list to GHC.Num.Natural

- - - - -
06a1c145 by Ben Gamari at 2023-05-11T15:22:51-04:00
base: Introduce Data.Show

- - - - -
d77a6604 by Ben Gamari at 2023-05-11T15:45:38-04:00
base: Add export list to GHC.Float

- - - - -
9d1c4bdc by Ben Gamari at 2023-05-11T16:23:30-04:00
base: Add export list to GHC.Real

- - - - -
29058cc8 by Ben Gamari at 2023-05-11T16:23:36-04:00
base: Eliminate module reexport in GHC.Exception

- - - - -


30 changed files:

- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/PPC/CodeGen.hs
- compiler/GHC/CmmToAsm/PPC/Instr.hs
- compiler/GHC/CmmToAsm/PPC/Ppr.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/CmmToC.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Llvm/Ppr.hs
- compiler/GHC/Llvm/Syntax.hs
- compiler/GHC/Llvm/Types.hs
- compiler/GHC/StgToCmm/Config.hs
- compiler/GHC/StgToCmm/Prim.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/SysTools/Cpp.hs
- docs/users_guide/9.8.1-notes.rst
- docs/users_guide/using.rst
- hadrian/src/Flavour.hs
- hadrian/src/Packages.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/91cb668cc440b13a685c893bbe70a2d094fe1442...29058cc86dcd537032c1e425b760c98a16ef968b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/91cb668cc440b13a685c893bbe70a2d094fe1442...29058cc86dcd537032c1e425b760c98a16ef968b
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/20230511/c03dd32d/attachment.html>


More information about the ghc-commits mailing list