Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions profile/plugin/ml_timeline/clientDev/ml_timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion profile/plugin/ml_timeline/ml_timeline_impl.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand All @@ -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;
}
};

}
Expand Down
28 changes: 26 additions & 2 deletions profile/plugin/ml_timeline/ml_timeline_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -270,7 +282,19 @@ namespace xdp {
mMultiImpl[hwCtxImpl] = std::make_pair(implId, std::make_unique<MLTimelineVE2Impl>(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

}
Expand Down
3 changes: 3 additions & 0 deletions profile/plugin/ml_timeline/ve2/ml_timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading