Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ AIEControlConfigFiletype::getPLIOs() const
}

std::unordered_map<std::string, io_config> plios;
uint8_t colShift = getPartitionOverlayStartCols().front();

for (auto& plio_node : pliosMetadata.get()) {
io_config plio;
Expand All @@ -178,7 +179,7 @@ AIEControlConfigFiletype::getPLIOs() const
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");
plio.shimColumn = plio_node.second.get<uint8_t>("shim_column");
plio.shimColumn = plio_node.second.get<uint8_t>("shim_column") + colShift;
plio.streamId = plio_node.second.get<uint8_t>("stream_id");
plio.slaveOrMaster = plio_node.second.get<bool>("slaveOrMaster");
plio.channelNum = 0;
Expand Down Expand Up @@ -216,6 +217,7 @@ AIEControlConfigFiletype::getChildGMIOs( const std::string& childStr) const
}

std::unordered_map<std::string, io_config> gmios;
uint8_t colShift = getPartitionOverlayStartCols().front();

for (auto& gmio_node : gmiosMetadata.get()) {
io_config gmio;
Expand All @@ -233,7 +235,7 @@ AIEControlConfigFiletype::getChildGMIOs( const std::string& childStr) const
gmio.name = gmio_node.second.get<std::string>("name");
gmio.logicalName = gmio_node.second.get<std::string>("logical_name");
gmio.slaveOrMaster = slaveOrMaster;
gmio.shimColumn = gmio_node.second.get<uint8_t>("shim_column");
gmio.shimColumn = gmio_node.second.get<uint8_t>("shim_column") + colShift;
gmio.channelNum = (slaveOrMaster == 0) ? (channelNumber - 2) : channelNumber;
gmio.streamId = gmio_node.second.get<uint8_t>("stream_id");
gmio.burstLength = gmio_node.second.get<uint8_t>("burst_length_in_16byte");
Expand Down Expand Up @@ -412,6 +414,7 @@ AIEControlConfigFiletype::getMemoryTiles(const std::string& graph_name,
std::vector<tile_type> memTiles;
// Always one row of interface tiles
uint8_t rowOffset = 1;
uint8_t colShift = getPartitionOverlayStartCols().front();

// Now parse all shared buffers
for (auto const &shared_buffer : sharedBufferTree.get()) {
Expand All @@ -425,7 +428,7 @@ AIEControlConfigFiletype::getMemoryTiles(const std::string& graph_name,
continue;

tile_type tile;
tile.col = shared_buffer.second.get<uint8_t>("column");
tile.col = shared_buffer.second.get<uint8_t>("column") + colShift;
tile.row = shared_buffer.second.get<uint8_t>("row") + rowOffset;

// Store names of DMA channels for reporting purposes
Expand Down Expand Up @@ -461,6 +464,7 @@ AIEControlConfigFiletype::getAIETiles(const std::string& graph_name) const

std::vector<tile_type> tiles;
auto rowOffset = getAIETileRowOffset();
uint8_t colShift = getPartitionOverlayStartCols().front();
int startCount = 0;

for (auto& graph : graphsMetadata.get()) {
Expand All @@ -472,7 +476,7 @@ AIEControlConfigFiletype::getAIETiles(const std::string& graph_name) const
for (auto& node : graph.second.get_child("core_columns")) {
tiles.push_back(tile_type());
auto& t = tiles.at(count++);
t.col = xdp::aie::convertStringToUint8(node.second.data());
t.col = xdp::aie::convertStringToUint8(node.second.data()) + colShift;
t.active_core = true;
}

Expand Down Expand Up @@ -550,10 +554,10 @@ AIEControlConfigFiletype::getEventTiles(const std::string& graph_name,

std::vector<tile_type> tiles;
auto rowOffset = getAIETileRowOffset();
uint8_t colShift = getPartitionOverlayStartCols().front();
int startCount = 0;

for (auto& graph : graphsMetadata.get()) {
// Make sure this is requested graph
// NOTE: Only top-level graphs are currently listed in metadata,
// so search is reversed to support sub-graph requests
// (e.g., "mygraph" is found in "mygraph.subgraph1")
Expand All @@ -566,7 +570,7 @@ AIEControlConfigFiletype::getEventTiles(const std::string& graph_name,
for (auto& node : graph.second.get_child(col_name)) {
tiles.push_back(tile_type());
auto& t = tiles.at(count++);
t.col = xdp::aie::convertStringToUint8(node.second.data());
t.col = xdp::aie::convertStringToUint8(node.second.data()) + colShift;
if (type == module_type::core)
t.active_core = true;
else
Expand Down Expand Up @@ -610,10 +614,10 @@ AIEControlConfigFiletype::getTiles(const std::string& graph_name,

std::vector<tile_type> tiles;
auto rowOffset = getAIETileRowOffset();
uint8_t colShift = getPartitionOverlayStartCols().front();

// Traverse all tiles in kernel map
for (auto const &mapping : kernelToTileMapping.get()) {
// Make sure this tile is what we're looking for
auto currGraph = mapping.second.get<std::string>("graph");
if ((currGraph.find(graph_name) == std::string::npos)
&& (graph_name.compare("all") != 0))
Expand All @@ -626,9 +630,8 @@ AIEControlConfigFiletype::getTiles(const std::string& graph_name,
continue;
}

// Store this tile
tile_type tile;
tile.col = mapping.second.get<uint8_t>("column");
tile.col = mapping.second.get<uint8_t>("column") + colShift;
tile.row = mapping.second.get<uint8_t>("row") + rowOffset;
tile.active_core = true;
tile.active_memory = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ AIETraceConfigFiletype::getExternalBuffers() const
}

std::unordered_map<std::string, io_config> gmios;
uint8_t colShift = getPartitionOverlayStartCols().front();

for (auto& buf_node : bufferMetadata.get()) {
io_config gmio;
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;
gmio.shimColumn = buf_node.second.get<uint8_t>("shim_column");
gmio.shimColumn = buf_node.second.get<uint8_t>("shim_column") + colShift;
gmio.channelNum = buf_node.second.get<uint8_t>("channel_number");
gmio.streamId = buf_node.second.get<uint8_t>("stream_id");
gmio.burstLength = 8;
Expand Down Expand Up @@ -124,6 +125,7 @@ AIETraceConfigFiletype::getMemoryTiles(const std::string& graph_name,
std::vector<tile_type> memTiles;
// Always one row of interface tiles
uint8_t rowOffset = 1;
uint8_t colShift = getPartitionOverlayStartCols().front();

// Parse all shared buffers
for (auto const &shared_buffer : sharedBufferTree.get()) {
Expand Down Expand Up @@ -152,7 +154,7 @@ AIETraceConfigFiletype::getMemoryTiles(const std::string& graph_name,
// Add to list if verified
if (foundGraph && foundBuffer) {
tile_type tile;
tile.col = shared_buffer.second.get<uint8_t>("column");
tile.col = shared_buffer.second.get<uint8_t>("column") + colShift;
tile.row = shared_buffer.second.get<uint8_t>("row") + rowOffset;

// Store names of DMA channels for reporting purposes
Expand Down Expand Up @@ -204,6 +206,7 @@ AIETraceConfigFiletype::getTiles(const std::string& graph_name,

std::vector<tile_type> tiles;
auto rowOffset = getAIETileRowOffset();
uint8_t colShift = getPartitionOverlayStartCols().front();

// Parse all kernel mappings
for (auto const &mapping : kernelToTileMapping.get()) {
Expand Down Expand Up @@ -236,7 +239,7 @@ AIETraceConfigFiletype::getTiles(const std::string& graph_name,
// Add to list if verified
if (foundGraph && foundKernel) {
tile_type tile;
tile.col = mapping.second.get<uint8_t>("column");
tile.col = mapping.second.get<uint8_t>("column") + colShift;
tile.row = mapping.second.get<uint8_t>("row") + rowOffset;
tile.active_core = true;
tile.active_memory = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,

std::map<std::pair<uint8_t, uint8_t>, tile_type> tileMap; // Use map to handle unique tiles by location
auto rowOffset = getAIETileRowOffset();
uint8_t colShift = getPartitionOverlayStartCols().front();

// Parse all kernel mappings
for (auto const &mapping : kernelToTileMapping.get()) {
Expand All @@ -136,7 +137,7 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
continue;

// Get core tile location
auto coreCol = mapping.second.get<uint8_t>("column");
auto coreCol = mapping.second.get<uint8_t>("column") + colShift;
auto coreRow = static_cast<uint8_t>(mapping.second.get<uint8_t>("row") + rowOffset);

// Create or get existing core tile
Expand All @@ -154,7 +155,7 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name,
auto dmaChannelsTree = mapping.second.get_child_optional("dmaChannels");
if (dmaChannelsTree) {
for (auto const &channel : dmaChannelsTree.get()) {
uint8_t dmaCol = xdp::aie::convertStringToUint8(channel.second.get<std::string>("column"));
uint8_t dmaCol = xdp::aie::convertStringToUint8(channel.second.get<std::string>("column")) + colShift;
uint8_t dmaRow = static_cast<uint8_t>(xdp::aie::convertStringToUint8(channel.second.get<std::string>("row")) + rowOffset);

auto dmaKey = std::make_pair(dmaCol, dmaRow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,13 @@ bool AIETraceOffload::initReadTrace()
VPDatabase* db = VPDatabase::Instance();
TraceGMIO* traceGMIO = (db->getStaticInfo()).getTraceGMIO(deviceId, i);

gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(traceGMIO->shimColumn, 0);
// Get the column for XAIE APIs
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
auto partitionShift = (db->getStaticInfo()).getAIEmetadataReader(deviceId)->getPartitionOverlayStartCols().front();
auto col = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
? traceGMIO->shimColumn : (traceGMIO->shimColumn - partitionShift);
gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(col, 0);

int driverStatus = XAIE_OK;
driverStatus = XAie_DmaDescInit(devInst, &(gmioDMAInsts[i].shimDmaInst), gmioDMAInsts[i].gmioTileLoc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ namespace xdp {
// Todo: get this from aie metadata
XAie_LocType loc;
XAie_DmaDesc DmaDesc;
loc = XAie_TileLoc(traceGMIO->shimColumn, 0);

// Get the column for XAIE APIs
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
auto partitionShift = (db->getStaticInfo()).getAIEmetadataReader(deviceId)->getPartitionOverlayStartCols().front();
auto col = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
? traceGMIO->shimColumn : (traceGMIO->shimColumn - partitionShift);
loc = XAie_TileLoc(col, 0);
uint8_t s2mm_ch_id = traceGMIO->channelNumber;
uint16_t s2mm_bd_id = 15; /* for now use last bd */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ bool AIETraceOffload::initReadTrace()
VPDatabase* db = VPDatabase::Instance();
TraceGMIO* traceGMIO = (db->getStaticInfo()).getTraceGMIO(deviceId, i);

gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(traceGMIO->shimColumn, 0);
// Get the column for XAIE APIs
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
auto partitionShift = (db->getStaticInfo()).getAIEmetadataReader(deviceId)->getPartitionOverlayStartCols().front();
auto col = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
? traceGMIO->shimColumn : (traceGMIO->shimColumn - partitionShift);
gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(col, 0);

int driverStatus = XAIE_OK;
driverStatus = XAie_DmaDescInit(devInst, &(gmioDMAInsts[i].shimDmaInst), gmioDMAInsts[i].gmioTileLoc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ namespace xdp {
continue;
}

auto loc = XAie_TileLoc(col, row);
// Get the column for XAIE APIs
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
? col : (col - partitionShift);
auto loc = XAie_TileLoc(xaieCol, row);
auto startEvents = (type == module_type::core) ? coreStartEvents[metricSet]
: ((type == module_type::dma) ? memoryStartEvents[metricSet]
: ((type == module_type::shim) ? shimStartEvents[metricSet]
Expand Down
Loading
Loading