grin-compiler / ghc-whole-program-compiler-project

GHC Whole Program Compiler and External STG IR tooling
116 stars 12 forks source link

Add support for ghc-9.6 #11

Open TristanCacqueray opened 1 year ago

TristanCacqueray commented 1 year ago

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

TristanCacqueray commented 1 year ago

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 commented 1 year ago

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

TristanCacqueray commented 1 year ago

I used this nix flake to build the plugin and the interpreter: https://github.com/podenv/hspkgs/commit/2adb3f0550d22f3e534211363f4c7ea46f753d6e . 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 commented 1 year ago

Well, as you can see in the flake, this also need https://github.com/luc-tielen/souffle-haskell/pull/73 and https://github.com/david-christiansen/final-pretty-printer/pull/7

TristanCacqueray commented 1 year ago

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 commented 1 year ago

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>     |                                                                                    ^^^^^^^^^^^