2.3K Star 8K Fork 4.2K

GVPMindSpore / mindspore

 / 详情

[CT][MS][parse]合理的常量控制流场景下抛变量

DONE
Bug-Report
创建于  
2023-06-06 16:12
name about labels
Bug Report Use this template for reporting a bug kind/bug

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

合理的常量控制流场景下抛变量

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

  • Hardware Environment(Ascend/GPU/CPU) / 硬件环境:

Please delete the backend not involved / 请删除不涉及的后端:
/device ascend/GPU/CPU/kirin/等其他芯片

  • Software Environment / 软件环境 (Mandatory / 必填):
    ascend_version=
    cuda_version=
    mindspore_commit=commit_id = '[sha1]:3eb447b7,[branch]:(HEAD,origin/master,origin/HEAD,master)'
    mindsporetest_commit=704467082efe102a1a838f6d55a873bf16c8376a
    CONTEXT_DEVICE_TARGET=CPU
    CONTEXT_MODE=GRAPH_MODE

  • Excute Mode / 执行模式 (Mandatory / 必填)(PyNative/Graph):

Please delete the mode not involved / 请删除不涉及的模式:
/mode graph

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

def test_parser_fallback_raise_else():
    class RaiseNet(nn.Cell):
        def construct(self, x, z):
            if z >= 1:
                raise ValueError(f"The input can be {x}")
            else:
                return x + 1

    x = mutable(1)
    net = RaiseNet()

    with pytest.raises(ValueError) as e:
        net(x, 1)
    assert "The input can be 1" in str(e.value)

    assert net(x, 0) == 2

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

  1. pytest -v test_parser_fallback_sequence.py::test_parser_fallback_raise_else

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

用例正常执行

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

E       RuntimeError: Should not raise with variable under a constant condition.
E       
E       In file /home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/test_parser_fallback_sequence.py:504
E                       raise ValueError(f"The input can be {x}")
E                       ^
E       
E       ----------------------------------------------------
E       - The Traceback of Net Construct Code:
E       ----------------------------------------------------
E       The function call stack (See file '/home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/rank_0/om/analyze_fail.ir' for more details. Get instructions about `analyze_fail.ir` at https://www.mindspore.cn/search?inputValue=analyze_fail.ir):
E       # 0 In file /home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/test_parser_fallback_sequence.py:503
E                   if z >= 1:
E       # 1 In file /home/jenkins-slave/workspace/mindspore_cpu_feature_opensource/MindSporeTest/parse/test_parser_fallback_sequence.py:504
E                       raise ValueError(f"The input can be {x}")
E                       ^
E       
E       ----------------------------------------------------
E       - C++ Call Stack: (For framework developers)
E       ----------------------------------------------------
E       mindspore/ccsrc/pipeline/jit/static_analysis/prim.cc:2989 EvalPrim

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

评论 (4)

杨凯璐 创建了Bug-Report
杨凯璐 添加了
 
kind/bug
标签
杨凯璐 添加了
 
attr/function
标签
杨凯璐 添加了
 
v2.1.0
标签
杨凯璐 添加了
 
sig/compiler
标签
展开全部操作日志

Please assign maintainer to check this issue.
请为此issue分配处理人。
@杨凯璐

Please add labels (comp or sig), also you can visit https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md to find more.
为了让代码尽快被审核,请您为Pull Request打上 组件(comp)或兴趣组(sig) 标签,打上标签的PR可直接推送给责任人进行审核。
更多的标签可以查看https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md
以组件相关代码提交为例,如果你提交的是data组件代码,你可以这样评论:
//comp/data
当然你也可以邀请data SIG组来审核代码,可以这样写:
//sig/data
另外你还可以给这个PR标记类型,例如是bugfix或者是特性需求:
//kind/bug or //kind/feature
恭喜你,你已经学会了使用命令来打标签,接下来就在下面的评论里打上标签吧!

Appearance & Root Cause
问题:常量控制流下抛出变量抛出异常
原因:过去认为该场景为异常场景,所以加了报错看护

Fix Solution
解决方法:删除该看护报错。
关联PR:!54534:放开raise常量控制流下抛出变量限制,并解决检查控制流core dump问题

李良灿 添加了
 
rct/oldrelease
标签
李良灿 添加了
 
rca/inf/msg
标签
李良灿 添加了
 
ctl/componenttest
标签
李良灿 里程碑B-SIG-Compiler 修改为B-ComponentTest
李良灿 任务状态TODO 修改为ACCEPTED
李良灿 任务状态ACCEPTED 修改为WIP
李良灿 任务状态WIP 修改为VALIDATION
李良灿 添加协作者李良灿
李良灿 负责人李良灿 修改为杨凯璐
杨凯璐 任务状态VALIDATION 修改为DONE

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore

搜索帮助