From 2cc0fb93817895aeef44dda6342071d0948228a3 Mon Sep 17 00:00:00 2001 From: Christophe Paquot Date: Wed, 13 May 2020 00:26:19 -0700 Subject: [PATCH] Make sure to remove the global var from amd::MemObjMap We need this otherwise ROCr can give us a matching address for another allocation and doing "insert" in ROCclr will not update the map with the newest object. We would then end up using stale objects (yikes) SWDEV-234992 Change-Id: I3475adf9781a9309d64a024fae45181d7e5afb04 --- hipamd/rocclr/hip_platform.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hipamd/rocclr/hip_platform.cpp b/hipamd/rocclr/hip_platform.cpp index 4b94d01045..e23b136cc0 100755 --- a/hipamd/rocclr/hip_platform.cpp +++ b/hipamd/rocclr/hip_platform.cpp @@ -229,6 +229,11 @@ std::vector< std::pair >* PlatformState::unregisterVar(hipMod = reinterpret_cast *>(dvar.shadowVptr); delete tex_hptr; } + for (size_t dev = 0; dev < g_devices.size(); ++dev) { + if (dvar.rvars[dev].getdeviceptr()) { + amd::MemObjMap::RemoveMemObj(dvar.rvars[dev].getdeviceptr()); + } + } vars_.erase(it++); } else { ++it;