From 8cf422e408d1fb8d2d13fcbe0a23b01d29236f47 Mon Sep 17 00:00:00 2001 From: Parth Ashwin Jain <149461152+parthash0804@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:09:27 +0530 Subject: [PATCH] Changes to build XDP on CLient linux (#8535) --- .../client/aie_trace_offload_client.h | 8 +++--- .../device/common/client_transaction.h | 2 +- .../device/common/transactions/op_init.hpp | 1 + .../plugin/aie_debug/aie_debug_plugin.cpp | 4 +-- .../plugin/aie_profile/client/aie_profile.cpp | 9 ++++--- .../plugin/aie_trace/client/aie_trace.cpp | 26 +++++++++---------- 6 files changed, 27 insertions(+), 23 deletions(-) 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 8db33b7aae1..1d04223f856 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 @@ -117,10 +117,6 @@ class AIETraceOffload XAie_DevInst aieDevInst = {0}; std::unique_ptr transactionHandler; - std::shared_ptr metadata; - std::vector xrt_bos; - xrt::hw_context context; - // Continuous Trace Offload (For PLIO) bool traceContinuous; uint64_t offloadIntervalUs; @@ -133,6 +129,10 @@ class AIETraceOffload bool mEnCircularBuf; bool mCircularBufOverwrite; + xrt::hw_context context; + std::shared_ptr metadata; + std::vector xrt_bos; + private: void readTraceGMIO(bool final); void continuousOffload(); diff --git a/src/runtime_src/xdp/profile/device/common/client_transaction.h b/src/runtime_src/xdp/profile/device/common/client_transaction.h index f94c45e741d..6e7e377b520 100644 --- a/src/runtime_src/xdp/profile/device/common/client_transaction.h +++ b/src/runtime_src/xdp/profile/device/common/client_transaction.h @@ -33,9 +33,9 @@ namespace xdp::aie { int getGroupID(int id) {return kernel.group_id(id); } private: - std::string transactionName; xrt::kernel kernel; xrt::hw_context context; + std::string transactionName; }; } // namespace xdp::aie diff --git a/src/runtime_src/xdp/profile/device/common/transactions/op_init.hpp b/src/runtime_src/xdp/profile/device/common/transactions/op_init.hpp index d760e34e1f6..69e84010a7c 100644 --- a/src/runtime_src/xdp/profile/device/common/transactions/op_init.hpp +++ b/src/runtime_src/xdp/profile/device/common/transactions/op_init.hpp @@ -6,6 +6,7 @@ #include #include "op_types.h" +#include using namespace std; diff --git a/src/runtime_src/xdp/profile/plugin/aie_debug/aie_debug_plugin.cpp b/src/runtime_src/xdp/profile/plugin/aie_debug/aie_debug_plugin.cpp index bd11632807b..e8e66dcc3b3 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_debug/aie_debug_plugin.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_debug/aie_debug_plugin.cpp @@ -134,7 +134,7 @@ namespace xdp { xrt_core::message::send(severity_level::debug, "XRT", msg.str()); for (auto &tile : tiles) { - for (int i = 0; i < Regs.size(); i++) { + for (size_t i = 0; i < Regs.size(); i++) { op_profile_data.emplace_back(register_data_t{Regs[i] + (tile.col << 25) + (tile.row << 20)}); counterId++; } @@ -150,7 +150,7 @@ namespace xdp { op_size = sizeof(read_register_op_t) + sizeof(register_data_t) * (counterId - 1); op = (read_register_op_t*)malloc(op_size); op->count = counterId; - for (int i = 0; i < op_profile_data.size(); i++) + for (size_t i = 0; i < op_profile_data.size(); i++) op->data[i] = op_profile_data[i]; #if 0 diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp index bac00369ae2..e669494f194 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp @@ -42,7 +42,10 @@ // XRT headers #include "xrt/xrt_bo.h" #include "core/common/shim/hwctx_handle.h" + +#ifdef _WIN32 #include +#endif namespace xdp { using severity_level = xrt_core::message::severity_level; @@ -191,8 +194,8 @@ namespace xdp { configStreamSwitchPorts(tileMetric.first, loc, type, metricSet, channel0, startEvent); // Convert enums to physical event IDs for reporting purposes - uint8_t tmpStart; - uint8_t tmpEnd; + uint16_t tmpStart; + uint16_t tmpEnd; XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, mod, startEvent, &tmpStart); XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, mod, endEvent, &tmpEnd); uint16_t phyStartEvent = tmpStart + aie::profile::getCounterBase(type); @@ -234,7 +237,7 @@ namespace xdp { op_size = sizeof(read_register_op_t) + sizeof(register_data_t) * (counterId - 1); op = (read_register_op_t*)malloc(op_size); op->count = counterId; - for (int i = 0; i < op_profile_data.size(); i++) { + for (size_t i = 0; i < op_profile_data.size(); i++) { op->data[i] = op_profile_data[i]; } diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/client/aie_trace.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/client/aie_trace.cpp index a0e7ad198c8..acaab76a536 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/client/aie_trace.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/client/aie_trace.cpp @@ -772,7 +772,7 @@ namespace xdp { //std::map> switchPortMap; // Traverse all counters and request monitor ports as needed - for (int i=0; i < events.size(); ++i) { + for (size_t i=0; i < events.size(); ++i) { // Ensure applicable event auto event = events.at(i); if (!isStreamSwitchPortEvent(event)) @@ -900,10 +900,10 @@ namespace xdp { XAIE_EVENT_COMBO_E1_OR_E2, XAIE_EVENT_COMBO_E1_OR_E2}; // Capture in config class to report later - for (int i=0; i < NUM_COMBO_EVENT_CONTROL; ++i) + for (size_t i=0; i < NUM_COMBO_EVENT_CONTROL; ++i) config.combo_event_control[i] = 2; - for (int i=0; i < events.size(); ++i) { - uint8_t phyEvent = 0; + for (size_t i=0; i < events.size(); ++i) { + uint16_t phyEvent = 0; XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, mod, events.at(i), &phyEvent); config.combo_event_input[i] = phyEvent; } @@ -1084,7 +1084,7 @@ namespace xdp { // Zero trace event tile counts for (int m = 0; m < static_cast(module_type::num_types); ++m) { - for (int n = 0; n <= NUM_TRACE_EVENTS; ++n) + for (size_t n = 0; n <= NUM_TRACE_EVENTS; ++n) mNumTileTraceEvents[m][n] = 0; } @@ -1204,7 +1204,7 @@ namespace xdp { xrt_core::message::send(severity_level::info, "XRT", "Configuring Core Trace Events"); XAie_ModuleType mod = XAIE_CORE_MOD; - uint8_t phyEvent = 0; + uint16_t phyEvent = 0; //auto coreTrace = core.traceControl(); // Delay cycles and user control are not compatible with each other @@ -1317,7 +1317,7 @@ namespace xdp { if (XAie_EventBroadcast(&aieDevInst, loc, XAIE_CORE_MOD, 9, traceEndEvent) != XAIE_OK) break; - uint8_t phyEvent = 0; + uint16_t phyEvent = 0; if(!m_trace_start_broadcast) { XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, XAIE_CORE_MOD, traceStartEvent, &phyEvent); cfgTile->core_trace_config.internal_events_broadcast[8] = phyEvent; @@ -1353,8 +1353,8 @@ namespace xdp { break; { - uint8_t phyEvent1 = 0; - uint8_t phyEvent2 = 0; + uint16_t phyEvent1 = 0; + uint16_t phyEvent2 = 0; XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, mod, traceStartEvent, &phyEvent1); XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, mod, traceEndEvent, &phyEvent2); if (type == module_type::core) { @@ -1436,7 +1436,7 @@ namespace xdp { configEdgeEvents(tile, type, metricSet, memoryEvents[i], channel0); // Update config file - uint8_t phyEvent = 0; + uint16_t phyEvent = 0; auto phyMod = isCoreEvent ? XAIE_CORE_MOD : XAIE_MEM_MOD; XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, phyMod, memoryEvents[i], &phyEvent); @@ -1516,7 +1516,7 @@ namespace xdp { interfaceEvents, cfgTile->interface_tile_trace_config); // Configure interface tile trace events - for (int i = 0; i < interfaceEvents.size(); i++) { + for (size_t i = 0; i < interfaceEvents.size(); i++) { auto event = interfaceEvents.at(i); //auto TraceE = shim.traceEvent(); //TraceE->setEvent(XAIE_PL_MOD, event); @@ -1535,7 +1535,7 @@ namespace xdp { // XAie_ModuleType M; // TraceE->getRscId(L, M, S); // Get Physical event - uint8_t phyEvent = 0; + uint16_t phyEvent = 0; XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, XAIE_PL_MOD, event, &phyEvent); cfgTile->interface_tile_trace_config.traced_events[i] = phyEvent; } @@ -1544,7 +1544,7 @@ namespace xdp { { // Add interface trace control events // Start - uint8_t phyEvent = 0; + uint16_t phyEvent = 0; XAie_EventLogicalToPhysicalConv(&aieDevInst, loc, XAIE_PL_MOD, interfaceTileTraceStartEvent, &phyEvent); cfgTile->interface_tile_trace_config.start_event = phyEvent; // Stop