Closed
[Requirement|需求建议]: mhc_pre算子支持batch一致性 #4421
hyhhh14Add on  Aug 19Closed at  Aug 21
hyhhh14
hyhhh14Collaborators
Aug 19 Create

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

Backgroud(背景信息)

新支持功能
新增支持batch一致性,当用户将确定性等级设置为 3 时,MhcPre 开启 Batch 一致性模式:
torch_npu 接口:调用:torch_npu.npu.set_deterministic_level(3)
aclnnMhcPre 和 aclnnMhcPreV2 共用同一套 tiling 逻辑,因此两套接口都支持该能力。

解决的问题
MhcPre 原有 tiling 会根据输入 shape 在 SPLIT_M_K、SPLIT_ND 和 SPLIT_BS 之间选择。
开启 deterministic_level=3 后,算子固定使用 SPLIT_BS,使 Batch 方向采用稳定的计算和累加顺序,从而满足 Batch 一致性场景的要求。
相关tiling代码修改在PR:https://gitcode.com/cann/ops-transformer/pull/9243/diffs
image.png

Benefit / Necessity (价值/作用)

Design(设计方案)

likedislike
hyhhh14hyhhh14Collaborators
Aug 19 Added label: requirement
hyhhh14hyhhh14Collaborators
Aug 19 Associated pull request
weihao18
weihao18Collaborators
Aug 19 Comments:

/assign @hyhhh14

likedislike
CANN-robotCANN-robotCollaborators
Aug 19 Assign hyhhh14 as responsible person
CANN-robotCANN-robotCollaborators
Aug 21 Close issue
CANN-robotCANN-robotCollaborators
Aug 21 Added label: resolved