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
13 changes: 12 additions & 1 deletion profile/plugin/aie_trace/aie_trace_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,21 @@ void AieTracePluginUnified::updateAIEDevice(void *handle, bool hw_context_flow)
xrt_core::message::send(xrt_core::message::severity_level::warning, "XRT",
msg);
AIEData.valid = false;
return;
}

// System timeline (INI flag): enable only for load_xclbin single-partition designs.
const bool iniEnableTimeline =
xrt_core::config::get_aie_trace_settings_enable_system_timeline();
const bool vitisLoadXclbin =
(db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE);
const auto &overlayCols = AIEData.metadata->getPartitionOverlayStartCols();
const bool multipartitionDesign = (overlayCols.size() > 1);
const bool enableSystemTimeline =
iniEnableTimeline && vitisLoadXclbin && !multipartitionDesign;

// Support system timeline
if (xrt_core::config::get_aie_trace_settings_enable_system_timeline()) {
if (enableSystemTimeline) {
#ifdef _WIN32
std::string deviceName = "win_device";
#else
Expand Down
2 changes: 1 addition & 1 deletion profile/plugin/aie_trace/aie_trace_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AieTracePluginUnified : public XDPPlugin {
struct AIEData {
uint64_t deviceID;
bool valid = false;
std::atomic<bool> pollAIETimerThreadCtrlBool;
std::atomic<bool> pollAIETimerThreadCtrlBool{false};
std::thread pollAIETimerThread;
std::unique_ptr<AIETraceOffloadManager> offloadManager;
std::unique_ptr<AieTraceImpl> implementation;
Expand Down
12 changes: 10 additions & 2 deletions profile/writer/aie_trace/aie_trace_timestamps_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ void AIETraceTimestampsWriter::writeCVSTimestampFile()

void AIETraceTimestampsWriter::writeBinaryTimestampFile()
{
// Move (not copy) all data elements to avoid doubling memory usage
std::vector<counters::DoubleSample> samples =
db->getDynamicInfo().moveAIETimerSamples(mDeviceIndex);

// XDPPlugin::endWrite() runs from finishFlushAIEDevice and again from ~AieTracePluginUnified
// (writeAll). Timer samples are moved out on the first write; a second write would open with
// trunc and destroy the file. Skip when nothing left to emit.
if (samples.empty())
return;

std::fstream aStream;
std::string binaryFileName = getcurrentFileName();
aStream.open(binaryFileName.c_str(), std::fstream::in | std::fstream::out
Expand All @@ -97,8 +107,6 @@ void AIETraceTimestampsWriter::writeBinaryTimestampFile()
aieClockFreqMhz, PACKETSIZE );
AIEBinaryData::AIEEventTimeStamp timeStampEvent;

// Move (not copy) all data elements to avoid doubling memory usage
std::vector<counters::DoubleSample> samples = db->getDynamicInfo().moveAIETimerSamples(mDeviceIndex);
for (auto& sample : samples) {
if (sample.values.size() == 3) {
auto column = static_cast<uint32_t>(sample.values[0]);
Expand Down
Loading