ANNOUNCE: ghc-gc-tune: a tool for analyzing the impact of GC flags

Inspired by a comment by Simon Marlow on Stack Overflow, about the time and space tradeoffs we make with garbage collection, particularly with a generational GCs, I wrote a small program, ghc-gc-tune, to traverse the garbage collector variable space, to see the relationship between settings and program performance. Given a program, it will show you an (optionally interactive) graph of how -A and -H flags to the garbage collector affect performance. http://donsbot.wordpress.com/2010/07/05/ghc-gc-tune-tuning-haskell-gc-settin... Feedback and patches welcome! -- Don

Don, Thank you for a new tool and great blog post ! I will surely use it. You might be interested by the experiments section of a paper that we submitted to the Haskell Symposium with Simon Marlow and Satnam Singh : http://membres-liglab.imag.fr/termier/HLCM/hlcm.pdf We studied the impact of GC parameters on runtime, on a complex parallel data mining program. We show that correct GC settings are really important for good parallel performance, with a runtimes that can be 5x faster. I think this could interest everyone who want to squeeze up the most of their parallel Haskell programs. Regards, Alexandre -- _____________________________________________________________ Alexandre Termier LIG (Laboratoire d'Informatique de Grenoble) Université Joseph Fourier 681 rue de la Passerelle B.P. 72, 38402 Saint Martin d'Hères (FRANCE) Phone: +33 4 76 82 72 07 Fax: +33 4 76 82 72 87 http://membres-liglab.imag.fr/termier/ _____________________________________________________________ On 06/07/2010 02:46, Don Stewart wrote:
Inspired by a comment by Simon Marlow on Stack Overflow, about the time and space tradeoffs we make with garbage collection, particularly with a generational GCs, I wrote a small program, ghc-gc-tune, to traverse the garbage collector variable space, to see the relationship between settings and program performance. Given a program, it will show you an (optionally interactive) graph of how -A and -H flags to the garbage collector affect performance.
http://donsbot.wordpress.com/2010/07/05/ghc-gc-tune-tuning-haskell-gc-settin...
Feedback and patches welcome!
-- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Mon, Jul 5, 2010 at 5:46 PM, Don Stewart
Feedback and patches welcome!
Interesting. Could this be combined with the ACOVEA compiler flag thing you did a while back to produce a tool that would automatically improve performance of programs on a fixed architecture/environment just by recompiling and running it?

warren.henning:
On Mon, Jul 5, 2010 at 5:46 PM, Don Stewart
wrote: Feedback and patches welcome!
Interesting.
Could this be combined with the ACOVEA compiler flag thing you did a while back to produce a tool that would automatically improve performance of programs on a fixed architecture/environment just by recompiling and running it?
A bit longer term, but yes. So far I've got individual approaches for improving performance by finding: * inlining points * strictness flags * `par` points * LLVM flags * RTS GC flags They just need to be integrated into a coherent set of tools and written up :-) -- Don

On Tue, Jul 6, 2010 at 10:07 AM, Don Stewart
A bit longer term, but yes. So far I've got individual approaches for improving performance by finding:
* inlining points * strictness flags * `par` points * LLVM flags * RTS GC flags
They just need to be integrated into a coherent set of tools and written up :-)
Sweet. Good project for someone new to Haskell? The code to ghc-gc-tune is one file and looks quite imperative in a lot of parts o_O

Don Stewart wrote:
A bit longer term, but yes. So far I've got individual approaches for improving performance by finding:
* inlining points * strictness flags * `par` points * LLVM flags * RTS GC flags
They just need to be integrated into a coherent set of tools and written up :-)
I've always thought of compiler flags as being a fairly imprecise tool. For example, -funbox-strict-fields applies a particular transformation to EVERY STRICT FIELD IN THE ENTIRE PROGRAM. Which is fine if it's always a win - but then, if it were always a win, there wouldn't be a flag to turn it on. It would just be on permanently. ;-) I've always thought it's much better to write source annotations on the specific fields you want unboxed. You have more control this way. (And you don't have to remember any special compiler flags.) I'm talking about unboxing of course, but the same deal applies to inlining or any number of other source-level transformations that GHC can perform. Of course, presumably writing a program to frob all possible combinations of unboxing annotations would be a tad more tricky to write than one that just invokes ghc.exe with different CLI args. ;-) I'm also all for new ways of giving the compiler extra information. For example, it would be neat if there was some way to say "this function is cheap to (re)compute" or "this function is expensive to compute". Or hints like "it's OK to try to evaluate this function at compile-time; it's output will never be significantly larger than its input". Of course, implementing a pragma is one thing; somebody then has to write an optimisation pass that *does* something with this information. ;-) I don't know much about how LLVM works, but unless there's a specific set of flags that's clearly optimal in all cases, it would probably be useful to be able to tune flags per-function. (It would of course be far, far more useful to know *why* certain programs run faster with certain flags. Maybe the code that GHC feeds to LLVM can be tweaked or something...) As far as GC goes, I've often thought it would be nice to be able to somehow say "if THIS object dies, all THESE objects will die with it, so you can just go ahead and collect them all". The hard part, of course, is finding a way to implement this efficiently and make it so programmer error won't cause live objects to get collected. (!)

Andrew Coppin schrieb:
I've always thought of compiler flags as being a fairly imprecise tool. For example, -funbox-strict-fields applies a particular transformation to EVERY STRICT FIELD IN THE ENTIRE PROGRAM. Which is fine if it's always a win - but then, if it were always a win, there wouldn't be a flag to turn it on. It would just be on permanently. ;-) I've always thought it's much better to write source annotations on the specific fields you want unboxed. You have more control this way. (And you don't have to remember any special compiler flags.) I'm talking about unboxing of course, but the same deal applies to inlining or any number of other source-level transformations that GHC can perform.
http://hackage.haskell.org/packages/archive/bytestring/0.9.1.7/doc/html/src/... data ByteString = PS {-# UNPACK #-} !(ForeignPtr Word8) -- payload {-# UNPACK #-} !Int -- offset {-# UNPACK #-} !Int -- length
participants (5)
-
Alexandre Termier
-
Andrew Coppin
-
Don Stewart
-
Henning Thielemann
-
Warren Henning