合并受阻
变更摘要
该 PR 主要完成 CANN 代码侦探 Challenge05 的 MulCustom 逐元素乘法算子(关联 issue #700):新增 mul_custom.asc,实现基于 AscendC::Mul 的多核、Double Buffer 分块乘法 kernel KernelMul,并提供 host 侧 kernel_mul 驱动、结果校验函数以及一键编译运行的 run.sh 脚本。此外,本次改动文件同时包含了 Challenge02 的 div_bf16_custom.asc(bfloat16 除法算子)及其 run.sh,整体属于算子实现与本地验证代码的新增(共新增 464 行,无删除)。
主要改动
KernelMul多核乘法算子实现: 在mul_custom.asc中新增KernelMul类,按核数切分数据(blockLength = totalLength / GetBlockNum()),并按 Double Buffer 计算每段搬运长度(tileLength = blockLength / tileNum / BUFFER_NUM,其中BUFFER_NUM = 2),通过CopyIn/Compute/CopyOut流水处理,在Compute中调用AscendC::Mul完成z = x * y的逐元素乘法。- host 侧驱动与校验逻辑: 同文件新增
MulCustomTilingData结构(含totalLength、tileNum)与kernel_mul函数,通过 ACL 接口完成设备内存分配、数据搬运,并以 8 核(numBlocks = 8)启动mul_customkernel、回拷结果;VerifyResult将输出与 golden 对比(如 1.2 × 2.3 = 2.76)并打印验证结论。 - 新增编译运行脚本: 新增
MulCustom/run.sh,自动探测并激活 CANN 环境(ASCEND_TOOLKIT_HOME),以dav-2201架构通过 cmake 编译后运行mul_test进行算子验证。 - 包含 Challenge02 的除法算子文件: 改动同时新增
div_bf16_custom.asc,实现bfloat16除法算子:将输入bfloat16_t通过Cast(CAST_NONE)转为float,调用AscendC::Div后以CAST_RINT转回bfloat16_t,配套run.sh完成编译与结果校验。


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
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/cann-outreach | ❌ (0/2)(You can also ask: li-shengxian3, Carolina_yuan, luzx66, 王艳秋, yanhf) | ❌ (0/1)(You can also ask: 傅涛, Carolina_yuan, yanhf, 田晓亮, luzx66) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
weixin_48384182, thanks for your pull request. All authors of the commits have signed the CLA. 👍


当前PR是否有AI参与:
[x] 否
[ ] 是
__1. AI Agent 平台:
__2. AI 模型:
__3. Prompt上下文 :
PR功能描述 / 为什么需要这个合入**:
MulCustom逐元素乘法算子
该PR关联的issue
https://gitcode.com/cann/cann-learning-hub/issues/700
希望检视人员了解:
改动类型 / Change Type
测试信息 / Testing
检查清单 / Checklist
测试:
