diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2019-03-15 17:06:21 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-20 20:04:49 -0400 |
commit | 646e3dc20ebe25baae898a6b22895ddd015fc975 (patch) | |
tree | be77fe6e65c116b2cfaa6f78ee4f25c92a278d28 | |
parent | 505c5ab2b9d9d4ac721d1a6fea020e0886c02eff (diff) | |
download | haskell-646e3dc20ebe25baae898a6b22895ddd015fc975.tar.gz |
Add a bench flavour to Hadrian
-rw-r--r-- | hadrian/doc/flavours.md | 54 | ||||
-rw-r--r-- | hadrian/hadrian.cabal | 1 | ||||
-rwxr-xr-x | hadrian/src/Settings.hs | 7 | ||||
-rw-r--r-- | hadrian/src/Settings/Flavours/Benchmark.hs | 24 | ||||
-rw-r--r-- | hadrian/src/Settings/Flavours/Llvm.hs | 5 |
5 files changed, 53 insertions, 38 deletions
diff --git a/hadrian/doc/flavours.md b/hadrian/doc/flavours.md index 7b89637f79..45479f8f68 100644 --- a/hadrian/doc/flavours.md +++ b/hadrian/doc/flavours.md @@ -88,6 +88,17 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH <td>-O</td> </tr> <tr> + <th>bench</td> + <td>-O<br>-H64m</td> + <td>-O<br>-H64m</td> + <td></td> + <td>-O2</td> + <td>-O2</td> + <td>-O0</td> + <td>-O2</td> + <td>-O2</td> + </tr> + <tr> <th>devel1</td> <td>-O<br>-H64m</td> <td>-O<br>-H64m</td> @@ -109,41 +120,16 @@ when compiling the `compiler` library, and `hsGhc` when compiling/linking the GH <td></td> <td>-O0<br>-DDEBUG</td> </tr> - <tr> - <th>quick-llvm</td> - <td>-O0<br>-H64m<br>-fllvm</td> - <td>-O0<br>-H64m<br>-fllvm</td> - <td></td> - <td>-O</td> - <td>-O</td> - <td></td> - <td>-O</td> - <td></td> - </tr> - <tr> - <th>perf-llvm</td> - <td>-O<br>-H64m<br>-fllvm</td> - <td>-O<br>-H64m<br>-fllvm</td> - <td></td> - <td>-O2</td> - <td>-O</td> - <td>-O2</td> - <td>-O</td> - <td>-O2</td> - </tr> - <tr> - <th>prof-llvm</td> - <td>-O0<br>-H64m<br>-fllvm</td> - <td>-O0<br>-H64m<br>-fllvm</td> - <td></td> - <td>-O</td> - <td>-O</td> - <td>-O</td> - <td>-O</td> - <td>-O</td> - </tr> </table> +### LLVM variants + +In addition to the above, there are LLVM variants for the flavours `quick`, +`prof`, `perf` and `bench`, available by appending a `-llvm` suffix (i.e., +`quick-llvm` for the LLVM variant of `quick`). These differ only in that there +is an additional `-fllvm` flag in `hsDefault` when the stage0 compiler is GHC. +See `src/Settings/Flavours/Llvm.hs` for details. + ## Ways Libraries and GHC can be built in different _ways_, e.g. with or without profiling @@ -197,7 +183,7 @@ information. The following table lists ways that are built in different flavours <td>No</td> </tr> <tr> - <th>quickest</th> + <th>quickest<br>bench</th> <td>vanilla</td> <td>vanilla</td> <td>vanilla<br>threaded</td> diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal index 266602fecc..af1dccbc9b 100644 --- a/hadrian/hadrian.cabal +++ b/hadrian/hadrian.cabal @@ -89,6 +89,7 @@ executable hadrian , Settings.Builders.RunTest , Settings.Builders.Xelatex , Settings.Default + , Settings.Flavours.Benchmark , Settings.Flavours.Common , Settings.Flavours.Development , Settings.Flavours.Llvm diff --git a/hadrian/src/Settings.hs b/hadrian/src/Settings.hs index 3089c0a4e6..721152c85e 100755 --- a/hadrian/src/Settings.hs +++ b/hadrian/src/Settings.hs @@ -11,6 +11,7 @@ import Packages import UserSettings (userFlavours, userPackages, userDefaultFlavour) import {-# SOURCE #-} Settings.Default +import Settings.Flavours.Benchmark import Settings.Flavours.Development import Settings.Flavours.Llvm import Settings.Flavours.Performance @@ -36,9 +37,9 @@ stagePackages stage = do hadrianFlavours :: [Flavour] hadrianFlavours = - [ defaultFlavour, developmentFlavour Stage1, developmentFlavour Stage2 - , performanceFlavour, profiledFlavour, quickFlavour, quickestFlavour - , quickCrossFlavour + [ benchmarkFlavour, defaultFlavour, developmentFlavour Stage1 + , developmentFlavour Stage2, performanceFlavour, profiledFlavour + , quickFlavour, quickestFlavour, quickCrossFlavour, benchmarkLlvmFlavour , performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour , ghcInGhciFlavour ] diff --git a/hadrian/src/Settings/Flavours/Benchmark.hs b/hadrian/src/Settings/Flavours/Benchmark.hs new file mode 100644 index 0000000000..fc7a87c0ae --- /dev/null +++ b/hadrian/src/Settings/Flavours/Benchmark.hs @@ -0,0 +1,24 @@ +module Settings.Flavours.Benchmark (benchmarkFlavour) where + +import Expression +import Flavour +import {-# SOURCE #-} Settings.Default + +-- Please update doc/flavours.md when changing this file. +benchmarkFlavour :: Flavour +benchmarkFlavour = defaultFlavour + { name = "bench" + , args = defaultBuilderArgs <> benchmarkArgs <> defaultPackageArgs + , libraryWays = pure [vanilla] + , rtsWays = pure [vanilla, threaded] } + +benchmarkArgs :: Args +benchmarkArgs = sourceArgs SourceArgs + { hsDefault = pure ["-O", "-H64m"] + , hsLibrary = pure ["-O2"] + -- TODO: We should really pass -O2 when notStage0. Otherwise, we aren't + -- really measuring the overhead of a potential new optimisation we want + -- to benchmark. This has to happen in sync with the Makefile build, though. + , hsCompiler = mconcat [stage0 ? arg "-O2", notStage0 ? arg "-O0"] + , hsGhc = pure ["-O2"] } + diff --git a/hadrian/src/Settings/Flavours/Llvm.hs b/hadrian/src/Settings/Flavours/Llvm.hs index 2752c9e7c6..ddf07a248d 100644 --- a/hadrian/src/Settings/Flavours/Llvm.hs +++ b/hadrian/src/Settings/Flavours/Llvm.hs @@ -1,4 +1,5 @@ module Settings.Flavours.Llvm ( + benchmarkLlvmFlavour, performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour, @@ -7,12 +8,14 @@ module Settings.Flavours.Llvm ( import Expression import Flavour +import Settings.Flavours.Benchmark import Settings.Flavours.Performance import Settings.Flavours.Profiled import Settings.Flavours.Quick -- Please update doc/flavours.md when changing this file. -performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour :: Flavour +benchmarkLlvmFlavour, performanceLlvmFlavour, profiledLlvmFlavour, quickLlvmFlavour :: Flavour +benchmarkLlvmFlavour = mkLlvmFlavour benchmarkFlavour performanceLlvmFlavour = mkLlvmFlavour performanceFlavour profiledLlvmFlavour = mkLlvmFlavour profiledFlavour quickLlvmFlavour = mkLlvmFlavour quickFlavour |