|
From: Julian S. <js...@ac...> - 2007-02-16 08:34:14
|
On Friday 16 February 2007 00:22, Nicholas Nethercote wrote:
> On Thu, 15 Feb 2007, Josef Weidendorfer wrote:
> >> Also, if we ever do more aggressive block formation which speculatively
> >> chases across conditional branches ("trace formation"), then some branch
> >> conditions will have to be inverted - it is unavoidable.
> >
> > Is such a speculative chasing useful? I assume that you take the
> > outcome of the first execution, which does the translation. It is not
> > clear to me why the first execution will stay a good speculation in
> > the run of a program.
>
> Systems that do this kind of thing normally do so after doing some run-time
> profiling for a while -- eg. optimise the hot blocks after they've run
> enough times.
That sounds like the right solution, but adds lots of complexity in
code cache management, which is already a bit hairy, what with redirection,
wrapping, discarding.
A couple of months back I did some experiments with trace selection
using static branch "prediction", predicting backwards branches taken
and forwards ones not taken. IIRC that gives about 68% correct rate
on spec cpu2000 'test'. Because, by default, vex ends basic blocks
at a conditional branch, this is better than it sounds - even a 50%
correct predict rate could in principle halve the number of block-to-
block transitions through the scheduler.
Some programs ran significantly faster (gzip) and many ran a couple
of percent faster. But it tends to slow down program startup because
the JIT produces (even) more code. Overall it didn't seem worth it.
J
|