haskell.compiler.ghc902Binary: bump LLVM by wrapping opt(1)#440271
haskell.compiler.ghc902Binary: bump LLVM by wrapping opt(1)#440271wolfgangwalther merged 2 commits intoNixOS:masterfrom
opt(1)#440271Conversation
4003084 to
5c5a469
Compare
|
I think we should target |
|
My inclination is actually the reverse: why not send those compiler drops to I know that It’s true that this PR will rebuild all the Haskell packages, due to patching the default GHC version, but the rebuilds should not be risky: the patches here only change the LLVM backend, which is not used for any Hydra platform for GHC ≥ 9.2; the main thing it is used for is to bootstrap 9.4 on AArch64, which I have shown results in essentially bit‐identical executable code. As long as the compilers bootstrap and function to a basic level, they shouldn’t regress anything that Hydra builds could catch in the first place, and that can be verified outside of Do you have an ETA for when the current |
Not all of them would be able to go to master, but not opposed in general. I already merged a bunch of uncontroversial drops to haskell-updates, but it should not be a problem to cherry-pick these back to master, too, I think. For example #440410 affects the bootstrap for darwin, so that must certainly go via haskell-updates (or staging, for that matter).
Yeah, I'm not worried about the rebuild introducing regressions, that looks fine.
Certainly not soon enough for your schedule, so that won't work out :)
Personally, I'd not be too worried about that, because from my experience Marking the LLVM backend broken temporarily would be an OK alternative for me.
I don't feel comfortable reviewing / approving this PR myself, I'm not deep enough into the whole business of building GHC, yet. Thus, I can't really judge this approach. I certainly want an approval from @sternenseemann before this one gets merged. In general, I think it would make most sense to try to drop as many of the GHC versions first and then figure out how to fix the remaining ones instead of the other way around. Now.. that ship has sailed, because you already did the work :D |
It seems like a good idea to me. I can rebase for such cherry‐picks, of course, regardless of the path chosen for these changes.
Then perhaps we shouldn’t specifically default to 9.4 solely for
OTOH, I did this work because I first raised dropping old GHCs last year and even with the new policy it has not seemed tractable to achieve sufficient velocity on that to not end up depending on otherwise‐unused LLVM versions indefinitely. These changes decouple all GHC versions from maintenance of LLVM < 19, without sacrifice in backend support, and so provide maximum freedom for Haskell maintainers to make decisions around version support without it having an effect on LLVM version support decisions (at least until we start looking at dropping LLVM 19, but it looked like the in‐flight changes to enable LLVM 20 aren’t very complex either). From discussion with @sternenseemann, it sounds like 9.4 is not going to get dropped until the issues Hadrian has with cross‐compiling GHCs are resolved, so making the bootstrap work there and patching it for newer LLVMs (to be able to cross‐compile a GHC for new platforms in the first place) is unavoidable. I would personally be happy to just mark the LLVM backend broken for versions above 9.4 and below 9.12, but most of the work here was just in corralling the patches required to fix 9.4; keeping the backend working for the intermediate versions is pretty cheap. Anyway, merging the The commit to patch the source releases for newer LLVMs could then be sent to |
Well, |
FWIW, the only hard deadline from my POV is whenever the 25.11 freeze gets scheduled for. But it would be convenient to be able to base further work on top of the cleaned‐up LLVM, to avoid rebasing the drop PR repeatedly, to not have to worry about reverting PRs that add dependencies on LLVMs that the authors don’t realize are actually already dead, etc., so I have a strong preference for at least not waiting more than one more |
|
@sternenseemann Thoughts on this approach? It would reduce the blocking part of the review here to just
|
|
I think we should merge this onto the fastest branch possible and then cherry pick the changes onto haskell-updates (or the other way around) so we get better visibility (though it is somewhat pointless since the problems are unlikely to become apparent on x86_64-linux) and avoid painful merge conflicts later. I would prefer not to break master if we can avoid it. We can of course split out the bindist changes and target staging (if you're using that for the LLVM changes as well). If we take too long reviewing the other batch of changes, so be it. |
To be clear, if we ignore 8.10 and 9.0 on AArch64 (which could be resolved by just merging their drops to Would you still prefer to go via |
This smells like https://gitlab.haskell.org/ghc/ghc/-/commit/ab533e711e60849fe4cde489644b71df71d3ca47 which I only discovered while reviewing this PR. |
Right we need that to remove 8.10.7. Didn't think about that. |
|
I meant the LLVM drops. But I don’t think the |
Sounds right; so GHC ≥ 9.10 need |
|
It’s tomorrow. Exactly as before on both Linux and Darwin for 9.4.8, so LLVM 20 works fine for this. I’d rather pursue something like #440794 than build 9.2, so from my POV this is ready to go. |
opt(1)
f13f81b to
dbffce6
Compare
|
This needs a rebase. |
These binary packages are available for a fixed set of platforms, all of which support the native code generator. Therefore, the `llvmPackages` argument was never used. We leave an assertion around, just in case.
Implement a wrapper script to translate the `opt(1)` arguments passed
by the GHC 9.0.2 binary distribution to the equivalent arguments
for the new LLVM pass manager passed by GHC ≥ 9.10 and our
soon‐to‐be‐patched compilers. This ensures that the bootstrap
of GHC 9.4 continues to work on AArch64.
On an earlier version of this change, I built `haskell.compiler.ghc948`
on both `aarch64-linux` and `aarch64-darwin`, and
`haskell.compiler.ghc924` on `aarch64-linux` only (it is already
broken on Darwin). I confirmed that we get functionally identical
store outputs before and after this change, modulo self‐references:
$ cp -a result-before/ before
$ cp -a result-after/ after
$ chmod -R +w before after
$ LANG=C find before -type f -exec \
remove-references-to \
-t $(readlink result-before) \
-t $(readlink result-before-doc) \
'{}' ';'
$ LANG=C find after -type f -exec \
remove-references-to \
-t $(readlink result-after) \
-t $(readlink result-after-doc) \
'{}' ';'
# Darwin only: normalize build user UIDs in the archive files…
$ LANG=C find before -name '*.a' -exec \
sed -i 's/ 360 / 351 /g' '{}' ';'
$ diff -r before after
# Linux only: the `package.cache` files differ, presumably due to
# an unrelated reproducibility issue.
Therefore, bumping this LLVM dependency did not affect the end result
of the bootstrap for the only compilers it is used for.
dbffce6 to
fb5a523
Compare
|
Done. |
|
Thank you! |
|
Thanks for the quick reviews and collaboration on this stuff! :) |
|
Hello, I just got back to Paris from NixCon and I noticed that the check nixpkgs/pkgs/by-name/fl/flac/package.nix Line 13 in 84e2411 now throws an error on LoongArch (and therefore also on RISC-V) instead of evaluating to false. The error message suggests that the assertion failed. This is also reproducible in |
| assert import ./common-have-ncg.nix { inherit lib stdenv version; }; | ||
|
|
There was a problem hiding this comment.
Right.. these asserts should not be placed at the top-level, otherwise they will prevent evaluating meta.available.
This assert could either be deferred until after meta (by putting in on some derivation argument instead) or the boolean returned by the import could be put in meta.broken instead?
There was a problem hiding this comment.
broken sounds like the way to go. Although frankly I can't imagine when we'd add other architectures for these that need LLVM without noticing that they don't work to do the bootstrap they're intended for, so I'm not sure how much value the check adds.
Can put up a PR in an hour or so.
|
Bisect says that 1bda5b1 |
If we don't explicitly pass something as LLVMAS, GHC >= 9.10 will try to invoke "clang" at runtime which fails. Upstream change: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12005 I've tested pkgsCross.armv7l-hf-multiplatform.buildPackages.haskell.compiler.ghc9102 which was reported to be failing here: NixOS#440271 (comment)
If we don't explicitly pass something as LLVMAS, GHC >= 9.10 will try to invoke "clang" at runtime which fails. Upstream change: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12005 I've tested pkgsCross.armv7l-hf-multiplatform.buildPackages.haskell.compiler.ghc9102 which was reported to be failing here: NixOS#440271 (comment)
Implement a wrapper script to translate the
opt(1)arguments passed by the GHC 9.0.2 binary distribution to the equivalent arguments for the new LLVM pass manager passed by GHC ≥ 9.10 and our soon‐to‐be‐patched compilers. This ensures that the bootstrap of GHC 9.4 continues to work on AArch64.On an earlier version of this change, I built
haskell.compiler.ghc948on bothaarch64-linuxandaarch64-darwin, andhaskell.compiler.ghc924onaarch64-linuxonly (it is already broken on Darwin). I confirmed that we get functionally identical store outputs before and after this change, modulo self‐references:Therefore, bumping this LLVM dependency did not affect the end result of the bootstrap for the only compilers it is used for.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.