diff --git a/inference-engine/include/cpp/ie_infer_request.hpp b/inference-engine/include/cpp/ie_infer_request.hpp index 54c71c410fd7d8..bebb973896ddcf 100644 --- a/inference-engine/include/cpp/ie_infer_request.hpp +++ b/inference-engine/include/cpp/ie_infer_request.hpp @@ -217,6 +217,18 @@ class INFERENCE_ENGINE_API_CLASS(InferRequest) { * @return true if current InferRequest object is initialized, false - otherwise */ explicit operator bool() const noexcept; + + /** + * @brief Compares whether this request wraps the same impl underneath + * @return true if current InferRequest object doesn't wrap the same impl as the operator's arg + */ + bool operator!=(const InferRequest&) const noexcept; + + /** + * @brief Compares whether this request wraps the same impl underneath + * @return true if current InferRequest object wraps the same impl as the operator's arg + */ + bool operator==(const InferRequest&) const noexcept; }; template<> diff --git a/inference-engine/src/auto_plugin/auto_exec_network.cpp b/inference-engine/src/auto_plugin/auto_exec_network.cpp index d6b42a1a8eca05..5fc5969a5a1efe 100644 --- a/inference-engine/src/auto_plugin/auto_exec_network.cpp +++ b/inference-engine/src/auto_plugin/auto_exec_network.cpp @@ -27,10 +27,14 @@ AutoExecutableNetwork::AutoExecutableNetwork(const SoExecutableNetworkInternal& AutoExecutableNetwork::~AutoExecutableNetwork() = default; -IInferRequestInternal::Ptr AutoExecutableNetwork::CreateInferRequestImpl(InputsDataMap networkInputs, +InferenceEngine::IInferRequestInternal::Ptr AutoExecutableNetwork::CreateInferRequestImpl(InputsDataMap networkInputs, OutputsDataMap networkOutputs) { - SoIInferRequestInternal inferRequest = { _network, _network->CreateInferRequest() }; - return std::make_shared(networkInputs, networkOutputs, inferRequest); + IE_THROW(NotImplemented); +} + +InferenceEngine::IInferRequestInternal::Ptr AutoExecutableNetwork::CreateInferRequest() { + SoIInferRequestInternal inferRequest = {_network, _network->CreateInferRequest()}; + return std::make_shared(_networkInputs, _networkOutputs, inferRequest); } void AutoExecutableNetwork::Export(std::ostream& networkModel) { diff --git a/inference-engine/src/auto_plugin/auto_exec_network.hpp b/inference-engine/src/auto_plugin/auto_exec_network.hpp index 0a99ba061336e9..d50b87d944a71a 100644 --- a/inference-engine/src/auto_plugin/auto_exec_network.hpp +++ b/inference-engine/src/auto_plugin/auto_exec_network.hpp @@ -24,7 +24,7 @@ struct DeviceInformation { std::map config; }; -class AutoExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefault { +class AutoExecutableNetwork : public InferenceEngine::ExecutableNetworkInternal { public: using Ptr = std::shared_ptr; @@ -40,6 +40,8 @@ class AutoExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSaf InferenceEngine::Parameter GetConfig(const std::string& name) const override; InferenceEngine::IInferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs, InferenceEngine::OutputsDataMap networkOutputs) override; + InferenceEngine::IInferRequestInternal::Ptr CreateInferRequest() override; + ~AutoExecutableNetwork() override; DeviceInformation _deviceInfo; diff --git a/inference-engine/src/auto_plugin/auto_infer_request.cpp b/inference-engine/src/auto_plugin/auto_infer_request.cpp index bcaf9b2aa5c4c0..f0777409830d68 100644 --- a/inference-engine/src/auto_plugin/auto_infer_request.cpp +++ b/inference-engine/src/auto_plugin/auto_infer_request.cpp @@ -36,4 +36,16 @@ void AutoInferRequest::Cancel() { _inferRequest->Cancel(); } +void AutoInferRequest::StartAsync() { + _inferRequest->StartAsync(); +} + +InferenceEngine::StatusCode AutoInferRequest::Wait(int64_t millis_timeout) { + return _inferRequest->Wait(millis_timeout); +} + +void AutoInferRequest::SetCallback(Callback callback) { + _inferRequest->SetCallback(callback); +} + } // namespace AutoPlugin diff --git a/inference-engine/src/auto_plugin/auto_infer_request.hpp b/inference-engine/src/auto_plugin/auto_infer_request.hpp index 400a18bf7c6167..1ccaf0093b27b3 100644 --- a/inference-engine/src/auto_plugin/auto_infer_request.hpp +++ b/inference-engine/src/auto_plugin/auto_infer_request.hpp @@ -30,6 +30,10 @@ class AutoInferRequest : public InferenceEngine::IInferRequestInternal { void SetBlob(const std::string& name, const InferenceEngine::Blob::Ptr& data) override; InferenceEngine::Blob::Ptr GetBlob(const std::string& name) override; void Cancel() override; + //async impl + void StartAsync() override; + InferenceEngine::StatusCode Wait(int64_t millis_timeout) override; + void SetCallback(Callback callback) override; private: InferenceEngine::SoIInferRequestInternal _inferRequest; diff --git a/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp b/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp index 39ded89d237bec..23c96574763319 100644 --- a/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp +++ b/inference-engine/src/inference_engine/cpp/ie_infer_request.cpp @@ -206,4 +206,12 @@ bool InferRequest::operator!() const noexcept { InferRequest::operator bool() const noexcept { return !!_impl; } + +bool InferRequest::operator!=(const InferRequest& r) const noexcept { + return !(r == *this); +} + +bool InferRequest::operator==(const InferRequest& r) const noexcept { + return r._impl == _impl; +} } // namespace InferenceEngine diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request_callback.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request_callback.hpp index 4ef5059f7b595c..93be32c3051952 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request_callback.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/infer_request_callback.hpp @@ -36,8 +36,9 @@ TEST_P(CallbackTests, canCallSyncAndAsyncWithCompletionCallback) { // Create InferRequest InferenceEngine::InferRequest req = execNet.CreateInferRequest(); bool isCalled = false; - req.SetCompletionCallback>( + req.SetCompletionCallback>( [&](InferenceEngine::InferRequest request, InferenceEngine::StatusCode status) { + ASSERT_TRUE(req == request); //the callback is called on the same impl of the request // HSD_1805940120: Wait on starting callback return HDDL_ERROR_INVAL_TASK_HANDLE if (targetDevice != CommonTestUtils::DEVICE_HDDL) { ASSERT_EQ(static_cast(InferenceEngine::StatusCode::OK), status);