[llvm-commits] LLVM JIT Adaptive Compilation Patch

Xin Tong Utoronto x.tong at utoronto.ca
Sun Jun 26 07:52:05 PDT 2011


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

enum JITReCompCount {
     CompilationNone = 1000,        // Compile at -O0
     CompilationLess = 5000,        // Compile at -O1
     CompilationDefault = 10000,    // Compile at -O2
     CompilationAggressive = 100000 // Compile at -O3
 };

lli -O0
Total Time is 1068.37

lli -O1
Total Time is 1395.68

lli -O2
Total Time is 1394.81

lli -O3
Total Time is 1395.76

lli -adaptive-comp
Total Time is 1119.23


Thanks


Xin



On Fri, Jun 24, 2011 at 2:30 PM, Eric Christopher <echristo at apple.com>wrote:

>
> On Jun 23, 2011, at 7:32 PM, Xin Tong Utoronto wrote:
>
> > 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.
> > The implementation of the adaptive compilation framework is one of the
> Google Summer of Code 2011 project (
> http://www.google-melange.com/gsoc/project/google/gsoc2011/timexerox/8001).
> 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.
>
> I realize I've looked at this already, but more eyes would be good. I'll
> also give it a bit more testing shortly.
>
> 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?
>
> Thanks!
>
> -eric
>



-- 
Kind Regards

Xin Tong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110626/b318ca1e/attachment.html>


More information about the llvm-commits mailing list