[LLVMdev] Deep JIT specialization

Reid Kleckner rnk at mit.edu
Thu May 27 11:45:44 PDT 2010


I don't think there is any infrastructure for this kind of
specialization.  The closest thing I can think of is the
profile-guided optimization stuff that Andreas Neufstifter has worked
on.

Because compilation and optimization with LLVM is expensive, our
approach with Unladen Swallow has been to try to wait longer to
generate specialized code, so we don't have to recompile.

If memory serves me, we also found that code generation (ie register
allocation and instruction selection) held the lion's share of the
compilation time, and I can't think of a way to introduce
specializations without paying that cost.

What do you think a good library for doing this kind of specialization
would look like?  Most of our specializations are very complicated,
like replacing calls to the runtime with inline guards.

Reid

On Thu, May 27, 2010 at 9:08 AM, Nicolas Capens
<nicolas.capens at gmail.com> wrote:
> Hi all,
>
> I'm attempting to use LLVM for run-time code specialization, but I'm facing
> a performance hurdle. I'm currently performing the specialization during the
> AST to LLVM IR translation, but unfortunately this leads to relatively slow
> recompiles as LLVM has to perform all the heavy (optimization) passes over
> and over again.
>
> So I was hoping that by first creating unspecialized LLVM IR, optimizing
> that as much as possible, and then performing the specializations starting
> from this optimized IR, the recompiles would be significantly faster.
> Currently the mem2reg and instcombine passes take the majority of
> compilation time, which could be avoided using "deep" JIT specialization.
>
> So my question is how do I get started with this? Currently tracking the
> specialization parameters and caching the generated specialized functions is
> done outside of LLVM. So I imagine I'll have to somehow inform LLVM of the
> semi-constant values of the specialization parameters, without losing the
> original (optimized) IR. Can I add and remove specialized function instances
> at run-time?
>
> Thanks for any pointers!
>
> Kind regards,
>
> Nicolas
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>




More information about the llvm-dev mailing list