Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ INTEL_NPU_NPUW_ANYMAP_OPT(NPUW_LLM_SHARED_LM_HEAD_CONFIG, ov::intel_npu::npuw::l
INTEL_NPU_NPUW_ANYMAP_OPT(NPUW_LLM_ADDITIONAL_SHARED_LM_HEAD_CONFIG, ov::intel_npu::npuw::llm, additional_shared_lm_head_config, "++NPUW_LLM_SHARED_HEAD_CONFIG", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_WHISPER, bool, false, ov::intel_npu::npuw::whisper, enabled, "NPUW_WHISPER", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_WHISPER_EOS_TOKEN, uint64_t, 50257, ov::intel_npu::npuw::whisper, whisper_eos_token, "NPUW_WHISPER_EOS_TOKEN", LLM, EXPOSED, UNCACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_WHISPER_DECOMPOSE_SDPA, bool, false, ov::intel_npu::npuw::whisper, whisper_decompose_sdpa, "NPUW_WHISPER_DECOMPOSE_SDPA", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_EAGLE, bool, false, ov::intel_npu::npuw::eagle, enabled, "NPUW_EAGLE", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_TEXT_EMBED, bool, false, ov::intel_npu::npuw::text_embed, enabled, "NPUW_TEXT_EMBED", LLM, EXPOSED, CACHED, ALL)
INTEL_NPU_NPUW_SIMPLE_OPT(NPUW_KOKORO, bool, false, ov::intel_npu::npuw::kokoro, enabled, "NPUW_KOKORO", KOKORO, EXPOSED, UNCACHED, ALL)
Expand Down
34 changes: 5 additions & 29 deletions src/plugins/intel_npu/src/plugin/npuw/llm_compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,32 +853,10 @@ ov::npuw::LLMCompiledModel::LLMCompiledModel(const std::shared_ptr<ov::Model>& m
m_kvcache_desc = KVCacheDesc{whisper_max_prompt_size, whisper_kvcache_size, 0u, whisper_seq_len_dim, 1u};
whisper_lhs_seq_size =
static_cast<uint32_t>(prefill_model->input("encoder_hidden_states").get_partial_shape()[1].get_length());
auto whisper_decompose_sdpa = m_cfg.get<::intel_npu::NPUW_WHISPER_DECOMPOSE_SDPA>();
if (whisper_decompose_sdpa) {
m_kvcache_desc.max_prompt_size = whisper_kvcache_size - 1;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still should use whisper_kvcache_size - 1 for reshape to static in case of decomposed SDPA. As when word_timestamps is enabled, the decoder may receive tokens decoded from the entire audio chunk.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - this is needed whenever word_timestamps is active, not just as an artifact of the removed option. Restored it, now detected structurally via a new has_decomposed_cross_attention_sdpa() helper (pushed in ea2553d).


auto prepare_prefill_model = ov::npuw::util::PrepareWhisperPrefillModel(m_kvcache_desc.max_prompt_size,
whisper_lhs_seq_size,
whisper_decompose_sdpa);
prepare_prefill_model.run_on_model(prefill_model); // Whisper decoder model
ov::npuw::util::PrepareWhisperPrefillModel(m_kvcache_desc.max_prompt_size, whisper_lhs_seq_size)
.run_on_model(prefill_model); // Whisper decoder model
ov::npuw::util::PrepareWhisperKVCacheModel().run_on_model(kvcache_model); // Whisper decoder_with_past model

// FIXME: Whisper Decompose SDPA
// WA: to mock new "cross_attention_qk_scaled_scores" outputs in original model
if (whisper_decompose_sdpa) {
m_decomposed_sdpa_size = prepare_prefill_model.get_decomposed_sdpa_size();
auto& mutable_outputs = const_cast<std::vector<ov::Output<const ov::Node>>&>(this->outputs());
for (size_t idx = 0; idx < m_decomposed_sdpa_size; idx++) {
auto fake_param = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, ov::PartialShape{});
auto fake_result = std::make_shared<ov::op::v0::Result>(fake_param);
fake_result->output(0).get_tensor().add_names(
{WhisperInferRequest::whisper_layer_names::qk_scores,
WhisperInferRequest::whisper_layer_names::qk_scores_ + std::to_string(idx)});

mutable_outputs.emplace_back(fake_result->output(0));
}
}
}

LOG_DEBUG("Make prefill model with static shapes");
Expand Down Expand Up @@ -1316,8 +1294,8 @@ void ov::npuw::LLMCompiledModel::serialize(std::ostream& raw_stream, const ov::n
m_kvcache_desc.dim & m_kvcache_desc.max_generation_token_len & m_kvcache_desc.v_tensors_transposed_pre &
m_kvcache_desc.v_tensors_transposed_gen & m_prefill_chunk_size & m_use_chunk_prefill & m_max_lora_rank &
m_enable_prefix_caching & m_prefix_caching_block_size & m_prefix_caching_max_num_blocks &
m_longrope_context_limit & m_is_whisper & m_eos_token_id & m_decomposed_sdpa_size & m_is_eagle &
m_is_embedding & m_is_block_kv_cache;
m_longrope_context_limit & m_is_whisper & m_eos_token_id & m_is_eagle & m_is_embedding &
m_is_block_kv_cache;

// Write config
stream & m_cfg;
Expand Down Expand Up @@ -1537,8 +1515,7 @@ std::shared_ptr<ov::npuw::LLMCompiledModel> ov::npuw::LLMCompiledModel::deserial
compiled->m_use_chunk_prefill & compiled->m_max_lora_rank & compiled->m_enable_prefix_caching &
compiled->m_prefix_caching_block_size & compiled->m_prefix_caching_max_num_blocks &
compiled->m_longrope_context_limit & compiled->m_is_whisper & compiled->m_eos_token_id &
compiled->m_decomposed_sdpa_size & compiled->m_is_eagle & compiled->m_is_embedding &
compiled->m_is_block_kv_cache;
compiled->m_is_eagle & compiled->m_is_embedding & compiled->m_is_block_kv_cache;

// Deserialize config
stream & compiled->m_cfg;
Expand Down Expand Up @@ -1672,7 +1649,6 @@ void ov::npuw::LLMCompiledModel::implement_properties() {
BIND(npuw::llm::shared_lm_head, NPUW_LLM_SHARED_HEAD, get),
BIND(npuw::whisper::enabled, NPUW_WHISPER, get),
BIND(npuw::whisper::whisper_eos_token, NPUW_WHISPER_EOS_TOKEN, get),
BIND(npuw::whisper::whisper_decompose_sdpa, NPUW_WHISPER_DECOMPOSE_SDPA, get),
BIND(npuw::eagle::enabled, NPUW_EAGLE, get),
BIND(npuw::text_embed::enabled, NPUW_TEXT_EMBED, get)});
#undef BIND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ class LLMCompiledModel : public ov::npuw::ICompiledModel {

bool m_is_whisper = false;
uint64_t m_eos_token_id = 0;
size_t m_decomposed_sdpa_size = 0;

bool m_is_embedding = false;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/src/plugin/npuw/serialization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const constexpr ov::npuw::s11n::IndicatorType NPUW_LLM_COMPILED_MODEL_INDICATOR
const constexpr ov::npuw::s11n::IndicatorType NPUW_GQA_COMPILED_MODEL_INDICATOR =
{char{0x47}, char{0x51}, char{0x41}, char{0x43}, char{0x4d}, char{0x4f}};

const constexpr char* NPUW_SERIALIZATION_VERSION = "0.28";
const constexpr char* NPUW_SERIALIZATION_VERSION = "0.29";

// Forward declaration
namespace intel_npu {
Expand Down
Loading