From 4e93bdc99ce41e04c629bf4fe7b8bd880a1a788c Mon Sep 17 00:00:00 2001 From: Christophe Paquot Date: Mon, 20 Jun 2016 17:08:17 -0700 Subject: [PATCH] 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 --- runtime/hsa-runtime/core/runtime/amd_memory_region.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp b/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp index 678f79e76b..62c9bfa16b 100644 --- a/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp +++ b/runtime/hsa-runtime/core/runtime/amd_memory_region.cpp @@ -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(alternate_va); - + if (alternate_va != 0) { + *agent_ptr = reinterpret_cast(alternate_va); + } else { + *agent_ptr = host_ptr; + } for (core::Agent* gpu : whitelist_gpus) { reinterpret_cast(gpu)->InitDma(); }