[Openmp-commits] [openmp] 3bc2b97 - [AMDGPU][libomptarget] Remove unused global variables

Pushpinder Singh via Openmp-commits openmp-commits at lists.llvm.org
Mon May 17 22:41:00 PDT 2021


Author: Pushpinder Singh
Date: 2021-05-18T05:40:49Z
New Revision: 3bc2b97b34ff1d5f817793f83961192e62d5fc7b

URL: https://github.com/llvm/llvm-project/commit/3bc2b97b34ff1d5f817793f83961192e62d5fc7b
DIFF: https://github.com/llvm/llvm-project/commit/3bc2b97b34ff1d5f817793f83961192e62d5fc7b.diff

LOG: [AMDGPU][libomptarget] Remove unused global variables

This initial patch removes some unused variables from global namespace.
There will more incoming patches for moving global variables to classes
or static members.

Reviewed By: JonChesterfield

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

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/impl/internal.h
    openmp/libomptarget/plugins/amdgpu/impl/machine.cpp
    openmp/libomptarget/plugins/amdgpu/impl/system.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/impl/internal.h b/openmp/libomptarget/plugins/amdgpu/impl/internal.h
index 174a94086b2d..2907de7de6ad 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/internal.h
+++ b/openmp/libomptarget/plugins/amdgpu/impl/internal.h
@@ -79,7 +79,6 @@ typedef struct atl_context_s {
   bool g_tasks_initialized;
 } atl_context_t;
 extern atl_context_t atlc;
-extern atl_context_t *atlc_p;
 
 #ifdef __cplusplus
 }
@@ -118,8 +117,6 @@ extern std::vector<std::map<std::string, atl_symbol_info_t>> SymbolInfoTable;
 
 // ---------------------- Kernel End -------------
 
-extern struct timespec context_init_time;
-
 namespace core {
 class TaskgroupImpl;
 class TaskImpl;

diff  --git a/openmp/libomptarget/plugins/amdgpu/impl/machine.cpp b/openmp/libomptarget/plugins/amdgpu/impl/machine.cpp
index ff8ac1c3550b..fecd954a02eb 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/machine.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/impl/machine.cpp
@@ -14,7 +14,6 @@
 #include <vector>
 
 extern ATLMachine g_atl_machine;
-extern hsa_region_t atl_cpu_kernarg_region;
 
 void ATLProcessor::addMemory(const ATLMemory &mem) {
   for (auto &mem_obj : memories_) {

diff  --git a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
index 90de4bb171c3..5e45bdba56a7 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp
@@ -130,9 +130,7 @@ static const std::map<std::string, KernelArgMD::ValueKind> ArgValueKind = {
 atmi_machine_t g_atmi_machine;
 ATLMachine g_atl_machine;
 
-hsa_region_t atl_gpu_kernarg_region;
 std::vector<hsa_amd_memory_pool_t> atl_gpu_kernarg_pools;
-hsa_region_t atl_cpu_kernarg_region;
 
 static std::vector<hsa_executable_t> g_executables;
 
@@ -143,19 +141,12 @@ std::vector<std::map<std::string, atl_symbol_info_t>> SymbolInfoTable;
 bool g_atmi_initialized = false;
 bool g_atmi_hostcall_required = false;
 
-struct timespec context_init_time;
-int context_init_time_init = 0;
-
 /*
    atlc is all internal global values.
    The structure atl_context_t is defined in atl_internal.h
    Most references will use the global structure prefix atlc.
-   However the pointer value atlc_p-> is equivalent to atlc.
-
 */
-
 atl_context_t atlc = {.struct_initialized = false};
-atl_context_t *atlc_p = NULL;
 
 namespace core {
 /* Machine Info */
@@ -243,7 +234,6 @@ atmi_status_t Runtime::Finalize() {
 }
 
 static void atmi_init_context_structs() {
-  atlc_p = &atlc;
   atlc.struct_initialized = true; /* This only gets called one time */
   atlc.g_hsa_initialized = false;
   atlc.g_gpu_initialized = false;
@@ -517,6 +507,7 @@ static hsa_status_t init_compute_and_memory() {
     proc_index++;
   }
   proc_index = 0;
+  hsa_region_t atl_cpu_kernarg_region;
   atl_cpu_kernarg_region.handle = (uint64_t)-1;
   if (cpu_procs.size() > 0) {
     err = hsa_agent_iterate_regions(
@@ -533,6 +524,7 @@ static hsa_status_t init_compute_and_memory() {
       exit(1);
     }
   }
+  hsa_region_t atl_gpu_kernarg_region;
   /* Find a memory region that supports kernel arguments.  */
   atl_gpu_kernarg_region.handle = (uint64_t)-1;
   if (gpu_procs.size() > 0) {
@@ -650,11 +642,6 @@ atmi_status_t atl_init_gpu_context() {
   if (err != HSA_STATUS_SUCCESS)
     return ATMI_STATUS_ERROR;
 
-  if (context_init_time_init == 0) {
-    clock_gettime(CLOCK_MONOTONIC_RAW, &context_init_time);
-    context_init_time_init = 1;
-  }
-
   err = hsa_amd_register_system_event_handler(callbackEvent, NULL);
   if (err != HSA_STATUS_SUCCESS) {
     printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__,


        


More information about the Openmp-commits mailing list