Massimiliano Mantione's Blog

RSS

../../massi.rss2

Email

massi@ximian.com

Docs:

I'm working on...

27 Mar 2006 (Permalink)

Almost Easter, and still moving trees around...

Lately I've been mostly working on the "tree mover", which is described in this post by Miguel.
As you can see, it is not an optimization by itself, it is a code transformation necessary to help our current register allocator, and in fact the plan is not to use it alone, but to help inlining. In practice, to get the full benefits five more optimizations must be enabled starting from the current default in the Mono JIT:

As you can see, all these passes are meant to work together in a "pipeline". After a lot of hammering on them, I have seen concrete results on some real and complex benchmark, like XMLMark.
Working on this benchmark, first of all I modified the ini files, to be able to see exactly what the JIT was affecting; so I created five ini files, one for each XMLMark functionality (each functionality gets weight 100, and all the others stay at 0):

I also had to set the number of agents to 1 to get reliable results (the multithreaded nature of XMLMark was getting in the way, and after all I was interested just in the effects of JIT settings).

Then, I tested with a lot of option combinations:

Options
LabelOptions
ALLall
ALL-NO-SSAall,-ssa,-ssapre,-abcrem
FASTconsprop,copyprop,treeprop,deadce,inline
NO-DEADconsprop,copyprop,treeprop,-deadce,inline
NO-INLINE-DEADconsprop,copyprop,treeprop,-deadce,-inline
NO-INLINEconsprop,copyprop,treeprop,deadce,-inline
NO-INLINE-TREEconsprop,copyprop,-treeprop,deadce,-inline
NO-PROP-consprop,-copyprop,-treeprop,deadce,inline
NO-PROP-INLINE-consprop,-copyprop,-treeprop,deadce,-inline
NO-TREE-DEADconsprop,copyprop,-treeprop,-deadce,inline
NO-TREEconsprop,copyprop,-treeprop,deadce,inline
NOTHING-consprop,-copyprop,-treeprop,-deadce,-inline

Of these combinations, "NOTHING" is the current JIT default, "FAST" is the full set I'm testing (which ideally will become the default), "ALL-NO-SSA" means "everything the JIT can do without using SSA", and all the "NO-something" are the "FAST" set without something, to see if all the options are really necessary to get the best results.

These are the numbers I got:

XMLMark results, in transactions per seconds
XMLMarkDOM-SELDOM-MODDOM-STRDOM-SERSAX-SEL
ALL53.4050.20 50.9554.6015.40
ALL-NO-SSA53.4050.50 51.1055.7515.25
FAST53.7550.85 51.4556.0015.95
NO-DEAD52.5049.85 50.0554.1013.15
NO-INLINE-DEAD47.8545.45 45.1049.2013.10
NO-INLINE50.1547.05 46.2551.2015.45
NO-INLINE-TREE50.8547.55 47.8552.1515.35
NO-PROP53.0550.55 50.4554.7015.45
NO-PROP-INLINE49.6046.90 47.1050.9515.25
NO-TREE-DEAD51.9049.20 49.9053.9015.75
NO-TREE52.7049.90 50.2554.9015.75
NO-TREE52.7049.90 50.2554.9015.75
NOTHING51.0547.70 47.8551.7515.00

Here are the same data in graphical form:

XMLMarl results chart

To make some sense of it, here's a chart of the gains against the "NOTHING" options set, as percentages:

XMLMarl gains chart

Some easy observations:

The (small) downside of these gains is that they cost about 25% more JIT time (this is the cumulative overhead of the "FAST" set). This is clearly visible in programs which exercise a lot of code but are very fast, like a mcs bootstrap: in this case the "FAST" set loses 1.33% (it takes 3.86 seconds instead of 3.81). However, uning a custom mcs driver that performs a second compilation (a sort of "hot run", because all the code is already jitted), and making sure that also the "cold run" had all the source files in the system buffer cache, shows that the "FAST" set gains 1.85% against the current default. This means that longer compilations should not suffer at all from the JIT overhead.

Finally, these results are on x86... on amd64 I noticed the need for further tuning in the linear regalloc spill costs: the gains are still there, but in some cases they are smaller. And also other benchmarks need some more tuning.

Anyway, this code should hit svn "real soon now", and be part of Mono 1.2 (so that nobody should worry about the overhead of wrapping fields with properties anymore!) .

Next in my todo list is getting rid of the SSAPRE issues we have...

All entries
This is a personal web page. Things said here do not represent the position of my employer.