[Openmp-commits] [PATCH] D139287: [OpenMP] Introduce basic JIT support to OpenMP target offloading

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 12 22:19:55 PST 2022

jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LG as there seem to be only nits left. We can expand on this in tree

Comment at: openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp:184
+  auto AddStream =
+      [&](size_t Task,
jhuber6 wrote:
> tianshilei1992 wrote:
> > jhuber6 wrote:
> > > tianshilei1992 wrote:
> > > > jhuber6 wrote:
> > > > > tianshilei1992 wrote:
> > > > > > Is there any way that we don't write it to a file here?
> > > > > Why do we need to invoke LTO here? I figured that we could call the backend directly since we have no need to actually link any filies, and we may not have a need to run more expensive optimizations when the bitcode is already optimized. If you do that then you should be able to just use a `raw_svector_ostream` as your output stream and get the compiled output written to that buffer.
> > > > For the purpose of this basic JIT support, we indeed just need backend. However, since we have the plan for super optimization, etc., having an optimization pipeline here is also useful.
> > > We should be able to configure our own optimization pipeline in that case, we might want the extra control as well.
> > which means we basically rewrite the function `opt` and `backend` in `LTO.cpp`. I thought about just invoking backend before, especially using LTO requires us to build the resolution table. However, after a second thought, I think it would be better to just use LTO.
> Building the passes isn't too complicated, it would take up the same amount of space as the symbol resolutions and has the advantage that we don't need to write the output to a file. I could write an implementation for this to see how well it works.
Agreed. We can test it in a follow up and decide then.

Comment at: openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp:121
+CodeGenOpt::Level getCGOptLevel(unsigned OptLevel) {
+  switch (OptLevel) {
jhuber6 wrote:
> I'm tempted to move this into LLVM somewhere since it's been duplicated so many times.
Let's do this as a follow up.

Comment at: openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.h:41
+/// PostProcessing will be called after codegen to handle cases such as assember
+/// is an external tool.
+Expected<__tgt_device_image *> compile(__tgt_device_image *Image,

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list