[git-p4: depot-paths = "//depot/stg/hsa/drivers/hsa/runtime/": change = 1247220]


[ROCm/ROCR-Runtime commit: 73d43224e9]
Этот коммит содержится в:
Besar Wicaksono (xN/A) TX [TEXT]
2016-03-14 18:42:31 -05:00
родитель 4fb3765f77
Коммит 2d78a85c21
4 изменённых файлов: 51 добавлений и 1 удалений
+2
Просмотреть файл
@@ -17,6 +17,7 @@ void GetInfo::Run() {
std::cout << "------------------------------------------------\n";
AgentProps prop(cpu);
PrintAgentInfo(prop);
PrintPeers(cpu);
std::cout << "------------------------------------------------\n";
hsa_amd_memory_pool_t global_fine = global_fine_[cpu.handle];
@@ -48,6 +49,7 @@ void GetInfo::Run() {
std::cout << "------------------------------------------------\n";
AgentProps prop(gpu);
PrintAgentInfo(prop);
PrintPeers(gpu);
std::cout << "------------------------------------------------\n";
hsa_amd_memory_pool_t global_coarse = global_coarse_[gpu.handle];
+1 -1
Просмотреть файл
@@ -1,7 +1,7 @@
#ifndef GET_INFO_H
#define GET_INFO_H
#include "common/hsa_test.h"
#include "samples/common/hsa_test.h"
class GetInfo : public HsaTest {
public:
+45
Просмотреть файл
@@ -243,6 +243,30 @@ bool HsaTest::Kernel::CreateCodeObjectAndExecutable() {
return true;
}
void HsaTest::GetGpuPeer(hsa_agent_t master,
std::vector<hsa_agent_t>& gpu_peers) {
AgentProps master_prop(master);
for (hsa_agent_t agent : gpus_) {
AgentProps agent_prop(agent);
if (master.handle == agent.handle ||
agent_prop.device_type != HSA_DEVICE_TYPE_GPU) {
continue;
}
hsa_amd_memory_pool_t peer_local_pool = global_coarse_[agent.handle];
hsa_amd_memory_pool_access_t access =
HSA_AMD_MEMORY_POOL_ACCESS_NEVER_ALLOWED;
if (HSA_STATUS_SUCCESS == hsa_amd_agent_memory_pool_get_info(
master, peer_local_pool,
HSA_AMD_AGENT_MEMORY_POOL_INFO_ACCESS,
(void*)&access) &&
access != HSA_AMD_MEMORY_POOL_ACCESS_NEVER_ALLOWED) {
gpu_peers.push_back(agent);
}
}
}
void* HsaTest::AllocateSystemMemory(bool fine_grain, size_t size) {
if (cpus_.size() == 0) {
return NULL;
@@ -423,6 +447,27 @@ void HsaTest::PrintAgentInfo(AgentProps& prop) {
PRINT_ATTRIBUTE(HSA_AGENT_INFO_VERSION_MINOR, prop.version_minor, "");
}
void HsaTest::PrintPeers(hsa_agent_t agent) {
std::cout << "Peer GPUs: ";
std::vector<hsa_agent_t> gpu_peers;
GetGpuPeer(agent, gpu_peers);
if (gpu_peers.size() > 0) {
for (hsa_agent_t peer_agent : gpu_peers) {
// Get the index of the peer in gpus_.
size_t peer_idx = 0;
for (; peer_idx < gpus_.size(); ++peer_idx) {
if (peer_agent.handle == gpus_[peer_idx].handle) {
std::cout << "GPU[" << peer_idx << "] ";
break;
}
}
}
std::cout << std::endl;
} else {
std::cout << "No peer GPUs\n";
}
}
void HsaTest::PrintPoolInfo(PoolProps& prop) {
const char* segment_strings[] = {
"HSA_SEGMENT_GLOBAL", "HSA_AMD_SEGMENT_READONLY",
+3
Просмотреть файл
@@ -96,6 +96,8 @@ class HsaTest {
std::string hsail_file_;
};
virtual void GetGpuPeer(hsa_agent_t master,
std::vector<hsa_agent_t>& gpu_peers);
virtual void* AllocateSystemMemory(bool fine_grain, size_t size);
virtual void* AllocateLocalMemory(hsa_agent_t agent, size_t size);
virtual void FreeMemory(void* ptr);
@@ -104,6 +106,7 @@ class HsaTest {
void* packet);
virtual void PrintAgentInfo(AgentProps& prop);
virtual void PrintPeers(hsa_agent_t agent);
virtual void PrintPoolInfo(PoolProps& prop);
std::string test_name_;