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


[ROCm/ROCR-Runtime commit: 4e93bdc99c]
This commit is contained in:
Christophe Paquot
2016-06-20 17:08:17 -07:00
vanhempi 125816f08f
commit 25ff46fbb8
@@ -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();
}