[NPUW] Make Whisper cross-attention passes tolerate decomposed SDPA - #37402
Draft
parthmah14 wants to merge 1 commit into
Draft
[NPUW] Make Whisper cross-attention passes tolerate decomposed SDPA#37402parthmah14 wants to merge 1 commit into
parthmah14 wants to merge 1 commit into
Conversation
The NPUW-specific Whisper transformation passes (KV-cache state exposure and attention-mask injection) assumed cross-attention SDPA is still a single fused ScaledDotProductAttention node. Once GenAI decomposes cross-attention SDPA for word-level timestamps, the encoder-attn ReadValue/consumer shapes change (the key branch gains a ShapeOf reader and the value branch's consumer type changes), which crashed the rv_readers.size() == 2 assertion (CVS-179287) or silently misclassified key/value. Classify encoder-attn KV-cache states by consumer type instead of a fixed SDPA port index, and inject the cross-attention mask at the decomposed "QK scaled scores" node (identified by its tensor name) when no fused SDPA node exists. Both passes now handle the fused and decomposed shapes uniformly, since decomposition only happens when word_timestamps is requested. CVS-184242
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the CVS-179287 crash: NPUW's Whisper transformation passes assumed cross-attention is always a single fused SDPA node. Once cross-attention SDPA is decomposed, the encoder KV-cache state's reader count/type changes, breaking a hardcoded assert and a port-index key/value heuristic. This makes those passes (and the attention-mask injection) handle both the fused and decomposed shapes.
Part 1 of 3 for CVS-184242
Tickets: