refactor(linked)!: migrate flash_attn_with_kvcache provider - #894
Merged
voltjia merged 1 commit intoAug 7, 2026
Merged
Conversation
voltjia
marked this pull request as ready for review
August 7, 2026 03:35
flash_attn_with_kvcache provider
Ziminli
approved these changes
Aug 7, 2026
whjthu
approved these changes
Aug 7, 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
flash_attn_with_kvcacheprovider from the handwrittensrc/torchpath to the genericsrc/linked/torcharchitecture.Motivation
The existing integration already called the C++ ABI exported by
flash_attn_2_cuda, but independently reimplemented package discovery, symbol inspection, library linking, RPATH setup, stream bridging, and ATen tensor adaptation insrc/CMakeLists.txtandsrc/torch.This migration makes the complex direct-symbol FlashAttention provider use the same linked-library mechanism as the simpler linked operators. It also validates that the architecture supports optional tensors, mutable caches, auxiliary outputs, scalar adaptation, and non-default streams without copying third-party kernels into InfiniOps.
This PR is stacked on #886. N/A - no linked issue.
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,accelerator-dev/nvidia:latest, NVIDIA A100, PyTorch2.10.0a0+b4e4ee8, FlashAttention2.7.4.post1+25.12.Test Results on Supported Platforms
tests/test_flash_attn_with_kvcache.py:12 passedAdditional validation output
Benchmark / Performance Impact
N/A - this PR changes provider discovery and integration structure, not the called FlashAttention ABI or operator computation.
Notes for Reviewers
flash::mha_fwd_kvcacheC++ ABI exported by the installedflash_attn_2_cudaDSO. The full demangled signature is now verified byflash_attn.yaml; a package version is no longer treated as an ABI proxy.cache_seqlensadaptation, and external-stream guarding. The NVIDIA provider contains only the library ABI declaration/call and slot specialization.1dc5014f(fix: copy optional tensor metadata #881). Manual validation applied that already-merged optional-metadata fix only to the remote test copy; it is not part of this PR. The branch should be rebased onto currentmasterafter its seven linked prerequisites merge.BREAKING CHANGE: enabling the NVIDIA
flash_attn_with_kvcacheprovider now requiresWITH_LINKED=ONinstead of relying onWITH_TORCH=ON, and its implementation index moves from slot 8 to linked slot 16. The public operator signature and behavior are unchanged.