diff --git a/build/petalinux.build b/build/petalinux.build index dda07a9be19..d1a55d7c11f 100644 --- a/build/petalinux.build +++ b/build/petalinux.build @@ -1,3 +1,3 @@ # When updating Petalinux build please file a SH ticket to retain the build # https://jira.xilinx.com/secure/CreateIssue!default.jspa -PETALINUX=/proj/petalinux/2024.2/petalinux-v2024.2_10031251/tool/petalinux-v2024.2-final +PETALINUX=/proj/petalinux/2024.2/petalinux-v2024.2_10101427/tool/petalinux-v2024.2-final diff --git a/src/runtime_src/core/common/info_platform.cpp b/src/runtime_src/core/common/info_platform.cpp index 117b3e6c705..ad11cfe8394 100644 --- a/src/runtime_src/core/common/info_platform.cpp +++ b/src/runtime_src/core/common/info_platform.cpp @@ -158,13 +158,6 @@ add_performance_info(const xrt_core::device* device, ptree_type& pt) catch (xrt_core::query::no_such_key&) { pt.add("power_mode", "not supported"); } - try { - const auto mode = (xrt_core::device_query(device) == 0) ? "disabled" : "enabled"; - pt.add("force_preemption", mode); - } - catch (xrt_core::query::no_such_key&) { - pt.add("force_preemption", "not supported"); - } } static std::string @@ -333,61 +326,6 @@ enum_to_str(CLOCK_TYPE type) } } -void -add_clock_info(const xrt_core::device* device, ptree_type& pt) -{ - ptree_type pt_clock_array; - - try { - auto raw = xrt_core::device_query(device); - if (raw.empty()) - return; - - ptree_type pt_clocks; - auto clock_topology = reinterpret_cast(raw.data()); - for (int i = 0; i < clock_topology->m_count; i++) { - ptree_type pt_clock; - pt_clock.add("id", clock_topology->m_clock_freq[i].m_name); - pt_clock.add("description", enum_to_str(static_cast(clock_topology->m_clock_freq[i].m_type))); - pt_clock.add("freq_mhz", clock_topology->m_clock_freq[i].m_freq_Mhz); - pt_clock_array.push_back(std::make_pair("", pt_clock)); - } - pt.put_child("clocks", pt_clock_array); - } - catch (const xq::no_such_key&) { - // ignoring if not available: Edge Case - } -} - -void -add_tops_info(const xrt_core::device* device, ptree_type& pt) -{ - ptree_type pt_tops_array; - - try - { - auto res_info = xrt_core::device_query(device); - if (res_info.empty()) - return; - - for (auto &res : res_info) - { - if (res.type != xrt_core::query::xrt_resource_raw::resource_type::ipu_tops_max) - continue; - - ptree_type pt_tops; - pt_tops.add("id", xq::xrt_resource_raw::get_name(res.type)); - pt_tops.add("value", res.data_double); - pt_tops_array.push_back(std::make_pair("", pt_tops)); - } - pt.put_child("tops", pt_tops_array); - } - catch (const xq::no_such_key &) - { - // ignoring if not available: Edge Case - } -} - void add_electrical_info(const xrt_core::device* device, ptree_type& pt) { @@ -450,7 +388,6 @@ add_platform_info(const xrt_core::device* device, ptree_type& pt_platform_array) ptree_type pt_platforms; add_static_region_info(device, pt_platform); - add_tops_info(device, pt_platform); add_status_info(device, pt_platform); const auto device_class = xrt_core::device_query_default(device, xrt_core::query::device_class::type::alveo); @@ -463,7 +400,8 @@ add_platform_info(const xrt_core::device* device, ptree_type& pt_platform_array) else add_controller_info(device, pt_platform); add_mac_info(device, pt_platform); - add_clock_info(device, pt_platform); + auto pt_clock_array = xrt_core::platform::get_clock_info(device); + pt_platform.put_child("clocks", pt_clock_array); add_config_info(device, pt_platform); break; } @@ -484,6 +422,33 @@ add_platform_info(const xrt_core::device* device, ptree_type& pt_platform_array) namespace xrt_core { namespace platform { +ptree_type +get_clock_info(const xrt_core::device* device) +{ + ptree_type pt; + + try { + auto raw = xrt_core::device_query(device); + if (raw.empty()) + return pt; + + ptree_type pt_clock_array; + auto clock_topology = reinterpret_cast(raw.data()); + for (int i = 0; i < clock_topology->m_count; i++) { + ptree_type pt_clock; + pt_clock.add("id", clock_topology->m_clock_freq[i].m_name); + pt_clock.add("description", enum_to_str(static_cast(clock_topology->m_clock_freq[i].m_type))); + pt_clock.add("freq_mhz", clock_topology->m_clock_freq[i].m_freq_Mhz); + pt_clock_array.push_back(std::make_pair("", pt_clock)); + } + pt.put_child("clocks", pt_clock_array); + } + catch (const xq::no_such_key&) { + // ignoring if not available: Edge Case + } + return pt; +} + ptree_type platform_info(const xrt_core::device* device) { diff --git a/src/runtime_src/core/common/info_platform.h b/src/runtime_src/core/common/info_platform.h index 291e008ab0f..b0551ff9733 100644 --- a/src/runtime_src/core/common/info_platform.h +++ b/src/runtime_src/core/common/info_platform.h @@ -31,6 +31,10 @@ XRT_CORE_COMMON_EXPORT boost::property_tree::ptree pcie_info(const xrt_core::device* device); +XRT_CORE_COMMON_EXPORT +boost::property_tree::ptree +get_clock_info(const xrt_core::device* device); + }} // platform, xrt #endif diff --git a/src/runtime_src/core/edge/user/aie/common_layer/adf_runtime_api.cpp b/src/runtime_src/core/edge/user/aie/common_layer/adf_runtime_api.cpp index 35db2040316..192b185af7c 100755 --- a/src/runtime_src/core/edge/user/aie/common_layer/adf_runtime_api.cpp +++ b/src/runtime_src/core/edge/user/aie/common_layer/adf_runtime_api.cpp @@ -920,9 +920,7 @@ err_code dma_api::updateBDAddressLin(XAie_MemInst* memInst , uint8_t column, uin int driverStatus = XAIE_OK; XAie_LocType tileLoc = XAie_TileLoc(column, relativeToAbsoluteRow(1, row)); - // uncomment below line once latest Petalinux is available -// driverStatus |= XAie_DmaUpdateBdAddrOff(memInst, tileLoc ,offset, bdId); - + driverStatus |= XAie_DmaUpdateBdAddrOff(memInst, tileLoc ,offset, bdId); if (driverStatus != AieRC::XAIE_OK) return errorMsg(err_code::aie_driver_error, "ERROR: adf::dma_api::updateBDAddressLin: AIE driver error."); diff --git a/src/runtime_src/core/tools/common/SubCmdConfigureInternal.cpp b/src/runtime_src/core/tools/common/SubCmdConfigureInternal.cpp index 191e5eaa6c2..e972c6d0f86 100644 --- a/src/runtime_src/core/tools/common/SubCmdConfigureInternal.cpp +++ b/src/runtime_src/core/tools/common/SubCmdConfigureInternal.cpp @@ -349,6 +349,7 @@ SubCmdConfigureInternal::execute(const SubCmdOptions& _options) const } if (optionOption) { + optionOption->setGlobalOptions(getGlobalOptions()); optionOption->execute(_options); return; } diff --git a/src/runtime_src/core/tools/common/TestRunner.cpp b/src/runtime_src/core/tools/common/TestRunner.cpp index e8414b304d0..6894105b9bc 100644 --- a/src/runtime_src/core/tools/common/TestRunner.cpp +++ b/src/runtime_src/core/tools/common/TestRunner.cpp @@ -360,46 +360,6 @@ TestRunner::validate_binary_file(const std::string& binaryfile) else return EXIT_SUCCESS; } - -// Copy values from text files into buff, expecting values are ascii encoded hex -void -TestRunner::init_instr_buf(xrt::bo &bo_instr, const std::string& dpu_file) { - std::ifstream dpu_stream(dpu_file); - if (!dpu_stream.is_open()) { - throw std::runtime_error(boost::str(boost::format("Failed to open %s for reading") % dpu_file)); - } - - auto instr = bo_instr.map(); - std::string line; - while (std::getline(dpu_stream, line)) { - if (line.at(0) == '#') { - continue; - } - std::stringstream ss(line); - unsigned int word = 0; - ss >> std::hex >> word; - *(instr++) = word; - } -} - -size_t -TestRunner::get_instr_size(const std::string& dpu_file) { - std::ifstream file(dpu_file); - if (!file.is_open()) { - throw std::runtime_error(boost::str(boost::format("Failed to open %s for reading") % dpu_file)); - } - size_t size = 0; - std::string line; - while (std::getline(file, line)) { - if (line.at(0) != '#') { - size++; - } - } - if (size == 0) { - throw std::runtime_error("Invalid DPU instruction length"); - } - return size; -} bool TestRunner::search_and_program_xclbin(const std::shared_ptr& dev, boost::property_tree::ptree& ptTest) { @@ -499,72 +459,3 @@ TestRunner::get_test_header() ptree.put("explicit", m_explicit); return ptree; } - -void -TestRunner::result_in_range(double value, double threshold, boost::property_tree::ptree& ptTest) -{ - //have a 40% tolerance until we can nail down consistent numbers - if (((((0.60*threshold) <= value) && (value <=(1.40*threshold))) || threshold == 0.0)) { - ptTest.put("status", test_token_passed); - } - else { - logger(ptTest, "Warning", boost::str(boost::format("Benchmark value is not ~%.1f which is the expected value") % threshold)); - ptTest.put("status", test_token_passed); - } -} - -/* - * This function finds the benchmark_devid_revid.json file in the driverstore and - * iterates through it to find the golden threshold value for a given test. - * Case 1: json is not found - the testcase will show a warning and pass the test - * Case 2: json is found, but the corresponding pmode is not - testcase will throw - * an exception - * Case 3: json and the corresponding pmode is found - testcase will compare the - * result against the json value - */ -void -TestRunner::set_threshold(const std::shared_ptr& dev, - boost::property_tree::ptree& ptTest) -{ - //find the benchmark.json - const auto pcie_id = xrt_core::device_query(dev); - - //phoenix is not supported - if(xq::pcie_id::device_to_string(pcie_id).find("1502") != std::string::npos) - return; - - auto benchmark_fname = boost::str(boost::format("benchmark_%s_%s.json") - % xq::pcie_id::device_to_string(pcie_id) % xq::pcie_id::revision_to_string(pcie_id)); - auto json_config = findPlatformFile(benchmark_fname, ptTest); - if (!std::filesystem::exists(json_config)) { - logger(ptTest, "Warning", "The results are not compared to expected numbers."); - m_threshold = 0.0; - return; - } - - logger(ptTest, "Benchmarks", json_config); - - //open file - boost::property_tree::ptree validate_json; - boost::property_tree::read_json(json_config, validate_json); - - //find curr pmode - const auto curr_pmode = xq::performance_mode::parse_status(xrt_core::device_query(dev)); - - //iterate tests array to find test_name - const boost::property_tree::ptree& tests = validate_json.get_child("tests"); - for (const auto& kt : tests) { - const boost::property_tree::ptree& pt_test = kt.second; - if(!boost::iequals(pt_test.get("test_name"), ptTest.get("name"))) - continue; - const boost::property_tree::ptree& benchmarks = pt_test.get_child("benchmarks"); - for (const auto& kb : benchmarks) { - const boost::property_tree::ptree& pt_benchmark = kb.second; - if(boost::iequals(curr_pmode, pt_benchmark.get("pmode"))) { - m_threshold = pt_benchmark.get("threshold"); - return; - } - } - } - throw std::runtime_error(boost::str(boost::format("Test is not supported for %s mode") % curr_pmode)); -} diff --git a/src/runtime_src/core/tools/common/TestRunner.h b/src/runtime_src/core/tools/common/TestRunner.h index ce6bf61dfd1..ac068a20b4e 100644 --- a/src/runtime_src/core/tools/common/TestRunner.h +++ b/src/runtime_src/core/tools/common/TestRunner.h @@ -46,11 +46,6 @@ class TestRunner : public JSONConfigurable { std::vector findDependencies( const std::string& test_path, const std::string& ps_kernel_name); int validate_binary_file(const std::string& binaryfile); - void init_instr_buf(xrt::bo &bo_instr, const std::string& dpu_file); - size_t get_instr_size(const std::string& dpu_file); - void result_in_range(double value, double threshold, boost::property_tree::ptree& ptTest); - void set_threshold(const std::shared_ptr& dev, boost::property_tree::ptree& ptTest); - double get_threshold(){return m_threshold;}; const std::string test_token_skipped = "SKIPPED"; const std::string test_token_failed = "FAILED"; @@ -69,7 +64,6 @@ class TestRunner : public JSONConfigurable { std::string m_name; std::string m_description; bool m_explicit; - double m_threshold; }; diff --git a/src/runtime_src/core/tools/common/XBMain.cpp b/src/runtime_src/core/tools/common/XBMain.cpp index 2ce7caf40ac..f9edcff184a 100644 --- a/src/runtime_src/core/tools/common/XBMain.cpp +++ b/src/runtime_src/core/tools/common/XBMain.cpp @@ -79,7 +79,12 @@ void main_(int argc, char** argv, // Parse the command line arguments po::variables_map vm; po::command_line_parser parser(argc, argv); - auto subcmd_options = XBU::process_arguments(vm, parser, allOptions, positionalCommand, false); + SubCmd::SubCmdOptions subcmd_options; + try { + subcmd_options = XBU::process_arguments(vm, parser, allOptions, positionalCommand, false); + } catch (po::error& ex) { + std::cerr << ex.what() << std::endl; + } if(bVersion) { std::cout << XBU::get_xrt_pretty_version(); diff --git a/src/runtime_src/core/tools/common/reports/platform/ReportRyzenPlatform.cpp b/src/runtime_src/core/tools/common/reports/platform/ReportRyzenPlatform.cpp index cfbf38f76b1..51916432583 100644 --- a/src/runtime_src/core/tools/common/reports/platform/ReportRyzenPlatform.cpp +++ b/src/runtime_src/core/tools/common/reports/platform/ReportRyzenPlatform.cpp @@ -51,7 +51,6 @@ ReportRyzenPlatform::writeReport(const xrt_core::device* /*_pDevice*/, const boost::property_tree::ptree& pt_status = pt_platform.get_child("status"); _output << boost::format(" %-23s: %s \n") % "Power Mode" % pt_status.get("power_mode"); - _output << boost::format(" %-23s: %s \n") % "Preemption" % pt_status.get("force_preemption"); const boost::property_tree::ptree& clocks = pt_platform.get_child("clocks", empty_ptree); if (!clocks.empty()) { @@ -63,16 +62,6 @@ ReportRyzenPlatform::writeReport(const xrt_core::device* /*_pDevice*/, } } - const boost::property_tree::ptree& tops = pt_platform.get_child("tops", empty_ptree); - if (!tops.empty()) { - _output << "\nTOPs\n"; - for (const auto& kt : tops) { - const boost::property_tree::ptree& pt_tops = kt.second; - std::string tops_name_type = pt_tops.get("id"); - _output << boost::format(" %-23s: %s Terabyte ops/second\n") % tops_name_type % pt_tops.get("value"); - } - } - auto watts = pt_platform.get("electrical.power_consumption_watts", "N/A"); if (watts != "N/A") _output << std::endl << boost::format("%-23s : %s Watts\n") % "Power" % watts; diff --git a/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp b/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp index 714247e87a3..be49b35f75a 100644 --- a/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp +++ b/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp @@ -2,6 +2,7 @@ // Local - Include Files #include "TestAIEReconfigOverhead.h" +#include "TestValidateUtilities.h" #include "tools/common/XBUtilities.h" #include "xrt/xrt_bo.h" #include "xrt/xrt_device.h" @@ -30,17 +31,6 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBUtilities::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f ms") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -88,10 +78,10 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); kernel = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex) + catch (const std::exception& ) { - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -104,7 +94,7 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) size_t instr_size = 0; try { - instr_size = get_instr_size(dpu_instr); + instr_size = XBValidateUtils::get_instr_size(dpu_instr); } catch(const std::exception& ex) { logger(ptree, "Error", ex.what()); @@ -123,7 +113,7 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) argno++; xrt::bo bo_mc(working_dev, 16, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(argno++)); - init_instr_buf(bo_instr, dpu_instr); + XBValidateUtils::init_instr_buf(bo_instr, dpu_instr); //Create ctrlcode with NOPs std::memset(bo_instr_no_op.map(), 0, instr_size); @@ -189,8 +179,7 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) elapsedSecsAverage /= itr_count; double overhead = (elapsedSecsAverage - elapsedSecsNoOpAverage)*1000; //in ms - //check if the value is in range - result_in_range(overhead, get_threshold(), ptree); logger(ptree, "Details", boost::str(boost::format("Array reconfiguration overhead: %.1f ms") % overhead)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp b/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp index 99740d3db43..dfcb82d61b7 100644 --- a/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp +++ b/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp @@ -29,17 +29,6 @@ TestCmdChainLatency::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f us") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -88,9 +77,10 @@ TestCmdChainLatency::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); testker = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex){ - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + catch (const std::exception& ) + { + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -155,6 +145,7 @@ TestCmdChainLatency::run(std::shared_ptr dev) catch (const std::exception& ex) { logger(ptree, "Error", ex.what()); ptree.put("status", test_token_failed); + return ptree; } try { @@ -163,6 +154,7 @@ TestCmdChainLatency::run(std::shared_ptr dev) catch (const std::exception& ex) { logger(ptree, "Error", ex.what()); ptree.put("status", test_token_failed); + return ptree; } } auto end = std::chrono::high_resolution_clock::now(); @@ -171,8 +163,7 @@ TestCmdChainLatency::run(std::shared_ptr dev) // Calculate end-to-end latency of one job execution const double latency = (elapsedSecs / (itr_count*run_count)) * 1000000; //convert s to us - //check if the value is in range - result_in_range(latency, get_threshold(), ptree); logger(ptree, "Details", boost::str(boost::format("Average latency: %.1f us") % latency)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp b/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp index 580d06fd91f..552e48eaee5 100644 --- a/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp +++ b/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp @@ -29,17 +29,6 @@ TestCmdChainThroughput::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f ops") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -87,10 +76,10 @@ TestCmdChainThroughput::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); testker = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex) + catch (const std::exception& ) { - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -155,6 +144,7 @@ TestCmdChainThroughput::run(std::shared_ptr dev) catch (const std::exception& ex) { logger(ptree, "Error", ex.what()); ptree.put("status", test_token_failed); + return ptree; } try { @@ -163,6 +153,7 @@ TestCmdChainThroughput::run(std::shared_ptr dev) catch (const std::exception& ex) { logger(ptree, "Error", ex.what()); ptree.put("status", test_token_failed); + return ptree; } } auto end = std::chrono::high_resolution_clock::now(); @@ -171,8 +162,7 @@ TestCmdChainThroughput::run(std::shared_ptr dev) // Compute the throughput const double throughput = ((itr_count*run_count) / elapsedSecs); - //check if the value is in range - result_in_range(throughput, get_threshold(), ptree); logger(ptree, "Details", boost::str(boost::format("Average throughput: %.1f ops") % throughput)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp b/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp index e243068519e..cb5eca0d4f0 100644 --- a/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp +++ b/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp @@ -4,6 +4,7 @@ // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files #include "TestDF_bandwidth.h" +#include "TestValidateUtilities.h" #include "tools/common/XBUtilities.h" #include "xrt/xrt_bo.h" #include "xrt/xrt_device.h" @@ -34,17 +35,6 @@ TestDF_bandwidth::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f GB/s") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -92,10 +82,10 @@ TestDF_bandwidth::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); kernel = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex) + catch (const std::exception& ) { - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -108,7 +98,7 @@ TestDF_bandwidth::run(std::shared_ptr dev) size_t instr_size = 0; try { - instr_size = get_instr_size(dpu_instr); + instr_size = XBValidateUtils::get_instr_size(dpu_instr); } catch(const std::exception& ex) { logger(ptree, "Error", ex.what()); @@ -121,7 +111,7 @@ TestDF_bandwidth::run(std::shared_ptr dev) xrt::bo bo_ofm(working_dev, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3)); xrt::bo bo_instr(working_dev, instr_size*sizeof(int), XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); - init_instr_buf(bo_instr, dpu_instr); + XBValidateUtils::init_instr_buf(bo_instr, dpu_instr); // map input buffer auto ifm_mapped = bo_ifm.map(); @@ -169,12 +159,10 @@ TestDF_bandwidth::run(std::shared_ptr dev) //Data is read and written in parallel hence x2 double bandwidth = (buffer_size_gb*itr_count*2) / elapsedSecs; - //check if the value is in range - result_in_range(bandwidth, get_threshold(), ptree); - if(XBU::getVerbose()) logger(ptree, "Details", boost::str(boost::format("Total duration: %.1fs") % elapsedSecs)); logger(ptree, "Details", boost::str(boost::format("Average bandwidth per shim DMA: %.1f GB/s") % bandwidth)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestGemm.cpp b/src/runtime_src/core/tools/common/tests/TestGemm.cpp index ab8bcc6b3b0..0540c36713d 100644 --- a/src/runtime_src/core/tools/common/tests/TestGemm.cpp +++ b/src/runtime_src/core/tools/common/tests/TestGemm.cpp @@ -4,6 +4,7 @@ // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files #include "TestGemm.h" +#include "TestValidateUtilities.h" #include "tools/common/XBUtilities.h" #include "xrt/xrt_bo.h" #include "xrt/xrt_device.h" @@ -37,17 +38,6 @@ TestGemm::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f TOPS") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::gemm); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -95,10 +85,10 @@ TestGemm::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); kernel = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex) + catch (const std::exception& ) { - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -112,7 +102,7 @@ TestGemm::run(std::shared_ptr dev) size_t instr_size = 0; try { - instr_size = get_instr_size(dpu_instr); + instr_size = XBValidateUtils::get_instr_size(dpu_instr); } catch(const std::exception& ex) { logger(ptree, "Error", ex.what()); @@ -122,7 +112,7 @@ TestGemm::run(std::shared_ptr dev) //Create Instruction BO xrt::bo bo_instr(working_dev, instr_size*sizeof(int), XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); - init_instr_buf(bo_instr, dpu_instr); + XBValidateUtils::init_instr_buf(bo_instr, dpu_instr); //Sync Instruction BO bo_instr.sync(XCL_BO_SYNC_BO_TO_DEVICE); @@ -130,41 +120,8 @@ TestGemm::run(std::shared_ptr dev) xrt::bo bo_result = xrt_core::bo_int::create_debug_bo(hwctx, 0x20000); // wait until clock reaches the max frequency - int ipu_hclock_pre = 0; int ipu_hclock = 0; - auto hclock_steady_counter = 0; - auto first_steady_state = -1, second_steady_state = -1;; - - for(int i=0; i<100;i++){ - auto raw = xrt_core::device_query(dev); - auto clock_topology = reinterpret_cast(raw.data()); - for (int c = 0; c < clock_topology->m_count; c++) { - if(boost::iequals(clock_topology->m_clock_freq[c].m_name, "H CLock")) - ipu_hclock = clock_topology->m_clock_freq[c].m_freq_Mhz; - } - std::this_thread::sleep_for(std::chrono::milliseconds(50)); - //std::cout << "NPU clock: " << ipu_hclock <= 1810) { - //break; - first_steady_state = ipu_hclock_pre; - hclock_steady_counter = 0; - } - - if(hclock_steady_counter == 8 && first_steady_state != -1 && second_steady_state == -1 && ipu_hclock > first_steady_state) { - //break; - second_steady_state = ipu_hclock; - hclock_steady_counter = 0; - } - - if (hclock_steady_counter == 8 && second_steady_state != -1 && ipu_hclock > second_steady_state) { - break; - } - - ipu_hclock_pre = ipu_hclock; // Update hclk with hclk_pre - - } + XBValidateUtils::wait_for_max_clock(ipu_hclock, dev); try { //run kernel @@ -212,10 +169,8 @@ TestGemm::run(std::shared_ptr dev) logger(ptree, "Details", boost::str(boost::format("Average cycle count: %.1f") % (total_cycle_count/num_of_cores))); } - //check if the value is in range - result_in_range(TOPS, get_threshold(), ptree); - logger(ptree, "Details", boost::str(boost::format("TOPS: %.1f") % TOPS)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestHelper.cpp b/src/runtime_src/core/tools/common/tests/TestHelper.cpp deleted file mode 100644 index 0539fe944c1..00000000000 --- a/src/runtime_src/core/tools/common/tests/TestHelper.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// Copyright (C) 2023-2024 Advanced Micro Devices, Inc. All rights reserved. - -// ------ I N C L U D E F I L E S ------------------------------------------- -// Local - Include Files -#include "TestHelper.h" - -// Constructor for BO_set -// BO_set is a collection of all the buffer objects so that the operations on all buffers can be done from a single object -// Parameters: -// - device: Reference to the xrt::device object -// - kernel: Reference to the xrt::kernel object -BO_set::BO_set(const xrt::device& device, const xrt::kernel& kernel, size_t buffer_size) - : buffer_size(buffer_size), - bo_instr (device, buffer_size, XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)), - bo_ifm (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(1)), - bo_param (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(2)), - bo_ofm (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3)), - bo_inter (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(4)), - bo_mc (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(7)) -{ - // no-op instruction buffer - std::memset(bo_instr.map(), (uint8_t)0, buffer_size); -} - -// Method to synchronize buffer objects to the device -void BO_set::sync_bos_to_device() { - bo_instr.sync(XCL_BO_SYNC_BO_TO_DEVICE); - bo_ifm.sync(XCL_BO_SYNC_BO_TO_DEVICE); - bo_param.sync(XCL_BO_SYNC_BO_TO_DEVICE); - bo_mc.sync(XCL_BO_SYNC_BO_TO_DEVICE); -} - -// Method to set kernel arguments -// Parameters: -// - run: Reference to the xrt::run object -void BO_set::set_kernel_args(xrt::run& run) const { - uint64_t opcode = 1; - run.set_arg(0, opcode); - run.set_arg(1, bo_ifm); - run.set_arg(2, bo_param); - run.set_arg(3, bo_ofm); - run.set_arg(4, bo_inter); - run.set_arg(5, bo_instr); - run.set_arg(6, buffer_size/sizeof(int)); - run.set_arg(7, bo_mc); -} - -void -TestCase::initialize() -{ - // Initialize kernels, buffer objects, and runs - for (int j = 0; j < queue_len; j++) { - auto kernel = xrt::kernel(hw_ctx, kernel_name); - auto bos = BO_set(device, kernel, buffer_size); - bos.sync_bos_to_device(); - auto run = xrt::run(kernel); - bos.set_kernel_args(run); - run.start(); - run.wait2(); - - kernels.push_back(kernel); - bo_set_list.push_back(bos); - run_list.push_back(run); - } -} - -// Method to run the test case -void -TestCase::run() -{ - for (int i = 0; i < itr_count; i++) { - // Start all runs in the queue so that they run in parallel - for (int cnt = 0; cnt < queue_len; cnt++) { - run_list[cnt].start(); - } - // Wait for all runs in the queue to complete - for (int cnt = 0; cnt < queue_len; cnt++) { - run_list[cnt].wait2(); - } - } -} diff --git a/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp b/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp index 3013ddc55df..6a215ce100a 100644 --- a/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp +++ b/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp @@ -29,17 +29,6 @@ TestNPULatency::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f us") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -88,12 +77,12 @@ TestNPULatency::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); testker = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex){ - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + catch (const std::exception& ) + { + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } - xrt::xclbin::ip cu; for (const auto& ip : xclbin.get_ips()) { if (ip.get_type() != xrt::xclbin::ip::ip_type::ps) @@ -148,14 +137,13 @@ TestNPULatency::run(std::shared_ptr dev) catch (const std::exception& ex) { logger(ptree, "Error", ex.what()); ptree.put("status", test_token_failed); + return ptree; } // Calculate end-to-end latency of one job execution const double latency = (elapsed_secs / itr_count) * 1000000; //convert s to us - //check if the value is in range - result_in_range(latency, get_threshold(), ptree); - logger(ptree, "Details", boost::str(boost::format("Average latency: %.1f us") % latency)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp b/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp index 76a39f0c95a..48dcd156256 100644 --- a/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp +++ b/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp @@ -29,17 +29,6 @@ TestNPUThroughput::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f ops") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -88,9 +77,10 @@ TestNPUThroughput::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); testker = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex){ - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + catch (const std::exception& ) + { + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -157,14 +147,13 @@ TestNPUThroughput::run(std::shared_ptr dev) catch (const std::exception& ex) { logger(ptree, "Error", ex.what()); ptree.put("status", test_token_failed); + return ptree; } // Compute the throughput const double throughput = (elapsedSecs != 0.0) ? itr_count_throughput / elapsedSecs : 0.0; - //check if the value is in range - result_in_range(throughput, get_threshold(), ptree); - logger(ptree, "Details", boost::str(boost::format("Average throughput: %.1f ops") % throughput)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp index ef03adb814d..534ab9d7281 100644 --- a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp +++ b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp @@ -4,7 +4,7 @@ // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files #include "TestSpatialSharingOvd.h" -#include "TestHelper.h" +#include "TestValidateUtilities.h" #include "tools/common/XBUtilities.h" #include "xrt/xrt_bo.h" #include "xrt/xrt_device.h" @@ -15,6 +15,7 @@ namespace XBU = XBUtilities; static constexpr size_t host_app = 1; //opcode +static constexpr size_t buffer_size = 1024; //1 KB // Method to run the test // Parameters: @@ -25,17 +26,6 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr(dev, xrt_core::query::xclbin_name::type::validate); @@ -103,13 +93,20 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr(dev, xrt_core::query::sequence_name::type::df_bandwidth); + auto dpu_instr = findPlatformFile(seq_name, ptree); + if (!std::filesystem::exists(dpu_instr)) + return ptree; + + logger(ptree, "DPU-Sequence", dpu_instr); /* Run 1 */ std::vector threads; std::vector testcases; // Create two test cases and add them to the vector - testcases.emplace_back(xclbin, kernelName, working_dev); - testcases.emplace_back(xclbin, kernelName, working_dev); + TestParams params(xclbin, working_dev, kernelName, dpu_instr, 8, buffer_size, 10000); + testcases.emplace_back(params); + testcases.emplace_back(params); for (uint32_t i = 0; i < testcases.size(); i++) { try{ @@ -140,10 +137,11 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f TCT/s") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -89,10 +79,10 @@ TestTCTAllColumn::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); kernel = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex) + catch (const std::exception& ) { - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } @@ -105,7 +95,7 @@ TestTCTAllColumn::run(std::shared_ptr dev) size_t instr_size = 0; try { - instr_size = get_instr_size(dpu_instr); + instr_size = XBValidateUtils::get_instr_size(dpu_instr); } catch(const std::exception& ex) { logger(ptree, "Error", ex.what()); @@ -118,7 +108,7 @@ TestTCTAllColumn::run(std::shared_ptr dev) xrt::bo bo_ofm(working_dev, 4*buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3)); xrt::bo bo_instr(working_dev, instr_size*sizeof(int), XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); - init_instr_buf(bo_instr, dpu_instr); + XBValidateUtils::init_instr_buf(bo_instr, dpu_instr); // map input buffer auto ifm_mapped = bo_ifm.map(); @@ -164,12 +154,10 @@ TestTCTAllColumn::run(std::shared_ptr dev) double throughput = itr_count / elapsedSecs; double latency = (elapsedSecs / itr_count) * 1000000; //convert s to us - //check if the value is in range - result_in_range(throughput, get_threshold(), ptree); - if(XBU::getVerbose()) logger(ptree, "Details", boost::str(boost::format("Average time for TCT: %.1f us") % latency)); logger(ptree, "Details", boost::str(boost::format("Average TCT throughput: %.1f TCT/s") % throughput)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp b/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp index 0b18d4e024e..a96ee37d00f 100644 --- a/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp +++ b/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp @@ -4,6 +4,7 @@ // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files #include "TestTCTOneColumn.h" +#include "TestValidateUtilities.h" #include "tools/common/XBUtilities.h" #include "xrt/xrt_bo.h" #include "xrt/xrt_device.h" @@ -30,17 +31,6 @@ TestTCTOneColumn::run(std::shared_ptr dev) boost::property_tree::ptree ptree = get_test_header(); ptree.erase("xclbin"); - try { - set_threshold(dev, ptree); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Threshold is %.1f TCT/s") % get_threshold())); - } - catch (const std::runtime_error& ex) { - logger(ptree, "Details", ex.what()); - ptree.put("status", test_token_skipped); - return ptree; - } - const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); auto xclbin_path = findPlatformFile(xclbin_name, ptree); if (!std::filesystem::exists(xclbin_path)){ @@ -89,13 +79,12 @@ TestTCTOneColumn::run(std::shared_ptr dev) hwctx = xrt::hw_context(working_dev, xclbin.get_uuid()); kernel = xrt::kernel(hwctx, kernelName); } - catch (const std::exception& ex) + catch (const std::exception& ) { - logger(ptree, "Error", ex.what()); - ptree.put("status", test_token_failed); + logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); + ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); return ptree; } - const auto seq_name = xrt_core::device_query(dev, xrt_core::query::sequence_name::type::tct_one_column); auto dpu_instr = findPlatformFile(seq_name, ptree); if (!std::filesystem::exists(dpu_instr)) @@ -105,7 +94,7 @@ TestTCTOneColumn::run(std::shared_ptr dev) size_t instr_size = 0; try { - instr_size = get_instr_size(dpu_instr); + instr_size = XBValidateUtils::get_instr_size(dpu_instr); } catch(const std::exception& ex) { logger(ptree, "Error", ex.what()); @@ -118,7 +107,7 @@ TestTCTOneColumn::run(std::shared_ptr dev) xrt::bo bo_ofm(working_dev, 4*buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3)); xrt::bo bo_instr(working_dev, instr_size*sizeof(int), XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); - init_instr_buf(bo_instr, dpu_instr); + XBValidateUtils::init_instr_buf(bo_instr, dpu_instr); // map input buffer auto ifm_mapped = bo_ifm.map(); @@ -163,12 +152,10 @@ TestTCTOneColumn::run(std::shared_ptr dev) double throughput = itr_count / elapsedSecs; double latency = (elapsedSecs / itr_count) * 1000000; //convert s to us - //check if the value is in range - result_in_range(throughput, get_threshold(), ptree); - if(XBU::getVerbose()) logger(ptree, "Details", boost::str(boost::format("Average time for TCT: %.1f us") % latency)); logger(ptree, "Details", boost::str(boost::format("Average TCT throughput: %.1f TCT/s") % throughput)); + ptree.put("status", test_token_passed); return ptree; } diff --git a/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp new file mode 100644 index 00000000000..2baf8741c0b --- /dev/null +++ b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp @@ -0,0 +1,151 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + +// ------ I N C L U D E F I L E S ------------------------------------------- + +// System - Include Files +#include + +// Local - Include Files +#include "tools/common/XBUtilities.h" +#include "tools/common/tests/TestTemporalSharingOvd.h" +#include "TestValidateUtilities.h" +#include "xrt/xrt_bo.h" +#include "xrt/xrt_device.h" +#include "xrt/xrt_hw_context.h" +#include "xrt/xrt_kernel.h" + + +namespace XBU = XBUtilities; +static constexpr size_t buffer_size = 1024; //1 KB + +boost::property_tree::ptree +TestTemporalSharingOvd::run(std::shared_ptr dev) { + ptree.erase("xclbin"); + + const auto xclbin_name = xrt_core::device_query(dev, xrt_core::query::xclbin_name::type::validate); + auto xclbin_path = findPlatformFile(xclbin_name, ptree); + if (!std::filesystem::exists(xclbin_path)) + return ptree; + + logger(ptree, "Xclbin", xclbin_path); + + xrt::xclbin xclbin; + try{ + xclbin = xrt::xclbin(xclbin_path); + } + catch(const std::runtime_error& ex) { + logger(ptree, "Error", ex.what()); + ptree.put("status", test_token_failed); + return ptree; + } + auto xkernels = xclbin.get_kernels(); + + auto itr = std::find_if(xkernels.begin(), xkernels.end(), [](xrt::xclbin::kernel& k) { + auto name = k.get_name(); + return name.rfind("DPU",0) == 0; // Starts with "DPU" + }); + + xrt::xclbin::kernel xkernel; + if (itr!=xkernels.end()) + xkernel = *itr; + else { + logger(ptree, "Error", "No kernel with `DPU` found in the xclbin"); + ptree.put("status", test_token_failed); + return ptree; + } + auto kernelName = xkernel.get_name(); + if(XBU::getVerbose()) + logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); + + auto working_dev = xrt::device(dev); + working_dev.register_xclbin(xclbin); + + const auto seq_name = xrt_core::device_query(dev, xrt_core::query::sequence_name::type::df_bandwidth); + auto dpu_instr = findPlatformFile(seq_name, ptree); + if (!std::filesystem::exists(dpu_instr)) + return ptree; + + logger(ptree, "DPU-Sequence", dpu_instr); + + // Run 1 + std::vector threads; + std::vector testcases; + + // Create two test cases and add them to the vector + TestParams params(xclbin, working_dev, kernelName, dpu_instr, 8, buffer_size, 10000); + testcases.emplace_back(params); + testcases.emplace_back(params); + + initializeTests(testcases); + + // Lambda function to run a test case. This will be sent to individual thread to be run. + auto runTestcase = [&](TestCase& test) { + try { + test.run(); + } catch (const std::exception& ex) { + logger(ptree, "Error", ex.what()); + ptree.put("status", test_token_failed); + return; + } + }; + + // Measure the latency for running the test cases in parallel + auto start = std::chrono::high_resolution_clock::now(); + // Create two threads to run the test cases + threads.emplace_back(runTestcase, std::ref(testcases[0])); + threads.emplace_back(runTestcase, std::ref(testcases[1])); + + for (uint32_t i = 0; i < threads.size(); i++) { + threads[i].join(); + } + auto end = std::chrono::high_resolution_clock::now(); + float latencySpatial = std::chrono::duration_cast>(end-start).count(); + + threads.clear(); + testcases.clear(); + + // Run 2 + // Create 4 test cases and add them to the vector + for (int i = 0; i < 4; i++) + testcases.emplace_back(params); + + initializeTests(testcases); + + // Measure the latency for running the test cases in parallel + start = std::chrono::high_resolution_clock::now(); + // Create four threads to run the test cases + for (unsigned int i = 0; i < testcases.size(); i++) + threads.emplace_back(runTestcase, std::ref(testcases[i])); + + for (uint32_t i = 0; i < threads.size(); i++) { + threads[i].join(); + } + end = std::chrono::high_resolution_clock::now(); + float latencyTemporal = std::chrono::duration_cast>(end-start).count(); + // End of Run 2 + + if(XBU::getVerbose()){ + logger(ptree, "Details", boost::str(boost::format("Spatially shared contexts latency: '%.1f' ms") % (latencySpatial * 1000))); + logger(ptree, "Details", boost::str(boost::format("Temporally shared contexts latency: '%.1f' ms") % (latencyTemporal * 1000))); + } + auto overhead = (latencyTemporal - latencySpatial); + logger(ptree, "Details", boost::str(boost::format("Overhead: '%.1f' ms") % (overhead * 1000))); + + // Set the test status to passed + ptree.put("status", test_token_passed); + return ptree; +} + +void +TestTemporalSharingOvd::initializeTests(std::vector& testcases) { + for (unsigned int i = 0; i < testcases.size(); i++) { + try{ + testcases[i].initialize(); + } catch (const std::exception& ex) { + logger(ptree, "Error", ex.what()); + ptree.put("status", test_token_failed); + return; + } + } +} diff --git a/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.h b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.h new file mode 100644 index 00000000000..1000ed3b84f --- /dev/null +++ b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.h @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + +#ifndef _TESTTEMPORALSHARINGOVD_ +#define _TESTTEMPORALSHARINGOVD_ + +#include "tools/common/TestRunner.h" +#include "TestValidateUtilities.h" + +/* + * @brief Test control flow: + + * Two threads are spawned to run two instances of testcases concurrently. There's one hardware context created on each thread so + * the 2 threads are doing spatial sharing. The threads are added to the threads vector and started using the runTestcase() lambda. + * Once ready, the latency for running the test cases in parallel is measured by recording the start and + * end times around the join calls for each thread. The second run is performed with three TestCase instances executed in 3 threads + * with 1 and 3 doing temporal sharing and 1 and 2 doing spatial sharing. The extra time taken for run corresponds to the overhead + * going into context switching for temporal sharing. + * + * | col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | + * |--------------|------------|------------|------------|------------|------------|------------|------------| + * | shared 4x1 | shared 4x1 | + * |--------------|------------|------------|------------|------------|------------|------------|------------| + * | shared 4x1 | shared 4x1 | +*/ + +class TestTemporalSharingOvd : public TestRunner { +public: + boost::property_tree::ptree ptree; + boost::property_tree::ptree run(std::shared_ptr dev); + void initializeTests(std::vector&); + TestTemporalSharingOvd() + : TestRunner("temporal-sharing-overhead", "Run Temporal Sharing Overhead Test"), ptree(get_test_header()) {} +}; + +#endif diff --git a/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp b/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp new file mode 100644 index 00000000000..37f2ddeb52e --- /dev/null +++ b/src/runtime_src/core/tools/common/tests/TestValidateUtilities.cpp @@ -0,0 +1,176 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + +// ------ I N C L U D E F I L E S ------------------------------------------- +// Local - Include Files +#include +#include +#include "TestValidateUtilities.h" + +// Constructor for BO_set +// BO_set is a collection of all the buffer objects so that the operations on all buffers can be done from a single object +// Parameters: +// - device: Reference to the xrt::device object +// - kernel: Reference to the xrt::kernel object +BO_set::BO_set(const xrt::device& device, const xrt::kernel& kernel, const std::string& dpu_instr, size_t buffer_size) + : buffer_size(buffer_size), + bo_ifm (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(1)), + bo_param (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(2)), + bo_ofm (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(3)), + bo_inter (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(4)), + bo_mc (device, buffer_size, XRT_BO_FLAGS_HOST_ONLY, kernel.group_id(7)) +{ + if (dpu_instr.empty()) { + // Create a no-op instruction if no instruction file is provided + std::memset(bo_instr.map(), (uint8_t)0, buffer_size); + } else { + size_t instr_size = XBValidateUtils::get_instr_size(dpu_instr); + bo_instr = xrt::bo(device, instr_size, XCL_BO_FLAGS_CACHEABLE, kernel.group_id(5)); + } +} + +// Method to synchronize buffer objects to the device +void BO_set::sync_bos_to_device() { + bo_instr.sync(XCL_BO_SYNC_BO_TO_DEVICE); + bo_ifm.sync(XCL_BO_SYNC_BO_TO_DEVICE); + bo_param.sync(XCL_BO_SYNC_BO_TO_DEVICE); + bo_mc.sync(XCL_BO_SYNC_BO_TO_DEVICE); +} + +// Method to set kernel arguments +// Parameters: +// - run: Reference to the xrt::run object +void BO_set::set_kernel_args(xrt::run& run) const { + uint64_t opcode = 1; + run.set_arg(0, opcode); + run.set_arg(1, bo_ifm); + run.set_arg(2, bo_param); + run.set_arg(3, bo_ofm); + run.set_arg(4, bo_inter); + run.set_arg(5, bo_instr); + run.set_arg(6, buffer_size/sizeof(int)); + run.set_arg(7, bo_mc); +} + +void +TestCase::initialize() +{ + hw_ctx = xrt::hw_context(params.device, params.xclbin.get_uuid()); + // Initialize kernels, buffer objects, and runs + for (int j = 0; j < params.queue_len; j++) { + xrt::kernel kernel; + try { + kernel = xrt::kernel(hw_ctx, params.kernel_name); + } catch (const std::exception& ) { + throw std::runtime_error("Not enough columns available. Please make sure no other workload is running on the device."); //rethrow + } + auto bos = BO_set(params.device, kernel, params.dpu_file, params.buffer_size); + bos.sync_bos_to_device(); + auto run = xrt::run(kernel); + bos.set_kernel_args(run); + run.start(); + run.wait2(); + + kernels.push_back(kernel); + bo_set_list.push_back(bos); + run_list.push_back(run); + } +} + +// Method to run the test case +void +TestCase::run() +{ + for (int i = 0; i < params.itr_count; i++) { + // Start all runs in the queue so that they run in parallel + for (int cnt = 0; cnt < params.queue_len; cnt++) { + run_list[cnt].start(); + } + // Wait for all runs in the queue to complete + for (int cnt = 0; cnt < params.queue_len; cnt++) { + run_list[cnt].wait2(); + } + } +} + +namespace XBValidateUtils{ + +// Copy values from text files into buff, expecting values are ascii encoded hex +void +init_instr_buf(xrt::bo &bo_instr, const std::string& dpu_file) { + std::ifstream dpu_stream(dpu_file); + if (!dpu_stream.is_open()) { + throw std::runtime_error(boost::str(boost::format("Failed to open %s for reading") % dpu_file)); + } + + auto instr = bo_instr.map(); + std::string line; + while (std::getline(dpu_stream, line)) { + if (line.at(0) == '#') { + continue; + } + std::stringstream ss(line); + unsigned int word = 0; + ss >> std::hex >> word; + *(instr++) = word; + } +} + +size_t +get_instr_size(const std::string& dpu_file) { + std::ifstream file(dpu_file); + if (!file.is_open()) { + throw std::runtime_error(boost::str(boost::format("Failed to open %s for reading") % dpu_file)); + } + size_t size = 0; + std::string line; + while (std::getline(file, line)) { + if (line.at(0) != '#') { + size++; + } + } + if (size == 0) { + throw std::runtime_error("Invalid DPU instruction length"); + } + return size; +} + +void +wait_for_max_clock(int& ipu_hclock, std::shared_ptr dev) { + int ipu_hclock_pre = 0; + auto hclock_steady_counter = 0; + auto first_steady_state = -1, second_steady_state = -1;; + + for(int i=0; i<100;i++){ + auto raw = xrt_core::device_query(dev); + auto clock_topology = reinterpret_cast(raw.data()); + for (int c = 0; c < clock_topology->m_count; c++) { + if(boost::iequals(clock_topology->m_clock_freq[c].m_name, "H CLock")) + ipu_hclock = clock_topology->m_clock_freq[c].m_freq_Mhz; + } + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + //std::cout << "NPU clock: " << ipu_hclock <= 1810) { + //break; + first_steady_state = ipu_hclock_pre; + hclock_steady_counter = 0; + } + + if(hclock_steady_counter == 8 && first_steady_state != -1 && second_steady_state == -1 && ipu_hclock > first_steady_state) { + //break; + second_steady_state = ipu_hclock; + hclock_steady_counter = 0; + } + + if (hclock_steady_counter == 8 && second_steady_state != -1 && ipu_hclock > second_steady_state) { + break; + } + + ipu_hclock_pre = ipu_hclock; // Update hclk with hclk_pre + + } +} + +}// end of namespace XBValidateUtils diff --git a/src/runtime_src/core/tools/common/tests/TestHelper.h b/src/runtime_src/core/tools/common/tests/TestValidateUtilities.h similarity index 59% rename from src/runtime_src/core/tools/common/tests/TestHelper.h rename to src/runtime_src/core/tools/common/tests/TestValidateUtilities.h index 39e5db7c116..072bf70185c 100644 --- a/src/runtime_src/core/tools/common/tests/TestHelper.h +++ b/src/runtime_src/core/tools/common/tests/TestValidateUtilities.h @@ -1,13 +1,27 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. -#ifndef __TestHelper_h_ -#define __TestHelper_h_ +#ifndef __TestValidateUtilities_h_ +#define __TestValidateUtilities_h_ // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files #include "tools/common/TestRunner.h" +class TestParams { +public: + xrt::xclbin xclbin; // Xclbin object + xrt::device device; + std::string kernel_name; + std::string dpu_file; + int queue_len; + size_t buffer_size; + int itr_count; + + TestParams(const xrt::xclbin& xclbin, xrt::device device, const std::string& kernel_name, const std::string& dpu_file, int queue_len, size_t buffer_size, int itr_count) + : xclbin(xclbin), device(device), kernel_name(kernel_name), dpu_file(dpu_file), queue_len(queue_len), buffer_size(buffer_size), itr_count(itr_count) {} +}; + // Class representing a set of buffer objects (BOs) class BO_set { size_t buffer_size; // Size of the buffer @@ -20,7 +34,7 @@ class BO_set { public: // Constructor to initialize buffer objects - BO_set(const xrt::device&, const xrt::kernel&, size_t); + BO_set(const xrt::device&, const xrt::kernel&, const std::string&, size_t); // Method to set kernel arguments void set_kernel_args(xrt::run&) const; @@ -32,23 +46,27 @@ class BO_set { // Class representing a test case, which is created for a single run on a single thread// class TestCase { - xrt::device device; // Device object - xrt::xclbin xclbin; // Xclbin object - std::string kernel_name; // Name of the kernel + TestParams params; // Test parameters xrt::hw_context hw_ctx; // Hardware context - int queue_len; // Queue length - size_t buffer_size; // Size of the buffer - int itr_count; // Number of iterations std::vector run_list; // Collection of run objects std::vector kernels; // Collection of kernel objects std::vector bo_set_list; // Collection of buffer object sets public: // Constructor to initialize the test case with xclbin and kernel name with hardware context creation - TestCase(const xrt::xclbin& xclbin, const std::string& kernel, const xrt::device& device) - : device(device), xclbin(xclbin), kernel_name(kernel), hw_ctx(device, xclbin.get_uuid()), queue_len(4), buffer_size(1024), itr_count(1000) {} + TestCase(const TestParams& params) + : params(params) {} void initialize(); void run(); -};;; +}; + + +namespace XBValidateUtils{ + +void init_instr_buf(xrt::bo &bo_instr, const std::string& dpu_file); +size_t get_instr_size(const std::string& dpu_file); +void wait_for_max_clock(int&, std::shared_ptr); + +} //End of namespace XBValidateUtils #endif diff --git a/src/runtime_src/core/tools/xbutil2/CMakeLists.txt b/src/runtime_src/core/tools/xbutil2/CMakeLists.txt index 82d210be023..2a09ce58d0d 100644 --- a/src/runtime_src/core/tools/xbutil2/CMakeLists.txt +++ b/src/runtime_src/core/tools/xbutil2/CMakeLists.txt @@ -49,6 +49,7 @@ file(GLOB XBUTIL_V2_SUBCMD_FILES "OO_HostMem.cpp" "OO_Performance.cpp" "OO_Preemption.cpp" + "OO_Reports.cpp" ) # Merge the files into one collection diff --git a/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp b/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp new file mode 100644 index 00000000000..e2543fe31a9 --- /dev/null +++ b/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp @@ -0,0 +1,108 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + +// ------ I N C L U D E F I L E S ------------------------------------------- +// Local - Include Files +#include "OO_Reports.h" +#include "tools/common/XBUtilitiesCore.h" +#include "tools/common/XBUtilities.h" +#include "tools/common/XBHelpMenusCore.h" +#include "core/common/info_platform.h" + +// 3rd Party Library - Include Files +#include +#include +namespace po = boost::program_options; +using bpt = boost::property_tree::ptree; + +// ----- C L A S S M E T H O D S ------------------------------------------- + +OO_Reports::OO_Reports( const std::string &_longName, bool _isHidden ) + : OptionOptions(_longName, _isHidden, "Hidden reports") + , m_device("") + , m_action("") + , m_help(false) +{ + m_optionsDescription.add_options() + ("device,d", boost::program_options::value(&m_device), "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest") + ("help", boost::program_options::bool_switch(&m_help), "Help to use this sub-command") + ("mode", boost::program_options::value(&m_action)->required(), "Action to perform: clocks") + ; + + m_positionalOptions. + add("mode", 1 /* max_count */) + ; +} + +void +OO_Reports::execute(const SubCmdOptions& _options) const +{ + XBUtilities::verbose("SubCommand option: report"); + + XBUtilities::verbose("Option(s):"); + for (auto & aString : _options) + XBUtilities::verbose(std::string(" ") + aString); + + // Honor help option first + if (std::find(_options.begin(), _options.end(), "--help") != _options.end()) { + printHelp(); + return; + } + + // Parse sub-command ... + po::variables_map vm; + + try { + po::options_description all_options("All Options"); + all_options.add(m_optionsDescription); + po::command_line_parser parser(_options); + XBUtilities::process_arguments(vm, parser, all_options, m_positionalOptions, true); + } catch(boost::program_options::error&) { + if(m_help) { + printHelp(); + throw xrt_core::error(std::errc::operation_canceled); + } + // Exit if neither action or device specified + if(m_action.empty()) { + std::cerr << boost::format("ERROR: the required argument for option '--report' is missing\n"); + printHelp(); + throw xrt_core::error(std::errc::operation_canceled); + } + } + + // Find device of interest + std::shared_ptr device; + + try { + device = XBUtilities::get_device(boost::algorithm::to_lower_copy(m_device), true /*inUserDomain*/); + } catch (const std::runtime_error& e) { + // Catch only the exceptions that we have generated earlier + std::cerr << boost::format("ERROR: %s\n") % e.what(); + throw xrt_core::error(std::errc::operation_canceled); + } + + try { + if (boost::iequals(m_action, "clock")) { + bpt empty_tree; + auto clocks = xrt_core::platform::get_clock_info(device.get()); + const bpt& pt_clock_array = clocks.get_child("clocks", empty_tree); + if(pt_clock_array.empty()) + return; + + std::cout << std::endl << "Clocks" << std::endl; + for (const auto& kc : pt_clock_array) { + const bpt& pt_clock = kc.second; + std::string clock_name_type = pt_clock.get("id"); + std::cout << boost::format(" %-23s: %3s MHz\n") % clock_name_type % pt_clock.get("freq_mhz"); + } + } + else { + throw xrt_core::error(boost::str(boost::format("Invalid report value: '%s'\n") % m_action)); + } + } + catch(const xrt_core::error& e) { + std::cerr << boost::format("\nERROR: %s\n") % e.what(); + printHelp(); + throw xrt_core::error(std::errc::operation_canceled); + } +} diff --git a/src/runtime_src/core/tools/xbutil2/OO_Reports.h b/src/runtime_src/core/tools/xbutil2/OO_Reports.h new file mode 100644 index 00000000000..b2a02294a79 --- /dev/null +++ b/src/runtime_src/core/tools/xbutil2/OO_Reports.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + +#ifndef __OO_Reports_h_ +#define __OO_Reports_h_ + +#include "tools/common/OptionOptions.h" + +class OO_Reports : public OptionOptions { + public: + virtual void execute( const SubCmdOptions &_options ) const; + + public: + OO_Reports( const std::string &_longName, bool _isHidden = false); + + private: + std::string m_device; + std::string m_action; + bool m_help; +}; + +#endif diff --git a/src/runtime_src/core/tools/xbutil2/SubCmdAdvanced.cpp b/src/runtime_src/core/tools/xbutil2/SubCmdAdvanced.cpp index 8b6ed13f3bf..9c1d3b4f0dc 100644 --- a/src/runtime_src/core/tools/xbutil2/SubCmdAdvanced.cpp +++ b/src/runtime_src/core/tools/xbutil2/SubCmdAdvanced.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2020-2022 Xilinx, Inc -// Copyright (C) 2022-2023 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights reserved. // ------ I N C L U D E F I L E S ------------------------------------------- // Local - Include Files @@ -8,6 +8,7 @@ #include "OO_AieRegRead.h" #include "OO_MemRead.h" #include "OO_MemWrite.h" +#include "OO_Reports.h" #include "SubCmdAdvanced.h" #include "common/device.h" @@ -51,6 +52,7 @@ SubCmdAdvanced::SubCmdAdvanced(bool _isHidden, bool _isDepricated, bool _isPreli addSubOption(std::make_shared("read-mem")); addSubOption(std::make_shared("write-mem")); + addSubOption(std::make_shared("report")); // Only defined for embedded platform #ifndef ENABLE_NATIVE_SUBCMDS_AND_REPORTS addSubOption(std::make_shared("read-aie-reg")); diff --git a/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp b/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp index 67091946615..05426e54fca 100644 --- a/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp +++ b/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp @@ -43,6 +43,7 @@ #include "tools/common/tests/TestCmdChainThroughput.h" #include "tools/common/tests/TestAIEReconfigOverhead.h" #include "tools/common/tests/TestSpatialSharingOvd.h" +#include "tools/common/tests/TestTemporalSharingOvd.h" namespace XBU = XBUtilities; // 3rd Party Library - Include Files @@ -116,7 +117,8 @@ std::vector> testSuite = { std::make_shared(), std::make_shared(), std::make_shared(), - std::make_shared() + std::make_shared(), + std::make_shared(), }; /* @@ -449,7 +451,7 @@ static const std::pair quick_test = {"quick", "Only th SubCmdValidate::SubCmdValidate(bool _isHidden, bool _isDepricated, bool _isPreliminary, const boost::property_tree::ptree& configurations) : SubCmd("validate", - "Validates the basic shell acceleration functionality") + "Validates the basic device acceleration functionality") , m_device("") , m_tests_to_run({"all"}) , m_format("JSON") @@ -482,13 +484,13 @@ SubCmdValidate::SubCmdValidate(bool _isHidden, bool _isDepricated, bool _isPreli ("device,d", boost::program_options::value(&m_device), "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest") ("format,f", boost::program_options::value(&m_format)->implicit_value(""), (std::string("Report output format. Valid values are:\n") + formatOptionValues).c_str() ) ("output,o", boost::program_options::value(&m_output)->implicit_value(""), "Direct the output to the given file") - ("pmode", boost::program_options::value(&m_pmode)->implicit_value(""), "Specify which power mode to run the benchmarks in. Note: Some tests might be unavailable for some modes") ("help", boost::program_options::bool_switch(&m_help), "Help to use this sub-command") ; m_hiddenOptions.add_options() ("path,p", boost::program_options::value(&m_xclbin_location)->implicit_value(""), "Path to the directory containing validate xclbins") ("param", boost::program_options::value(&m_param)->implicit_value(""), (std::string("Extended parameter for a given test. Format: ::\n") + extendedKeysOptions()).c_str()) + ("pmode", boost::program_options::value(&m_pmode)->implicit_value(""), "Specify which power mode to run the benchmarks in. Note: Some tests might be unavailable for some modes") ; m_commonOptions.add(common_options); @@ -728,10 +730,13 @@ SubCmdValidate::execute(const SubCmdOptions& _options) const else { throw xrt_core::error(boost::str(boost::format("Invalid pmode value: '%s'\n") % m_pmode)); } + XBU::verbose(boost::str(boost::format("Setting power mode to `%s` \n") % m_pmode)); } else { xrt_core::device_update(device.get(), xrt_core::query::performance_mode::power_type::performance); + XBU::verbose("Setting power mode to `performance`\n"); } + } catch (const xrt_core::query::no_such_key&) { // Do nothing, as performance mode setting is not supported diff --git a/src/runtime_src/core/tools/xbutil2/xbutil.cpp b/src/runtime_src/core/tools/xbutil2/xbutil.cpp index c009591d69c..f9d0ba88a1d 100644 --- a/src/runtime_src/core/tools/xbutil2/xbutil.cpp +++ b/src/runtime_src/core/tools/xbutil2/xbutil.cpp @@ -62,11 +62,11 @@ R"( }] },{ "advanced":[{ - "suboption": ["read-aie-reg", "aie-clock"] + "suboption": ["read-aie-reg", "aie-clock", "report"] }] },{ "validate": [{ - "test": ["latency", "throughput", "cmd-chain-latency", "cmd-chain-throughput", "df-bw", "tct-one-col", "tct-all-col", "gemm", "aie-reconfig-overhead", "spatial-sharing-overhead"] + "test": ["latency", "throughput", "cmd-chain-latency", "cmd-chain-throughput", "df-bw", "tct-one-col", "tct-all-col", "gemm", "aie-reconfig-overhead", "spatial-sharing-overhead", "temporal-sharing-overhead"] }] }] }] @@ -106,11 +106,11 @@ int main( int argc, char** argv ) // -- Program Description const std::string description = - "The Xilinx (R) Run Time - System Management Interface (xrt-smi) is a standalone" - " command line utility that is included with the Xilinx Run Time (XRT) installation" - " package. It includes multiple commands to identify and validate the installed" - " card(s).\n\nThis information can be used for both card administration and" - " application debugging."; + "The XRT - System Management Interface (xrt-smi) is a standalone" + " command-line utility that is included with the XRT runtime" + " package. It includes multiple commands to configure, examine, and validate" + " supported device(s).\n\nThe reports produced by xrt-smi may be used for device" + " administration, monitoring, and troubleshooting application behavior."; // -- Ready to execute the code try {