Pull Request has been successfully merged by CANN-robot.
(Thank you for Yuan Bin's contribution.)变更摘要
本 PR 修复了 posembedding/inplace_partial_rotary_mul/op_kernel/inplace_partial_rotary_mul.h 中 InplacePartialRotaryMulABA 模板的 ComputeMul 方法在非广播(非 brc)分支中调用 Mul 时的 repeatTimes 截断问题。原先直接以 numHead 作为重复次数传入,当 numHead 超过 Mul 接口支持的重复次数上限时会被截断;改动后通过内层循环将待处理numHead拆分为多段,每段重复次数限制在 MAX_MUL_REPEAT_TIME 以内,并按 done * mask 偏移源与目标地址,从而覆盖全部 head 数据。
主要改动
- 分段调用
Mul以规避重复次数上限:将原先单次传入numHead的Mul调用改为for (uint32_t done = 0; done < numHead;)循环,按MAX_MUL_REPEAT_TIME上限分段执行,避免repeatTimes被截断。 - 引入重复次数计算逻辑:循环内通过
remaining = numHead - done与static_cast<uint8_t>(remaining > MAX_MUL_REPEAT_TIME ? MAX_MUL_REPEAT_TIME : remaining)计算本段实际重复次数repeats,并在每段结束后以done += repeats推进。 - 同步调整地址偏移:
Mul的输入src0Ub与输出dtsUb偏移量由j * count改为j * count + done * mask,保证各分段作用于正确的数据区间,而src1Ub[j * headDim]保持不变。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| posembedding | ✅ kdy18482276080, cc-z (2/2) | ✅ cc-z, kdy18482276080 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
aaaakai, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


流水线分析报告 — ops-transformer run#9118
流水线: https://gitcode.com/CANN/ops-transformer/actions/runs/7caef5a76ae648a689b84a891032a464 | PR#13040 | 2026-09-28 10:34:56 ~ 2026-09-28 10:42:23 | 失败 Job 1 个
定界结论: 代码问题 / 代码检查错误 — clang-format 格式不通过
- 失败类型: 代码问题
- 根因: pre-commit 检查项 clang-format 不通过,文件被 hook 自动改写:
posembedding/inplace_partial_rotary_mul/op_kernel/inplace_partial_rotary_mul.h - 处置建议: 通知 PR 提交者修复 — 本地对该文件执行 clang-format 格式化(或执行
pre-commit run clang-format --all-files)后重新提交推送- 参考链接: 本地执行 pre-commit 指导
- 排除项: 其余 pre-commit 检查项(trim trailing whitespace / fix end of files / ruff / codespell / OAT / duplicate-header)均 Passed;下游 Job(API_Check / UT / PreSmoke_A2 / Kirin_PreSmoke)因前置失败级联未启动,无独立失败
失败根因分析
根因 #1: 代码问题 / 代码检查错误 — clang-format 格式不通过
- 判据: pre-commit 检查项不通过: clang-format(files were modified by this hook)
- 定位步骤:
3_precommit.log - 影响 Job: CodeCheck_precommit
- 根因证据(日志原文):
[2026-09-28 10:38:17.602+08:00] clang-format.............................................................Failed
[2026-09-28 10:38:17.603+08:00] - hook id: clang-format
[2026-09-28 10:38:17.604+08:00] - files were modified by this hook
[2026-09-28 10:38:17.607+08:00] Formatting [1/1] posembedding/inplace_partial_rotary_mul/op_kernel/inplace_partial_rotary_mul.h
由门禁失败定界分析自动生成 | repo: ops-transformer | run: 7caef5a76ae648a689b84a891032a464 | PR#13040


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/lgtm
/approve


/lgtm
/approve


描述
调用入参截断导致了inplacePartialRotaryMul算子的部分special路径的用例精度失效。
解决方法
在special路径调用Mul时针对repeatTime参数超过接口限制时展开循环逐段处理。
关联的Issue
https://gitcode.com/cann/ops-transformer/issues/5722
测试
通过了本地白盒泛化测试。
文档更新
类型标签