On CI

Josef Svenningsson josefs at fb.com
Fri Feb 19 10:40:29 UTC 2021


Doing "optimistic caching" like you suggest sounds very promising. A way to regain more robustness would be as follows.
If the build fails while building the libraries or the stage2 compiler, this might be a false negative due to the optimistic caching. Therefore, evict the "optimistic caches" and restart building the libraries. That way we can validate that the build failure was a true build failure and not just due to the aggressive caching scheme.

Just my 2p

Josef

________________________________
From: ghc-devs <ghc-devs-bounces at haskell.org> on behalf of Simon Peyton Jones via ghc-devs <ghc-devs at haskell.org>
Sent: Friday, February 19, 2021 8:57 AM
To: John Ericson <john.ericson at obsidian.systems>; ghc-devs <ghc-devs at haskell.org>
Subject: RE: On CI


  1.  Building and testing happen together. When tests failure spuriously, we also have to rebuild GHC in addition to re-running the tests. That's pure waste. https://gitlab.haskell.org/ghc/ghc/-/issues/13897<https://nam06.safelinks.protection.outlook.com/?url=https://gitlab.haskell.org/ghc/ghc/-/issues/13897&data=04|01|simonpj@microsoft.com|3d503922473f4cd0543f08d8d48522b2|72f988bf86f141af91ab2d7cd011db47|1|0|637493018301253098|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0=|3000&sdata=FG2fyYCXbacp69Q8Il6GE0aX+7ZLNkH1u84NA/VMjQc=&reserved=0> tracks this more or less.

I don’t get this.  We have to build GHC before we can test it, don’t we?

2 .  We don't cache between jobs.

This is, I think, the big one.   We endlessly build the exact same binaries.

There is a problem, though.  If we make *any* change in GHC, even a trivial refactoring, its binary will change slightly.  So now any caching build system will assume that anything built by that GHC must be rebuilt – we can’t use the cached version.  That includes all the libraries and the stage2 compiler.  So caching can save all the preliminaries (building the initial Cabal, and large chunk of stage1, since they are built with the same bootstrap compiler) but after that we are dead.

I don’t know any robust way out of this.  That small change in the source code of GHC might be trivial refactoring, or it might introduce a critical mis-compilation which we really want to see in its build products.

However, for smoke-testing MRs, on every architecture, we could perhaps cut corners.  (Leaving Marge to do full diligence.)  For example, we could declare that if we have the result of compiling library module X.hs with the stage1 GHC in the last full commit in master, then we can re-use that build product rather than compiling X.hs with the MR’s slightly modified stage1 GHC.  That *might* be wrong; but it’s usually right.

Anyway, there are big wins to be had here.

Simon







From: ghc-devs <ghc-devs-bounces at haskell.org> On Behalf Of John Ericson
Sent: 19 February 2021 03:19
To: ghc-devs <ghc-devs at haskell.org>
Subject: Re: On CI



I am also wary of us to deferring checking whole platforms and what not. I think that's just kicking the can down the road, and will result in more variance and uncertainty. It might be alright for those authoring PRs, but it will make Ben's job keeping the system running even more grueling.

Before getting into these complex trade-offs, I think we should focus on the cornerstone issue that CI isn't incremental.

  1.  Building and testing happen together. When tests failure spuriously, we also have to rebuild GHC in addition to re-running the tests. That's pure waste. https://gitlab.haskell.org/ghc/ghc/-/issues/13897<https://nam06.safelinks.protection.outlook.com/?url=https://gitlab.haskell.org/ghc/ghc/-/issues/13897&data=04|01|simonpj@microsoft.com|3d503922473f4cd0543f08d8d48522b2|72f988bf86f141af91ab2d7cd011db47|1|0|637493018301253098|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0=|3000&sdata=FG2fyYCXbacp69Q8Il6GE0aX+7ZLNkH1u84NA/VMjQc=&reserved=0> tracks this more or less.
  2.  We don't cache between jobs. Shake and Make do not enforce dependency soundness, nor cache-correctness when the build plan itself changes, and this had made this hard/impossible to do safely. Naively this only helps with stage 1 and not stage 2, but if we have separate stage 1 and --freeze1 stage 2 builds, both can be incremental. Yes, this is also lossy, but I only see it leading to false failures not false acceptances (if we can also test the stage 1 one), so I consider it safe. MRs that only work with a slow full build because ABI can so indicate.

The second, main part is quite hard to tackle, but I strongly believe incrementality is what we need most, and what we should remain focused on.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210219/24fb0a3f/attachment.html>


More information about the ghc-devs mailing list