diff --git a/profile/plugin/aie_trace/client/aie_trace.cpp b/profile/plugin/aie_trace/client/aie_trace.cpp index d976bdb0..9b1674e2 100644 --- a/profile/plugin/aie_trace/client/aie_trace.cpp +++ b/profile/plugin/aie_trace/client/aie_trace.cpp @@ -606,6 +606,8 @@ namespace xdp { return false; } + aie::trace::warnIfAieInterfaceTraceContendsWithStartToBytes(metadata); + // Get channel configurations (memory and interface tiles) auto configChannel0 = metadata->getConfigChannel0(); auto configChannel1 = metadata->getConfigChannel1(); diff --git a/profile/plugin/aie_trace/edge/aie_trace.cpp b/profile/plugin/aie_trace/edge/aie_trace.cpp index e8ca44bf..990f106e 100755 --- a/profile/plugin/aie_trace/edge/aie_trace.cpp +++ b/profile/plugin/aie_trace/edge/aie_trace.cpp @@ -274,6 +274,8 @@ namespace xdp { return false; } + aie::trace::warnIfAieInterfaceTraceContendsWithStartToBytes(metadata); + // Get channel configurations (memory and interface tiles) auto configChannel0 = metadata->getConfigChannel0(); auto configChannel1 = metadata->getConfigChannel1(); diff --git a/profile/plugin/aie_trace/util/aie_trace_util.cpp b/profile/plugin/aie_trace/util/aie_trace_util.cpp index 73e56cd4..90890296 100755 --- a/profile/plugin/aie_trace/util/aie_trace_util.cpp +++ b/profile/plugin/aie_trace/util/aie_trace_util.cpp @@ -10,6 +10,7 @@ #include "xdp/profile/device/pl_device_intf.h" #include "xdp/profile/device/tracedefs.h" +#include "core/common/config_reader.h" #include "core/common/message.h" #include "core/include/xrt/xrt_kernel.h" @@ -20,6 +21,7 @@ #include #include #include +#include // *************************************************************** // Anonymous namespace for helper functions local to this file @@ -778,4 +780,48 @@ namespace xdp::aie::trace { } } + static const char* const kStartToBytesMetric = "start_to_bytes_transferred"; + + static bool + aieProfileConfiguresStartToBytesOnInterfaceTiles() + { + if (!xrt_core::config::get_aie_profile()) + return false; + const std::string g = boost::algorithm::trim_copy( + xrt_core::config::get_aie_profile_settings_graph_based_interface_tile_metrics()); + const std::string t = boost::algorithm::trim_copy( + xrt_core::config::get_aie_profile_settings_tile_based_interface_tile_metrics()); + return (g.find(kStartToBytesMetric) != std::string::npos) + || (t.find(kStartToBytesMetric) != std::string::npos); + } + + void + warnIfAieInterfaceTraceContendsWithStartToBytes( + const std::shared_ptr& metadata) + { + static bool s_warned = false; + if (s_warned) + return; + if (!xrt_core::config::get_aie_trace()) + return; + if (!aieProfileConfiguresStartToBytesOnInterfaceTiles()) + return; + + bool traceHasInterfaceTile = false; + for (const auto& tileMetric : metadata->getConfigMetrics()) { + const auto& tile = tileMetric.first; + if (aie::getModuleType(tile.row, metadata->getRowOffset()) == module_type::shim) { + traceHasInterfaceTile = true; + break; + } + } + if (!traceHasInterfaceTile) + return; + + s_warned = true; + std::string msg = + "AIE trace on interface (shim) tiles together with AIE profile start_to_bytes_transferred " + "on interface tiles can contend for the same PL user event; AIE trace data may be wrong."; + xrt_core::message::send(severity_level::warning, "XRT", msg); + } } // namespace xdp::aie::trace diff --git a/profile/plugin/aie_trace/util/aie_trace_util.h b/profile/plugin/aie_trace/util/aie_trace_util.h index 036e2ee7..ea42a86e 100755 --- a/profile/plugin/aie_trace/util/aie_trace_util.h +++ b/profile/plugin/aie_trace/util/aie_trace_util.h @@ -191,7 +191,15 @@ namespace xdp::aie::trace { void reset2ChannelBroadcastNetwork(XAie_DevInst* aieDevInst, std::shared_ptr metadata, uint8_t broadcastId1, uint8_t broadcastId2, uint8_t startCol, uint8_t numCols, uint8_t numRows); - + +/** + * @brief If interface-tile AIE trace and AIE profile \c start_to_bytes_transferred + * (graph/tile interface-tile strings) are both in use, log a one-time warning. + * Call only after \c getIsValidMetrics() is true. + */ + void warnIfAieInterfaceTraceContendsWithStartToBytes( + const std::shared_ptr& metadata); + } // namespace xdp::aie::trace #endif diff --git a/profile/plugin/aie_trace/ve2/aie_trace.cpp b/profile/plugin/aie_trace/ve2/aie_trace.cpp index af5a47f1..f5a0f75b 100644 --- a/profile/plugin/aie_trace/ve2/aie_trace.cpp +++ b/profile/plugin/aie_trace/ve2/aie_trace.cpp @@ -414,6 +414,7 @@ namespace xdp { return false; } + aie::trace::warnIfAieInterfaceTraceContendsWithStartToBytes(metadata); boost::property_tree::ptree aiePartitionPt = xdp::aie::getAIEPartitionInfo(handle); // Currently, assuming only one Hw Context is alive at a time // Column should be relative to the partition, hence startCol is 0.