<div dir="ltr">Hi Marwa,<div><br></div><div>There are no tutorials that focus on constructing a JIT using the Orc layers (though I hope to write one in the future). There are several complete example JITs in-tree though. The simplest example is the Kaleidoscope JIT. See llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h .</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 10, 2016 at 4:13 AM, <a href="mailto:marwayusuf@feng.bu.edu.eg">marwayusuf@feng.bu.edu.eg</a> <span dir="ltr"><<a href="mailto:marwayusuf@feng.bu.edu.eg" target="_blank">marwayusuf@feng.bu.edu.eg</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi Lang,</p>
<p>Is there any detailed instructions or tutorial for using orc layers?</p><span class="">
<p>Thanks in advance.</p>
<p><br>
</p>
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div><font size="2"><span style="font-size:10pt">
<div>Regards,<br>
Marwa Yusuf<br>
Teaching Assistant - Computer Engineering Department<br>
Faculty of Engineering - Benha University<br>
E-JUST PhD Student<br>
Computer Science & Engineering Dept.</div>
</span></font></div>
</div>
</div>
<br>
<br>
</span><div style="color:rgb(0,0,0)"><span class="">
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>><br>
<b>Sent:</b> Wednesday, December 2, 2015 11:29 PM<br>
<b>To:</b> <a href="mailto:marwayusuf@feng.bu.edu.eg" target="_blank">marwayusuf@feng.bu.edu.eg</a><br>
<b>Cc:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] re-compile a function</font>
<div> </div>
</div>
</span><div><div class="h5"><div>
<div dir="ltr">Hi Marwa,
<div><br>
</div>
<div>MCJIT doesn't provide any support for recompilation. The best you can do is use multiple MCJIT instances and destroy whichever one contains the function "foo" that you want to recompile. MCJIT does not do any dependence tracking either, so you'll also
need to destroy and recompile any direct callers of "foo" (and their direct callers, and so on). If you know you want to be able to recompile a function it may be best to only call it indirectly - that way all you have to do is delete the containing MCJIT
instance, create a new MCJIT instance, and update your function pointer.</div>
<div><br>
</div>
<div>You may find the Orc APIs a better fit for what you're doing: they at least support removing individual modules from the JIT session, so you don't have to maintain multiple JIT instances yourself. You'll still need to manage the invalidation and/or function
pointer update. If you come up with a scheme for that though we could look at adding it in-tree. You might also be able to make some use of the utilities in include/llvm/ExecutionEngine/Orc/IndirectionUtils.h.</div>
<div><br>
</div>
<div>In case it's useful, I've attached an example that uses the Orc APIs to do recompilation at higher optimization levels, based on the Kaleidoscope tutorials. This was motivated by the following mailing list discussion:
<a href="http://lists.llvm.org/pipermail/llvm-dev/2015-July/087776.html" target="_blank">
http://lists.llvm.org/pipermail/llvm-dev/2015-July/087776.html</a>, which may also be related to what you want to do.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Lang.</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sat, Nov 21, 2015 at 11:05 AM, <a href="mailto:marwayusuf@feng.bu.edu.eg" target="_blank">
marwayusuf@feng.bu.edu.eg</a> via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Dear All</p>
<p>Is there is a way to recompile a function at runtime?</p>
<p>It seems that I need to -like - invalidate the recompiled function to force the MCJIT to recompile it, cause when I just call runFunction, it neglects any modifications in the function code.</p>
<p>Thanks in advance.</p>
<p><br>
</p>
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div><font size="2"><span style="font-size:10pt">
<div>Regards,<br>
Marwa Yusuf<br>
Teaching Assistant - Computer Engineering Department<br>
Faculty of Engineering - Benha University<br>
E-JUST PhD Student<br>
Computer Science & Engineering Dept.</div>
</span></font></div>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br></div>