diff --git a/profile/device/aie_trace/aie_trace_offload.cpp b/profile/device/aie_trace/aie_trace_offload.cpp index 789e5a71..003c22db 100644 --- a/profile/device/aie_trace/aie_trace_offload.cpp +++ b/profile/device/aie_trace/aie_trace_offload.cpp @@ -415,8 +415,9 @@ uint64_t AIETraceOffload::syncAndLog(uint64_t index) bd.offloadDone = true; } - // Log nBytes of trace - traceLogger->addAIETraceData(index, hostBuf, nBytes, mEnCircularBuf); + // Log nBytes of trace. Always copy: syncTraceBuf() unmaps the BO before returning. + traceLogger->addAIETraceData(index, hostBuf, nBytes, true); + return nBytes; } diff --git a/profile/plugin/aie_trace/aie_trace_plugin.cpp b/profile/plugin/aie_trace/aie_trace_plugin.cpp index b60cbda6..b628d4fd 100644 --- a/profile/plugin/aie_trace/aie_trace_plugin.cpp +++ b/profile/plugin/aie_trace/aie_trace_plugin.cpp @@ -264,15 +264,18 @@ void AieTracePluginUnified::updateAIEDevice(void *handle, bool hw_context_flow) // uint64_t aieTraceBufSizePLIO = aieTraceBufSize; // uint64_t aieTraceBufSizeGMIO = aieTraceBufSize; if (isPLIO && !configuredOnePlioPartition) { -#if defined(XDP_VE2_BUILD) && defined(XDP_VE2_ZOCL_BUILD) // PLIO flow for VE2 ZOCL build only +#if defined(XDP_CLIENT_BUILD) || (defined(XDP_VE2_BUILD) && !defined(XDP_VE2_ZOCL_BUILD)) + // PLIO not supported on client/XDNA builds +#else XAie_DevInst* devInst = static_cast(AIEData.implementation->setAieDeviceInst(handle, deviceID)); if(!devInst) { xrt_core::message::send(severity_level::warning, "XRT", "Unable to get AIE device instance. AIE event trace will not be available."); return; } - AIEData.offloadManager->configureAndInitPLIO(handle, deviceIntf, aieTraceBufSize, - AIEData.metadata->getNumStreamsPLIO(), devInst); + if (!AIEData.offloadManager->configureAndInitPLIO(handle, deviceIntf, aieTraceBufSize, + AIEData.metadata->getNumStreamsPLIO(), devInst)) + return; #endif configuredOnePlioPartition = true; } diff --git a/profile/plugin/aie_trace/edge/aie_trace.cpp b/profile/plugin/aie_trace/edge/aie_trace.cpp index 990f106e..3590cf7f 100755 --- a/profile/plugin/aie_trace/edge/aie_trace.cpp +++ b/profile/plugin/aie_trace/edge/aie_trace.cpp @@ -255,6 +255,15 @@ namespace xdp { if(!metadata->getRuntimeMetrics()) return; + if (!aieDevice) { + setAieDeviceInst(metadata->getHandle(), metadata->getDeviceID()); + if (!aieDevice) { + xrt_core::message::send(severity_level::warning, "XRT", + "Unable to get AIE device. AIE event trace will not be available."); + return; + } + } + // Set metrics for counters and trace events if (!setMetricsSettings(metadata->getDeviceID(), metadata->getHandle())) { std::string msg("Unable to configure AIE trace control and events. No trace will be generated."); @@ -996,6 +1005,9 @@ namespace xdp { if (!(db->getStaticInfo().isDeviceReady(index))) return; + if (!aieDevInst) + return; + // Only read first timer and assume common time domain across all tiles static auto tileMetrics = metadata->getConfigMetrics(); if (tileMetrics.empty())