From 5eae256a3ac5a51c261c858f7b03e222ce2dd240 Mon Sep 17 00:00:00 2001 From: Bogdan Pereanu Date: Tue, 28 Jan 2025 14:13:33 +0200 Subject: [PATCH] Add new func test Signed-off-by: Bogdan Pereanu --- .../functional/behavior/infer_request_run.hpp | 30 +++++++++++++++++++ .../internal/overload/compile_and_infer.hpp | 12 ++++++++ 2 files changed, 42 insertions(+) diff --git a/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp index ab53a442c16cda..54590a7abe513f 100644 --- a/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp +++ b/src/plugins/intel_npu/tests/functional/behavior/infer_request_run.hpp @@ -170,6 +170,36 @@ TEST_P(InferRequestRunTests, MultipleExecutorStreamsTestsSyncInfers) { } } +TEST_P(InferRequestRunTests, MultipleCompiledModelsTestsSyncInfers) { + // Skip test according to plugin specific disabledTestPatterns() (if any) + SKIP_IF_CURRENT_TEST_IS_DISABLED() + // Load CNNNetwork to target plugins + const int no_of_iterations = 256; + std::array compiled_models; + + for (int i = 0; i < no_of_iterations; ++i) { + OV_ASSERT_NO_THROW(compiled_models[i] = core->compile_model(ov_model, target_device, configuration)); + } + + // Create InferRequests + std::array infer_reqs; + std::array infer_reqs_threads; + for (int i = 0; i < no_of_iterations; ++i) { + OV_ASSERT_NO_THROW(infer_reqs[i] = compiled_models[i].create_infer_request()); + } + + for (int i = 0; i < no_of_iterations; ++i) { + infer_reqs_threads[i] = std::thread([&infer_reqs, i]() -> void { + OV_ASSERT_NO_THROW(infer_reqs[i].infer()); + infer_reqs[i] = {}; + }); + } + + for (int i = 0; i < no_of_iterations; ++i) { + infer_reqs_threads[i].join(); + } +} + TEST_P(InferRequestRunTests, MultipleExecutorStreamsTestsAsyncInfers) { // Skip test according to plugin specific disabledTestPatterns() (if any) SKIP_IF_CURRENT_TEST_IS_DISABLED() diff --git a/src/plugins/intel_npu/tests/functional/internal/overload/compile_and_infer.hpp b/src/plugins/intel_npu/tests/functional/internal/overload/compile_and_infer.hpp index e3775ab13385bc..877eb6628f7645 100644 --- a/src/plugins/intel_npu/tests/functional/internal/overload/compile_and_infer.hpp +++ b/src/plugins/intel_npu/tests/functional/internal/overload/compile_and_infer.hpp @@ -250,6 +250,18 @@ TEST_P(OVCompileAndInferRequest, CompiledModelWorkloadTypeUpdateAfterCompilation OV_ASSERT_NO_THROW(req2.start_async()); OV_ASSERT_NO_THROW(req2.wait()); ASSERT_TRUE(isCalled); + + req1 = {}; + req2 = {}; + req3 = {}; + + OV_ASSERT_NO_THROW(req1 = execNet.create_infer_request()); + OV_ASSERT_NO_THROW(req2 = secondCompiledModel.create_infer_request()); + OV_ASSERT_NO_THROW(req1.infer()); + OV_ASSERT_NO_THROW(req3 = execNet.create_infer_request()); + OV_ASSERT_NO_THROW(req2.infer()); + OV_ASSERT_NO_THROW(req3.infer()); + OV_ASSERT_NO_THROW(req3.infer()); } }