feat(cambricon): add varlen flash attention provider - #970
Draft
baominghelly wants to merge 1 commit into
Draft
Conversation
baominghelly
force-pushed
the
feat/cambricon-flash-attn-varlen-func
branch
from
September 3, 2026 02:10
8a7adbd to
db8dfc7
Compare
baominghelly
force-pushed
the
feat/cambricon-flash-attn-with-kvcache
branch
from
September 3, 2026 02:10
6e71e4b to
c7c7836
Compare
baominghelly
force-pushed
the
feat/cambricon-flash-attn-varlen-func
branch
from
September 3, 2026 02:22
db8dfc7 to
fd462fc
Compare
baominghelly
marked this pull request as ready for review
September 3, 2026 02:27
baominghelly
force-pushed
the
feat/cambricon-flash-attn-varlen-func
branch
from
September 3, 2026 07:14
fd462fc to
fd80cb5
Compare
baominghelly
force-pushed
the
feat/cambricon-flash-attn-with-kvcache
branch
from
September 3, 2026 07:14
c7c7836 to
4a750ac
Compare
Base automatically changed from
feat/cambricon-flash-attn-with-kvcache
to
master
September 4, 2026 01:59
baominghelly
force-pushed
the
feat/cambricon-flash-attn-varlen-func
branch
from
September 4, 2026 02:20
fd80cb5 to
db40b50
Compare
voltjia
previously approved these changes
Sep 4, 2026
baominghelly
force-pushed
the
feat/cambricon-flash-attn-varlen-func
branch
from
September 4, 2026 03:00
db40b50 to
59bd90d
Compare
baominghelly
marked this pull request as draft
September 4, 2026 03:02
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
flash_attn_varlen_func.flash-attnextension'smha_varlen_fwdentry point for packed variable-length attention.Motivation
Cambricon model prefill and variable-length batches need the FlashAttention varlen interface selected by the model operator manifest. This provider complements the KV-cache decode provider merged in #969 and reuses the linked-library declaration and paged-cache helper now available on
master.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
Not run — the repository's official Cambricon smoke suite was not run. A fresh slot-specific Cambricon linked build and operator test were run instead.
Test Results on Supported Platforms
26 passed, 5 skipped; one test-reference int64-to-int32 warningTargeted pytest output
Benchmark / Performance Impact
N/A - no benchmark was run.
Notes for Reviewers
flash-attnlibrary declaration andsrc/common/op_utils/paged_kv_cache.hwere added by feat(cambricon): add flash attention KV-cache provider #969 and are now inmaster.softcapanddeterministicare currently accepted but not forwarded to the Cambricon extension.return_attn_probsis enabled, the provider copies softmax LSE; the optionals_dmaskoutput is not populated.mha_varlen_fwd.clang-format --dry-run --Werrorandgit diff --checkpassed.