Skip to content
Snippets Groups Projects
  1. Jun 13, 2023
  2. May 06, 2023
  3. Apr 27, 2023
  4. Nov 29, 2022
  5. Oct 12, 2022
  6. Sep 13, 2022
    • sheaf's avatar
      Diagnostic codes: acccept test changes · 362cca13
      sheaf authored and Marge Bot's avatar Marge Bot committed
      The testsuite output now contains diagnostic codes, so many tests need
      to be updated at once.
      We decided it was best to keep the diagnostic codes in the testsuite
      output, so that contributors don't inadvertently make changes to the
      diagnostic codes.
      362cca13
  7. Aug 06, 2022
    • Andreas Klebinger's avatar
      Change `-fprof-late` to insert cost centres after unfolding creation. · fab0ee93
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      The former behaviour of adding cost centres after optimization but
      before unfoldings are created is not available via the flag
      `prof-late-inline` instead.
      
      I also reduced the overhead of -fprof-late* by pushing the cost centres
      into lambdas. This means the cost centres will only account for
      execution of functions and not their partial application.
      
      Further I made LATE_CC cost centres it's own CC flavour so they now
      won't clash with user defined ones if a user uses the same string for
      a custom scc.
      
      LateCC: Don't put cost centres inside constructor workers.
      
      With -fprof-late they are rarely useful as the worker is usually
      inlined. Even if the worker is not inlined or we use -fprof-late-linline
      they are generally not helpful but bloat compile and run time
      significantly. So we just don't add sccs inside constructor workers.
      
      -------------------------
      Metric Decrease:
          T13701
      -------------------------
      fab0ee93
  8. Jul 26, 2022
  9. Jul 13, 2022
  10. Jul 03, 2022
    • Rodrigo Mesquita's avatar
      Refactor ModuleName to L.H.S.Module.Name · c43dbac0
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      ModuleName used to live in GHC.Unit.Module.Name. In this commit, the
      definition of ModuleName and its associated functions are moved to
      Language.Haskell.Syntax.Module.Name according to the current plan
      towards making the AST GHC-independent.
      
      The instances for ModuleName for Outputable, Uniquable and Binary were
      moved to the module in which the class is defined because these instances
      depend on GHC.
      
      The instance of Eq for ModuleName is slightly changed to no longer
      depend on unique explicitly and instead uses FastString's instance of
      Eq.
      c43dbac0
  11. May 30, 2022
    • Simon Peyton Jones's avatar
      A bunch of changes related to eta reduction · 6656f016
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This is a large collection of changes all relating to eta
      reduction, originally triggered by #18993, but there followed
      a long saga.
      
      Specifics:
      
      * Move state-hack stuff from GHC.Types.Id (where it never belonged)
        to GHC.Core.Opt.Arity (which seems much more appropriate).
      
      * Add a crucial mkCast in the Cast case of
        GHC.Core.Opt.Arity.eta_expand; helps with T18223
      
      * Add clarifying notes about eta-reducing to PAPs.
        See Note [Do not eta reduce PAPs]
      
      * I moved tryEtaReduce from GHC.Core.Utils to GHC.Core.Opt.Arity,
        where it properly belongs.  See Note [Eta reduce PAPs]
      
      * In GHC.Core.Opt.Simplify.Utils.tryEtaExpandRhs, pull out the code for
        when eta-expansion is wanted, to make wantEtaExpansion, and all that
        same function in GHC.Core.Opt.Simplify.simplStableUnfolding.  It was
        previously inconsistent, but it's doing the same thing.
      
      * I did a substantial refactor of ArityType; see Note [ArityType].
        This allowed me to do away with the somewhat mysterious takeOneShots;
        more generally it allows arityType to describe the function, leaving
        its clients to decide how to use that information.
      
        I made ArityType abstract, so that clients have to use functions
        to access it.
      
      * Make GHC.Core.Opt.Simplify.Utils.rebuildLam (was stupidly called
        mkLam before) aware of the floats that the simplifier builds up, so
        that it can still do eta-reduction even if there are some floats.
        (Previously that would not happen.)  That means passing the floats
        to rebuildLam, and an extra check when eta-reducting (etaFloatOk).
      
      * In GHC.Core.Opt.Simplify.Utils.tryEtaExpandRhs, make use of call-info
        in the idDemandInfo of the binder, as well as the CallArity info. The
        occurrence analyser did this but we were failing to take advantage here.
      
        In the end I moved the heavy lifting to GHC.Core.Opt.Arity.findRhsArity;
        see Note [Combining arityType with demand info], and functions
        idDemandOneShots and combineWithDemandOneShots.
      
        (These changes partly drove my refactoring of ArityType.)
      
      * In GHC.Core.Opt.Arity.findRhsArity
        * I'm now taking account of the demand on the binder to give
          extra one-shot info.  E.g. if the fn is always called with two
          args, we can give better one-shot info on the binders
          than if we just look at the RHS.
      
        * Don't do any fixpointing in the non-recursive
          case -- simple short cut.
      
        * Trim arity inside the loop. See Note [Trim arity inside the loop]
      
      * Make SimpleOpt respect the eta-reduction flag
        (Some associated refactoring here.)
      
      * I made the CallCtxt which the Simplifier uses distinguish between
        recursive and non-recursive right-hand sides.
           data CallCtxt = ... | RhsCtxt RecFlag | ...
        It affects only one thing:
           - We call an RHS context interesting only if it is non-recursive
             see Note [RHS of lets] in GHC.Core.Unfold
      
      * Remove eta-reduction in GHC.CoreToStg.Prep, a welcome simplification.
        See Note [No eta reduction needed in rhsToBody] in GHC.CoreToStg.Prep.
      
      Other incidental changes
      
      * Fix a fairly long-standing outright bug in the ApplyToVal case of
        GHC.Core.Opt.Simplify.mkDupableContWithDmds. I was failing to take the
        tail of 'dmds' in the recursive call, which meant the demands were All
        Wrong.  I have no idea why this has not caused problems before now.
      
      * Delete dead function GHC.Core.Opt.Simplify.Utils.contIsRhsOrArg
      
      Metrics: compile_time/bytes allocated
                                     Test    Metric       Baseline      New value Change
      ---------------------------------------------------------------------------------------
      MultiLayerModulesTH_OneShot(normal) ghc/alloc  2,743,297,692  2,619,762,992  -4.5% GOOD
                           T18223(normal) ghc/alloc  1,103,161,360    972,415,992 -11.9% GOOD
                            T3064(normal) ghc/alloc    201,222,500    184,085,360  -8.5% GOOD
                            T8095(normal) ghc/alloc  3,216,292,528  3,254,416,960  +1.2%
                            T9630(normal) ghc/alloc  1,514,131,032  1,557,719,312  +2.9%  BAD
                       parsing001(normal) ghc/alloc    530,409,812    525,077,696  -1.0%
      
      geo. mean                                 -0.1%
      
      Nofib:
             Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
               banner          +0.0%     +0.4%     -8.9%     -8.7%      0.0%
          exact-reals          +0.0%     -7.4%    -36.3%    -37.4%      0.0%
       fannkuch-redux          +0.0%     -0.1%     -1.0%     -1.0%      0.0%
                 fft2          -0.1%     -0.2%    -17.8%    -19.2%      0.0%
                fluid          +0.0%     -1.3%     -2.1%     -2.1%      0.0%
                   gg          -0.0%     +2.2%     -0.2%     -0.1%      0.0%
        spectral-norm          +0.1%     -0.2%      0.0%      0.0%      0.0%
                  tak          +0.0%     -0.3%     -9.8%     -9.8%      0.0%
                 x2n1          +0.0%     -0.2%     -3.2%     -3.2%      0.0%
      --------------------------------------------------------------------------------
                  Min          -3.5%     -7.4%    -58.7%    -59.9%      0.0%
                  Max          +0.1%     +2.2%    +32.9%    +32.9%      0.0%
       Geometric Mean          -0.0%     -0.1%    -14.2%    -14.8%     -0.0%
      
      Metric Decrease:
          MultiLayerModulesTH_OneShot
          T18223
          T3064
          T15185
          T14766
      Metric Increase:
          T9630
      6656f016
  12. May 24, 2022
  13. May 09, 2022
  14. May 04, 2022
  15. Apr 08, 2022
  16. Apr 01, 2022
  17. Mar 12, 2022
  18. Feb 10, 2022
  19. Feb 03, 2022
    • Matthew Pickering's avatar
      Rewrite CallerCC parser using ReadP · 84ab0153
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This allows us to remove the dependency on parsec and hence transitively
      on text.
      
      Also added some simple unit tests for the parser and fixed two small
      issues in the documentation.
      
      Fixes #21033
      84ab0153
  20. Jan 30, 2022
  21. Jan 26, 2022
  22. Jan 14, 2022
  23. Oct 12, 2021
    • Ben Gamari's avatar
      testsuite: Clean up dynlib support predicates · 05303f68
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Previously it was unclear whether req_shared_libs should require:
      
       * that the platform supports dynamic library loading,
       * that GHC supports dynamic linking of Haskell code, or
       * that the dyn way libraries were built
      
      Clarify by splitting the predicate into two:
      
       * `req_dynamic_lib_support` demands that the platform support dynamic
         linking
       * `req_dynamic_hs` demands that the GHC support dynamic linking of
         Haskell code on the target platform
      
      Naturally `req_dynamic_hs` cannot be true unless
      `req_dynamic_lib_support` is also true.
      05303f68
    • Ben Gamari's avatar
      testsuite: Mark T14931 as requiring dynamic linking · 99b8177a
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      99b8177a
  24. Sep 23, 2021
    • Sven Tennie's avatar
      Use Info Table Provenances to decode cloned stack (#18163) · 29717ecb
      Sven Tennie authored and Marge Bot's avatar Marge Bot committed
      Emit an Info Table Provenance Entry (IPE) for every stack represeted info table
      if -finfo-table-map is turned on.
      
      To decode a cloned stack, lookupIPE() is used. It provides a mapping between
      info tables and their source location.
      
      Please see these notes for details:
      
      - [Stacktraces from Info Table Provenance Entries (IPE based stack unwinding)]
      - [Mapping Info Tables to Source Positions]
      
      Metric Increase:
          T12545
      29717ecb
    • Sven Tennie's avatar
      Introduce stack snapshotting / cloning (#18741) · 6f7f5990
      Sven Tennie authored and Marge Bot's avatar Marge Bot committed
      
      Add `StackSnapshot#` primitive type that represents a cloned stack (StgStack).
      The cloning interface consists of two functions, that clone either the treads
      own stack (cloneMyStack) or another threads stack (cloneThreadStack).
      
      The stack snapshot is offline/cold, i.e. it isn't evaluated any further. This is
      useful for analyses as it prevents concurrent modifications.
      
      For technical details, please see Note [Stack Cloning].
      
      Co-authored-by: default avatarBen Gamari <bgamari.foss@gmail.com>
      Co-authored-by: default avatarMatthew Pickering <matthewtpickering@gmail.com>
      6f7f5990
  25. Jun 17, 2021
    • Matthew Pickering's avatar
      profiling: Look in RHS of rules for cost centre ticks · 01fd2617
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      There are some obscure situations where the RHS of a rule can contain a
      tick which is not mentioned anywhere else in the program. If this
      happens you end up with an obscure linker error. The solution is quite
      simple, traverse the RHS of rules to also look for ticks. It turned out
      to be easier to implement if the traversal was moved into CoreTidy
      rather than at the start of code generation because there we still had
      easy access to the rules.
      
      ./StreamD.o(.text+0x1b9f2): error: undefined reference to 'StreamK_mkStreamFromStream_HPC_cc'
      ./MArray.o(.text+0xbe83): error: undefined reference to 'StreamK_mkStreamFromStream_HPC_cc'
      Main.o(.text+0x6fdb): error: undefined reference to 'StreamK_mkStreamFromStream_HPC_cc'
      01fd2617
  26. Jun 05, 2021
  27. Apr 02, 2021
  28. Mar 10, 2021
  29. Mar 03, 2021
    • Matthew Pickering's avatar
      Add test for whereFrom# · db80a5cc
      Matthew Pickering authored
      db80a5cc
    • Matthew Pickering's avatar
      Profiling: Allow heap profiling to be controlled dynamically. · d89deeba
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This patch exposes three new functions in `GHC.Profiling` which allow
      heap profiling to be enabled and disabled dynamically.
      
      1. startHeapProfTimer - Starts heap profiling with the given RTS options
      2. stopHeapProfTimer  - Stops heap profiling
      3. requestHeapCensus  - Perform a heap census on the next context
                              switch, regardless of whether the timer is enabled or not.
      d89deeba
    • Sylvain Henry's avatar
      Fix array and cleanup conversion primops (#19026) · d8dc0f96
      Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
      The first change makes the array ones use the proper fixed-size types,
      which also means that just like before, they can be used without
      explicit conversions with the boxed sized types. (Before, it was Int# /
      Word# on both sides, now it is fixed sized on both sides).
      
      For the second change, don't use "extend" or "narrow" in some of the
      user-facing primops names for conversions.
      
        - Names like `narrowInt32#` are misleading when `Int` is 32-bits.
      
        - Names like `extendInt64#` are flat-out wrong when `Int is
          32-bits.
      
        - `narrow{Int,Word}<N>#` however map a type to itself, and so don't
          suffer from this problem. They are left as-is.
      
      These changes are batched together because Alex happend to use the array
      ops. We can only use released versions of Alex at this time, sadly, and
      I don't want to have to have a release thatwon't work for the final GHC
      9.2. So by combining these we get all the changes for Alex done at once.
      
      Bump hackage state in a few places, and also make that workflow slightly
      easier for the future.
      
      Bump minimum Alex version
      
      Bump Cabal, array, bytestring, containers, text, and binary submodules
      d8dc0f96
  30. Feb 17, 2021
  31. Dec 23, 2020
    • Andreas Klebinger's avatar
      Increase -A default to 4MB. · 553c59ca
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      This gives a small increase in performance under most circumstances.
      
      For single threaded GC the improvement is on the order of 1-2%.
      
      For multi threaded GC the results are quite noisy but seem to
      fall into the same ballpark.
      
      Fixes #16499
      553c59ca
  32. Nov 26, 2020
    • Moritz Angermann's avatar
      [Sized Cmm] properly retain sizes. · be5d74ca
      Moritz Angermann authored and Marge Bot's avatar Marge Bot committed
      
      This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int#  with
      Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us
      with properly sized primitives in the codegenerator instead of pretending
      they are all full machine words.
      
      This came up when implementing darwinpcs for arm64.  The darwinpcs reqires
      us to pack function argugments in excess of registers on the stack.  While
      most procedure call standards (pcs) assume arguments are just passed in
      8 byte slots; and thus the caller does not know the exact signature to make
      the call, darwinpcs requires us to adhere to the prototype, and thus have
      the correct sizes.  If we specify CInt in the FFI call, it should correspond
      to the C int, and not just be Word sized, when it's only half the size.
      
      This does change the expected output of T16402 but the new result is no
      less correct as it eliminates the narrowing (instead of the `and` as was
      previously done).
      
      Bumps the array, bytestring, text, and binary submodules.
      
      Co-Authored-By: default avatarBen Gamari <ben@well-typed.com>
      
      Metric Increase:
          T13701
          T14697
      be5d74ca
  33. Nov 21, 2020
    • Ben Gamari's avatar
      Introduce -fprof-callers flag · 53ad67ea
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      This introducing a new compiler flag to provide a convenient way to
      introduce profiler cost-centers on all occurrences of the named
      identifier.
      
      Closes #18566.
      53ad67ea
  34. Jul 11, 2020
    • Simon Peyton Jones's avatar
      Improve eta-expansion using ArityType · 2b7c71cb
      Simon Peyton Jones authored
      As #18355 shows, we were failing to preserve one-shot info when
      eta-expanding.  It's rather easy to fix, by using ArityType more,
      rather than just Arity.
      
      This patch is important to suport the one-shot monad trick;
      see #18202.  But the extra tracking of one-shot-ness requires
      the patch
      
         Define multiShotIO and use it in mkSplitUniqueSupply
      
      If that patch is missing, ths patch makes things worse in
      GHC.Types.Uniq.Supply.  With it, however, we see these improvements
      
          T3064     compiler bytes allocated -2.2%
          T3294     compiler bytes allocated -1.3%
          T12707    compiler bytes allocated -1.3%
          T13056    compiler bytes allocated -2.2%
      
      Metric Decrease:
          T3064
          T3294
          T12707
          T13056
      2b7c71cb
Loading