support context in auto and re-enable tests (#18554)

wrap hardware remote context to compiled model

Signed-off-by: fishbell <bell.song@intel.com>
This commit is contained in:
yanlan song 2023-07-20 14:53:07 +08:00 committed by GitHub
parent 7167473744
commit a51d9494fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 41 additions and 22 deletions

View File

@ -17,9 +17,10 @@ namespace ov {
namespace auto_plugin {
AutoCompiledModel::AutoCompiledModel(const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<const ov::IPlugin>& plugin,
ScheduleContext::Ptr context,
Schedule::Ptr scheduler)
: CompiledModel(model, plugin, context, scheduler),
const ov::SoPtr<ov::IRemoteContext>& remote_context,
ScheduleContext::Ptr& schedule_context,
Schedule::Ptr& scheduler)
: CompiledModel(model, plugin, remote_context, schedule_context, scheduler),
m_model(model) {
m_scheduler = std::dynamic_pointer_cast<AutoSchedule>(scheduler);
}

View File

@ -15,8 +15,9 @@ class AutoCompiledModel : public CompiledModel {
public:
AutoCompiledModel(const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<const ov::IPlugin>& plugin,
ScheduleContext::Ptr context,
Schedule::Ptr scheduler);
const ov::SoPtr<ov::IRemoteContext>& context,
ScheduleContext::Ptr& schedule_context,
Schedule::Ptr& scheduler);
// implement pure virtual methods from a base class ov::ICompiledModel
void export_model(std::ostream& model) const override;

View File

@ -18,12 +18,12 @@
ov::auto_plugin::CompiledModel::CompiledModel(const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<const ov::IPlugin>& plugin,
ScheduleContext::Ptr context,
Schedule::Ptr scheduler)
: ov::ICompiledModel(model, plugin),
m_context(context),
const ov::SoPtr<ov::IRemoteContext>& remote_context,
ScheduleContext::Ptr& schedule_context,
Schedule::Ptr& scheduler)
: ov::ICompiledModel(model, plugin, remote_context),
m_context(schedule_context),
m_scheduler(scheduler) {
scheduler->launch(context);
m_inputs_outputs_from_hardware = (model == nullptr);
}

View File

@ -13,8 +13,9 @@ class CompiledModel : public ov::ICompiledModel {
public:
CompiledModel(const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<const ov::IPlugin>& plugin,
ScheduleContext::Ptr context,
Schedule::Ptr scheduler);
const ov::SoPtr<ov::IRemoteContext>& remote_context,
ScheduleContext::Ptr& schedule_context,
Schedule::Ptr& scheduler);
std::shared_ptr<ov::IAsyncInferRequest> create_infer_request() const override;
std::shared_ptr<const Plugin> get_auto_plugin();

View File

@ -18,9 +18,10 @@ namespace ov {
namespace auto_plugin {
AutoCumuCompiledModel::AutoCumuCompiledModel(const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<const ov::IPlugin>& plugin,
ScheduleContext::Ptr context,
Schedule::Ptr scheduler)
: CompiledModel(model, plugin, context, scheduler) {
const ov::SoPtr<ov::IRemoteContext>& remote_context,
ScheduleContext::Ptr& schedule_context,
Schedule::Ptr& scheduler)
: CompiledModel(model, plugin, remote_context, schedule_context, scheduler) {
m_scheduler = std::dynamic_pointer_cast<CumuSchedule>(scheduler);
}

View File

@ -15,8 +15,9 @@ class AutoCumuCompiledModel : public CompiledModel {
public:
AutoCumuCompiledModel(const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<const ov::IPlugin>& plugin,
ScheduleContext::Ptr context,
Schedule::Ptr scheduler);
const ov::SoPtr<ov::IRemoteContext>& remote_context,
ScheduleContext::Ptr& schedule_context,
Schedule::Ptr& scheduler);
// implement pure virtual methods from a base class ov::ICompiledModel
void export_model(std::ostream& model) const override;

View File

@ -529,10 +529,26 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model_impl(const std::string
auto_s_context->m_runtime_fallback = load_config.get_property(ov::intel_auto::enable_runtime_fallback);
auto_s_context->m_bind_buffer = load_config.get_property(ov::intel_auto::device_bind_buffer);
std::shared_ptr<ov::ICompiledModel> impl;
std::shared_ptr<Schedule> scheduler = is_cumulative ? std::static_pointer_cast<Schedule>(std::make_shared<CumuSchedule>()) :
std::static_pointer_cast<Schedule>(std::make_shared<AutoSchedule>());
scheduler->launch(auto_s_context);
ov::SoPtr<ov::IRemoteContext> device_context;
try {
OPENVINO_ASSERT(auto_s_context->m_hw_compiled_model, "no valid compiled model available");
device_context = auto_s_context->m_hw_compiled_model->get_context();
if (!device_context._so)
device_context._so = auto_s_context->m_hw_compiled_model._so;
} catch (ov::NotImplemented&) {
LOG_INFO_TAG("underlying hardware does not support hardware context");
OPENVINO_SUPPRESS_DEPRECATED_START
} catch (InferenceEngine::Exception&) {
LOG_INFO_TAG("underlying hardware does not support hardware context");
}
OPENVINO_SUPPRESS_DEPRECATED_END
if (is_cumulative) {
impl = std::make_shared<AutoCumuCompiledModel>(ppp_model, shared_from_this(), auto_s_context, std::make_shared<CumuSchedule>());
impl = std::make_shared<AutoCumuCompiledModel>(ppp_model, shared_from_this(), device_context, auto_s_context, scheduler);
} else {
impl = std::make_shared<AutoCompiledModel>(ppp_model, shared_from_this(), auto_s_context, std::make_shared<AutoSchedule>());
impl = std::make_shared<AutoCompiledModel>(ppp_model, shared_from_this(), device_context, auto_s_context, scheduler);
}
return impl;
}

View File

@ -137,8 +137,6 @@ std::vector<std::string> disabledTestPatterns() {
// For some strange reason (bug?) output format cannot have a rank greater than 4 for dynamic shape case,
// because it crashes in some random places during "reorder_inputs" pass.
R"(.*UniqueLayerDynamicGPUTest.*\(\d*\.\d*\.\d*\.\d*\.\d*\).*axis.*)",
// cvs-115052
R"(.*smoke_Multi.*canCreateContextThenRequestThenBlobsAndInfer.*)",
#ifdef PROXY_PLUGIN_ENABLED
// Plugin version was changed to ov::Version
R"(.*VersionTest.*pluginCurrentVersionIsCorrect.*)",