@@ -1141,11 +1141,19 @@ std::shared_ptr<ov::npuw::CompiledModel> ov::npuw::CompiledModel::deserialize(
11411141 std::shared_ptr<ov::Model> model_ptr;
11421142 // Cache model's constants
11431143 WeightsContext::ConstsCache consts_cache;
1144+ ov::FdGetterType fd_getter = nullptr ;
11441145 if (is_weightless) {
11451146 if (properties.find (ov::weights_path.name ()) != properties.end ()) {
11461147 weights_path = properties.at (ov::weights_path.name ()).as <std::string>();
11471148 NPUW_ASSERT (!weights_path.empty () &&
11481149 " Empty weights_path. Please provide WEIGHTS_PATH or MODEL_PTR in the configuration." );
1150+
1151+ // 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>();
1155+ }
1156+ }
11491157 } else if (properties.find (ov::hint::model.name ()) != properties.end ()) {
11501158 model_ptr = std::const_pointer_cast<ov::Model>(
11511159 properties.at (ov::hint::model.name ()).as <std::shared_ptr<const ov::Model>>())
@@ -1181,7 +1189,14 @@ std::shared_ptr<ov::npuw::CompiledModel> ov::npuw::CompiledModel::deserialize(
11811189 ov::npuw::s11n::WeightsPtr weights = nullptr ;
11821190 if (is_weightless) {
11831191 if (!weights_path.empty ()) {
1184- auto mapped_memory = ov::load_mmap_object (weights_path);
1192+ std::shared_ptr<ov::MappedMemory> mapped_memory;
1193+ // Use fd_getter if available, otherwise use default mmap
1194+ if (fd_getter) {
1195+ int fd = fd_getter (weights_path);
1196+ mapped_memory = ov::load_mmap_object (fd);
1197+ } else {
1198+ mapped_memory = ov::load_mmap_object (weights_path);
1199+ }
11851200 weights = std::make_shared<ov::npuw::s11n::Weights>(mapped_memory->data (),
11861201 mapped_memory->size (),
11871202 mapped_memory);
@@ -1191,7 +1206,8 @@ std::shared_ptr<ov::npuw::CompiledModel> ov::npuw::CompiledModel::deserialize(
11911206 // FIXME: prolong lifetime of ov::Model for import with MODEL_PTR.
11921207 // Unclear why it's needed, but without saving consts_cache until bank evaluation,
11931208 // the memory is freed somewhere.
1194- compiled->m_import_weights_ctx = WeightsContext (weights, weights_path, consts_cache, compiled->m_bf16_consts );
1209+ compiled->m_import_weights_ctx =
1210+ WeightsContext (weights, weights_path, consts_cache, compiled->m_bf16_consts , fd_getter);
11951211
11961212 // Deserialize compiled submodels
11971213 std::size_t subm_size = 0 ;
0 commit comments