... | ... | @@ -66,7 +66,7 @@ In the meantime, here are some good sources for test code: |
|
|
|
|
|
- **Turn on profiling**
|
|
|
|
|
|
Register pressure increases significantly when the module is compiled with profiling. [checkSpills.report](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.report)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.report) gives tuples of `(spills, reloads, reg-reg-moves)` present in output code generated by the three algorithms when compiled with `-O2 -prof`. Left to right are the stats for the linear, graph coloring and iterative coalescing algorithms. Note that most modules compile with no spill/reloads inserted, but a few (notably `real/compress2/Encode`) need several hundred.
|
|
|
Register pressure increases significantly when the module is compiled with profiling. [checkSpills.report](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.report) gives tuples of `(spills, reloads, reg-reg-moves)` present in output code generated by the three algorithms when compiled with `-O2 -prof`. Left to right are the stats for the linear, graph coloring and iterative coalescing algorithms. Note that most modules compile with no spill/reloads inserted, but a few (notably `real/compress2/Encode`) need several hundred.
|
|
|
|
|
|
* I've found it useful to maintain three darcs repos when working on the allocator. `ghc-HEAD-work` compiled with `-Onot` for fast compilation during hacking, `ghc-HEAD-prof` for testing with profiling turned on, and `ghc-HEAD-validate` for running the validate script. Patches are created in `work`, pushed into `prof` where `checkSpills` is used to compile the nofib benchmarks with the most register pressure. Once we're happy that the performance is ok, the patch is then pushed into `validate` for validation before pushing to the main repo on `darcs.haskell.org`
|
|
|
|
... | ... | @@ -115,12 +115,12 @@ circo -Tpng niceGraph.dot -o niceGraph.png |
|
|
|
|
|
* Here's two from `nofib/real/compress2/Encode` compiled with `-O2 -prof`:
|
|
|
|
|
|
* [graph.dot](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph.dot)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph.dot) -\> [graph.png](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph.png)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph.png)
|
|
|
* [graph.dot](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph.dot) -\> [graph.png](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph.png)
|
|
|
|
|
|
* [graph-colored.dot](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph-colored.dot)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph-colored.dot) -\> [graph-colored.png](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph-colored.png)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph-colored.png)
|
|
|
* [graph-colored.dot](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph-colored.dot) -\> [graph-colored.png](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/graph-colored.png)
|
|
|
|
|
|
- **checkSpills**
|
|
|
[checkSpills.hs](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.hs)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.hs) is a nasty, throw away script which can be used to automate the comparison of allocation algorithms. Copy it and a list of test like [checkSpills.tests](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.tests)[](/trac/ghc/raw-attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.tests) to the top level nofib directory, compile and run. It will build the nofib benchmarks in the list 6 times each, once each with each of the allocators to extract spill counts, and then once again to get compile timings which are unperterbed by the space leaks introduced by compiling with debugging turned on. It's only needed if you're hacking on the allocator, parses the nofib make output directly, and is likely to rot - which is why it isn't included in the main source tree.
|
|
|
[checkSpills.hs](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.hs) is a nasty, throw away script which can be used to automate the comparison of allocation algorithms. Copy it and a list of test like [checkSpills.tests](/trac/ghc/attachment/wiki/Commentary/Compiler/Backends/NCG/RegisterAllocator/checkSpills.tests) to the top level nofib directory, compile and run. It will build the nofib benchmarks in the list 6 times each, once each with each of the allocators to extract spill counts, and then once again to get compile timings which are unperterbed by the space leaks introduced by compiling with debugging turned on. It's only needed if you're hacking on the allocator, parses the nofib make output directly, and is likely to rot - which is why it isn't included in the main source tree.
|
|
|
|
|
|
## Runtime performance
|
|
|
|
... | ... | |