Merged
新增batch一致性需求的reduce模版 #519
sunzhongwen1Add on Jun 11
新增batch一致性需求的reduce模版 #519
Merged
Merged fromsunzhongwen1/opbasebatchvariantintocann/opbasemaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for sunzhongwen1's contribution.)Jun 11 Created pull request, commit 18b24a59
Jun 11 Added label: cann-cla/yes
CANN-robot
Jun 11 Comments:
Jun 11 Comments:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| pkg_inc | ✅ jia0liang, wangrui_, 王永光 (3/2) | ✅ 王永光 (1/1) |
| repo-cann/opbase | ✅ jia0liang, wangrui_ (2/2) | ✅ jia0liang (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
sunzhongwen1, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Jun 16 Force-pushed 1 commits:6ae68dad-新增batch一致性需求的reduce模版
Jun 22 Force-pushed 1 commits:648e7477-新增batch一致性需求的reduce模版
52 messages are collapsed here。 See more
wangyongguang
Jun 27 Comments:
Jun 27 Comments:
/approve


陈佳良
Jun 27 Comments:
Jun 27 Comments:
/lgtm
/approve


Jun 27 Added label: lgtmapproved
Jun 27 Closed associated issue
Jun 27 Merged pull request
描述
为了满足batch一致性的需求,需要在tiling中设计有针对性的切分策略,来满足不同的batch轴,最后计算都能满足batch一致性。
一、
新的Tiling策略
先切R后切A
切R原则分尾轴为A和尾轴为R,总体策略是R优先占满ub,剩下的先开满多核,开满多核后开ub间循环。
切A原则为占满ub,剩下的开多核,开满核后剩下的A启用A轴ub间循环。
AR pattern和尾轴为R并且尾轴R大于32/64,ub内不预留cachesize;其他情况ub内预留cachesize
step1.切R
切出UB内R.i
if R/R.i<=64:R/R.i全部开多核
else:开满核,R轴ub间循环R.i.o = R/R.i/64
step2.
先往ub内塞,A.i
if groupR * A/A.i <=64:
A/A.i全部开多核
else:
factorACntPerCore = ceildiv(outerA, FloorDiv(blockNum, groupR))
factorATotalCnt = outerA
realcoreNum = CeilDiv(outerA, factorACntPerCore) * CeilDiv(outerR, factorRCntPerCore)
二、
目前模板的group场景,没有支持A轴的ub间循环,但是当前tiling策略会存在group场景且A轴需要ub间循环的情况,需要kernel中对于group场景增加A轴的ub间循环。需要新增key来隔开kernel代码
for A.i.o
for R.i.o
搬入
reduce
累加
搬出
三、针对上述tiling和kernel修改,需要增加一个batchInvariant的key用来判断走不同的tiling和kernel分支。
关联的Issue
测试
文档更新
类型标签