[WS2][PR7][Attention] Add FlashInfer RoPE-fused paged attention scaffold - #279
Draft
inaniloquentee wants to merge 3 commits into
Draft
Conversation
Signed-off-by: JLiu4Coding <lzwgre@126.com>
Signed-off-by: JLiu4Coding <lzwgre@126.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Open
8 tasks
inaniloquentee
force-pushed
the
codex/ws2-pr7-flashinfer-rope-fused-submit
branch
from
August 5, 2026 15:28
aaf1b4b to
ed157ab
Compare
Signed-off-by: inaniloquentee <3051000145@qq.com>
inaniloquentee
force-pushed
the
codex/ws2-pr7-flashinfer-rope-fused-submit
branch
from
August 5, 2026 15:59
ed157ab to
b69859e
Compare
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
Implements the #235 PR7 scaffold for fused attention backend alignment, with the distributed
TP=2, CP=2attention boundary made explicit.This is a draft PR stacked on #260 / PR6. The branch is based on the latest fetched #260 PR head (
2eb4362) and currently targetsfeat/ws2-attention-single-gpu-harness-pr2because #260's head is available as a PR ref rather than an origin branch. After #260 lands, this PR should be retargeted so the diff only contains PR7.What This Adds
FlashInferQwen3PagedAttentionOpFlashInferPagedAttentionConfigFlashInferRoPEFusionConfigFlashInferSplitKVPolicypos_encoding_mode="ROPE_LLAMA"rope_theta=1_000_000.0rope_scale=1.0rotary_dim=head_dimdisabledfixed:<N>auto, rejected when batch invariance is requiredblock_table/global_token_positionsreconstructionkey_position_idsidentityout/lsedrift path when CUDA + FlashInfer are availableCP/TP Communication Interface
Issue #235 targets
Qwen3-8B, TP=2, CP=2, BF16, so PR7 cannot look like a single-rank-only adapter. This PR exposes the communication-operator interface now, but the real self-owned CUDA communication kernels are not implemented in this scaffold.This is not a p2p NCCL interface. The intended communication layer is custom CUDA AG/RS, with compute and communication decoupled.
Added interface surface:
The intended future flow is:
Important details:
FlashInferPagedAttentionConfigdefaults totp_world_size=2,cp_world_size=2,backend="cuda_ag_rs",status="interface_only".require_cp_comm=Truefails before execution. This prevents this scaffold from pretending real communication exists.CUDAAGRSAttentionCPCommunication.all_gather_partial_states(...)validates local partial states and then raisesAttentionCPCommunicationUnavailable.CUDAAGRSAttentionCPCommunication.reduce_scatter_merged_state(...)validates the merged state and then raisesAttentionCPCommunicationUnavailable.AttentionCPBlockMetadata.global_block_index.global_block_indexis rejected.lse.Key Files
rl_engine/kernels/ops/cuda/attention/cp_comm.pyrl_engine/kernels/ops/cuda/attention/flashinfer_paged_attention.pyrl_engine/kernels/ops/cuda/attention/__init__.pyscripts/ws2_pr7_flashinfer_attention_check.pytests/test_flashinfer_pr7_attention.pydocs/design/ws2-attention-pr7-flashinfer-rope-splitk.mdNon-Claims
This PR does not implement custom CUDA AG/RS communication kernels, does not enable FlashInfer by default, does not implement the TE training lane, does not replace PR3 CP merge semantics, does not prove real H-card batch invariance locally, and does not implement training backward. Real CUDA/H-card validation is still required before promotion beyond candidate status.
Validation
Pre-submit checks run locally from a clean worktree after the communication-interface correction:
DCO
Signed-off-by: inaniloquentee <3051000145@qq.com>.Part of #235
Depends on #260