OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[NPU][IE-MDK] Add fallbacks for platform indentification (#33156)
Sorin Butnariu4b42d60c9f5f
diff --git a/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.cpp b/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.cppindex 7377736463c..6cc99030920 100644--- a/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.cpp+++ b/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.cpp@@ -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::utilsnamespace InferRequestParamsAnyMapTestName {diff --git a/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.hpp b/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.hppindex 44aa11bccc2..c7801860b50 100644--- a/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.hpp+++ b/src/plugins/intel_npu/tests/functional/common/npu_test_env_cfg.hpp@@ -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::utilsdiff --git a/src/plugins/intel_npu/tests/functional/shared_tests_instances/skip_tests_config.cpp b/src/plugins/intel_npu/tests/functional/shared_tests_instances/skip_tests_config.cppindex 1ec03e527f6..541e342e253 100644--- a/src/plugins/intel_npu/tests/functional/shared_tests_instances/skip_tests_config.cpp+++ b/src/plugins/intel_npu/tests/functional/shared_tests_instances/skip_tests_config.cpp@@ -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 {@@ -32,14 +35,6 @@ public: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);@@ -48,26 +43,37 @@ private: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 variablesconst 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>();}@@ -76,20 +82,10 @@ public: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;@@ -110,14 +106,6 @@ public:return _name;}- bool isLinux() const {- return _name == "linux";- }-- bool isWindows() const {- return _name == "windows";- }-private:std::string _name;};@@ -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 skipsif (!xmlResult.error_msg.empty()) {_log.error(xmlResult.error_msg.c_str());