Merge blocked
变更摘要
本 PR 以设计文档形式新增 04_tasks/01_community-task-2026/tasklist/12-aclsparseAxpyi-950-910/huier325/docs/design.md,用于描述 aclsparseAxpyi 稀疏向量缩放累加算子在 Ascend 950 与 Atlas A2/A3 双架构下的开发方案。文档覆盖需求背景与参数约束、数学公式、双架构核函数与分核策略、PyTorch 封装层注册方式、硬件支持范围、精度与性能验收标准及自测结果汇总,明确以 torch_npu.sparse.aclsparse_axpyi 与 aclsparseAxpyi / aclsparseAxpyiRaw C 接口为验收基准,并声明不修改仓内已有算子接口与二进制 ABI。
主要改动
- 算子接口与参数约束定义:文档给出
alpha、x_val、x_ind、y、out的参数表与计算公式y[xInd[k] - idxBase] = alpha * xVal[k] + y[xInd[k] - idxBase],并约定值类型float32/float16/bfloat16、索引类型int32/int64、0-based 与 1-based 模式及0 <= nnz <= N的边界条件。 - 双架构目录与实现方案:规划
sparse/axpyi/arch22/(Atlas A2/A3,dav-2201)采用Brcb/Gather/GatherMask全矢量流水与硬件原子加,sparse/axpyi/arch35/(Ascend 950,dav-3510)采用__simt_vf__/asc_vf_call的 SIMT 线程级并行,并分别说明 Host 侧分核策略与 Kernel 侧流水设计。 - 并发写防撕裂策略:针对随机 Scatter-Add 的跨核同 32B Cache Line 写撕裂问题,文档区分
float32的SetAtomicAdd<float>()加 4 字节DataCopyPad原子写回、float16/bfloat16的 3 级异步流水配合DataCopyPad字节使能选通写回,以及arch35索引互异前提下的标量地址访存方案。 - PyTorch 封装与注册机制:通过
TORCH_NPU_SPARSE_FACADE_APIS = {"aclsparse_axpyi": aclsparse_axpyi}自动挂载到torch_npu.sparse.aclsparse_axpyi,由 pybind 入口完成设备/维度/dtype/长度校验、非连续张量.contiguous()、基于ValidatedIndexBoundsCache的索引越界校验,并调用aclsparseAxpyiRaw返回新张量。 - 验收标准与自测结果记录:文档列出分 dtype 的精度容差、TC-01 ~ TC-11 功能覆盖与 24 组规模 x dtype 性能点,并记录 Ascend 950 模拟器 9/9、Atlas A3 C++ 单元测试 18/18、官方脚本 43/43 与全量脚本 80/80 的验证结果及
msprof管线利用率数据。


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-ops-competitions | ❌ (0/2)(You can also ask: syeren, 王艳秋, Albertq, 傅涛, zutao) | ❌ (0/1)(You can also ask: syeren, jackwangc, 田晓亮, guomin36, zutao) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
huier325, thanks for your pull request. All authors of the commits have signed the CLA. 👍


12月社区任务 aclsparseAxpyi(Atlas A2/A3 arch22 & Ascend 950 arch35 + torch_extension)算子设计文档。已完成双架构编码、Ascend 950 周期级模拟器 9/9 验证、Atlas A3 150/150 全量精度测试与 24 组性能测试(较同机 torch_npu 提速 7.6x~48.5x,MTE3 利用率达 95.2%)。提交账号:huier325。