Theodoros Theododiris via llvm-dev
2016-May-27 06:49 UTC
[llvm-dev] How to recompile functions with ORC JIT?
Hello, I am trying to figure out how to recompile functions multiple times during run-time with ORC JIT and I'd appreciate any help/advice. My use case is t he following: every time a function of interest (annotated) is called, profiling data are gathered. Given enough data the function is recompiled using different optimizations. This happens repeatedly until the "best" optimization parameters are found. A similar question was asked before and a solution was suggested: http://lists.llvm.org/pipermail/llvm-dev/2015-July/088665.html What I am trying to figure out is how the function pointer can be updated to point to the newly compiled version. Thanks, Theodor
David Blaikie via llvm-dev
2016-May-27 17:38 UTC
[llvm-dev] How to recompile functions with ORC JIT?
+Lang Ultravague answer: There are a few different Orc layers for different levels of indirection needed for different levels of substitutability. One way is to indirect every call through global function pointers - so when you want to replace the function you write the new function pointer to the global variable. I forget which layers do which kinds of indirection. - Dave On Thu, May 26, 2016 at 11:49 PM, Theodoros Theododiris via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > I am trying to figure out how to recompile functions multiple times during > run-time with ORC JIT > > and I'd appreciate any help/advice. > > > My use case is t he following: every time a function of interest > (annotated) is called, profiling data > > are gathered. Given enough data the function is recompiled using different > optimizations. This happens > > repeatedly until the "best" optimization parameters are found. > > > A similar question was asked before and a solution was suggested: > > http://lists.llvm.org/pipermail/llvm-dev/2015-July/088665.html > > > What I am trying to figure out is how the function pointer can be updated > to point to the newly > > compiled version. > > > Thanks, > > Theodor > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160527/141a7556/attachment.html>
Lang Hames via llvm-dev
2016-May-27 22:15 UTC
[llvm-dev] How to recompile functions with ORC JIT?
H Theodoros, David, What I am trying to figure out is how the function pointer can be updated> to point to the newly compiled version.As Dave implied, it depends on how you've set up your ORC stack. These days, the API directly responsible for this is the IndirectStubsManager (see llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h). If you have access to the appropriate IndirectStubsManager you just need to call the updatePointer method with the name of the function you want to update and the new address. If you're using the CompileOnDemand layer to compile lazily from IR, the problem is that that layer doesn't (currently) expose the IndirectStubManager for each module. I think it would be reasonable to add support for that if you need it though. So - what is your current setup? You may also be interested in the latest chapter of the Building A JIT tutorial series that I'm working on. There's no chapter text yet, but the code was just committed as r271054 and is (hopefully) fairly readable if you're already familiar with Orc. Cheers, Lang. On Fri, May 27, 2016 at 10:38 AM, David Blaikie <dblaikie at gmail.com> wrote:> +Lang > > Ultravague answer: There are a few different Orc layers for different > levels of indirection needed for different levels of substitutability. One > way is to indirect every call through global function pointers - so when > you want to replace the function you write the new function pointer to the > global variable. I forget which layers do which kinds of indirection. > > - Dave > > On Thu, May 26, 2016 at 11:49 PM, Theodoros Theododiris via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hello, >> >> I am trying to figure out how to recompile functions multiple times >> during run-time with ORC JIT >> >> and I'd appreciate any help/advice. >> >> >> My use case is t he following: every time a function of interest >> (annotated) is called, profiling data >> >> are gathered. Given enough data the function is recompiled using >> different optimizations. This happens >> >> repeatedly until the "best" optimization parameters are found. >> >> >> A similar question was asked before and a solution was suggested: >> >> http://lists.llvm.org/pipermail/llvm-dev/2015-July/088665.html >> >> >> What I am trying to figure out is how the function pointer can be updated >> to point to the newly >> >> compiled version. >> >> >> Thanks, >> >> Theodor >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160527/3027be7f/attachment.html>
Seemingly Similar Threads
- How to recompile functions with ORC JIT?
- How to recompile functions with ORC JIT?
- [ORC JIT] Exposing IndirectStubsManager from CompileOnDemandLayer.h
- [ORC JIT] Exposing IndirectStubsManager from CompileOnDemandLayer.h
- [ORC JIT] Exposing IndirectStubsManager from CompileOnDemandLayer.h