--- /dev/null
+// Copyright (C) 2018-2020 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "behavior/stress_tests.hpp"
+
+using namespace LayerTestsDefinitions;
+
+const unsigned int g_BugAllocationLimit = 10000;
+
+namespace {
+ INSTANTIATE_TEST_CASE_P(BehaviorTests, MultipleAllocations,
+ ::testing::Combine(
+ ::testing::Values(CommonTestUtils::DEVICE_MYRIAD),
+ ::testing::Values(g_BugAllocationLimit)),
+ MultipleAllocations::getTestCaseName);
+} // namespace
--- /dev/null
+// Copyright (C) 2018-2020 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#pragma once
+
+#include <tuple>
+#include <vector>
+#include <string>
+#include <memory>
+
+#include "functional_test_utils/layer_test_utils.hpp"
+
+namespace LayerTestsDefinitions {
+
+typedef std::tuple<
+ LayerTestsUtils::TargetDevice, // Device name
+ unsigned int // Allocations count
+> MultipleAllocationsParams;
+
+class MultipleAllocations : public testing::WithParamInterface<MultipleAllocationsParams>,
+ public LayerTestsUtils::LayerTestsCommon {
+public:
+ static std::string getTestCaseName(const testing::TestParamInfo<MultipleAllocationsParams>& obj);
+
+protected:
+ void SetUp() override;
+
+protected:
+ unsigned int m_allocationsCount = 0;
+};
+
+} // namespace LayerTestsDefinitions
--- /dev/null
+// Copyright (C) 2018-2020 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include "behavior/stress_tests.hpp"
+#include "ngraph_functions/subgraph_builders.hpp"
+
+namespace LayerTestsDefinitions {
+
+std::string MultipleAllocations::getTestCaseName(const testing::TestParamInfo<MultipleAllocationsParams>& obj) {
+ LayerTestsUtils::TargetDevice targetDevice;
+ unsigned int allocationsCount;
+
+ std::tie(targetDevice, allocationsCount) = obj.param;
+ std::ostringstream result;
+ result << "targetDevice=" << targetDevice << "_";
+ result << "allocationsCount=" << allocationsCount;
+ return result.str();
+}
+
+void MultipleAllocations::SetUp() {
+ std::tie(targetDevice, m_allocationsCount) = this->GetParam();
+ function = ngraph::builder::subgraph::makeSplitConvConcat();
+}
+
+TEST_P(MultipleAllocations, InferWorksCorrectAfterAllocations) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+
+ ConfigurePlugin();
+
+ InferenceEngine::CNNNetwork cnnNet(function);
+ auto ie = PluginCache::get().ie();
+
+ std::cout << "Load the network " << m_allocationsCount << " times..." << std::flush;
+ for (int i = 0; i < m_allocationsCount; ++i) {
+ ie->LoadNetwork(cnnNet, targetDevice);
+ }
+
+ std::cout << "\nCheck inference.\n";
+
+ // Experiments demonstrated that 10 cycles are enough to reproduce the issue
+ int infersCount = 10;
+ for (int j = 0; j < infersCount; ++j) {
+ LoadNetwork();
+
+ std::cout << "Infer(): " << j << std::flush;
+
+ Infer();
+ Validate();
+ }
+};
+
+} // namespace LayerTestsDefinitions