diff --git a/src/runtime_src/core/common/api/hw_context_int.h b/src/runtime_src/core/common/api/hw_context_int.h index 40353beb138..1215de1288d 100644 --- a/src/runtime_src/core/common/api/hw_context_int.h +++ b/src/runtime_src/core/common/api/hw_context_int.h @@ -15,6 +15,8 @@ namespace xrt_core { namespace hw_context_int { // Get the core_device from this context +// Exported for xdp access +XRT_CORE_COMMON_EXPORT std::shared_ptr get_core_device(const xrt::hw_context& ctx); diff --git a/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp b/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp index ab24a194a10..9636f62406a 100755 --- a/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "aie_util.h" @@ -66,24 +67,20 @@ namespace aie { int getHardwareGeneration(const boost::property_tree::ptree& aie_meta) { - static int hwGen = 1; - static bool gotValue = false; - if (!gotValue) { + static std::optional hwGen; + if (!hwGen.has_value()) { hwGen = aie_meta.get_child("aie_metadata.driver_config.hw_gen").get_value(); - gotValue = true; } - return hwGen; + return *hwGen; } uint16_t getAIETileRowOffset(const boost::property_tree::ptree& aie_meta) { - static uint16_t rowOffset = 1; - static bool gotValue = false; - if (!gotValue) { + static std::optional rowOffset; + if (!rowOffset.has_value()) { rowOffset = aie_meta.get_child("aie_metadata.driver_config.aie_tile_row_start").get_value(); - gotValue = true; } - return rowOffset; + return *rowOffset; } aiecompiler_options getAIECompilerOptions(const boost::property_tree::ptree& aie_meta) diff --git a/src/runtime_src/xdp/profile/database/static_info_database.cpp b/src/runtime_src/xdp/profile/database/static_info_database.cpp index da3e079215f..9c39a418a39 100644 --- a/src/runtime_src/xdp/profile/database/static_info_database.cpp +++ b/src/runtime_src/xdp/profile/database/static_info_database.cpp @@ -1307,6 +1307,13 @@ namespace xdp { parseXrtIPMetadata(deviceId, device); } + + void VPStaticDatabase::updateDeviceClient(uint64_t deviceId, std::shared_ptr device) + { + xrt::xclbin xrtXclbin = device->get_xclbin(device->get_xclbin_uuid()); + updateDevice(deviceId, xrtXclbin); + } + // Return true if we should reset the device information. // Return false if we should not reset device information bool VPStaticDatabase::resetDeviceInfo(uint64_t deviceId, const std::shared_ptr& device) diff --git a/src/runtime_src/xdp/profile/database/static_info_database.h b/src/runtime_src/xdp/profile/database/static_info_database.h index 2f8171fbeef..eb796805595 100644 --- a/src/runtime_src/xdp/profile/database/static_info_database.h +++ b/src/runtime_src/xdp/profile/database/static_info_database.h @@ -264,6 +264,7 @@ namespace xdp { XDP_EXPORT Memory* getMemory(uint64_t deviceId, int32_t memId) ; // Reseting device information whenever a new xclbin is added XDP_EXPORT void updateDevice(uint64_t deviceId, void* devHandle) ; + XDP_EXPORT void updateDeviceClient(uint64_t deviceId, std::shared_ptr device); // ********************************************************* // ***** Functions related to trace_processor tool ***** 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 1a1be2653f6..7d3720af44a 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 @@ -27,7 +27,6 @@ #include "core/common/message.h" #include "core/common/xrt_profiling.h" #include "xdp/profile/database/database.h" -#include "xdp/profile/database/static_info/aie_util.h" #include "xdp/profile/plugin/vp_base/vp_base_plugin.h" namespace xdp { @@ -40,7 +39,6 @@ namespace xdp { #ifdef XDP_MINIMAL_BUILD try { pt::read_json("aie_control_config.json", aie_meta); - invalidXclbinMetadata = false; } catch (...) { std::stringstream msg; msg << "The file aie_control_config.json is required in the same directory as the host executable to run AIE Profile."; @@ -54,8 +52,7 @@ namespace xdp { #else auto device = xrt_core::get_userpf_device(handle); auto data = device->get_axlf_section(AIE_METADATA); - invalidXclbinMetadata = (!data.first || !data.second); - read_aie_metadata(data.first, data.second, aie_meta); + aie::readAIEMetadata(data.first, data.second, aie_meta); #endif // Verify settings from xrt.ini @@ -149,42 +146,6 @@ namespace xdp { } } - int AieProfileMetadata::getHardwareGen() - { - static int hwGen = 1; - static bool gotValue = false; - - if (!gotValue) { - if (invalidXclbinMetadata) { - hwGen = 1; - } else { - hwGen = aie_meta.get_child("aie_metadata.driver_config.hw_gen").get_value(); - } - - gotValue = true; - } - - return hwGen; - } - - uint16_t AieProfileMetadata::getAIETileRowOffset() - { - static uint16_t rowOffset = 1; - static bool gotValue = false; - - if (!gotValue) { - if (invalidXclbinMetadata) { - rowOffset = 1; - } else { - rowOffset = aie_meta.get_child("aie_metadata.driver_config.aie_tile_row_start").get_value(); - } - - gotValue = true; - } - - return rowOffset; - } - std::vector AieProfileMetadata::getSettingsVector(std::string settingsString) { if (settingsString.empty()) @@ -200,166 +161,12 @@ namespace xdp { return settingsVector; } - // Find all MEM tiles associated with a graph and kernel - // kernel_name = all : all tiles in graph - // kernel_name = : only tiles used by that specific kernel - std::vector AieProfileMetadata::get_mem_tiles(const std::string& graph_name, - const std::string& kernel_name) - { - if (getHardwareGen() == 1) - return {}; - - if (invalidXclbinMetadata) - return {}; - - // Grab all shared buffers - auto sharedBufferTree = aie_meta.get_child_optional("aie_metadata.TileMapping.SharedBufferToTileMapping"); - - if (!sharedBufferTree) - return {}; - - std::vector allTiles; - - std::vector memTiles; - - // Always one row of interface tiles - uint16_t rowOffset = 1; - - // 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; - - if (kernel_name.compare("all") != 0) { - std::vector names; - std::string functionStr = shared_buffer.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 = 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), tileCompare); - return memTiles; - } - inline void throw_if_error(bool err, const char* msg) { if (err) throw std::runtime_error(msg); } - std::vector AieProfileMetadata::get_event_tiles(const std::string& graph_name, module_type type) - { - if (invalidXclbinMetadata) - return {}; - - // Interface tiles use different method - if (type == module_type::shim) - 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(); - - int startCount = 0; - - for (auto& graph : aie_meta.get_child("aie_metadata.EventGraphs")) { - auto currGraph = graph.second.get("name"); - - if ((currGraph.find(graph_name) == std::string::npos) && (graph_name.compare("all") != 0)) - continue; - - int count = startCount; - - 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())); - } - - int num_tiles = count; - count = startCount; - - for (auto& node : graph.second.get_child(row_name)) - tiles.at(count++).row = static_cast(std::stoul(node.second.data())) + rowOffset; - - throw_if_error(count < num_tiles, "rows < num_tiles"); - startCount = count; - } - - return tiles; - } - - // Find all AIE tiles associated with a graph and module type (kernel_name = all) - std::vector AieProfileMetadata::get_aie_tiles( const std::string& graph_name, module_type type) - { - std::vector tiles; - tiles = get_event_tiles(graph_name, module_type::core); - if (type == module_type::dma) { - auto dmaTiles = get_event_tiles(graph_name, module_type::dma); - std::unique_copy(dmaTiles.begin(), dmaTiles.end(), back_inserter(tiles), tileCompare); - } - - return tiles; - } - - std::vector AieProfileMetadata::get_tiles(const std::string& graph_name, - module_type type, const std::string& kernel_name) - { - if (type == module_type::mem_tile) - return get_mem_tiles(graph_name, kernel_name); - if (kernel_name.compare("all") == 0) - return get_aie_tiles(graph_name, type); - - // Now search by graph-kernel pairs - if (invalidXclbinMetadata) - return {}; - - // Grab all kernel to tile mappings - auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping"); - if (!kernelToTileMapping) - 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()) - continue; - } - - tile_type tile; - tile.col = mapping.second.get("column"); - tile.row = mapping.second.get("row") + rowOffset; - tiles.emplace_back(std::move(tile)); - } - - return tiles; - } - // Resolve metrics for AIE or MEM tiles void AieProfileMetadata::getConfigMetricsForTiles(int moduleIdx, const std::vector& metricsSettings, const std::vector& graphMetricsSettings, @@ -368,21 +175,21 @@ namespace xdp { if ((metricsSettings.empty()) && (graphMetricsSettings.empty())) return; - if ((getHardwareGen() == 1) && (mod == module_type::mem_tile)) { + if ((aie::getHardwareGeneration(aie_meta) == 1) && (mod == module_type::mem_tile)) { xrt_core::message::send(severity_level::warning, "XRT", "MEM tiles are not available in AIE1. Profile " "settings will be ignored."); return; } - uint16_t rowOffset = (mod == module_type::mem_tile) ? 1 : getAIETileRowOffset(); + uint16_t rowOffset = (mod == module_type::mem_tile) ? 1 : aie::getAIETileRowOffset(aie_meta); auto modName = (mod == module_type::core) ? "aie" : ((mod == module_type::dma) ? "aie_memory" : "memory_tile"); auto allValidGraphs = aie::getValidGraphs(aie_meta); auto allValidKernels = aie::getValidKernels(aie_meta); std::set allValidTiles; - auto validTilesVec = get_tiles("all", mod); + auto validTilesVec = aie::getTiles(aie_meta,"all", mod); std::unique_copy(validTilesVec.begin(), validTilesVec.end(), std::inserter(allValidTiles, allValidTiles.end()), tileCompare); @@ -427,7 +234,7 @@ namespace xdp { continue; } - auto tiles = get_tiles(graphMetrics[i][0], mod, graphMetrics[i][1]); + auto tiles = aie::getTiles(aie_meta,graphMetrics[i][0], mod, graphMetrics[i][1]); for (auto& e : tiles) { configMetrics[moduleIdx][e] = graphMetrics[i][2]; } @@ -469,7 +276,7 @@ namespace xdp { } // Capture all tiles in given graph - auto tiles = get_tiles(graphMetrics[i][0], mod, graphMetrics[i][1]); + auto tiles = aie::getTiles(aie_meta,graphMetrics[i][0], mod, graphMetrics[i][1]); for (auto& e : tiles) { configMetrics[moduleIdx][e] = graphMetrics[i][2]; } @@ -526,12 +333,27 @@ namespace xdp { if ((metrics[i][0].compare("all") != 0) || (metrics[i].size() < 2)) continue; - auto tiles = get_tiles(metrics[i][0], mod); + auto tiles = aie::getTiles(aie_meta,metrics[i][0], mod); for (auto& e : tiles) { configMetrics[moduleIdx][e] = metrics[i][1]; } // Grab channel numbers (if specified; MEM tiles only) + // One channel specified + if (metrics[i].size() == 3) { + try { + for (auto& e : tiles) { + configChannel0[e] = static_cast(std::stoul(metrics[i][2])); + } + } + catch (...) { + std::stringstream msg; + msg << "Channel specifications in tile_based_" << modName << "_metrics are not valid and hence ignored."; + xrt_core::message::send(severity_level::warning, "XRT", msg.str()); + } + } + + // Both channel specified if (metrics[i].size() == 4) { try { for (auto& e : tiles) { @@ -1003,17 +825,9 @@ namespace xdp { } } - void AieProfileMetadata::read_aie_metadata(const char* data, size_t size, pt::ptree& aie_project) - { - std::stringstream aie_stream; - aie_stream.write(data, size); - pt::read_json(aie_stream, aie_project); - } - uint8_t AieProfileMetadata::getMetricSetIndex(std::string metricString, module_type mod) { auto stringVector = metricStrings[mod]; - auto itr = std::find(stringVector.begin(), stringVector.end(), metricString); if (itr != stringVector.cend()) { diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.h b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.h index 2307e7c389a..5fdc8a9b071 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.h +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.h @@ -25,27 +25,53 @@ #include "core/include/xrt/xrt_hw_context.h" #include "xdp/config.h" #include "xdp/profile/database/static_info/aie_constructs.h" +#include "xdp/profile/database/static_info/aie_util.h" namespace xdp { - constexpr unsigned int NUM_CORE_COUNTERS = 4; - constexpr unsigned int NUM_MEMORY_COUNTERS = 2; - constexpr unsigned int NUM_SHIM_COUNTERS = 2; - constexpr unsigned int NUM_MEM_TILE_COUNTERS = 4; - - class AieProfileMetadata { - private: - // Currently supporting Core, Memory, Interface Tiles, and MEM Tiles - static constexpr int NUM_MODULES = 4; - - const std::vector moduleNames = - {"aie", "aie_memory", "interface_tile", "memory_tile"}; - const std::string defaultSets[NUM_MODULES] = - {"write_throughputs", "write_throughputs", "input_throughputs", "input_channels"}; - const int numCountersMod[NUM_MODULES] = - {NUM_CORE_COUNTERS, NUM_MEMORY_COUNTERS, NUM_SHIM_COUNTERS, NUM_MEM_TILE_COUNTERS}; - const module_type moduleTypes[NUM_MODULES] = - {module_type::core, module_type::dma, module_type::shim, module_type::mem_tile}; +constexpr unsigned int NUM_CORE_COUNTERS = 4; +constexpr unsigned int NUM_MEMORY_COUNTERS = 2; +constexpr unsigned int NUM_SHIM_COUNTERS = 2; +constexpr unsigned int NUM_MEM_TILE_COUNTERS = 4; + +class AieProfileMetadata { + private: + // Currently supporting Core, Memory, Interface Tiles, and MEM Tiles + static constexpr int NUM_MODULES = 4; + + std::map > metricStrings { + { + module_type::core, { + "heat_map", "stalls", "execution", + "floating_point", "stream_put_get", "write_throughputs", + "read_throughputs", "aie_trace", "events"} + }, + { + module_type::dma, { + "conflicts", "dma_locks", "dma_stalls_s2mm", + "dma_stalls_mm2s", "write_throughputs", "read_throughputs"} + }, + { + module_type::shim, {"input_throughputs", "output_throughputs", "packets"} + + }, + { + module_type::mem_tile, { + "input_channels", "input_channels_details", + "output_channels", "output_channels_details", + "memory_stats", "mem_trace" + } + } + }; + + const std::vector moduleNames = + {"aie", "aie_memory", "interface_tile", "memory_tile"}; + const std::string defaultSets[NUM_MODULES] = + {"write_throughputs", "write_throughputs", "input_throughputs", "input_channels"}; + const int numCountersMod[NUM_MODULES] = + {NUM_CORE_COUNTERS, NUM_MEMORY_COUNTERS, NUM_SHIM_COUNTERS, NUM_MEM_TILE_COUNTERS}; + const module_type moduleTypes[NUM_MODULES] = + {module_type::core, module_type::dma, module_type::shim, module_type::mem_tile}; uint32_t pollingInterval; uint64_t deviceID; @@ -53,104 +79,51 @@ namespace xdp { void* handle; xrt::hw_context hwContext; - std::map > metricStrings { - { - module_type::core, { - "heat_map", "stalls", "execution", - "floating_point", "stream_put_get", "write_throughputs", - "read_throughputs", "aie_trace", "events"} - }, - { - module_type::dma, { - "conflicts", "dma_locks", "dma_stalls_s2mm", - "dma_stalls_mm2s", "write_throughputs", "read_throughputs"} - }, - { - module_type::shim, {"input_throughputs", "output_throughputs", "packets"} - - }, - { - module_type::mem_tile, { - "input_channels", "input_channels_details", - "output_channels", "output_channels_details", - "memory_stats", "mem_trace" - } - } - }; - std::vector> configMetrics; std::map configChannel0; std::map configChannel1; boost::property_tree::ptree aie_meta; - bool invalidXclbinMetadata; - - public: - AieProfileMetadata(uint64_t deviceID, void* handle); - - uint64_t getDeviceID() {return deviceID;} - void* getHandle() {return handle;} - uint32_t getPollingIntervalVal() {return pollingInterval;} - - void checkSettings(); - int getHardwareGen(); - uint16_t getAIETileRowOffset(); - std::vector getSettingsVector(std::string settingsString); - - void getConfigMetricsForTiles(int moduleIdx, - const std::vector& metricsSettings, - const std::vector& graphMetricsSettings, - const module_type mod); - void getConfigMetricsForInterfaceTiles(int moduleIdx, - const std::vector& metricsSettings, - const std::vector graphMetricsSettings); - uint8_t getMetricSetIndex(std::string metricSet, module_type mod); - static void read_aie_metadata(const char* data, size_t size, boost::property_tree::ptree& aie_project); - - std::vector get_mem_tiles(const std::string& graph_name, - const std::string& kernel_name = "all"); - std::vector get_event_tiles(const std::string& graph_name, - module_type type); - std::vector get_aie_tiles(const std::string& graph_name, - module_type type); - std::vector get_tiles(const std::string& graph_name, - module_type type, - const std::string& kernel_name = "all"); - - std::map getConfigMetrics(int module){ return configMetrics[module];} - std::map getConfigChannel0() {return configChannel0;} - std::map getConfigChannel1() {return configChannel1;} - boost::property_tree::ptree getAIEConfigMetadata(std::string config_name); - - bool checkModule(int module) { return (module >= 0 && module < NUM_MODULES);} - double getClockFreqMhz() {return clockFreqMhz;} - std::string getModuleName(int module) - { - if (checkModule(module)) - return moduleNames[module]; - else - return moduleNames[0]; - } - int getNumCountersMod(int module) - { - if (checkModule(module)) - return numCountersMod[module]; - else - return numCountersMod[0]; - } - module_type getModuleType(int module) - { - if (checkModule(module)) - return moduleTypes[module]; - else - return moduleTypes[0]; - } - int getNumModules() {return NUM_MODULES;} + public: + AieProfileMetadata(uint64_t deviceID, void* handle); + + uint64_t getDeviceID() {return deviceID;} + void* getHandle() {return handle;} + uint32_t getPollingIntervalVal() {return pollingInterval;} + void checkSettings(); + + std::vector getSettingsVector(std::string settingsString); + + void getConfigMetricsForTiles(int moduleIdx, + const std::vector& metricsSettings, + const std::vector& graphMetricsSettings, + const module_type mod); + void getConfigMetricsForInterfaceTiles(int moduleIdx, + const std::vector& metricsSettings, + const std::vector graphMetricsSettings); + uint8_t getMetricSetIndex(std::string metricSet, module_type mod); + + std::map getConfigMetrics(int module){ return configMetrics[module];} + std::map getConfigChannel0() {return configChannel0;} + std::map getConfigChannel1() {return configChannel1;} + boost::property_tree::ptree getAIEConfigMetadata(std::string config_name); + + bool checkModule(int module) { return (module >= 0 && module < NUM_MODULES);} + std::string getModuleName(int module) { return moduleNames[module]; } + int getNumCountersMod(int module){ return numCountersMod[module]; } + module_type getModuleType(int module) { return moduleTypes[module]; } + + uint16_t getAIETileRowOffset() { return aie::getAIETileRowOffset(aie_meta);} + uint16_t getHardwareGen() { return aie::getHardwareGeneration(aie_meta);} + + double getClockFreqMhz() {return clockFreqMhz;} + int getNumModules() {return NUM_MODULES;} xrt::hw_context getHwContext(){return hwContext;} void setHwContext(xrt::hw_context c) { hwContext = std::move(c); } - }; -} +}; + +} // end XDP namespace #endif diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_plugin.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_plugin.cpp index 1fa2165d873..65349c91369 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_plugin.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_plugin.cpp @@ -116,15 +116,25 @@ namespace xdp { if (!handle) return; + /* + * handle relates to hw context handle in case of Client XRT + */ + #ifdef XDP_MINIMAL_BUILD + xrt::hw_context context = xrt_core::hw_context_int::create_hw_context_from_implementation(handle); + auto device = xrt_core::hw_context_int::get_core_device(context); + #else + auto device = xrt_core::get_userpf_device(handle); + #endif + auto deviceID = getDeviceIDFromHandle(handle); // Update the static database with information from xclbin - (db->getStaticInfo()).updateDevice(deviceID, handle); - { #ifdef XDP_MINIMAL_BUILD + (db->getStaticInfo()).updateDeviceClient(deviceID, device); (db->getStaticInfo()).setDeviceName(deviceID, "win_device"); #else + (db->getStaticInfo()).updateDevice(deviceID, handle); struct xclDeviceInfo2 info; if (xclGetDeviceInfo2(handle, &info) == 0) { (db->getStaticInfo()).setDeviceName(deviceID, std::string(info.mName)); @@ -145,7 +155,7 @@ namespace xdp { AIEData.metadata = std::make_shared(deviceID, handle); #ifdef XDP_MINIMAL_BUILD - AIEData.metadata->setHwContext(xrt_core::hw_context_int::create_hw_context_from_implementation(handle)); + AIEData.metadata->setHwContext(context); AIEData.implementation = std::make_unique(db, AIEData.metadata); #elif defined(XRT_X86_BUILD) AIEData.implementation = std::make_unique(db, AIEData.metadata); diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/win/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/win/aie_profile.cpp index 8983c326e69..66162a72d5f 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/win/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/win/aie_profile.cpp @@ -210,7 +210,6 @@ namespace xdp { auto configChannel0 = metadata->getConfigChannel0(); for (int module = 0; module < metadata->getNumModules(); ++module) { - // int numTileCounters[metadata->getNumCountersMod(module)+1] = {0}; XAie_ModuleType mod = falModuleTypes[module]; // Iterate over tiles and metrics to configure all desired counters for (auto& tileMetric : metadata->getConfigMetrics(module)) { @@ -287,7 +286,7 @@ namespace xdp { op_profile_data.emplace_back(profile_data_t{Regs[i] + (col << 25) + (row << 20)}); std::vector values; - values.insert(values.end(), {col, row, phyStartEvent, phyEndEvent, resetEvent, 0, 1000, payload}); + values.insert(values.end(), {col, row, phyStartEvent, phyEndEvent, resetEvent, 0, 0, payload}); outputValues.push_back(values); counterId++; diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/x86/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/x86/aie_profile.cpp index 1819631c0f3..af50405f09a 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/x86/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/x86/aie_profile.cpp @@ -145,6 +145,11 @@ namespace xdp { // Store counter info in database auto& counter = cfg->counters[i]; std::string counterName = "AIE Counter " + std::to_string(counter.counterId); + if (!metadata->checkModule(counter.moduleName)) { + xrt_core::message::send(xrt_core::message::severity_level::warning, "XRT", "Invalid Module Returned from PS Kernel. Data may be invalid."); + counter.moduleName = 0; + } + (db->getStaticInfo()) .addAIECounter(deviceId, counter.counterId, counter.col, counter.row, counter.counterNum, counter.startEvent, counter.endEvent, counter.resetEvent, counter.payload,