已开启
【代码侦探Challenge05】 cftang9999 MulCustom #2471
【代码侦探Challenge05】 cftang9999 MulCustom #2471
已开启
cftang9999创建于 15 天前
cftang9999
15 天前

当前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

likedislike
合并受阻
Ccftang9999
15 天前 创建了 pull request,commit 09de1e71
atomgit-bot
atomgit-bot
15 天前 评论:

变更摘要

本 PR 为「CANN 代码侦探 Challenge05」提交的自定义乘法(Mul)算子实现,新增一个基于 AscendC 的逐元素相乘内核及配套的构建运行脚本。内核侧通过 KernelMul 类实现分块(tiling)流水处理,采用双缓冲(BUFFER_NUM = 2QUEUE_DEPTH = 2)方式在 CopyInComputeCopyOut 三个步骤间交替搬运与计算;主机侧由 kernel_mul 封装完整的 ACL 运行时流程(设备初始化、内存申请与释放、Host/Device 数据拷贝、kernel 启动),并以 VerifyResult 对比输出与 golden 结果完成正确性验证。

主要改动

  • 新增自定义乘法规格与内核实现:在 mul_custom.asc 中新增 MulCustomTilingData 结构体(包含 totalLengthtileNum 字段)与 mul_custom 内核入口,KernelMul::InitGetBlockNum() 划分各核处理长度并初始化全局/本地缓冲区,Process 循环执行 CopyInDataCopy 搬入 x/y)、ComputeAscendC::Mul 完成逐元素相乘)、CopyOut(结果写回 z)以流水方式完成计算。
  • 新增主机侧调用封装 kernel_mul:实现从 std::vector<float> 输入出发的完整 ACL 流程,包括 aclrtMalloc/aclrtMallocHost 申请内存、aclrtMemcpy 完成 H2D 与 D2H 拷贝、以 mul_custom<<<blockDim, nullptr, stream>>> 启动内核,并在结束时释放资源、复位设备与 aclFinalize,最后返回计算结果向量。
  • 新增结果校验与主函数main 构造长度为 8 * 2048 的固定输入(1.2f2.3f)并计算 golden 期望值,VerifyResult 打印输出与 golden 的前若干元素并调用 std::equal 判断精度校验是否通过,返回 0/1 作为进程退出码。
  • 新增构建运行脚本 run.sh:检查并加载 ASCEND_TOOLKIT_HOME 环境(找不到时回退到 /usr/local/Ascend/opt/ascend 下的 set_env.sh),随后清理并创建 build 目录、执行 cmakemake 编译,最后运行 ./demo 触发算子验证。
likedislike
不准确?
CANN-robot
CANN-robot成员
15 天前 评论:

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.

likedislike
atomgit-bot
atomgit-bot
15 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
15 天前 添加了label:cann-cla/no
CANN-robotCANN-robot成员
15 天前 添加了label:ai-co-authored
CANN-robot
CANN-robot成员
15 天前 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
cftang9999
15 天前 评论:
cftang9999
15 天前 评论:

xxx.jpg

likedislike
cftang9999
15 天前 评论:

/check_cla

likedislike
cftang9999
15 天前 评论:

/compile

likedislike
Ccftang9999
7 天前 预合并成功(commit_id: 33fcf383955d3fd0465e182ee0d454ff91310c38)
此处折叠了6条事件消息 查看更多
CANN-robotCANN-robot成员
7 天前 添加了label:ai-compliance-failed
CANN-robot
CANN-robot成员
7 天前 评论:

AI Declaration Check Failed

@cftang9999, AI declaration is not compliant. AI tool: openCode

Please check:

  1. The AI tool and model declared in the PR description must be real.
  2. Commit messages must include the AI model, and it must be consistent with the PR description. ⚠️
likedislike
Ccftang9999
7 天前 预合并成功(commit_id: be35ba3a97337466dbb3eccaf3ba311b45444b56)
Ccftang9999
7 天前 强制推送  1 个提交:33424366-【代码侦探Challenge04】 cftang9999 div_custom_template
Ccftang9999
7 天前 预合并成功(commit_id: 2af60c9f26992038d8db30c0066c9828a56a9908)
CANN-robotCANN-robot成员
7 天前 删除了label:cann-cla/yes
CANN-robotCANN-robot成员
7 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7 天前 评论:

AI Declaration Check Failed

@cftang9999, AI declaration is not compliant. AI tool: opencode

Please check:

  1. The AI tool and model declared in the PR description must be real.
  2. Commit messages must include the AI model, and it must be consistent with the PR description. ⚠️
likedislike