From 936ecd1885924899858ccbb5a5c4553f4dee81dd Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 9 Nov 2018 04:36:25 -0600 Subject: [PATCH] Remove legacy SVM region concept. Also rename blit_agent to region_gpu and add comments to clarify its role in deprecated region API support rather than to do blits. Change-Id: I80b1043db2e1c5d40a58fc801eef70a688ea9169 --- runtime/hsa-runtime/core/inc/runtime.h | 17 ++----- .../core/runtime/amd_gpu_agent.cpp | 3 +- runtime/hsa-runtime/core/runtime/runtime.cpp | 46 ++----------------- 3 files changed, 9 insertions(+), 57 deletions(-) diff --git a/runtime/hsa-runtime/core/inc/runtime.h b/runtime/hsa-runtime/core/inc/runtime.h index 651ced228e..9c189cd51d 100644 --- a/runtime/hsa-runtime/core/inc/runtime.h +++ b/runtime/hsa-runtime/core/inc/runtime.h @@ -290,7 +290,7 @@ class Runtime { const std::vector& gpu_ids() { return gpu_ids_; } - Agent* blit_agent() { return blit_agent_; } + Agent* region_gpu() { return region_gpu_; } const std::vector& system_regions_fine() const { return system_regions_fine_; @@ -468,8 +468,8 @@ class Runtime { // Deallocator using ::system_region_ std::function system_deallocator_; - // Pointer to DMA agent. - Agent* blit_agent_; + // Deprecated HSA Region API GPU (for legacy APU support only) + Agent* region_gpu_; AsyncEventsControl async_events_control_; @@ -477,17 +477,6 @@ class Runtime { AsyncEvents new_async_events_; - // Starting address of SVM address space. - // On APU the cpu and gpu could access the area inside starting and end of - // the SVM address space. - // On dGPU, only the gpu is guaranteed to have access to the area inside the - // SVM address space, since it maybe backed by private gpu VRAM. - uintptr_t start_svm_address_; - - // End address of SVM address space. - // start_svm_address_ + size - uintptr_t end_svm_address_; - // System clock frequency. uint64_t sys_clock_freq_; diff --git a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp index b047d09aad..91a279438b 100644 --- a/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_gpu_agent.cpp @@ -461,8 +461,7 @@ hsa_status_t GpuAgent::VisitRegion(bool include_peer, void* data) const { if (include_peer) { // Only expose system, local, and LDS memory of the blit agent. - if (this->node_id() == - core::Runtime::runtime_singleton_->blit_agent()->node_id()) { + if (this->node_id() == core::Runtime::runtime_singleton_->region_gpu()->node_id()) { hsa_status_t stat = VisitRegion(regions_, callback, data); if (stat != HSA_STATUS_SUCCESS) { return stat; diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 10d144ba04..bd9db6a294 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -202,37 +202,8 @@ void Runtime::RegisterAgent(Agent* agent) { gpu_ids_.push_back(agent->node_id()); - // Assign the first discovered gpu agent as blit agent that will provide - // DMA operation for hsa_memory_copy. - if (blit_agent_ == NULL) { - blit_agent_ = agent; - - // Query the start and end address of the SVM address space in this - // platform. - if (reinterpret_cast(blit_agent_)->profile() == - HSA_PROFILE_BASE) { - std::vector::const_iterator it = - std::find_if(blit_agent_->regions().begin(), - blit_agent_->regions().end(), - [](const core::MemoryRegion* region) { - return ( - reinterpret_cast(region)->IsSvm()); - }); - - assert(it != blit_agent_->regions().end()); - - const amd::MemoryRegion* svm_region = - reinterpret_cast(*it); - - start_svm_address_ = - static_cast(svm_region->GetBaseAddress()); - end_svm_address_ = start_svm_address_ + svm_region->GetPhysicalSize(); - } else { - start_svm_address_ = 0; - end_svm_address_ = os::GetUserModeVirtualMemoryBase() + - os::GetUserModeVirtualMemorySize(); - } - } + // Assign the first discovered gpu agent as region gpu. + if (region_gpu_ == NULL) region_gpu_ = agent; } } @@ -247,7 +218,7 @@ void Runtime::DestroyAgents() { std::for_each(cpu_agents_.begin(), cpu_agents_.end(), DeleteObject()); cpu_agents_.clear(); - blit_agent_ = NULL; + region_gpu_ = NULL; system_regions_fine_.clear(); system_regions_coarse_.clear(); @@ -1191,19 +1162,12 @@ bool Runtime::VMFaultHandler(hsa_signal_value_t val, void* arg) { } Runtime::Runtime() - : blit_agent_(NULL), + : region_gpu_(nullptr), sys_clock_freq_(0), vm_fault_event_(nullptr), vm_fault_signal_(nullptr), system_event_handler_user_data_(nullptr), - ref_count_(0) { - start_svm_address_ = 0; -#if defined(HSA_LARGE_MODEL) - end_svm_address_ = UINT64_MAX; -#else - end_svm_address_ = UINT32_MAX; -#endif -} + ref_count_(0) {} hsa_status_t Runtime::Load() { flag_.Refresh();