Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[`NPU`] [`TESTS`] [`ENCRYPTION`] Fix internal encryption tests throwing "Unsupported IR API version" (#36052)

Mircea-Aurelian Dan44e286794f03
diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp
index c69616044c3..5de66e274c5 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.cpp
@@ -170,4 +170,10 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests_CheckCompilerVersion,
::testing::ValuesIn(valid_device_ids)),
CheckCompilerVersionProperty::getTestCaseName);
+INSTANTIATE_TEST_SUITE_P(compatibility_smoke_BehaviorTests_CheckSecureCompilationFlag,
+ CheckSecureCompilationFlag,
+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
+ ::testing::ValuesIn(exe_network_public_mutable_properties)),
+ CheckSecureCompilationFlag::getTestCaseName);
+
} // namespace
diff --git a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp
index 3451f447961..f5dde63e26c 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/compiled_model/property.hpp
@@ -861,4 +861,27 @@ TEST_P(CheckCpuPinning, CheckCompileModelWithCpuPinningFromCompileProperty) {
std::string::npos);
}
+using CheckSecureCompilationFlag = ClassExecutableNetworkGetPropertiesTestNPU;
+
+TEST_P(CheckSecureCompilationFlag, EncryptionCallbacksForOlderDriverThrows) {
+ ov::Core core;
+ ov::AnyMap configuration = {{configKey, configValue},
+ ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER)};
+ if (::intel_npu::ZeroInitStructsHolder::getInstance()->getGraphDdiTable().version() < ZE_MAKE_VERSION(1, 17)) {
+ OV_EXPECT_THROW(core.compile_model(model, deviceName, configuration),
+ ov::Exception,
+ testing::HasSubstr(
+ "Secure compilation was requested, but the current driver version does not support it."));
+ core.set_property(deviceName, configuration);
+ OV_EXPECT_THROW(core.compile_model(model, deviceName, {}),
+ ov::Exception,
+ testing::HasSubstr(
+ "Secure compilation was requested, but the current driver version does not support it."));
+ } else {
+ OV_ASSERT_NO_THROW(core.compile_model(model, deviceName, configuration));
+ core.set_property(deviceName, configuration);
+ OV_ASSERT_NO_THROW(core.compile_model(model, deviceName, {}));
+ }
+}
+
} // namespace
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.cpp
index c813026693e..1c280430f48 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
@@ -37,14 +37,10 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,
graphExtVersions),
ZeroGraphTest::getTestCaseName);
-const std::vector<ov::AnyMap> configEncryptionCallbacks = {
- {ov::intel_npu::compiler_type(ov::intel_npu::CompilerType::DRIVER),
- ov::cache_encryption_callbacks(ov::EncryptionCallbacks{ov::util::codec_xor, ov::util::codec_xor})}};
-
INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTest,
EncryptionCallbacks,
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
- ::testing::ValuesIn(configEncryptionCallbacks),
+ ::testing::ValuesIn(emptyConfigsTests),
graphExtVersions),
ZeroGraphTest::getTestCaseName);
diff --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.hpp
index a66f17933a3..a0ec07d87bf 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
@@ -409,30 +409,17 @@ TEST_P(IsOptionSupported, PropertySupportedByDriver) {
using EncryptionCallbacks = ZeroGraphTest;
TEST_P(EncryptionCallbacks, EncryptionCallbacksSetSecureCompileFlag) {
- model = ov::test::utils::make_conv_pool_relu({1, 3, 227, 227}, ov::element::f32);
-
- auto options = std::make_shared<OptionsDesc>();
- options->add<COMPILER_TYPE>();
- options->add<CACHE_ENCRYPTION_CALLBACKS>();
- auto npu_config = std::make_unique<FilteredConfig>(options);
- for (const auto& [propertyName, propertyValue] : configuration) {
- npu_config->enable(propertyName, true);
- }
- npu_config->updateAny(configuration);
-
- std::shared_ptr<ICompilerAdapter> compiler;
- compiler =
- npu_config->get<COMPILER_TYPE>() == intel_npu::CompilerType::DRIVER
- ? std::dynamic_pointer_cast<ICompilerAdapter>(std::make_shared<DriverCompilerAdapter>(zeroInitStruct))
- : std::dynamic_pointer_cast<ICompilerAdapter>(std::make_shared<PluginCompilerAdapter>(zeroInitStruct));
-
+ auto localZeGraphExt = std::make_shared<ZeGraphExtWrappers>(zeroInitStruct);
+ serializeIR();
if (zeroInitStruct->getGraphDdiTable().version() < ZE_MAKE_VERSION(1, 17)) {
- OV_EXPECT_THROW(compiler->compile(model, *npu_config),
- ov::Exception,
- testing::HasSubstr(
- "Secure compilation was requested, but the current driver version does not support it."));
+ OV_EXPECT_THROW(
+ localZeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache(), /* secureCompile = */ true),
+ ov::Exception,
+ testing::HasSubstr(
+ "Secure compilation was requested, but the current driver version does not support it."));
} else {
- OV_ASSERT_NO_THROW(compiler->compile(model, *npu_config));
+ OV_ASSERT_NO_THROW(
+ localZeGraphExt->getGraphDescriptor(serializedIR, "", bypassUmdCache(), /* secureCompile = */ true));
}
}