Skip to content

Commit

Permalink
Fixed ODR for LTO with gcc5 (openvinotoolkit#2615)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Oct 12, 2020
1 parent 2110a29 commit d617f1c
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class AsyncInferRequestThreadSafeDefault : public AsyncInferRequestThreadSafeInt
using Futures = std::vector<std::shared_future<void>>;
using Promise = std::shared_ptr<std::promise<void>>;
enum Stage_e : std::uint8_t { executor, task };
struct DisableCallbackGuard{
InferRequestInternal::Ptr _syncRequest;

struct DisableCallbackGuard {
explicit DisableCallbackGuard(AtomicCallback& callback)
: _callbackRef(callback), _callback(callback.exchange(nullptr)) {}
~DisableCallbackGuard() {
Expand All @@ -54,7 +56,12 @@ class AsyncInferRequestThreadSafeDefault : public AsyncInferRequestThreadSafeInt
AtomicCallback& _callbackRef;
IInferRequest::CompletionCallback _callback;
};
InferRequestInternal::Ptr _syncRequest;

struct ImmediateStreamsExecutor : public InferenceEngine::ITaskExecutor {
explicit ImmediateStreamsExecutor(const IStreamsExecutor::Ptr& streamsExecutor) : _streamsExecutor{streamsExecutor} {}
void run(InferenceEngine::Task task) override {_streamsExecutor->Execute(std::move(task));}
IStreamsExecutor::Ptr _streamsExecutor;
};

public:
/**
Expand All @@ -78,14 +85,9 @@ class AsyncInferRequestThreadSafeDefault : public AsyncInferRequestThreadSafeInt
_requestExecutor {taskExecutor},
_callbackExecutor {callbackExecutor},
_pipeline {{taskExecutor, [this] {_syncRequest->Infer();}}},
_syncPipeline{{std::make_shared<ImmediateExecutor>(), [this] {_syncRequest->Infer();}}} {
_syncPipeline {{std::make_shared<ImmediateExecutor>(), [this] {_syncRequest->Infer();}}} {
auto streamsExecutor = std::dynamic_pointer_cast<IStreamsExecutor>(taskExecutor);
if (streamsExecutor != nullptr) {
struct ImmediateStreamsExecutor : public InferenceEngine::ITaskExecutor {
explicit ImmediateStreamsExecutor(const IStreamsExecutor::Ptr& streamsExecutor) : _streamsExecutor{streamsExecutor} {}
void run(InferenceEngine::Task task) override {_streamsExecutor->Execute(std::move(task));}
IStreamsExecutor::Ptr _streamsExecutor;
};
_syncPipeline = {{std::make_shared<ImmediateStreamsExecutor>(std::move(streamsExecutor)), [this] {_syncRequest->Infer();}}};
}
}
Expand Down

0 comments on commit d617f1c

Please sign in to comment.