Skip to content
Open
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
34 changes: 29 additions & 5 deletions src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2024-2026 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
// Local - Include Files
#include "TestNPUThroughput.h"
#include "TestValidateUtilities.h"
#include "tools/common/XBUtilities.h"
#include "core/common/runner/runner.h"
#include "core/common/query_requests.h"
#include "core/common/smi/smi.h"
#include "xrt/xrt_device.h"
#include "core/common/json/nlohmann/json.hpp"
#include "core/common/archive.h"
Expand Down Expand Up @@ -35,6 +37,19 @@ get_throughput_from_report(const json& report) const
return report.at("cpu").at("throughput").get<double>();
}

double
TestNPUThroughput::
get_ops_throughput_from_report(const json& report, bool use_runlist) const
{
const auto runlist_throughput = get_throughput_from_report(report);
if (use_runlist) {
const auto recipe_runs = report.at("resources").at("runs").get<double>();
return runlist_throughput * recipe_runs;
} else {
return runlist_throughput;
}
}

boost::property_tree::ptree
TestNPUThroughput::run(const std::shared_ptr<xrt_core::device>& dev, const xrt_core::archive* archive)
{
Expand All @@ -47,8 +62,17 @@ TestNPUThroughput::run(const std::shared_ptr<xrt_core::device>& dev, const xrt_c
}

try {
std::string recipe_data = archive->data("recipe_throughput.json");
std::string profile_data = archive->data("profile_throughput.json");
const auto pcie_id = xrt_core::device_query<xrt_core::query::pcie_id>(dev);
xrt_core::smi::smi_hardware_config smi_hrdw;
const auto hardware_type = smi_hrdw.get_hardware_type(pcie_id);
const bool use_runlist =
(smi_hrdw.get_family(hardware_type) == xrt_core::smi::smi_hardware_config::hardware_family::npu3);

const char* recipe_name = use_runlist ? "recipe_cmd_chain_throughput.json" : "recipe_throughput.json";
const char* profile_name = use_runlist ? "profile_cmd_chain_throughput.json" : "profile_throughput.json";

std::string recipe_data = archive->data(recipe_name);
std::string profile_data = archive->data(profile_name);

auto artifacts_repo = XBUtilities::extract_artifacts_from_archive(archive, {
"validate.xclbin",
Expand All @@ -61,8 +85,8 @@ TestNPUThroughput::run(const std::shared_ptr<xrt_core::device>& dev, const xrt_c
runner.wait();

const auto report = json::parse(runner.get_report());
const double throughput = get_throughput_from_report(report);
XBValidateUtils::logger(ptree, "Details", boost::str(boost::format("Average throughput: %.1f op/s") % throughput));
const double throughput = get_ops_throughput_from_report(report, use_runlist);
XBValidateUtils::logger(ptree, "Details", boost::str(boost::format("Average throughput: %.1f ops/s") % throughput));
ptree.put("status", XBValidateUtils::test_token_passed);
}
catch(const std::exception& e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ class TestNPUThroughput : public TestRunner {
TestNPUThroughput();

private:
double
double
get_throughput_from_report(const nlohmann::json& report) const;

double
get_ops_throughput_from_report(const nlohmann::json& report, bool use_runlist) const;
};

#endif
11 changes: 11 additions & 0 deletions src/runtime_src/core/tools/common/tests/TestRunlistLatency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "TestRunlistLatency.h"
#include "TestValidateUtilities.h"
#include "tools/common/XBUtilities.h"
#include "core/common/query_requests.h"
#include "core/common/smi/smi.h"
#include "xrt/xrt_device.h"
#include "core/common/runner/runner.h"
#include "core/common/json/nlohmann/json.hpp"
Expand All @@ -24,6 +26,15 @@ TestRunlistLatency::run(const std::shared_ptr<xrt_core::device>& dev, const xrt_
{
boost::property_tree::ptree ptree = get_test_header();

const auto pcie_id = xrt_core::device_query<xrt_core::query::pcie_id>(dev);
xrt_core::smi::smi_hardware_config smi_hrdw;
const auto hardware_type = smi_hrdw.get_hardware_type(pcie_id);
if (smi_hrdw.get_family(hardware_type) == xrt_core::smi::smi_hardware_config::hardware_family::npu3) {
XBValidateUtils::logger(ptree, "Details", "N/A");
ptree.put("status", XBValidateUtils::test_token_skipped);
return ptree;
}

if (archive == nullptr) {
ptree.put("status", XBValidateUtils::test_token_failed);
XBValidateUtils::logger(ptree, "Error", "No archive found, skipping test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "TestRunlistThroughput.h"
#include "TestValidateUtilities.h"
#include "tools/common/XBUtilities.h"
#include "core/common/query_requests.h"
#include "core/common/smi/smi.h"
#include "xrt/xrt_device.h"
#include "core/common/runner/runner.h"
#include "core/common/json/nlohmann/json.hpp"
Expand Down Expand Up @@ -49,6 +51,15 @@ TestRunlistThroughput::run(const std::shared_ptr<xrt_core::device>& dev, const x
{
boost::property_tree::ptree ptree = get_test_header();

const auto pcie_id = xrt_core::device_query<xrt_core::query::pcie_id>(dev);
xrt_core::smi::smi_hardware_config smi_hrdw;
const auto hardware_type = smi_hrdw.get_hardware_type(pcie_id);
if (smi_hrdw.get_family(hardware_type) == xrt_core::smi::smi_hardware_config::hardware_family::npu3) {
XBValidateUtils::logger(ptree, "Details", "N/A");
ptree.put("status", XBValidateUtils::test_token_skipped);
return ptree;
}

if (archive == nullptr) {
ptree.put("status", XBValidateUtils::test_token_failed);
XBValidateUtils::logger(ptree, "Error", "No archive found, skipping test");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2023-2026 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
// Local - Include Files
Expand Down Expand Up @@ -96,6 +96,12 @@ TestTCTAllColumn::run(const std::shared_ptr<xrt_core::device>& dev, const xrt_co
const auto pcie_id = xrt_core::device_query<query>(dev);
xrt_core::smi::smi_hardware_config smi_hrdw;
const auto hardware_type = smi_hrdw.get_hardware_type(pcie_id);
if (smi_hrdw.get_family(hardware_type) == xrt_core::smi::smi_hardware_config::hardware_family::npu3) {
XBValidateUtils::logger(ptree, "Details", "N/A");
ptree.put("status", XBValidateUtils::test_token_skipped);
return ptree;
}

const bool is_strix = XBU::is_strix_hardware(hardware_type);

const std::vector<std::string> artifacts = is_strix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2023-2025 Advanced Micro Devices, Inc. All rights reserved.
// Copyright (C) 2023-2026 Advanced Micro Devices, Inc. All rights reserved.

// ------ I N C L U D E F I L E S -------------------------------------------
// Local - Include Files
Expand Down Expand Up @@ -96,6 +96,12 @@ TestTCTOneColumn::run(const std::shared_ptr<xrt_core::device>& dev, const xrt_co
const auto pcie_id = xrt_core::device_query<query>(dev);
xrt_core::smi::smi_hardware_config smi_hrdw;
const auto hardware_type = smi_hrdw.get_hardware_type(pcie_id);
if (smi_hrdw.get_family(hardware_type) == xrt_core::smi::smi_hardware_config::hardware_family::npu3) {
XBValidateUtils::logger(ptree, "Details", "N/A");
ptree.put("status", XBValidateUtils::test_token_skipped);
return ptree;
}

const bool is_strix = XBU::is_strix_hardware(hardware_type);

const std::vector<std::string> artifacts = is_strix
Expand Down
Loading