From a1f109afe73cf076bac4c94819f9f6fa55305955 Mon Sep 17 00:00:00 2001 From: Jay Cornwall Date: Sat, 9 Jul 2016 18:38:51 -0500 Subject: [PATCH] Recognize all CPU nodes in hsa_signal_create consumer list On multi-node systems only the first CPU node was recognized in the signal consumer list, causing fallback to non-interrupt signals. Change-Id: I9bd0706bafbe046be9d7f210d05fa4cf1fcd16fa [ROCm/ROCR-Runtime commit: b44417043b46a3e6f29352a10a3b7a7009285735] --- .../runtime/hsa-runtime/core/inc/runtime.h | 5 ----- .../runtime/hsa-runtime/core/runtime/hsa.cpp | 15 +++++++++------ .../runtime/hsa-runtime/core/runtime/runtime.cpp | 4 +--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h index d3c6f8b9f4..6d45542150 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h @@ -280,8 +280,6 @@ class Runtime { Agent* blit_agent() { return blit_agent_; } - Agent* host_agent() { return host_agent_; } - const std::vector& system_regions_fine() const { return system_regions_fine_; } @@ -455,9 +453,6 @@ class Runtime { // Deallocator using ::system_region_ std::function system_deallocator_; - // Pointer to a host/cpu agent object. - Agent* host_agent_; - // Pointer to DMA agent. Agent* blit_agent_; diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp index a7648b702c..d48af4f4d6 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa.cpp @@ -783,7 +783,7 @@ hsa_status_t core::Signal* ret; - bool useshost = true; + bool uses_host = false; if (num_consumers > 0) { IS_BAD_PTR(consumers); @@ -796,13 +796,16 @@ hsa_status_t return HSA_STATUS_ERROR_INVALID_ARGUMENT; } - useshost = - (consumer_set.find( - core::Runtime::runtime_singleton_->host_agent()->public_handle()) != - consumer_set.end()); + for (const core::Agent* cpu_agent : + core::Runtime::runtime_singleton_->cpu_agents()) { + uses_host |= + (consumer_set.find(cpu_agent->public_handle()) != consumer_set.end()); + } + } else { + uses_host = true; } - if (core::g_use_interrupt_wait && useshost) { + if (core::g_use_interrupt_wait && uses_host) { ret = new core::InterruptSignal(initial_value); } else { ret = new core::DefaultSignal(initial_value); diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp index 0d397b2240..a93d75c99e 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -188,7 +188,6 @@ void Runtime::RegisterAgent(Agent* agent) { HsaClockCounters clocks; hsaKmtGetClockCounters(0, &clocks); sys_clock_freq_ = clocks.SystemClockFrequencyHz; - host_agent_ = agent; } } else if (agent->device_type() == Agent::DeviceType::kAmdGpuDevice) { gpu_agents_.push_back(agent); @@ -791,8 +790,7 @@ bool Runtime::VMFaultHandler(hsa_signal_value_t val, void* arg) { } Runtime::Runtime() - : host_agent_(NULL), - blit_agent_(NULL), + : blit_agent_(NULL), queue_count_(0), sys_clock_freq_(0), vm_fault_event_(NULL),