Skip to content

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

[`NPU`] [`OV CACHE`] Support `ov::internal::cache_header_alignment` property (#32380)

Mircea-Aurelian Dancfedf0906931
diff --git a/src/plugins/intel_npu/src/plugin/include/properties.hpp b/src/plugins/intel_npu/src/plugin/include/properties.hpp
index 20fccd4e9d3..feeeb460a4d 100644
--- a/src/plugins/intel_npu/src/plugin/include/properties.hpp
+++ b/src/plugins/intel_npu/src/plugin/include/properties.hpp
@@ -131,7 +131,8 @@ private:
ov::intel_npu::npuw::llm::additional_shared_lm_head_config.name()};
const std::vector<ov::PropertyName> _internalSupportedProperties = {ov::internal::caching_properties.name(),
- ov::internal::caching_with_mmap.name()};
+ ov::internal::caching_with_mmap.name(),
+ ov::internal::cache_header_alignment.name()};
};
} // namespace intel_npu
diff --git a/src/plugins/intel_npu/src/plugin/src/properties.cpp b/src/plugins/intel_npu/src/plugin/src/properties.cpp
index 72167b6d9ac..255301b625f 100644
--- a/src/plugins/intel_npu/src/plugin/src/properties.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/properties.cpp
@@ -9,6 +9,7 @@
#include "intel_npu/common/device_helpers.hpp"
#include "intel_npu/config/npuw.hpp"
#include "intel_npu/config/options.hpp"
+#include "intel_npu/utils/utils.hpp"
namespace intel_npu {
@@ -499,6 +500,7 @@ void Properties::registerPluginProperties() {
REGISTER_SIMPLE_METRIC(ov::device::gops, true, _metrics->GetGops(get_specified_device_name(config)));
REGISTER_SIMPLE_METRIC(ov::device::type, true, _metrics->GetDeviceType(get_specified_device_name(config)));
REGISTER_SIMPLE_METRIC(ov::internal::supported_properties, false, _internalSupportedProperties);
+ REGISTER_SIMPLE_METRIC(ov::internal::cache_header_alignment, false, utils::STANDARD_PAGE_SIZE);
REGISTER_SIMPLE_METRIC(ov::intel_npu::device_alloc_mem_size,
true,
_metrics->GetDeviceAllocMemSize(get_specified_device_name(config)));
diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/caching_tests.cpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/caching_tests.cpp
new file mode 100644
index 00000000000..eac9553e113
--- /dev/null
+++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/caching_tests.cpp
@@ -0,0 +1,23 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "caching_tests.hpp"
+
+#include <vector>
+
+#include "common/utils.hpp"
+
+using namespace ov::test::behavior;
+
+namespace {
+
+std::vector<ov::AnyMap> config = {{}};
+
+INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests,
+ OVCompileModelLoadFromFileTestBaseNPU,
+ ::testing::Combine(::testing::Values(ov::test::utils::DEVICE_NPU),
+ ::testing::ValuesIn(config)),
+ ov::test::utils::appendPlatformTypeTestName<OVCompileModelLoadFromFileTestBaseNPU>);
+
+} // namespace
diff --git a/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/caching_tests.hpp b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/caching_tests.hpp
new file mode 100644
index 00000000000..fb1b2860f9a
--- /dev/null
+++ b/src/plugins/intel_npu/tests/functional/behavior/ov_plugin/caching_tests.hpp
@@ -0,0 +1,56 @@
+// Copyright (C) 2018-2025 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <ze_api.h> // not redundant, needed for `ze_structure_type_t` structure
+#include <ze_mem_import_system_memory_ext.h>
+
+#include <behavior/ov_plugin/caching_tests.hpp>
+
+#include "intel_npu/utils/zero/zero_init.hpp"
+#include "openvino/core/log_util.hpp"
+
+namespace ov {
+namespace test {
+namespace behavior {
+
+using OVCompileModelLoadFromFileTestBaseNPU = CompileModelLoadFromFileTestBase;
+
+TEST_P(OVCompileModelLoadFromFileTestBaseNPU, BlobWithOVHeaderAligmentCanBeImported) {
+ core->set_property(ov::cache_dir(m_cacheFolderName));
+
+ ze_device_external_memory_properties_t externalMemorydDesc = {};
+ externalMemorydDesc.stype = ZE_STRUCTURE_TYPE_DEVICE_EXTERNAL_MEMORY_PROPERTIES;
+
+ auto res =
+ intel_npu::zeDeviceGetExternalMemoryProperties(intel_npu::ZeroInitStructsHolder::getInstance()->getDevice(),
+ &externalMemorydDesc);
+ if ((res != ZE_RESULT_SUCCESS) ||
+ ((externalMemorydDesc.memoryAllocationImportTypes & ZE_EXTERNAL_MEMORY_TYPE_FLAG_STANDARD_ALLOCATION) == 0)) {
+ GTEST_SKIP() << "Standard allocation is not supported by the current configuration.";
+ }
+
+ std::stringstream custom_logger;
+ ov::util::LogCallback custom_log_callback =
+ [&](std::string_view s) { // switch to query allocation info for import flag when possible
+ custom_logger << s << std::endl;
+ };
+ ov::util::set_log_callback(custom_log_callback);
+
+ for (size_t i = 0; i < 2; ++i) {
+ if (i != 0) {
+ configuration.emplace(ov::log::level(ov::log::Level::DEBUG));
+ }
+ core->compile_model(m_modelName, targetDevice, configuration);
+ configuration.erase(ov::log::level.name());
+ }
+ ov::util::reset_log_callback();
+ EXPECT_THAT(custom_logger.str(),
+ ::testing::HasSubstr("getGraphDescriptor - set ZE_GRAPH_FLAG_INPUT_GRAPH_PERSISTENT"));
+}
+
+} // namespace behavior
+} // namespace test
+} // namespace ov