Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPUW] Move e2e tests from unit to functional (#34293)

Alexandru Enacheda8a161ef6d1
diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.cpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.cpp
index 2ca4658a75f..85515d0a6c8 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.cpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.cpp
@@ -4,7 +4,6 @@
#include "behavior_tests.hpp"
#include "test_engine/comparators/nrmse.hpp"
-#include "openvino/util/shared_object.hpp"
#include "openvino/util/file_util.hpp"
#include <filesystem>
@@ -75,7 +74,7 @@ TEST_F(BehaviorTestsNPUW, TestInfrastructureIsCorrect) {
}
TEST_F(BehaviorTestsNPUW, CompilationIsSuccessful) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1));
@@ -90,7 +89,7 @@ TEST_F(BehaviorTestsNPUW, CompilationIsSuccessful) {
}
TEST_F(BehaviorTestsNPUW, CompilationIsFailSafe) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
{
@@ -109,7 +108,7 @@ TEST_F(BehaviorTestsNPUW, CompilationIsFailSafe) {
}
TEST_F(BehaviorTestsNPUW, CompilationIsFailed) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1), THROW("Compilation on MockNPU is failed"));
@@ -124,7 +123,7 @@ TEST_F(BehaviorTestsNPUW, CompilationIsFailed) {
}
TEST_F(BehaviorTestsNPUW, InferRequestCreationIsSuccessful) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1));
@@ -141,7 +140,7 @@ TEST_F(BehaviorTestsNPUW, InferRequestCreationIsSuccessful) {
}
TEST_F(BehaviorTestsNPUW, InferRequestCreationIsFailSafe) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
{
@@ -162,7 +161,7 @@ TEST_F(BehaviorTestsNPUW, InferRequestCreationIsFailSafe) {
}
TEST_F(BehaviorTestsNPUW, InferRequestCreationIsFailed) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1));
@@ -180,7 +179,7 @@ TEST_F(BehaviorTestsNPUW, InferRequestCreationIsFailed) {
}
TEST_F(BehaviorTestsNPUW, InferIsSuccessful) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1));
@@ -199,7 +198,7 @@ TEST_F(BehaviorTestsNPUW, InferIsSuccessful) {
}
TEST_F(BehaviorTestsNPUW, InferIsFailSafe) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
{
@@ -223,7 +222,7 @@ TEST_F(BehaviorTestsNPUW, InferIsFailSafe) {
}
TEST_F(BehaviorTestsNPUW, InferIsFailed) {
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1));
@@ -244,7 +243,7 @@ TEST_F(BehaviorTestsNPUW, InferIsFailed) {
using BehaviorTestsNPUWOnlinePartitioning = BehaviorTestsNPUW;
TEST_F(BehaviorTestsNPUWOnlinePartitioning, CompilationIsSuccessful) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(12));
@@ -260,7 +259,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, CompilationIsSuccessful) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, CompilationIsFailSafe) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
{
InSequence s;
@@ -281,7 +280,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, CompilationIsFailSafe) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, CompilationIsFailed) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1), THROW("Compilation on MockNPU is failed"));
@@ -297,7 +296,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, CompilationIsFailed) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferRequestCreationIsSuccessful) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(12));
@@ -318,7 +317,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferRequestCreationIsSuccessful) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferRequestCreationIsFailSafe) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
{
InSequence s;
@@ -344,7 +343,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferRequestCreationIsFailSafe) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferRequestCreationIsFailed) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(12));
@@ -366,7 +365,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferRequestCreationIsFailed) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferIsSuccessful) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(12));
@@ -389,7 +388,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferIsSuccessful) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferIsFailSafe) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
{
@@ -420,7 +419,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferIsFailSafe) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferIsFailed) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
{
@@ -448,7 +447,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, InferIsFailed) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, RepeatedBlocksAreFolded) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
{
@@ -480,7 +479,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, RepeatedBlocksAreFolded) {
}
TEST_F(BehaviorTestsNPUWOnlinePartitioning, FoldingAndPipelining) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
{
@@ -525,7 +524,7 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, FoldingAndPipelining) {
using BehaviorTestsNPUWOfflinePartitioning = BehaviorTestsNPUW;
TEST_F(BehaviorTestsNPUWOfflinePartitioning, CompilationIsSuccessful) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
// For plan generation and execution (twice compiled):
@@ -554,7 +553,7 @@ TEST_F(BehaviorTestsNPUWOfflinePartitioning, CompilationIsSuccessful) {
}
TEST_F(BehaviorTestsNPUWOfflinePartitioning, InferRequestCreationIsSuccessful) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
// For plan generation and execution (twice compiled):
@@ -589,7 +588,7 @@ TEST_F(BehaviorTestsNPUWOfflinePartitioning, InferRequestCreationIsSuccessful) {
}
TEST_F(BehaviorTestsNPUWOfflinePartitioning, InferIsSuccessful) {
- model = model_generator.get_model_with_repeated_blocks();
+ model = model_builder.get_model_with_repeated_blocks();
// Set expectations first:
// For plan generation and execution (twice compiled):
@@ -638,8 +637,8 @@ TEST(BehaviorTestsNPUWAccuracy, RepAndNonePartPipesGiveSameResults) {
core.register_plugin(plugin_path, ov::test::utils::DEVICE_TEMPLATE);
// Create model:
- ModelGenerator model_generator;
- const auto &model = model_generator.get_model_with_repeated_blocks(32);
+ ov::test::npuw::ModelBuilder model_builder;
+ const auto &model = model_builder.get_model_with_repeated_blocks(32);
// Do the test:
ov::AnyMap online_rep_props { ::ov::intel_npu::use_npuw(true),
@@ -671,7 +670,7 @@ TEST(BehaviorTestsNPUWAccuracy, RepAndNonePartPipesGiveSameResults) {
TEST_F(BehaviorTestsNPUW, CanSayNoToPMMProperty) {
// Create model:
- model = model_generator.get_model_with_one_op();
+ model = model_builder.get_model_with_one_op();
// Set expectation to npu plugin:
EXPECT_COMPILE_MODEL(mock_npu, TIMES(1));
diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.hpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.hpp
index 3814022cff5..99b5409f8ee 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.hpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/npuw/behavior_tests.hpp
@@ -8,7 +8,7 @@
#include <memory>
#include <random>
-#include "test_engine/models/model_generator.hpp"
+#include "test_engine/models/model_builder.hpp"
#include "test_engine/mocks/mock_plugins.hpp"
#include "test_engine/mocks/register_in_ov.hpp"
#include "intel_npu/npuw_private_properties.hpp"
@@ -28,7 +28,7 @@ public:
ov::AnyMap use_npuw_props;
std::shared_ptr<ov::Model> model;
- ModelGenerator model_generator;
+ test::npuw::ModelBuilder model_builder;
void SetUp() override {
mock_npu_plugin = std::make_shared<MockNpuPlugin>();
diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/serialization.cpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/serialization.cpp
new file mode 100644
index 00000000000..1c80b96f5c3
--- /dev/null
+++ b/src/plugins/intel_npu/tests/functional/behavior/npuw/serialization.cpp
@@ -0,0 +1,81 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gtest/gtest.h>
+
+#include "npuw/test_engine/models/model_builder.hpp"
+#include "openvino/core/parallel.hpp"
+
+using ov::test::npuw::ModelBuilder;
+
+// FIXME: parametrize all the tests below
+
+TEST(SerializationTestNPUW, Stress_ParallelImport) {
+ // Only run this test on NPU device
+ ov::Core ov_core;
+ auto core_devices = ov_core.get_available_devices();
+ if (std::find(core_devices.begin(), core_devices.end(), "NPU") == core_devices.end()) {
+ GTEST_SKIP() << "No available devices.";
+ }
+
+ // Device
+ const std::string device = "NPU";
+
+ // Create model
+ ModelBuilder mb;
+ auto model1 = mb.get_model_with_repeated_blocks();
+ auto model2 = mb.get_model_with_repeated_blocks();
+ auto model3 = mb.get_model_with_repeated_blocks();
+ auto model4 = mb.get_model_with_repeated_blocks();
+
+ // NPUW config
+ ov::AnyMap config = {{"NPU_USE_NPUW", "YES"},
+ {"NPUW_FUNCALL_FOR_ALL", "YES"},
+ {"NPUW_DEVICES", "NPU"},
+ {"NPUW_FOLD", "YES"},
+ // FIXME: enable once proper model for weights sharing is available
+ // (go through LLMCompiledModel). Otherwise we hit a case
+ // where bank reads same weights several times, in which
+ // case an assert is triggered.
+ // {"NPUW_WEIGHTS_BANK", "shared"},
+
+ // FIXME: test weightless mode once proper model with actual weights
+ // is available in tests.
+ {"CACHE_MODE", "OPTIMIZE_SPEED"}};
+
+ // Run stress test to check for data race
+ for (size_t i = 0; i < 10; ++i) {
+ // Compile NPUW
+ auto compiled1 = ov_core.compile_model(model1, device, config);
+ auto compiled2 = ov_core.compile_model(model2, device, config);
+ auto compiled3 = ov_core.compile_model(model3, device, config);
+ auto compiled4 = ov_core.compile_model(model4, device, config);
+
+ // Create infer request and infer
+ auto request1 = compiled1.create_infer_request();
+ request1.infer();
+ auto request2 = compiled2.create_infer_request();
+ request2.infer();
+ auto request3 = compiled3.create_infer_request();
+ request3.infer();
+ auto request4 = compiled4.create_infer_request();
+ request4.infer();
+
+ std::vector<std::stringstream> ss(4);
+ compiled1.export_model(ss[0]);
+ compiled2.export_model(ss[1]);
+ compiled3.export_model(ss[2]);
+ compiled4.export_model(ss[3]);
+
+ std::vector<ov::CompiledModel> imported(4);
+ ov::parallel_for(4, [&](size_t idx) {
+ imported[idx] = ov_core.import_model(ss[idx], "NPU");
+ });
+
+ for (auto& m : imported) {
+ auto r = m.create_infer_request();
+ r.infer();
+ }
+ }
+}
diff --git a/src/plugins/intel_npu/tests/unit/npuw/set_tensor.cpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/set_tensor.cpp
similarity index 98%
rename from src/plugins/intel_npu/tests/unit/npuw/set_tensor.cpp
rename to src/plugins/intel_npu/tests/functional/behavior/npuw/set_tensor.cpp
index 1eede133621..5b1846af810 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/set_tensor.cpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/npuw/set_tensor.cpp
@@ -4,10 +4,7 @@
#include <gtest/gtest.h>
-#include <iostream>
-
-#include "model_builder/model_builder.hpp"
-#include "openvino/openvino.hpp"
+#include "npuw/test_engine/models/model_builder.hpp"
using ov::test::npuw::ModelBuilder;
diff --git a/src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_builder.cpp
similarity index 100%
rename from src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
rename to src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_builder.cpp
diff --git a/src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.hpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_builder.hpp
similarity index 100%
rename from src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.hpp
rename to src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_builder.hpp
diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_generator.cpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_generator.cpp
deleted file mode 100644
index 95f5a8c5db5..00000000000
--- a/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_generator.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#include "model_generator.hpp"
-
-#include "openvino/openvino.hpp"
-#include "openvino/opsets/opset11.hpp"
-#include "openvino/op/ops.hpp"
-
-
-std::shared_ptr<ov::Model> ModelGenerator::get_model_with_one_op() {
- auto param = std::make_shared<ov::opset11::Parameter>(ov::element::i64, ov::PartialShape{1, 3, 2, 2});
- param->set_friendly_name("input");
- auto const_value = ov::opset11::Constant::create(ov::element::i64, ov::Shape{1, 1, 1, 1}, {1});
- const_value->set_friendly_name("const_val");
- auto add = std::make_shared<ov::opset11::Add>(param, const_value);
- add->set_friendly_name("add");
- auto result = std::make_shared<ov::opset11::Result>(add);
- result->set_friendly_name("res");
- return std::make_shared<ov::Model>(ov::ResultVector{result}, ov::ParameterVector{param});
-}
-
-std::shared_ptr<ov::Model> ModelGenerator::get_model_without_repeated_blocks() {
- std::shared_ptr<ov::op::v0::Parameter> input = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{1, 1, 40});
- m_nodes.push_back(input);
- set_name(input);
-
- std::shared_ptr<ov::Node> res = get_block(input);
-
- auto result = std::make_shared<ov::op::v0::Result>(res);
- m_nodes.push_back(result);
- set_name(result);
-
- ov::ParameterVector params = {input};
- ov::ResultVector results = {result};
-
- return std::make_shared<ov::Model>(results, params);
-}
-
-std::shared_ptr<ov::Model> ModelGenerator::get_model_with_repeated_blocks(std::size_t repetitions) {
- // Generate head
- std::shared_ptr<ov::op::v0::Parameter> input = std::make_shared<ov::op::v0::Parameter>(ov::element::i32, ov::Shape{1, 1, 40});
- m_nodes.push_back(input);
- set_name(input);
-
- std::vector<std::shared_ptr<ov::Node>> head(7, nullptr);
- head[0] = std::make_shared<ov::op::v1::Add>(input, input);
- head[1] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{1}, std::vector<int>{2});
- head[2] = std::make_shared<ov::op::v1::Divide>(head[0], head[1], true);
- head[3] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, std::vector<int>{1, 1, 4, 10});
- head[4] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{3}, std::vector<int>{1, 1, 40});
- head[5] = std::make_shared<ov::op::v1::Reshape>(head[2], head[3], false);
- head[6] = std::make_shared<ov::op::v1::Reshape>(head[5], head[4], false);
-
- for (const auto& h : head) {
- m_nodes.push_back(h);
- set_name(h);
- }
-
- // Generate repeated blocks
- std::shared_ptr<ov::Node> output = get_block(head[6]);
- std::vector<std::shared_ptr<ov::Node>> outputs;
- outputs.push_back(output);
-
- for (size_t i = 0; i < repetitions - 1; ++i) {
- output = get_block(output);
- outputs.push_back(output);
- }
-
- // Generate tail
- std::vector<std::shared_ptr<ov::Node>> tail(6, nullptr);
- tail[0] = std::make_shared<ov::op::v0::Concat>(outputs, -1);
- tail[1] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{3}, std::vector<int>{1, 40, int(repetitions)});
- tail[2] = std::make_shared<ov::op::v1::Reshape>(tail[0], tail[1], false);
- tail[3] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{1, 1, 1});
- tail[4] = std::make_shared<ov::op::v1::Multiply>(tail[2], tail[3]);
- tail[5] = std::make_shared<ov::op::v1::Add>(tail[4], tail[4]);
-
- for (const auto& t : tail) {
- m_nodes.push_back(t);
- set_name(t);
- }
-
- // Create model
- auto result = std::make_shared<ov::op::v0::Result>(tail[5]);
- m_nodes.push_back(result);
- set_name(result);
-
- ov::ParameterVector params = {input};
- ov::ResultVector results = {result};
-
- return std::make_shared<ov::Model>(results, params);
-}
-
-std::shared_ptr<ov::Model> ModelGenerator::get_model_with_repeated_blocks() {
- return get_model_with_repeated_blocks(10);
-}
-
-std::shared_ptr<ov::Node> ModelGenerator::get_block(const std::shared_ptr<ov::Node>& input) {
- // Parameters
- // input
-
- // Constants
- std::vector<std::shared_ptr<ov::Node>> model_c(18, nullptr);
- model_c[0] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{4}, std::vector<int>{0, 2, 1, 3});
- model_c[1] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int>{1});
- model_c[2] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int>{0});
- model_c[3] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int>{2});
- model_c[4] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int>{0});
- model_c[5] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, std::vector<int>{1, 1, 1, 1});
- model_c[6] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int>{1});
- model_c[7] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{1}, std::vector<int>{0});
- model_c[8] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, std::vector<int>{1, 1, 1, 1});
- model_c[9] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{4}, std::vector<int>{1, 1, 1, 2});
- model_c[10] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{4}, std::vector<int>{1, 1, 1, 1});
- model_c[11] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{4}, std::vector<int>{1, 1, 1, 2});
- model_c[12] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{1, 1, 1, 1});
- model_c[13] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{1, 1, 1, 1});
- model_c[14] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{1, 1, 1, 1});
- model_c[15] = std::make_shared<ov::op::v0::Constant>(ov::element::f32, ov::Shape{40, 40});
- model_c[16] = std::make_shared<ov::op::v0::Constant>(ov::element::i64, ov::Shape{4}, std::vector<int>{1, 1, 4, 10});
- model_c[17] = std::make_shared<ov::op::v0::Constant>(ov::element::i32, ov::Shape{3}, std::vector<int>{1, 1, 40});
-
- for (const auto& c : model_c) {
- m_nodes.push_back(c);
- set_name(c);
- }
-
- // Converts
- std::vector<std::shared_ptr<ov::Node>> convert(3, nullptr);
- convert[0] = std::make_shared<ov::op::v0::Convert>(model_c[15], ov::element::f16);
- convert[1] = std::make_shared<ov::op::v0::Convert>(convert[0], ov::element::i32);
- convert[2] = std::make_shared<ov::op::v0::Convert>(model_c[12], ov::element::i32);
-
- for (const auto& c : convert) {
- m_nodes.push_back(c);
- set_name(c);
- }
-
- // Ops
- std::vector<std::shared_ptr<ov::Node>> op(16, nullptr);
- op[0] = std::make_shared<ov::op::v0::MatMul>(input, convert[1], false, true);
- op[1] = std::make_shared<ov::op::v1::Reshape>(op[0], model_c[16], false);
- op[2] = std::make_shared<ov::op::v1::Transpose>(op[1], model_c[0]);
- op[3] = std::make_shared<ov::op::v0::ShapeOf>(op[2]);
- op[4] = std::make_shared<ov::op::v1::Gather>(op[3], model_c[1], model_c[2]);
- op[5] = std::make_shared<ov::op::v1::Divide>(op[4], model_c[3], true);
- op[6] = std::make_shared<ov::op::v0::Floor>(op[5]);
- op[7] = std::make_shared<ov::op::v3::ScatterUpdate>(model_c[5], model_c[6], op[6], model_c[7]);
- op[8] = std::make_shared<ov::op::v1::StridedSlice>(op[2],
- model_c[8],
- op[7],
- model_c[9],
- std::vector<int64_t>{1, 1, 1, 1},
- std::vector<int64_t>{1, 1, 1, 1});
- op[9] = std::make_shared<ov::op::v1::StridedSlice>(op[2],
- op[7],
- model_c[10],
- model_c[11],
- std::vector<int64_t>{1, 1, 1, 1},
- std::vector<int64_t>{1, 1, 1, 1});
- op[10] = std::make_shared<ov::op::v1::Multiply>(op[9], convert[2]);
- op[11] = std::make_shared<ov::op::v0::Concat>(std::vector<std::shared_ptr<ov::Node>>{op[10], op[8]}, -1);
- op[12] = std::make_shared<ov::op::v1::Multiply>(model_c[13], op[11]);
- op[13] = std::make_shared<ov::op::v1::Multiply>(model_c[14], op[2]);
- op[14] = std::make_shared<ov::op::v1::Add>(op[13], op[12]);
- op[15] = std::make_shared<ov::op::v1::Reshape>(op[14], model_c[17], false);
-
- for (const auto& o : op) {
- m_nodes.push_back(o);
- set_name(o);
- }
-
- return op[15];
-}
-
-void ModelGenerator::set_name(const std::shared_ptr<ov::Node>& node) {
- node->set_friendly_name("node_" + std::to_string(m_name_idx++));
-}
diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_generator.hpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_generator.hpp
deleted file mode 100644
index 41e3ce5e097..00000000000
--- a/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_generator.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2018-2026 Intel Corporation
-// SPDX-License-Identifier: Apache-2.0
-//
-
-#pragma once
-
-#include "openvino/openvino.hpp"
-
-class ModelGenerator {
-public:
- ModelGenerator() = default;
-
- std::shared_ptr<ov::Model> get_model_with_one_op();
- std::shared_ptr<ov::Model> get_model_without_repeated_blocks();
- std::shared_ptr<ov::Model> get_model_with_repeated_blocks(std::size_t repetitions);
- std::shared_ptr<ov::Model> get_model_with_repeated_blocks();
-
-private:
- std::shared_ptr<ov::Node> get_block(const std::shared_ptr<ov::Node>& input);
- void set_name(const std::shared_ptr<ov::Node>& node);
-
-private:
- std::vector<std::shared_ptr<ov::Node>> m_nodes;
- size_t m_name_idx;
-};
diff --git a/src/plugins/intel_npu/tests/unit/CMakeLists.txt b/src/plugins/intel_npu/tests/unit/CMakeLists.txt
index 8d9d325ec22..0a184f1952a 100644
--- a/src/plugins/intel_npu/tests/unit/CMakeLists.txt
+++ b/src/plugins/intel_npu/tests/unit/CMakeLists.txt
@@ -25,11 +25,11 @@ ov_add_test_target(
INCLUDES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/npuw
- ${CMAKE_CURRENT_SOURCE_DIR}/npuw/model_builder
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/utils/include
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/include
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/al/include
+ ${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models
OBJECT_FILES
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/src/metadata.cpp
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model_utils.cpp
@@ -47,6 +47,7 @@ ov_add_test_target(
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw/moe_transformations/moe_unroll_patterns.cpp
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw/moe_transformations/device_routed_moe_transform.cpp
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw/moe_transformations/gather_to_2d_gather.cpp
+ ${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/tests/functional/behavior/npuw/test_engine/models/model_builder.cpp
LINK_LIBRARIES
${MANDATORY_UNIT_TESTS_LIBS}
LABELS
diff --git a/src/plugins/intel_npu/tests/unit/npuw/online_partitioning.cpp b/src/plugins/intel_npu/tests/unit/npuw/online_partitioning.cpp
index 0485a3a84db..d0ce835c095 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/online_partitioning.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/online_partitioning.cpp
@@ -8,7 +8,7 @@
#include "intel_npu/config/config.hpp"
#include "intel_npu/config/npuw.hpp"
-#include "model_builder/model_builder.hpp"
+#include "model_builder.hpp"
#include "openvino/op/ops.hpp"
#include "openvino/op/util/op_types.hpp"
#include "openvino/openvino.hpp"
diff --git a/src/plugins/intel_npu/tests/unit/npuw/serialization.cpp b/src/plugins/intel_npu/tests/unit/npuw/serialization.cpp
index c9b658bbc6b..f5d06210607 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/serialization.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/serialization.cpp
@@ -11,7 +11,7 @@
#include "compiled_model.hpp"
#include "intel_npu/config/config.hpp"
#include "intel_npu/config/npuw.hpp"
-#include "model_builder/model_builder.hpp"
+#include "model_builder.hpp"
#include "openvino/core/parallel.hpp"
#include "openvino/openvino.hpp"
#include "spatial.hpp"
@@ -289,73 +289,4 @@ TEST(SerializationTest, OVTypes_Tensor_with_weights) {
EXPECT_EQ(data, data_res);
}
-TEST(SerializationTest, Stress_ParallelImport) {
- // Only run this test on NPU device
- ov::Core ov_core;
- auto core_devices = ov_core.get_available_devices();
- if (std::find(core_devices.begin(), core_devices.end(), "NPU") == core_devices.end()) {
- GTEST_SKIP() << "No available devices.";
- }
-
- // Device
- const std::string device = "NPU";
-
- // Create model
- ModelBuilder mb;
- auto model1 = mb.get_model_with_repeated_blocks();
- auto model2 = mb.get_model_with_repeated_blocks();
- auto model3 = mb.get_model_with_repeated_blocks();
- auto model4 = mb.get_model_with_repeated_blocks();
-
- // NPUW config
- ov::AnyMap config = {{"NPU_USE_NPUW", "YES"},
- {"NPUW_FUNCALL_FOR_ALL", "YES"},
- {"NPUW_DEVICES", "NPU"},
- {"NPUW_FOLD", "YES"},
- // FIXME: enable once proper model for weights sharing is available
- // (go through LLMCompiledModel). Otherwise we hit a case
- // where bank reads same weights several times, in which
- // case an assert is triggered.
- // {"NPUW_WEIGHTS_BANK", "shared"},
-
- // FIXME: test weightless mode once proper model with actual weights
- // is available in tests.
- {"CACHE_MODE", "OPTIMIZE_SPEED"}};
-
- // Run stress test to check for data race
- for (size_t i = 0; i < 10; ++i) {
- // Compile NPUW
- auto compiled1 = ov_core.compile_model(model1, device, config);
- auto compiled2 = ov_core.compile_model(model2, device, config);
- auto compiled3 = ov_core.compile_model(model3, device, config);
- auto compiled4 = ov_core.compile_model(model4, device, config);
-
- // Create infer request and infer
- auto request1 = compiled1.create_infer_request();
- request1.infer();
- auto request2 = compiled2.create_infer_request();
- request2.infer();
- auto request3 = compiled3.create_infer_request();
- request3.infer();
- auto request4 = compiled4.create_infer_request();
- request4.infer();
-
- std::vector<std::stringstream> ss(4);
- compiled1.export_model(ss[0]);
- compiled2.export_model(ss[1]);
- compiled3.export_model(ss[2]);
- compiled4.export_model(ss[3]);
-
- std::vector<ov::CompiledModel> imported(4);
- ov::parallel_for(4, [&](size_t idx) {
- imported[idx] = ov_core.import_model(ss[idx], "NPU");
- });
-
- for (auto& m : imported) {
- auto r = m.create_infer_request();
- r.infer();
- }
- }
-}
-
// TODO: add tests on CompiledModel and LLMCompiledModel once tests have access to any model to test on