Skip to content

Commit

Permalink
Check HolderTests under the proxy (openvinotoolkit#19785)
Browse files Browse the repository at this point in the history
* Skip only virtual device tests

* Fixed proxy life time

* Fixed compiled model get property

* Fixed code style

* Try to fix LTO
  • Loading branch information
ilyachur authored Sep 14, 2023
1 parent 1a950f9 commit fa66715
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
6 changes: 6 additions & 0 deletions src/core/include/openvino/core/any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ class Node;
class RuntimeAttribute;

class CompiledModel;
namespace proxy {

class CompiledModel;

}
class RemoteContext;
class RemoteTensor;

Expand Down Expand Up @@ -659,6 +664,7 @@ class OPENVINO_API Any {
friend class ::ov::RuntimeAttribute;
friend class ::InferenceEngine::ExecutableNetwork;
friend class ::ov::CompiledModel;
friend class ::ov::proxy::CompiledModel;
friend class ::ov::RemoteContext;
friend class ::ov::RemoteTensor;
friend class ::ov::Plugin;
Expand Down
24 changes: 15 additions & 9 deletions src/inference/src/compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
#include "openvino/runtime/icompiled_model.hpp"
#include "openvino/runtime/properties.hpp"

#define OV_COMPILED_MODEL_CALL_STATEMENT(...) \
OPENVINO_ASSERT(_impl != nullptr, "CompiledModel was not initialized."); \
try { \
__VA_ARGS__; \
} catch (const std::exception& ex) { \
OPENVINO_THROW(ex.what()); \
} catch (...) { \
OPENVINO_THROW("Unexpected exception"); \
#define OV_COMPILED_MODEL_CALL_STATEMENT(...) \
if (_impl == nullptr) \
OPENVINO_THROW("CompiledModel was not initialized."); \
try { \
__VA_ARGS__; \
} catch (const std::exception& ex) { \
OPENVINO_THROW(ex.what()); \
} catch (...) { \
OPENVINO_THROW("Unexpected exception"); \
}

namespace ov {
Expand Down Expand Up @@ -115,7 +116,12 @@ void CompiledModel::set_property(const AnyMap& config) {
}

Any CompiledModel::get_property(const std::string& name) const {
OV_COMPILED_MODEL_CALL_STATEMENT(return {_impl->get_property(name), {_so}});
OV_COMPILED_MODEL_CALL_STATEMENT({
auto property = _impl->get_property(name);
if (!property._so)
property._so = _so;
return property;
});
}

RemoteContext CompiledModel::get_context() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ std::vector<std::string> disabledTestPatterns() {
R"(.*MemoryDynamicBatch.*)",
// Meta plugins may miss saving HW plugin so handle, thus plugin may be unloaded before all objects are deleted which leads to segfault
// Issue: 118840
R"(.*OVHoldersTest.*)",
R"(.*OVHoldersTest.*AUTO.*)",
R"(.*OVHoldersTest.*MULTI.*)",
R"(.*OVHoldersTest.*BATCH.*)",
};
}
5 changes: 4 additions & 1 deletion src/plugins/proxy/src/compiled_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class CompiledModel : public ov::ICompiledModel {
}

ov::Any get_property(const std::string& name) const override {
return m_compiled_model->get_property(name);
auto property = m_compiled_model->get_property(name);
if (!property._so)
property._so = m_compiled_model._so;
return property;
}
const std::vector<ov::Output<const ov::Node>>& inputs() const override {
return m_compiled_model->inputs();
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/proxy/src/infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ std::vector<ov::ProfilingInfo> ov::proxy::InferRequest::get_profiling_info() con

ov::SoPtr<ov::ITensor> ov::proxy::InferRequest::get_tensor(const ov::Output<const ov::Node>& port) const {
auto tensor = m_infer_request->get_tensor(port);
if (!tensor._so)
tensor._so = m_infer_request._so;
if (std::dynamic_pointer_cast<ov::IRemoteTensor>(tensor._ptr)) {
auto remote_context = std::dynamic_pointer_cast<ov::proxy::RemoteContext>(m_compiled_model->get_context()._ptr);
OPENVINO_ASSERT(remote_context);
Expand All @@ -64,6 +66,8 @@ void ov::proxy::InferRequest::set_tensor(const ov::Output<const ov::Node>& port,
std::vector<ov::SoPtr<ov::ITensor>> ov::proxy::InferRequest::get_tensors(const ov::Output<const ov::Node>& port) const {
auto tensors = m_infer_request->get_tensors(port);
for (auto&& tensor : tensors) {
if (!tensor._so)
tensor._so = m_infer_request._so;
if (std::dynamic_pointer_cast<ov::IRemoteTensor>(tensor._ptr)) {
auto remote_context =
std::dynamic_pointer_cast<ov::proxy::RemoteContext>(m_compiled_model->get_context()._ptr);
Expand Down

0 comments on commit fa66715

Please sign in to comment.