[Openmp-commits] [PATCH] D102847: [AMDGPU][Libomptarget] Delete g_atmi_initialized

Pushpinder Singh via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue May 25 00:35:42 PDT 2021


pdhaliwal updated this revision to Diff 347595.
pdhaliwal added a comment.
Herald added a subscriber: foad.

Removed inlining from this patch and rebased.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102847

Files:
  openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp
  openmp/libomptarget/plugins/amdgpu/impl/system.cpp


Index: openmp/libomptarget/plugins/amdgpu/impl/system.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -146,7 +146,6 @@
 
 std::vector<hsa_amd_memory_pool_t> atl_gpu_kernarg_pools;
 
-bool g_atmi_initialized = false;
 bool g_atmi_hostcall_required = false;
 
 /*
@@ -164,18 +163,6 @@
   return &g_atmi_machine;
 }
 
-static void atl_set_atmi_initialized() {
-  // FIXME: thread safe? locks?
-  g_atmi_initialized = true;
-}
-
-static void atl_reset_atmi_initialized() {
-  // FIXME: thread safe? locks?
-  g_atmi_initialized = false;
-}
-
-bool atl_is_atmi_initialized() { return g_atmi_initialized; }
-
 hsa_status_t allow_access_to_all_gpu_agents(void *ptr) {
   std::vector<ATLGPUProcessor> &gpu_procs =
       g_atl_machine.processors<ATLGPUProcessor>();
@@ -187,26 +174,18 @@
 }
 
 atmi_status_t Runtime::Initialize() {
-  atmi_devtype_t devtype = ATMI_DEVTYPE_GPU;
-  if (atl_is_atmi_initialized())
-    return ATMI_STATUS_SUCCESS;
-
-  if (devtype == ATMI_DEVTYPE_ALL || devtype & ATMI_DEVTYPE_GPU) {
-    atmi_status_t rc = atl_init_gpu_context();
-    if (rc != ATMI_STATUS_SUCCESS) {
-      printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__, "GPU context init",
-             get_atmi_error_string(atl_init_gpu_context()));
-      return rc;
-    }
+  atmi_status_t rc = atl_init_gpu_context();
+  if (rc != ATMI_STATUS_SUCCESS) {
+    printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__, "GPU context init",
+           get_atmi_error_string(atl_init_gpu_context()));
+    return rc;
   }
 
-  atl_set_atmi_initialized();
   return ATMI_STATUS_SUCCESS;
 }
 
 atmi_status_t Runtime::Finalize() {
   atmi_status_t rc = ATMI_STATUS_SUCCESS;
-  atl_reset_atmi_initialized();
   hsa_status_t err = hsa_shut_down();
   if (err != HSA_STATUS_SUCCESS) {
     printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__, "Shutting down HSA",
Index: openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp
+++ openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp
@@ -6,8 +6,6 @@
 #include "atmi_interop_hsa.h"
 #include "internal.h"
 
-using core::atl_is_atmi_initialized;
-
 atmi_status_t atmi_interop_hsa_get_symbol_info(
     std::map<std::string, atl_symbol_info_t> &SymbolInfoTable,
     atmi_mem_place_t place, const char *symbol, void **var_addr,
@@ -21,8 +19,6 @@
      atmi_memcpy(signal, host_add, var_addr, var_size);
   */
 
-  if (!atl_is_atmi_initialized())
-    return ATMI_STATUS_ERROR;
   atmi_machine_t *machine = atmi_machine_get_info();
   if (!symbol || !var_addr || !var_size || !machine)
     return ATMI_STATUS_ERROR;
@@ -56,8 +52,6 @@
                                   &val);
   */
 
-  if (!atl_is_atmi_initialized())
-    return ATMI_STATUS_ERROR;
   atmi_machine_t *machine = atmi_machine_get_info();
   if (!kernel_name || !value || !machine)
     return ATMI_STATUS_ERROR;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102847.347595.patch
Type: text/x-patch
Size: 3084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210525/7f35fec7/attachment-0001.bin>


More information about the Openmp-commits mailing list