已合并
[社区任务] aclsparseSpMM A2/A3 算子设计文档 #1113
[社区任务] aclsparseSpMM A2/A3 算子设计文档 #1113
已合并
nwww创建于 16 天前
nwww
16 天前

当前PR是否有AI参与

[ ] 否

[x] 是

1. AI Agent 平台: OpenAI Codex
2. AI 模型: GPT-5
3. Prompt上下文: 使用 AI 辅助梳理 aclsparseSpMM A2/A3 社区任务需求、分析现有算子实现、整理 Host/Kernel/ATen 适配方案、诊断测试问题、核对验证结果,并协助编写和检查设计文档。所有代码提交、测试执行、结果确认及 PR 创建均由开发者在实际 Ascend A2/A3 环境中完成。

PR功能描述 / 为什么需要这个合入

本 PR 提交 CANN 社区任务“08-12-aclsparseSpMM 算子开发(A2/A3)”的算子设计文档。

文档路径:

04_tasks/01_community-task-2026/tasklist/08-12-aclsparseSpMM-A2A3/nannan-2026/docs/design.md

本任务基于 ops-sparse 仓库已有的 aclsparseSpMM 能力进行扩展,目标是在 Ascend A2、Ascend A3 环境中完善稀疏矩阵与稠密矩阵乘加能力,并打通以下调用链路:

torch.sparse.addmm → ATen NPU / PrivateUse1 Adapter → aclsparseSpMM C++ API → Host Tiling → Ascend C Kernel

设计文档主要包含以下内容:

  1. aclsparseSpMM 需求背景和功能分析;
  2. CSR 稀疏矩阵与稠密矩阵乘加的数学定义;
  3. FP16、BF16、FP32、Complex64 数据类型支持方案;
  4. CSR row pointer、column index 和 value 的处理方式;
  5. opAopB 转置及共轭转置设计;
  6. Row Major、Column Major 布局及 leading dimension 处理;
  7. CSR 索引基址和算法选择支持;
  8. nnz=0、空行等稀疏边界处理;
  9. Host 侧参数检查、Workspace 计算和 Tiling 设计;
  10. Ascend C Kernel 侧数据搬运、计算及结果写回方案;
  11. PyTorch/ATen NPU torch.sparse.addmm 适配方案;
  12. A2/A3 功能、精度和性能验证方案;
  13. 兼容性、约束条件和异常处理说明。

本 PR 仅提交设计文档,不包含算子实现代码。关联实现代码已通过独立 PR 提交至官方 cann/ops-sparse 仓库。

该PR关联的issue

无独立 Issue。

关联社区任务:

08-12-aclsparseSpMM 算子开发(A2/A3)

关联设计文档 PR:

https://gitcode.com/cann/cann-ops-competitions/pull/1113

关联代码 PR:

https://gitcode.com/cann/ops-sparse/pull/128

关联个人代码仓库:

希望检视人员了解

  1. 本 PR 是纯设计文档变更,算子代码位于关联的 ops-sparse PR #128。
  2. 设计内容以实际提交的实现和 A2/A3 环境验证结果为依据,不是未落地的概念方案。
  3. A2、A3 均已完成完整的 ATK 精度验证。
  4. A3 性能 Event 与 torch_npu.profiler 采集链路已完成小规模预检;本设计文档不声明尚未形成正式报告的性能结论。
  5. Profiler 使用 Level1 采集,能够生成 op_statistic.csvkernel_details.csv,用于确认算子在 NPU Kernel 上执行。
  6. 文档中没有包含账号令牌、密码、访问凭证或其他敏感信息。

改动类型 / Change Type

测试信息 / Testing

本 PR 本身仅修改 Markdown 设计文档;关联算子实现已在真实 Ascend A2/A3 环境中完成以下验证。

A2 环境验证

  • CANN 版本:9.0.0
  • 代码分支:feature/aclsparse-spmm-a2a3
  • 代码提交:f385698d7c0b25890f7c3ef6acf24d5b3b933b86
  • 工程构建:通过
  • FP16/BF16 dtype smoke:通过
  • layout/base/algorithm smoke:通过
  • Complex64 smoke:通过
  • CSR sparse boundary smoke:通过
  • ATen NPU torch.sparse.addmm 测试:通过
  • ATK 完整精度测试:200/200 通过
  • 精度通过率:100%
  • ATK 退出状态:成功

A2 关键结果:

Total Task: 200, success 200, failed 0

Summary info: acc_pass_result:Pass

atk task success

A3 环境验证

  • CANN 版本:9.0.0
  • PyTorch:2.7.1+cpu
  • torch_npu:2.7.1.post4
  • 代码分支:feature/aclsparse-spmm-a2a3
  • 代码提交:f385698d7c0b25890f7c3ef6acf24d5b3b933b86
  • 工程构建:通过
  • FP16/BF16 dtype smoke:通过
  • layout/base/algorithm smoke:通过
  • Complex64 smoke:通过
  • CSR sparse boundary smoke:通过
  • ATen NPU torch.sparse.addmm 测试:通过
  • ATK 完整精度测试:200/200 通过
  • 精度通过率:100%
  • Event 性能采集预检:2/2 通过
  • torch_npu.profiler Level1 预检:2/2 通过
  • op_statistic.csv:成功生成
  • kernel_details.csv:成功生成

A3 关键结果:

Total Task: 200, success 200, failed 0

Summary info: acc_pass_result:Pass

completed: 2/2 succeeded

PROFILER_LEVEL1_EXIT=0

文档检查

  • UTF-8 编码检查:通过
  • Markdown 文件可正常读取:通过
  • 模板残留检查:通过
  • git diff --check:通过
  • 提交范围检查:仅新增目标任务目录下的 docs/design.md

测试勾选:

检查清单 / Checklist

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 nwww 的贡献)
Nnwww
16 天前 创建了 pull request,commit d14b9740
atomgit-bot
atomgit-bot
16 天前 评论:

变更摘要

该 PR 是社区任务交付的文档类改动,新增了 aclsparseSpMM 算子 A2/A3 的设计文档。整体为纯文档新增(1 个文件、新增 385 行、无删除行),不涉及代码、测试或配置改动,用于补充该稀疏矩阵乘法算子在 A2/A3 场景下的设计方案。

主要改动

  • 新增 aclsparseSpMM A2/A3 算子设计文档: 以文档形式补充该算子 A2/A3 设计说明,属于本次 PR 的核心交付内容(385 行全部为新增内容)。
  • 纯文档改动,无业务代码影响: 本次变更仅包含文档新增,未修改任何源代码、测试用例或配置文件,不影响现有功能行为。
likedislike
CANN-robotCANN-robot成员
16 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
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

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/cann-ops-competitions 傅涛, Carolina_yuan (2/2) 傅涛, Carolina_yuan (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

nannan-2026, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
16 天前 评论:

CLA Signature Pass

nannan-2026, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
Nnwww
16 天前 修改了pull request 的描述
CANN-robotCANN-robot成员
16 天前 添加了label:ai-co-authored
CANN-robotCANN-robot成员
16 天前 添加了label:ai-docs-only
CANN-robotCANN-robot成员
16 天前 添加了label:ai-compliance-failed
CANN-robot
CANN-robot成员
16 天前 评论:

AI Declaration Check Failed

@nannan-2026, AI declaration is not compliant. AI tool: OpenAI Codex

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
nwww
16 天前 评论:

compile

likedislike
Nnwww
16 天前 update merge request[project id: 9516645, iid: 1113, commit_id: 8de9782ef07e94e14b5558c42999d97d2ecfdd45] virtual merging success
此处折叠了7条事件消息 查看更多
CANN-robotCANN-robot成员
15 天前 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
15 天前 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
CANN-robotCANN-robot成员
15 天前 删除了label:ai-compliance-failed
CANN-robotCANN-robot成员
15 天前 添加了label:ai-compliance-successful
忧莫晓
11 天前 评论:

评审通过

likedislike
nwww
11 天前 评论:

评审通过

@moxiaoyou

老师,您好,image.png我这里的验收任务显示的文档未通过,我是需要改这个验收文件吗还是这个pr里的文件内容,我不太明白,麻烦指教

likedislike
fulltower成员
11 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
11 天前 添加了label:approved
圆啊圆
圆啊圆成员
10 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
10 天前 添加了label:lgtm
condfuse_3
condfuse_3成员
10 天前 评论:

compile

likedislike
Nnwww
10 天前 update merge request[project id: 9516645, iid: 1113, commit_id: 99ce6a846304c245b52d6143ebe1f47097858a8b] virtual merging success
CANN-robotCANN-robot成员
10 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
10 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
10 天前 添加了label:ci-pipeline-passed
condfuse_3
condfuse_3成员
8 天前 评论:

@nannan-2026 你好,社区任务设计文档 PR 自动检视结果:当前未通过评审。请按下列项修改后重新提交。

1. CLA 状态未知

  • 未检测到 cann-cla/yescann-cla/no
  • 请完成 CLA 签署,并确认 PR 带有 cann-cla/yes 标签。

全部满足后(CLA-yes + CI-pass + 设计分≥80 + 无未解决意见 + 路径正确或为忽略)将视为评审通过。

likedislike
nwww
8 天前 评论:

/check-cla

likedislike
CANN-robotCANN-robot成员
8 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8 天前 评论:

CLA检查已通过,详情可参考这里

likedislike
CANN-robotCANN-robot成员
8 天前 合入了pull request