[MLton] Parallel compilation?

skaller skaller at users.sourceforge.net
Thu Sep 20 22:55:31 PDT 2007


On Thu, 2007-09-20 at 22:33 -0500, Matthew Fluet wrote:
> On Wed, 19 Sep 2007, Ryan Newton wrote:
> > I haven't personally come across any multi-threaded compilers that 
> > parallelize at the granularity of the abstract syntax tree itself (not at a 
> > module or file granularity).

> In any case, it is certainly an interesting question, without any 
> immediate, clear answers.

I can't speak for MLton, however there are definitely parallel-isable
procedures in the Felix compiler (also whole program analyser).

For example inlining optimisation includes a recursive descent
on children, and inlining into a function is independent of inlining
into another function (except at the end, where some global properties
are recomputed). Thus, it should be easy to split inlining 
into N children into N separate threads.

However 70% of time is spent in the GLR parser, and 70% of the rest
doing lookup. Both these procedures are also potentially parallelisable.
GLR parsing is semantically a matter of following parallel parses with
parallel threads. In Felix, (apart from a cache) lookup (binding) of
any symbol based on read only unbound symbol table, and independent
of binding of any other symbol.

Of course, Felix is written in Ocaml which doesn't support
multi-processing of threads, so parallelisation would be rather
pointless (and sharing data structures like symbol tables between
processes seems expensive to do).

[Maybe I should use ML as the compiler language.. probably getting
an 8 core box soon]


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net



More information about the MLton mailing list