合并受阻
变更摘要
本 PR 为「CANN 代码侦探 Challenge05」提交的自定义乘法(Mul)算子实现,新增一个基于 AscendC 的逐元素相乘内核及配套的构建运行脚本。内核侧通过 KernelMul 类实现分块(tiling)流水处理,采用双缓冲(BUFFER_NUM = 2、QUEUE_DEPTH = 2)方式在 CopyIn、Compute、CopyOut 三个步骤间交替搬运与计算;主机侧由 kernel_mul 封装完整的 ACL 运行时流程(设备初始化、内存申请与释放、Host/Device 数据拷贝、kernel 启动),并以 VerifyResult 对比输出与 golden 结果完成正确性验证。
主要改动
- 新增自定义乘法规格与内核实现:在
mul_custom.asc中新增MulCustomTilingData结构体(包含totalLength、tileNum字段)与mul_custom内核入口,KernelMul::Init按GetBlockNum()划分各核处理长度并初始化全局/本地缓冲区,Process循环执行CopyIn(DataCopy搬入 x/y)、Compute(AscendC::Mul完成逐元素相乘)、CopyOut(结果写回 z)以流水方式完成计算。 - 新增主机侧调用封装
kernel_mul:实现从std::vector<float>输入出发的完整 ACL 流程,包括aclrtMalloc/aclrtMallocHost申请内存、aclrtMemcpy完成 H2D 与 D2H 拷贝、以mul_custom<<<blockDim, nullptr, stream>>>启动内核,并在结束时释放资源、复位设备与aclFinalize,最后返回计算结果向量。 - 新增结果校验与主函数:
main构造长度为8 * 2048的固定输入(1.2f与2.3f)并计算 golden 期望值,VerifyResult打印输出与 golden 的前若干元素并调用std::equal判断精度校验是否通过,返回 0/1 作为进程退出码。 - 新增构建运行脚本
run.sh:检查并加载ASCEND_TOOLKIT_HOME环境(找不到时回退到/usr/local/Ascend或/opt/ascend下的set_env.sh),随后清理并创建build目录、执行cmake与make编译,最后运行./demo触发算子验证。


Hi @cftang9999, welcome to submitting your first PR to cann-outreach!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


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: yanyawen, 王艳秋, 田晓亮, gcw_tgPdOLZT, luzx66) | ❌ (0/1)(You can also ask: 王艳秋, luzx66, shaoyf, gcw_tgPdOLZT, li-shengxian3) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
cftang9999, thanks for your pull request. All authors of the commits have signed the CLA. 👍





/check_cla


/compile


AI Declaration Check Failed
@cftang9999, AI declaration is not compliant. AI tool: openCode
Please check:
- The AI tool and model declared in the PR description must be real.
- Commit messages must include the AI model, and it must be consistent with the PR description. ⚠️


AI Declaration Check Failed
@cftang9999, AI declaration is not compliant. AI tool: opencode
Please check:
- The AI tool and model declared in the PR description must be real.
- Commit messages must include the AI model, and it must be consistent with the PR description. ⚠️


当前PR是否有AI参与:
[] 否
[x] 是
__1. AI Agent 平台: opencode+cannbot-skills
__2. AI 模型: MiMo V2.5 Free
__3. Prompt上下文 :
PR功能描述 / 为什么需要这个合入**:
该PR关联的issue
(格式为fixes #<issue号>, 或者resolves #<issue号>): fixes #
希望检视人员了解:
改动类型 / Change Type
测试信息 / Testing
检查清单 / Checklist