-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHC 9.* #1233
GHC 9.* #1233
Conversation
There's a lot here that can be cleaned up, and we need some backward compatiblity layer, but this is just a first try. Something in the PrimeEC module is causing hard crashes during the test suite, so I'll have to figure out what's going on there.
a difference for the obeserved crash.
The first thing I notice when running the tests for this PR is the following, which looks ominous.
@RyanGlScott, any idea what's going on here? I don't know if this is a genuine GHC bug, or if I did a some kind of no-no. |
Minimizing further, we have:
This error appears quite deterministic, although the pointer value in the error message changes. |
Here is a minimal example that requires no external dependencies:
Luckily, someone else encountered this issue before we did: see GHC#19645. That has been fixed upstream, and the fix will be included in GHC 9.0.2. Indeed, if I use a
I'm not sure if there's a workaround for GHC#19645, so we may just have to wait until GHC 9.0.2 gets released before landing these changes. If you want to keep prototyping this branch in anticipation of 9.0.2, however, you may want to download a bindist from GHC's GitLab and develop with that until then. |
Thanks Ryan, that's very helpful. |
I think I'm going to shelve this for now and wait for the 9.0.2 release, or until we have a pressing need for the 9.* series (in which case a larger refactoring might be required). |
I hope you don't mind me pushing to your branch, @robdockins. I'm curious to see how the test suite fares now that GHC 9.0.2 is released. |
Happily, the GHC 9.0.2 CI job worked like a charm. Now we just need to figure out the best way to achieve backwards compatibility with older GHCs. |
Excellent news. |
I think we can abstract pretty much everything we need (which basically ends up being modular arithmetic primitives and a primality test) into a utility module and just select different implementations based on the GHC/base version. |
I've made an attempt to factor out all the compatibility shims into a |
GHC 9.0's pattern-match coverage checker is more clever and flags this guard as redundant: ``` [ 48 of 111] Compiling Cryptol.TypeCheck.SimpleSolver ( src/Cryptol/TypeCheck/SimpleSolver.hs, /tmp/ghc54946_0/ghc_169.o ) src/Cryptol/TypeCheck/SimpleSolver.hs:37:7: warning: [-Woverlapping-patterns] Pattern match is redundant In an equation for ‘dbg’: dbg msg x | False = ... | 37 | | False = ppTrace msg x | ^^^^^ ``` While true, we want to keep this code in to keep in from bitrotting. I have tweaked the code slightly so that it is just clever enough to defeat the pattern-match coverage checker.
I might have celebrated CI passing a bit too early. Although the jobs which build the |
I have a hunch that the reason the regression tests are stalling is because the |
This adopts the same approach as in commit 3ea5e9e: use `:set show-examples=false` in the affected examples to avoid showing the particular data that a solver picks for examples/counterexamples. Also avoid printing the contents of `it` for similar reasons. I have verified that the new output works across a wide range of Z3 versions. Fixes #1280.
The previous `what4-solvers` snapshot used Z3 4.8.10, which is known to cause severe performance regressions with the `negshift` regression test. See #1107. This updates to a more recent `what4-solvers` snapshot that uses Z3 4.8.14 instead, which is known to work more reliably with `negshift`.
Sure enough, upgrading to Z3 4.8.14 was enough to get the CI unstuck. Since the output of The CI is completely green now, so I'll mark this as ready for review. |
Well, I can't push the "approve" button since I initially authored this PR, but I think this looks good to me. |
This contains a variety of fixes needed to make the packages in the `saw-script` repo compile with GHC 9.0: * GHC 9.0 implements simplified subsumption (see [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0?version_id=5fcd0a50e0872efb3c38a32db140506da8310d87#simplified-subsumption)). This requires manually eta expanding some function applications to accommodate (see, for instance, the expansions of `getAllLLVM` in `SAWScript.Crucible.LLVM.MethodSpecIR`. * GHC's constraint solver now solves constraints in each top-level group sooner (see [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0?version_id=5fcd0a50e0872efb3c38a32db140506da8310d87#the-order-of-th-splices-is-more-important)). This affects `heapster-saw`, as it uses declaration splices extensively. I did some fairly involved rearranging of data type declarations and TH-generated instances to make everything typecheck. It's not exactly pretty, but it gets the job done. * GHC 9.0 now enables `-Wstar-is-type` in `-Wall`, so this patch replaces some uses of `*` with `Data.Kind.Type` in `saw-core-what4` and `crux-mir-comp`. `Data.Kind` requires the use of GHC 8.0 or later, so this patch also updates the lower bounds on `base` to `>= 4.9` in the appropriate `.cabal` files. (I'm fairly certain that this requirement was already present implicity, but better to be explicit about it.) * The upper version bounds on `base` in `saw-remote-api` were raised to allow it to build with `base-4.15.*`, which is bundled with GHC 9.0. * The `cryptol` submodule was bumped to incorporate the changes from GaloisInc/cryptol#1233, which allow it to build with GHC 9.0.
This contains a variety of fixes needed to make the packages in the `saw-script` repo compile with GHC 9.0: * GHC 9.0 implements simplified subsumption (see [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0?version_id=5fcd0a50e0872efb3c38a32db140506da8310d87#simplified-subsumption)). This requires manually eta expanding some function applications to accommodate (see, for instance, the expansions of `getAllLLVM` in `SAWScript.Crucible.LLVM.MethodSpecIR`. * GHC's constraint solver now solves constraints in each top-level group sooner (see [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.0?version_id=5fcd0a50e0872efb3c38a32db140506da8310d87#the-order-of-th-splices-is-more-important)). This affects `heapster-saw`, as it uses declaration splices extensively. I did some fairly involved rearranging of data type declarations and TH-generated instances to make everything typecheck. It's not exactly pretty, but it gets the job done. * GHC 9.0 now enables `-Wstar-is-type` in `-Wall`, so this patch replaces some uses of `*` with `Data.Kind.Type` in `saw-core-what4` and `crux-mir-comp`. `Data.Kind` requires the use of GHC 8.0 or later, so this patch also updates the lower bounds on `base` to `>= 4.9` in the appropriate `.cabal` files. (I'm fairly certain that this requirement was already present implicity, but better to be explicit about it.) * The upper version bounds on `base` in `saw-remote-api` were raised to allow it to build with `base-4.15.*`, which is bundled with GHC 9.0. * The `cryptol` submodule was bumped to incorporate the changes from GaloisInc/cryptol#1233, which allow it to build with GHC 9.0.
This PR is work-in-progress toward GHC 9 support. The main thing we have to deal with here are the changes to the BigNat and Integer types that came in the 9.* series. This rearranged and renamed some operations, and removed the primality testing operation altogether.
To keep compatibility across these changes, we will need some intermediate compatibility layer. For now, I'm just figuring out what changes need to be made; then we can work out the compatibility API we need afterward.