Skip to content

Commit

Permalink
Use IO type and module type enums (#8244)
Browse files Browse the repository at this point in the history
  • Loading branch information
vipangul authored Jul 15, 2024
1 parent 4507250 commit 82d85a8
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 31 deletions.
22 changes: 13 additions & 9 deletions src/runtime_src/xdp/profile/database/static_info/aie_constructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,31 @@ namespace xdp::aie {

namespace xdp {


enum class module_type {
enum module_type {
core = 0,
dma,
shim,
mem_tile,
num_types
};

enum io_type {
PLIO = 0,
GMIO
};

struct tile_type
{
{
uint8_t row;
uint8_t col;
uint8_t subtype;
uint8_t stream_id;
uint8_t is_master;
uint64_t itr_mem_addr;
bool active_core;
bool active_memory;
bool is_trigger;

io_type subtype;

bool operator==(const tile_type &tile) const {
return (col == tile.col) && (row == tile.row);
}
Expand All @@ -88,7 +92,7 @@ enum class module_type {
};

struct io_config
{
{
// Object id
int id;
// Variable name
Expand All @@ -105,9 +109,9 @@ enum class module_type {
uint8_t channelNum;
// Burst length
uint8_t burstLength;
// I/O type - 0:PLIO, 1:GMIO
uint8_t type;
};
// I/O type
io_type type;
};

/*
* Represents AIE counter configuration for a single counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <memory>
#include "xdp/profile/database/static_info/device_info.h"
#include "xdp/profile/database/static_info/aie_constructs.h"
#include "xdp/profile/database/static_info/pl_constructs.h"
#include "xdp/profile/database/static_info/xclbin_info.h"
#include "xdp/profile/device/pl_device_intf.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ AIEControlConfigFiletype::getPLIOs() const
for (auto& plio_node : pliosMetadata.get()) {
io_config plio;

plio.type = 0;
plio.type = io_type::PLIO;
plio.id = plio_node.second.get<uint32_t>("id");
plio.name = plio_node.second.get<std::string>("name");
plio.logicalName = plio_node.second.get<std::string>("logical_name");
Expand Down Expand Up @@ -190,7 +190,7 @@ AIEControlConfigFiletype::getChildGMIOs( const std::string& childStr) const
auto slaveOrMaster = gmio_node.second.get<uint8_t>("type");
auto channelNumber = gmio_node.second.get<uint8_t>("channel_number");

gmio.type = 1;
gmio.type = io_type::GMIO;
gmio.id = gmio_node.second.get<uint32_t>("id");
gmio.name = gmio_node.second.get<std::string>("name");
gmio.logicalName = gmio_node.second.get<std::string>("logical_name");
Expand Down Expand Up @@ -252,7 +252,7 @@ AIEControlConfigFiletype::getInterfaceTiles(const std::string& graphName,
if (useColumn && !((minCol <= shimCol) && (shimCol <= maxCol)))
continue;
// Make sure channel number is same as specified (GMIO only)
if ((type == 1) && (channelId >= 0) && (channelId != io.second.channelNum)) {
if ((type == io_type::GMIO) && (channelId >= 0) && (channelId != io.second.channelNum)) {
std::stringstream msg;
msg << "Specified channel ID " << +channelId << "doesn't match for interface column "
<< +shimCol <<" and stream ID " << +streamId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ AIETraceConfigFiletype::getExternalBuffers() const

for (auto& buf_node : bufferMetadata.get()) {
io_config gmio;
gmio.type = 1;
gmio.type = io_type::GMIO;
gmio.name = buf_node.second.get<std::string>("portName");
auto direction = buf_node.second.get<std::string>("direction");
gmio.slaveOrMaster = (direction == "s2mm") ? 1 : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,13 @@ namespace xdp {

switch (moduleType)
{
case 0:
case module_type::core:
xclbin->aie.aieCoreCountersMap[numCounters] = numTiles ;
break ;
case 1:
case module_type::dma:
xclbin->aie.aieMemoryCountersMap[numCounters] = numTiles ;
break ;
case 2:
case module_type::shim:
xclbin->aie.aieShimCountersMap[numCounters] = numTiles ;
break ;
default:
Expand Down
4 changes: 0 additions & 4 deletions src/runtime_src/xdp/profile/database/static_info_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,10 +1511,6 @@ namespace xdp {
if (config->plDeviceIntf == nullptr && xdpDevice != nullptr)
return true;

std::stringstream msg;
msg << "Loaded xclbins on device already contains this new xclbin with UID: " << new_xclbin_uuid.to_string() <<"." ;
msg << " Skipping update of the device.\n";
xrt_core::message::send(xrt_core::message::severity_level::debug, "XRT", msg.str());
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace xdp::aie::profile {
/****************************************************************************
* Modify configured events based on the channel and hardware generation
***************************************************************************/
void modifyEvents(const module_type type, const uint16_t subtype, const uint8_t channel,
void modifyEvents(const module_type type, const io_type subtype, const uint8_t channel,
std::vector<XAie_Events>& events, const int hwGen)
{
if ((type != module_type::dma) && (type != module_type::shim))
Expand All @@ -230,7 +230,7 @@ namespace xdp::aie::profile {

// Calculate throughput differently for PLIO or AIE1 devices
// since DMA-related events are not defined in those cases
if ((subtype == 0) || (hwGen == 1)) {
if ((subtype == io_type::PLIO) || (hwGen == 1)) {
std::replace(events.begin(), events.end(),
XAIE_EVENT_GROUP_DMA_ACTIVITY_PL, XAIE_EVENT_PORT_STALLED_0_PL);
std::replace(events.begin(), events.end(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace xdp::aie::profile {
* @param events vector of events to replace with the respective channel 1 events
* @param hwGen AIE hardware generation
*/
void modifyEvents(const module_type type, const uint16_t subtype, const uint8_t channel,
void modifyEvents(const module_type type, const io_type subtype, const uint8_t channel,
std::vector<XAie_Events>& events, const int hwGen);
/**
* @brief Check if event is generated by a stream switch monitor port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ namespace xdp {
}

// Check for PLIO tiles and it's compatible metric settings
if ((tileMetric.first.subtype == 0) && isGMIOMetric(tileMetric.second)) {
if ((tileMetric.first.subtype == io_type::PLIO) && isGMIOMetric(tileMetric.second)) {
if (showWarningGMIOMetric) {
std::string msg = "Configured interface_tile metric set " + tileMetric.second
+ " is only applicable for GMIO type tiles.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ namespace xdp {
/****************************************************************************
* Modify events in metric set based on type and channel
***************************************************************************/
void AieTrace_WinImpl::modifyEvents(module_type type, uint16_t subtype,
void AieTrace_WinImpl::modifyEvents(module_type type, io_type subtype,
const std::string metricSet, uint8_t channel,
std::vector<XAie_Events>& events)
{
// Only needed for GMIO DMA channel 1
if ((type != module_type::shim) || (subtype == 0) || (channel == 0))
if ((type != module_type::shim) || (subtype == io_type::PLIO) || (channel == 0))
return;

// Check type to minimize replacements
Expand Down Expand Up @@ -924,7 +924,7 @@ namespace xdp {
auto loc = XAie_TileLoc(col, row);

std::stringstream cmsg;
cmsg << "Configuring tile (" << +col << "," << +row << ") in module type: " << typeInt << ".";
cmsg << "Configuring tile (" << +col << "," << +row << ") in module type: " << getModuleName(type) << ".";
xrt_core::message::send(severity_level::info, "XRT", cmsg.str());

// xaiefal::XAieMod core;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace xdp {
virtual void pollTimers(uint64_t index, void* handle);
virtual uint64_t checkTraceBufSize(uint64_t size);

void modifyEvents(module_type type, uint16_t subtype,
void modifyEvents(module_type type, io_type subtype,
const std::string metricSet, uint8_t channel,
std::vector<XAie_Events>& events);
bool setMetricsSettings(uint64_t deviceId, void* handle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,11 @@ namespace xdp::aie::trace {
/****************************************************************************
* Modify events in metric set based on type and channel
***************************************************************************/
void modifyEvents(module_type type, uint16_t subtype, const std::string metricSet,
void modifyEvents(module_type type, io_type subtype, const std::string metricSet,
uint8_t channel, std::vector<XAie_Events>& events)
{
// Only needed for GMIO DMA channel 1
if ((type != module_type::shim) || (subtype == 0) || (channel == 0))
if ((type != module_type::shim) || (subtype == io_type::PLIO) || (channel == 0))
return;

// Check type to minimize replacements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ namespace xdp::aie::trace {
* @param channel Channel number
* @param events Vector of events in metric set (modified if needed)
*/
void modifyEvents(module_type type, uint16_t subtype, const std::string metricSet,
void modifyEvents(module_type type, io_type subtype, const std::string metricSet,
uint8_t channel, std::vector<XAie_Events>& events);

} // namespace xdp::aie::trace
Expand Down

0 comments on commit 82d85a8

Please sign in to comment.