[commit: ghc] master: Implement new integer-gmp2 from scratch (re #9281) (c774b28)

git at git.haskell.org git at git.haskell.org
Wed Nov 12 10:05:03 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a/ghc

>---------------------------------------------------------------

commit c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Oct 19 20:37:40 2014 +0200

    Implement new integer-gmp2 from scratch (re #9281)
    
    This is done as a separate `integer-gmp2` backend library because it
    turned out to become a complete rewrite from scratch.
    
    Due to the different (over)allocation scheme and potentially different
    accounting (via the new `{shrink,resize}MutableByteArray#` primitives),
    some of the nofib benchmarks actually results in increased allocation
    numbers (but not necessarily an increase in runtime!).  I believe the
    allocation numbers could improve if `{resize,shrink}MutableByteArray#`
    could be optimised to reallocate in-place more efficiently.
    
    Here are the more apparent changes in the latest nofib comparision
    between `integer-gmp` and `integer-gmp2`:
    
      ------------------------------------------------------------------
              Program     Size    Allocs   Runtime   Elapsed  TotalMem
      ------------------------------------------------------------------
                  ...
           bernouilli    +1.6%    +15.3%     0.132     0.132      0.0%
                  ...
         cryptarithm1    -2.2%      0.0%     -9.7%     -9.7%      0.0%
                  ...
                fasta    -0.7%     -0.0%    +10.9%    +10.9%      0.0%
                  ...
                kahan    +0.6%    +38.9%     0.169     0.169      0.0%
                  ...
                 lcss    -0.7%     -0.0%     -6.4%     -6.4%      0.0%
                  ...
               mandel    +1.6%    +33.6%     0.049     0.049      0.0%
                  ...
             pidigits    +0.8%     +8.5%     +3.9%     +3.9%      0.0%
                power    +1.4%    -23.8%    -18.6%    -18.6%    -16.7%
                  ...
            primetest    +1.3%    +50.1%     0.085     0.085      0.0%
                  ...
                  rsa    +1.6%    +53.4%     0.026     0.026      0.0%
                  ...
                  scs    +1.2%     +6.6%     +6.5%     +6.6%    +14.3%
                  ...
               symalg    +1.0%     +9.5%     0.010     0.010      0.0%
                  ...
            transform    -0.6%     -0.0%     -5.9%     -5.9%      0.0%
                  ...
      ------------------------------------------------------------------
                  Min    -2.3%    -23.8%    -18.6%    -18.6%    -16.7%
                  Max    +1.6%    +53.4%    +10.9%    +10.9%    +14.3%
       Geometric Mean    -0.3%     +1.9%     -0.8%     -0.8%     +0.0%
    
    (see P35 / https://phabricator.haskell.org/P35 for full report)
    
    By default, `INTEGER_LIBRARY=integer-gmp2` is active now, which results
    in the package `integer-gmp-1.0.0.0` being registered in the package db.
    The previous `integer-gmp-0.5.1.0` can be restored by setting
    `INTEGER_LIBRARY=integer-gmp` (but will probably be removed altogether
    for GHC 7.12). In-tree GMP support has been stolen from the old
    `integer-gmp` (while unpatching the custom memory-allocators, as well as
    forcing `-fPIC`)
    
    A minor hack to `ghc-cabal` was necessary in order to support two different
    `integer-gmp` packages (in different folders) with the same package key.
    
    There will be a couple of follow-up commits re-implementing some features
    that were dropped to keep D82 minimal, as well as further
    clean-ups/improvements.
    
    More information can be found via #9281 and
    https://ghc.haskell.org/trac/ghc/wiki/Design/IntegerGmp2
    
    Reviewed By: austin, rwbarton, simonmar
    
    Differential Revision: https://phabricator.haskell.org/D82


>---------------------------------------------------------------

c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a
 compiler/basicTypes/Module.lhs                     |    7 +-
 compiler/coreSyn/CorePrep.lhs                      |    3 +-
 compiler/ghc.mk                                    |    8 +-
 compiler/prelude/PrelNames.lhs                     |    2 +
 ghc.mk                                             |   11 +-
 libraries/base/GHC/Real.hs                         |    4 +
 libraries/base/base.cabal                          |   19 +-
 libraries/{integer-gmp => integer-gmp2}/.gitignore |    5 +-
 libraries/integer-gmp2/LICENSE                     |   30 +
 libraries/{base => integer-gmp2}/Setup.hs          |    0
 libraries/{integer-gmp => integer-gmp2}/aclocal.m4 |    0
 libraries/integer-gmp2/cbits/wrappers.c            |  281 ++++
 .../{integer-gmp => integer-gmp2}/changelog.md     |    7 +
 .../integer-gmp2/config.guess                      |    0
 config.sub => libraries/integer-gmp2/config.sub    |    0
 .../{integer-gmp => integer-gmp2}/configure.ac     |    2 +-
 .../{integer-gmp => integer-gmp2}/gmp/config.mk.in |    0
 libraries/integer-gmp2/gmp/ghc.mk                  |  124 ++
 libraries/integer-gmp2/gmp/gmpsrc.patch            |   37 +
 {libffi => libraries/integer-gmp2/gmp}/ln          |    0
 .../include/HsIntegerGmp.h.in                      |    0
 .../integer-gmp.buildinfo.in                       |    0
 libraries/integer-gmp2/integer-gmp.cabal           |   65 +
 .../src/GHC/Integer.hs}                            |   49 +-
 .../integer-gmp2/src/GHC/Integer/GMP/Internals.hs  |  126 ++
 .../integer-gmp2/src/GHC/Integer/Logarithms.hs     |   73 +
 .../src/GHC/Integer/Logarithms/Internals.hs        |  118 ++
 libraries/integer-gmp2/src/GHC/Integer/Type.hs     | 1663 ++++++++++++++++++++
 mk/config.mk.in                                    |    2 +-
 rules/foreachLibrary.mk                            |    2 +
 testsuite/tests/ghci/scripts/ghci025.stdout        |    6 +-
 testsuite/tests/lib/integer/all.T                  |    3 +-
 testsuite/tests/llvm/should_compile/all.T          |    2 +-
 testsuite/tests/perf/should_run/all.T              |    3 +-
 testsuite/tests/perf/space_leaks/all.T             |    6 +-
 testsuite/tests/safeHaskell/check/pkg01/all.T      |    1 +
 testsuite/tests/simplCore/should_run/T5603.hs      |    3 +-
 testsuite/tests/typecheck/should_fail/T5095.stderr |    4 +-
 .../tests/typecheck/should_fail/tcfail072.stderr   |    2 +-
 utils/ghc-cabal/Main.hs                            |    4 +
 40 files changed, 2628 insertions(+), 44 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 c774b28f76ee4c220f7c1c9fd81585e0e3af0e8a


More information about the ghc-commits mailing list