Skip to content
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

Enable building Clash against GHC 9.10 (copy #2758) #2790

Open
wants to merge 18 commits into
base: 1.8
Choose a base branch
from

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Aug 19, 2024

Add support for GHC 9.10

Currently, when building the Clash compiler against GHC 9.10 it will only work reliably on 64-bit platforms, and not so on 32-bit platforms. That's because we still use Int for our uniques, while GHC will use Word64, and we use fromIntegral to convert the Word64 to Int. Users on 32-bit platforms should use GHC 9.8 or older to compile the Clash compiler for now.

Once this is merged, open an issue to rethink our Unique story so that it works with GHC's changeover from Int to Word64 so that they have sufficient uniques on 32-bit platforms.

Still TODO:

  • Write a changelog entry (see changelog/README.md)
  • Check copyright notices are up to date in edited files

This is an automatic copy of pull request #2758 done by [Mergify](https://mergify.com).

Copy link
Author

mergify bot commented Aug 19, 2024

Cherry-pick of e702e9a has failed:

On branch mergify/copy/1.8/pr-2758
Your branch is up to date with 'origin/1.8'.

You are currently cherry-picking commit e702e9a7d.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   cabal.project
	modified:   clash-ffi/clash-ffi.cabal
	modified:   clash-prelude/clash-prelude.cabal
	modified:   clash-prelude/src/Clash/Class/BitPack/BitIndex.hs
	modified:   clash-prelude/src/Clash/Class/BitPack/Internal/TH.hs
	modified:   clash-prelude/src/Clash/Explicit/BlockRam/Blob.hs
	modified:   clash-prelude/src/Clash/Explicit/BlockRam/Internal.hs
	modified:   clash-prelude/src/Clash/Signal/Bundle/Internal.hs
	modified:   clash-prelude/src/Clash/Signal/Trace.hs
	modified:   clash-prelude/src/Clash/Sized/Internal/BitVector.hs
	modified:   clash-prelude/src/Clash/Sized/RTree.hs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   clash-cores/clash-cores.cabal
	both modified:   clash-ghc/clash-ghc.cabal
	both modified:   clash-lib/clash-lib.cabal
	both modified:   clash-prelude/src/Clash/Sized/Vector.hs

Cherry-pick of 1f8e765 has failed:

On branch mergify/copy/1.8/pr-2758
Your branch is ahead of 'origin/1.8' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit 1f8e7658b.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   clash-lib/src/Clash/Backend/Verilog.hs
	modified:   clash-lib/src/Clash/Core/EqSolver.hs
	modified:   clash-lib/src/Clash/Core/Evaluator/Types.hs
	modified:   clash-lib/src/Clash/Core/Term.hs
	modified:   clash-lib/src/Clash/Core/TyCon.hs
	modified:   clash-lib/src/Clash/Core/Type.hs
	modified:   clash-lib/src/Clash/Core/Util.hs
	modified:   clash-lib/src/Clash/Driver.hs
	modified:   clash-lib/src/Clash/Normalize/PrimitiveReductions.hs
	modified:   clash-lib/src/Clash/Normalize/Transformations/Case.hs
	modified:   clash-lib/src/Clash/Normalize/Util.hs
	modified:   clash-lib/src/Clash/Unique.hs
	modified:   clash-lib/src/Data/Aeson/Extra.hs

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   clash-lib/src/Clash/Core/TysPrim.hs

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot added the conflicts label Aug 19, 2024
This also introduces a new functions, fromGhcUnique, which
converts from GHC's Unique to Clash's Unique. This function is
used wherever we interact with Uniques we get from GHC.

(cherry picked from commit 1f8e765)
(cherry picked from commit b32dec8)
Used to implement dataToTag# in GHC 9.10

(cherry picked from commit 5fe9aea)
Type-level addition got moved from GHC.TypeNats to
GHC.TypeNats.Internal in GHC 9.10, so name-based
identifcation started failing.

(cherry picked from commit 3bded90)
As of GHC 9.10 it lives in GHC.Internal.Stack.Types

(cherry picked from commit dd0aeee)
As of GHC 9.10 the Tuple constructors now live in GHC.Tuple

(cherry picked from commit 5c2d9d6)
As of GHC 9.10, constraint tuples are no longer called (%,%),
but CTuple2

(cherry picked from commit 2a320e3)
In base-4.20 the type families were moved to
GHC.TypeNats.Internal, which the old code didn't match on.
Matching against uniques is far more stable.

(cherry picked from commit fcf6a33)
(cherry picked from commit 7691de5)
(cherry picked from commit a63eeaa)
(cherry picked from commit 1f6fca4)
This way we can just refer to "'patError" regardless of whether
it lives in:
- Control.Exceptions.Base, or
- GHC.Internal.Control.Exception.Base

(cherry picked from commit e565d26)
@kleinreact
Copy link
Contributor

The changes of 098380f may be a quick fix for the currently encountered error. I don't completely understand tough, why we didn't run into that one earlier already.

I can't test everything on CI without opening another PR, so just feel free to cherry pick it the changes for this one if you like them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants