已关闭
[CT][MS][OPS][ops.atleast_2d/atleast_1d][function][全量]atleast_2d/atleast_1d GE模式存在精度问题 #97
tanxinglian创建于  2025年3月25日关闭于  2025年4月1日
tanxinglian
2025年3月25日 创建

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

样例: (根据实际修改和增删)

atleast_2d/atleast_1d GE模式存在精度问题

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

  • Hardware Environment / 硬件环境(Mandatory / 必填):
    Hardware (e.g.Ascend910B1/Mac CPU)

    样例:

后端类型 硬件具体类别
Ascend 910A
  • Software Environment / 软件环境 (Mandatory / 必填):

    bugfix版本问题引入样例:(根据实际修改和增删)

Software Version(根据实际修改,必填)
MindSpore 3.21号__commit_id__ = '[sha1]:4859f51e,[branch]:(HEAD,origin/master,origin/HEAD,master)'(失败) 3.1号__commit_id__ = '[sha1]:8a8b22cf,[branch]:(HEAD,origin/master,origin/HEAD,master)'(成功)
CANN Milan_C21/20250307(成功) Milan_C21/20250307(失败)
Python Python 3.10.2
OS platform eulerosv2r10
GCC/Compiler version 7.3

3.Related testcase / 关联用例 (Mandatory / 必填)

  • Testcase Name/ 用例名 (Mandatory / 必填):
    -- Testcase Name(e.g.test_mf_llama_7b_wiki4096_train_cell_dp1mp4pp4mb4_910_16p_0005): test_f_atleast_2d_one_input
    test_f_atleast_2d_float64_8d_4x4x4x3x3x7x5x8_random
    test_f_atleast_1d_float64_8d_4x4x4x3x3x7x5x8_random
  • Excute Mode / 执行模式 (Mandatory / 必填):
    -- Excute Mode(e.g., Graph\PyNative): Graph
    -- Excute Mode(e.g., O0\O1\O2):910A不设置 910B设置为O2
  • 数据集名字和路径 (Mandatory / 选填):
  • 权重文件名字和路径 (Mandatory / 选填):

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

测试步骤:来自文本用例
用例执行命令:1)export SLOG_PRINT_TO_STDOUT=1
export GLOG_v=2
export ME_OPINFO=1
export NPU_ASD_ENABLE=1
export CIDA_TESTBOT=1
export MS_ASCEND_CHECK_OVERFLOW_MODE=INFNAN_MODE
export CONTEXT_DEVICE_TARGET=Ascend
export CONTEXT_MODE=GRAPH_MODE
export MS_DISABLE_KERNEL_BACKOFF=1
(2)cd MindSporeTest/operations
(3)pytest -s -v test_f_atleast_2d.py::test_f_atleast_2d_one_input
pytest -s -v test_f_atleast_2d.py::test_f_atleast_2d_float64_8d_4x4x4x3x3x7x5x8_random
pytest -s -v test_f_atleast_1d.py::test_f_atleast_1d_float64_8d_4x4x4x3x3x7x5x8_random

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

【预期结果】:用例执行成功

6.Related log / screenshot / 日志 / 截图 (Mandatory / 必填)

报错关键日志截图:

 @Level1
    def test_f_atleast_2d_one_input():
        x1 = Tensor(np.array(np.random.randn(2, 3)).astype(np.float32))
        input_x = x1
        fact = Atleast2dMock(inputs=[input_x])
>       fact.forward_cmp()

../test_f_atleast_2d.py:333: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../share/ops/functional/atleast_2d_ops.py:134: in forward_cmp
    self.allclose_recursive(data_expected, data_me, self.loss, self.loss)
../../share/ops/functional/atleast_2d_ops.py:107: in allclose_recursive
    self.allclose_recursive(e, d, rtol, atol, equal_nan)
../../share/ops/functional/atleast_2d_ops.py:104: in allclose_recursive
    allclose_nparray(data_expected, data_me, rtol, atol, equal_nan=equal_nan)
../../share/utils.py:63: in allclose_nparray
    _count_unequal_element(data_expected, data_me, rtol, atol)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

data_expected = array([[-0.710087  , -0.15930213, -0.9889787 ]], dtype=float32)
data_me = array([[ 1.2614635 , -0.04235008, -1.9021045 ]], dtype=float32)
rtol = 0.001, atol = 0.001

    def _count_unequal_element(data_expected, data_me, rtol, atol):
        assert data_expected.shape == data_me.shape
        total_count = len(data_expected.flatten())
        error = np.abs(data_expected - data_me)
        greater = np.greater(error, atol + np.abs(data_me) * rtol)
        nan_diff = np.not_equal(np.isnan(data_expected), np.isnan(data_me))
        inf_diff = np.not_equal(np.isinf(data_expected), np.isinf(data_me))
        neginf_diff = np.not_equal(np.isneginf(data_expected), np.isneginf(data_me))
        greater = greater + nan_diff + inf_diff + neginf_diff
        loss_count = np.count_nonzero(greater)
>       assert (loss_count / total_count) < rtol, \
            "\ndata_expected_std:{0}\ndata_me_error:{1}\nloss:{2}". \
                format(data_expected[greater], data_me[greater], error[greater])
E       AssertionError: 
E       data_expected_std:[-0.710087   -0.15930213 -0.9889787 ]
E       data_me_error:[ 1.2614635  -0.04235008 -1.9021045 ]
E       loss:[1.9715505  0.11695205 0.9131258 ]

../../share/utils.py:56: AssertionError
  @Level2
    def test_f_atleast_2d_float64_8d_4x4x4x3x3x7x5x8_random():
        inputs = Tensor(np.random.randn(4, 4, 4, 3, 3, 7, 5, 8), mstype.float64)
        fact = Atleast2dMock(
            inputs=[inputs])
>       fact.forward_cmp()

../test_f_atleast_2d.py:349: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../share/ops/functional/atleast_2d_ops.py:134: in forward_cmp
    self.allclose_recursive(data_expected, data_me, self.loss, self.loss)
../../share/ops/functional/atleast_2d_ops.py:107: in allclose_recursive
    self.allclose_recursive(e, d, rtol, atol, equal_nan)
../../share/ops/functional/atleast_2d_ops.py:104: in allclose_recursive
    allclose_nparray(data_expected, data_me, rtol, atol, equal_nan=equal_nan)
../../share/utils.py:63: in allclose_nparray
    _count_unequal_element(data_expected, data_me, rtol, atol)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

data_expected = array([[[[[[[-6.47150725e-01,  5.55300267e-01, -3.28036543e-01, ...,
              2.40420912e-01, -3.99763457e-02, -1...7864e-01,  9.67802708e-01, -1.09830324e+00, ...,
             -2.69247352e-01,  1.40805548e-01, -1.77464795e+00]]]]]]])
data_me = array([[[[[[[ 8.13775657e-01,  8.72998526e-01, -2.32492671e+00, ...,
             -3.59323163e-01,  9.72418807e-02, -1...1129e+00,  2.57996330e-01, -1.27029780e+00, ...,
             -3.75397298e-01, -8.99975487e-01,  5.46112136e-01]]]]]]])
rtol = 0.001, atol = 0.001

    def _count_unequal_element(data_expected, data_me, rtol, atol):
        assert data_expected.shape == data_me.shape
        total_count = len(data_expected.flatten())
        error = np.abs(data_expected - data_me)
        greater = np.greater(error, atol + np.abs(data_me) * rtol)
        nan_diff = np.not_equal(np.isnan(data_expected), np.isnan(data_me))
        inf_diff = np.not_equal(np.isinf(data_expected), np.isinf(data_me))
        neginf_diff = np.not_equal(np.isneginf(data_expected), np.isneginf(data_me))
        greater = greater + nan_diff + inf_diff + neginf_diff
        loss_count = np.count_nonzero(greater)
>       assert (loss_count / total_count) < rtol, \
            "\ndata_expected_std:{0}\ndata_me_error:{1}\nloss:{2}". \
                format(data_expected[greater], data_me[greater], error[greater])
E       AssertionError: 
E       data_expected_std:[-0.64715073  0.55530027 -0.32803654 ... -0.26924735  0.14080555
E        -1.77464795]
E       data_me_error:[ 0.81377566  0.87299853 -2.32492671 ... -0.3753973  -0.89997549
E         0.54611214]
E       loss:[1.46092638 0.31769826 1.99689016 ... 0.10614995 1.04078103 2.32076009]

../../share/utils.py:56: AssertionError
 @Level2
    def test_f_atleast_1d_float64_8d_4x4x4x3x3x7x5x8_random():
        inputs = Tensor(np.random.randn(4, 4, 4, 3, 3, 7, 5, 8), mstype.float64)
        fact = Atleast1dMock(
            inputs=[inputs])
>       fact.forward_cmp()

../test_f_atleast_1d.py:441: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../share/ops/functional/atleast_1d_ops.py:129: in forward_cmp
    self.allclose_recursive(data_expected, data_me, self.loss, self.loss)
../../share/ops/functional/atleast_1d_ops.py:103: in allclose_recursive
    self.allclose_recursive(e, d, rtol, atol, equal_nan)
../../share/ops/functional/atleast_1d_ops.py:100: in allclose_recursive
    allclose_nparray(data_expected, data_me, rtol, atol, equal_nan=equal_nan)
../../share/utils.py:63: in allclose_nparray
    _count_unequal_element(data_expected, data_me, rtol, atol)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

data_expected = array([[[[[[[ 1.92223194e+00,  1.19662758e+00,  1.57134805e+00, ...,
              5.36740821e-01, -6.18361852e-02,  1...3960e-01, -1.17214672e-01, -1.08765067e+00, ...,
             -2.25559525e-01, -4.03151114e-01,  1.52303502e-01]]]]]]])
data_me = array([[[[[[[ 4.48446527e-01,  1.95218101e+00,  8.26326072e-01, ...,
             -8.63563393e-01, -5.87472310e-01, -1...5818e-01,  1.75759792e+00, -4.45418779e-01, ...,
             -4.74295572e-01,  6.99296377e-01,  1.11847999e-02]]]]]]])
rtol = 0.001, atol = 0.001

    def _count_unequal_element(data_expected, data_me, rtol, atol):
        assert data_expected.shape == data_me.shape
        total_count = len(data_expected.flatten())
        error = np.abs(data_expected - data_me)
        greater = np.greater(error, atol + np.abs(data_me) * rtol)
        nan_diff = np.not_equal(np.isnan(data_expected), np.isnan(data_me))
        inf_diff = np.not_equal(np.isinf(data_expected), np.isinf(data_me))
        neginf_diff = np.not_equal(np.isneginf(data_expected), np.isneginf(data_me))
        greater = greater + nan_diff + inf_diff + neginf_diff
        loss_count = np.count_nonzero(greater)
>       assert (loss_count / total_count) < rtol, \
            "\ndata_expected_std:{0}\ndata_me_error:{1}\nloss:{2}". \
                format(data_expected[greater], data_me[greater], error[greater])
E       AssertionError: 
E       data_expected_std:[ 1.92223194  1.19662758  1.57134805 ... -0.22555952 -0.40315111
E         0.1523035 ]
E       data_me_error:[ 0.44844653  1.95218101  0.82632607 ... -0.47429557  0.69929638
E         0.0111848 ]
E       loss:[1.47378541 0.75555342 0.74502198 ... 0.24873605 1.10244749 0.1411187 ]

../../share/utils.py:56: AssertionError

完整日志(通过附件上传):

https://testreporter.szv.dragon.tools.huawei.com/TestDataBot/analysis/taskdetailes?productId=mindspore&productLine=2012 Laboratories&taskId=2407259351036199063&tmssPath=%2F03200tqk2t5d0%2F03o5107oo9agj%2F03mb1082tjvbv%2F&title=CT_mindspore_ascend910a_op_graph_standalone_full_2025-03-22 07:58:12&isMergedTask=false&nodeDate=2025-03-22&year=2024-2025&TestNow=true&testcaseid=67babc824503c84f0a0558a2&workspaceId=67dec2d0e00c6b20d42488d0

https://testreporter.szv.dragon.tools.huawei.com/TestDataBot/analysis/taskdetailes?productId=mindspore&productLine=2012 Laboratories&taskId=2407259351036199063&tmssPath=/03200tqk2t5d0/03o5107oo9agj/03mb1082tjvbv/&title=CT_mindspore_ascend910a_op_graph_standalone_full_2025-03-22 07%3A58%3A12&isMergedTask=false&nodeDate=2025-03-22&year=2024-2025&TestNow=true&testcaseid=67babc7e4503c84f0a0557da&workspaceId=67dec2d0e00c6b20d42488d0

https://testreporter.szv.dragon.tools.huawei.com/TestDataBot/analysis/taskdetailes?productId=mindspore&productLine=2012 Laboratories&taskId=2407259351036199063&tmssPath=/03200tqk2t5d0/03o5107oo9agj/03mb1082tjvbv/&title=CT_mindspore_ascend910a_op_graph_standalone_full_2025-03-22 07%3A58%3A12&isMergedTask=false&nodeDate=2025-03-22&year=2024-2025&TestNow=true&testcaseid=67bad65584dee72f16df2e9e&workspaceId=67de910ef31fc3250cb57b42

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

【定位人】

likedislike
Ttanxinglian
2025年3月25日 添加了问题后端类型的 Ascend 选项
Ttanxinglian
2025年3月25日 添加了关联分支的 master 选项
Ttanxinglian
2025年3月25日 创建了Bug-Report
司小南(机器人)
司小南(机器人)成员
2025年3月25日 评论:

请参考以下典型优秀案例进行问题单根因分析,如未按此模板进行根因分析,转回归会被打回,更多问题单规范请参看https://e.gitee.com/mind_spore/docs/2489468/file/5767947?sub_id=11382313&scope=undefined

Appearance & Root Cause
问题:pangu_sigma2.3编译耗时优化未达预期
根因:
1、 2.3上某些pass相比于2.2版本的实现,存在性能劣化
2、 2.3版本把trace功能下掉了,导致前端编译劣化

Fix Solution
1、修复性能劣化的前端图优化pass
2、通过支持boost infer功能把trace功能下掉导致的性能劣化拿回来

Fix Description & Test Suggestion
https://gitee.com/mindspore/mindspore/pulls/70920 PR合入后daily包回归
测试建议:该问题可以通过特性用例防护,增加****场景。

Self-test Report & DT Review
目前前后端耗时在12分钟以内。
是否需要补充 ST/UT:否 如果选择否,请补充理由
原因:非基本功能问题

Introduction Analysis
引入类型:特性合入引入
引入PR:https://e.gitee.com/mind_spore/repos/mindspore/mindspore/pulls/xxx
PR合入时间:年/月/日
问题是否偶现:是/否

likedislike
AAtomGit-Bot
2025年3月25日 添加了 &nbsp; gitee 标签
AAtomGit-Bot
2025年3月27日 将负责人从 gaoshuanglong 修改为fary86
AAtomGit-Bot
2025年3月27日 添加协作者gaoshuanglong
AAtomGit-Bot
2025年3月27日 将里程碑从 B-SIG-Kit 修改为B-SIG-ASCEND
Ffary86成员
2025年3月27日 将任务状态从 TODO 修改为WIP
fary86成员
2025年3月27日 评论:

问题根因:GE后端解耦 https://gitee.com/mindspore/mindspore/pulls/82691 引入,之前GE会自动把Tensor转成连续的,但是需要依赖aclnn算子,为了保证GE后端的独立性,解耦后,不再做Tensor非连续到连续的转换,而是换成Tensor是否连续的校验,对应的代码改动如下:
输入图片说明

likedislike
AAtomGit-Bot
2025年3月27日 添加了 &nbsp; foruda 标签
Ffary86成员
2025年3月27日 将负责人从 fary86 修改为胡彬
Ffary86成员
2025年3月27日 添加协作者fary86
Hhbhu_bin成员
2025年3月28日 将任务状态从 WIP 修改为TODO
Hhbhu_bin成员
2025年3月28日 关联了MindSpore/mindspore Pull Request !83634
hbhu_bin成员
2025年3月31日 评论:

Appearance & Root Cause

问题:atleast算子存在精度错误
根因:
非连续输入场景没有拦截,导致精度误差

Fix Solution

GE不再支持非连续输入,用例需要你切换到kbk后端执行

Fix Description & Test Suggestion

https://gitee.com/mindspore/mindspore/pulls/83634 PR合入后daily包回归
测试建议:需要切换执行后端为kbk

Self-test Report & DT Review

用例自测ok
是否需要补充 ST/UT:否
原因:非基本功能问题

Introduction Analysis

引入类型:特性合入引入
引入PR:https://gitee.com/mindspore/mindspore/pulls/81245
PR合入时间:2025年/3月/7日
问题是否偶现:否

likedislike
Hhbhu_bin成员
2025年3月31日 将任务状态从 TODO 修改为VALIDATION
此处折叠了5条事件消息 查看更多
Hhbhu_bin成员
2025年3月31日 添加了 &nbsp; rct/oldrelease 标签
tanxinglian
2025年4月1日 评论:

GE不再支持非连续输入,已正确拦截,用例需适配
输入图片说明
输入图片说明
输入图片说明
输入图片说明

likedislike
Ttanxinglian
2025年4月1日 将任务状态从 VALIDATION 修改为DONE
Iivss成员
2025年9月10日 移除了rct/oldrelease(已删除)标签
Iivss成员
2025年9月10日 移除了rca/others(已删除)标签
Iivss成员
2025年9月10日 移除了ctl/componenttest(已删除)标签
Iivss成员
2025年9月11日 移除了gitee(已删除)标签
Iivss成员
2025年9月11日 移除了foruda(已删除)标签