Repository navigation
Conversation
sufubao
force-pushed
the
refactor/attention-backend-2-dense-triton
branch
2 times, most recently
from
November 18, 2026 10:09
5bb04ad to
44f41a9
Compare
sufubao
force-pushed
the
refactor/attention-backend-3-dense-flashinfer
branch
2 times, most recently
from
November 18, 2026 10:19
0fbb5ef to
b3b7796
Compare
sufubao
force-pushed
the
refactor/attention-backend-2-dense-triton
branch
2 times, most recently
from
November 20, 2026 07:19
7e3e005 to
55145d4
Compare
sufubao
force-pushed
the
refactor/attention-backend-3-dense-flashinfer
branch
2 times, most recently
from
November 20, 2026 07:26
19636ea to
b3b7796
Compare
sufubao
force-pushed
the
refactor/attention-backend-2-dense-triton
branch
from
November 20, 2026 07:26
55145d4 to
7e3e005
Compare
sufubao
force-pushed
the
refactor/attention-backend-3-dense-flashinfer
branch
from
November 20, 2026 08:11
b3b7796 to
fe7e8b4
Compare
sufubao
force-pushed
the
refactor/attention-backend-2-dense-triton
branch
from
November 20, 2026 08:30
f102662 to
14a4fb7
Compare
sufubao
force-pushed
the
refactor/attention-backend-3-dense-flashinfer
branch
from
November 20, 2026 08:30
fe7e8b4 to
0815454
Compare
sufubao
force-pushed
the
refactor/attention-backend-3-dense-flashinfer
branch
from
November 20, 2026 09:24
0815454 to
9367a75
Compare
sufubao
force-pushed
the
refactor/attention-backend-2-dense-triton
branch
from
November 20, 2026 09:24
14a4fb7 to
ee1e7ea
Compare
The decode split schedule depended on the first layer's query and cache strides, so it could only be prepared lazily inside decode_att, with a separate cached schedule for CUDA graph capture. TritonMLADecodeBackend now takes the per-rank layer configuration (q heads, latent and rotary dims, dtype) at construction. Stage 1 occupancy is probed once with canonical operands and cached, and stage 1 launches with the planned vsm_count instead of measuring it per layer. The adapter plans in init_state, skips planning for replay states, and refreshes the captured schedule in copy_for_decode_cuda_graph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AttentionBackend now defines the lifecycle shared by all providers: plan() builds the batch once per forward pass, outside CUDA graph capture; forward() runs per layer; refresh() updates derived state before graph replay and is a no-op by default. Every GQA, MLA and sparse MLA backend implements plan(), and the adapters plan in init_state instead of rebuilding the batch in every layer. A GQA decode batch planned for capture bounds MHA scratch by the graph capacity, which capture only writes into infer_state after init_state. Speculative decode does not plan the unused GQA batch. Batch holds state shared by all layers and Inputs holds per-layer data, so the sparse MLA top-k indices move from Batch to Inputs. The decode plan now creates the FlashMLA tile schedule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GQAInputs stores sliding_window as a tuple, so a list loaded from a JSON
model config matches the full-attention check in MHA decode. GQA decode
rejects q_heads that are not a multiple of kv_heads with a ValueError
naming both counts, instead of NotImplementedError("error") or silently
running the GQA kernel. The backend docstrings state that the caller
selects q.device as the current device.
MLA prefill derives the rotary width from k_rope instead of assuming 64.
The sparse MLA tests remove their backend singleton and its GPU buffers.
The MLA decode tuning script uses the current kernel paths and the
plan-then-decode API.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GQA FlashInfer backends now implement the plan/refresh lifecycle from #1735. plan() builds and plans the prefill or CUDA-graph-capable decode wrapper over caller-owned workspace and page buffers, and the decode refresh() runs fast_decode_plan for graph replay. The adapter derives page metadata, plans once in init_state and refreshes the captured batch in copy_for_decode_cuda_graph. refresh() accepts provider-specific keyword arguments, since FlashInfer re-plans from the replay batch's maximum KV length. The adapter keeps prefill_wrapper and decode_wrapper because the FP8 subclass still runs the wrapper directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sufubao
force-pushed
the
refactor/attention-backend-3-dense-flashinfer
branch
from
November 20, 2026 11:25
9367a75 to
98e2745
Compare
sufubao
force-pushed
the
refactor/attention-backend-2-dense-triton
branch
2 times, most recently
from
November 20, 2026 15:29
f303ea4 to
4605284
Compare
Collaborator
Author
|
FlashInfer GQA 已并入 #1735(提交 7702f03,按新的 planner/impl 接口实现),本 PR 关闭。 🤖 Generated with Claude Code |
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.
承接 #1735。
backends/gqa/flashinfer.py用同一份GQAInputs接入 FP16/BF16 prefill 和 decode,并遵循 #1735 中AttentionBackend的plan→forward→refresh生命周期。调用方准备 page map 和 workspace 并管理 CUDA graph,backend 直接填写调用方的输出。可按下面两个提交依次审阅。
bad0622309367a75bb,随 #1735 调整包路径和类型名)。98e274550plan/refresh。plan()在调用方持有的 workspace 和页缓冲上创建并规划 prefill wrapper 或支持 CUDA graph 的 decode wrapper;decode 的refresh(batch, max_kv_len=...)在 replay 前执行fast_decode_plan。adapter 计算页元数据,在init_state中规划一次,replay 状态不规划,由copy_for_decode_cuda_graph刷新捕获的 batch。两点说明:
AttentionBackend.refresh()改为接受各实现自定义的关键字参数。FlashInfer 需要按 replay batch 的最大 KV 长度(主机侧数值)重新规划,是第一个用到它的实现。prefill_wrapper/decode_wrapper,因为 FP8 FlashInfer 子类仍直接调用 wrapper。head 数和 dtype 作为plan()参数而非构造参数传入,因为 FP8 backend 在基类构造之后才设置 KV dtype。验证
9367a75bb在 H200 单卡、FlashInfer 0.6.18 上通过 32 项 GQA FlashInfer 测试,覆盖 ragged/cached prefill、不同 page size、非连续 KV、输出 identity,以及用 torch/serving allocator 捕获的 graph 在请求变长后的 replay。98e274550在 H200、Torch 2.11.0、FlashInfer 0.6.12 上验证:plan()构建 batch。两个 adapter 测试的桩 backend 补上decode_backend,其中 replay 测试仍检查重新规划使用捕获的缓冲区、head 配置和均匀 indptr。unit_tests/common、unit_tests/utils、unit_tests/models与 [2/n] attention backend refactoring: all attention paths (GQA, MLA, sparse MLA, GDN, KDA) and removal of the model-side adapters #1735 当前提交f81a02e67的失败集合一致,多出的 32 项通过即本 PR 的测试。🤖 Generated with Claude Code