Skip to content

Commit ffb6519

Browse files
committed
Move the fd getter prop to npuw
Signed-off-by: Anoob Anto Kodankandath <[email protected]>
1 parent 414d179 commit ffb6519

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

src/inference/include/openvino/runtime/properties.hpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,6 @@ static constexpr Property<std::string, PropertyMutability::RO> model_name{"NETWO
241241
static constexpr Property<uint32_t, PropertyMutability::RO> optimal_number_of_infer_requests{
242242
"OPTIMAL_NUMBER_OF_INFER_REQUESTS"};
243243

244-
/**
245-
* @brief Type definition for file descriptor getter callback.
246-
* Function that takes a file path string and returns a file descriptor as int.
247-
* This is useful for scenarios where file access needs to be controlled externally.
248-
* @ingroup ov_runtime_cpp_prop_api
249-
*/
250-
using FdGetterType = std::function<int(const std::string&)>;
251-
252244
/**
253245
* @brief Namespace with hint properties
254246
*/
@@ -540,14 +532,6 @@ static constexpr Property<uint32_t> num_requests{"PERFORMANCE_HINT_NUM_REQUESTS"
540532
*/
541533
static constexpr Property<std::shared_ptr<const ov::Model>> model{"MODEL_PTR"};
542534

543-
/**
544-
* @brief This key identifies callback function to get file descriptor for a given file path.
545-
* The callback takes a file path string and returns a file descriptor as int.
546-
* This is useful for scenarios where file access needs to be controlled externally.
547-
* @ingroup ov_runtime_cpp_prop_api
548-
*/
549-
static constexpr Property<FdGetterType> fd_getter{"FD_GETTER"};
550-
551535
/**
552536
* @brief Special key for auto batching feature configuration. Enabled by default
553537
* @ingroup ov_runtime_cpp_prop_api

src/plugins/intel_npu/src/al/include/intel_npu/npuw_private_properties.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
namespace ov {
1010
namespace intel_npu {
11+
12+
/**
13+
* @brief Type definition for file descriptor getter callback.
14+
* Function that takes a file path string and returns a file descriptor as int.
15+
* This is useful for scenarios where file access needs to be controlled externally.
16+
*/
17+
using FdGetterType = std::function<int(const std::string&)>;
1118
/**
1219
* @brief
1320
* Type: bool
@@ -17,6 +24,13 @@ namespace intel_npu {
1724
static constexpr ov::Property<bool> use_npuw{"NPU_USE_NPUW"};
1825

1926
namespace npuw {
27+
/**
28+
* @brief This key identifies callback function to get file descriptor for a given file path.
29+
* The callback takes a file path string and returns a file descriptor as int.
30+
* This is useful for scenarios where file access needs to be controlled externally.
31+
*/
32+
static constexpr ov::Property<FdGetterType> fd_getter{"FD_GETTER"};
33+
2034
/**
2135
* @brief
2236
* Type: std::string

src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "accuracy/comparator.hpp"
1111
#include "intel_npu/npu_private_properties.hpp"
12+
#include "intel_npu/npuw_private_properties.hpp"
1213
#include "just_sync_infer_request.hpp"
1314
#include "logging.hpp"
1415
#include "openvino/core/parallel.hpp"
@@ -1141,17 +1142,17 @@ std::shared_ptr<ov::npuw::CompiledModel> ov::npuw::CompiledModel::deserialize(
11411142
std::shared_ptr<ov::Model> model_ptr;
11421143
// Cache model's constants
11431144
WeightsContext::ConstsCache consts_cache;
1144-
ov::FdGetterType fd_getter = nullptr;
1145+
ov::intel_npu::FdGetterType fd_getter = nullptr;
11451146
if (is_weightless) {
11461147
if (properties.find(ov::weights_path.name()) != properties.end()) {
11471148
weights_path = properties.at(ov::weights_path.name()).as<std::string>();
11481149
NPUW_ASSERT(!weights_path.empty() &&
11491150
"Empty weights_path. Please provide WEIGHTS_PATH or MODEL_PTR in the configuration.");
11501151

11511152
// Check if fd_getter function is provided
1152-
if (const auto fd_it = properties.find(ov::hint::fd_getter.name()); fd_it != properties.end()) {
1153-
if (fd_it->second.is<ov::FdGetterType>()) {
1154-
fd_getter = fd_it->second.as<ov::FdGetterType>();
1153+
if (const auto fd_it = properties.find(ov::intel_npu::npuw::fd_getter.name()); fd_it != properties.end()) {
1154+
if (fd_it->second.is<ov::intel_npu::FdGetterType>()) {
1155+
fd_getter = fd_it->second.as<ov::intel_npu::FdGetterType>();
11551156
}
11561157
}
11571158
} else if (properties.find(ov::hint::model.name()) != properties.end()) {

src/plugins/intel_npu/src/plugin/npuw/lazy_tensor.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <memory>
88
#include <variant>
99

10+
#include "intel_npu/npuw_private_properties.hpp"
1011
#include "openvino/op/constant.hpp"
1112
#include "openvino/runtime/shared_buffer.hpp"
1213
#include "openvino/runtime/tensor.hpp"
@@ -108,7 +109,7 @@ class Const {
108109
std::size_t m_byte_size = 0;
109110
ov::Tensor m_read_from_bin;
110111
std::string m_weights_path;
111-
ov::FdGetterType m_fd_getter = nullptr;
112+
ov::intel_npu::FdGetterType m_fd_getter = nullptr;
112113
mutable ov::npuw::s11n::WeightsPtr m_mmaped_weights = nullptr;
113114
// FIXME: special case when a new Constant was added into the model,
114115
// then made into LazyTensor during folding. We need to keep a copy of it,

src/plugins/intel_npu/src/plugin/npuw/serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ov::npuw::s11n::WeightsContext::WeightsContext(const ov::npuw::s11n::WeightsPtr&
2929
const std::string& _weights_path,
3030
const s11n::WeightsContext::ConstsCache& _consts_cache,
3131
const BF16Cache& _bf16_consts,
32-
const ov::FdGetterType& _fd_getter)
32+
const ov::intel_npu::FdGetterType& _fd_getter)
3333
: weights(_weights),
3434
weights_path(_weights_path),
3535
consts_cache(_consts_cache),

src/plugins/intel_npu/src/plugin/npuw/serialization.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <string>
1515
#include <tuple>
1616
#include <unordered_map>
17+
18+
#include "intel_npu/npuw_private_properties.hpp"
1719
#include <unordered_set>
1820
#include <vector>
1921

@@ -129,7 +131,7 @@ struct WeightsContext {
129131
const std::string& _weights_path,
130132
const ConstsCache& _consts_cache,
131133
const BF16Cache& _bf16_consts,
132-
const ov::FdGetterType& _fd_getter = nullptr);
134+
const ov::intel_npu::FdGetterType& _fd_getter = nullptr);
133135

134136
WeightsContext& operator=(const WeightsContext& other) = default;
135137

@@ -144,7 +146,7 @@ struct WeightsContext {
144146
std::string weights_path;
145147
ConstsCache consts_cache;
146148
BF16Cache bf16_consts;
147-
ov::FdGetterType fd_getter = nullptr;
149+
ov::intel_npu::FdGetterType fd_getter = nullptr;
148150
};
149151

150152
BF16Cache get_bf16_consts(const std::shared_ptr<ov::Model>& model);

0 commit comments

Comments
 (0)