diff --git a/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp b/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp index 6c091cb0..ef466f26 100644 --- a/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp +++ b/profile/plugin/ml_timeline/clientDev/ml_timeline.cpp @@ -197,6 +197,9 @@ namespace xdp { ptHeader.put("cycle_size", 2*sizeof(uint32_t)); ptHeader.put("buffer_size", mBufSz); ptHeader.put("num_buffer_segments", mNumBufSegments); + if (!mHwCtxName.empty()) { + ptHeader.put("hw_context_name", mHwCtxName); + } ptTop.add_child("header", ptHeader); // Record Timer TS in JSON diff --git a/profile/plugin/ml_timeline/ml_timeline_impl.h b/profile/plugin/ml_timeline/ml_timeline_impl.h index d5e029e1..a8a49a8b 100644 --- a/profile/plugin/ml_timeline/ml_timeline_impl.h +++ b/profile/plugin/ml_timeline/ml_timeline_impl.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved +// Copyright (C) 2023-2026 Advanced Micro Devices, Inc. All rights reserved #ifndef XDP_PLUGIN_ML_TIMELINE_IMPL_H #define XDP_PLUGIN_ML_TIMELINE_IMPL_H @@ -19,6 +19,7 @@ namespace xdp { VPDatabase* db = nullptr; uint32_t mBufSz; uint32_t mNumBufSegments; + std::string mHwCtxName; public: MLTimelineImpl(VPDatabase* dB, uint32_t sz) @@ -33,6 +34,10 @@ namespace xdp { virtual void updateDevice(void*, uint64_t) = 0; virtual void finishflushDevice(void*, uint64_t) = 0; + + void setHWContextName(const std::string &nm) { + mHwCtxName = nm; + } }; } diff --git a/profile/plugin/ml_timeline/ml_timeline_plugin.cpp b/profile/plugin/ml_timeline/ml_timeline_plugin.cpp index 15f0b68d..edbb3fa2 100644 --- a/profile/plugin/ml_timeline/ml_timeline_plugin.cpp +++ b/profile/plugin/ml_timeline/ml_timeline_plugin.cpp @@ -110,7 +110,7 @@ namespace xdp { { xrt_core::message::send(xrt_core::message::severity_level::info, "XRT", "In ML Timeline Plugin : updateDevice."); - + #ifdef XDP_CLIENT_BUILD if (mMultiImpl.find(hwCtxImpl) != mMultiImpl.end()) { @@ -201,6 +201,18 @@ namespace xdp { auto mlImpl = mMultiImpl[hwCtxImpl].second.get(); mlImpl->updateDevice(hwCtxImpl, deviceId); + try { + xrt::hw_context::cfg_type hwCtxCfgMap = xrt_core::hw_context_int::get_cfg_map(hwContext); + auto itr = hwCtxCfgMap.find("hw_context_name"); + if (hwCtxCfgMap.end() != itr) { + mlImpl->setHWContextName(itr->second); + } + } catch (const std::exception& e) { + std::stringstream msg; + msg << e.what() << " Failed while accessing config map for HW Context Name. " << std::endl; + xrt_core::message::send(xrt_core::message::severity_level::debug, "XRT", msg.str()); + } + #elif defined (XDP_VE2_BUILD) if (mMultiImpl.find(hwCtxImpl) != mMultiImpl.end()) { @@ -270,7 +282,19 @@ namespace xdp { mMultiImpl[hwCtxImpl] = std::make_pair(implId, std::make_unique(db, mBufSz)); auto mlImpl = mMultiImpl[hwCtxImpl].second.get(); mlImpl->updateDevice(hwCtxImpl, deviceId); - + + try { + xrt::hw_context::cfg_type hwCtxCfgMap = xrt_core::hw_context_int::get_cfg_map(hwContext); + auto itr = hwCtxCfgMap.find("hw_context_name"); + if (hwCtxCfgMap.end() != itr) { + mlImpl->setHWContextName(itr->second); + } + } catch (const std::exception& e) { + std::stringstream msg; + msg << e.what() << " Failed while accessing config map for HW Context Name. " << std::endl; + xrt_core::message::send(xrt_core::message::severity_level::debug, "XRT", msg.str()); + } + #endif } diff --git a/profile/plugin/ml_timeline/ve2/ml_timeline.cpp b/profile/plugin/ml_timeline/ve2/ml_timeline.cpp index 0f52a5d8..f2a591f8 100644 --- a/profile/plugin/ml_timeline/ve2/ml_timeline.cpp +++ b/profile/plugin/ml_timeline/ve2/ml_timeline.cpp @@ -182,6 +182,9 @@ namespace xdp { ptHeader.put("cycle_size", 2*sizeof(uint32_t)); ptHeader.put("buffer_size", mBufSz); ptHeader.put("num_buffer_segments", mNumBufSegments); + if (!mHwCtxName.empty()) { + ptHeader.put("hw_context_name", mHwCtxName); + } ptTop.add_child("header", ptHeader); // Record Timer TS in JSON