Skip to content

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

[NPUW] Architecture-aware NPU config for Flux.2 compiled model (#38761)

Andrei Beleiu9d4d3508f828
diff --git a/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.cpp b/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.cpp
index 1442dcc14b6..7b36c5f249b 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.cpp
@@ -15,6 +15,7 @@
#include "openvino/runtime/properties.hpp"
#include "partitioning/patterns/fold_const.hpp"
#include "serialization.hpp"
+#include "util.hpp"
namespace {
@@ -30,13 +31,80 @@ auto cfg_get(const ov::AnyMap& properties) -> typename T::ValueType {
void merge_config_with(ov::AnyMap& lhs, const ov::AnyMap& rhs) {
for (const auto& [key, value] : rhs) {
if (auto it = lhs.find(key); it != lhs.end()) {
- it->second = value;
+ if (key == ::intel_npu::COMPILATION_MODE_PARAMS::key()) {
+ it->second = ov::npuw::util::merge_compilation_mode_params(it->second.as<std::string>(),
+ value.as<std::string>());
+ } else {
+ it->second = value;
+ }
} else {
lhs.emplace(key, value);
}
}
}
+struct NPUDesc {
+ std::string arch;
+ int64_t max_tiles = -1;
+};
+
+std::optional<NPUDesc> extract_npu_descriptor(const std::shared_ptr<const ov::IPlugin>& plugin) {
+ if (!plugin || !plugin->get_core()) {
+ return std::nullopt;
+ }
+ NPUDesc desc;
+ try {
+ const auto all_devices = plugin->get_core()->get_property("NPU", ov::available_devices);
+ if (all_devices.empty()) {
+ return std::nullopt;
+ }
+ desc.arch = plugin->get_property(ov::device::architecture.name(), ov::AnyMap{}).as<std::string>();
+ desc.max_tiles = plugin->get_property(ov::intel_npu::max_tiles.name(), ov::AnyMap{}).as<int64_t>();
+ } catch (const ov::Exception& ex) {
+ LOG_WARN("Flux2CompiledModel: failed to query NPU capabilities: " << ex.what());
+ return std::nullopt;
+ }
+ return std::make_optional(std::move(desc));
+}
+
+// Architecture-aware NPU tile configuration
+void set_max_tiles_based_on_arch(ov::AnyMap& config, const std::optional<NPUDesc>& npudesc) {
+ if (!npudesc.has_value()) {
+ return;
+ }
+ LOG_DEBUG("Flux2CompiledModel: NPU arch " << npudesc->arch << ", max tiles " << npudesc->max_tiles);
+
+ // Use the reported architecture when available; otherwise keep AUTO_DETECT.
+ const std::string npu_platform = (npudesc->arch != ov::intel_npu::Platform::AUTO_DETECT)
+ ? ov::intel_npu::Platform::standardize(npudesc->arch)
+ : npudesc->arch;
+
+ bool set_npu_tiles = false;
+ std::string arch_added_compilation_param;
+ if (npu_platform == ov::intel_npu::Platform::NPU3720) {
+ // Keep baseline settings
+ } else if (npu_platform == ov::intel_npu::Platform::NPU4000) {
+ set_npu_tiles = true;
+ arch_added_compilation_param = "optimization-level=3";
+ } else if (npu_platform == ov::intel_npu::Platform::NPU5010 || npu_platform == ov::intel_npu::Platform::NPU5020) {
+ set_npu_tiles = true;
+ } else if (npu_platform == ov::intel_npu::Platform::NPU6010) {
+ arch_added_compilation_param = "performance-hint-override=latency";
+ } else if (npu_platform == ov::intel_npu::Platform::AUTO_DETECT) {
+ // Keep baseline settings
+ } else {
+ LOG_WARN("Flux2CompiledModel: unknown NPU platform " << npu_platform << ". Default config will be used.");
+ }
+
+ if (set_npu_tiles && npudesc->max_tiles > 0) {
+ config[std::string(ov::intel_npu::tiles.name())] = npudesc->max_tiles;
+ }
+ if (!arch_added_compilation_param.empty()) {
+ merge_config_with(config,
+ {{std::string(::intel_npu::COMPILATION_MODE_PARAMS::key()), arch_added_compilation_param}});
+ }
+}
+
// Flux.2-klein pipeline submodels. Each is compiled separately (with NPUW_FLUX2:YES)
// and needs its own NPUW configuration - see submodel_config().
enum class Flux2Submodel { TEXT_ENCODER, TRANSFORMER, VAE_DECODER, VAE_ENCODER, UNKNOWN };
@@ -137,7 +205,9 @@ Flux2Submodel detect_submodel(const std::shared_ptr<ov::Model>& model) {
}
// Build the effective config: NPU device base < per-submodel defaults < user properties.
-ov::AnyMap with_flux2_defaults(const std::shared_ptr<ov::Model>& model, const ov::AnyMap& properties) {
+ov::AnyMap with_flux2_defaults(const std::shared_ptr<ov::Model>& model,
+ const std::shared_ptr<const ov::IPlugin>& plugin,
+ const ov::AnyMap& properties) {
const auto role = detect_submodel(model);
if (role == Flux2Submodel::UNKNOWN) {
LOG_WARN("Flux2CompiledModel could not identify the Flux.2-klein submodel; "
@@ -155,6 +225,9 @@ ov::AnyMap with_flux2_defaults(const std::shared_ptr<ov::Model>& model, const ov
{std::string(::intel_npu::NPUW_UNFOLD_IREQS::key()), "NO"},
};
merge_config_with(config, submodel_config(role));
+ // Compile newer NPU generations across all tiles (mirrors LLMCompiledModel).
+ set_max_tiles_based_on_arch(config, extract_npu_descriptor(plugin));
+
// User-provided properties take precedence over the defaults above.
merge_config_with(config, properties);
return config;
@@ -164,8 +237,9 @@ ov::AnyMap with_flux2_defaults(const std::shared_ptr<ov::Model>& model, const ov
ov::npuw::Flux2CompiledModel::PreparedState ov::npuw::Flux2CompiledModel::prepare(
const std::shared_ptr<ov::Model>& model,
+ const std::shared_ptr<const ov::IPlugin>& plugin,
const ov::AnyMap& properties) {
- auto prepared_properties = with_flux2_defaults(model, properties);
+ auto prepared_properties = with_flux2_defaults(model, plugin, properties);
model->set_friendly_name(model->get_friendly_name() + "_flux2");
if (cfg_get<::intel_npu::NPUW_PLAN>(prepared_properties).empty()) {
@@ -190,7 +264,7 @@ ov::npuw::Flux2CompiledModel::Flux2CompiledModel(const std::shared_ptr<ov::Model
const std::shared_ptr<const ov::IPlugin>& plugin,
const ov::AnyMap& properties,
CompiledModelFactory factory)
- : Flux2CompiledModel(prepare(model, properties), plugin, std::move(factory)) {}
+ : Flux2CompiledModel(prepare(model, plugin, properties), plugin, std::move(factory)) {}
ov::npuw::Flux2CompiledModel::Flux2CompiledModel(PreparedState prepared,
const std::shared_ptr<const ov::IPlugin>& plugin,
diff --git a/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.hpp b/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.hpp
index 7027721327a..fcb94367dcb 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.hpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/flux2_compiled_model.hpp
@@ -69,7 +69,9 @@ private:
ov::AnyMap properties;
};
- static PreparedState prepare(const std::shared_ptr<ov::Model>& model, const ov::AnyMap& properties);
+ static PreparedState prepare(const std::shared_ptr<ov::Model>& model,
+ const std::shared_ptr<const ov::IPlugin>& plugin,
+ const ov::AnyMap& properties);
Flux2CompiledModel(PreparedState prepared,
const std::shared_ptr<const ov::IPlugin>& plugin,
diff --git a/src/plugins/intel_npu/src/plugin/npuw/util.cpp b/src/plugins/intel_npu/src/plugin/npuw/util.cpp
index 4f3c20b9452..0b887da8140 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/util.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/util.cpp
@@ -13,6 +13,9 @@
#include <openvino/core/type/nf4.hpp>
#include <regex>
#include <sstream>
+#include <unordered_map>
+#include <unordered_set>
+#include <vector>
#include "llm_lora_states.hpp"
#include "logging.hpp"
@@ -222,6 +225,60 @@ std::string ov::npuw::util::fmt(std::size_t number, std::size_t total) {
return ss.str();
}
+std::string ov::npuw::util::merge_compilation_mode_params(const std::string& defaults, const std::string& overrides) {
+ // Keys whose value is a comma-separated list that must be extended rather than replaced.
+ static const std::unordered_set<std::string> list_keys = {"compute-layers-with-higher-precision"};
+
+ const auto append_list_values = [](std::string& param, const std::string& extra_values) {
+ std::unordered_set<std::string> existing;
+ std::istringstream current(param.substr(param.find('=') + 1));
+ for (std::string item; std::getline(current, item, ',');) {
+ existing.insert(item);
+ }
+ std::istringstream extra(extra_values);
+ for (std::string item; std::getline(extra, item, ',');) {
+ if (!item.empty() && existing.insert(item).second) {
+ param += (param.back() == '=' ? "" : ",") + item;
+ }
+ }
+ };
+
+ std::vector<std::string> params;
+ std::unordered_map<std::string, size_t> param_indices;
+
+ const auto add_params = [&](const std::string& value, bool replace_existing) {
+ std::istringstream stream(value);
+ std::string param;
+ while (stream >> param) {
+ const auto separator = param.find('=');
+ const auto key = param.substr(0, separator);
+ const auto [it, inserted] = param_indices.emplace(key, params.size());
+ if (inserted) {
+ params.push_back(std::move(param));
+ } else if (replace_existing) {
+ if (separator != std::string::npos && list_keys.count(key) &&
+ params[it->second].find('=') != std::string::npos) {
+ append_list_values(params[it->second], param.substr(separator + 1));
+ } else {
+ params[it->second] = std::move(param);
+ }
+ }
+ }
+ };
+
+ add_params(defaults, false);
+ add_params(overrides, true);
+
+ std::ostringstream result;
+ for (size_t i = 0; i < params.size(); ++i) {
+ if (i != 0) {
+ result << ' ';
+ }
+ result << params[i];
+ }
+ return result.str();
+}
+
void ov::npuw::util::unpack(const ov::SoPtr<ov::ITensor>& from,
const ov::SoPtr<ov::ITensor>& to,
const UnpackOptions& unpack_options) {
diff --git a/src/plugins/intel_npu/src/plugin/npuw/util.hpp b/src/plugins/intel_npu/src/plugin/npuw/util.hpp
index b842d7272b7..926dfcf27b6 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/util.hpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/util.hpp
@@ -49,6 +49,10 @@ bool is_supported_position_ids_input(const ov::Output<const ov::Node>& p);
std::string fmt(std::size_t number, std::size_t total);
+// Merges space-separated `key=value` lists; `overrides` replaces tokens with the same key, new keys are appended.
+// For compute-layers-with-higher-precision, override layers are appended to the existing comma-separated list.
+std::string merge_compilation_mode_params(const std::string& defaults, const std::string& overrides);
+
// Matches the three DynamicQuantize decomposition implementations declared in
// kv_cache_compressed.hpp.
enum class DynamicQuantDecomposeMode {
diff --git a/src/plugins/intel_npu/tests/unit/npuw/flux2_compiled_model_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/flux2_compiled_model_test.cpp
index 0b845c1acf0..7c901e5ac2b 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/flux2_compiled_model_test.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/flux2_compiled_model_test.cpp
@@ -9,14 +9,17 @@
#include <memory>
#include <sstream>
#include <string>
+#include <utility>
#include <vector>
#include "llm_test_helpers.hpp"
#include "openvino/core/version.hpp"
#include "openvino/op/parameter.hpp"
#include "openvino/op/result.hpp"
+#include "openvino/runtime/intel_npu/properties.hpp"
#include "openvino/runtime/properties.hpp"
#include "serialization.hpp"
+#include "unit_test_utils/mocks/openvino/runtime/mock_icore.hpp"
namespace {
@@ -30,6 +33,7 @@ constexpr const char* kDynQuant = "NPU_COMPILER_DYNAMIC_QUANTIZATION";
constexpr const char* kF16IC = "NPUW_F16IC";
constexpr const char* kCompileParams = "NPU_COMPILATION_MODE_PARAMS";
constexpr const char* kOnlinePipeline = "NPUW_ONLINE_PIPELINE";
+constexpr const char* kTiles = "NPU_TILES";
std::shared_ptr<ov::Model> make_model(const std::string& model_name,
const ov::element::Type& type,
@@ -70,6 +74,43 @@ private:
std::vector<CompileCall> m_calls;
};
+// Plugin that reports a specific NPU architecture and max-tiles count so the
+// architecture-aware tile configuration path can be exercised without real hardware.
+class ArchAwarePlugin final : public NullPlugin {
+public:
+ ArchAwarePlugin(std::string arch, int64_t max_tiles) : m_arch(std::move(arch)), m_max_tiles(max_tiles) {}
+
+ ov::Any get_property(const std::string& name, const ov::AnyMap&) const override {
+ if (name == ov::device::architecture.name()) {
+ return m_arch;
+ }
+ if (name == ov::intel_npu::max_tiles.name()) {
+ return m_max_tiles;
+ }
+ return {};
+ }
+
+private:
+ std::string m_arch;
+ int64_t m_max_tiles;
+};
+
+std::shared_ptr<ov::MockICore> attach_mock_core_with_npu_device(
+ const std::shared_ptr<ov::IPlugin>& plugin,
+ std::vector<std::string> device_list = std::vector<std::string>{"0"}) {
+ auto core = std::make_shared<testing::NiceMock<ov::MockICore>>();
+ plugin->set_core(core);
+
+ ON_CALL(*core,
+ get_property(testing::StrEq("NPU"),
+ testing::StrEq(ov::available_devices.name()),
+ testing::An<const ov::AnyMap&>()))
+ .WillByDefault([device_list](const std::string&, const std::string&, const ov::AnyMap&) -> ov::Any {
+ return ov::Any(device_list);
+ });
+ return core;
+}
+
// Build a header matching Flux2CompiledModel::export_model so import_model's validation
// can be exercised without a real inner ORC blob.
std::string make_flux2_header(const ov::npuw::s11n::IndicatorType& serialization_indicator,
@@ -346,4 +387,228 @@ TEST_F(Flux2CompiledModelTest, ImportRejectsVersionMismatch) {
EXPECT_THROW(ov::npuw::Flux2CompiledModel::import_model(stream, m_plugin, {}), ov::Exception);
}
+// --- Architecture-aware NPU tile configuration ------------------------------
+
+TEST_F(Flux2CompiledModelTest, Arch5000SeriesSetsNpuTilesForTransformer) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("5010", 3);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.at(kTiles).as<int64_t>(), 3);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(), "compute-layers-with-higher-precision=MVN");
+}
+
+TEST_F(Flux2CompiledModelTest, Arch4000AddsOptimizationLevelAndSetsNpuTiles) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("4000", 4);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.at(kTiles).as<int64_t>(), 4);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(),
+ "compute-layers-with-higher-precision=MVN optimization-level=3");
+}
+
+TEST_F(Flux2CompiledModelTest, Arch3720SkipsNpuTiles) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("3720", 2);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.count(kTiles), 0u);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(), "compute-layers-with-higher-precision=MVN");
+}
+
+TEST_F(Flux2CompiledModelTest, ArchAutoDetectUsesDefaultConfigAndSkipsNpuTiles) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("AUTO_DETECT", 4);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.count(kTiles), 0u);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(), "compute-layers-with-higher-precision=MVN");
+}
+
+TEST_F(Flux2CompiledModelTest, Arch6010AppendsLatencyHintAndSkipsNpuTiles) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("6010", 4);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.count(kTiles), 0u);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(),
+ "compute-layers-with-higher-precision=MVN performance-hint-override=latency");
+}
+
+TEST_F(Flux2CompiledModelTest, ArchAtLeast6000UsesDefaultConfig) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("7000", 8);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.count(kTiles), 0u);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(), "compute-layers-with-higher-precision=MVN");
+}
+
+// Submodels without their own compile params (e.g. text_encoder) still get NPU_TILES
+// on 5000-series, but no NPU_COMPILATION_MODE_PARAMS, since 5010 adds no compile token.
+TEST_F(Flux2CompiledModelTest, Arch5000SeriesSetsNpuTilesForTextEncoderWithoutCompileParams) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("5010", 3);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_text_encoder", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.at(kTiles).as<int64_t>(), 3);
+ EXPECT_EQ(call.props.at(kF16IC).as<std::string>(), "NO");
+ EXPECT_EQ(call.props.count(kCompileParams), 0u);
+}
+
+// --- NPU_COMPILATION_MODE_PARAMS is appended, not overwritten ---------------
+
+// Regression: a user-provided NPU_COMPILATION_MODE_PARAMS used to replace the per-submodel
+// precision hint. It must now be appended so both tokens survive.
+TEST_F(Flux2CompiledModelTest, UserCompilationParamsAppendToSubmodelDefault) {
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {{kCompileParams, "performance-hint-override=latency"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ EXPECT_EQ(recorder.only_call().props.at(kCompileParams).as<std::string>(),
+ "compute-layers-with-higher-precision=MVN performance-hint-override=latency");
+}
+
+TEST_F(Flux2CompiledModelTest, UserCompilationParamsAppendAfterArchParams) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("4000", 4);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {{kCompileParams, "performance-hint-override=latency"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.at(kTiles).as<int64_t>(), 4);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(),
+ "compute-layers-with-higher-precision=MVN optimization-level=3 performance-hint-override=latency");
+}
+
+TEST_F(Flux2CompiledModelTest, TransformerUserHigherPrecisionLayersAppendToDefault) {
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(
+ compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {{kCompileParams, "compute-layers-with-higher-precision=Sqrt,MVN performance-hint-override=latency"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ EXPECT_EQ(recorder.only_call().props.at(kCompileParams).as<std::string>(),
+ "compute-layers-with-higher-precision=MVN,Sqrt performance-hint-override=latency");
+}
+
+TEST_F(Flux2CompiledModelTest, UserCompilationParamsReplaceMatchingArchParam) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("4000", 4);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {{kCompileParams, "optimization-level=2"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ EXPECT_EQ(recorder.only_call().props.at(kCompileParams).as<std::string>(),
+ "compute-layers-with-higher-precision=MVN optimization-level=2");
+}
+
+// User-provided NPU_TILES takes priority over the arch-computed default.
+TEST_F(Flux2CompiledModelTest, UserNpuTilesOverrideArchDefault) {
+ m_plugin = std::make_shared<ArchAwarePlugin>("5010", 3);
+ const auto core = attach_mock_core_with_npu_device(m_plugin);
+
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {{kTiles, static_cast<int64_t>(1)}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.count(kTiles), 1u);
+ EXPECT_EQ(call.props.at(kTiles).as<int64_t>(), 1);
+}
+
+// No NPU backend => no architecture query => no NPU_TILES, per-submodel defaults intact.
+TEST_F(Flux2CompiledModelTest, NoNpuBackendSkipsNpuTiles) {
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::Flux2CompiledModel> compiled;
+ ASSERT_NO_THROW(compiled = create_compiled_model(
+ make_model("flux_transformer", ov::element::f32, ov::PartialShape{1, 16}, "hidden"),
+ {},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+
+ const auto& call = recorder.only_call();
+ EXPECT_EQ(call.props.count(kTiles), 0u);
+ EXPECT_EQ(call.props.at(kCompileParams).as<std::string>(), "compute-layers-with-higher-precision=MVN");
+}
+
} // namespace