Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix help handling with different number of devices #8735

Merged
merged 2 commits into from
Feb 3, 2025
Merged
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
44 changes: 2 additions & 42 deletions src/runtime_src/core/common/smi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,7 @@ const tuple_vector&
smi_base::
get_validate_test_desc() const
{
static const tuple_vector validate_test_desc = {
{"aie-reconfig-overhead", "Run end-to-end array reconfiguration overhead through shim DMA", "hidden"},
{"all", "All applicable validate tests will be executed (default)", "common"},
{"cmd-chain-latency", "Run end-to-end latency test using command chaining", "common"},
{"cmd-chain-throughput", "Run end-to-end throughput test using command chaining", "common"},
{"df-bw", "Run bandwidth test on data fabric", "common"},
{"gemm", "Measure the TOPS value of GEMM operations", "common"},
{"latency", "Run end-to-end latency test", "common"},
{"quick", "Run a subset of four tests: \n1. latency \n2. throughput \n3. cmd-chain-latency \n4. cmd-chain-throughput", "common"},
{"spatial-sharing-overhead", "Run Spatial Sharing Overhead Test", "hidden"},
{"tct-all-col", "Measure average TCT processing time for all columns", "common"},
{"tct-one-col", "Measure average TCT processing time for one column", "common"},
{"temporal-sharing-overhead", "Run Temporal Sharing Overhead Test", "hidden"},
{"throughput", "Run end-to-end throughput test", "common"},
{"aux-connection", "Check if auxiliary power is connected", "common"},
{"dma", "Run dma test", "common"},
{"thostmem-bw", "Run 'bandwidth kernel' when host memory is enabled", "common"},
{"m2m", "Run M2M test", "common"},
{"mem-bw", "Run 'bandwidth kernel' and check the throughput", "common"},
{"p2p", "Run P2P test", "common"},
{"pcie-link", "Check if PCIE link is active", "common"},
{"sc-version","Check if SC firmware is up-to-date", "common"},
{"verify", "Run 'Hello World' kernel test", "common"}
};
static const tuple_vector validate_test_desc = {};
return validate_test_desc;
}

Expand All @@ -78,24 +55,7 @@ smi_base::
get_examine_report_desc() const
{
static const tuple_vector examine_report_desc = {
{"aie-partitions", "AIE partition information", "common"},
{"host", "Host information", "common"},
{"platform", "Platforms flashed on the device", "common"},
{"telemetry", "Telemetry data for the device", "common"},
{"aie", "AIE metadata in xclbin", "common"},
{"aiemem", "AIE memory tile information", "common"},
{"aieshim", "AIE shim tile status", "common"},
{"debug-ip-status", "Status of Debug IPs present in xclbin loaded on device", "common"},
{"dynamic-regions", "Information about the xclbin and the compute units", "common"},
{"electrical", "Electrical and power sensors present on the device", "common"},
{"error", "Asyncronus Error present on the device", "common"},
{"firewall", "Firewall status", "common"},
{"mailbox", "Mailbox metrics of the device", "common"},
{"mechanical", "Mechanical sensors on and surrounding the device", "common"},
{"memory", "Memory information present on the device", "common"},
{"pcie-info", "Pcie information of the device", "common"},
{"qspi-status", "QSPI write protection status", "common"},
{"thermal", "Thermal sensors present on the device", "common"}
{"host", "Host information", "common"}
};
return examine_report_desc;
}
Expand Down
26 changes: 18 additions & 8 deletions src/runtime_src/core/tools/common/XBMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,28 @@ void main_(int argc, char** argv,
* instead of xrt-smi.
* If the device is not found, then load the default xrt-smi config.
*/
std::shared_ptr<xrt_core::device> device;
boost::property_tree::ptree configTreeMain;
std::string config;
try {
device = XBU::get_device(boost::algorithm::to_lower_copy(sDevice), isUserDomain);
} catch (...) {
device = nullptr;

boost::property_tree::ptree available_devices = XBU::get_available_devices(isUserDomain);

if (available_devices.empty()) //no device
config = xrt_core::smi::get_smi_config();
else if (available_devices.size() == 1 || !sDevice.empty()) { //1 device
auto device = XBU::get_device(boost::algorithm::to_lower_copy(sDevice), isUserDomain);
config = xrt_core::device_query<xrt_core::query::xrt_smi_config>(device, xrt_core::query::xrt_smi_config::type::options_config);
}
if (device)
else { //multiple devices
std::string dev;
for (auto& kd : available_devices) {
boost::property_tree::ptree& devpt = kd.second;
dev = devpt.get<std::string>("bdf");
}
std::cout << (boost::format("NOTE: Multiple devices found. Showing help for %s device\n\n") % dev).str();
auto device = XBU::get_device(boost::algorithm::to_lower_copy(dev), isUserDomain);
config = xrt_core::device_query<xrt_core::query::xrt_smi_config>(device, xrt_core::query::xrt_smi_config::type::options_config);
else
config = xrt_core::smi::get_smi_config();
}

std::istringstream command_config_stream(config);
boost::property_tree::read_json(command_config_stream, configTreeMain);
subCommand->setOptionConfig(configTreeMain);
Expand Down
Loading