已开启
【代码侦探Challenge05】完成MulCustom逐元素乘法算子 #3609
JeffDing创建于 16 天前
【代码侦探Challenge05】完成MulCustom逐元素乘法算子 #3609
已开启
合并受阻
16 天前 添加了label:cann-cla/yes
CANN-robot
16 天前 评论:
16 天前 评论:
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, luzx66) | ❌ (0/1)(You can also ask: yanhf, yanyawen, jxlang, 王艳秋, shaoyf) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
JeffDing, thanks for your pull request. All authors of the commits have signed the CLA. 👍


16 天前 修改标题为 “【代码侦探Challenge05】完成Qianqiuer的MulCustom逐元素乘法算子”,原标题为“add MulCustom Code”
16 天前 修改标题为 “【代码侦探Challenge05】完成MulCustom逐元素乘法算子”,原标题为“【代码侦探Challenge05】完成Qianqiuer的MulCustom逐元素乘法算子”
16 天前 修改标题为 “【代码侦探Challenge05】完成MulCustom逐元素乘法算子”,原标题为“【代码侦探Challenge05】完成Qianqiuer的MulCustom逐元素乘法算子”
16 天前 修改了pull request 的描述
16 天前 修改了pull request 的描述
16 天前 关联了issue:[Feature]: 【代码侦探Challenge05】完成MulCustom逐元素乘法算子
Challenge05 · MulCustom 逐元素乘法算子
按任务书要求补全
mul_custom.asc,实现 Ascend C 逐元素乘法算子z[i] = x[i] * y[i]。实现要点
TQue<TPosition::VECIN/VECOUT, BUFFER_NUM=2>,数据搬运与计算并行GetBlockNum()/GetBlockIdx()+SetGlobalBuffer设置每核偏移AscendC::Mul(zLocal, xLocal, yLocal, tileLength)完成逐元素乘法aclrtMalloc/Memcpy+ kernel 直调mul_custom<<<blockDim, nullptr, stream>>>提交文件
mul_custom.asc—— 算子核函数实现CMakeLists.txt—— 构建脚本run.sh—— 编译运行脚本主要改动
本 PR 由 @JeffDing 提交,目标是补全
mul_custom.asc,实现 Ascend C 逐元素乘法算子z[i] = x[i] * y[i]。该实现采用 Vector 编程范式的 CopyIn → Compute → CopyOut 三段式流水线,通过TQue<TPosition::VECIN/VECOUT, BUFFER_NUM=2>双缓冲实现数据搬运与计算并行,并借助GetBlockNum()/GetBlockIdx()+SetGlobalBuffer完成多核数据切分,最终以AscendC::Mul指令完成逐元素乘法。Host 侧使用aclrtMalloc/Memcpy分配与拷贝数据,并直接以mul_custom<<<blockDim, nullptr, stream>>>方式调用核函数。主要改动
mul_custom.asc中按 Vector 编程范式实现MulCustom算子的 CopyIn → Compute → CopyOut 三段式流水线,完成z[i] = x[i] * y[i]的逐元素乘法逻辑。TQue<TPosition::VECIN/VECOUT, BUFFER_NUM=2>配置输入输出队列,使数据搬运与计算并行执行。GetBlockNum()/GetBlockIdx()结合SetGlobalBuffer设置每核数据偏移,实现多核并行处理。AscendC::Mul(zLocal, xLocal, yLocal, tileLength)完成逐元素乘法计算。aclrtMalloc/Memcpy管理数据,以 kernel 直调方式启动;并新增CMakeLists.txt构建脚本与run.sh编译运行脚本以支撑算子编译与运行验证。