Closed
[Bug-Report|缺陷反馈]: ForeachAtan经Agent扫描发现多个问题 #8884
m0_46386992Add on 5 days agoClosed at 5 days ago
5 days ago Added label: bug-report
yuning_chen
5 days ago Comments:
5 days ago Comments:
感谢反馈,问题已收到。我们会按「资料声明与实现一致性」的方向排查:确认是资料需要收敛,还是实现需要补齐校验;定位后在本 issue 回贴结论与修复 PR。
本条要点: Describe the current behavior / 问题描述 (Mandatory / 必填)


5 days ago Close issue
5 days ago changed custom state from 待办的 to 已完成
5 days ago Added label: resolved
Describe the current behavior / 问题描述 (Mandatory / 必填)
在 ascend950(arch35)上,
ForeachAtan的 Tiling 入口ForeachAtanTilingFunc只读取输入列表第 0 个 Tensor 的 dtype 和各输入 shape,未实现文档声明的入参校验,
同时示例代码存在资源泄漏、文档错误码口径与实现/同族算子不一致。具体表现为:
其余 Tensor 的 dtype 不校验。混合 dtype 列表会按首张量位宽解释全部数据,
首张量为 4 字节、后续为 2 字节类型时存在越界读写风险。
out数量少于x、outdtype 与x不一致、outshape size 小于/大于x时不会拒绝,kernel 按输入元素数写入,存在越界写风险。
GetDimNum()校验。totalElements += numel无溢出检查,也未拒绝
gert::Shape::GetShapeSize()在维度乘积溢出时返回的INT64_MIN哨兵值。561002(ACLNN_ERR_INNER_TILING_ERROR),而同族算子(foreach_abs/exp/sin/acos)与 aclnn 实现均为
161002(ACLNN_ERR_PARAM_INVALID),且缺少“Tensor 数量 > 256 → 561002”一行。CreateAclTensor中aclrtMemcpy失败未释放已申请的 device 内存;main失败路径直接return,不释放 device 内存/tensorList/stream,不aclResetDevice/aclFinalize。executor_aclnnForeachAtan.py)。另外
README.md仍写“输出不支持非连续Tensor”,但实现(foreach_contiguous_helper.h的
ForeachMakeContiguousTensorList+ForeachViewCopyToOutputTensorList)与docs/aclnnForeachAtan.md均已支持非连续 out,文档自相矛盾。Environment Information / 环境信息 (Mandatory / 必填)
/data/whb/1104Ascend/cann-9.3.0(9.3.0 weekly 20261104)ops-nn,算子目录foreach/foreach_atand9c3e90efcebf38c3c1187bd72ab5f34eb4fdcb8Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
以下非法输入在修复前不会被 arch35 Tiling 拒绝(需通过 kernel/GEIR 直调路径,绕过 aclnn 适配层):
x = [float32(4), float16(4)]x=float32(4),out=float16(4)x=(8,)、out=(4,),或x=(4,)、out=(8,)(1,)张量x=(1,1,1,1,1,1,1,1,2)以 TTK 为例(修复前会进入 kernel,或在 aclnn 层返回与文档不一致的错误码):
source /data/whb/1104Ascend/cann-9.3.0/bin/setenv.bash cd /data/w00842359/ops-test-kit # kernel 直调路径:列表 dtype 混用 / out dtype / out shape / 257 个 Tensor python3 -m ttk kernel -i <foreach_atan_min_l2.csv> \ --plugin <golden.py> --run 1 --seed 42 --devices 6 \ --task-prof false --compare mixed -o <result.csv>样例 CSV 关键行:
示例程序资源泄漏可用
test_aclnn_foreach_atan.cpp人为触发aclrtMemcpy失败/中途返回复现。Describe the expected behavior / 预期结果 (Mandatory / 必填)
ge::GRAPH_FAILED),不进入 kernel:out与x对应位置 Tensor 的 shape size 必须相等(与文档、生成 aclnn 层一致)。161002;561002。Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
修复后 kernel 直调路径的拒绝日志(
INVALID_TILING):修复后回归结果(ascend950 / device 6):
-b=release)INVALID_TILING命中新校验;rank9 框架拦截;out 数量工具无法表达Special notes for this issue/备注 (Optional / 选填)