Repository navigation
Conversation
This was referenced Oct 21, 2026
xuxl1008
force-pushed
the
feat/v41-indexer-balance
branch
from
October 22, 2026 01:59
e11c509 to
fa261c3
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.
本 PR 在保持 main attention、teacher、KL 的原始 Q owner 布局下,重新分配 Indexer 的离散 TopK 选择任务,减轻因果稠密打分的负载不均。
这是 mindspore-ai#1143 的拆分 B,依赖 A 的 CP 通信/调度分支。当前先在个人 fork 上评审,前置合入后再提主仓 master。一个功能提交,Index K 本阶段仍为完整 all-gather bank。
主要修改:
none、zigzag、greedy、hybrid接口。zigzag 保留头尾片段,greedy 用最小堆分配固定上限的 block;hybrid 同时使用绝对文档长度和最小 zigzag 片段阈值,长文档余数与其它文档进入同一 greedy 池。在 A 的配置中增加:
block size 默认 2048,仅 greedy/hybrid 可设置,必须为正整数且不大于 local Q;none/zigzag 必须省略。两个 zigzag 阈值只供 hybrid 使用,需显式指定。阈值是配置示例,不是通用最优值。均衡路径要求普通因果 Indexer、TP=1。
验证:22 项现有 UT;CPU/Gloo CP8 六层共享链,四类自然文档、两步 AdamW,三种均衡与无均衡的输出、TopK、梯度、参数及 optimizer 状态逐位一致。同一任务布局的同步/异步对照在 CPU CP8 和 NPU/HCCL CP4 均逐位一致,后者共 128 条 rank-case。最小 hybrid r1/r2 选择缓存检查共 16 条 CP4 记录:重计算开关下结果/梯度一致,LI 与输入分发每个 checkpoint 只执行一次。未新增仓库测试或改公共测试启动器。
改动文件 pylint、复杂度和格式检查通过。这里的精度结果只针对所测形状,跨任务布局不承诺任意 BF16 输入或并列 TopK 都逐位不变;本轮不新增整模型加速声明。Index K A2AV、分页 K、融合接收/TopK 恢复、后置 block 交换留给其它工作。
前置草稿:#2
本轮补充检查:独立 review、18 项本地 CPU 边界对照、41 项现有 UT 和两个改动文件 pylint 通过;未新增仓库测试或修改公共启动器。边界包括空 Q/K、不完整 TND 分区、int32/int64 与推理缓存复用。此前本地 NPU 消融已检查对应转换的 TopK/输出/梯度;本轮正式分支 CP8 配对复跑因其它任务占卡被资源监测停止,未作为新精度或性能结果。