feat(linked): add FlashAttention FlashAttnVarlenFunc provider - #911
Merged
Conversation
FlashAttnVarlenFunc provider
This was referenced Aug 9, 2026
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.
Summary
FlashAttnVarlenFuncoperator by resolving FlashAttention's exportedflash::mha_varlen_fwdsymbol.block_tableandalibi_slopesinputs.Motivation
FlashAttnVarlenFuncis the canonical replacement target for the deprecatedPagedAttentionPrefillInfinilminterface, but its paged-KV path had no NVIDIA provider. The NVIDIA development image already ships FlashAttention and exports the required ABI, so the provider can be linked without adding another native kernel implementation or changing the public InfiniOps signature.Type of Change
feat- new feature / new operator / new platformfix- bug fixperf- performance improvement (no behavioral change)refactor- code restructuring without behavior changetest- adding or fixing tests onlydocs- documentation onlybuild/ci- build system or CI configurationchore- tooling, formatting, or other non-code changes!in the Conventional Commits prefix or aBREAKING CHANGE:footer)Platforms Affected
WITH_CPU)WITH_NVIDIA)WITH_ILUVATAR)WITH_METAX)WITH_CAMBRICON)WITH_MOORE)WITH_ASCEND)WITH_TORCH)Smoke Test Result
Remote environment:
ssh nvidia, imageaccelerator-dev/nvidia:latest, PyTorch2.10.0a0+b4e4ee81d3.nv25.12, FlashAttention2.7.4.post1+25.12.The four focused-test skips are the expected implementation-index 8 paged-KV/ALiBi cases; those arguments are supported by the new linked implementation-index 16 provider.
Test Results on Supported Platforms
43 passed, 4 skipped; resolver24 passedFormatting was checked with the CI-pinned tools: clang-format 21 and ruff 0.15.22 (
ruff checkandruff format --check).Benchmark / Performance Impact
N/A. This PR adds provider coverage and does not replace or tune a kernel.
Notes for Reviewers
API alignment
FlashAttnVarlenFunc(q, k, v, cu_seqlens_q, cu_seqlens_k, alibi_slopes, block_table, max_seqlen_q, max_seqlen_k, dropout_p, softmax_scale, causal, window_size, softcap, deterministic, return_attn_probs, out, softmax_lse, s_dmask)flash_attn_varlen_funcCONTRIBUTING.md.The linked symbol was verified directly in the image's FlashAttention DSO. A direct upstream paged-varlen smoke case also matched a materialized PyTorch reference (
max_abs_error=0.000244140625,allclose=True).The existing implementation-index 8 provider does not implement
block_tableoralibi_slopes; it now rejects those arguments explicitly instead of silently ignoring them. No public overload was added or removed.