Skip to content

Commit 3bc2b97

Browse files
committed
[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
1 parent 57c660f commit 3bc2b97

File tree

3 files changed

+2
-19
lines changed

3 files changed

+2
-19
lines changed

openmp/libomptarget/plugins/amdgpu/impl/internal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ typedef struct atl_context_s {
7979
bool g_tasks_initialized;
8080
} atl_context_t;
8181
extern atl_context_t atlc;
82-
extern atl_context_t *atlc_p;
8382

8483
#ifdef __cplusplus
8584
}
@@ -118,8 +117,6 @@ extern std::vector<std::map<std::string, atl_symbol_info_t>> SymbolInfoTable;
118117

119118
// ---------------------- Kernel End -------------
120119

121-
extern struct timespec context_init_time;
122-
123120
namespace core {
124121
class TaskgroupImpl;
125122
class TaskImpl;

openmp/libomptarget/plugins/amdgpu/impl/machine.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <vector>
1515

1616
extern ATLMachine g_atl_machine;
17-
extern hsa_region_t atl_cpu_kernarg_region;
1817

1918
void ATLProcessor::addMemory(const ATLMemory &mem) {
2019
for (auto &mem_obj : memories_) {

openmp/libomptarget/plugins/amdgpu/impl/system.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ static const std::map<std::string, KernelArgMD::ValueKind> ArgValueKind = {
130130
atmi_machine_t g_atmi_machine;
131131
ATLMachine g_atl_machine;
132132

133-
hsa_region_t atl_gpu_kernarg_region;
134133
std::vector<hsa_amd_memory_pool_t> atl_gpu_kernarg_pools;
135-
hsa_region_t atl_cpu_kernarg_region;
136134

137135
static std::vector<hsa_executable_t> g_executables;
138136

@@ -143,19 +141,12 @@ std::vector<std::map<std::string, atl_symbol_info_t>> SymbolInfoTable;
143141
bool g_atmi_initialized = false;
144142
bool g_atmi_hostcall_required = false;
145143

146-
struct timespec context_init_time;
147-
int context_init_time_init = 0;
148-
149144
/*
150145
atlc is all internal global values.
151146
The structure atl_context_t is defined in atl_internal.h
152147
Most references will use the global structure prefix atlc.
153-
However the pointer value atlc_p-> is equivalent to atlc.
154-
155148
*/
156-
157149
atl_context_t atlc = {.struct_initialized = false};
158-
atl_context_t *atlc_p = NULL;
159150

160151
namespace core {
161152
/* Machine Info */
@@ -243,7 +234,6 @@ atmi_status_t Runtime::Finalize() {
243234
}
244235

245236
static void atmi_init_context_structs() {
246-
atlc_p = &atlc;
247237
atlc.struct_initialized = true; /* This only gets called one time */
248238
atlc.g_hsa_initialized = false;
249239
atlc.g_gpu_initialized = false;
@@ -517,6 +507,7 @@ static hsa_status_t init_compute_and_memory() {
517507
proc_index++;
518508
}
519509
proc_index = 0;
510+
hsa_region_t atl_cpu_kernarg_region;
520511
atl_cpu_kernarg_region.handle = (uint64_t)-1;
521512
if (cpu_procs.size() > 0) {
522513
err = hsa_agent_iterate_regions(
@@ -533,6 +524,7 @@ static hsa_status_t init_compute_and_memory() {
533524
exit(1);
534525
}
535526
}
527+
hsa_region_t atl_gpu_kernarg_region;
536528
/* Find a memory region that supports kernel arguments. */
537529
atl_gpu_kernarg_region.handle = (uint64_t)-1;
538530
if (gpu_procs.size() > 0) {
@@ -650,11 +642,6 @@ atmi_status_t atl_init_gpu_context() {
650642
if (err != HSA_STATUS_SUCCESS)
651643
return ATMI_STATUS_ERROR;
652644

653-
if (context_init_time_init == 0) {
654-
clock_gettime(CLOCK_MONOTONIC_RAW, &context_init_time);
655-
context_init_time_init = 1;
656-
}
657-
658645
err = hsa_amd_register_system_event_handler(callbackEvent, NULL);
659646
if (err != HSA_STATUS_SUCCESS) {
660647
printf("[%s:%d] %s failed: %s\n", __FILE__, __LINE__,

0 commit comments

Comments
 (0)