Add IOLink support
[git-p4: depot-paths = "//depot/stg/hsa/drivers/hsa/runtime/": change = 1247220]
[ROCm/ROCR-Runtime commit: 73d43224e9]
这个提交包含在:
@@ -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",
|
||||
|
||||
在新工单中引用
屏蔽一个用户