<div dir="ltr">Hi,<div><br></div><div>I&#39;m interested in participating in the GSoC by improving GHC with one of these two features:</div><div><br></div><div>1) Implement native support for compiling modules in parallel (see <a href="http://hackage.haskell.org/trac/ghc/ticket/910" target="_blank">#910</a>). This will involve making the compilation pipeline thread-safe, implementing the logic for building modules in parallel (with an emphasis on keeping compiler output deterministic), and lots of testing and benchmarking. Being able to seamlessly build modules in parallel will shorten the time it takes to recompile a project and will therefore improve the life of every GHC user.</div>


<div><br></div><div>2) Improve existing constant folding, strength reduction and peephole optimizations on arithmetic and logical expressions, and optionally implement a core-to-core pass for optimizing nested comparisons (relevant tickets include <a href="http://hackage.haskell.org/trac/ghc/ticket/2132" target="_blank">#2132</a>,<a href="http://hackage.haskell.org/trac/ghc/ticket/5615" target="_blank">#5615</a>,<a href="http://hackage.haskell.org/trac/ghc/ticket/4101">#4101</a>). GHC currently performs some of these simplifications (via its BuiltinRule framework), but there is a lot of room for improvement. For instance, the core for this snippet is essentially identical to the Haskell source:</div>
<div><br></div><div><div>foo :: Int -&gt; Int -&gt; Int -&gt; Int</div><div>foo a b c = 10*((b+7+a+12+b+9)+4) + 5*(a+7+b+12+a+9) + 7 + b + c</div></div><div><br></div><div style>Yet the RHS is actually equivalent to</div>
<div style><br></div><div style>20*a + 26*b + c + 467</div><div style><br></div><div style>And:</div><div style><br></div><div style>bar :: Int -&gt; Int -&gt; Int</div><div style>bar a b = a + b - a - b -- the RHS is should be optimized away to 0</div>
<div style><br></div><div style>Other optimizations include: multiplication and division by powers of two should be converted to shifts; multiple plusAddr calls with constant operands should be coalesced into a single plusAddr call; floating point functions should be constant folded, etc..</div>
<div style><br></div><div style>GHC should be able to perform all these algebraic simplifications. Of course, emphasis should be placed on the correctness of such transformations. A flag for performing unsafe optimizations like assuming floating point arithmetic is associative and distributive should be added. This proposal will benefit anybody writing or using numerically intensive code.</div>
<div style><br></div><div style><br></div><div style>I&#39;m wondering what the community thinks of these projects. Which project is a better fit for GSoC, or are both a good fit? Is a mentor willing to supervise one of these projects?</div>
<div style><br></div><div style><div style>Thanks for your time.</div><div style>Patrick</div><div style><br></div><div style><div>(A little about myself: I&#39;m a Mathematics student in the US, and I&#39;ve been programming in Haskell for about 3.5 years. Having a keen interest in Haskell and compilers, I began studying the GHC source about 1 year ago and I&#39;ve since gotten a good understanding of its internals, contributing a few patches along the way.)</div>
<div><br></div></div></div></div>