Revert "Sync GNA lib calls to avoid multi threads and plugins crash (#2435)" (#2538)

This reverts commit 0879938250.
This commit is contained in:
Andrey Babushkin
2020-10-05 18:11:14 +03:00
committed by GitHub
parent 05d70cfa43
commit 65a9e0c8f3
4 changed files with 2 additions and 34 deletions

View File

@@ -7,7 +7,6 @@
#include <map>
#include <string>
#include <cstring>
#include <mutex>
#include <vector>
#if GNA_LIB_VER == 2
@@ -25,8 +24,6 @@
#include "details/ie_exception.hpp"
#include "gna_plugin_log.hpp"
std::mutex GNADeviceHelper::acrossPluginsSync{};
uint8_t* GNADeviceHelper::alloc(uint32_t size_requested, uint32_t *size_granted) {
void * memPtr = nullptr;
#if GNA_LIB_VER == 1
@@ -65,7 +62,6 @@ uint32_t GNADeviceHelper::propagate(const intel_nnet_type_t *pNeuralNetwork,
return reqId;
}
#else
void GNADeviceHelper::setUpActiveList(const uint32_t requestConfigId, uint32_t layerIndex, uint32_t* ptr_active_indices, uint32_t num_active_indices) {
const auto status = Gna2RequestConfigEnableActiveList(requestConfigId, layerIndex, num_active_indices, ptr_active_indices);
checkGna2Status(status);
@@ -367,7 +363,6 @@ void GNADeviceHelper::checkStatus() const {
#endif
void GNADeviceHelper::open(uint8_t n_threads) {
std::unique_lock<std::mutex> lockGnaCalls{ acrossPluginsSync };
#if GNA_LIB_VER == 1
nGNAHandle = GNADeviceOpenSetThreads(&nGNAStatus, n_threads);
checkStatus();
@@ -384,7 +379,6 @@ void GNADeviceHelper::open(uint8_t n_threads) {
}
void GNADeviceHelper::close() {
std::unique_lock<std::mutex> lockGnaCalls{ acrossPluginsSync };
#if GNA_LIB_VER == 1
GNADeviceClose(nGNAHandle);
nGNAHandle = 0;
@@ -404,7 +398,6 @@ void GNADeviceHelper::close() {
}
void GNADeviceHelper::setOMPThreads(uint8_t const n_threads) {
std::unique_lock<std::mutex> lockGnaCalls{ acrossPluginsSync };
#if GNA_LIB_VER == 1
gmmSetThreads(n_threads);
#else

View File

@@ -6,7 +6,6 @@
#include <cstdint>
#include <memory>
#include <mutex>
#include <string>
#include <map>
#include <vector>
@@ -38,7 +37,6 @@ enum GnaWaitStatus : int {
* holds gna - style handle in RAII way
*/
class GNADeviceHelper {
static std::mutex acrossPluginsSync;
#if GNA_LIB_VER == 1
intel_gna_status_t nGNAStatus = GNA_NOERROR;
intel_gna_handle_t nGNAHandle = 0;
@@ -170,7 +168,6 @@ public:
void setOMPThreads(uint8_t const n_threads);
void initGnaPerfCounters() {
std::unique_lock<std::mutex> lockGnaCalls{ acrossPluginsSync };
#if GNA_LIB_VER == 1
nGNAPerfResults = {{0, 0, 0, 0, 0, 0, 0}, {0, 0}, {0, 0, 0}, {0, 0}};
nGNAPerfResultsTotal = {{0, 0, 0, 0, 0, 0, 0}, {0, 0}, {0, 0, 0}, {0, 0}};

View File

@@ -117,7 +117,8 @@ TEST_F(CoreThreadingTests, RegisterPlugins) {
}
// tested function: GetAvailableDevices, UnregisterPlugin
TEST_F(CoreThreadingTests, GetAvailableDevices) {
// TODO: some plugins initialization (e.g. GNA) failed during such stress-test scenario
TEST_F(CoreThreadingTests, DISABLED_GetAvailableDevices) {
InferenceEngine::Core ie;
runParallel([&] () {
std::vector<std::string> devices = ie.GetAvailableDevices();

View File

@@ -1,23 +0,0 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <behavior/core_threading_tests.hpp>
namespace {
Params params[] = {
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_GNA, {{ CONFIG_KEY(PERF_COUNT), CONFIG_VALUE(YES) }}},
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_HETERO, {{ "TARGET_FALLBACK", CommonTestUtils::DEVICE_GNA }}},
std::tuple<Device, Config>{ CommonTestUtils::DEVICE_MULTI, {{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES), CommonTestUtils::DEVICE_GNA }}},
};
} // namespace
INSTANTIATE_TEST_CASE_P(GNA, CoreThreadingTests, testing::ValuesIn(params), CoreThreadingTests::getTestCaseName);
INSTANTIATE_TEST_CASE_P(DISABLED_GNA, CoreThreadingTestsWithIterations,
testing::Combine(testing::ValuesIn(params),
testing::Values(2),
testing::Values(2)),
CoreThreadingTestsWithIterations::getTestCaseName);