[Openmp-commits] [PATCH] D140732: [OpenMP][JIT] Fixed a couple of issues in the initial implementation of JIT

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 28 11:27:46 PST 2022


tianshilei1992 created this revision.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

This patch fixes a couple of issues:

1. Instead of using `llvm_unreachable` for those base virtual functions, unknown value will be returned. The previous method could cause runtime error for those targets where the image is not compatible but JIT is not implemented.
2. Fixed the type in CMake that causes the `Target` CMake variable is undefined.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140732

Files:
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h


Index: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
===================================================================
--- openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
+++ openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
@@ -380,7 +380,7 @@
 
   /// Get target architecture.
   virtual std::string getArch() const {
-    llvm_unreachable("device doesn't support JIT");
+    return "unknown";
   }
 
   /// Post processing after jit backend. The ownership of \p MB will be taken.
@@ -540,7 +540,7 @@
 
   /// Get the target triple of this plugin.
   virtual Triple::ArchType getTripleArch() const {
-    llvm_unreachable("target doesn't support jit");
+    return Triple::ArchType::UnknownArch;
   }
 
   /// Allocate a structure using the internal allocator.
Index: openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
+++ openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
@@ -18,7 +18,7 @@
 # Only enable JIT for those targets that LLVM can support.
 string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
 foreach(Target ${TargetsSupported})
-  target_compile_definitions(PluginInterface PRIVATE "LIBOMPTARGET_JIT_${TARGET}")
+  target_compile_definitions(PluginInterface PRIVATE "LIBOMPTARGET_JIT_${Target}")
 endforeach()
 
 # This is required when using LLVM libraries.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140732.485527.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221228/64098a62/attachment.bin>


More information about the Openmp-commits mailing list