Skip to content
Snippets Groups Projects
  1. Apr 23, 2024
  2. Apr 21, 2024
  3. Apr 03, 2024
  4. Mar 06, 2024
    • Simon Peyton Jones's avatar
      Three compile perf improvements with deep nesting · 1e84b924
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      These were changes are all triggered by #24471.
      
      1. Make GHC.Core.Opt.SetLevels.lvlMFE behave better when there are
         many free variables.  See Note [Large free-variable sets].
      
      2. Make GHC.Core.Opt.Arity.floatIn a bit lazier in its Cost argument.
         This benefits the common case where the ArityType turns out to
         be nullary. See Note [Care with nested expressions]
      
      3. Make GHC.CoreToStg.Prep.cpeArg behave for deeply-nested
         expressions.  See Note [Eta expansion of arguments in CorePrep]
         wrinkle (EA2).
      
      Compile times go down by up to 4.5%, and much more in artificial
      cases. (Geo mean of compiler/perf changes is -0.4%.)
      
      Metric Decrease:
          CoOpt_Read
          T10421
          T12425
      1e84b924
  5. Feb 25, 2024
  6. Feb 07, 2024
    • 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
  7. Jan 20, 2024
  8. Jan 08, 2024
  9. Dec 13, 2023
  10. Dec 11, 2023
  11. Dec 08, 2023
  12. Dec 03, 2023
  13. Nov 30, 2023
  14. Nov 29, 2023
  15. Nov 27, 2023
    • Matthew Pickering's avatar
      testsuite: Add mechanism to collect generic metrics · b5213542
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      * Generalise the metric logic by adding an additional field which
        allows you to specify how to query for the actual value. Previously
        the method of querying the baseline value was abstracted (but always
        set to the same thing).
      
      * This requires rejigging how the stat collection works slightly but now
        it's more uniform and hopefully simpler.
      
      * Introduce some new "generic" helper functions for writing generic
        stats tests.
      
        - collect_size ( deviation, path )
          Record the size of the file as a metric
      
        - stat_from_file ( metric, deviation, path )
          Read a value from the given path, and store that as a metric
      
        - collect_generic_stat ( metric, deviation, get_stat)
          Provide your own `get_stat` function, `lambda way: <Int>`, which
          can be used to establish the current value of the metric.
      
        - collect_generic_stats ( metric_info ):
          Like collect_generic_stat but provide the whole dictionary of metric
          definitions.
      
          { metric: {
              deviation: <Int>
              current: lambda way: <Int>
              } }
      
      * Introduce two new "size" metrics for keeping track of build products.
          - `size_hello_obj` - The size of `hello.o` from compiling hello.hs
          - `libdir` - The total size of the `libdir` folder.
      
      * Track the number of modules in the AST tests
         - CountDepsAst
         - CountDepsParser
      
      This lays the infrastructure for #24191 #22256 #17129
      b5213542
  16. Nov 15, 2023
    • Rodrigo Mesquita's avatar
      testsuite: Skip MultiLayerModulesTH_Make on darwin · 929ba2f9
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      The recent toolchain upgrade on darwin machines resulted in the
      MultiLayerModulesTH_Make test metrics varying too much from the
      baseline, ultimately blocking the CI pipelines.
      
      This commit skips the test on darwin to temporarily avoid failures due
      to the environment change in the runners. However, the metrics
      divergence is being investigated still (tracked in #24177)
      929ba2f9
  17. Sep 30, 2023
    • Simon Peyton Jones's avatar
      Refactor to combine HsLam and HsLamCase · ef5342cd
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This MR is pure refactoring (#23916):
      * Combine `HsLam` and `HsLamCase`
      * Combine `HsCmdLam` and `HsCmdLamCase`
      
      This just arranges to treat uniformly
         \x -> e
         \case pi -> ei
         \cases pis -> ie
      
      In the exising code base the first is treated differently
      to the latter two.
      
      No change in behaviour.
      
      More specifics:
      
      * Combine `HsLam` and `HsLamCase` (constructors of `Language.Haskell.Syntax.Expr.HsExpr`) into one data construtor covering
        * Lambda
        * `\case`
        * `\cases`
      
      * The new `HsLam` has an argument of type `HsLamVariant` to distinguish the three cases.
      
      * Similarly, combine `HsCmdLam` and `HsCmdLamCase` (constructors of `Language.Haskell.Syntax.Expr.HsCmd` ) into one.
      
      * Similarly, combine `mkHsLamPV` and `mkHsLamCasePV` (methods of class `DisambECP`) into one. (Thank you Alan Zimmerman.)
      
      * Similarly, combine `LambdaExpr` and `LamCaseAlt` (constructors of `Language.Haskell.Syntax.Expr.HsMatchContext`) into one: `LamAlt` with a `HsLamVariant` argument.
      
      * Similarly, combine `KappaExpr` and `ArrowLamCaseAlt` (constructors of `Language.Haskell.Syntax.Expr.HsArrowMatchContext`) into one: `ArrowLamAlt` with a `HsLamVariant` argument.
      
      * Similarly, combine `PsErrLambdaInPat` and `PsErrLambdaCaseInPat` (constructors of `GHC.Parser.Errors.Ppr.PsError`) into one.
      
      * Similarly, combine `PsErrLambdaInPat` and `PsErrLambdaCaseInPat` (constructors of `GHC.Parser.Errors.Ppr.PsError`) into one.
      
      * In the same `PsError` data type, combine `PsErrLambdaCmdInFunAppCmd` and `PsErrLambdaCaseCmdInFunAppCmd` into one.
      
      * In the same `PsError` data tpye, combine `PsErrLambdaInFunAppExpr` and `PsErrLambdaCaseInFunAppExpr` into one.
      
      p* Smilarly combine `ExpectedFunTyLam` and `ExpectedFunTyLamCase` (constructors of `GHC.Tc.Types.Origin.ExpectedFunTyOrigin`) into one.
      
      Phew!
      ef5342cd
  18. Sep 13, 2023
    • Simon Peyton Jones's avatar
      Add -fno-cse to T15426 and T18964 · 98e7c1cf
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      This -fno-cse change is to avoid these performance tests depending on
      flukey CSE stuff.  Each contains several independent tests, and we don't
      want them to interact.
      
      See #23925.
      
      By killing CSE we expect a 400% increase in T15426, and 100% in T18964.
      
      Metric Increase:
          T15426
          T18964
      98e7c1cf
  19. Aug 28, 2023
  20. Aug 02, 2023
  21. Jul 05, 2023
    • Jaro Reinders's avatar
      Refactor Unique to be represented by Word64 · 9edcb1fb
      Jaro Reinders authored and Marge Bot's avatar Marge Bot committed
      In #22010 we established that Int was not always sufficient to store all
      the uniques we generate during compilation on 32-bit platforms. This
      commit addresses that problem by using Word64 instead of Int for
      uniques.
      
      The core of the change is in GHC.Core.Types.Unique and
      GHC.Core.Types.Unique.Supply. However, the representation of uniques is
      used in many other places, so those needed changes too. Additionally, the RTS
      has been extended with an atomic_inc64 operation.
      
      One major change from this commit is the introduction of the Word64Set and
      Word64Map data types. These are adapted versions of IntSet and IntMap
      from the containers package. These are planned to be upstreamed in the
      future.
      
      As a natural consequence of these changes, the compiler will be a bit
      slower and take more space on 32-bit platforms. Our CI tests indicate
      around a 5% residency increase.
      
      Metric Increase:
          CoOpt_Read
          CoOpt_Singletons
          LargeRecord
          ManyAlternatives
          ManyConstructors
          MultiComponentModules
          MultiComponentModulesRecomp
          MultiLayerModulesTH_OneShot
          RecordUpdPerf
          T10421
          T10547
          T12150
          T12227
          T12234
          T12425
          T12707
          T13035
          T13056
          T13253
          T13253-spj
          T13379
          T13386
          T13719
          T14683
          T14697
          T14766
          T15164
          T15703
          T16577
          T16875
          T17516
          T18140
          T18223
          T18282
          T18304
          T18698a
          T18698b
          T18923
          T1969
          T19695
          T20049
          T21839c
          T3064
          T3294
          T4801
          T5030
          T5321FD
          T5321Fun
          T5631
          T5642
          T5837
          T6048
          T783
          T8095
          T9020
          T9198
          T9233
          T9630
          T9675
          T9872a
          T9872b
          T9872b_defer
          T9872c
          T9872d
          T9961
          TcPlugin_RewritePerf
          UniqLoop
          WWRec
          hard_hole_fits
      9edcb1fb
  22. Jul 03, 2023
    • Alexis King's avatar
      perf tests: Increase default stack size for MultiLayerModules · 32741743
      Alexis King authored and Marge Bot's avatar Marge Bot committed
      An unhelpfully small stack size appears to have been the real culprit
      behind the metric fluctuations in #19293. Debugging metric decreases
      triggered by !10729 helped to finally identify the problem.
      
      Metric Decrease:
          MultiLayerModules
          MultiLayerModulesTH_Make
          T13701
          T14697
      32741743
  23. Jun 27, 2023
  24. Jun 20, 2023
  25. Jun 13, 2023
  26. May 26, 2023
    • Matthew Pickering's avatar
      error messages: Don't display ghci specific hints for missing packages · 34b44f7d
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Tickets like #22884 suggest that it is confusing that GHC used on the
      command line can suggest options which only work in GHCi.
      
      This ticket uses the error message infrastructure to override certain
      error messages which displayed GHCi specific information so that this
      information is only showed when using GHCi.
      
      The main annoyance is that we mostly want to display errors in the same
      way as before, but with some additional information. This means that the
      error rendering code has to be exported from the Iface/Errors/Ppr.hs
      module.
      
      I am unsure about whether the approach taken here is the best or most
      maintainable solution.
      
      Fixes #22884
      34b44f7d
  27. May 16, 2023
    • Zubin's avatar
      testsuite: add test for T22744 · 47a58150
      Zubin authored and Marge Bot's avatar Marge Bot committed
      This test checks for #22744 by compiling 100 modules which each have
      a dependency on 1000 distinct external files.
      
      Previously, when loading these interfaces from disk, each individual instance
      of a filepath in the interface will would be allocated as an individual object
      on the heap, meaning we have heap objects for 100*1000 files, when there are
      only 1000 distinct files we care about.
      
      This test checks this by first compiling the module normally, then measuring
      the peak memory usage in a no-op recompile, as the recompilation checking will
      force the allocation of all these filepaths.
      47a58150
  28. Apr 27, 2023
  29. Apr 18, 2023
    • Matthew Pickering's avatar
      Convert interface file loading errors into proper diagnostics · 5e1d33d7
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      This patch converts all the errors to do with loading interface files
      into proper structured diagnostics.
      
      * DriverMessage: Sometimes in the driver we attempt to load an interface
        file so we embed the IfaceMessage into the DriverMessage.
      * TcRnMessage: Most the time we are loading interface files during
        typechecking, so we embed the IfaceMessage
      
      This patch also removes the TcRnInterfaceLookupError constructor which
      is superceded by the IfaceMessage, which is now structured compared to
      just storing an SDoc before.
      5e1d33d7
  30. Mar 29, 2023
    • sheaf's avatar
      Handle records in the renamer · 3f374399
      sheaf authored
      This patch moves the field-based logic for disambiguating record updates
      to the renamer. The type-directed logic, scheduled for removal, remains
      in the typechecker.
      
      To do this properly (and fix the myriad of bugs surrounding the treatment
      of duplicate record fields), we took the following main steps:
      
        1. Create GREInfo, a renamer-level equivalent to TyThing which stores
           information pertinent to the renamer.
           This allows us to uniformly treat imported and local Names in the
           renamer, as described in Note [GREInfo].
      
        2. Remove GreName. Instead of a GlobalRdrElt storing GreNames, which
           distinguished between normal names and field names, we now store
           simple Names in GlobalRdrElt, along with the new GREInfo information
           which allows us to recover the FieldLabel for record fields.
      
        3. Add namespacing for record fields, within the OccNames themselves.
           This allows us to remove the mangling of duplicate field selectors.
      
           This change ensures we don't print mangled names to the user in
           error messages, and allows us to handle duplicate record fields
           in Template Haskell.
      
        4. Move record disambiguation to the renamer, and operate on the
           level of data constructors instead, to handle #21443.
      
           The error message text for ambiguous record updates has also been
           changed to reflect that type-directed disambiguation is on the way
           out.
      
      (3) means that OccEnv is now a bit more complex: we first key on the
      textual name, which gives an inner map keyed on NameSpace:
      
        OccEnv a ~ FastStringEnv (UniqFM NameSpace a)
      
      Note that this change, along with (2), both increase the memory residency
      of GlobalRdrEnv = OccEnv [GlobalRdrElt], which causes a few tests to
      regress somewhat in compile-time allocation.
      
      Even though (3) simplified a lot of code (in particular the treatment of
      field selectors within Template Haskell and in error messages), it came
      with one important wrinkle: in the situation of
      
        -- M.hs-boot
        module M where { data A; foo :: A -> Int }
        -- M.hs
        module M where { data A = MkA { foo :: Int } }
      
      we have that M.hs-boot exports a variable foo, which is supposed to match
      with the record field foo that M exports. To solve this issue, we add a
      new impedance-matching binding to M
      
        foo{var} = foo{fld}
      
      This mimics the logic that existed already for impedance-binding DFunIds,
      but getting it right was a bit tricky.
      See Note [Record field impedance matching] in GHC.Tc.Module.
      
      We also needed to be careful to avoid introducing space leaks in GHCi.
      So we dehydrate the GlobalRdrEnv before storing it anywhere, e.g. in
      ModIface. This means stubbing out all the GREInfo fields, with the
      function forceGlobalRdrEnv.
      When we read it back in, we rehydrate with rehydrateGlobalRdrEnv.
      This robustly avoids any space leaks caused by retaining old type
      environments.
      
      Fixes #13352 #14848 #17381 #17551 #19664 #21443 #21444 #21720 #21898 #21946 #21959 #22125 #22160 #23010 #23062 #23063
      
      Updates haddock submodule
      
      -------------------------
      Metric Increase:
          MultiComponentModules
          MultiLayerModules
          MultiLayerModulesDefsGhci
          MultiLayerModulesNoCode
          T13701
          T14697
          hard_hole_fits
      -------------------------
      3f374399
  31. Mar 08, 2023
  32. Mar 01, 2023
    • Sebastian Graf's avatar
      Revert the main payload of "Make `drop` and `dropWhile` fuse (#18964)" · a2a1a1c0
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      This reverts the bits affecting fusion of `drop` and `dropWhile` of commit
      0f7588b5 and keeps just the small refactoring
      unifying `flipSeqTake` and `flipSeqScanl'` into `flipSeq`.
      
      It also adds a new test for #23021 (which was the reason for reverting) as
      well as adds a clarifying comment to T18964.
      
      Fixes #23021, unfixes #18964.
      
      Metric Increase:
          T18964
      Metric Decrease:
          T18964
      a2a1a1c0
  33. Feb 02, 2023
    • jeffrey young's avatar
      CI: JavaScript backend runs testsuite · 394b91ce
      jeffrey young authored and Marge Bot's avatar Marge Bot committed
      This MR runs the testsuite for the JS backend. Note that this is a
      temporary solution until !9515 is merged.
      
      Key point: The CI runs hadrian on the built cross compiler _but not_ on
      the bindist.
      
      Other Highlights:
      
       - stm submodule gets a bump to mark tests as broken
       - several tests are marked as broken or are fixed by adding more
       - conditions to their test runner instance.
      
      List of working commit messages:
      
      CI: test cross target _and_ emulator
      
      CI: JS: Try run testsuite with hadrian
      
      JS.CI: cleanup and simplify hadrian invocation
      
      use single bracket, print info
      
      JS CI: remove call to test_compiler from hadrian
      
      don't build haddock
      
      JS: mark more tests as broken
      
      Tracked in ghc/ghc#22576
      
      JS testsuite: don't skip sum_mod test
      
      Its expected to fail, yet we skipped it which automatically makes it
      succeed leading to an unexpected success,
      
      JS testsuite: don't mark T12035j as skip
      
      leads to an unexpected pass
      
      JS testsuite: remove broken on T14075
      
      leads to unexpected pass
      
      JS testsuite: mark more tests as broken
      
      JS testsuite: mark T11760 in base as broken
      
      JS testsuite: mark ManyUnbSums broken
      
      submodules: bump process and hpc for JS tests
      
      Both submodules has needed tests skipped or marked broken for th JS
      backend. This commit now adds these changes to GHC.
      
      See:
      
      HPC: hpc/hpc!21
      
      Process: https://github.com/haskell/process/pull/268
      
      remove js_broken on now passing tests
      
      separate wasm and js backend ci
      
      test: T11760: add threaded, non-moving only_ways
      
      test: T10296a add req_c
      
      T13894: skip for JS backend
      
      tests: jspace, T22333: mark as js_broken(22573)
      
      test: T22513i mark as req_th
      
      stm submodule: mark stm055, T16707 broken for JS
      
      tests: js_broken(22374) on unpack_sums_6, T12010
      
      dont run diff on JS CI, cleanup
      
      fixup: More CI cleanup
      
      fix: align text to master
      
      fix: align exceptions submodule to master
      
      CI: Bump DOCKER_REV
      
      Bump to ci-images commit that has a deb11 build with node. Required for
      !9552
      
      testsuite: mark T22669 as js_skip
      
      See #22669
      
      This test tests that .o-boot files aren't created when run in using the
      interpreter backend. Thus this is not relevant for the JS backend.
      
      testsuite: mark T22671 as broken on JS
      
      See #22835
      
      base.testsuite: mark Chan002 fragile for JS
      
      see #22836
      
      revert: submodule process bump
      
      bump stm submodule
      
      New hash includes skips for the JS backend.
      
      testsuite: mark RnPatternSynonymFail broken on JS
      
      Requires TH:
       - see !9779
       - and #22261
      
      compiler: GHC.hs ifdef import Utils.Panic.Plain
      394b91ce
  34. Jan 24, 2023
  35. Jan 23, 2023
  36. Dec 24, 2022
    • Matthew Pickering's avatar
      Store RdrName rather than OccName in Holes · 6d62f6bf
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      In #20472 it was pointed out that you couldn't defer out of scope but
      the implementation collapsed a RdrName into an OccName to stuff it into
      a Hole. This leads to the error message for a deferred qualified name
      dropping the qualification which affects the quality of the error
      message.
      
      This commit adds a bit more structure to a hole, so a hole can replace a
      RdrName without losing information about what that RdrName was. This is
      important when printing error messages.
      
      I also added a test which checks the Template Haskell deferral of out of
      scope qualified names works properly.
      
      Fixes #22130
      6d62f6bf
  37. Dec 09, 2022
  38. Nov 29, 2022
  39. Nov 25, 2022
    • Vladislav Zavialov's avatar
      Print unticked promoted data constructors (#20531) · 13d627bb
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      
      Before this patch, GHC unconditionally printed ticks before promoted
      data constructors:
      
      	ghci> type T = True  -- unticked (user-written)
      	ghci> :kind! T
      	T :: Bool
      	= 'True              -- ticked (compiler output)
      
      After this patch, GHC prints ticks only when necessary:
      
      	ghci> type F = False    -- unticked (user-written)
      	ghci> :kind! F
      	F :: Bool
      	= False                 -- unticked (compiler output)
      
      	ghci> data False        -- introduce ambiguity
      	ghci> :kind! F
      	F :: Bool
      	= 'False                -- ticked by necessity (compiler output)
      
      The old behavior can be enabled by -fprint-redundant-promotion-ticks.
      
      Summary of changes:
      * Rename PrintUnqualified to NamePprCtx
      * Add QueryPromotionTick to it
      * Consult the GlobalRdrEnv to decide whether to print a tick (see mkPromTick)
      * Introduce -fprint-redundant-promotion-ticks
      
      Co-authored-by: default avatarArtyom Kuznetsov <hi@wzrd.ht>
      13d627bb
Loading