hipHostMalloc allocation are mapped to all devices by default.

Support hipHostMallocPortable flag.
Default flags are hipHostMallocPortable | hipHostMallocMapped.

Also:
-refactor tests to move addCount and addCountReverse into HipTest
namespace.
-test multi-GPU host memory.
This commit is contained in:
Ben Sander
2017-05-10 17:32:25 -05:00
parent e0c3ea15b2
commit c3ccaa01e5
7 changed files with 181 additions and 96 deletions
+9
View File
@@ -118,6 +118,7 @@ bool g_visible_device = false;
unsigned g_deviceCnt;
std::vector<int> g_hip_visible_devices;
hsa_agent_t g_cpu_agent;
hsa_agent_t *g_allAgents; // CPU agents + all the visible GPU agents.
unsigned g_numLogicalThreads;
std::atomic<int> g_lastShortTid(1);
@@ -1389,6 +1390,14 @@ void ihipInit()
g_deviceCnt++;
}
}
g_allAgents = static_cast<hsa_agent_t*> (malloc((g_deviceCnt+1) * sizeof(hsa_agent_t)));
g_allAgents[0] = g_cpu_agent;
for (int i=0; i<g_deviceCnt; i++) {
g_allAgents[i+1] = g_deviceArray[i]->_hsaAgent;
}
g_numLogicalThreads = std::thread::hardware_concurrency();
// If HIP_VISIBLE_DEVICES is not set, make sure all devices are initialized