OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Fixed tests for NPUW (#27060)
Anastasiya(Asya) Pronina485e5802ec8b
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.cppindex 093e3235afb..b55d39bead4 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@@ -489,30 +489,24 @@ TEST_F(BehaviorTestsNPUWOnlinePartitioning, FoldingAndPipelining) {EXPECT_COMPILE_MODEL(mock_cpu, TIMES(0));}- for (int i = 0; i < 3; i++) {- // Here we will create 2 infer requests per model,- // so `create_sync_infer_request()` should be called twice- // per model:- EXPECT_CREATE_SYNC_INFER_REQ(mock_npu, MODEL(i), TIMES(2));- }-- // 1st model 1st infer request is called once -- head- EXPECT_INFER_FOR(mock_npu, MODEL(0), INFER_REQ(0), TIMES(1));- // 1st model 2nd infer request is never called,- // it is not a function and is not repeated- EXPECT_INFER_FOR(mock_npu, MODEL(0), INFER_REQ(1), TIMES(0));+ // 1 infer request for head:+ EXPECT_CREATE_SYNC_INFER_REQ(mock_npu, MODEL(0), TIMES(1));+ // 2 infer requests for function, `create_sync_infer_request()`+ // should be called twice here:+ EXPECT_CREATE_SYNC_INFER_REQ(mock_npu, MODEL(1), TIMES(2));+ // 1 infer request for tail:+ EXPECT_CREATE_SYNC_INFER_REQ(mock_npu, MODEL(2), TIMES(1));++ // Head's infer request is called once:+ EXPECT_INFER(mock_npu, MODEL(0), TIMES(1));- // Repeated block- // 2nd model 1st infer request is called 5 times+ // Repeated block's model 1st infer request is called 5 times:EXPECT_INFER_FOR(mock_npu, MODEL(1), INFER_REQ(0), TIMES(5));- // 2nd model 2nd infer request (brother of 1st one) is called 5 times+ // Repeated block's model 2nd infer request (brother of 1st one) is called 5 times:EXPECT_INFER_FOR(mock_npu, MODEL(1), INFER_REQ(1), TIMES(5));- // 3rd model 1st infer request is called once -- tail- EXPECT_INFER_FOR(mock_npu, MODEL(2), INFER_REQ(0), TIMES(1));- // 3rd model 2nd infer request is never called,- // it is not a function and is not repeated- EXPECT_INFER_FOR(mock_npu, MODEL(2), INFER_REQ(1), TIMES(0));+ // Tail's infer request is called once:+ EXPECT_INFER(mock_npu, MODEL(2), TIMES(1));// Register mock objects as plugins in OpenVINO:register_mock_plugins_in_ov();diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.cpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.cppindex ed4bf72a945..4c6c470d81e 100644--- a/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.cpp+++ b/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.cpp@@ -245,7 +245,7 @@ void MockPluginBase<DeviceType>::create_implementation() {});ON_CALL(*this, get_default_context).WillByDefault([](const ov::AnyMap& remote_properties) -> ov::SoPtr<ov::IRemoteContext> {- OPENVINO_NOT_IMPLEMENTED;+ return std::make_shared<MockRemoteContext>(device_name);});ON_CALL(*this, import_model(testing::_, testing::_)).WillByDefault([](std::istream& model, const ov::AnyMap& properties)diff --git a/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.hpp b/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.hppindex 4d720796c6a..2cad81b6c13 100644--- a/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.hpp+++ b/src/plugins/intel_npu/tests/functional/behavior/npuw/mocks/mock_plugins.hpp@@ -23,6 +23,20 @@ namespace ov {namespace npuw {namespace tests {+class MockRemoteContext : public ov::IRemoteContext {+ std::string m_name;++public:+ MockRemoteContext(std::string name) : m_name(std::move(name)) {}+ const std::string& get_device_name() const override {+ return m_name;+ }+ MOCK_METHOD(ov::SoPtr<ov::IRemoteTensor>,+ create_tensor,+ (const ov::element::Type&, const ov::Shape&, const ov::AnyMap&));+ MOCK_METHOD(const ov::AnyMap&, get_property, (), (const));+};+class MockCompiledModelBase;using MockCompiledModel = testing::NiceMock<MockCompiledModelBase>;