Reverted to atomic flag on the load completion + GetGraph that will wait for graph to be loaded (as opposite to assuming it is loaded) (#7629)
This commit is contained in:
parent
f8618b75a9
commit
fdc125118e
@ -133,7 +133,7 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::CNNNetwork &network,
|
||||
}
|
||||
}
|
||||
|
||||
MKLDNNExecNetwork::Graph::Lock MKLDNNExecNetwork::GetGraph() {
|
||||
MKLDNNExecNetwork::Graph::Lock MKLDNNExecNetwork::GetGraph() const {
|
||||
int streamId = 0;
|
||||
int numaNodeId = 0;
|
||||
auto streamsExecutor = dynamic_cast<InferenceEngine::IStreamsExecutor*>(_taskExecutor.get());
|
||||
@ -167,19 +167,6 @@ MKLDNNExecNetwork::Graph::Lock MKLDNNExecNetwork::GetGraph() {
|
||||
return graphLock;
|
||||
}
|
||||
|
||||
MKLDNNExecNetwork::Graph::Lock MKLDNNExecNetwork::GetGraph() const {
|
||||
int streamId = 0;
|
||||
int numaNodeId = 0;
|
||||
auto streamsExecutor = dynamic_cast<InferenceEngine::IStreamsExecutor*>(_taskExecutor.get());
|
||||
if (nullptr != streamsExecutor) {
|
||||
streamId = streamsExecutor->GetStreamId();
|
||||
numaNodeId = streamsExecutor->GetNumaNodeId();
|
||||
}
|
||||
auto graphLock = Graph::Lock(_graphs[streamId % _graphs.size()]);
|
||||
IE_ASSERT(graphLock._graph.IsReady());
|
||||
return graphLock;
|
||||
}
|
||||
|
||||
void MKLDNNExecNetwork::setProperty(const std::map<std::string, std::string> &properties) {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock{_cfgMutex};
|
||||
|
@ -50,7 +50,7 @@ protected:
|
||||
MKLDNNExtensionManager::Ptr extensionManager;
|
||||
std::vector<InferenceEngine::IVariableStateInternal::Ptr> memoryStates;
|
||||
const InferenceEngine::CNNNetwork _network;
|
||||
std::mutex _cfgMutex;
|
||||
mutable std::mutex _cfgMutex;
|
||||
Config _cfg;
|
||||
std::atomic_int _numRequests = {0};
|
||||
std::string _name;
|
||||
@ -70,7 +70,6 @@ protected:
|
||||
* NOTE: Main thread is interpreted as master thread of external stream so use this function to get access to graphs
|
||||
* even from main thread
|
||||
*/
|
||||
Graph::Lock GetGraph();
|
||||
Graph::Lock GetGraph() const;
|
||||
|
||||
|
||||
|
@ -170,7 +170,7 @@ private:
|
||||
NetworkPromise _cpuPromise;
|
||||
mutable NetworkFuture _acceleratorFuture;
|
||||
mutable NetworkPromise _acceleratorPromise;
|
||||
mutable bool _alreadyActualNetwork = {false};
|
||||
mutable std::atomic<bool> _alreadyActualNetwork = {false};
|
||||
bool _workModeIsAUTO = {false};
|
||||
DeviceInformation _cpuDevice;
|
||||
DeviceInformation _acceleratorDevice;
|
||||
|
Loading…
Reference in New Issue
Block a user