Skip to content

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

Validate imported NPUW ORC routing metadata (#37492)

Alexis Menard97974745f25e
diff --git a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp
index be3078225b5..9ff9dd9c572 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.cpp
@@ -1396,10 +1396,152 @@ std::shared_ptr<ov::npuw::CompiledModel> ov::npuw::CompiledModel::deserialize_or
OPENVINO_THROW("Missing ORC weights bank container");
}
+ validate_import_routing_tables(compiled);
+
compiled->implement_properties();
return compiled;
}
+void ov::npuw::CompiledModel::validate_import_routing_tables(const std::shared_ptr<CompiledModel>& compiled) {
+ const auto num_submodels = compiled->m_compiled_submodels.size();
+
+ // The NO_LINK sentinel is only meaningful for global inputs (a Parameter may be unused by
+ // any submodel). Every other table is dereferenced without checking for it, so accepting the
+ // sentinel there would turn a malformed blob into an out-of-bounds access at infer-request time.
+ const auto ensure_submodel_index = [&](const char* table_name,
+ std::size_t owner_idx,
+ const char* field_name,
+ const auto& link,
+ bool allow_no_link) {
+ if (link == CompiledModel::NO_LINK) {
+ if (allow_no_link) {
+ return;
+ }
+ OPENVINO_THROW("Invalid ", table_name, "[", owner_idx, "] ", field_name, " link: NO_LINK is not allowed");
+ }
+ if (link.first >= num_submodels) {
+ OPENVINO_THROW("Invalid ",
+ table_name,
+ "[",
+ owner_idx,
+ "] ",
+ field_name,
+ " submodel index ",
+ link.first,
+ " (submodel count: ",
+ num_submodels,
+ ")");
+ }
+ };
+
+ const auto ensure_input_port_index =
+ [&](const char* table_name, std::size_t owner_idx, const auto& link, bool allow_no_link) {
+ ensure_submodel_index(table_name, owner_idx, "input", link, allow_no_link);
+ if (link == CompiledModel::NO_LINK) {
+ return;
+ }
+ const auto& submodel_desc = compiled->m_compiled_submodels.at(link.first);
+ if (submodel_desc.compiled_model != nullptr &&
+ link.second >= submodel_desc.compiled_model->inputs().size()) {
+ OPENVINO_THROW("Invalid ",
+ table_name,
+ "[",
+ owner_idx,
+ "] input port index ",
+ link.second,
+ " for submodel ",
+ link.first,
+ " (inputs: ",
+ submodel_desc.compiled_model->inputs().size(),
+ ")");
+ }
+ };
+
+ const auto ensure_output_port_index =
+ [&](const char* table_name, std::size_t owner_idx, const auto& link, bool allow_no_link) {
+ ensure_submodel_index(table_name, owner_idx, "output", link, allow_no_link);
+ if (link == CompiledModel::NO_LINK) {
+ return;
+ }
+ const auto& submodel_desc = compiled->m_compiled_submodels.at(link.first);
+ if (submodel_desc.compiled_model != nullptr &&
+ link.second >= submodel_desc.compiled_model->outputs().size()) {
+ OPENVINO_THROW("Invalid ",
+ table_name,
+ "[",
+ owner_idx,
+ "] output port index ",
+ link.second,
+ " for submodel ",
+ link.first,
+ " (outputs: ",
+ submodel_desc.compiled_model->outputs().size(),
+ ")");
+ }
+ };
+
+ for (std::size_t idx = 0u; idx < compiled->m_compiled_submodels.size(); ++idx) {
+ const auto& submodel_desc = compiled->m_compiled_submodels[idx];
+ if (submodel_desc.replaced_by.has_value() && submodel_desc.replaced_by.value() >= num_submodels) {
+ OPENVINO_THROW("Invalid m_compiled_submodels[",
+ idx,
+ "].replaced_by index ",
+ submodel_desc.replaced_by.value(),
+ " (submodel count: ",
+ num_submodels,
+ ")");
+ }
+ }
+
+ if (compiled->m_inputs_to_submodels_inputs.size() != compiled->inputs().size()) {
+ OPENVINO_THROW("Invalid m_inputs_to_submodels_inputs size ",
+ compiled->m_inputs_to_submodels_inputs.size(),
+ " (expected ",
+ compiled->inputs().size(),
+ ")");
+ }
+
+ if (compiled->m_outputs_to_submodels_outputs.size() != compiled->outputs().size()) {
+ OPENVINO_THROW("Invalid m_outputs_to_submodels_outputs size ",
+ compiled->m_outputs_to_submodels_outputs.size(),
+ " (expected ",
+ compiled->outputs().size(),
+ ")");
+ }
+
+ for (std::size_t idx = 0u; idx < compiled->m_inputs_to_submodels_inputs.size(); ++idx) {
+ ensure_input_port_index("m_inputs_to_submodels_inputs", idx, compiled->m_inputs_to_submodels_inputs[idx], true);
+ }
+
+ for (std::size_t idx = 0u; idx < compiled->m_outputs_to_submodels_outputs.size(); ++idx) {
+ ensure_output_port_index("m_outputs_to_submodels_outputs",
+ idx,
+ compiled->m_outputs_to_submodels_outputs[idx],
+ false);
+ }
+
+ for (const auto& kvp : compiled->m_param_subscribers) {
+ const auto input_idx = kvp.first;
+ if (input_idx >= compiled->m_inputs_to_submodels_inputs.size()) {
+ OPENVINO_THROW("Invalid m_param_subscribers key ",
+ input_idx,
+ " (inputs: ",
+ compiled->m_inputs_to_submodels_inputs.size(),
+ ")");
+ }
+ for (const auto& link_to : kvp.second) {
+ ensure_input_port_index("m_param_subscribers", input_idx, link_to, false);
+ }
+ }
+
+ std::size_t routing_idx = 0u;
+ for (const auto& kvp : compiled->m_submodels_input_to_prev_output) {
+ ensure_input_port_index("m_submodels_input_to_prev_output", routing_idx, kvp.first, false);
+ ensure_output_port_index("m_submodels_input_to_prev_output", routing_idx, kvp.second, false);
+ ++routing_idx;
+ }
+}
+
void ov::npuw::CompiledModel::serialize(std::ostream& stream, const ov::npuw::s11n::CompiledContext& enc_ctx) const {
if (enc_ctx.encrypted) {
NPUW_ASSERT(enc_ctx.encrypt && "Encryption function isn't provided!");
diff --git a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.hpp b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.hpp
index c5241808eea..9812443e588 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/compiled_model.hpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/compiled_model.hpp
@@ -113,6 +113,7 @@ public:
static std::shared_ptr<CompiledModel> import_model(std::istream& stream,
const std::shared_ptr<const ov::IPlugin>& plugin,
const ov::AnyMap& properties);
+ static void validate_import_routing_tables(const std::shared_ptr<CompiledModel>& compiled);
std::shared_ptr<const ov::Model> get_runtime_model() const override;
void set_property(const ov::AnyMap& properties) override;
diff --git a/src/plugins/intel_npu/src/plugin/npuw/just_sync_infer_request.cpp b/src/plugins/intel_npu/src/plugin/npuw/just_sync_infer_request.cpp
index 160ca987a67..e51eb1133c8 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/just_sync_infer_request.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/just_sync_infer_request.cpp
@@ -125,7 +125,7 @@ ov::npuw::MemAccessSim::MemAccessSim(const std::shared_ptr<ov::npuw::CompiledMod
m_remaining_reads[read_from]++;
// Record a read request for this particular Subgraph (who reads the Source)
- m_read_list[read_to.first].push_back(read_from);
+ m_read_list.at(read_to.first).push_back(read_from);
}
// 2. Global model's outputs
for (auto&& read_from : compiled_model->m_outputs_to_submodels_outputs) {
diff --git a/src/plugins/intel_npu/tests/unit/CMakeLists.txt b/src/plugins/intel_npu/tests/unit/CMakeLists.txt
index e844e170bb1..687abfde3ec 100644
--- a/src/plugins/intel_npu/tests/unit/CMakeLists.txt
+++ b/src/plugins/intel_npu/tests/unit/CMakeLists.txt
@@ -174,6 +174,7 @@ target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/npuw/pre_compute_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/npuw/resolve_dynamic_quant_storage_types_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/npuw/orc.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/npuw/compiled_model_orc_import_validation_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/npuw/sdpa_pattern_nodes_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/npuw/sdpa_pattern_matcher_test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/npuw/subgraph_pipeline.cpp
diff --git a/src/plugins/intel_npu/tests/unit/npuw/compiled_model_orc_import_validation_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/compiled_model_orc_import_validation_test.cpp
new file mode 100644
index 00000000000..669d7ffff0c
--- /dev/null
+++ b/src/plugins/intel_npu/tests/unit/npuw/compiled_model_orc_import_validation_test.cpp
@@ -0,0 +1,331 @@
+// Copyright (C) 2018-2026 Intel Corporation
+// SPDX-License-Identifier: Apache-2.0
+//
+
+#include <gtest/gtest.h>
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#define private public
+#include "compiled_model.hpp"
+#undef private
+
+#include "openvino/op/parameter.hpp"
+#include "openvino/op/result.hpp"
+#include "unit_test_utils/mocks/openvino/runtime/mock_icore.hpp"
+
+namespace {
+
+class TestPlugin final : public ov::IPlugin {
+public:
+ std::shared_ptr<ov::ICompiledModel> compile_model(const std::shared_ptr<const ov::Model>&,
+ const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::compile_model call");
+ }
+ std::shared_ptr<ov::ICompiledModel> compile_model(const std::shared_ptr<const ov::Model>&,
+ const ov::AnyMap&,
+ const ov::SoPtr<ov::IRemoteContext>&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::compile_model(context) call");
+ }
+ std::shared_ptr<ov::ICompiledModel> import_model(std::istream&, const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::import_model(stream) call");
+ }
+ std::shared_ptr<ov::ICompiledModel> import_model(std::istream&,
+ const ov::SoPtr<ov::IRemoteContext>&,
+ const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::import_model(stream, context) call");
+ }
+ std::shared_ptr<ov::ICompiledModel> import_model(const ov::Tensor&, const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::import_model(blob) call");
+ }
+ std::shared_ptr<ov::ICompiledModel> import_model(const ov::Tensor&,
+ const ov::SoPtr<ov::IRemoteContext>&,
+ const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::import_model(blob, context) call");
+ }
+ ov::SupportedOpsMap query_model(const std::shared_ptr<const ov::Model>&, const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::query_model call");
+ }
+ void set_property(const ov::AnyMap&) override {}
+ ov::Any get_property(const std::string&, const ov::AnyMap&) const override {
+ OPENVINO_THROW("Test plugin does not expose properties");
+ }
+ bool is_property_supported(const std::string&, const ov::AnyMap&) const override {
+ return false;
+ }
+ ov::SoPtr<ov::IRemoteContext> create_context(const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::create_context call");
+ }
+ ov::SoPtr<ov::IRemoteContext> get_default_context(const ov::AnyMap&) const override {
+ OPENVINO_THROW("Unexpected TestPlugin::get_default_context call");
+ }
+};
+
+class FakeSubCompiledModel final : public ov::ICompiledModel {
+public:
+ FakeSubCompiledModel(const std::shared_ptr<ov::Model>& model, const std::shared_ptr<const ov::IPlugin>& plugin)
+ : ov::ICompiledModel(model, plugin, nullptr, nullptr),
+ m_model(model) {}
+
+ void export_model(std::ostream&) const override {}
+ std::shared_ptr<const ov::Model> get_runtime_model() const override {
+ return m_model;
+ }
+ void set_property(const ov::AnyMap&) override {}
+ ov::Any get_property(const std::string&) const override {
+ return {};
+ }
+ std::shared_ptr<ov::ISyncInferRequest> create_sync_infer_request() const override {
+ return {};
+ }
+ std::shared_ptr<ov::IAsyncInferRequest> create_infer_request() const override {
+ return {};
+ }
+
+private:
+ std::shared_ptr<ov::Model> m_model;
+};
+
+std::shared_ptr<TestPlugin> make_test_plugin() {
+ auto plugin = std::make_shared<TestPlugin>();
+ auto core = std::make_shared<testing::NiceMock<ov::MockICore>>();
+
+ ON_CALL(*core, get_supported_property(testing::_, testing::_, testing::_))
+ .WillByDefault([](const std::string&, const ov::AnyMap& properties, const bool) {
+ return properties;
+ });
+ ON_CALL(*core, get_property(testing::_, testing::_, testing::_))
+ .WillByDefault([](const std::string&, const std::string& name, const ov::AnyMap&) -> ov::Any {
+ if (name == ov::available_devices.name()) {
+ return std::vector<std::string>{};
+ }
+ if (name == ov::intel_npu::compiler_version.name()) {
+ return int64_t{0};
+ }
+ if (name == ov::device::architecture.name()) {
+ return std::string{};
+ }
+ if (name == ov::supported_properties.name() || name == ov::internal::supported_properties.name()) {
+ return std::vector<ov::PropertyName>{};
+ }
+ return {};
+ });
+ ON_CALL(*core, get_property(testing::_, testing::_))
+ .WillByDefault([](const std::string&, const std::string& name) -> ov::Any {
+ if (name == ov::available_devices.name()) {
+ return std::vector<std::string>{};
+ }
+ if (name == ov::supported_properties.name()) {
+ return std::vector<ov::PropertyName>{};
+ }
+ if (name == ov::intel_npu::compiler_version.name()) {
+ return static_cast<int64_t>(0);
+ }
+ if (name == ov::device::architecture.name()) {
+ return std::string{};
+ }
+ return {};
+ });
+
+ plugin->set_core(core);
+ return plugin;
+}
+
+std::shared_ptr<ov::npuw::CompiledModel> make_compiled_model_with_input_link(
+ const std::pair<std::size_t, std::size_t>& input_link) {
+ auto param = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1});
+ param->output(0).get_tensor().set_names({"input"});
+ auto res = std::make_shared<ov::op::v0::Result>(param);
+ res->output(0).get_tensor().set_names({"output"});
+ auto model =
+ std::make_shared<ov::Model>(ov::OutputVector{res->output(0)}, ov::ParameterVector{param}, "test_model");
+
+ auto plugin = make_test_plugin();
+ auto compiled = std::make_shared<ov::npuw::CompiledModel>(model, plugin, true);
+
+ compiled->m_inputs_to_submodels_inputs = {input_link};
+ compiled->m_outputs_to_submodels_outputs = {{0u, 0u}};
+ compiled->m_param_subscribers.clear();
+ compiled->m_submodels_input_to_prev_output.clear();
+ compiled->m_dev_list.clear();
+ compiled->m_non_npuw_props.clear();
+ compiled->set_weights_bank(ov::npuw::weights::bank("test_bank", plugin->get_core(), ""));
+
+ return compiled;
+}
+
+std::shared_ptr<ov::Model> make_simple_model(const std::string& name) {
+ auto param = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::Shape{1});
+ auto res = std::make_shared<ov::op::v0::Result>(param);
+ return std::make_shared<ov::Model>(ov::OutputVector{res->output(0)}, ov::ParameterVector{param}, name);
+}
+
+void add_fake_submodel(const std::shared_ptr<ov::npuw::CompiledModel>& compiled) {
+ auto model = make_simple_model("fake_sub");
+ auto plugin = make_test_plugin();
+ ov::npuw::CompiledModel::CompiledModelDesc desc;
+ desc.compiled_model = ov::SoPtr<ov::ICompiledModel>{std::make_shared<FakeSubCompiledModel>(model, plugin)};
+ compiled->m_compiled_submodels.push_back(std::move(desc));
+}
+
+void expect_validation_throw_contains(const std::shared_ptr<ov::npuw::CompiledModel>& compiled,
+ const std::string& expected_substr) {
+ try {
+ ov::npuw::CompiledModel::validate_import_routing_tables(compiled);
+ FAIL() << "Expected ov::Exception containing: " << expected_substr;
+ } catch (const ov::Exception& ex) {
+ EXPECT_NE(std::string(ex.what()).find(expected_substr), std::string::npos) << ex.what();
+ }
+}
+
+TEST(CompiledModelOrcImportValidationTest, AcceptsNoLinkInputRouting) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+
+ ASSERT_NE(compiled, nullptr);
+ EXPECT_NO_THROW(ov::npuw::CompiledModel::validate_import_routing_tables(compiled));
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsInputRoutingToMissingSubmodel) {
+ auto compiled = make_compiled_model_with_input_link({0u, 0u});
+ expect_validation_throw_contains(compiled, "m_inputs_to_submodels_inputs[0] input submodel index 0");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsInputPortIndexOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link({0u, 1u});
+ add_fake_submodel(compiled);
+
+ expect_validation_throw_contains(compiled, "m_inputs_to_submodels_inputs[0] input port index 1");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsOutputRoutingToMissingSubmodel) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ compiled->m_outputs_to_submodels_outputs = {{0u, 0u}};
+
+ expect_validation_throw_contains(compiled, "m_outputs_to_submodels_outputs[0] output submodel index 0");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsOutputPortIndexOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_outputs_to_submodels_outputs = {{0u, 1u}};
+
+ expect_validation_throw_contains(compiled, "m_outputs_to_submodels_outputs[0] output port index 1");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsNoLinkOutputRouting) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_outputs_to_submodels_outputs = {ov::npuw::CompiledModel::NO_LINK};
+
+ expect_validation_throw_contains(compiled, "m_outputs_to_submodels_outputs[0] output link: NO_LINK is not allowed");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsReplacedByOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ compiled->m_compiled_submodels.emplace_back();
+ compiled->m_compiled_submodels[0].replaced_by = 1u;
+
+ expect_validation_throw_contains(compiled, "m_compiled_submodels[0].replaced_by index 1");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsInputsTableSizeMismatch) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ compiled->m_inputs_to_submodels_inputs.clear();
+
+ expect_validation_throw_contains(compiled, "Invalid m_inputs_to_submodels_inputs size 0");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsOutputsTableSizeMismatch) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ compiled->m_outputs_to_submodels_outputs.clear();
+
+ expect_validation_throw_contains(compiled, "Invalid m_outputs_to_submodels_outputs size 0");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsParamSubscribersKeyOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_param_subscribers = {{1u, {{0u, 0u}}}};
+
+ expect_validation_throw_contains(compiled, "Invalid m_param_subscribers key 1");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsNoLinkParamSubscriberEntry) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_param_subscribers = {{0u, {ov::npuw::CompiledModel::NO_LINK}}};
+
+ expect_validation_throw_contains(compiled, "m_param_subscribers[0] input link: NO_LINK is not allowed");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsParamSubscribersPortOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_param_subscribers = {{0u, {{0u, 1u}}}};
+
+ expect_validation_throw_contains(compiled, "m_param_subscribers[0] input port index 1");
+}
+
+TEST(CompiledModelOrcImportValidationTest, AcceptsValidPrevOutputRouting) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{{1u, 0u}, {0u, 0u}}};
+
+ EXPECT_NO_THROW(ov::npuw::CompiledModel::validate_import_routing_tables(compiled));
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsPrevOutputConsumerSubmodelOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{{7u, 0u}, {0u, 0u}}};
+
+ expect_validation_throw_contains(compiled, "m_submodels_input_to_prev_output[0] input submodel index 7");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsPrevOutputConsumerPortOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{{0u, 5u}, {0u, 0u}}};
+
+ expect_validation_throw_contains(compiled, "m_submodels_input_to_prev_output[0] input port index 5");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsPrevOutputProducerSubmodelOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{{0u, 0u}, {9u, 0u}}};
+
+ expect_validation_throw_contains(compiled, "m_submodels_input_to_prev_output[0] output submodel index 9");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsPrevOutputProducerPortOutOfRange) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{{0u, 0u}, {0u, 3u}}};
+
+ expect_validation_throw_contains(compiled, "m_submodels_input_to_prev_output[0] output port index 3");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsNoLinkPrevOutputConsumer) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{ov::npuw::CompiledModel::NO_LINK, {0u, 0u}}};
+
+ expect_validation_throw_contains(compiled,
+ "m_submodels_input_to_prev_output[0] input link: NO_LINK is not allowed");
+}
+
+TEST(CompiledModelOrcImportValidationTest, RejectsNoLinkPrevOutputProducer) {
+ auto compiled = make_compiled_model_with_input_link(ov::npuw::CompiledModel::NO_LINK);
+ add_fake_submodel(compiled);
+ compiled->m_submodels_input_to_prev_output = {{{0u, 0u}, ov::npuw::CompiledModel::NO_LINK}};
+
+ expect_validation_throw_contains(compiled,
+ "m_submodels_input_to_prev_output[0] output link: NO_LINK is not allowed");
+}
+
+} // namespace
\ No newline at end of file