Skip to content

Commit ba6aca4

Browse files
committed
Add template plugin support
1 parent 1092834 commit ba6aca4

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/plugins/template/src/plugin.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const
394394
ov::PropertyName{ov::internal::threads_per_stream.name(), ov::PropertyMutability::RW},
395395
ov::PropertyName{ov::internal::compiled_model_runtime_properties.name(), ov::PropertyMutability::RO},
396396
ov::PropertyName{ov::internal::cache_header_alignment.name(), ov::PropertyMutability::RO},
397+
ov::PropertyName{ov::internal::compiled_blob_version.name(), ov::PropertyMutability::RO},
398+
ov::PropertyName{ov::internal::blob_verification_callback.name(), ov::PropertyMutability::RO},
397399
};
398400
} else if (ov::available_devices == name) {
399401
// TODO: fill list of available devices
@@ -415,12 +417,26 @@ ov::Any ov::template_plugin::Plugin::get_property(const std::string& name, const
415417
return decltype(ov::execution_devices)::value_type{get_device_name()};
416418
} else if (ov::range_for_async_infer_requests == name) {
417419
return decltype(ov::range_for_async_infer_requests)::value_type{1, 1, 1};
420+
} else if (ov::internal::blob_verification_callback == name) {
421+
return decltype(ov::internal::blob_verification_callback)::value_type{[](const std::string& version) {
422+
return ov::template_plugin::Plugin::verify_compiled_blob(version);
423+
}};
424+
} else if (ov::internal::compiled_blob_version == name) {
425+
return decltype(ov::internal::compiled_blob_version)::value_type{get_compiled_blob_version()};
418426
} else {
419427
return m_cfg.Get(name);
420428
}
421429
}
422430
// ! [plugin:get_property]
423431

432+
std::string ov::template_plugin::Plugin::get_compiled_blob_version() {
433+
return "TEMPLATE_PLUGIN_BLOB_V1";
434+
}
435+
436+
bool ov::template_plugin::Plugin::verify_compiled_blob(const std::string& compiled_blob_version) {
437+
return compiled_blob_version == get_compiled_blob_version();
438+
}
439+
424440
// ! [plugin:create_plugin_engine]
425441
static const ov::Version version = {CI_BUILD_NUMBER, "openvino_template_plugin"};
426442
OV_DEFINE_PLUGIN_CREATE_FUNCTION(ov::template_plugin::Plugin, version)

src/plugins/template/src/plugin.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ class Plugin : public ov::IPlugin {
5858
std::shared_ptr<ov::runtime::Backend> m_backend;
5959
Configuration m_cfg;
6060
std::shared_ptr<ov::threading::ITaskExecutor> m_waitExecutor;
61-
};
6261

62+
static std::string get_compiled_blob_version();
63+
static bool verify_compiled_blob(const std::string& compiled_blob_version);
64+
};
6365
} // namespace template_plugin
6466
} // namespace ov
6567
//! [plugin:header]

0 commit comments

Comments
 (0)