[Openmp-commits] [PATCH] D102346: [libomptarget][amdgpu] Remove majority of fatal errors

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed May 12 11:48:48 PDT 2021


JonChesterfield added a comment.

This replaces some debug printing with DP() macro where it is near exit calls, leaving other (f)printf calls for a later patch.



================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/data.cpp:23
 namespace core {
-void allow_access_to_all_gpu_agents(void *ptr);
 
----------------
in internal.h


================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/data.cpp:62
 
-  register_allocation(*ptr, size, place);
 
----------------
register_allocation doesn't look like it handles invalid pointers gracefully, keeping it guarded by allocate succeeding


================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/internal.h:51
 
-#define check(msg, status)                                                     \
-  if (status != HSA_STATUS_SUCCESS) {                                          \
----------------
was unused


================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/system.cpp:389
   }
   if (err != HSA_STATUS_SUCCESS) {
     printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__, "Getting a gpu agent",
----------------
redundant checks


================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/system.cpp:1070
       // the comgr method of getting symbol info
-      if (HSA_STATUS_ERROR_INVALID_CODE_OBJECT != HSA_STATUS_SUCCESS) {
-        printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__,
----------------
branch was always true


================
Comment at: openmp/libomptarget/plugins/amdgpu/impl/utils.cpp:102
               << std::endl;
-    exit(0);
   }
----------------
this exit was reasonable in atmi, not so in libomptarget


================
Comment at: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp:1804
     hsa_queue_t *queue = DeviceInfo.HSAQueues[device_id];
+    if (!queue) {
+      return OFFLOAD_FAIL;
----------------
previously, this is a nullptr dereference on partial construction of the global


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102346/new/

https://reviews.llvm.org/D102346



More information about the Openmp-commits mailing list