-
-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Share ModuleGraphs for all files (#3232)
* Remove GetDependencyInformation in favour of GetModuleGraph. Computing and storing GetDependencyInformation for each file essentially individually means that we perform downsweep on each file individually, wasting a lot of work and using an excessive amount of memory to store all these duplicated graphs individually. However, we already have the `GetModuleGraph` rule, which we need to compute before compiling files any way due to being depended on by `NeedsCompilation`, which needs to know if any reverse dependencies of the module we are compiling requires TH, which meant that each file already depends on the results of downsweep for the whole project. Instead, we can compute the whole graph once when we execute the `GetModuleGraph` rule and even use this inside `HscEnv.hsc_mod_graph` to avoid reconstructing the `ModuleGraph` on each invocation of `GhcSessionDeps`. There may be concerns about excessive build churn due to any change to the result of `GetModuleGraph` invalidating the result of `GhcSessionDeps` too often, but note that this only happens when something in the header of a module changes, and this could be solved easily be re-introducing a version of `GetDependencyInformation` with early cutoff that essentially returns the result of `GetModuleGraph` but includes the hash of only the `ModSummary`s in the downward dependency closure of the file. * module graph early cutoff early cutoff for eval plugin * allow running benchmarks on examples generated via a script * Add new benchmarks to config * Allow pathToId to fail * Errors --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
202295b
commit 9effc56
Showing
13 changed files
with
363 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
# Generate $DEPTH layers of modules with $WIDTH modules on each layer | ||
# Every module on layer N imports all the modules on layer N-1 | ||
# MultiLayerModules.hs imports all the modules from the last layer | ||
DEPTH=15 | ||
WIDTH=40 | ||
cat >hie.yaml << EOF | ||
cradle: | ||
direct: | ||
arguments: | ||
EOF | ||
for i in $(seq -w 1 $WIDTH); do | ||
echo "module DummyLevel0M$i where" > DummyLevel0M$i.hs; | ||
echo " - DummyLevel0M$i.hs" >> hie.yaml; | ||
done | ||
for l in $(seq 1 $DEPTH); do | ||
for i in $(seq -w 1 $WIDTH); do | ||
echo "module DummyLevel${l}M$i where" > DummyLevel${l}M$i.hs; | ||
echo " - DummyLevel${l}M$i.hs" >> hie.yaml; | ||
for j in $(seq -w 1 $WIDTH); do | ||
echo "import DummyLevel$((l-1))M$j" >> DummyLevel${l}M$i.hs; | ||
done | ||
done | ||
done | ||
case "$1" in | ||
'--th') | ||
echo "{-# LANGUAGE TemplateHaskell #-}" > MultiLayerModules.hs | ||
;; | ||
esac | ||
echo "module MultiLayerModules where" >> MultiLayerModules.hs | ||
echo " - MultiLayerModules.hs" >> hie.yaml; | ||
for j in $(seq -w 1 $WIDTH); do | ||
echo "import DummyLevel${DEPTH}M$j" >> MultiLayerModules.hs; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.