Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
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)。
服务器/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)
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
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 编译产物)
复现状态:✅ 复现。NPU 运行完成,kernel 编译产物存在。仓分类:pypto。完整证据目录:issues/issue-03/README.md。9ffbc6d4c46a42d998abcd0bb9fd865c.zip
易用性批测问题,已启动分析
附件里面的用例,感觉和issue的描述,不太一样。描述中表明和tile shape 相关,但是附件中的复现demo并未设置tile shape
基于0907 newest该问题已不复现,该issue计划关闭,如有问题欢迎继续沟通
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)")
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
原始 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