Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GNA] stored request id for completed sync infer request in order to get status later using wait() #1458

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions inference-engine/src/gna_plugin/gna_infer_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ class GNAInferRequest : public InferenceEngine::AsyncInferRequestInternal {
void InferImpl() override {
// execute input pre-processing.
execDataPreprocessing(_inputs);
plg->Infer(_inputs, _outputs);
// result returned from sync infer wait method
auto result = plg->Infer(_inputs, _outputs);

// if result is false we are dealing with QoS feature
// if result is ok, next call to wait() will return Ok, if request not in gna_queue
if (!result) {
inferRequestIdx = -1;
} else {
inferRequestIdx = -2;
}
}

/**
Expand Down Expand Up @@ -92,7 +101,13 @@ class GNAInferRequest : public InferenceEngine::AsyncInferRequestInternal {
qosOK = plg->WaitFor(inferRequestIdx, millis_timeout);
}

return qosOK ? InferenceEngine::OK : InferenceEngine::INFER_NOT_STARTED;
if (qosOK) {
return InferenceEngine::OK;
} else {
// need to preserve invalid state here to avoid next Wait() from clearing it
inferRequestIdx = -1;
return InferenceEngine::INFER_NOT_STARTED;
}
}
};
} // namespace GNAPluginNS
8 changes: 4 additions & 4 deletions inference-engine/src/gna_plugin/gna_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ void GNAPlugin::Reset() {
graphCompiler.Reset();
}

void GNAPlugin::Infer(const InferenceEngine::Blob &input, InferenceEngine::Blob &output) {
bool GNAPlugin::Infer(const InferenceEngine::Blob &input, InferenceEngine::Blob &output) {
BlobMap bmInput;
BlobMap bmOutput;
if (inputsDataMap.size() != 1) {
Expand All @@ -1080,11 +1080,11 @@ void GNAPlugin::Infer(const InferenceEngine::Blob &input, InferenceEngine::Blob
bmInput[inputsDataMap.begin()->first] = std::shared_ptr<Blob>(const_cast<Blob*>(&input), [](Blob*){});
IE_ASSERT(!outputsDataMap.empty());
bmOutput[outputsDataMap.begin()->first] = std::shared_ptr<Blob>(&output, [](Blob*){});
Infer(bmInput, bmOutput);
return Infer(bmInput, bmOutput);
}

void GNAPlugin::Infer(const InferenceEngine::BlobMap &input, InferenceEngine::BlobMap &result) {
Wait(QueueInference(input, result));
bool GNAPlugin::Infer(const InferenceEngine::BlobMap &input, InferenceEngine::BlobMap &result) {
return Wait(QueueInference(input, result));
}

Blob::Ptr GNAPlugin::GetOutputBlob(const std::string& name, InferenceEngine::Precision precision) {
Expand Down
4 changes: 2 additions & 2 deletions inference-engine/src/gna_plugin/gna_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class GNAPlugin : public InferenceEngine::IInferencePluginInternal, public std::

void LoadNetwork(InferenceEngine::ICNNNetwork &network);

void Infer(const InferenceEngine::BlobMap &input, InferenceEngine::BlobMap &result);
bool Infer(const InferenceEngine::BlobMap &input, InferenceEngine::BlobMap &result);
void GetPerformanceCounts(std::map<std::string, InferenceEngine::InferenceEngineProfileInfo> &perfMap);
void AddExtension(InferenceEngine::IExtensionPtr extension) override;

Expand All @@ -107,7 +107,7 @@ class GNAPlugin : public InferenceEngine::IInferencePluginInternal, public std::
InferenceEngine::ExecutableNetwork LoadNetwork(const InferenceEngine::ICNNNetwork &network,
const std::map<std::string, std::string> &config_map,
InferenceEngine::RemoteContext::Ptr context) override { THROW_GNA_EXCEPTION << "Not implemented"; }
void Infer(const InferenceEngine::Blob &input, InferenceEngine::Blob &result);
bool Infer(const InferenceEngine::Blob &input, InferenceEngine::Blob &result);
void SetCore(InferenceEngine::ICore*) noexcept override {}
InferenceEngine::ICore* GetCore() const noexcept override {return nullptr;}
void Reset();
Expand Down