Skip to content

Commit

Permalink
Cherry-picks for RAI1.3 GA (#8561)
Browse files Browse the repository at this point in the history
* Spatial Sharing test update for low variance (#8506)

* Spatial Sharing test update for low variance

Signed-off-by: Akshay Tondak <[email protected]>

* Header correction

Signed-off-by: Akshay Tondak <[email protected]>

* Update TestValidateUtilities.h

* Fix for XRT build fail

Signed-off-by: Akshay Tondak <[email protected]>

* Review comment changes

Signed-off-by: Akshay Tondak <[email protected]>

---------

Signed-off-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>
(cherry picked from commit 40ed432)

* CR-1214433, CR-1214577 and CR-1215195 (#8507)

* CRs

Signed-off-by: AShivangi <[email protected]>

* CR-1215195

Signed-off-by: AShivangi <[email protected]>

* remove --pmode msging

Signed-off-by: AShivangi <[email protected]>

* change messaging for all tests

Signed-off-by: AShivangi <[email protected]>

* fix typo

Signed-off-by: AShivangi <[email protected]>

* fix error handling

Signed-off-by: AShivangi <[email protected]>

* fix build

---------

Signed-off-by: AShivangi <[email protected]>
(cherry picked from commit c2b7bbb)

* VITIS-13557 Display clocks on-demand (#8520)

* move clock reporting to advanced

Signed-off-by: AShivangi <[email protected]>

* rename some files

Signed-off-by: AShivangi <[email protected]>

---------

Signed-off-by: AShivangi <[email protected]>
(cherry picked from commit 344019f)

* Vitis 12999 : Temporal Sharing overhead benchmark test (#8516)

* Spatial Sharing test update for low variance

Signed-off-by: Akshay Tondak <[email protected]>

* Adding missing file

Signed-off-by: Akshay Tondak <[email protected]>

* Temporal sharing v1

Signed-off-by: Akshay Tondak <[email protected]>

* Temporal Sharing Overhead test final for PR

Signed-off-by: Akshay Tondak <[email protected]>

* Update TestTemporalSharingOvd.h

* Threshold Logic Addition

Signed-off-by: Akshay Tondak <[email protected]>

* Threshold changes update

Signed-off-by: Akshay Tondak <[email protected]>

* Update TestTemporalSharingOvd.cpp

* Update to temporal sharing test after XrtSmiUtilities changes

Signed-off-by: Akshay Tondak <[email protected]>

* Merge conflic fixes

Signed-off-by: Akshay Tondak <[email protected]>

* Removing extra header inclusions

Signed-off-by: Akshay Tondak <[email protected]>

* DCO Remediation Commit for Akshay Tondak <[email protected]>

I, Akshay Tondak <[email protected]>, hereby add my Signed-off-by to this commit: 18c6592
I, Akshay Tondak <[email protected]>, hereby add my Signed-off-by to this commit: eebad9c

Signed-off-by: Akshay Tondak <[email protected]>

* Fix for build fail

Signed-off-by: Akshay Tondak <[email protected]>

* DCO Remediation Commit for Akshay Tondak <[email protected]>

I, Akshay Tondak <[email protected]>, hereby add my Signed-off-by to this commit: 18c6592
I, Akshay Tondak <[email protected]>, hereby add my Signed-off-by to this commit: eebad9c

Signed-off-by: Akshay Tondak <[email protected]>

Signed-off-by: Akshay Tondak <[email protected]>

---------

Signed-off-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>

* CR-1216849, CR-1217061 FIX : xrt-smi configure --pmode default --help` does not print global options (#8532)

* CR-1216849 fix

Signed-off-by: Akshay Tondak <[email protected]>

* CR-1217061 fix

Signed-off-by: Akshay Tondak <[email protected]>

---------

Signed-off-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>
(cherry picked from commit 422826c)

* Fixes for upcoming release (#8537)

* fixes

Signed-off-by: AShivangi <[email protected]>

* add a missing pass token

Signed-off-by: AShivangi <[email protected]>

---------

Signed-off-by: AShivangi <[email protected]>
(cherry picked from commit 78681ef)

* Remove max tops (#8543)

* remove max tops and preemption msg handling

Signed-off-by: AShivangi <[email protected]>

* remove tops only

Signed-off-by: AShivangi <[email protected]>

---------

Signed-off-by: AShivangi <[email protected]>
(cherry picked from commit f603d05)

* CR-1217061 revert (#8540)

Signed-off-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>
(cherry picked from commit 56d452c)

* CR-1206954 fix : Change the text displayed by xrt-smi help (#8554)

* CR-1206954 fix

Signed-off-by: Akshay Tondak <[email protected]>

* updating wording

Signed-off-by: Akshay Tondak <[email protected]>

* Updated wording

Signed-off-by: Akshay Tondak <[email protected]>

* Updated description after reviews

Signed-off-by: Akshay Tondak <[email protected]>

* Updating message after reviews

Signed-off-by: Akshay Tondak <[email protected]>

---------

Signed-off-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>
(cherry picked from commit b97f868)

* enabling external buffer logic as latest petalinux has ssw change (#8517)

Signed-off-by: ch vamshi krishna <[email protected]>
Co-authored-by: ch vamshi krishna <[email protected]>
(cherry picked from commit ad4be07)

---------

Signed-off-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>
Co-authored-by: Akshay Tondak <[email protected]>
Co-authored-by: Ch Vamshi Krishna <[email protected]>
  • Loading branch information
4 people authored Oct 23, 2024
1 parent 287bc08 commit 2f72145
Show file tree
Hide file tree
Showing 30 changed files with 663 additions and 519 deletions.
2 changes: 1 addition & 1 deletion build/petalinux.build
Original file line number Diff line number Diff line change
@@ -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
93 changes: 29 additions & 64 deletions src/runtime_src/core/common/info_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<xq::preemption>(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
Expand Down Expand Up @@ -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<xq::clock_freq_topology_raw>(device);
if (raw.empty())
return;

ptree_type pt_clocks;
auto clock_topology = reinterpret_cast<const clock_freq_topology*>(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_TYPE>(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<xq::xrt_resource_raw>(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)
{
Expand Down Expand Up @@ -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<xrt_core::query::device_class>(device, xrt_core::query::device_class::type::alveo);
Expand All @@ -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;
}
Expand All @@ -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<xq::clock_freq_topology_raw>(device);
if (raw.empty())
return pt;

ptree_type pt_clock_array;
auto clock_topology = reinterpret_cast<const clock_freq_topology*>(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_TYPE>(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)
{
Expand Down
4 changes: 4 additions & 0 deletions src/runtime_src/core/common/info_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ SubCmdConfigureInternal::execute(const SubCmdOptions& _options) const
}

if (optionOption) {
optionOption->setGlobalOptions(getGlobalOptions());
optionOption->execute(_options);
return;
}
Expand Down
109 changes: 0 additions & 109 deletions src/runtime_src/core/tools/common/TestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int*>();
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<xrt_core::device>& dev, boost::property_tree::ptree& ptTest)
{
Expand Down Expand Up @@ -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<xrt_core::device>& dev,
boost::property_tree::ptree& ptTest)
{
//find the benchmark.json
const auto pcie_id = xrt_core::device_query<xq::pcie_id>(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<xq::performance_mode>(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<std::string>("test_name"), ptTest.get<std::string>("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<std::string>("pmode"))) {
m_threshold = pt_benchmark.get<double>("threshold");
return;
}
}
}
throw std::runtime_error(boost::str(boost::format("Test is not supported for %s mode") % curr_pmode));
}
6 changes: 0 additions & 6 deletions src/runtime_src/core/tools/common/TestRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class TestRunner : public JSONConfigurable {
std::vector<std::string> 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<xrt_core::device>& 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";
Expand All @@ -69,7 +64,6 @@ class TestRunner : public JSONConfigurable {
std::string m_name;
std::string m_description;
bool m_explicit;
double m_threshold;

};

Expand Down
7 changes: 6 additions & 1 deletion src/runtime_src/core/tools/common/XBMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>("power_mode");
_output << boost::format(" %-23s: %s \n") % "Preemption" % pt_status.get<std::string>("force_preemption");

const boost::property_tree::ptree& clocks = pt_platform.get_child("clocks", empty_ptree);
if (!clocks.empty()) {
Expand All @@ -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<std::string>("id");
_output << boost::format(" %-23s: %s Terabyte ops/second\n") % tops_name_type % pt_tops.get<std::string>("value");
}
}

auto watts = pt_platform.get<std::string>("electrical.power_consumption_watts", "N/A");
if (watts != "N/A")
_output << std::endl << boost::format("%-23s : %s Watts\n") % "Power" % watts;
Expand Down
Loading

0 comments on commit 2f72145

Please sign in to comment.