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
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ std::string getDeviceNameID(const std::string& str) {
return parser.get_device_id();
}

std::string getTestPlatform() {
return ov::intel_npu::Platform::standardize(NpuTestEnvConfig::getInstance().IE_NPU_TESTS_PLATFORM);
}

} // namespace ov::test::utils

namespace InferRequestParamsAnyMapTestName {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ std::string getTestsPlatformFromEnvironmentOr(const std::string& instead);
std::string getDeviceNameTestCase(const std::string& str);
std::string getDeviceName();
std::string getDeviceNameID(const std::string& str);
std::string getTestPlatform();

} // namespace ov::test::utils

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
#include "intel_npu/npu_private_properties.hpp"
#include "openvino/util/xml_parse_utils.hpp"

using namespace ov::test::utils;
using namespace ov::util::pugixml;

class BackendName {
public:
BackendName() {
const auto corePtr = ov::test::utils::PluginCache::get().core();
const auto corePtr = PluginCache::get().core();
if (corePtr != nullptr) {
_name = getBackendName(*corePtr);
} else {
Expand All @@ -32,14 +35,6 @@ class BackendName {
return _name;
}

bool isEmpty() const noexcept {
return _name.empty();
}

bool isZero() const {
return _name == "LEVEL0";
}

private:
std::string _name;
intel_npu::Logger _log = intel_npu::Logger("BackendName", ov::log::Level::INFO);
Expand All @@ -48,26 +43,37 @@ class BackendName {
class AvailableDevices {
public:
AvailableDevices() {
const auto corePtr = ov::test::utils::PluginCache::get().core();
const auto corePtr = PluginCache::get().core();
if (corePtr != nullptr) {
_availableDevices = ::getAvailableDevices(*corePtr);
_availableDevices.push_back(getTestPlatform());

if (_availableDevices.empty()) {
auto deviceName = getDeviceName();
if (!deviceName.empty()) {
_availableDevices.push_back(getDeviceNameID(deviceName));
}
}

if (_availableDevices.empty()) {
_availableDevices = ::getAvailableDevices(*corePtr);
}
} else {
_log.error("Failed to get OpenVINO Core from cache!");
}

// Private device names may be registered via environment variables
const std::string environmentDevice =
ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::intel_npu::Platform::AUTO_DETECT.data());
getTestsPlatformFromEnvironmentOr(ov::intel_npu::Platform::AUTO_DETECT.data());
const std::string standardizedEnvironmentDevice = ov::intel_npu::Platform::standardize(environmentDevice);

if (std::all_of(_availableDevices.begin(), _availableDevices.end(), [&](const std::string& deviceName) {
return deviceName.find(standardizedEnvironmentDevice) == std::string::npos;
})) {
_availableDevices.push_back(standardizedEnvironmentDevice);
_availableDevices.push_back(getDeviceNameID(standardizedEnvironmentDevice));
}

auto driverVersionPropetry =
corePtr->get_property(ov::test::utils::DEVICE_NPU, ov::intel_npu::driver_version.name());
corePtr->get_property(DEVICE_NPU, ov::intel_npu::driver_version.name());
_driverVersion = driverVersionPropetry.as<std::string>();

}
Expand All @@ -76,20 +82,10 @@ class AvailableDevices {
return _availableDevices;
}

auto count() const {
return _availableDevices.size();
}

const std::string& getDriverVersion() const {
return _driverVersion;
}

bool has3720() const {
return std::any_of(_availableDevices.begin(), _availableDevices.end(), [](const std::string& deviceName) {
return deviceName.find("3720") != std::string::npos;
});
}

private:
std::vector<std::string> _availableDevices;
std::string _driverVersion;
Expand All @@ -110,14 +106,6 @@ class CurrentOS {
return _name;
}

bool isLinux() const {
return _name == "linux";
}

bool isWindows() const {
return _name == "windows";
}

private:
std::string _name;
};
Expand Down Expand Up @@ -255,10 +243,10 @@ std::vector<std::string> disabledTestPatterns() {
const CurrentOS currentOS;

try {
const auto& filePath = ov::test::utils::NpuTestEnvConfig::getInstance().OV_NPU_TESTS_SKIP_CONFIG_FILE;
const auto& filePath = NpuTestEnvConfig::getInstance().OV_NPU_TESTS_SKIP_CONFIG_FILE;
_log.info("Using %s as skip config", filePath.c_str());

auto xmlResult = ov::util::pugixml::parse_xml(filePath.c_str());
auto xmlResult = parse_xml(filePath.c_str());
// Error returned from pugixml, fallback to legacy skips
if (!xmlResult.error_msg.empty()) {
_log.error(xmlResult.error_msg.c_str());
Expand Down
Loading