Perf: 优化A5双Die任务局部性与SPMD派发 - #9
Open
yanghaoran29 wants to merge 1 commit into
Open
Conversation
基于连续物理cluster分核,为任务引入GLOBAL/DIE0/DIE1 domain队列,并在完成、依赖释放和本地续接路径中保持同Die局部性。为BGEMM与PA系列按依赖链分配Die;Qwen按MLP分片分Die,并将非sync-start多核SPMD拆分到双Die,保留sync-start attention及高fanin dcr_xgamma单任务。 卡1相对历史Main 3b578e3:8个case的Device latency全部改善,几何平均改善7.787%;逐case结果、限制说明以及最终代码生成的8张四级泳道随提交保存。
yanghaoran29
force-pushed
the
perf/a5-die-locality-spmd-final-20260827
branch
2 times, most recently
from
August 27, 2026 08:05
629c7cd to
c2b91ca
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.
背景
A5由两个Die组成。Main按模4分配cluster,任务通过共享ready queue动态派发;这会让Scheduler访问远端AICore,并使细粒度producer/consumer依赖在两个Die间迁移。
本PR让任务domain、Scheduler负责的物理cluster和依赖链局部性保持一致,降低跨Die完成检测、依赖释放和再次派发开销。
方案
GLOBAL、DIE0或DIE1,并为AIC/AIV/MIX维护对应ready queue。DIE_AFFINE和AUTO_DIE_AFFINEscope,分别保持显式依赖和TensorMap自动依赖语义,同时固定局部依赖链所在Die。dcr_xgamma保持单个5核任务,避免复制fanin和额外汇合。性能
设备为Ascend950PR_9579卡1,CANN 9.2.0。非Qwen每个case运行100轮;Qwen运行5轮,按Device删除最快和最慢轮次后取中间3轮。Main使用同卡历史数据,基线commit为
3b578e30a2a9e2859d19908b2647393ffdecc543。负数表示本PR更快。8个case均优于历史Main,其中7个改善超过2%。完整数据见
outputs/pr-final-all-swimlanes-card1-20260827/comparison.md和summary.csv。验证
outputs/pr-final-all-swimlanes-card1-20260827/<case>/merged_swimlane.json,可直接导入Perfetto;同目录保存kernel名称映射。已知限制
dcr_xgamma具有85路fanin,不能像普通SPMD一样直接对半拆分;当前保留为GLOBAL单任务。