[Openmp-commits] [PATCH] D91746: [libomptarget] Fail on missing symbols in device image

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 18 15:16:29 PST 2020


JonChesterfield created this revision.
JonChesterfield added reviewers: jdoerfert, ABataev, grokos, tianshilei1992, ye-luo.
Herald added subscribers: openmp-commits, kerbowa, nhaehnle, jvesely.
Herald added a project: OpenMP.
JonChesterfield requested review of this revision.
Herald added a subscriber: sstefan1.

[libomptarget] Fail on missing symbols in device image

_exec_mode is unconditionally emitted by codegen. It missing implies a corrupt
device image, which may have further problems.

omptarget_device_environment is unconditionally present in deviceRTL. It
missing implies that some of the deviceRTL has not been linked into the
application.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91746

Files:
  openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
  openmp/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -663,10 +663,9 @@
           return nullptr;
         }
       } else {
-        DP("Loading global exec_mode '%s' - symbol missing, using default "
-           "value GENERIC (1)\n",
-           ExecModeName);
+        DP("Loading global exec_mode '%s' - symbol missing\n", ExecModeName);
         CUDA_ERR_STRING(Err);
+        return nullptr;
       }
 
       KernelsList.emplace_back(Func, ExecModeVal);
@@ -711,8 +710,7 @@
       } else {
         DP("Finding global device environment '%s' - symbol missing.\n",
            DeviceEnvName);
-        DP("Continue, considering this is a device RTL which does not accept "
-           "environment setting.\n");
+        return nullptr;
       }
     }
 
Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -958,8 +958,7 @@
     if (rc != 0) {
       DP("Finding global device environment '%s' - symbol missing.\n",
          device_env_Name);
-      // no need to return FAIL, consider this is a not a device debug build.
-      return ATMI_STATUS_SUCCESS;
+      return ATMI_STATUS_ERROR;
     }
     if (si.size != sizeof(host_device_env)) {
       return ATMI_STATUS_ERROR;
@@ -1252,10 +1251,8 @@
           return NULL;
         }
       } else {
-        DP("Loading global exec_mode '%s' - symbol missing, using default "
-           "value "
-           "GENERIC (1)\n",
-           ExecModeName);
+        DP("Loading global exec_mode '%s' - symbol missing\n", ExecModeName);
+        return NULL;
       }
       check("Loading computation property", err);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91746.306240.patch
Type: text/x-patch
Size: 1919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201118/ab95c50a/attachment-0001.bin>


More information about the Openmp-commits mailing list