Perf: A5双Die任务局部性适配最新Main - #10
Open
yanghaoran29 wants to merge 1 commit into
Open
Conversation
基于连续物理cluster分核,为每个任务引入GLOBAL、DIE0和DIE1 domain,并为AIC、AIV和MIX维护按domain直接索引的ready queue。completion、async-wait、deferred-release和Scheduler-local continuation传播任务domain,使固定Die的依赖链尽量在对应Die内完成。 按样例的自然依赖粒度分配任务:BGEMM按group,PA unroll和manual PA按batch链,Batch PA按chunk,Alternating根任务在两侧均分。Qwen3按MLP分片保持Gate/Up、SiLU和Down同Die,并将非sync-start多核SPMD拆成两个逻辑block区间;sync-start attention和高fanin dcr_xgamma保留为GLOBAL单任务。 分支已rebase到Main 80dd3cd,并适配最新Tensor及PTO2退役后的runtime接口。卡1同机重新测试Main和本提交:非Qwen每个case 100轮,Qwen 5轮取Device中间3轮。Alternating改善8.19%,Batch PA改善1.89%,Qwen改善5.63%,BGEMM回退0.65%;4个PA unroll/manual case回退14.89%至21.40%,8 case Device几何平均回退6.62%。最新数据、限制说明及当前代码生成的8张四级原始泳道随提交保存。
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.
背景
这是A5双Die任务局部性方案rebase到Main后的独立验证PR。原实验分支和原PR保持在旧主线版本,不由本PR覆盖。
本PR基于Main提交
80dd3cd96e568e6f3ded9c11b68e7c267a31343d,相对该提交只有一个commit:629c7cdef4e83b039fe83de1ec87d948ee4bb185。方案
GLOBAL、DIE0或DIE1,AIC/AIV/MIX分别维护按domain直接索引的ready queue。dcr_xgamma保持GLOBAL。与Main的干净构建性能对比
设备为Ascend950PR_9579卡1,CANN 9.2.0。Main和本PR均使用各自的全新worktree、全新
build/和独立PTO-ISA checkout从零编译;测试前同时卸载.venv与底层conda环境中的旧editable安装。两侧的pto_isa_build.json均已校验,所有构建路径都位于各自worktree内。80dd3cd96e568e6f3ded9c11b68e7c267a31343d629c7cdef4e83b039fe83de1ec87d948ee4bb185task-submit锁,不执行RTT preflight。Qwen中间3轮Device样本:
35793.9, 36244.5, 36302.7 us;35271.3, 35283.7, 35413.7 us。本次8个case的Device latency全部改善,没有Device回退项。Qwen的Orchestrator单项回退
2.35%,但Device、Effective和Scheduler均改善约2.19%。此前PR描述中的性能表受到本机残留editable安装污染:构建后端曾从系统site-packages加载旧优化仓库。本次已清除该安装,并用构建元数据强制验证Main/PR来源;旧表不再作为性能结论。
验证和泳道
merged_swimlane.json,可直接导入Perfetto;kernel名称映射保存在对应case目录。已知问题
2.35%,后续可继续压缩任务domain路由与依赖构造开销。Qwen3后续Die-local实验(独立分支,尚未合入本PR)
在本PR提交
629c7cdef4e83b039fe83de1ec87d948ee4bb185基础上继续减少Qwen3跨Die依赖,实验代码位于分支exp/a5-qwen-domain-bridges-20260827,最新提交为cd5eefefc1b4994dd3d7670a120e6abed2559aea。本节是后续实验结果,当前PR head尚不包含这两个实验提交;上方全量表中的Qwen数据仍对应当前PR代码。新增算法:
residual_rms_castconsumer固定在同一Die;mlp_out_seed与24-block CANN PA保持GLOBAL。mlp_out_seed同时清零down/gate/up/attention四类accumulator,且GLOBAL PA必须等待全部seed完成,继续拆分不能带来提前启动收益。测试仍固定Ascend950PR_9579卡1,关闭泳道;先运行1轮golden并PASS,再运行5轮。按Device latency排序,删除最快和最慢轮,对中间3轮及其对应指标取平均:
629c7cde87c23c26cd5eefef最终版本相对当前PR:Device改善
2.11%、Effective改善2.26%、Scheduler改善2.43%、Orchestrator改善0.37%。最终5轮Device原始值为34644.2, 34473.0, 34434.4, 34612.5, 34932.8 us,入选中间3轮为34473.0, 34612.5, 34644.2 us。