diff --git a/.ci/cabal.project.local b/.ci/cabal.project.local index 2117f6e9c7..c64b3a4a4f 100644 --- a/.ci/cabal.project.local +++ b/.ci/cabal.project.local @@ -10,7 +10,7 @@ package * package clash-prelude ghc-options: -Werror - flags: +doctests +multiple-hidden -workaround-ghc-mmap-crash + flags: +doctests +multiple-hidden tests: True benchmarks: True @@ -24,7 +24,6 @@ package clash-lib package clash-ghc ghc-options: -Werror - flags: -workaround-ghc-mmap-crash package clash-cosim ghc-options: -Werror @@ -48,7 +47,7 @@ package clash-lib-hedgehog package clash-testsuite ghc-options: -Werror -- enable cosim - flags: +cosim +multiple-hidden -workaround-ghc-mmap-crash + flags: +cosim +multiple-hidden package clash-benchmark ghc-options: -Werror diff --git a/.ci/gitlab/common.yml b/.ci/gitlab/common.yml index 4b310fae7c..c96a42548c 100644 --- a/.ci/gitlab/common.yml +++ b/.ci/gitlab/common.yml @@ -22,6 +22,7 @@ - export THREADS=$(./.ci/effective_cpus.sh) - export CABAL_JOBS=$(./.ci/effective_cpus.sh) - export CABAL_DIR=$HOME/.cabal + - if [[ "$WORKAROUND_GHC_MMAP_CRASH" == "yes" ]]; then export GHCRTS="-xm20000000"; fi - export - tar -xf cache.tar.zst -C / || true - .ci/setup.sh diff --git a/.ci/setup.sh b/.ci/setup.sh index a1e1e87c70..dd5014d5f5 100755 --- a/.ci/setup.sh +++ b/.ci/setup.sh @@ -78,10 +78,6 @@ if [ ! -f cabal.project.local ]; then fi set +u - if [[ "$WORKAROUND_GHC_MMAP_CRASH" == "yes" ]]; then - sed -i 's/-workaround-ghc-mmap-crash/+workaround-ghc-mmap-crash/g' cabal.project.local - fi - if [[ "$GHC_HEAD" == "yes" ]]; then cat .ci/cabal.project.local.append-HEAD >> cabal.project.local fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91da5e0846..a0dc1a422c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,7 +138,7 @@ jobs: CABAL_JOBS: 2 MULTIPLE_HIDDEN: ${{ matrix.multiple_hidden }} CI_COMMIT_BRANCH: ${{ github.base_ref }} - WORKAROUND_GHC_MMAP_CRASH: ${{ matrix.workaround_ghc_mmap_crash }} + GHCRTS: ${{ fromJSON('["","-xm20000000"]')[matrix.workaround_ghc_mmap_crash == 'yes'] }} steps: - name: Checkout diff --git a/benchmark/profiling/prepare/clash-profiling-prepare.cabal b/benchmark/profiling/prepare/clash-profiling-prepare.cabal index 033d38e57b..331b1c4b0e 100644 --- a/benchmark/profiling/prepare/clash-profiling-prepare.cabal +++ b/benchmark/profiling/prepare/clash-profiling-prepare.cabal @@ -26,7 +26,7 @@ library executable clash-profile-normalization-prepare main-is: profile-normalization-prepare.hs default-language: Haskell2010 - ghc-options: -Wall -Wcompat + ghc-options: -Wall -Wcompat -rtsopts build-depends: base, binary, bytestring, @@ -38,7 +38,7 @@ executable clash-profile-normalization-prepare executable clash-profile-netlist-prepare main-is: profile-netlist-prepare.hs default-language: Haskell2010 - ghc-options: -Wall -Wcompat + ghc-options: -Wall -Wcompat -rtsopts build-depends: base, binary, bytestring, diff --git a/benchmark/profiling/run/clash-profiling.cabal b/benchmark/profiling/run/clash-profiling.cabal index 6730b634e2..6b8fad1fc6 100644 --- a/benchmark/profiling/run/clash-profiling.cabal +++ b/benchmark/profiling/run/clash-profiling.cabal @@ -12,7 +12,7 @@ cabal-version: >=1.10 executable clash-profile-normalization-run main-is: profile-normalization-run.hs default-language: Haskell2010 - ghc-options: -O2 -Wall -Wcompat + ghc-options: -O2 -Wall -Wcompat -rtsopts build-depends: base, binary, bytestring, @@ -30,7 +30,7 @@ executable clash-profile-normalization-run executable clash-profile-netlist-run main-is: profile-netlist-run.hs default-language: Haskell2010 - ghc-options: -O2 -Wall -Wcompat + ghc-options: -O2 -Wall -Wcompat -rtsopts build-depends: base, binary, bytestring, diff --git a/clash-cores/clash-cores.cabal b/clash-cores/clash-cores.cabal index 1fec9e3c56..a68c375589 100644 --- a/clash-cores/clash-cores.cabal +++ b/clash-cores/clash-cores.cabal @@ -166,7 +166,7 @@ test-suite unittests hs-source-dirs: test type: exitcode-stdio-1.0 main-is: unittests.hs - + ghc-options: -rtsopts if !flag(unittests) buildable: False @@ -196,7 +196,7 @@ test-suite doctests type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: doctests.hs - ghc-options: -Wall -Wcompat -threaded + ghc-options: -Wall -Wcompat -threaded -rtsopts hs-source-dirs: test if !flag(doctests) diff --git a/clash-cosim/clash-cosim.cabal b/clash-cosim/clash-cosim.cabal index 839131b1ec..be9db377df 100644 --- a/clash-cosim/clash-cosim.cabal +++ b/clash-cosim/clash-cosim.cabal @@ -117,6 +117,6 @@ test-suite test tasty-hunit, tasty-quickcheck, template-haskell - ghc-options: -Wall -Wcompat + ghc-options: -Wall -Wcompat -rtsopts if flag(pedantic) ghc-options: -Werror diff --git a/clash-ffi/clash-ffi.cabal b/clash-ffi/clash-ffi.cabal index 0096bf7d0e..a3818bcf0c 100644 --- a/clash-ffi/clash-ffi.cabal +++ b/clash-ffi/clash-ffi.cabal @@ -91,6 +91,7 @@ executable ffi-interface-tests ExistentialQuantification hs-source-dirs: tests main-is: Main.hs + ghc-options: -rtsopts other-modules: Clash.FFI.Test Clash.FFI.Test.Instances diff --git a/clash-ghc/clash-ghc.cabal b/clash-ghc/clash-ghc.cabal index f1b8b33f61..85f4482fed 100644 --- a/clash-ghc/clash-ghc.cabal +++ b/clash-ghc/clash-ghc.cabal @@ -65,24 +65,12 @@ flag use-ghc-paths default: False manual: True -flag workaround-ghc-mmap-crash - description: - Only use this flag when hit by GHC bug #19421. See clash-compiler PR #2444. - default: False - manual: True - executable clash Main-Is: src-ghc/Batch.hs Build-Depends: base, clash-ghc - GHC-Options: -Wall -Wcompat -threaded -rtsopts + GHC-Options: -Wall -Wcompat -threaded -rtsopts -with-rtsopts=-A128m if flag(dynamic) GHC-Options: -dynamic - -- Note that multiple -with-rtsopts are not cumulative, so we can't add the - -- common RTS options in the unconditional GHC-Options - if flag(workaround-ghc-mmap-crash) - GHC-Options: "-with-rtsopts=-A128m -xm20000000" - else - GHC-Options: -with-rtsopts=-A128m extra-libraries: pthread default-language: Haskell2010 diff --git a/clash-lib/clash-lib.cabal b/clash-lib/clash-lib.cabal index f2aba365f5..789e682724 100644 --- a/clash-lib/clash-lib.cabal +++ b/clash-lib/clash-lib.cabal @@ -339,7 +339,7 @@ executable v16-upgrade-primitives directory, stringsearch, Glob - GHC-Options: -Wall -Wcompat + GHC-Options: -Wall -Wcompat -rtsopts default-language: Haskell2010 executable static-files @@ -352,7 +352,7 @@ executable static-files extra, filepath Other-Modules: Paths_clash_lib - GHC-Options: -Wall -Wcompat + GHC-Options: -Wall -Wcompat -rtsopts default-language: Haskell2010 if impl(ghc >= 9.2.0) buildable: False @@ -362,7 +362,7 @@ test-suite doctests type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: doctests.hs - ghc-options: -Wall -Wcompat -threaded + ghc-options: -Wall -Wcompat -threaded -rtsopts hs-source-dirs: tests if !flag(doctests) @@ -379,7 +379,7 @@ test-suite unittests type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: unittests.hs - ghc-options: -Wall -Wcompat -threaded -with-rtsopts=-N + ghc-options: -Wall -Wcompat -threaded -rtsopts -with-rtsopts=-N hs-source-dirs: tests if !flag(unittests) diff --git a/clash-prelude/clash-prelude.cabal b/clash-prelude/clash-prelude.cabal index f1d9109106..9c0e68f572 100644 --- a/clash-prelude/clash-prelude.cabal +++ b/clash-prelude/clash-prelude.cabal @@ -117,12 +117,6 @@ flag benchmarks default: True manual: True -flag workaround-ghc-mmap-crash - description: - Only use this flag when hit by GHC bug #19421. See clash-compiler PR #2444. - default: False - manual: True - common common-options default-language: Haskell2010 default-extensions: BangPatterns @@ -376,7 +370,7 @@ test-suite doctests type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: doctests.hs - ghc-options: -Wall -Wcompat -threaded + ghc-options: -Wall -Wcompat -threaded -rtsopts hs-source-dirs: tests if !flag(doctests) @@ -388,15 +382,11 @@ test-suite doctests doctest-parallel >= 0.2 && < 0.4, filepath - if flag(workaround-ghc-mmap-crash) - ghc-options: -with-rtsopts=-xm20000000 - - test-suite unittests import: common-options type: exitcode-stdio-1.0 main-is: unittests.hs - ghc-options: -Wall -Wcompat -threaded -with-rtsopts=-N + ghc-options: -Wall -Wcompat -threaded -rtsopts -with-rtsopts=-N hs-source-dirs: tests if !flag(unittests) @@ -462,7 +452,7 @@ benchmark benchmark-clash-prelude type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: benchmark-main.hs - ghc-options: -O2 -Wall + ghc-options: -O2 -Wall -rtsopts hs-source-dirs: benchmarks ghc-options: -with-rtsopts=-T diff --git a/clash-term/clash-term.cabal b/clash-term/clash-term.cabal index b3fcdb2e37..3c93cc6d80 100644 --- a/clash-term/clash-term.cabal +++ b/clash-term/clash-term.cabal @@ -30,7 +30,7 @@ executable clash-term bytestring >= 0.10.0.2 && < 0.12, rewrite-inspector == 0.1.0.11 - GHC-Options: -Wall -Wcompat -threaded + GHC-Options: -Wall -Wcompat -threaded -rtsopts extra-libraries: pthread default-language: Haskell2010 if os(windows) diff --git a/nix/overlay.nix b/nix/overlay.nix index 40274a9f60..4f573ae22f 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -103,8 +103,7 @@ let unmodified = hprev.callCabal2nixWithOptions "clash-ghc" - ../clash-ghc - "--flag workaround-ghc-mmap-crash" { + ../clash-ghc { inherit (hfinal) clash-lib clash-prelude; }; in @@ -139,7 +138,6 @@ let hprev.callCabal2nixWithOptions "clash-prelude" ../clash-prelude - "--flag workaround-ghc-mmap-crash" { }; clash-prelude-hedgehog = @@ -190,8 +188,7 @@ let unmodified = hprev.callCabal2nixWithOptions "clash-testsuite" - ../tests - "--flag workaround-ghc-mmap-crash" { + ../tests { inherit (hfinal) clash-cores clash-ghc clash-lib clash-prelude; }; in diff --git a/tests/clash-testsuite.cabal b/tests/clash-testsuite.cabal index 5c7aca3f75..451c2079e6 100644 --- a/tests/clash-testsuite.cabal +++ b/tests/clash-testsuite.cabal @@ -31,12 +31,6 @@ flag multiple-hidden default: True manual: True -flag workaround-ghc-mmap-crash - description: - Only use this flag when hit by GHC bug #19421. See clash-compiler PR #2444. - default: False - manual: True - common basic-config default-language: Haskell2010 ghc-options: -Wall -Wcompat @@ -92,9 +86,6 @@ common basic-config if flag(multiple-hidden) cpp-options: -DCLASH_MULTIPLE_HIDDEN - if flag(workaround-ghc-mmap-crash) - cpp-options: -DCLASH_WORKAROUND_GHC_MMAP_CRASH - library import: basic-config hs-source-dirs: @@ -145,6 +136,7 @@ library executable clash-testsuite import: basic-config main-is: Main.hs + ghc-options: -rtsopts build-tool-depends: clash-ghc:clash