合并受阻
变更摘要
该 PR 面向「代码侦探 Challenge05」挑战,实现了逐元素乘法算子 MulCustom,用于计算 z[i] = x[i] * y[i]。改动新增了一个完整的 AscendC 自定义算子实现:包含 KernelMul 内核类(完成 Init 初始化、Process 主循环、CopyIn 搬入、Compute 计算、CopyOut 搬出全流程,其中 Compute 通过 AscendC::Mul 完成逐元素相乘),并基于 Double Buffer(BUFFER_NUM = 2)实现数据流水。同时提供了 mul_custom kernel 入口函数、Host 侧 kernel_mul 直调封装(基于 ACL 运行时完成内存申请、H2D/D2H 拷贝与流同步),以及 VerifyResult 精度校验与 main 验证逻辑。整个算子通过 MulCustomTilingData 传递 totalLength 与 tileNum 分块参数,按 GetBlockNum()/GetBlockIdx() 进行多核切分。
主要改动
- 新增内核算子实现(
mul_custom.asc):实现KernelMul类及Init/Process/CopyIn/Compute/CopyOut方法,Compute中调用AscendC::Mul对x、y逐元素相乘并输出到z,整个过程使用BUFFER_NUM = 2的双缓冲队列inQueueX、inQueueY、outQueueZ实现流水。 - 新增 Host 侧调用与验证逻辑:
kernel_mul通过 ACL 接口(aclrtMalloc、aclrtMemcpy、mul_custom<<<blockDim, nullptr, stream>>>、aclrtSynchronizeStream等)完成设备内存管理、数据搬入搬出与 kernel 启动;main构造长度为8 * 2048的输入并经VerifyResult与 golden 结果逐元素比对。 - 新增构建运行脚本(
run.sh):脚本激活 CANN 环境(set_env.sh)、创建build目录、执行cmake与make编译,并运行生成的mul_test可执行程序完成验证。


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: 田晓亮, yanhf, Carolina_yuan, 王艳秋, gcw_tgPdOLZT) | ❌ (0/1)(You can also ask: yanhf, gcw_tgPdOLZT, Carolina_yuan, jxlang, yanyawen) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
gxhgxh2475698, 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功能描述 / 为什么需要这个合入**:
在
2026/CANN-Code-Detective/Challenge05-MulCustom/gxhgxh2475698/MulCustom中完成 MulCustom 逐元素乘法算子:TQue初始化;CopyIn -> Compute -> CopyOut流程实现流水处理;AscendC::Mul完成z[i] = x[i] * y[i];提交范围仅包含任务书要求的
mul_custom.asc、CMakeLists.txt和run.sh,不包含构建产物。该PR关联的issue
https://gitcode.com/cann/cann-learning-hub/issues/700
希望检视人员了解:
改动类型 / Change Type
测试信息 / Testing
bash run.sh验证结果: