Skip to content

Commit

Permalink
CreateInferRequest uses the first graph for CPU Plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
xufang-lisa committed Oct 19, 2023
1 parent 30e68aa commit 30ec440
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/plugins/intel_cpu/src/exec_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ ExecNetwork::GraphGuard::Lock ExecNetwork::GetGraph() const {
return graphLock;
}

ExecNetwork::GraphGuard::Lock ExecNetwork::GetFirstGraph() const {
int streamId = 0;
auto streamsExecutor = dynamic_cast<InferenceEngine::IStreamsExecutor*>(_taskExecutor.get());
auto graphLock = GraphGuard::Lock(_graphs[streamId % _graphs.size()]);
if (!graphLock._graph.IsReady()) {
IE_THROW() << "graph is not ready";
}
return graphLock;
}

InferenceEngine::IInferRequestInternal::Ptr ExecNetwork::CreateInferRequest() {
return CreateAsyncInferRequestFromSync<AsyncInferRequest>();
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/intel_cpu/src/exec_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ExecNetwork: public InferenceEngine::ExecutableNetworkThreadSafeDefault {
* even from main thread
*/
GraphGuard::Lock GetGraph() const;
GraphGuard::Lock GetFirstGraph() const;

InferenceEngine::Parameter GetConfigLegacy(const std::string &name) const;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/infer_request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void InferRequestBase::CreateInferRequest() {

if (execNetwork->_graphs.size() == 0)
IE_THROW() << "No graph was found";
graph = &(execNetwork->GetGraph()._graph);
graph = &(execNetwork->GetFirstGraph()._graph);

initBlobs();

Expand Down

0 comments on commit 30ec440

Please sign in to comment.