Skip to content

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

[NPUW] Continuous prefill: on when the compiled model can serve it (#38606)

Dylan Neve4671da243c8c
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/config/npuw_option_defs.inc b/src/plugins/intel_npu/src/al/include/intel_npu/config/npuw_option_defs.inc
index faf040e795b..2f48af68d06 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/config/npuw_option_defs.inc
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/config/npuw_option_defs.inc
@@ -72,7 +72,7 @@ INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_OPTIMIZE_FP8, bool, false, ov::intel_npu::npu
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_ENABLE_PREFIX_CACHING, bool, false, ov::intel_npu::npuw::llm, enable_prefix_caching, "NPUW_LLM_ENABLE_PREFIX_CACHING", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_PREFIX_CACHING_BLOCK_SIZE, uint64_t, 256, ov::intel_npu::npuw::llm, prefix_caching_block_size, "NPUW_LLM_PREFIX_CACHING_BLOCK_SIZE", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_PREFIX_CACHING_MAX_NUM_BLOCKS, uint64_t, 128, ov::intel_npu::npuw::llm, prefix_caching_max_num_blocks, "NPUW_LLM_PREFIX_CACHING_MAX_NUM_BLOCKS", LLM, EXPOSED, CACHED, ALL)
-INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_ENABLE_CONTINUOUS_PREFILL, bool, false, ov::intel_npu::npuw::llm, enable_continuous_prefill, "NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", LLM, EXPOSED, CACHED, ALL)
+INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_ENABLE_CONTINUOUS_PREFILL, bool, true, ov::intel_npu::npuw::llm, enable_continuous_prefill, "NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_CACHE_ROPE, bool, true, ov::intel_npu::npuw::llm, cache_rope, "NPUW_LLM_CACHE_ROPE", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_ENABLE_BLOCK_BASED_KV_CACHE, bool, false, ov::intel_npu::npuw::llm, enable_block_based_kv_cache, "NPUW_LLM_ENABLE_BLOCK_BASED_KV_CACHE", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK, bool, false, ov::intel_npu::npuw::llm, enable_swa_kv_cache_shrink, "NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK", LLM, EXPOSED, CACHED, ALL)
diff --git a/src/plugins/intel_npu/src/al/include/intel_npu/npuw_private_properties.hpp b/src/plugins/intel_npu/src/al/include/intel_npu/npuw_private_properties.hpp
index c7f88928df2..6b8c668f200 100644
--- a/src/plugins/intel_npu/src/al/include/intel_npu/npuw_private_properties.hpp
+++ b/src/plugins/intel_npu/src/al/include/intel_npu/npuw_private_properties.hpp
@@ -22,18 +22,6 @@ namespace ov::intel_npu::npuw {
inline constexpr ov::Property<ov::FileHandleProvider> weights_handle_provider{"NPUW_WEIGHTS_HANDLE_PROVIDER"};
-namespace llm {
-
-// Read-only compiled-model capability: continuous prefill is active for this
-// compiled model. Not a config option, so it is declared by hand rather than
-// generated from npuw_option_defs.inc. GenAI probes it by name; capability must
-// not be inferred from query_state() containing npuw_stored_tokens_state, which
-// every plugin build publishes.
-inline constexpr ov::Property<bool, ov::PropertyMutability::RO> continuous_prefill_supported{
- "NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED"};
-
-} // namespace llm
-
} // namespace ov::intel_npu::npuw
#define INTEL_NPU_NPUW_DECLARE_PROPERTY_ALIAS(OPT, NS_PATH, NAME) \
diff --git a/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp b/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp
index 819e5d8f7c4..844a4bd6572 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp
@@ -869,21 +869,6 @@ ov::npuw::LLMCompiledModel::LLMCompiledModel(const std::shared_ptr<ov::Model>& m
}
}
- // Continuous prefill is opt-in and mutually exclusive with the hash prefix cache.
- // The prefix cache restore step unconditionally overwrites num_stored_tokens and
- // its helper hashes absolute token positions of a full prompt. Neither holds under
- // the delta-input contract, so the combination fails compilation instead of
- // silently misbehaving, mirroring the block-KV and prefix-caching exclusion.
- m_enable_continuous_prefill = m_cfg.get<::intel_npu::NPUW_LLM_ENABLE_CONTINUOUS_PREFILL>();
- if (m_enable_continuous_prefill) {
- OPENVINO_ASSERT(!m_cfg.get<::intel_npu::NPUW_LLM_ENABLE_PREFIX_CACHING>(),
- "NPUW_LLM_ENABLE_CONTINUOUS_PREFILL and NPUW_LLM_ENABLE_PREFIX_CACHING "
- "cannot be enabled simultaneously. Continuous prefill receives delta-only "
- "inputs which the hash prefix cache cannot process. "
- "Please disable one of the two options.");
- LOG_INFO("Continuous prefill is enabled");
- }
-
const uint32_t batch_dim = m_cfg.get<::intel_npu::NPUW_LLM_BATCH_DIM>();
const uint32_t seq_len_dim = m_cfg.get<::intel_npu::NPUW_LLM_SEQ_LEN_DIM>();
KVAxesPosition axes{batch_dim, seq_len_dim};
@@ -984,10 +969,9 @@ ov::npuw::LLMCompiledModel::LLMCompiledModel(const std::shared_ptr<ov::Model>& m
// auto-enable both options for them unless the user explicitly configured it.
bool propagate_slice_up = m_cfg.get<::intel_npu::NPUW_LLM_PROPAGATE_SLICE_UP>();
if (is_per_layer_inputs_model) {
- // SWA shrink is incompatible with prefix caching, multi-token generation (e.g. speculative
- // decoding), and continuous prefill.
- const bool swa_shrink_compatible =
- !m_enable_prefix_caching && max_generation_token_len == 1 && !m_enable_continuous_prefill;
+ // SWA shrink is incompatible with prefix caching and multi-token generation (e.g.
+ // speculative decoding). When it applies, continuous prefill is resolved off.
+ const bool swa_shrink_compatible = !m_enable_prefix_caching && max_generation_token_len == 1;
if (swa_shrink_compatible && !m_cfg.has<::intel_npu::NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK>()) {
m_cfg.update({{"NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK", "YES"}});
LOG_INFO("Gemma-4 cross-group KV model: auto-enabling NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK");
@@ -1488,12 +1472,7 @@ ov::npuw::LLMCompiledModel::LLMCompiledModel(const std::shared_ptr<ov::Model>& m
}
implement_properties();
-
- if (m_enable_continuous_prefill && !compute_continuous_prefill_supported()) {
- LOG_WARN("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL is set, but continuous prefill is not "
- "supported for this compiled model. NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED "
- "reports false and full-history behaviour stays in effect.");
- }
+ resolve_continuous_prefill();
LOG_DEBUG("Done");
}
@@ -1792,8 +1771,6 @@ std::shared_ptr<ov::npuw::LLMCompiledModel> ov::npuw::LLMCompiledModel::deserial
// Deserialize config
stream & compiled->m_cfg;
compiled->implement_properties();
- // Not serialized. Recomputed from the deserialized config so older blobs stay loadable.
- compiled->m_enable_continuous_prefill = compiled->m_cfg.get<::intel_npu::NPUW_LLM_ENABLE_CONTINUOUS_PREFILL>();
// Deserialize KV cache model variants
stream & compiled->m_kvcache_sizes;
@@ -1840,6 +1817,10 @@ std::shared_ptr<ov::npuw::LLMCompiledModel> ov::npuw::LLMCompiledModel::deserial
// Reject blobs whose KVCacheDesc::dim is not a valid axis for the restored KV tensors.
compiled->validate_imported_kvcache_dim();
+ // The flag itself is not serialized. Resolving it here also keeps blobs written
+ // before the write-back correct.
+ compiled->resolve_continuous_prefill();
+
return compiled;
};
@@ -1907,16 +1888,25 @@ void ov::npuw::LLMCompiledModel::set_property(const ov::AnyMap& properties) {
OPENVINO_NOT_IMPLEMENTED;
}
-bool ov::npuw::LLMCompiledModel::compute_continuous_prefill_supported() const {
+void ov::npuw::LLMCompiledModel::resolve_continuous_prefill() {
+ m_enable_continuous_prefill =
+ m_cfg.get<::intel_npu::NPUW_LLM_ENABLE_CONTINUOUS_PREFILL>() && can_continue_prefill();
+ m_cfg.update({{"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", m_enable_continuous_prefill ? "YES" : "NO"}});
+ if (m_enable_continuous_prefill) {
+ LOG_INFO("Continuous prefill is enabled");
+ }
+}
+
+bool ov::npuw::LLMCompiledModel::can_continue_prefill() const {
// Static exclusions for continuous prefill. Every condition here is knowable at
// compile or import time. Per-turn limits like capacity, alignment and the
// watermark are applied dynamically by the propose/grant channel instead.
- if (!m_enable_continuous_prefill) {
- return false; // opt-in feature
- }
if (!m_use_chunk_prefill) {
return false; // whole (STATIC) prefill has no continuation path
}
+ if (m_enable_prefix_caching) {
+ return false; // the hash prefix cache restores full prompts, not deltas
+ }
if (m_is_whisper || m_is_embedding || m_is_eagle) {
return false; // out of scope pipelines
}
@@ -1955,10 +1945,10 @@ bool ov::npuw::LLMCompiledModel::compute_continuous_prefill_supported() const {
return false;
}
// Position ids must be the exact [batch, seq] sequence the runtime validation
- // accepts: 3-D M-RoPE cannot be validated as a contiguous continuation. A
- // read-only property must never throw, so a dynamic rank is treated as
- // unsupported rather than queried through PartialShape::size(), which asserts
- // a static rank.
+ // accepts: 3-D M-RoPE cannot be validated as a contiguous continuation. This
+ // check runs for every compiled model and must not throw, so a dynamic rank is
+ // treated as unsupported rather than queried through PartialShape::size(),
+ // which asserts a static rank.
const auto position_ids_port =
ov::npuw::util::find_port_by_name(prefill_inputs, ov::npuw::LLMInferRequest::layer_names::position_ids);
if (!position_ids_port.has_value()) {
@@ -1978,10 +1968,6 @@ ov::Any ov::npuw::LLMCompiledModel::get_property(const std::string& name) const
OPENVINO_THROW(name, " is write-only option!");
}
- if (name == ov::intel_npu::npuw::llm::continuous_prefill_supported.name()) {
- return compute_continuous_prefill_supported();
- }
-
auto&& configIterator = m_prop_to_opt.find(name);
if (configIterator != m_prop_to_opt.cend()) {
return std::get<1>(configIterator->second)(m_cfg);
diff --git a/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.hpp b/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.hpp
index 013b53a1a37..be297182829 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.hpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.hpp
@@ -158,12 +158,12 @@ protected:
// variants take its leading rows. Part of the exported blob (see serialize()).
ov::npuw::patterns::pre_compute::LongRopeCosSin m_longrope_tables;
- // Continuous prefill support. Opted in via NPUW_LLM_ENABLE_CONTINUOUS_PREFILL and
- // mutually exclusive with hash prefix caching, which fails compilation.
+ // Continuous prefill is on whenever this compiled model can serve it, unless
+ // NPUW_LLM_ENABLE_CONTINUOUS_PREFILL is set to NO. Resolved once after compilation
+ // or import and written back, so the option reports the effective state.
bool m_enable_continuous_prefill = false;
- // Computes the NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED read-only property from
- // compiled model state. Not serialized, recomputed identically after import.
- bool compute_continuous_prefill_supported() const;
+ void resolve_continuous_prefill();
+ bool can_continue_prefill() const;
// Friend declarations for PrefixCachingHelper to access protected members
friend class PrefixCachingHelper;
diff --git a/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.cpp b/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.cpp
index 1c6cc05a56f..0eb425249d5 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.cpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.cpp
@@ -365,10 +365,9 @@ ov::npuw::LLMInferRequest::LLMInferRequest(const std::shared_ptr<ov::npuw::LLMCo
m_stored_tokens_state = std::make_shared<ov::npuw::StoredTokensState>();
init_lora_states();
- // Wire the continuous prefill negotiation channel when the compiled model
- // reports the capability. Without it the stored tokens state keeps its
- // legacy contract untouched.
- if (compiled_model->compute_continuous_prefill_supported()) {
+ // Wire the continuous prefill negotiation channel when it is enabled for the
+ // compiled model. Without it the stored tokens state keeps its legacy contract.
+ if (compiled_model->m_enable_continuous_prefill) {
m_continuation.enable(static_cast<uint32_t>(compiled_model->m_prefill_chunk_size),
compiled_model->m_kvcache_desc.max_prompt_size);
m_stored_tokens_state->attach_continuation(&m_continuation);
diff --git a/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.hpp b/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.hpp
index 64b97bc8a9e..43405358d00 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.hpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/llm_infer_request.hpp
@@ -195,8 +195,8 @@ protected:
// Support reset of stored tokens to 0 from external pipeline
ov::SoPtr<ov::npuw::StoredTokensState> m_stored_tokens_state;
- // Continuous prefill transaction coordinator, disabled unless the compiled model
- // reports the capability.
+ // Continuous prefill transaction coordinator, disabled unless continuous prefill
+ // is enabled for the compiled model.
ContinuationCoordinator m_continuation;
// Absolute KV position the current chunked prefill started at. Non-zero only while
// a continued prefill is running, where the caller tensors hold just the delta and
diff --git a/src/plugins/intel_npu/src/plugin/npuw/llm_stored_tokens_state.hpp b/src/plugins/intel_npu/src/plugin/npuw/llm_stored_tokens_state.hpp
index ed5d7d5084c..ad27e241f54 100644
--- a/src/plugins/intel_npu/src/plugin/npuw/llm_stored_tokens_state.hpp
+++ b/src/plugins/intel_npu/src/plugin/npuw/llm_stored_tokens_state.hpp
@@ -33,7 +33,11 @@ class LLMInferRequest;
class StoredTokensState : public ov::IVariableState {
public:
friend class ov::npuw::LLMInferRequest;
- StoredTokensState() : ov::IVariableState("npuw_stored_tokens_state") {
+
+ // External pipelines find this state by name, so the name is part of the contract.
+ static constexpr const char* state_name = "npuw_stored_tokens_state";
+
+ StoredTokensState() : ov::IVariableState(state_name) {
auto tensor = ov::Tensor(ov::element::i64, ov::Shape{1});
m_state = ov::get_tensor_impl(tensor);
m_state->data<int64_t>()[0] = 0;
@@ -48,16 +52,18 @@ public:
void set_state(const ov::SoPtr<ov::ITensor>& new_state) override {
if (!has_continuation()) {
- OPENVINO_THROW("npuw_stored_tokens_state: set_state() is a continuous prefill proposal and requires "
- "NPUW_LLM_ENABLE_CONTINUOUS_PREFILL on a model where "
- "NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED reports true.");
+ OPENVINO_THROW(state_name,
+ ": set_state() is a continuous prefill proposal and requires a compiled model where "
+ "NPUW_LLM_ENABLE_CONTINUOUS_PREFILL reports YES.");
}
- OPENVINO_ASSERT(new_state, "npuw_stored_tokens_state: set_state() received a null tensor.");
+ OPENVINO_ASSERT(new_state, state_name, ": set_state() received a null tensor.");
OPENVINO_ASSERT(new_state->get_element_type() == ov::element::i64,
- "npuw_stored_tokens_state: proposal tensor must be i64, got ",
+ state_name,
+ ": proposal tensor must be i64, got ",
new_state->get_element_type());
OPENVINO_ASSERT(new_state->get_size() == 1u,
- "npuw_stored_tokens_state: proposal tensor must be a scalar (one element), got ",
+ state_name,
+ ": proposal tensor must be a scalar (one element), got ",
new_state->get_size(),
" elements.");
m_coordinator->propose(new_state->data<int64_t>()[0]);
diff --git a/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp
index 23ea9b35268..9f36ccc551f 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_factory_options_test.cpp
@@ -387,21 +387,6 @@ TEST_F(LLMCompiledModelFactoryOptionsTest, PerLayerInputsModelDoesNotOverrideMul
EXPECT_TRUE(compiled->get_property("NPUW_LLM_PROPAGATE_SLICE_UP").as<bool>());
}
-TEST_F(LLMCompiledModelFactoryOptionsTest, PerLayerInputsModelDoesNotOverrideContinuousPrefill) {
- RecordingFactory recorder;
- std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
-
- // Continuous prefill doesn't work with a shrunk/sliding KV cache either (see
- // compute_continuous_prefill_supported()), so shrink must stay off here too.
- ASSERT_NO_THROW(compiled = create_compiled_model(ov::test::npuw::build_per_layer_inputs_probe_model(),
- {{"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "YES"}},
- recorder));
- ASSERT_NE(compiled, nullptr);
-
- EXPECT_FALSE(compiled->get_property("NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK").as<bool>());
- EXPECT_TRUE(compiled->get_property("NPUW_LLM_PROPAGATE_SLICE_UP").as<bool>());
-}
-
TEST_F(LLMCompiledModelFactoryOptionsTest, DefaultStageConfigsCarryBaselineNpuwOptions) {
RecordingFactory recorder;
std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
diff --git a/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_graph_options_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_graph_options_test.cpp
index 1d3822474fe..f972f716933 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_graph_options_test.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/llm_compiled_model_graph_options_test.cpp
@@ -230,50 +230,81 @@ TEST_F(LLMCompiledModelGraphOptionsTest, GeneratePyramidBuildsTwoStaticGenerateV
::testing::UnorderedElementsAre(ov::Shape({1, 1152}), ov::Shape({1, 2176})));
}
-TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillOptionAndCapabilitySurface) {
+TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillIsOnForChunkedPrefill) {
RecordingFactory recorder;
std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
- ASSERT_NO_THROW(compiled = create_compiled_model({{"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "YES"},
+ // Nothing asks for it: an eligible chunked model turns continuous prefill on
+ // and the option reports the effective state.
+ ASSERT_NO_THROW(
+ compiled = create_compiled_model({{"NPUW_LLM_PREFILL_HINT", "DYNAMIC"}, {"NPUW_LLM_PREFILL_CHUNK_SIZE", "32"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+ EXPECT_TRUE(compiled->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
+}
+
+TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillCanBeTurnedOff) {
+ RecordingFactory recorder;
+ std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
+
+ ASSERT_NO_THROW(compiled = create_compiled_model({{"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "NO"},
{"NPUW_LLM_PREFILL_HINT", "DYNAMIC"},
{"NPUW_LLM_PREFILL_CHUNK_SIZE", "32"}},
recorder));
ASSERT_NE(compiled, nullptr);
-
- EXPECT_TRUE(compiled->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
- // The capability read must never throw. With the contiguous delta prefill
- // path in place, an eligible chunked model advertises support.
- ov::Any supported;
- ASSERT_NO_THROW(supported = compiled->get_property("NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED"));
- EXPECT_TRUE(supported.as<bool>());
+ EXPECT_FALSE(compiled->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
}
-TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillUnsupportedForStaticPrefill) {
+TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillReportsOffForStaticPrefill) {
RecordingFactory recorder;
std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
- // Whole (STATIC) prefill has no continuation path, so the option is accepted
- // but the capability reports false.
+ // Whole (STATIC) prefill has no continuation path, so even an explicit YES
+ // is reported as NO.
ASSERT_NO_THROW(compiled = create_compiled_model({{"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "YES"},
{"NPUW_LLM_PREFILL_HINT", "STATIC"}},
recorder));
ASSERT_NE(compiled, nullptr);
-
- ov::Any supported;
- ASSERT_NO_THROW(supported = compiled->get_property("NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED"));
- EXPECT_FALSE(supported.as<bool>());
+ EXPECT_FALSE(compiled->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
}
-TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillRejectsPrefixCaching) {
+TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillReportsOffWithPrefixCaching) {
RecordingFactory recorder;
- // The hash prefix cache cannot process delta-only inputs, so the combination
- // fails compilation instead of silently misbehaving.
- EXPECT_THROW(create_compiled_model({{"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "YES"},
- {"NPUW_LLM_ENABLE_PREFIX_CACHING", "YES"},
- {"NPUW_LLM_PREFILL_HINT", "DYNAMIC"},
- {"NPUW_LLM_PREFILL_CHUNK_SIZE", "32"}},
- recorder),
- ov::Exception);
+ std::unique_ptr<ov::npuw::LLMCompiledModel> compiled;
+
+ // The hash prefix cache cannot process delta-only inputs. It is requested
+ // explicitly, so it wins and continuous prefill is reported as NO.
+ ASSERT_NO_THROW(compiled = create_compiled_model({{"NPUW_LLM_ENABLE_PREFIX_CACHING", "YES"},
+ {"NPUW_LLM_PREFILL_HINT", "DYNAMIC"},
+ {"NPUW_LLM_PREFILL_CHUNK_SIZE", "32"}},
+ recorder));
+ ASSERT_NE(compiled, nullptr);
+ EXPECT_FALSE(compiled->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
+}
+
+TEST_F(LLMCompiledModelGraphOptionsTest, ContinuousPrefillReportsOffWithShrunkSlidingWindow) {
+ // A window-shrunk KV cache has no continuation path. The same model with the
+ // full KV cache keeps continuous prefill on.
+ const auto compile_swa_model = [this](const std::string& shrink) {
+ RecordingFactory recorder;
+ auto props = base_props();
+ merge_props(props,
+ {{"NPUW_LLM_ENABLE_SWA_KV_CACHE_SHRINK", shrink},
+ {"NPUW_LLM_PREFILL_HINT", "DYNAMIC"},
+ {"NPUW_LLM_PREFILL_CHUNK_SIZE", "8"}});
+ return std::make_unique<ov::npuw::LLMCompiledModel>(ov::test::npuw::build_sliding_window_test_model(32, 1),
+ m_plugin,
+ props,
+ recorder.make_factory());
+ };
+
+ std::unique_ptr<ov::npuw::LLMCompiledModel> full;
+ ASSERT_NO_THROW(full = compile_swa_model("NO"));
+ EXPECT_TRUE(full->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
+
+ std::unique_ptr<ov::npuw::LLMCompiledModel> shrunk;
+ ASSERT_NO_THROW(shrunk = compile_swa_model("YES"));
+ EXPECT_FALSE(shrunk->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
}
TEST(HybridModelBuilderTest, HybridLinearAttnModelBuilds) {
diff --git a/src/plugins/intel_npu/tests/unit/npuw/llm_continued_prefill_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/llm_continued_prefill_test.cpp
index f65da7cd190..285c646fd24 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/llm_continued_prefill_test.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/llm_continued_prefill_test.cpp
@@ -276,8 +276,7 @@ protected:
{"NPUW_LLM_MAX_PROMPT_LEN", "256"},
{"NPUW_LLM_MIN_RESPONSE_LEN", "64"},
{"NPUW_LLM_PREFILL_HINT", "DYNAMIC"},
- {"NPUW_LLM_PREFILL_CHUNK_SIZE", "32"},
- {"NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "YES"}};
+ {"NPUW_LLM_PREFILL_CHUNK_SIZE", "32"}};
for (const auto& [key, value] : extra_props) {
props[key] = value;
}
@@ -286,7 +285,7 @@ protected:
props,
factory.make_factory());
ASSERT_NE(m_compiled, nullptr);
- ASSERT_TRUE(m_compiled->get_property("NPUW_LLM_CONTINUOUS_PREFILL_SUPPORTED").as<bool>());
+ ASSERT_TRUE(m_compiled->get_property("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL").as<bool>());
m_request = std::make_unique<ov::npuw::LLMInferRequest>(m_compiled);
diff --git a/src/plugins/intel_npu/tests/unit/npuw/npuw_options_smoke_test.cpp b/src/plugins/intel_npu/tests/unit/npuw/npuw_options_smoke_test.cpp
index 26cf60bc9dc..e6a276ed8ce 100644
--- a/src/plugins/intel_npu/tests/unit/npuw/npuw_options_smoke_test.cpp
+++ b/src/plugins/intel_npu/tests/unit/npuw/npuw_options_smoke_test.cpp
@@ -158,7 +158,7 @@ std::vector<Case> make_cases() {
"NPUW_LLM_PREFIX_CACHING_MAX_NUM_BLOCKS",
"32",
uint64_t{32}),
- bool_case<::intel_npu::NPUW_LLM_ENABLE_CONTINUOUS_PREFILL>("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "YES", true),
+ bool_case<::intel_npu::NPUW_LLM_ENABLE_CONTINUOUS_PREFILL>("NPUW_LLM_ENABLE_CONTINUOUS_PREFILL", "NO", false),
enum_case<::intel_npu::NPUW_LLM_PREFILL_HINT>("NPUW_LLM_PREFILL_HINT", "STATIC", "STATIC"),
enum_case<::intel_npu::NPUW_LLM_PREFILL_ATTENTION_HINT>("NPUW_LLM_PREFILL_ATTENTION_HINT",
"DYNAMIC",