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, ---------------- Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D139287/new/ https://reviews.llvm.org/D139287 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits