Skip to content
Snippets Groups Projects
  1. Feb 07, 2024
    • jeffrey young's avatar
      ts: add wasm_arch, heapprof002 wasm extension · 75a31379
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      75a31379
    • jeffrey young's avatar
      ts: add compile_artifact, ignore_extension flag · 569b4c10
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      In b5213542 the testsuite gained the
      capability to collect generic metrics. But this assumed that the test
      was not linking and producing artifacts and we only wanted to track
      object files, interface files, or build artifacts from the compiler
      build. However, some backends, such as the JS backend, produce artifacts when
      compiling, such as the jsexe directory which we want to track.
      
      This patch:
      
      - tweaks the testsuite to collect generic metrics on any build artifact
      in the test directory.
      
      - expands the exe_extension function to consider windows and adds the
      ignore_extension flag.
      
      - Modifies certain tests to add the ignore_extension flag. Tests such as
      heaprof002 expect a .ps file, but on windows without ignore_extensions
      the testsuite will look for foo.exe.ps. Hence the flag.
      
      - adds the size_hello_artifact test
      569b4c10
  2. Feb 03, 2024
    • Apoorv Ingle's avatar
      Expand `do` blocks right before typechecking using the `HsExpansion` philosophy. · 5ff7cc26
      Apoorv Ingle authored
      - Fixes #18324 #20020 #23147 #22788 #15598 #22086 #21206
      
      - The change is detailed in
        - Note [Expanding HsDo with HsExpansion] in `GHC.Tc.Gen.Do`
        - Note [Doing HsExpansion in the Renamer vs Typechecker] in `GHC.Rename.Expr`
               expains the rational of doing expansions in type checker as opposed to in the renamer
      
      - Adds new datatypes:
        - `GHC.Hs.Expr.XXExprGhcRn`: new datatype makes this expansion work easier
          1. Expansion bits for Expressions, Statements and Patterns in (`ExpandedThingRn`)
          2. `PopErrCtxt` a special GhcRn Phase only artifcat to pop the previous error message in the error context stack
      
        - `GHC.Basic.Origin` now tracks the reason for expansion in case of Generated
          This is useful for type checking cf. `GHC.Tc.Gen.Expr.tcExpr` case for `HsLam`
      
        - Kills `HsExpansion` and `HsExpanded` as we have inlined them in `XXExprGhcRn` and `XXExprGhcTc`
      
      - Ensures warnings such as
        1. Pattern match checks
        2. Failable patterns
        3. non-() return in body statements are preserved
      
      - Kill `HsMatchCtxt` in favor of `TcMatchAltChecker`
      
      - Testcases:
        * T18324 T20020 T23147 T22788 T15598 T22086
        * T23147b (error message check),
        * DoubleMatch (match inside a match for pmc check)
        * pattern-fails (check pattern match with non-refutable pattern, eg. newtype)
        * Simple-rec (rec statements inside do statment)
        * T22788 (code snippet from #22788)
        * DoExpanion1 (Error messages for body statments)
        * DoExpansion2 (Error messages for bind statements)
        * DoExpansion3 (Error messages for let statements)
      
      Also repoint haddock to the right submodule so that the test (haddockHypsrcTest) pass
      
      Metric Increase 'compile_time/bytes allocated':
          T9020
      
      The testcase is a pathalogical example of a `do`-block with many statements that do nothing.
      Given that we are expanding the statements into function binds, we will have to bear
      a (small) 2% cost upfront in the compiler to unroll the statements.
      5ff7cc26
  3. Jan 20, 2024
  4. Nov 26, 2023
    • Alan Zimmerman's avatar
      EPA: Remove EpAnnNotUsed · 7902ebf8
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      We no longer need the EpAnnNotUsed constructor for EpAnn, as we can
      represent an unused annotation with an anchor having a EpaDelta of
      zero, and empty comments and annotations.
      
      This simplifies code handling annotations considerably.
      
      Updates haddock submodule
      
      Metric Increase:
          parsing001
      7902ebf8
  5. Sep 01, 2023
  6. Aug 24, 2023
    • Finley McIlwaine's avatar
      Add a test checking overhead of -finfo-table-map · d3e0124c
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      We want to make sure we don't end up with poor codegen performance resulting from
      -finfo-table-map again as in #23103. This test adds a performance test tracking
      total allocations while compiling ExactPrint with -finfo-table-map.
      d3e0124c
  7. Jun 13, 2023
  8. May 06, 2023
  9. Apr 27, 2023
  10. Nov 29, 2022
  11. Oct 12, 2022
  12. 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
  13. 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
  14. Jul 26, 2022
  15. Jul 13, 2022
  16. 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
  17. 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
  18. May 24, 2022
  19. May 09, 2022
  20. May 04, 2022
  21. Apr 08, 2022
  22. Apr 01, 2022
  23. Mar 12, 2022
  24. Feb 10, 2022
  25. 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
  26. Jan 30, 2022
  27. Jan 26, 2022
  28. Jan 14, 2022
  29. 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
  30. 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
  31. 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
  32. Jun 05, 2021
  33. Apr 02, 2021
  34. Mar 10, 2021
  35. Mar 03, 2021
Loading