Skip to content

Commit

Permalink
Fix on client to correct partition info device query request (Xilinx#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vipangul authored Mar 26, 2024
1 parent 6ed717d commit d57e6de
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
27 changes: 15 additions & 12 deletions src/runtime_src/xdp/profile/database/static_info/aie_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define XDP_CORE_SOURCE

#include "aie_util.h"
#include "core/common/api/hw_context_int.h"
#include "core/common/message.h"
#include "core/common/system.h"
#include "core/common/device.h"
Expand Down Expand Up @@ -363,31 +364,33 @@ namespace xdp::aie {
* Get AIE partition information
***************************************************************************/
std::vector<uint8_t>
getPartitionStartColumns(void* handle)
getPartitionStartColumnsClient(void* handle)
{
std::vector<uint8_t> startCols;

try {
std::shared_ptr<xrt_core::device> dev = xrt_core::get_userpf_device(handle);
auto infoVector = xrt_core::device_query<xrt_core::query::aie_partition_info>(dev);
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);
if (device==nullptr)
return std::vector<uint8_t>{0};

auto infoVector = xrt_core::device_query<xrt_core::query::aie_partition_info>(device.get());
if (infoVector.empty()) {
xrt_core::message::send(severity_level::info, "XRT", "No AIE partition information found.");
startCols.push_back(0);
return std::vector<uint8_t>{0};
}
else {
for (auto& info : infoVector) {
auto startCol = static_cast<uint8_t>(info.start_col);
xrt_core::message::send(severity_level::info, "XRT",
"Partition shift of " + std::to_string(startCol) + " was found.");
startCols.push_back(startCol);
}

for (auto& info : infoVector) {
auto startCol = static_cast<uint8_t>(info.start_col);
xrt_core::message::send(severity_level::info, "XRT",
"Partition shift of " + std::to_string(startCol) + " was found.");
startCols.push_back(startCol);
}
}
catch(...) {
// Query not available
xrt_core::message::send(severity_level::info, "XRT", "Unable to query AIE partition information.");
startCols.push_back(0);
return std::vector<uint8_t>{0};
}

return startCols;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace xdp::aie {
uint8_t convertStringToUint8(const std::string& input);

XDP_CORE_EXPORT
std::vector<uint8_t> getPartitionStartColumns(void* handle);
std::vector<uint8_t> getPartitionStartColumnsClient(void* handle);

} // namespace xdp::aie

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ namespace xdp {

// Get partition columns
// NOTE: for now, assume a single partition
auto partitionCols = xdp::aie::getPartitionStartColumns(metadata->getHandle());
auto startCol = partitionCols.at(0);
auto partitionCols = xdp::aie::getPartitionStartColumnsClient(metadata->getHandle());
uint8_t startCol = partitionCols.at(0);

//Start recording the transaction
XAie_StartTransaction(&aieDevInst, XAIE_TRANSACTION_DISABLE_AUTO_FLUSH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ namespace xdp {
+ typeName + " channel " + std::to_string(channelNum);
xrt_core::message::send(severity_level::debug, "XRT", msg);
//switchPortRsc->setPortToSelect(slaveOrMaster, DMA, channelNum);
XAie_EventSelectStrmPort(&aieDevInst, loc, 0, slaveOrMaster, DMA, channelNum);
XAie_EventSelectStrmPort(&aieDevInst, loc, portnum, slaveOrMaster, DMA, channelNum);

// Record for runtime config file
// NOTE: channel info informs back-end there will be events on that channel
Expand All @@ -562,7 +562,7 @@ namespace xdp {
xrt_core::message::send(severity_level::debug, "XRT", msg);

//switchPortRsc->setPortToSelect(slaveOrMaster, SOUTH, streamPortId);
XAie_EventSelectStrmPort(&aieDevInst, loc, 0, slaveOrMaster, SOUTH, streamPortId);
XAie_EventSelectStrmPort(&aieDevInst, loc, portnum, slaveOrMaster, SOUTH, streamPortId);

// Record for runtime config file
config.port_trace_ids[portnum] = streamPortId;
Expand All @@ -588,7 +588,7 @@ namespace xdp {
+ typeName + " stream port " + std::to_string(channel);
xrt_core::message::send(severity_level::debug, "XRT", msg);
//switchPortRsc->setPortToSelect(slaveOrMaster, DMA, channel);
XAie_EventSelectStrmPort(&aieDevInst, loc, 0, slaveOrMaster, DMA, channel);
XAie_EventSelectStrmPort(&aieDevInst, loc, portnum, slaveOrMaster, DMA, channel);

// Record for runtime config file
config.port_trace_ids[portnum] = channel;
Expand Down Expand Up @@ -808,9 +808,9 @@ namespace xdp {

// Get partition columns
// NOTE: for now, assume a single partition
auto partitionCols = xdp::aie::getPartitionStartColumns(handle);
auto startCol = partitionCols.at(0);

auto partitionCols = xdp::aie::getPartitionStartColumnsClient(handle);
uint8_t startCol = partitionCols.at(0);
//Start recording the transaction
XAie_StartTransaction(&aieDevInst, XAIE_TRANSACTION_DISABLE_AUTO_FLUSH);

Expand Down Expand Up @@ -1142,7 +1142,6 @@ namespace xdp {
break;

coreToMemBcMask |= (0x1 << bcId);
bcId++;
}
else {
if (XAie_TraceEvent(&aieDevInst, loc, XAIE_MEM_MOD, memoryEvents[i], i) != XAIE_OK)
Expand All @@ -1161,6 +1160,7 @@ namespace xdp {
if (isCoreEvent) {
cfgTile->core_trace_config.internal_events_broadcast[bcId] = phyEvent;
cfgTile->memory_trace_config.traced_events[i] = bcIdToEvent(bcId);
bcId++;
}
else if (type == module_type::mem_tile)
cfgTile->memory_tile_trace_config.traced_events[i] = phyEvent;
Expand Down

0 comments on commit d57e6de

Please sign in to comment.