Skip to content

Commit

Permalink
Changes to build XDP on CLient linux (#8535)
Browse files Browse the repository at this point in the history
  • Loading branch information
parthash0804 authored Oct 23, 2024
1 parent ca21d0f commit 8cf422e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ class AIETraceOffload
XAie_DevInst aieDevInst = {0};
std::unique_ptr<aie::ClientTransaction> transactionHandler;

std::shared_ptr<AieTraceMetadata> metadata;
std::vector<xrt::bo> xrt_bos;
xrt::hw_context context;

// Continuous Trace Offload (For PLIO)
bool traceContinuous;
uint64_t offloadIntervalUs;
Expand All @@ -133,6 +129,10 @@ class AIETraceOffload
bool mEnCircularBuf;
bool mCircularBufOverwrite;

xrt::hw_context context;
std::shared_ptr<AieTraceMetadata> metadata;
std::vector<xrt::bo> xrt_bos;

private:
void readTraceGMIO(bool final);
void continuousOffload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <xaiengine.h>

#include "op_types.h"
#include <cstring>

using namespace std;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
// XRT headers
#include "xrt/xrt_bo.h"
#include "core/common/shim/hwctx_handle.h"

#ifdef _WIN32
#include <windows.h>
#endif

namespace xdp {
using severity_level = xrt_core::message::severity_level;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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];
}

Expand Down
26 changes: 13 additions & 13 deletions src/runtime_src/xdp/profile/plugin/aie_trace/client/aie_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ namespace xdp {
//std::map<uint8_t, std::shared_ptr<xaiefal::XAieStreamPortSelect>> 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))
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -1084,7 +1084,7 @@ namespace xdp {

// Zero trace event tile counts
for (int m = 0; m < static_cast<int>(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;
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand All @@ -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
Expand Down

0 comments on commit 8cf422e

Please sign in to comment.