From f4d18d5256eb248408dce7ba16e0e6bb0285782e Mon Sep 17 00:00:00 2001 From: Ramesh Errabolu Date: Tue, 18 Sep 2018 16:27:30 -0500 Subject: [PATCH] Capture number of Numa Nodes present on system Change-Id: Ic789a6b9da8e316cb483e50b0fe9faa03798f97c [ROCm/ROCR-Runtime commit: 01eea21d6c6ab3b5b71cf8668fcebc16e04ad53a] --- projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h | 3 +++ .../rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 9721f9c9a6..ffed796fdd 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/inc/runtime.h @@ -504,6 +504,9 @@ class Runtime { // System clock frequency. uint64_t sys_clock_freq_; + // Number of Numa Nodes + size_t num_nodes_; + // @brief AMD HSA event to monitor for virtual memory access fault. HsaEvent* vm_fault_event_; 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 9444edcc8f..410076b458 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -253,6 +253,7 @@ void Runtime::DestroyAgents() { } void Runtime::SetLinkCount(size_t num_nodes) { + num_nodes_ = num_nodes; link_matrix_.resize(num_nodes * num_nodes); } @@ -276,7 +277,7 @@ const Runtime::LinkInfo Runtime::GetLinkInfo(uint32_t node_id_from, } uint32_t Runtime::GetIndexLinkInfo(uint32_t node_id_from, uint32_t node_id_to) { - return ((node_id_from * agents_by_node_.size()) + node_id_to); + return ((node_id_from * num_nodes_) + node_id_to); } hsa_status_t Runtime::IterateAgent(hsa_status_t (*callback)(hsa_agent_t agent,