[Openmp-commits] [openmp] 75019f1 - [OpenMP][JIT] Fixed a couple of issues in the initial implementation of JIT

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 28 11:41:04 PST 2022


Author: Shilei Tian
Date: 2022-12-28T14:40:59-05:00
New Revision: 75019f18bd4f563a9335581bbc34e81876d80bf0

URL: https://github.com/llvm/llvm-project/commit/75019f18bd4f563a9335581bbc34e81876d80bf0
DIFF: https://github.com/llvm/llvm-project/commit/75019f18bd4f563a9335581bbc34e81876d80bf0.diff

LOG: [OpenMP][JIT] Fixed a couple of issues in the initial implementation of JIT

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.

Reviewed By: ye-luo

Differential Revision: https://reviews.llvm.org/D140732

Added: 
    

Modified: 
    openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
    openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
    openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
index 9abd430356bc7..8c9bbe38074d5 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/CMakeLists.txt
@@ -18,7 +18,7 @@ add_library(PluginInterface OBJECT
 # 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.

diff  --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
index 0d42c6db96d73..7cc1bb88cd004 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/JIT.cpp
@@ -69,7 +69,7 @@ void init(Triple TT) {
   }
 #endif
   if (!JITTargetInitialized) {
-    FAILURE_MESSAGE("unsupported JIT target");
+    FAILURE_MESSAGE("unsupported JIT target: %s\n", TT.str().c_str());
     abort();
   }
 

diff  --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
index 9f253015bc08a..836eb81e6eae2 100644
--- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
+++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.h
@@ -380,7 +380,7 @@ struct GenericDeviceTy : public DeviceAllocatorTy {
 
   /// 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 @@ struct GenericPluginTy {
 
   /// 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.


        


More information about the Openmp-commits mailing list