已关闭
[Requirement|需求建议]: 新增inplace_partial_rotary_mul_grad算子 #3109
AlfengYuan创建于  6月13日关闭于  7月3日
AlfengYuan
AlfengYuan成员
6月13日 创建

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

融合 inplace(split + ropegrad + concat) 等小算子,实现 inplace partial RopeGrad
其中inplace的意思是原地,就是直接在输入gm地址上做ropegrad,节省gm空间
其中partial的意思是部分,只对输入的尾轴的部分做RopeGrad,原本小算子实现是先把要做的部分 split取出来,做完ropeGrad后再concat回去
RopeGrad的实现基本上参考库上 rotary_position_embedding_grad

将 inplace(split + ropeGrad + concat) 等小算子合并为一个 算子,该操作在大模型中比较常见,主要目的是提升网络性能。

Benefit / Necessity (价值/作用)

大模型旋转位置编码常见操作,提升整网性能。

Design(设计方案)

partialDy = dy[..., start:end]
assert(cos.shape[-1] == sin.shape[-1] == partialDy.shape[-1])
dy[..., start:end] = RopeGrad(partialDy, cos, sin)

likedislike
AlfengYuanAlfengYuan成员
6月13日 添加了label:requirement
AlfengYuanAlfengYuan成员
6月13日 将 alfengyuan 设为负责人
CANN-robotCANN-robot成员
7月3日 关闭了 issue
CANN-robotCANN-robot成员
7月3日 添加了label:resolved