From 1b076c43567d3ab98bef468fe200256f8cfdd1da Mon Sep 17 00:00:00 2001 From: pgschuey Date: Fri, 8 Dec 2023 13:48:41 -0700 Subject: [PATCH] AIE profile fixes and re-formatting (#7832) --- .../filetypes/aie_control_config_filetype.cpp | 439 ++++++++++-------- .../filetypes/aie_control_config_filetype.h | 34 +- .../filetypes/base_filetype_impl.h | 25 +- .../client/aie_trace_offload_client.h | 15 +- .../aie_profile/aie_profile_metadata.cpp | 30 +- .../plugin/aie_trace/win/aie_trace.cpp | 2 +- .../profile/plugin/aie_trace/win/aie_trace.h | 2 +- 7 files changed, 291 insertions(+), 256 deletions(-) diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp index df363983659..04b5322d276 100644 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp @@ -24,7 +24,6 @@ #include "xdp/profile/database/static_info/aie_util.h" #include "core/common/message.h" - namespace xdp::aie { namespace pt = boost::property_tree; using severity_level = xrt_core::message::severity_level; @@ -32,6 +31,12 @@ using severity_level = xrt_core::message::severity_level; AIEControlConfigFiletype::AIEControlConfigFiletype(boost::property_tree::ptree& aie_project) : BaseFiletypeImpl(aie_project) {} +std::string +AIEControlConfigFiletype::getMessage(std::string secName) +{ + return "Ignoring AIE metadata section " + secName + " since not found."; +} + driver_config AIEControlConfigFiletype::getDriverConfig() { return xdp::aie::getDriverConfig(aie_meta, "aie_metadata.driver_config"); @@ -59,7 +64,6 @@ AIEControlConfigFiletype::getAIETileRowOffset() { return xdp::aie::getAIETileRowOffset(aie_meta, "aie_metadata.driver_config.aie_tile_row_start"); } - std::vector AIEControlConfigFiletype::getValidGraphs() { return xdp::aie::getValidGraphs(aie_meta, "aie_metadata.graphs"); @@ -68,8 +72,10 @@ AIEControlConfigFiletype::getValidGraphs() { std::vector AIEControlConfigFiletype::getValidPorts() { auto ios = getAllIOs(); - if (ios.empty()) - return {}; + if (ios.empty()) { + xrt_core::message::send(severity_level::info, "XRT", "No valid ports found."); + return {}; + } std::vector ports; @@ -89,14 +95,16 @@ AIEControlConfigFiletype::getValidKernels() { // Grab all kernel to tile mappings auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping"); - if (!kernelToTileMapping) - return {}; + if (!kernelToTileMapping) { + xrt_core::message::send(severity_level::info, "XRT", getMessage("TileMapping.AIEKernelToTileMapping")); + return {}; + } for (auto const &mapping : kernelToTileMapping.get()) { - std::vector names; - std::string functionStr = mapping.second.get("function"); - boost::split(names, functionStr, boost::is_any_of(".")); - std::unique_copy(names.begin(), names.end(), std::back_inserter(kernels)); + std::vector names; + std::string functionStr = mapping.second.get("function"); + boost::split(names, functionStr, boost::is_any_of(".")); + std::unique_copy(names.begin(), names.end(), std::back_inserter(kernels)); } return kernels; @@ -110,22 +118,28 @@ AIEControlConfigFiletype::getTraceGMIOs(){ std::unordered_map AIEControlConfigFiletype::getPLIOs() { + auto pliosMetadata = aie_meta.get_child_optional("aie_metadata.PLIOs"); + if (!pliosMetadata) { + xrt_core::message::send(severity_level::info, "XRT", getMessage("PLIOs")); + return {}; + } + std::unordered_map plios; - for (auto& plio_node : aie_meta.get_child("aie_metadata.PLIOs")) { - io_config plio; + for (auto& plio_node : pliosMetadata.get()) { + io_config plio; - plio.type = 0; - plio.id = plio_node.second.get("id"); - plio.name = plio_node.second.get("name"); - plio.logicalName = plio_node.second.get("logical_name"); - plio.shimColumn = plio_node.second.get("shim_column"); - plio.streamId = plio_node.second.get("stream_id"); - plio.slaveOrMaster = plio_node.second.get("slaveOrMaster"); - plio.channelNum = 0; - plio.burstLength = 0; + plio.type = 0; + plio.id = plio_node.second.get("id"); + plio.name = plio_node.second.get("name"); + plio.logicalName = plio_node.second.get("logical_name"); + plio.shimColumn = plio_node.second.get("shim_column"); + plio.streamId = plio_node.second.get("stream_id"); + plio.slaveOrMaster = plio_node.second.get("slaveOrMaster"); + plio.channelNum = 0; + plio.burstLength = 0; - plios[plio.name] = plio; + plios[plio.name] = plio; } return plios; @@ -134,7 +148,7 @@ AIEControlConfigFiletype::getPLIOs() std::unordered_map AIEControlConfigFiletype::getGMIOs() { -return getChildGMIOs("aie_metadata.GMIOs"); + return getChildGMIOs("aie_metadata.GMIOs"); } std::unordered_map @@ -150,50 +164,52 @@ std::unordered_map AIEControlConfigFiletype::getChildGMIOs( const std::string& childStr) { auto gmiosMetadata = aie_meta.get_child_optional(childStr); - if (!gmiosMetadata) - return {}; + if (!gmiosMetadata) { + xrt_core::message::send(severity_level::info, "XRT", getMessage(childStr)); + return {}; + } std::unordered_map gmios; for (auto& gmio_node : gmiosMetadata.get()) { - io_config gmio; - - // Channel is reported as a unique number: - // 0 : S2MM channel 0 (master/output) - // 1 : S2MM channel 1 - // 2 : MM2S channel 0 (slave/input) - // 3 : MM2S channel 1 - auto slaveOrMaster = gmio_node.second.get("type"); - auto channelNumber = gmio_node.second.get("channel_number"); - - gmio.type = 1; - gmio.id = gmio_node.second.get("id"); - gmio.name = gmio_node.second.get("name"); - gmio.logicalName = gmio_node.second.get("logical_name"); - gmio.slaveOrMaster = slaveOrMaster; - gmio.shimColumn = gmio_node.second.get("shim_column"); - gmio.channelNum = (slaveOrMaster == 0) ? (channelNumber - 2) : channelNumber; - gmio.streamId = gmio_node.second.get("stream_id"); - gmio.burstLength = gmio_node.second.get("burst_length_in_16byte"); - - gmios[gmio.name] = gmio; + io_config gmio; + + // Channel is reported as a unique number: + // 0 : S2MM channel 0 (master/output) + // 1 : S2MM channel 1 + // 2 : MM2S channel 0 (slave/input) + // 3 : MM2S channel 1 + auto slaveOrMaster = gmio_node.second.get("type"); + auto channelNumber = gmio_node.second.get("channel_number"); + + gmio.type = 1; + gmio.id = gmio_node.second.get("id"); + gmio.name = gmio_node.second.get("name"); + gmio.logicalName = gmio_node.second.get("logical_name"); + gmio.slaveOrMaster = slaveOrMaster; + gmio.shimColumn = gmio_node.second.get("shim_column"); + gmio.channelNum = (slaveOrMaster == 0) ? (channelNumber - 2) : channelNumber; + gmio.streamId = gmio_node.second.get("stream_id"); + gmio.burstLength = gmio_node.second.get("burst_length_in_16byte"); + + gmios[gmio.name] = gmio; } return gmios; } std::vector -AIEControlConfigFiletype::getInterfaceTiles( - const std::string& graphName, - const std::string& portName, - const std::string& metricStr, - int16_t channelId, - bool useColumn, - uint32_t minCol, - uint32_t maxCol) +AIEControlConfigFiletype::getInterfaceTiles(const std::string& graphName, + const std::string& portName, + const std::string& metricStr, + int16_t channelId, + bool useColumn, + uint32_t minCol, + uint32_t maxCol) { std::vector tiles; + // PLIO metadata not valid in XDP_MINIMAL_BUILD builds #ifdef XDP_MINIMAL_BUILD auto ios = getGMIOs(); #else @@ -201,75 +217,76 @@ AIEControlConfigFiletype::getInterfaceTiles( #endif for (auto& io : ios) { - auto isMaster = io.second.slaveOrMaster; - auto streamId = io.second.streamId; - auto shimCol = io.second.shimColumn; - auto logicalName = io.second.logicalName; - auto name = io.second.name; - auto type = io.second.type; - auto namePos = name.find_last_of("."); - auto currGraph = name.substr(0, namePos); - auto currPort = name.substr(namePos+1); - - // Make sure this matches what we're looking for - //if ((channelId >= 0) && (channelId != streamId)) - // continue; - if ((portName.compare("all") != 0) - && (portName.compare(currPort) != 0) - && (portName.compare(logicalName) != 0)) - continue; - if ((graphName.compare("all") != 0) - && (graphName.compare(currGraph) != 0)) - continue; - - // Make sure it's desired polarity - // NOTE: input = slave (data flowing from PLIO) - // output = master (data flowing to PLIO) - if ((metricStr != "ports") - && ((isMaster && (metricStr.find("input") != std::string::npos - || metricStr.find("mm2s") != std::string::npos)) - || (!isMaster && (metricStr.find("output") != std::string::npos - || metricStr.find("s2mm") != std::string::npos)))) - continue; - // Make sure column is within specified range (if specified) - if (useColumn && !((minCol <= (uint32_t)shimCol) && ((uint32_t)shimCol <= maxCol))) - continue; - - if ((channelId >= 0) && (channelId != io.second.channelNum)) - continue; - - tile_type tile = {0}; - tile.col = shimCol; - tile.row = 0; - tile.subtype = type; - // Grab stream ID and slave/master (used in configStreamSwitchPorts()) - tile.itr_mem_col = isMaster; - tile.itr_mem_row = streamId; - - tiles.emplace_back(std::move(tile)); + auto isMaster = io.second.slaveOrMaster; + auto streamId = io.second.streamId; + auto shimCol = io.second.shimColumn; + auto logicalName = io.second.logicalName; + auto name = io.second.name; + auto type = io.second.type; + auto namePos = name.find_last_of("."); + auto currGraph = name.substr(0, namePos); + auto currPort = name.substr(namePos+1); + + // Make sure this matches what we're looking for + if ((portName.compare("all") != 0) + && (portName.compare(currPort) != 0) + && (portName.compare(logicalName) != 0)) + continue; + if ((graphName.compare("all") != 0) + && (graphName.compare(currGraph) != 0)) + continue; + + // Make sure it's desired polarity + // NOTE: input = slave (data flowing from PLIO) + // output = master (data flowing to PLIO) + if ((metricStr != "ports") + && ((isMaster && (metricStr.find("input") != std::string::npos + || metricStr.find("mm2s") != std::string::npos)) + || (!isMaster && (metricStr.find("output") != std::string::npos + || metricStr.find("s2mm") != std::string::npos)))) + continue; + // Make sure column is within specified range (if specified) + if (useColumn && !((minCol <= (uint32_t)shimCol) && ((uint32_t)shimCol <= maxCol))) + continue; + + if ((channelId >= 0) && (channelId != io.second.channelNum)) + continue; + + tile_type tile = {0}; + tile.col = shimCol; + tile.row = 0; + tile.subtype = type; + // Grab stream ID and slave/master (used in configStreamSwitchPorts()) + tile.itr_mem_col = isMaster; + tile.itr_mem_row = streamId; + + tiles.emplace_back(std::move(tile)); } if (tiles.empty() && (channelId >= 0)) { - std::string msg = - "No tiles used channel ID " + std::to_string(channelId) + ". Please specify a valid channel ID."; - xrt_core::message::send(severity_level::warning, "XRT", msg); + std::string msg = "No tiles used channel ID " + std::to_string(channelId) + + ". Please specify a valid channel ID."; + xrt_core::message::send(severity_level::warning, "XRT", msg); } return tiles; } std::vector -AIEControlConfigFiletype::getMemoryTiles( - const std::string& graph_name, - const std::string& buffer_name) +AIEControlConfigFiletype::getMemoryTiles(const std::string& graph_name, + const std::string& buffer_name) { if (getHardwareGeneration() == 1) - return {}; + return {}; // Grab all shared buffers - auto sharedBufferTree = aie_meta.get_child_optional("aie_metadata.TileMapping.SharedBufferToTileMapping"); - if (!sharedBufferTree) - return {}; + auto sharedBufferTree = + aie_meta.get_child_optional("aie_metadata.TileMapping.SharedBufferToTileMapping"); + if (!sharedBufferTree) { + xrt_core::message::send(severity_level::info, "XRT", + getMessage("TileMapping.SharedBufferToTileMapping")); + return {}; + } std::vector allTiles; std::vector memTiles; @@ -278,105 +295,130 @@ AIEControlConfigFiletype::getMemoryTiles( // Now parse all shared buffers for (auto const &shared_buffer : sharedBufferTree.get()) { - auto currGraph = shared_buffer.second.get("graph"); - if ((currGraph.find(graph_name) == std::string::npos) - && (graph_name.compare("all") != 0)) - continue; - auto currBuffer = shared_buffer.second.get("bufferName"); - if ((currBuffer.find(buffer_name) == std::string::npos) - && (buffer_name.compare("all") != 0)) - continue; - - tile_type tile; - tile.col = shared_buffer.second.get("column"); - tile.row = shared_buffer.second.get("row") + rowOffset; - allTiles.emplace_back(std::move(tile)); + auto currGraph = shared_buffer.second.get("graph"); + if ((currGraph.find(graph_name) == std::string::npos) + && (graph_name.compare("all") != 0)) + continue; + auto currBuffer = shared_buffer.second.get("bufferName"); + if ((currBuffer.find(buffer_name) == std::string::npos) + && (buffer_name.compare("all") != 0)) + continue; + + tile_type tile; + tile.col = shared_buffer.second.get("column"); + tile.row = shared_buffer.second.get("row") + rowOffset; + allTiles.emplace_back(std::move(tile)); } std::unique_copy(allTiles.begin(), allTiles.end(), std::back_inserter(memTiles), xdp::aie::tileCompare); return memTiles; } -// Find all AIE tiles associated with a graph (kernel_name = all) +// Find all AIE tiles in a graph that use the core (kernel_name = all) std::vector AIEControlConfigFiletype::getAIETiles(const std::string& graph_name) { + auto graphsMetadata = aie_meta.get_child_optional("aie_metadata.graphs"); + if (!graphsMetadata) { + xrt_core::message::send(severity_level::info, "XRT", getMessage("graphs")); + return {}; + } + std::vector tiles; auto rowOffset = getAIETileRowOffset(); int startCount = 0; - for (auto& graph : aie_meta.get_child("aie_metadata.graphs")) { - if ((graph.second.get("name") != graph_name) - && (graph_name.compare("all") != 0)) - continue; + for (auto& graph : graphsMetadata.get()) { + if ((graph.second.get("name") != graph_name) + && (graph_name.compare("all") != 0)) + continue; - int count = startCount; - for (auto& node : graph.second.get_child("core_columns")) { - tiles.push_back(tile_type()); - auto& t = tiles.at(count++); - t.col = static_cast(std::stoul(node.second.data())); - } + int count = startCount; + for (auto& node : graph.second.get_child("core_columns")) { + tiles.push_back(tile_type()); + auto& t = tiles.at(count++); + t.col = static_cast(std::stoul(node.second.data())); + } - int num_tiles = count; - count = startCount; - for (auto& node : graph.second.get_child("core_rows")) - tiles.at(count++).row = static_cast(std::stoul(node.second.data())) + rowOffset; - xdp::aie::throwIfError(count < num_tiles,"core_rows < num_tiles"); - - count = startCount; - for (auto& node : graph.second.get_child("iteration_memory_columns")) - tiles.at(count++).itr_mem_col = static_cast(std::stoul(node.second.data())); - xdp::aie::throwIfError(count < num_tiles,"iteration_memory_columns < num_tiles"); - - count = startCount; - for (auto& node : graph.second.get_child("iteration_memory_rows")) - tiles.at(count++).itr_mem_row = static_cast(std::stoul(node.second.data())); - xdp::aie::throwIfError(count < num_tiles,"iteration_memory_rows < num_tiles"); - - count = startCount; - for (auto& node : graph.second.get_child("iteration_memory_addresses")) - tiles.at(count++).itr_mem_addr = std::stoul(node.second.data()); - xdp::aie::throwIfError(count < num_tiles,"iteration_memory_addresses < num_tiles"); - - count = startCount; - for (auto& node : graph.second.get_child("multirate_triggers")) - tiles.at(count++).is_trigger = (node.second.data() == "true"); - xdp::aie::throwIfError(count < num_tiles,"multirate_triggers < num_tiles"); - - startCount = count; + int num_tiles = count; + count = startCount; + for (auto& node : graph.second.get_child("core_rows")) + tiles.at(count++).row = static_cast(std::stoul(node.second.data())) + rowOffset; + xdp::aie::throwIfError(count < num_tiles,"core_rows < num_tiles"); + + count = startCount; + for (auto& node : graph.second.get_child("iteration_memory_columns")) + tiles.at(count++).itr_mem_col = static_cast(std::stoul(node.second.data())); + xdp::aie::throwIfError(count < num_tiles,"iteration_memory_columns < num_tiles"); + + count = startCount; + for (auto& node : graph.second.get_child("iteration_memory_rows")) + tiles.at(count++).itr_mem_row = static_cast(std::stoul(node.second.data())); + xdp::aie::throwIfError(count < num_tiles,"iteration_memory_rows < num_tiles"); + + count = startCount; + for (auto& node : graph.second.get_child("iteration_memory_addresses")) + tiles.at(count++).itr_mem_addr = std::stoul(node.second.data()); + xdp::aie::throwIfError(count < num_tiles,"iteration_memory_addresses < num_tiles"); + + count = startCount; + for (auto& node : graph.second.get_child("multirate_triggers")) + tiles.at(count++).is_trigger = (node.second.data() == "true"); + xdp::aie::throwIfError(count < num_tiles,"multirate_triggers < num_tiles"); + + startCount = count; } return tiles; } +// Find all AIE tiles in a graph that use core and/or memories (kernel_name = all) +std::vector +AIEControlConfigFiletype::getAllAIETiles(const std::string& graph_name) +{ + std::vector tiles; + tiles = getEventTiles(graph_name, module_type::core); + auto dmaTiles = getEventTiles(graph_name, module_type::dma); + std::unique_copy(dmaTiles.begin(), dmaTiles.end(), back_inserter(tiles), xdp::aie::tileCompare); + return tiles; +} + std::vector -AIEControlConfigFiletype::getEventTiles( - const std::string& graph_name, - module_type type) +AIEControlConfigFiletype::getEventTiles(const std::string& graph_name, + module_type type) { - if (type == module_type::shim) - return {}; + if ((type == module_type::shim) || (type == module_type::mem_tile)) + return {}; + + auto graphsMetadata = aie_meta.get_child_optional("aie_metadata.EventGraphs"); + if (!graphsMetadata) { + xrt_core::message::send(severity_level::info, "XRT", getMessage("EventGraphs")); + return {}; + } const char* col_name = (type == module_type::core) ? "core_columns" : "dma_columns"; const char* row_name = (type == module_type::core) ? "core_rows" : "dma_rows"; std::vector tiles; + auto rowOffset = getAIETileRowOffset(); - for (auto& graph : aie_meta.get_child("aie_metadata.EventGraphs")) { - if (graph.second.get("name") != graph_name) - continue; + for (auto& graph : graphsMetadata.get()) { + auto currGraph = graph.second.get("name"); + if ((currGraph.find(graph_name) == std::string::npos) + && (graph_name.compare("all") != 0)) + continue; - int count = 0; + int count = 0; for (auto& node : graph.second.get_child(col_name)) { - tiles.push_back(tile_type()); - auto& t = tiles.at(count++); - t.col = static_cast(std::stoul(node.second.data())); + tiles.push_back(tile_type()); + auto& t = tiles.at(count++); + t.col = static_cast(std::stoul(node.second.data())); } int num_tiles = count; count = 0; for (auto& node : graph.second.get_child(row_name)) - tiles.at(count++).row = static_cast(std::stoul(node.second.data())); + tiles.at(count++).row = static_cast(std::stoul(node.second.data())) + rowOffset; xdp::aie::throwIfError(count < num_tiles,"rows < num_tiles"); } @@ -387,41 +429,44 @@ AIEControlConfigFiletype::getEventTiles( // kernel_name = all : all tiles in graph // kernel_name = : only tiles used by that specific kernel std::vector -AIEControlConfigFiletype::getTiles( - const std::string& graph_name, - module_type type, - const std::string& kernel_name) +AIEControlConfigFiletype::getTiles(const std::string& graph_name, + module_type type, + const std::string& kernel_name) { if (type == module_type::mem_tile) - return getMemoryTiles(graph_name, kernel_name); + return getMemoryTiles(graph_name, kernel_name); + if ((type == module_type::dma) && (kernel_name.compare("all") == 0)) + return getAllAIETiles(graph_name); // Now search by graph-kernel pairs auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping"); - if (!kernelToTileMapping && kernel_name.compare("all") == 0) - return getAIETiles(graph_name); - if (!kernelToTileMapping) - return {}; + if (!kernelToTileMapping && (kernel_name.compare("all") == 0)) + return getAIETiles(graph_name); + if (!kernelToTileMapping) { + xrt_core::message::send(severity_level::info, "XRT", getMessage("TileMapping.AIEKernelToTileMapping")); + return {}; + } std::vector tiles; auto rowOffset = getAIETileRowOffset(); for (auto const &mapping : kernelToTileMapping.get()) { - auto currGraph = mapping.second.get("graph"); - if ((currGraph.find(graph_name) == std::string::npos) - && (graph_name.compare("all") != 0)) - continue; - if (kernel_name.compare("all") != 0) { - std::vector names; - std::string functionStr = mapping.second.get("function"); - boost::split(names, functionStr, boost::is_any_of(".")); - if (std::find(names.begin(), names.end(), kernel_name) == names.end()) + auto currGraph = mapping.second.get("graph"); + if ((currGraph.find(graph_name) == std::string::npos) + && (graph_name.compare("all") != 0)) continue; - } + if (kernel_name.compare("all") != 0) { + std::vector names; + std::string functionStr = mapping.second.get("function"); + boost::split(names, functionStr, boost::is_any_of(".")); + if (std::find(names.begin(), names.end(), kernel_name) == names.end()) + continue; + } - tile_type tile; - tile.col = mapping.second.get("column"); - tile.row = mapping.second.get("row") + rowOffset; - tiles.emplace_back(std::move(tile)); + tile_type tile; + tile.col = mapping.second.get("column"); + tile.row = mapping.second.get("row") + rowOffset; + tiles.emplace_back(std::move(tile)); } return tiles; } diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.h b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.h index 508cb74d5af..afbbfe42b84 100644 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.h +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.h @@ -20,7 +20,6 @@ #include "base_filetype_impl.h" #include - // *************************************************************** // The implementation specific to the aie_control_config.json file // *************************************************************** @@ -67,32 +66,37 @@ class AIEControlConfigFiletype : public xdp::aie::BaseFiletypeImpl { std::vector getInterfaceTiles(const std::string& graphName, - const std::string& portName = "all", - const std::string& metricStr = "channels", - int16_t channelId = -1, - bool useColumn = false, - uint32_t minCol = 0, - uint32_t maxCol = 0) override; + const std::string& portName = "all", + const std::string& metricStr = "channels", + int16_t channelId = -1, + bool useColumn = false, + uint32_t minCol = 0, + uint32_t maxCol = 0) override; std::vector getMemoryTiles(const std::string& graphName, - const std::string& bufferName = "all") override; - + const std::string& bufferName = "all") override; std::vector getAIETiles(const std::string& graphName) override; - std::vector - getEventTiles( const std::string& graph_name, - module_type type) override; + getAllAIETiles(const std::string& graphName) override; + + std::vector + getEventTiles(const std::string& graph_name, + module_type type) override; std::vector getTiles(const std::string& graph_name, - module_type type, - const std::string& kernel_name = "all") override; + module_type type, + const std::string& kernel_name = "all") override; + + private: + std::string getMessage(std::string secName); + }; -} +} #endif \ No newline at end of file diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/base_filetype_impl.h b/src/runtime_src/xdp/profile/database/static_info/filetypes/base_filetype_impl.h index ad9951f86d3..4b52fa8891b 100644 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/base_filetype_impl.h +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/base_filetype_impl.h @@ -56,30 +56,33 @@ class BaseFiletypeImpl { virtual std::vector - getInterfaceTiles( const std::string& graphName, - const std::string& portName = "all", - const std::string& metricStr = "channels", - int16_t channelId = -1, - bool useColumn = false, - uint32_t minCol = 0, - uint32_t maxCol = 0) = 0; + getInterfaceTiles(const std::string& graphName, + const std::string& portName = "all", + const std::string& metricStr = "channels", + int16_t channelId = -1, + bool useColumn = false, + uint32_t minCol = 0, + uint32_t maxCol = 0) = 0; virtual std::vector getMemoryTiles(const std::string& graphName, - const std::string& bufferName) = 0; + const std::string& bufferName) = 0; virtual std::vector getAIETiles(const std::string& graphName) = 0; + virtual std::vector + getAllAIETiles(const std::string& graphName) = 0; + virtual std::vector getEventTiles(const std::string& graph_name, - module_type type) = 0; + module_type type) = 0; virtual std::vector getTiles(const std::string& graph_name, - module_type type, - const std::string& kernel_name) = 0; + module_type type, + const std::string& kernel_name) = 0; }; } diff --git a/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.h b/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.h index c7483f8fa4a..83396751d47 100644 --- a/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.h +++ b/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.h @@ -24,7 +24,6 @@ #include "core/include/xrt/xrt_kernel.h" #include "xdp/profile/plugin/aie_trace/aie_trace_metadata.h" - extern "C" { #include #include @@ -68,7 +67,6 @@ enum class AIEOffloadThreadStatus { class AIETraceOffload { public: - XDP_EXPORT AIETraceOffload(void* handle, uint64_t id, DeviceIntf*, AIETraceLogger*, bool isPlio, @@ -77,18 +75,12 @@ class AIETraceOffload xrt::hw_context context, std::shared_ptr metadata ); - - XDP_EXPORT virtual ~AIETraceOffload(); -public: - XDP_EXPORT + public: bool initReadTrace(); - XDP_EXPORT void endReadTrace(); - XDP_EXPORT void startOffload(); - XDP_EXPORT void stopOffload(); inline AIETraceLogger* getAIETraceLogger() { return traceLogger; } @@ -104,8 +96,7 @@ class AIETraceOffload void readTrace(bool final) {mReadTrace(final);}; bool isTraceBufferFull() {return false;}; -private: - + private: void* deviceHandle; uint64_t deviceId; DeviceIntf* deviceIntf; @@ -138,7 +129,7 @@ class AIETraceOffload bool mEnCircularBuf; bool mCircularBufOverwrite; -private: + private: void readTraceGMIO(bool final); bool keepOffloading(); void offloadFinished(); diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp index a4696b1dbc1..e7e83989518 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp @@ -177,8 +177,7 @@ namespace xdp { // Resolve metrics for AIE or MEM tiles void AieProfileMetadata::getConfigMetricsForTiles(int moduleIdx, const std::vector& metricsSettings, - const std::vector& graphMetricsSettings, - const module_type mod) + const std::vector& graphMetricsSettings, const module_type mod) { if ((metricsSettings.empty()) && (graphMetricsSettings.empty())) return; @@ -190,16 +189,15 @@ namespace xdp { return; } - uint16_t rowOffset = (mod == module_type::mem_tile) ? 1 : filetype->getAIETileRowOffset(); - auto modName = (mod == module_type::core) ? "aie" : ((mod == module_type::dma) ? "aie_memory" : "memory_tile"); + uint16_t rowOffset = (mod == module_type::mem_tile) ? 1 : filetype->getAIETileRowOffset(); + std::string modName = (mod == module_type::core) ? "aie" + : ((mod == module_type::dma) ? "aie_memory" : "memory_tile"); auto allValidGraphs = filetype->getValidGraphs(); auto allValidKernels = filetype->getValidKernels(); std::set allValidTiles; - auto validTilesVec = filetype->getTiles("all", - mod, - "all"); + auto validTilesVec = filetype->getTiles("all", mod, "all"); std::unique_copy(validTilesVec.begin(), validTilesVec.end(), std::inserter(allValidTiles, allValidTiles.end()), tileCompare); @@ -244,9 +242,7 @@ namespace xdp { continue; } - auto tiles = filetype->getTiles(graphMetrics[i][0], - mod, - graphMetrics[i][1]); + auto tiles = filetype->getTiles(graphMetrics[i][0], mod, graphMetrics[i][1]); for (auto& e : tiles) { configMetrics[moduleIdx][e] = graphMetrics[i][2]; } @@ -288,9 +284,7 @@ namespace xdp { } // Capture all tiles in given graph - auto tiles = filetype->getTiles(graphMetrics[i][0], - mod, - graphMetrics[i][1]); + auto tiles = filetype->getTiles(graphMetrics[i][0], mod, graphMetrics[i][1]); for (auto& e : tiles) { configMetrics[moduleIdx][e] = graphMetrics[i][2]; } @@ -347,9 +341,7 @@ namespace xdp { if ((metrics[i][0].compare("all") != 0) || (metrics[i].size() < 2)) continue; - auto tiles = filetype->getTiles(metrics[i][0], - mod, - "all"); + auto tiles = filetype->getTiles(metrics[i][0], mod, "all"); for (auto& e : tiles) { configMetrics[moduleIdx][e] = metrics[i][1]; } @@ -411,8 +403,8 @@ namespace xdp { } catch (...) { xrt_core::message::send(severity_level::warning, "XRT", - "Tile range specification in tile_based_aie_[memory}_metrics " - "is not of valid format and hence skipped."); + "Tile range specification in tile_based_" + modName + + "_metrics is not valid format and hence skipped."); continue; } @@ -420,7 +412,7 @@ namespace xdp { if ((minCol > maxCol) || (minRow > maxRow)) { std::stringstream msg; msg << "Tile range specification in tile_based_" << modName - << "_metrics is not of valid format and hence skipped."; + << "_metrics is not valid format and hence skipped."; xrt_core::message::send(severity_level::warning, "XRT", msg.str()); continue; } diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.cpp index 35b5410c789..2dad57331eb 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.cpp @@ -216,7 +216,7 @@ namespace xdp { return size; } - void AieTrace_WinImpl::flushAieTileTraceModule() + void AieTrace_WinImpl::flushTraceModules() { if (mTraceFlushLocs.empty() && mMemoryTileTraceFlushLocs.empty() && mInterfaceTileTraceFlushLocs.empty()) diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.h b/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.h index bb4a9a0b27b..303b58b9f7c 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.h +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/win/aie_trace.h @@ -44,7 +44,7 @@ namespace xdp { AieTrace_WinImpl(VPDatabase* database, std::shared_ptr metadata); ~AieTrace_WinImpl() = default; virtual void updateDevice(); - virtual void flushAieTileTraceModule(); + virtual void flushTraceModules(); virtual void freeResources(); virtual void pollTimers(uint64_t index, void* handle); virtual uint64_t checkTraceBufSize(uint64_t size);