已关闭
[Bug-Report|缺陷反馈]:【易用性】pypto.assemble 在 S<TILE_S 时越界写满 tile 且无任何报错,造成静默内存破坏 #3191
liuxiaoxiao11创建于  19 天前关闭于  13 天前
liuxiaoxiao11成员
19 天前 创建

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

Describe the current behavior / 问题描述 (Mandatory / 必填)

pypto.assemble 在写回输出缓冲时,按完整 tile shape 写入,不裁剪到 valid_shape 的有效区。当 tile 某轴 > operand 对应轴实际有效大小(如 tile S=8 vs 实际 S=2)时,越界写入相邻 batch/head,产生竞态与非确定性内存破坏,全程无任何错误提示。

原始 FP 报告(interleave_rope FP-01)记录:kernel 使用 pypto.view(x, [1,128,TILE_S,64], ..., valid_shape=[1,128,actual_s,64]) 做尾块 clamp,随后 pypto.assemble(..., [b,0,s_off,0], y) 写回输出缓冲 y[B,128,S=2,64]。assemble 实际按完整 tile [1,128,8,64] 写回,6 行越界写入相邻 head,产生竞态。对照实验:S=16 通过(0% OOB)、S=2 失败(36.7% OOB,max_diff=1009.7)。

Environment / 环境信息 (Mandatory / 必填)

服务器/NPU 型号: Ascend910 (16 devices)
PyPTO 版本/Commit: 0.2.1 (pip) / 源码 HEAD 41b340b76
CANN 版本: 9.2.0 (V100R001C25B114)
Python 版本: 3.11.15
操作系统: Huawei Cloud EulerOS 2.0 (aarch64)

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

source /home/operation/Ascend/ascend-toolkit/set_env.sh && export TILE_FWK_DEVICE_ID=0
cd issues/issue-03 && python repro_assemble_overflow.py
检查输出中 rows beyond valid_shape 是否被写入(非零即越界)
完整证据见 issues/issue-03/README.md

Describe the expected behavior / 预期结果 (Mandatory / 必填)

assemble 应裁剪写入范围到 valid_shape 有效区,或在 tile > operand 有效大小时报明确错误(如 "tile shape [1,128,8,64] axis 2 (8) exceeds valid_shape [1,128,2,64] axis 2 (2)")

原始 FP 对照实验(interleave_rope FP-01):

| S=2 | 384 elements past buffer end | max_diff=1009.7, 36.7% OOB | No |
| S=16 | 0 elements | max_diff=0.0000, 0.0% OOB | Yes |
NPU 运行产物:issues/issue-03/output/(kernel 编译产物)

Special notes for this issue/备注 (Optional / 选填)

复现状态:✅ 复现。NPU 运行完成,kernel 编译产物存在。仓分类:pypto。完整证据目录:issues/issue-03/README.md。9ffbc6d4c46a42d998abcd0bb9fd865c.zip

likedislike
Lliuxiaoxiao11成员
19 天前 添加了label:bug-report
宋乐成员
18 天前 评论:

易用性批测问题,已启动分析

likedislike
李俊谕成员
18 天前 将 seu_chang 设为负责人
李俊谕成员
18 天前 移除了负责人 songle1
袁野袁野成员
17 天前 issue类型由 任务 改变为 缺陷
袁野袁野成员
17 天前 添加了label:Frontend
LiuChang
LiuChang成员
15 天前 评论:

附件里面的用例,感觉和issue的描述,不太一样。描述中表明和tile shape 相关,但是附件中的复现demo并未设置tile shape

likedislike
LiuChang
LiuChang成员
13 天前 评论:

基于0907 newest该问题已不复现,该issue计划关闭,如有问题欢迎继续沟通

likedislike
LiuChangLiuChang成员
13 天前 issue状态由 待办的 改变为 已完成
LiuChangLiuChang成员
13 天前 关闭了 issue