From a0ebf06e6edf5c3e407e2b0b5ef8e3fcc474b3ec Mon Sep 17 00:00:00 2001 From: Shweta Khatri Date: Fri, 23 Feb 2024 15:25:22 -0500 Subject: [PATCH] Record interop mapped object in allocation_map_ This allows the VA to be recorded in ROCr so that they are not treated as an invalid pointer in future API calls. Change-Id: I8d1d8ef9816a984c89d30a2179b0ce8940fef1da [ROCm/ROCR-Runtime commit: f2006d68995c6a5e8c08a09c26f7cb8d0147cbc7] --- .../rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp index 148c5e371b..d155d5097f 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -833,6 +833,10 @@ hsa_status_t Runtime::InteropMap(uint32_t num_agents, Agent** agents, *size = info.SizeInBytes; *ptr = info.MemoryAddress; + ScopedAcquire lock(&memory_lock_); + allocation_map_[info.MemoryAddress] = AllocationRegion( + nullptr, info.SizeInBytes, info.SizeInBytes, core::MemoryRegion::AllocateNoFlags); + return HSA_STATUS_SUCCESS; }