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] Refactoring getGraphDescriptor by setting the flags inside it (#32449)
Bogdan Pereanu3d09e79aa103
diff --git a/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp b/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hppindex e88ebe5634a..94a05865001 100644--- a/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp+++ b/src/plugins/intel_npu/src/compiler_adapter/include/ze_graph_ext_wrappers.hpp@@ -35,7 +35,7 @@ public:GraphDescriptor getGraphDescriptor(SerializedIR serializedIR,const std::string& buildFlags,- const uint32_t& flags) const;+ const bool bypassUmdCache = false) const;GraphDescriptor getGraphDescriptor(void* data, size_t size) const;diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cppindex 9cd1320b1a5..4fba7d414da 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/driver_compiler_adapter.cpp@@ -101,15 +101,10 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compile(const std::shared_ptr<con_logger.debug("compileIR Build flags : %s", buildFlags.c_str());- // If UMD Caching is requested to be bypassed or if OV cache is enabled, disable driver caching- uint32_t flags = ZE_GRAPH_FLAG_NONE;- const auto set_cache_dir = config.get<CACHE_DIR>();- if (!set_cache_dir.empty() || config.get<BYPASS_UMD_CACHING>()) {- flags = flags | ZE_GRAPH_FLAG_DISABLE_CACHING;- }-_logger.debug("compile start");- auto graphDesc = _zeGraphExt->getGraphDescriptor(std::move(serializedIR), buildFlags, flags);+ // If UMD Caching is requested to be bypassed or if OV cache is enabled, disable driver caching+ const bool bypassCache = !config.get<CACHE_DIR>().empty() || config.get<BYPASS_UMD_CACHING>();+ auto graphDesc = _zeGraphExt->getGraphDescriptor(std::move(serializedIR), buildFlags, bypassCache);_logger.debug("compile end");OV_ITT_TASK_NEXT(COMPILE_BLOB, "getNetworkMeta");@@ -161,13 +156,6 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compileWS(const std::shared_ptr<o}FilteredConfig updatedConfig = *plgConfig;- // If UMD Caching is requested to be bypassed or if OV cache is enabled, disable driver caching- uint32_t flags = ZE_GRAPH_FLAG_NONE;- const auto set_cache_dir = config.get<CACHE_DIR>();- if (!set_cache_dir.empty() || config.get<BYPASS_UMD_CACHING>()) {- flags = flags | ZE_GRAPH_FLAG_DISABLE_CACHING;- }-// WS v3 is based on a stateless compiler. We'll use a separate config entry for informing the compiler the index of// the current call iteration.std::vector<NetworkMetadata> initNetworkMetadata;@@ -191,7 +179,9 @@ std::shared_ptr<IGraph> DriverCompilerAdapter::compileWS(const std::shared_ptr<obuildFlags += irSerializer.serializeConfig(updatedConfig, compilerVersion);_logger.debug("compile start");- auto graphDesc = _zeGraphExt->getGraphDescriptor(serializedIR, buildFlags, flags);+ // If UMD Caching is requested to be bypassed or if OV cache is enabled, disable driver caching+ const bool bypassCache = !config.get<CACHE_DIR>().empty() || config.get<BYPASS_UMD_CACHING>();+ auto graphDesc = _zeGraphExt->getGraphDescriptor(serializedIR, buildFlags, bypassCache);_logger.debug("compile end");OV_ITT_TASK_NEXT(COMPILE_BLOB, "getNetworkMeta");diff --git a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cppindex f27c4187b81..b7ec5af25f2 100644--- a/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp+++ b/src/plugins/intel_npu/src/compiler_adapter/src/ze_graph_ext_wrappers.cpp@@ -131,10 +131,6 @@ ZeGraphExtWrappers::ZeGraphExtWrappers(const std::shared_ptr<ZeroInitStructsHoldZE_MAJOR_VERSION(_graphExtVersion),ZE_MINOR_VERSION(_graphExtVersion));_logger.debug("capabilities:");- _logger.debug("-SupportQuery: %d", true);- _logger.debug("-SupportAPIGraphQueryNetworkV1: %d", true);- _logger.debug("-SupportAPIGraphQueryNetworkV2 :%d", true);- _logger.debug("-SupportpfnCreate2 :%d", true);_logger.debug("-SupportArgumentMetadata :%d", !NotSupportArgumentMetadata(_graphExtVersion));_logger.debug("-UseCopyForNativeBinary :%d", UseCopyForNativeBinary(_graphExtVersion));}@@ -274,10 +270,8 @@ static std::unordered_set<std::string> parseQueryResult(std::vector<char>& data)std::unordered_set<std::string> ZeGraphExtWrappers::queryGraph(SerializedIR serializedIR,const std::string& buildFlags) const {- // For ext version >= 1.5ze_graph_query_network_handle_t hGraphQueryNetwork = nullptr;- // For ext version >= 1.5ze_graph_desc_2_t desc = {ZE_STRUCTURE_TYPE_GRAPH_DESC_PROPERTIES,nullptr,ZE_GRAPH_FORMAT_NGRAPH_LITE,@@ -286,14 +280,14 @@ std::unordered_set<std::string> ZeGraphExtWrappers::queryGraph(SerializedIR seribuildFlags.c_str(),ZE_GRAPH_FLAG_NONE};- // Create querynetwork handle- _logger.debug("For ext larger than 1.4 - perform pfnQueryNetworkCreate2");- ze_result_t result = _zeroInitStruct->getGraphDdiTable().pfnQueryNetworkCreate2(_zeroInitStruct->getContext(),- _zeroInitStruct->getDevice(),- &desc,- &hGraphQueryNetwork);+ _logger.debug("queryGraph - perform pfnQueryNetworkCreate2");+ auto result = _zeroInitStruct->getGraphDdiTable().pfnQueryNetworkCreate2(_zeroInitStruct->getContext(),+ _zeroInitStruct->getDevice(),+ &desc,+ &hGraphQueryNetwork);THROW_ON_FAIL_FOR_LEVELZERO_EXT("pfnQueryNetworkCreate2", result, _zeroInitStruct->getGraphDdiTable());+ // Get the size of query result_logger.debug("queryGraph - perform pfnQueryNetworkGetSupportedLayers to get size");size_t size = 0;result = _zeroInitStruct->getGraphDdiTable().pfnQueryNetworkGetSupportedLayers(hGraphQueryNetwork, &size, nullptr);@@ -341,8 +335,15 @@ bool ZeGraphExtWrappers::canCpuVaBeImported(void* data, size_t size) const {GraphDescriptor ZeGraphExtWrappers::getGraphDescriptor(SerializedIR serializedIR,const std::string& buildFlags,- const uint32_t& flags) const {- // For ext version >= 1.5, calling pfnCreate2 api in _zeroInitStruct->getGraphDdiTable()+ const bool bypassUmdCache) const {+ ze_graph_handle_t graphHandle = nullptr;++ uint32_t flags = ZE_GRAPH_FLAG_NONE;+ if (bypassUmdCache) {+ _logger.debug("getGraphDescriptor - set ZE_GRAPH_FLAG_DISABLE_CACHING");+ flags |= ZE_GRAPH_FLAG_DISABLE_CACHING;+ }+ze_graph_desc_2_t desc = {ZE_STRUCTURE_TYPE_GRAPH_DESC_PROPERTIES,nullptr,ZE_GRAPH_FORMAT_NGRAPH_LITE,@@ -352,8 +353,6 @@ GraphDescriptor ZeGraphExtWrappers::getGraphDescriptor(SerializedIR serializedIRflags};_logger.debug("getGraphDescriptor - perform pfnCreate2");- // Create querynetwork handle- ze_graph_handle_t graphHandle = nullptr;auto result = _zeroInitStruct->getGraphDdiTable().pfnCreate2(_zeroInitStruct->getContext(),_zeroInitStruct->getDevice(),&desc,@@ -370,12 +369,11 @@ GraphDescriptor ZeGraphExtWrappers::getGraphDescriptor(void* blobData, size_t blOPENVINO_THROW("Empty blob");}- uint32_t flags = 0;+ uint32_t flags = ZE_GRAPH_FLAG_NONE;bool setPersistentFlag = canCpuVaBeImported(blobData, blobSize);-if (setPersistentFlag) {_logger.debug("getGraphDescriptor - set ZE_GRAPH_FLAG_INPUT_GRAPH_PERSISTENT");- flags = ZE_GRAPH_FLAG_INPUT_GRAPH_PERSISTENT;+ flags |= ZE_GRAPH_FLAG_INPUT_GRAPH_PERSISTENT;}ze_graph_desc_2_t desc = {ZE_STRUCTURE_TYPE_GRAPH_DESC_PROPERTIES,@@ -387,7 +385,6 @@ GraphDescriptor ZeGraphExtWrappers::getGraphDescriptor(void* blobData, size_t blflags};_logger.debug("getGraphDescriptor - perform pfnCreate2");-auto result = _zeroInitStruct->getGraphDdiTable().pfnCreate2(_zeroInitStruct->getContext(),_zeroInitStruct->getDevice(),&desc,diff --git a/src/plugins/intel_npu/tests/functional/internal/backend/zero_tensor_tests.hpp b/src/plugins/intel_npu/tests/functional/internal/backend/zero_tensor_tests.hppindex c554ae1e14a..1519ddd7724 100644--- a/src/plugins/intel_npu/tests/functional/internal/backend/zero_tensor_tests.hpp+++ b/src/plugins/intel_npu/tests/functional/internal/backend/zero_tensor_tests.hpp@@ -61,7 +61,6 @@ public:ov::element::Type type;std::tie(targetDevice, configuration, type) = obj.param;std::replace(targetDevice.begin(), targetDevice.end(), ':', '_');- targetDevice = ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU);std::ostringstream result;result << "targetDevice=" << targetDevice << "_";diff --git a/src/plugins/intel_npu/tests/functional/internal/backend/zero_variable_state_tests.hpp b/src/plugins/intel_npu/tests/functional/internal/backend/zero_variable_state_tests.hppindex ca2d1fa3fb7..13379a41bb7 100644--- a/src/plugins/intel_npu/tests/functional/internal/backend/zero_variable_state_tests.hpp+++ b/src/plugins/intel_npu/tests/functional/internal/backend/zero_variable_state_tests.hpp@@ -59,7 +59,6 @@ public:ov::AnyMap configuration;std::tie(targetDevice, configuration) = obj.param;std::replace(targetDevice.begin(), targetDevice.end(), ':', '_');- targetDevice = ov::test::utils::getTestsPlatformFromEnvironmentOr(ov::test::utils::DEVICE_NPU);std::ostringstream result;result << "targetDevice=" << targetDevice << "_";diff --git a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.cpp b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.cppindex 683ba498eb1..e48a5ca1243 100644--- a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.cpp+++ b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.cpp@@ -4,23 +4,27 @@#include "zero_graph.hpp"-#include <common_test_utils/test_assertions.hpp>-namespace {-std::vector<int> graphDescflags = {ZE_GRAPH_FLAG_NONE, ZE_GRAPH_FLAG_DISABLE_CACHING, ZE_GRAPH_FLAG_ENABLE_PROFILING};+const std::vector<ov::AnyMap> configsGraphCompilationTests = {{},+ {ov::cache_dir("test")},+ {ov::intel_npu::bypass_umd_caching(true)}};// tested versions interval is [1.5, CURRENT + 1)-auto extVersions = ::testing::Range(ZE_MAKE_VERSION(1, 5), ZE_GRAPH_EXT_VERSION_CURRENT + 1);+auto graphExtVersions = ::testing::Range(ZE_MAKE_VERSION(1, 5), ZE_GRAPH_EXT_VERSION_CURRENT + 1);INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,ZeroGraphCompilationTests,- ::testing::Combine(::testing::ValuesIn(graphDescflags), extVersions),+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),+ ::testing::ValuesIn(configsGraphCompilationTests),+ graphExtVersions),ZeroGraphTest::getTestCaseName);-std::vector<int> noneGraphDescflags = {ZE_GRAPH_FLAG_NONE};+const std::vector<ov::AnyMap> emptyConfigsTests = {{}};INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,ZeroGraphTest,- ::testing::Combine(::testing::ValuesIn(noneGraphDescflags), extVersions),+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),+ ::testing::ValuesIn(emptyConfigsTests),+ graphExtVersions),ZeroGraphTest::getTestCaseName);} // namespacediff --git a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hppindex fccc36659fd..1b17bfffb47 100644--- a/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp+++ b/src/plugins/intel_npu/tests/functional/internal/compiler_adapter/zero_graph.hpp@@ -16,11 +16,15 @@#include "intel_npu/utils/zero/zero_mem.hpp"#include "intel_npu/utils/zero/zero_utils.hpp"#include "ir_serializer.hpp"+#include "openvino/runtime/intel_npu/properties.hpp"#include "ze_graph_ext_wrappers.hpp"#include "zero_init_mock.hpp"using namespace intel_npu;+using CompilationParamsAndExtensionVersion = std::tuple<std::string, // Device name+ ov::AnyMap, // Config+ int>; // Extension Versionnamespace {size_t calculate_size_with_alignment_padding(size_t size, size_t alignment) {return size + alignment - (size % alignment);@@ -37,45 +41,28 @@ size_t get_file_size(std::ifstream& file) {} // namespacenamespace ov::test::behavior {-class ZeroGraphTest : public ::testing::TestWithParam<std::tuple<int, int>> {+class ZeroGraphTest : public ::testing::TestWithParam<CompilationParamsAndExtensionVersion> {public:- std::shared_ptr<ZeroInitStructsHolder> zeroInitStruct;-- std::shared_ptr<ZeGraphExtWrappers> zeGraphExt;-- SerializedIR serializedIR;-- GraphDescriptor graphDescriptor;-- std::shared_ptr<ov::Model> model;-- std::shared_ptr<driver_compiler_utils::IRSerializer> irSerializer;-- std::string blobPath;-- int extVersion;-- int graphDescFlag;-- static std::string getTestCaseName(const testing::TestParamInfo<std::tuple<int, int>>& obj) {- int flag, version;- std::tie(flag, version) = obj.param;- std::string targetDevice = ov::test::utils::DEVICE_NPU;+ static std::string getTestCaseName(const testing::TestParamInfo<CompilationParamsAndExtensionVersion>& obj) {+ std::string targetDevice;+ ov::AnyMap configuration;+ int graphExtVersion;+ std::tie(targetDevice, configuration, graphExtVersion) = obj.param;+ std::replace(targetDevice.begin(), targetDevice.end(), ':', '_');std::ostringstream result;result << "targetDevice=" << targetDevice << "_";result << "targetPlatform=" << ov::test::utils::getTestsPlatformFromEnvironmentOr(targetDevice) << "_";- result << "graphDescriptorFlag=" + std::to_string(flag) << "_";- result << "extVersion=" + std::to_string(ZE_MAJOR_VERSION(version)) + "." +- std::to_string(ZE_MINOR_VERSION(version));- return result.str();- }+ if (!configuration.empty()) {+ for (auto& configItem : configuration) {+ result << "configItem=" << configItem.first << "_";+ configItem.second.print(result);+ }+ }+ result << "graphExtVersion=" + std::to_string(ZE_MAJOR_VERSION(graphExtVersion)) + "." ++ std::to_string(ZE_MINOR_VERSION(graphExtVersion));- void serializeIR() {- auto compilerProperties = zeroInitStruct->getCompilerProperties();- const ze_graph_compiler_version_info_t& compilerVersion = compilerProperties.compilerVersion;- const auto maxOpsetVersion = compilerProperties.maxOVOpsetVersionSupported;- serializedIR = irSerializer->serializeIR(model, compilerVersion, maxOpsetVersion);+ return result.str();}protected:@@ -84,17 +71,15 @@ protected:SKIP_IF_CURRENT_TEST_IS_DISABLED();- std::tie(graphDescFlag, extVersion) = GetParam();+ std::tie(targetDevice, configuration, graphExtVersion) = this->GetParam();const std::string BLOB_NAME = "blob_compatibility_dummy_model_MTL_ov_2025_1_0_driver_1003967.blob";blobPath = ov::test::utils::NpuTestEnvConfig::getInstance().OV_NPU_TESTS_BLOBS_PATH + BLOB_NAME;model = ov::test::utils::make_multi_single_conv();- std::shared_ptr<ZeroInitStructsMock> zeroInitMock = std::make_shared<ZeroInitStructsMock>(extVersion);-+ std::shared_ptr<ZeroInitStructsMock> zeroInitMock = std::make_shared<ZeroInitStructsMock>(graphExtVersion);zeroInitStruct = std::reinterpret_pointer_cast<ZeroInitStructsHolder>(zeroInitMock);-zeGraphExt = std::make_shared<ZeGraphExtWrappers>(zeroInitStruct);auto compilerProperties = zeroInitStruct->getCompilerProperties();@@ -105,13 +90,54 @@ protected:void TearDown() override {zeGraphExt->destroyGraph(graphDescriptor);}++ void serializeIR() {+ auto compilerProperties = zeroInitStruct->getCompilerProperties();+ const ze_graph_compiler_version_info_t& compilerVersion = compilerProperties.compilerVersion;+ const auto maxOpsetVersion = compilerProperties.maxOVOpsetVersionSupported;+ serializedIR = irSerializer->serializeIR(model, compilerVersion, maxOpsetVersion);+ }++ bool bypassUmdCache() {+ if (!configuration.empty()) {+ for (auto& configItem : configuration) {+ if (configItem.first == ov::cache_dir.name()) {+ const auto set_cache_dir = configItem.second;+ if (!set_cache_dir.empty()) {+ return true;+ }+ }+ if (configItem.first == ov::intel_npu::bypass_umd_caching.name()) {+ if (configItem.second.as<bool>()) {+ return true;+ }+ }+ }+ }++ return false;+ }++ std::shared_ptr<ZeroInitStructsHolder> zeroInitStruct;+ std::shared_ptr<ZeGraphExtWrappers> zeGraphExt;+ ov::AnyMap configuration;++ SerializedIR serializedIR;+ GraphDescriptor graphDescriptor;++ std::shared_ptr<ov::Model> model;+ std::shared_ptr<driver_compiler_utils::IRSerializer> irSerializer;++ std::string targetDevice;+ std::string blobPath;+ int graphExtVersion;};using ZeroGraphCompilationTests = ZeroGraphTest;TEST_P(ZeroGraphCompilationTests, GetGraphInitIR) {serializeIR();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));uint32_t initCommandQueueOrdinal = 0;OV_ASSERT_NO_THROW(initCommandQueueOrdinal =@@ -122,7 +148,7 @@ TEST_P(ZeroGraphCompilationTests, GetGraphInitIR) {TEST_P(ZeroGraphCompilationTests, GetInitSetArgsDestroyGraphAlignedMemoryIR) {serializeIR();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));uint32_t initCommandQueueOrdinal = 0;OV_ASSERT_NO_THROW(initCommandQueueOrdinal =@@ -139,26 +165,32 @@ TEST_P(ZeroGraphCompilationTests, GetInitSetArgsDestroyGraphAlignedMemoryIR) {}TEST_P(ZeroGraphTest, GetGraphInitBlob) {- std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);- ASSERT_TRUE(blobStream.is_open());- size_t size = get_file_size(blobStream);-- std::vector<uint8_t> blob(size);- blobStream.read(reinterpret_cast<char*>(blob.data()), size);- blobStream.close();-- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob.data(), blob.size()));-- uint32_t initCommandQueueOrdinal = 0;- OV_ASSERT_NO_THROW(initCommandQueueOrdinal =- zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),- ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));- OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));+ std::string platform = ov::test::utils::getTestsPlatformFromEnvironmentOr(targetDevice);+ size_t pos = platform.find("3720");+ if (pos != std::string::npos) {+ std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);+ ASSERT_TRUE(blobStream.is_open());+ size_t size = get_file_size(blobStream);++ std::vector<uint8_t> blob(size);+ blobStream.read(reinterpret_cast<char*>(blob.data()), size);+ blobStream.close();++ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob.data(), blob.size()));++ uint32_t initCommandQueueOrdinal = 0;+ OV_ASSERT_NO_THROW(initCommandQueueOrdinal =+ zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),+ ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));+ OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));+ } else {+ GTEST_SKIP() << "Skip due to incompatible blob format on this platform.";+ }}TEST_P(ZeroGraphTest, GetNetworkMeta) {serializeIR();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));OV_ASSERT_NO_THROW(NetworkMetadata meta = zeGraphExt->getNetworkMeta(graphDescriptor));}@@ -169,30 +201,36 @@ TEST_P(ZeroGraphTest, QueryGraph) {}TEST_P(ZeroGraphTest, GetGraphBinary) {- std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);- ASSERT_TRUE(blobStream.is_open());- size_t size = get_file_size(blobStream);+ std::string platform = ov::test::utils::getTestsPlatformFromEnvironmentOr(targetDevice);+ size_t pos = platform.find("3720");+ if (pos != std::string::npos) {+ std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);+ ASSERT_TRUE(blobStream.is_open());+ size_t size = get_file_size(blobStream);- std::vector<uint8_t> blob(size);- blobStream.read(reinterpret_cast<char*>(blob.data()), size);- blobStream.close();+ std::vector<uint8_t> blob(size);+ blobStream.read(reinterpret_cast<char*>(blob.data()), size);+ blobStream.close();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob.data(), blob.size()));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob.data(), blob.size()));- uint32_t initCommandQueueOrdinal = 0;- OV_ASSERT_NO_THROW(initCommandQueueOrdinal =- zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),- ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));- OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));+ uint32_t initCommandQueueOrdinal = 0;+ OV_ASSERT_NO_THROW(initCommandQueueOrdinal =+ zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),+ ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));+ OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));- const uint8_t* blobPtr = nullptr;- OV_ASSERT_NO_THROW(zeGraphExt->getGraphBinary(graphDescriptor, blob, blobPtr, size));+ const uint8_t* blobPtr = nullptr;+ OV_ASSERT_NO_THROW(zeGraphExt->getGraphBinary(graphDescriptor, blob, blobPtr, size));+ } else {+ GTEST_SKIP() << "Skip due to incompatible blob format on this platform.";+ }}TEST_P(ZeroGraphTest, SetGraphArgOnNullBuffer) {serializeIR();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));uint32_t initCommandQueueOrdinal = 0;OV_ASSERT_NO_THROW(initCommandQueueOrdinal =@@ -204,54 +242,69 @@ TEST_P(ZeroGraphTest, SetGraphArgOnNullBuffer) {}TEST_P(ZeroGraphTest, GetInitSetArgsDestroyGraphAlignedMemoryMallocBlob) {- std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);- ASSERT_TRUE(blobStream.is_open());- size_t size = get_file_size(blobStream);- size = calculate_size_with_alignment_padding(size, ::utils::STANDARD_PAGE_SIZE);+ std::string platform = ov::test::utils::getTestsPlatformFromEnvironmentOr(targetDevice);+ size_t pos = platform.find("3720");+ if (pos != std::string::npos) {+ std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);+ ASSERT_TRUE(blobStream.is_open());+ size_t size = get_file_size(blobStream);+ size = calculate_size_with_alignment_padding(size, ::utils::STANDARD_PAGE_SIZE);- uint8_t* blob = static_cast<uint8_t*>(::operator new(size, std::align_val_t(::utils::STANDARD_PAGE_SIZE)));- blobStream.read(reinterpret_cast<char*>(blob), size);- blobStream.close();+ uint8_t* blob = static_cast<uint8_t*>(::operator new(size, std::align_val_t(::utils::STANDARD_PAGE_SIZE)));+ blobStream.read(reinterpret_cast<char*>(blob), size);+ blobStream.close();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob, size));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob, size));- uint32_t initCommandQueueOrdinal = 0;- OV_ASSERT_NO_THROW(initCommandQueueOrdinal =- zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),- ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));- OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));+ uint32_t initCommandQueueOrdinal = 0;+ OV_ASSERT_NO_THROW(initCommandQueueOrdinal =+ zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),+ ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));+ OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));- std::unique_ptr<ZeroMem> buffer;- OV_ASSERT_NO_THROW(buffer = std::make_unique<ZeroMem>(zeroInitStruct, size, ::utils::STANDARD_PAGE_SIZE, false));+ std::unique_ptr<ZeroMem> buffer;+ OV_ASSERT_NO_THROW(buffer =+ std::make_unique<ZeroMem>(zeroInitStruct, size, ::utils::STANDARD_PAGE_SIZE, false));- OV_ASSERT_NO_THROW(zeGraphExt->setGraphArgumentValue(graphDescriptor, 0, buffer->data()));+ OV_ASSERT_NO_THROW(zeGraphExt->setGraphArgumentValue(graphDescriptor, 0, buffer->data()));- ::operator delete(blob, std::align_val_t(::utils::STANDARD_PAGE_SIZE));+ ::operator delete(blob, std::align_val_t(::utils::STANDARD_PAGE_SIZE));+ } else {+ GTEST_SKIP() << "Skip due to incompatible blob format on this platform.";+ }}TEST_P(ZeroGraphTest, GetInitSetArgsDestroyGraphNotAlignedMemoryMallocBlob) {- std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);- ASSERT_TRUE(blobStream.is_open());- size_t size = get_file_size(blobStream);+ std::string platform = ov::test::utils::getTestsPlatformFromEnvironmentOr(targetDevice);+ size_t pos = platform.find("3720");+ if (pos != std::string::npos) {+ std::ifstream blobStream(blobPath, std::ios::binary | std::ios::in);+ ASSERT_TRUE(blobStream.is_open());+ size_t size = get_file_size(blobStream);- uint8_t* blob = static_cast<uint8_t*>(::operator new(size, std::align_val_t(::utils::STANDARD_PAGE_SIZE)));- blobStream.read(reinterpret_cast<char*>(blob), size);- blobStream.close();+ uint8_t* blob = static_cast<uint8_t*>(::operator new(size, std::align_val_t(::utils::STANDARD_PAGE_SIZE)));+ blobStream.read(reinterpret_cast<char*>(blob), size);+ blobStream.close();- OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob, size));+ OV_ASSERT_NO_THROW(graphDescriptor = zeGraphExt->getGraphDescriptor(blob, size));- uint32_t initCommandQueueOrdinal = 0;- OV_ASSERT_NO_THROW(initCommandQueueOrdinal =- zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),- ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));- OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));+ uint32_t initCommandQueueOrdinal = 0;+ OV_ASSERT_NO_THROW(initCommandQueueOrdinal =+ zeroUtils::findCommandQueueGroupOrdinal(zeroInitStruct->getDevice(),+ ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE));+ OV_ASSERT_NO_THROW(zeGraphExt->initializeGraph(graphDescriptor, initCommandQueueOrdinal));- std::unique_ptr<ZeroMem> buffer;- OV_ASSERT_NO_THROW(buffer = std::make_unique<ZeroMem>(zeroInitStruct, size, ::utils::STANDARD_PAGE_SIZE, false));+ std::unique_ptr<ZeroMem> buffer;+ OV_ASSERT_NO_THROW(buffer =+ std::make_unique<ZeroMem>(zeroInitStruct, size, ::utils::STANDARD_PAGE_SIZE, false));- OV_ASSERT_NO_THROW(zeGraphExt->setGraphArgumentValue(graphDescriptor, 0, static_cast<char*>(buffer->data()) + 1));+ OV_ASSERT_NO_THROW(+ zeGraphExt->setGraphArgumentValue(graphDescriptor, 0, static_cast<char*>(buffer->data()) + 1));- ::operator delete(blob, std::align_val_t(::utils::STANDARD_PAGE_SIZE));+ ::operator delete(blob, std::align_val_t(::utils::STANDARD_PAGE_SIZE));+ } else {+ GTEST_SKIP() << "Skip due to incompatible blob format on this platform.";+ }}TEST_P(ZeroGraphTest, SetUnalignedAddressBlob) {@@ -264,7 +317,8 @@ TEST_P(ZeroGraphTest, SetUnalignedAddressBlob) {auto localZeGraphExt = std::make_shared<ZeGraphExtWrappers>(zeroInitStruct);GraphDescriptor localGraphDescriptor;serializeIR();- OV_ASSERT_NO_THROW(localGraphDescriptor = localZeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(localGraphDescriptor =+ localZeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));const uint8_t* blobPtr = nullptr;std::vector<uint8_t> blobVec; // plugin needs to keep a copy of the blob for older driverssize_t blobSize;@@ -299,7 +353,8 @@ TEST_P(ZeroGraphTest, SetUnalignedSizeBlob) {auto localZeGraphExt = std::make_shared<ZeGraphExtWrappers>(zeroInitStruct);GraphDescriptor localGraphDescriptor;serializeIR();- OV_ASSERT_NO_THROW(localGraphDescriptor = localZeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(localGraphDescriptor =+ localZeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));const uint8_t* blobPtr = nullptr;std::vector<uint8_t> blobVec; // plugin needs to keep a copy of the blob for older driverssize_t blobSize;@@ -334,7 +389,8 @@ TEST_P(ZeroGraphTest, SetAlignedBlob) {auto localZeGraphExt = std::make_shared<ZeGraphExtWrappers>(zeroInitStruct);GraphDescriptor localGraphDescriptor;serializeIR();- OV_ASSERT_NO_THROW(localGraphDescriptor = localZeGraphExt->getGraphDescriptor(serializedIR, "", graphDescFlag));+ OV_ASSERT_NO_THROW(localGraphDescriptor =+ localZeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache()));const uint8_t* blobPtr = nullptr;std::vector<uint8_t> blobVec; // plugin needs to keep a copy of the blob for older driverssize_t blobSize;diff --git a/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml b/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xmlindex ad7ae518200..20b0bff6176 100644--- a/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml+++ b/src/plugins/intel_npu/tests/functional/shared_tests_instances/npu_skip_func_tests.xml@@ -845,18 +845,4 @@ Example:</filters></skip_config>- <!-- E#189262 -->- <skip_config>- <message>Some ZeroGraphTest run only on NPU 3720</message>- <enable_rules>- <device>!3720</device>- </enable_rules>- <filters>- <filter>.*smoke_BehaviorTest/ZeroGraphTest.GetGraphInitBlob.*</filter>- <filter>.*smoke_BehaviorTest/ZeroGraphTest.GetGraphBinary.*</filter>- <filter>.*smoke_BehaviorTest/ZeroGraphTest.GetInitSetArgsDestroyGraphAlignedMemoryMallocBlob.*</filter>- <filter>.*smoke_BehaviorTest/ZeroGraphTest.GetInitSetArgsDestroyGraphNotAlignedMemoryMallocBlob.*</filter>- </filters>- </skip_config>-</skip_configs>