Closed
[Bug-Report|缺陷反馈]: 部分TileOp在处理时默认输入输出的shape一致导致部分场景精度有误 #3642
刘奕哲Add on Oct 23Closed at 29 days ago
刘奕哲
Oct 23 Comments:
Oct 23 Comments:
/assign


Oct 23 Assign Creeeeper as responsible person
29 days ago Close issue
29 days ago Added label: resolved
Describe the current behavior / 问题描述 (Mandatory / 必填)
部分TileOp在处理时默认输入输出的shape一致但是pass在处理时有可能改变rawshape导致实际计算时跳stride长度不对
Environment / 环境信息 (Mandatory / 必填)
cann-9.2.0
A2/A3/A5
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
import os import pytest import torch import pypto pytestmark = pytest.mark.soc("950") @pypto.frontend.jit(debug_options={"runtime_debug_mode": 0, "compile_debug_mode": 0}) def unary(x: pypto.Tensor(), y: pypto.Tensor(), op: str): pypto.set_vec_tile_shapes(16, 128) z = pypto.add(x, 0.25) pypto.set_vec_tile_shapes(16, 80) v = pypto.view(z, [16, 80], [0, 0]) if op == 'log1p': r = pypto.log1p(v) elif op == 'erf': r = pypto.erf(v) pypto.assemble(r, [0, 0], y) @pytest.mark.parametrize("operation", ["log1p", "erf"]) def test_unary_parent_stride(operation): device = int(os.environ.get("TILE_FWK_DEVICE_ID", "0")) torch.npu.set_device(device) source = (torch.arange(16 * 128).reshape(16, 128) % 97).float() / 97 output = torch.empty((16, 80), device=f"npu:{device}") unary(source.to(output.device), output, operation) values = source[:, :80] + 0.25 reference = { "log1p": torch.log1p, "erf": torch.erf, }[operation](values) torch.testing.assert_close(output.cpu(), reference, rtol=1e-4, atol=1e-5)Describe the expected behavior / 预期结果 (Mandatory / 必填)
PASS
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
FAILED python/tests/st/operation/vector/test_vector_layout_graph.py::test_unary_parent_stride[log1p] - operation = 'log1p'
FAILED python/tests/st/operation/vector/test_vector_layout_graph.py::test_unary_parent_stride[erf] - operation = 'erf'
Special notes for this issue/备注 (Optional / 选填)