Repository navigation
[FA4] Support paged/decode compile specs in compile_flash_attn_varlen_func_from_specs - #158
Open
sfc-gh-goliaro wants to merge 1 commit into
Open
sfc-gh-goliaro wants to merge 1 commit into
sfc-gh-goliaro wants to merge 1 commit into
Conversation
…_func_from_specs Extend the compile-only warmup helper to cover the axes used by vLLM's dense (non-MLA) paged decode/prefill path so those specializations can be precompiled instead of JIT-compiling during serving: - seqused_k_shape (paged decode uses seqused_k, not cu_seqlens_k) - page_table_shape (paged KV) - k_stride (paged key_cache views are non-contiguous) - q/k/v_descale (bool) (fp8 KV cache) - softcap All are existing _flash_attn_fwd parameters; the helper previously exposed only the contiguous varlen (cu_seqlens) axes. Backward compatible: every new parameter defaults to None/False. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Gabriele Oliaro <gabriele.oliaro@snowflake.com>
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.
[FA4] Support paged/decode compile specs in
compile_flash_attn_varlen_func_from_specsRepo:
vllm-project/flash-attention· Branch:fa4-dense-paged-compile-specsSummary
Extend the CuTeDSL compile-only warmup helper so the dense (non-MLA) paged
decode/prefill specializations can be precompiled, instead of JIT-compiling during
serving. The helper previously exposed only the contiguous varlen (
cu_seqlens) axes,which is enough for MLA prefill but not for vLLM's standard
FLASH_ATTN(GQA) path.New optional parameters (all default to
None/False, fully backward compatible):seqused_k_shape— paged decode usesseqused_k(notcu_seqlens_k)page_table_shape— paged KVk_stride—key_cacheis a non-contiguous view of a(num_blocks, 2, page_size, …)cache, so its
num_blocksstride is not the contiguous default; the compiled kernelbakes strides, so this must be settable
q_descale/k_descale/v_descale(bool) — fp8 KV cachesoftcapAll of these are already parameters of
_flash_attn_fwd; this only threads them throughthe compile-only entry point.
Why this is needed
vLLM warms FA4 kernels at startup via
compile_flash_attn_varlen_func_from_specs. For astandard GQA model the dense forward (
FlashAttentionForwardSm100,q_stage=2, paged,seqused_k) is a different compile key than the varlen/MLA specs this helper couldexpress, so it could not be precompiled and JIT-compiled on the first serving request.
Test
compile_flash_attn_varlen_func_from_specs(...)with a paged decode/prefill spec nowcompiles the exact
FlashAttentionForwardSm100specialization vLLM serves with(verified by matching the
compile_keythe engine reports).Note for integrators
Paired with vllm-project/vllm#48156, which calls these new args (dense-FA4 CuTeDSL
warmup) and bumps the flash-attn pin to this commit — see that PR for the end-to-end
performance results. Land this PR first (or together).
🤖 AI-assisted change.