From 3970d68ca83a774269aae7bf8f69bc978027520c Mon Sep 17 00:00:00 2001 From: Parth Ashwin Jain <149461152+parthash0804@users.noreply.github.com> Date: Thu, 3 Oct 2024 23:18:57 +0530 Subject: [PATCH] Removed creation of copy of the shared_ptr in its own destructor (#8488) --- .../profile/plugin/pl_deadlock/pl_deadlock_plugin.cpp | 9 +++------ .../xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.cpp b/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.cpp index 932d7dbfed7..23f02346eca 100644 --- a/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.cpp +++ b/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.cpp @@ -167,12 +167,7 @@ namespace xdp { void PLDeadlockPlugin::flushDevice(void* hwCtxImpl) { - xrt::hw_context hwContext = xrt_core::hw_context_int::create_hw_context_from_implementation(hwCtxImpl); - auto coreDevice = xrt_core::hw_context_int::get_core_device(hwContext); - - auto handle = coreDevice->get_device_handle(); - - uint64_t deviceId = db->addDevice(util::getDebugIpLayoutPath(handle)); + uint64_t deviceId = mHwCtxImplToDevIdMap[hwCtxImpl]; mThreadCtrlMap[deviceId] = false; auto it = mThreadMap.find(deviceId); @@ -181,6 +176,7 @@ namespace xdp { mThreadMap.erase(it); mThreadCtrlMap.erase(deviceId); } + mHwCtxImplToDevIdMap.erase(hwCtxImpl); } void PLDeadlockPlugin::updateDevice(void* hwCtxImpl) @@ -191,6 +187,7 @@ namespace xdp { auto handle = coreDevice->get_device_handle(); uint64_t deviceId = db->addDevice(util::getDebugIpLayoutPath(handle)); + mHwCtxImplToDevIdMap[hwCtxImpl] = deviceId; auto it = mThreadMap.find(deviceId); if (it != mThreadMap.end()) { diff --git a/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.h b/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.h index c08b5c52b40..b745ccefec6 100644 --- a/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.h +++ b/src/runtime_src/xdp/profile/plugin/pl_deadlock/pl_deadlock_plugin.h @@ -42,6 +42,7 @@ namespace xdp { std::map mThreadMap; std::map> mThreadCtrlMap; + std::unordered_map mHwCtxImplToDevIdMap; // std::map mThreadMap; // std::map> mThreadCtrlMap; std::mutex mWriteLock;