From 467122229a0642102fa7a18beb82fde87f1c52f8 Mon Sep 17 00:00:00 2001 From: Egor Duplensky Date: Tue, 1 Jun 2021 09:45:00 +0300 Subject: [PATCH] [CPU] Add workaround for Ngraph OPs friendly name initialization (#5916) Otherwise they are initialized concurrently in scope of MKLDNNNode constructor without thread safety --- inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp index 356abff030b..315b61724d3 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_exec_network.cpp @@ -70,6 +70,13 @@ MKLDNNExecNetwork::MKLDNNExecNetwork(const InferenceEngine::CNNNetwork &network, _callbackExecutor = _taskExecutor; } + // Workaround for initializing friendly names for all the OPs + // Otherwise they are initialized concurrently without thread safety. + // TODO: Can be removed after 57069 is done. + for (const auto& op : _network.getFunction()->get_ops()) { + op->get_friendly_name(); + } + int streams = std::max(1, _cfg.streamExecutorConfig._streams); std::vector tasks; tasks.resize(streams); _graphs.resize(streams);