Repository navigation
[Feature] support Qwen3.8-flash-next - #1628
Merged
Merged
Conversation
Mio310
requested review from
Infinite666,
SuperMarioYL,
Wwwzff,
harrisonyhq,
mag1c-h,
nrj868,
qyh111 and
ygwpz
as code owners
November 5, 2026 09:20
Mio310
force-pushed
the
qwen3.8-vllm
branch
2 times, most recently
from
November 5, 2026 12:13
f1aa507 to
96f3161
Compare
student-jhz
previously requested changes
Nov 5, 2026
student-jhz
left a comment
Contributor
There was a problem hiding this comment.
整体结论:request-changes。
主要理由:
- [blocker] PR 当前与 develop 存在合并冲突(API mergeable_state=dirty),请先 rebase 解决后重跑 CI。
- [major] 新适配模型未同步支持矩阵:本 PR 为 Qwen3.8-Flash-Next 新增 vLLM-Ascend(NPU)整存整取+layerwise 与 CUDA 整存整取适配,但 docs/docs-site/docs/{en,zh}/user-guide/support-matrix/index.md 中该模型仍为 Unverified,Documentation 节为空且未说明(详见行内意见)。
- [major] v2 store 的 share_buffer_enable 配置在本 PR 后完全失效且文档未更新:v2 中该配置此前唯一消费者是 LoadQ,现在分发行为完全由任务级 distributeBackendLoad 决定,MLA 用户显式设为 false 也无法关闭分发(集成层按 is_mla 强制传 true),en/zh reference/config-parameters.md 仍描述该参数控制共享内存(详见行内意见)。
- [major] Test 节为空,且截至检视时该 PR 无任何 CI check-runs 记录:+1620 行改动(含 C++ 存储路径改造)没有任何自验证证据。请补充单测/CI 输出或实机验证结果,至少包含:NPU flash-next 整存整取+layerwise 端到端、既有 GLM/KDA 模型回归、gtest 与 pytest 全量。
- [major] 范围聚焦:PR 实际包含一套跨层的"按任务分发后端加载"基础设施改造(TaskDesc.distributeBackendLoad、LoadQ 分发重构、pipeline store / rank_consistency 签名扩展、vLLM 三个连接器与 sglang adapter 传参),Modifications 五条均为 flash-next 适配,未提及该机制、动机与用户可见影响;建议补充描述或拆分 PR。
- [minor] 标题不规范:应为 [Feat] 前缀(仓内惯例,如 [Feat] Add native AsuStore metrics and Grafana panels (#1572));当前 [feature] 小写且 ] 后缺空格,"Qwen3.8-flash-next- #1621" 尾部连字符疑为笔误。
- [nit] 8 个 commit 中 "adapt for cuda qwen3.8-flash-next"、"support npu qwen3.8-flash-next"、"fix suggestions" 缺少 scope 前缀,建议统一为 [Feat]/[Opt]/[Doc] 风格。
亮点(已核实):
- 向后兼容做得细:C++ Load/load_data 新参数全部带默认值,rank_consistency 通过 supports_distributed_backend_load 探测后以 kwargs 传参,自定义 store 旧签名不受影响,并有 3 个专门用例覆盖;
- 状态边界落盘修复正确:first_lcm_b 从步首+1 起算、token_processed 每步前进,连续步不重叠不遗漏,并有 test_dump_writes_state_at_every_crossed_lcm_boundary 锁定;
- 组列所有权与 null 地址方案自洽:group_pair_bases 按 (gid, type_id, slot) 寻址避免 full/linear 同 stride 指针合并,未拥有列/槽填 0 与 copy_stream 的 null-address skip 配套,whole-store 与 layerwise 两套几何核算一致;
- _scope_blocks 在 load 路径保序等长,start_load_kv 按 load_full_attn_count 切分共享 MLA / 私有 state 任务的索引对齐与失败路径处理正确;
- PLE layerwise 的 pack 补零 / unpack 截断、中间 slot 空填先于 commit 任务的顺序正确,_drain_unwaited_loads 对未等待/未解包任务兜底并 WARN;
- CUDA BLNHC + layerwise 双重拦截(ucm_connector 运行时 + LayerWise 连接器构造),报错信息给出可操作建议;
- C++ gtest 更新到位(prealloc/Get 同 rank 新约定、私有任务保序),代码风格与仓内规范一致(含 clang-format 专项提交)。
qyh111
reviewed
Nov 6, 2026
qyh111
left a comment
Contributor
There was a problem hiding this comment.
基于最新提交 8e8a19a 检视,建议先处理以下两点,详见行内意见:
- [P1] NPU layerwise 在 FULL 图回放路径缺少 forward 前的完整加载和等待;post-forward drain 只能处理已提交任务,不能保证模型读取前 KV 已就绪。
- [P2] raw_key_cache 真实层名未被识别为 raw_key,CUDA 布局会多分配一列,扩大每份缓存记录的 shard/block 大小。
复核范围:源码调用链、CPU 最小布局/调度脚本及现有 HLA 测试。PR 为 69 PASS / 37 FAIL,base 4f912dd 为 56 PASS / 37 FAIL;失败项相同,新增 13 项通过,未将既有失败归因于本 PR。没有进行设备、模型 forward 或精度验证。已核对当前提交存在通过的 CI 记录,未沿用旧评论中“无 CI / 合并冲突”的结论。
qyh111
self-requested a review
November 6, 2026 09:24
qyh111
approved these changes
Nov 6, 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.
Purpose
为昇腾 NPU 上的 Qwen3.8-Flash-Next 补上 UCM hybrid linear-attention KV 外置缓存。该模型在 vLLM-Ascend 里的布局名是 BLNHC,但各 tensor 的 layer_stride > block_stride,实际按层存放。本次让这种 layer-major BLNHC 走通整存整取和 layerwise,并保持 UCM 只使用一种 block size。CUDA 上的 BLNHC 仍然不能开 layerwise。MTP 不在本次范围内。
Modifications
1、用 is_npu_layer_major_blnhc 识别 NPU layer-major BLNHC:设备是 NPU、布局名是 BLNHC,且每个多层 tensor 都满足 layer_stride > block_stride。真正的 block-first 布局继续拒绝。HLA 入口条件不变,仍然要求同时存在 FullAttention 和 mamba_cache_mode="align" 的 Mamba。
2、raw_key 不占列、不参与哈希。compressed 不单独哈希,按层号与 full attention 配对。ple 使用和 linear 相同的 state hash计算方式,单独占一块。
3、整存整取使用一组列:12 个 full 页、12 个 compressed 页、1 个 PLE 页。Full 组填满前 24 列,PLE 列地址为 0。每个 linear 组只用自己的 12 层基址填前 12 列。PLE 只填最后一列。各组基址放在 group_pair_bases,避免 full 和 linear 因相同 block_stride 被收成同一个指针。
4、Layerwise 保持 12 个 slot,每个 shard 是 [full页, compressed页]。Full 组在每个 slot 上拥有两列。Linear 组只拥有第 0 列。PLE 只占 slot 0 的第 0 列,先拷进 full 页大小的暂存区并补 0,加载后再拆回 184320。最高 slot 仍由 commit 任务写入。
5、在 CUDA BLNHC 且开启 layerwise 时抛出 RuntimeError。NPU layer-major BLNHC 在 layerwise 开启时进入 UCMHybridLinearAttentionLayerWiseConnector。整存整取连接器在注册这种布局时把 use_layerwise 置为 false,避免 KVCacheLayout 的默认值再按 layerwise 组列。
Test
完成端到端精度测试
Documentation
支持矩阵目前是待验收状态,待合入出包后修改支持矩阵