Handle alternate_va==0

Have amd::MemoryRegion::Lock not assert if the alternate_va
is null but use the host_ptr instead because in the case where
the src/dst memory pointer is allocated via KFD, the host_ptr
is a GPUVA already.

Change-Id: If44368cc2854d4c0c477ae56e4eeabc37e54c1a5
Dieser Commit ist enthalten in:
Christophe Paquot
2016-06-20 17:08:17 -07:00
Ursprung 38fddca9fe
Commit 4e93bdc99c
@@ -542,9 +542,11 @@ hsa_status_t MemoryRegion::Lock(uint32_t num_agents, const hsa_agent_t* agents,
uint64_t alternate_va = 0;
if (MakeKfdMemoryResident(whitelist_nodes.size(), &whitelist_nodes[0],
host_ptr, size, &alternate_va, map_flag_)) {
assert(alternate_va != 0);
*agent_ptr = reinterpret_cast<void*>(alternate_va);
if (alternate_va != 0) {
*agent_ptr = reinterpret_cast<void*>(alternate_va);
} else {
*agent_ptr = host_ptr;
}
for (core::Agent* gpu : whitelist_gpus) {
reinterpret_cast<GpuAgentInt*>(gpu)->InitDma();
}