Merged
experimental文件夹支持自定义算法注册 #2734
chenyizhuoAdd on Aug 24
experimental文件夹支持自定义算法注册 #2734
Merged
chenyizhuoAdd on Aug 24
chenyizhuo
Aug 24

描述

为完成在experimental文件夹打通REGISTER_EXEC_V2注册方式需求,在experimental文件夹新增一个算法来测试是否能在该文件夹使用REGISTER_EXEC_V2方式注册。

关联的Issue

NA

测试

流水线测试、真机测试和RDV测试通过。

文档更新

更新了experimental/README.md与experimental/README_en.md,添加了3.2节 实现自定义算法。增加了experimental/ops/all_reduce/example/README.md与同目录的README_en.md,描述register_v2_test文件夹的动机、结构、现状、用法、限制等。

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for chenyizhuo's contribution.)
chenyizhuochenyizhuo
Aug 24 Created pull request, commit f7ba0ac3
atomgit-bot
atomgit-bot
Aug 24 Comments:

变更摘要

本 PR 为验证 experimental 文件夹下能否正常使用 REGISTER_EXEC_V2 注册方式,新增了一个实验性 AllReduce 算法及其配套的 ST 测试用例与离线仿真 CCU 启动桩:在 experimental/ops/all_reduce/register_v2_test/ 下新增 executor、template 与 CCU kernel 三层实现,并通过 REGISTER_EXEC_V2 完成注册;同时在 test/st/algorithm 下新增调用该算法的测试用例及 CCU 仿真 stub;此外更新了 build.sh 的可选 ST 算子列表与相关 README 文档(experimental/README.md 新增 3.2 节、新增 register_v2_test/README.md)。

主要改动

  • 新增实验性 AllReduce 算法及 REGISTER_EXEC_V2 注册:在 experimental/ops/all_reduce/register_v2_test/ 下新增 InsV2AllReduceExperimentalSoleExecutor(含 Orchestrate、OrchestrateLoop、CalcRes、FastLaunchSaveCtx/FastLaunch)与模板类 CcuTempAllReduceExperimentalMesh1D(含 CalcSliceInfo、CalcRes、KernelRun、CheckCcuDataType),文件末尾通过 REGISTER_EXEC_V2(HcclCMDType::HCCL_CMD_ALLREDUCE, CcuAllReduceExperimentalMesh1D, ...) 注册,并以 CANN_VERSION_NUM >= CANN_VERSION(9, 0, 0) 条件编译保护。
  • 新增 CCU kernel 实现:新增 ccu_kernel_all_reduce_experimental_mesh1d.h/.cc,定义 CcuKernelArgAllReduceExperimentalMesh1D 与 CcuAllReduceExperimentalMesh1DKernel 入口,kernel 内按 PreSync → DoAllReduce(ReduceScatter + AllGather)→ PostSync 流程执行。
  • 新增 ST 测试用例:新增 test/st/algorithm/testcase/all_reduce_experimental_testcase.cc,以多线程方式按 rank 下发 HcclAllReduce 并做结果成图校验,覆盖 2/3/4/8 rank、多种数据类型与 sum/min/max、512KB 边界、1GB 多 loop 切片等成功场景,以及 uint16/uint32 被 API 层 CheckDataType 拦截的报错场景。
  • 新增 CCU 启动桩与仿真环境适配:新增 hcomm_ccu_launch_stub.h/.cc,实现 HcommCcuGetMemToken、HcommCcuKernelRegister*、HcclCommQueryCcuIns/HcclCommAssignCcuIns 与 HcommCcuKernelLaunch(仅支持 CcuKernelAllReduceExperimentalMesh1D,按 AllReduce 语义生成 LOCAL_COPY + READ_REDUCE + POST/WAIT 任务);并修改 sim_context_manager.cc(COMM_ENGINE_CCU 分配 HOST 内存)、sim_thread_manager.cc(COMM_ENGINE_CCU 映射为 DEVICE_NOTIFY)、sim_world.cc(Deinit 时调用 ClearCcuLaunchStub())。
  • 构建脚本与文档更新:build.sh 的 --st_ops 可用算子列表新增 all_reduce_experimental;按 PR 描述,experimental/README.md 新增「实现自定义算法」章节,并新增 register_v2_test/README.md 说明该文件夹的动机、结构、用法与限制。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 24 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robot
CANN-robotCollaborators
Aug 24 Comments:

Hi @chenyizhuo, welcome to submitting your first PR to hccl!

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
CANN-robotCANN-robotCollaborators
Aug 24 Added label: cann-cla/no
379 messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
Sep 1 Added label: ci-pipeline-passed
chenyia
chenyiaCollaborators
Sep 1 Comments:

/lgtm

likedislike
philo
philoCollaborators
Sep 1 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 1 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Sep 1 Merged pull request