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

Add support for ghc-9.6 #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TristanCacqueray
Copy link

This PR enables building the external-stg-interpreter with ghc-9.6.

This change fixes this compilation error:

  lib/Stg/Interpreter/PrimOp/Double.hs:126:22: error: [GHC-83865]
      • Couldn't match expected type ‘Int#’ with actual type ‘Int64#’
      • In the first argument of ‘I#’, namely ‘a’
        In the first argument of ‘Int64V’, namely ‘(I# a)’
        In the expression: Int64V (I# a)
      |
  126 |     pure [Int64V (I# a), IntV (I# b)]
@TristanCacqueray
Copy link
Author

Well the test needs more work because of the expected type 'Word64# with actual type 'Word#' error, but at least ghc-9.6 can now build the ext-stg-interpreter command.

@csabahruska
Copy link
Member

How did you compile it? Could you include a separate stack.yaml for 9.6 i.e. stack-ghc-9.6.yaml?

@TristanCacqueray
Copy link
Author

I used this nix flake to build the plugin and the interpreter: podenv/hspkgs@2adb3f0 . Though I haven't tried it yet, I only got a single modpack for my project, so I guess I need to rebuild the deps with the plugin or something. Anyway this PR just fixed the build. I can try building with stack, but not this week.

@TristanCacqueray
Copy link
Author

Well, as you can see in the flake, this also need luc-tielen/souffle-haskell#73 and david-christiansen/final-pretty-printer#7

@TristanCacqueray
Copy link
Author

Using this environment nix-shell -p bzip2 -p zlib -p gmp -p pkg-config -p gcc -p stack, then this command worked:

$ stack --stack-yaml ./stack-ghc-9.6.yaml  build
...
external-stg-interpreter> Installing executable run-stgi-testsuite in /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/.stack-work/install/x86_64-linux-tinfo6/197e998ecb915bff27c7671c9a996fab0a1d44f1f1533dd0bf7ddea2665028a6/9.6.2/bin
external-stg-interpreter> Installing library in /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/.stack-work/install/x86_64-linux-tinfo6/197e998ecb915bff27c7671c9a996fab0a1d44f1f1533dd0bf7ddea2665028a6/9.6.2/lib/x86_64-linux-ghc-9.6.2/external-stg-interpreter-0.1.0.1-5lt3ICzxcnq3EhO7oU26Ys
external-stg-interpreter> Installing executable ext-stg-interpreter in /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/.stack-work/install/x86_64-linux-tinfo6/197e998ecb915bff27c7671c9a996fab0a1d44f1f1533dd0bf7ddea2665028a6/9.6.2/bin
external-stg-interpreter> Registering library for external-stg-interpreter-0.1.0.1..

@TristanCacqueray
Copy link
Author

Here are the tests failures:

external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:174:76: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘popCnt64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely ‘(popCnt64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (popCnt64# (unboxWord a)))’
external-stg-interpreter>     |
external-stg-interpreter> 174 |         evalOp "popCnt64#" [WordV a] `shouldReturn` [WordV (W# (popCnt64# (unboxWord a)))]
external-stg-interpreter>     |                                                                            ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:194:72: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
external-stg-interpreter>     • In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(pdep64# (unboxWord a) (unboxWord b))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (pdep64# (unboxWord a) (unboxWord b)))’
external-stg-interpreter>       In the expression: WordV (W# (pdep64# (unboxWord a) (unboxWord b)))
external-stg-interpreter>     |
external-stg-interpreter> 194 |         evalOp "pdep64#" [WordV a, WordV b] `shouldReturn` [WordV (W# (pdep64# (unboxWord a) (unboxWord b)))]
external-stg-interpreter>     |                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:194:81: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘pdep64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(pdep64# (unboxWord a) (unboxWord b))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (pdep64# (unboxWord a) (unboxWord b)))’
external-stg-interpreter>     |
external-stg-interpreter> 194 |         evalOp "pdep64#" [WordV a, WordV b] `shouldReturn` [WordV (W# (pdep64# (unboxWord a) (unboxWord b)))]
external-stg-interpreter>     |                                                                                 ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:194:95: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the second argument of ‘pdep64#’, namely ‘(unboxWord b)’
external-stg-interpreter>       In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(pdep64# (unboxWord a) (unboxWord b))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (pdep64# (unboxWord a) (unboxWord b)))’
external-stg-interpreter>     |
external-stg-interpreter> 194 |         evalOp "pdep64#" [WordV a, WordV b] `shouldReturn` [WordV (W# (pdep64# (unboxWord a) (unboxWord b)))]
external-stg-interpreter>     |                                                                                               ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:214:72: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
external-stg-interpreter>     • In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(pext64# (unboxWord a) (unboxWord b))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (pext64# (unboxWord a) (unboxWord b)))’
external-stg-interpreter>       In the expression: WordV (W# (pext64# (unboxWord a) (unboxWord b)))
external-stg-interpreter>     |
external-stg-interpreter> 214 |         evalOp "pext64#" [WordV a, WordV b] `shouldReturn` [WordV (W# (pext64# (unboxWord a) (unboxWord b)))]
external-stg-interpreter>     |                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:214:81: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘pext64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(pext64# (unboxWord a) (unboxWord b))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (pext64# (unboxWord a) (unboxWord b)))’
external-stg-interpreter>     |
external-stg-interpreter> 214 |         evalOp "pext64#" [WordV a, WordV b] `shouldReturn` [WordV (W# (pext64# (unboxWord a) (unboxWord b)))]
external-stg-interpreter>     |                                                                                 ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:214:95: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the second argument of ‘pext64#’, namely ‘(unboxWord b)’
external-stg-interpreter>       In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(pext64# (unboxWord a) (unboxWord b))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (pext64# (unboxWord a) (unboxWord b)))’
external-stg-interpreter>     |
external-stg-interpreter> 214 |         evalOp "pext64#" [WordV a, WordV b] `shouldReturn` [WordV (W# (pext64# (unboxWord a) (unboxWord b)))]
external-stg-interpreter>     |                                                                                               ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:234:70: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘clz64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely ‘(clz64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (clz64# (unboxWord a)))’
external-stg-interpreter>     |
external-stg-interpreter> 234 |         evalOp "clz64#" [WordV a] `shouldReturn` [WordV (W# (clz64# (unboxWord a)))]
external-stg-interpreter>     |                                                                      ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:254:70: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘ctz64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely ‘(ctz64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (ctz64# (unboxWord a)))’
external-stg-interpreter>     |
external-stg-interpreter> 254 |         evalOp "ctz64#" [WordV a] `shouldReturn` [WordV (W# (ctz64# (unboxWord a)))]
external-stg-interpreter>     |                                                                      ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:270:67: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
external-stg-interpreter>     • In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(byteSwap64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (byteSwap64# (unboxWord a)))’
external-stg-interpreter>       In the expression: WordV (W# (byteSwap64# (unboxWord a)))
external-stg-interpreter>     |
external-stg-interpreter> 270 |         evalOp "byteSwap64#" [WordV a] `shouldReturn` [WordV (W# (byteSwap64# (unboxWord a)))]
external-stg-interpreter>     |                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:270:80: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘byteSwap64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely ‘(byteSwap64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (byteSwap64# (unboxWord a)))’
external-stg-interpreter>     |
external-stg-interpreter> 270 |         evalOp "byteSwap64#" [WordV a] `shouldReturn` [WordV (W# (byteSwap64# (unboxWord a)))]
external-stg-interpreter>     |                                                                                ^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:291:69: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word#’ with actual type ‘Word64#’
external-stg-interpreter>     • In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(bitReverse64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (bitReverse64# (unboxWord a)))’
external-stg-interpreter>       In the expression: WordV (W# (bitReverse64# (unboxWord a)))
external-stg-interpreter>     |
external-stg-interpreter> 291 |         evalOp "bitReverse64#" [WordV a] `shouldReturn` [WordV (W# (bitReverse64# (unboxWord a)))]
external-stg-interpreter>     |                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
external-stg-interpreter> 
external-stg-interpreter> /srv/github.com/grin-compiler/ghc-whole-program-compiler-project/external-stg-interpreter/test/PrimOp/WordSpec.hs:291:84: error: [GHC-83865]
external-stg-interpreter>     • Couldn't match expected type ‘Word64#’ with actual type ‘Word#’
external-stg-interpreter>     • In the first argument of ‘bitReverse64#’, namely ‘(unboxWord a)’
external-stg-interpreter>       In the first argument of ‘W#’, namely
external-stg-interpreter>         ‘(bitReverse64# (unboxWord a))’
external-stg-interpreter>       In the first argument of ‘WordV’, namely
external-stg-interpreter>         ‘(W# (bitReverse64# (unboxWord a)))’
external-stg-interpreter>     |
external-stg-interpreter> 291 |         evalOp "bitReverse64#" [WordV a] `shouldReturn` [WordV (W# (bitReverse64# (unboxWord a)))]
external-stg-interpreter>     |                                                                                    ^^^^^^^^^^^

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

Successfully merging this pull request may close these issues.

2 participants