diff --git a/openmp/libomptarget/plugins/amdgpu/impl/atmi.cpp b/openmp/libomptarget/plugins/amdgpu/impl/atmi.cpp --- a/openmp/libomptarget/plugins/amdgpu/impl/atmi.cpp +++ b/openmp/libomptarget/plugins/amdgpu/impl/atmi.cpp @@ -10,13 +10,6 @@ #include #include -/* - * Machine Info - */ -atmi_machine_t *atmi_machine_get_info() { - return core::Runtime::GetMachineInfo(); -} - /* * Data */ diff --git a/openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp b/openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp --- a/openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp +++ b/openmp/libomptarget/plugins/amdgpu/impl/atmi_interop_hsa.cpp @@ -5,6 +5,11 @@ *===------------------------------------------------------------------------*/ #include "atmi_interop_hsa.h" #include "internal.h" +#include "machine.h" + +// TODO: need to get rid of this as well + +extern ATLMachine g_atl_machine; hsa_status_t atmi_interop_hsa_get_symbol_info( const std::map &SymbolInfoTable, @@ -18,11 +23,10 @@ atmi_memcpy(signal, host_add, var_addr, var_size); */ - atmi_machine_t *machine = atmi_machine_get_info(); - if (!symbol || !var_addr || !var_size || !machine) + if (!symbol || !var_addr || !var_size) return HSA_STATUS_ERROR; if (DeviceId < 0 || - DeviceId >= machine->device_count_by_type[ATMI_DEVTYPE_GPU]) + DeviceId >= g_atl_machine.processors().size()) return HSA_STATUS_ERROR; // get the symbol info @@ -52,11 +56,10 @@ &val); */ - atmi_machine_t *machine = atmi_machine_get_info(); - if (!kernel_name || !value || !machine) + if (!kernel_name || !value) return HSA_STATUS_ERROR; if (DeviceId < 0 || - DeviceId >= machine->device_count_by_type[ATMI_DEVTYPE_GPU]) + DeviceId >= g_atl_machine.processors().size()) return HSA_STATUS_ERROR; hsa_status_t status = HSA_STATUS_SUCCESS; diff --git a/openmp/libomptarget/plugins/amdgpu/impl/atmi_runtime.h b/openmp/libomptarget/plugins/amdgpu/impl/atmi_runtime.h --- a/openmp/libomptarget/plugins/amdgpu/impl/atmi_runtime.h +++ b/openmp/libomptarget/plugins/amdgpu/impl/atmi_runtime.h @@ -58,23 +58,6 @@ /** @} */ -/** \defgroup machine ATMI Machine - * @{ - */ -/** - * @brief ATMI's device discovery function to get the current machine's - * topology. - * - * @detail The @p atmi_machine_t structure is a tree-based representation of the - * compute and memory elements in the current node. Once ATMI is initialized, - * this function can be called to retrieve the pointer to this global structure. - * - * @return Returns a pointer to a global structure of tyoe @p atmi_machine_t. - * Returns NULL if ATMI is not initialized. - */ -atmi_machine_t *atmi_machine_get_info(); -/** @} */ - hsa_status_t atmi_memcpy_h2d(hsa_signal_t signal, void *deviceDest, const void *hostSrc, size_t size, hsa_agent_t agent); diff --git a/openmp/libomptarget/plugins/amdgpu/impl/rt.h b/openmp/libomptarget/plugins/amdgpu/impl/rt.h --- a/openmp/libomptarget/plugins/amdgpu/impl/rt.h +++ b/openmp/libomptarget/plugins/amdgpu/impl/rt.h @@ -49,8 +49,6 @@ return instance; } - // machine info - static atmi_machine_t *GetMachineInfo(); // modules static hsa_status_t RegisterModuleFromMemory( void *, size_t, atmi_place_t, diff --git a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp --- a/openmp/libomptarget/plugins/amdgpu/impl/system.cpp +++ b/openmp/libomptarget/plugins/amdgpu/impl/system.cpp @@ -140,8 +140,6 @@ {"hidden_hostcall_buffer", KernelArgMD::ValueKind::HiddenHostcallBuffer}, }; -// global variables. TODO: Get rid of these -atmi_machine_t g_atmi_machine; ATLMachine g_atl_machine; std::vector atl_gpu_kernarg_pools; @@ -154,12 +152,6 @@ atl_context_t atlc = {.struct_initialized = false}; namespace core { -/* Machine Info */ -atmi_machine_t *Runtime::GetMachineInfo() { - if (!atlc.g_hsa_initialized) - return NULL; - return &g_atmi_machine; -} hsa_status_t allow_access_to_all_gpu_agents(void *ptr) { std::vector &gpu_procs = @@ -362,12 +354,7 @@ } } - g_atmi_machine.device_count_by_type[ATMI_DEVTYPE_CPU] = cpu_procs.size(); - g_atmi_machine.device_count_by_type[ATMI_DEVTYPE_GPU] = gpu_procs.size(); - size_t num_procs = cpu_procs.size() + gpu_procs.size(); - // g_atmi_machine.devices = (atmi_device_t *)malloc(num_procs * - // sizeof(atmi_device_t)); atmi_device_t *all_devices = reinterpret_cast( malloc(num_procs * sizeof(atmi_device_t))); int num_iGPUs = 0; @@ -385,17 +372,10 @@ DEBUG_PRINT("dGPU Agents: %d\n", num_dGPUs); DEBUG_PRINT("GPU Agents: %lu\n", gpu_procs.size()); - g_atmi_machine.device_count_by_type[ATMI_DEVTYPE_iGPU] = num_iGPUs; - g_atmi_machine.device_count_by_type[ATMI_DEVTYPE_dGPU] = num_dGPUs; - int cpus_begin = 0; int cpus_end = cpu_procs.size(); int gpus_begin = cpu_procs.size(); int gpus_end = cpu_procs.size() + gpu_procs.size(); - g_atmi_machine.devices_by_type[ATMI_DEVTYPE_CPU] = &all_devices[cpus_begin]; - g_atmi_machine.devices_by_type[ATMI_DEVTYPE_GPU] = &all_devices[gpus_begin]; - g_atmi_machine.devices_by_type[ATMI_DEVTYPE_iGPU] = &all_devices[gpus_begin]; - g_atmi_machine.devices_by_type[ATMI_DEVTYPE_dGPU] = &all_devices[gpus_begin]; int proc_index = 0; for (int i = cpus_begin; i < cpus_end; i++) { all_devices[i].type = cpu_procs[proc_index].type();