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
This commit is contained in:
Sean Keely
2018-11-09 04:36:25 -06:00
والد dda9c17b45
کامیت 936ecd1885
3فایلهای تغییر یافته به همراه9 افزوده شده و 57 حذف شده
@@ -290,7 +290,7 @@ class Runtime {
const std::vector<uint32_t>& gpu_ids() { return gpu_ids_; }
Agent* blit_agent() { return blit_agent_; }
Agent* region_gpu() { return region_gpu_; }
const std::vector<const MemoryRegion*>& system_regions_fine() const {
return system_regions_fine_;
@@ -468,8 +468,8 @@ class Runtime {
// Deallocator using ::system_region_
std::function<void(void*)> 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_;
@@ -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;
@@ -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<amd::GpuAgentInt*>(blit_agent_)->profile() ==
HSA_PROFILE_BASE) {
std::vector<const core::MemoryRegion*>::const_iterator it =
std::find_if(blit_agent_->regions().begin(),
blit_agent_->regions().end(),
[](const core::MemoryRegion* region) {
return (
reinterpret_cast<const amd::MemoryRegion*>(region)->IsSvm());
});
assert(it != blit_agent_->regions().end());
const amd::MemoryRegion* svm_region =
reinterpret_cast<const amd::MemoryRegion*>(*it);
start_svm_address_ =
static_cast<uintptr_t>(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();