Merge blocked
🤖 正在生成合并请求摘要,请稍候…


Hi @huier325, welcome to submitting your first PR to CANN!
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.
%!(EXTRA string=https://atomgit.com/cann/community/blob/master/en/sig-infrastructure/command.md)


🤖 AI 代码检视正在进行中,请稍候…


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/ops-sparse | ❌ (0/2)(You can also ask: chenbinbin199309, fanzhaoyun001, xutianze, 朱如意, HuangKun8682) | ❌ (0/1)(You can also ask: 唐超, 朱志明, 唐超力, HuangKun8682, fanzhaoyun001) |
💡 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. 👍


⚠️ 本次变更过大(22 个可审文件、3876 行,预估需 4 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。


compile


⚠️ 本次变更过大(22 个可审文件、3876 行,预估需 4 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。


流水线任务触发成功
任务链接 [499972c49a18483d8d3c32a873f87508][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_A2 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A2 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A2_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A2_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_A5_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| codecheck | ❌ FAILED | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| pre-commit | ✅ SUCCESS |


[Major] 内存别名校验发生在 copy kernel 入队之后,校验形同虚设
L134-L174 已经根据 ySrcPtr != yDstPtr 异步入队了 axpyi_copy_kernel_do 写入 yDst,之后 L190-L194 才用 AxpyiRangesOverlap 校验 yDst 与 xVal/xInd 是否重叠。若 yDst 与 xVal/xInd 确实重叠,此时 copy 已在 stream 上执行,会先覆写稀疏向量输入,再返回 ACL_SPARSE_STATUS_INVALID_VALUE,既不满足“非法输入不产生副作用”,还可能让调用方在释放输入后遭遇设备侧 use-after-free。建议把所有空指针/别名/参数校验整体前移到任何 kernel 入队之前,校验通过后再执行 copy 与 scatter-add。


[Major] 异地模式只判断指针不等,未校验 ySrc/yDst 区间部分重叠
if (ySrcPtr != yDstPtr && yLen > 0) 仅区分原地/异地,未检测 ySrc 与 yDst 两个 yBytes 区间是否存在部分重叠。copy 核按块 DataCopy 语义等价于 memcpy,要求源目区间不重叠;当调用方传入如 yDst = ySrc + 1 的部分重叠缓冲区时,会静默产生错误结果。建议对异地模式追加 AxpyiRangesOverlap(ySrcPtr, yBytes, yDstPtr, yBytes) 校验并返回 INVALID_VALUE。


[Minor] AIV 核数缓存为非线程安全的函数内 static 且跨 device 复用
GetCachedAivCoreCount 用未加锁的 static uint32_t cached 缓存结果,多线程首次并发调用存在数据竞争(UB);同时该缓存按进程全局保存、不区分 deviceId,多卡场景下不同设备 AIV 核数不同会返回错误核数,影响 blockNum 切分。建议改用 std::once_flag/std::atomic 保证线程安全,或按 deviceId 维度做缓存。


任务:12月社区任务-aclsparseAxpyi算子开发(950/910)
设计文档PR:https://gitcode.com/cann/cann-ops-competitions/pull/3874
账号:huier325
实现:双架构(Atlas A2/A3 arch22 零Workspace纯PIPE_V流水线 + Ascend 950 arch35 SIMT 4路展开与位精确Copy)+ PyTorch扩展 + C++/Python全量测试与Benchmark,双架构Release零告警。
自测(150/150 PASS):950仿真9/9、A3 C++ 18/18、官方pytest 43/43、全量TC-01~11 80/80。
性能:A3 24组Shape×DType较同机torch_npu提速7.60x-48.46x,10M/500k FP32达0.1678ms(aiv_mte3_ratio=0.952)。