Adaptive compilation attempts to detect hot functions in the program and recompile them at a higher optimization level.  Currently, I have an adaptive compilation framework ready in LLVM and X86 support for it. I ran the llvm test-suite with lli -Ox  and lli -adaptive-comp and following is the result i got on a Intel i5, Ubuntu 32bits machine. Currently, LLVM adaptive compilation inserts instrumentational code ( invocation counters ) into the function stub and when a function reaches a compilation threshold, it is recompiled. We would expect adaptive-comp to perform well on large test cases with hotspots. The benefit of adaptive compilation is not clearly shown in the llvm test-suite as the test cases are generally small and short.  Currently the threshold for recompilation is <div>
<br></div><div>enum JITReCompCount {</div><div><div>     CompilationNone = 1000,        // Compile at -O0</div><div>     CompilationLess = 5000,        // Compile at -O1</div><div>     CompilationDefault = 10000,    // Compile at -O2</div>
<div>     CompilationAggressive = 100000 // Compile at -O3</div><div> };</div></div><div><br><div>lli -O0</div><div>Total Time is 1068.37<br><br></div><div>lli -O1</div><div>Total Time is 1395.68</div><div><br></div><div>
lli -O2</div><div>Total Time is 1394.81</div><div><br></div><div>lli -O3</div><div>Total Time is 1395.76</div><div><br></div><div>lli -adaptive-comp</div><div>Total Time is 1119.23</div><div><br></div><div><br></div><div>
Thanks</div><div><br></div><div><br></div><div>Xin </div><div><br></div><div><br><div><br><div class="gmail_quote">On Fri, Jun 24, 2011 at 2:30 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@apple.com">echristo@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Jun 23, 2011, at 7:32 PM, Xin Tong Utoronto wrote:<br>
<br>
> One of the current drawbacks of the LLVM JIT is the lack of an adaptive compilation system. All the non-adaptive bits are already there in LLVM: optimizing compiler with the different types of instruction selectors, register allocators, preRA schedulers, etc. and a full set of optimizations changeable at runtime. What's left is a system that can keep track of and dynamically look-up the hotness of methods and re-compile with more expensive optimizations as the methods are executed over and over. This should improve program startup time and execution time and will bring great benefits to all ported languages that intend to use LLVM JIT as one of the execution methods.<br>

> The implementation of the adaptive compilation framework is one of the Google Summer of Code 2011 project (<a href="http://www.google-melange.com/gsoc/project/google/gsoc2011/timexerox/8001" target="_blank">http://www.google-melange.com/gsoc/project/google/gsoc2011/timexerox/8001</a>). This patch is intended to provide the basic infrastructure for the adaptive compilation framework. Code for specific platforms are currently being developed. This patch is generate against the LLVM trunk and using GIT.<br>

<br>
</div>I realize I've looked at this already, but more eyes would be good. I'll also give it a bit more testing shortly.<br>
<br>
That said can you provide some more information with this for everyone? What tests is gives a performance win on and what tests we can expect to see regressions on? Some of the logic behind some of your decisions etc?<br>

<br>
Thanks!<br>
<font color="#888888"><br>
-eric<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Kind Regards <br><br>Xin Tong <br>
</div></div></div>