2.3K Star 8K Fork 4.2K

GVPMindSpore / mindspore

 / 详情

[CT][MS][switch_layer+D] test_parser_switch_layer_switch_seq hung

DONE
Bug-Report
创建于  
2021-03-09 14:27
name about labels
Bug Report Use this template for reporting a bug kind/bug

Environment

  • Hardware Environment(Ascend/GPU/CPU): Ascend

  • Software Environment:
    -- MindSpore version (source or binary): vm+graph
    -- Python version (e.g., Python 3.7.5):
    -- OS platform and distribution (e.g., Linux Ubuntu 16.04):
    -- GCC/Compiler version (if compiled from source):

Related testcase

def test_parser_switch_layer_switch_seq():
    func1 = TwoLayerReLU()
    func2 = TwoLayerSoftmax()
    funcsa = (func1, func2)
    funcsb = (func2, func1)

    class SwitchSeqNet(Cell, MetaFactory):
        def __init__(self, funcsa, funcsb):
            super().__init__()
            MetaFactory.__init__(self)
            self.funcsa = funcsa
            self.funcsb = funcsb

        def construct(self, i, x):
            x = self.funcsa[i](x)
            x = self.funcsb[i](x)
            return x

    class ReluSoftmax(Cell):
        def __init__(self):
            super().__init__()
            self.relu = nn.ReLU()
            self.softmax = nn.Softmax()
            self.neg = P.Neg()

        def construct(self, x):
            x = self.relu(x)
            x = self.neg(x)
            x = self.softmax(x)
            x = self.neg(x)
            return x

    net = SwitchSeqNet(funcsa, funcsb)
    good_net = ReluSoftmax()

    inputs = Tensor(np.random.randn(2, 3, 4, 5).astype(np.float32))
    i = Tensor(0, mstype.int32)
    netout = net(i, inputs)
    goodout = good_net(inputs)

    allclose_nparray(goodout.asnumpy(), netout.asnumpy(), 0, 0)

    # test backward
    grad = Tensor(np.random.randn(2, 3, 4, 5).astype(np.float32))
    back_net = GradOfAllInputs(net)
    back_net_good = GradOfAllInputs(good_net)
    back_out = back_net(i, inputs, grad)
    back_out_good = back_net_good(inputs, grad)
    allclose_nparray(back_out[1].asnumpy(), back_out_good[0].asnumpy(), 0, 0)

Steps to reproduce the issue

Describe the current behavior

用例卡住
执行卡住,执行序如下
Index[0], node name[Default/Assign-op27], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]57{[0]: ValueNode Assign, [1]: inputs, [2]: x, [3]: ValueNode U}]
Index[1], node name[Default/Assign-op25], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]55{[0]: ValueNode Assign, [1]: inputs, [2]: x, [3]: ValueNode U}]
Index[2], node name[Default/LabelSwitch-op29], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]59{[0]: ValueNode LabelSwitch, [1]: i, [2]: [CNode]58}], label id[1, 2]
Index[3], node name[Default/LabelSet-op45], logic id[4294967295], stream id[0], node info[kernel_graph_1:[CNode]77{[0]: ValueNode LabelSet, [1]: ValueNode U}], label id[2]
Index[4], node name[Default/Softmax-op9], logic id[4294967295], stream id[0], node info[kernel_graph_1:x{[0]: ValueNode Softmax, [1]: inputs}]
Index[5], node name[Default/Neg-op8], logic id[4294967295], stream id[0], node info[kernel_graph_1:x{[0]: ValueNode Neg, [1]: x}]
Index[6], node name[Default/Assign-op46], logic id[4294967295], stream id[0], node info[kernel_graph_1:[CNode]78{[0]: ValueNode Assign, [1]: [Parameter]62, [2]: x, [3]: ValueNode
Index[7], node name[Default/LabelGoto-op48], logic id[4294967295], stream id[0], node info[kernel_graph_1:[CNode]80{[0]: ValueNode LabelGoto, [1]: [CNode]79}], label id[3]
Index[8], node name[Default/LabelSet-op40], logic id[4294967295], stream id[0], node info[kernel_graph_2:[CNode]72{[0]: ValueNode LabelSet, [1]: ValueNode U}], label id[1]
Index[9], node name[Default/FusionOp_ReLU_Neg-op50], logic id[4294967295], stream id[0], node info[kernel_graph_2:x{[0]: ValueNode FusionOp_ReLU_Neg, [1]: inputs}]
Index[10], node name[Default/Assign-op41], logic id[4294967295], stream id[0], node info[kernel_graph_2:[CNode]73{[0]: ValueNode Assign, [1]: [Parameter]62, [2]: x, [3]: ValueNode
Index[11], node name[Default/LabelSet-op30], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]60{[0]: ValueNode LabelSet, [1]: [CNode]59}], label id[3]
Index[12], node name[Default/Assign-op34], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]65{[0]: ValueNode Assign, [1]: inputs, [2]: [CNode]61, [3]: ValueNode<UMonad
Index[13], node name[Default/Assign-op32], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]63{[0]: ValueNode Assign, [1]: inputs, [2]: [CNode]61, [3]: ValueNode<UMonad
Index[14], node name[Default/LabelSwitch-op36], logic id[4294967295], stream id[0], node info[kernel_graph_0:[CNode]67{[0]: ValueNode LabelSwitch, [1]: i, [2]: [CNode]66}], label id[2, 1]

kernel_graph1和kernel_graph2被多次调用,关联多子图调用需求,使用栈解决

评论 (13)

echo_hua 创建了Bug-Report
echo_hua 计划截止日期设置为2021-12-31
echo_hua 关联仓库设置为MindSpore/mindspore
echo_hua 负责人设置为weiyang
echo_hua 里程碑设置为B-ME
echo_hua 计划开始日期设置为2021-03-09
echo_hua 优先级设置为次要
zhunaipan 任务状态TODO 修改为WIP
展开全部操作日志

多子图调用,循环嵌套,死循环,需要算子支持。

不支持要添加文档说明

echo_hua 里程碑B-ME 修改为B-VM
jjfeing 里程碑B-VM 修改为B-ME

贺老师修改可能能改掉这个问题,待验证后再明确是否转需求。

zhunaipan 计划截止日期2021-12-31 修改为2021-03-16

使用最新带贺老师修改的版本验证还是出现执行卡住的问题,需要进行适配。

zhunaipan 计划截止日期2021-03-16 修改为2021-03-19
liangzelang 添加协作者liangzelang

没有卡主,结果不对,数据传递有问题。

zhunaipan 计划截止日期2021-03-19 修改为2021-03-23

03.20 分析进展:

  • 用例的执行如图所示,从执行序上看没有明显的循环,从dump的数据上也没有循环产生。
    enter image description here

  • 通过dump数据分析,没有发现数据计算过程有数据踩踏等问题。

weiyang 添加协作者weiyang
weiyang 负责人weiyang 修改为liangzelang
weiyang 取消协作者liangzelang

怀疑RELU_NEG融合影响精度。

03.23 分析进展:

  • 对比是否加控制流的ir,两个ir图基本操作是一致的,流程是相同的:
%0 = ReLU(x_0)
%1 = Neg(%0)
%2 = SoftMax(%1)
%3 = Neg(%2)
……
%4 = Neg(……)

%5 = ReLU(x_1)
%6 = ReLUGrad(%4, %5) 
……
  • 网络中预期行为%0 = ReLU(x_0)%5 = ReLU(x_1)是相同的,输入均为最开始的用户输入
  • dump数据发现x_0x_1不相同,具体原因需要进一步分析。

Appearance & Root Cause

  • 现象为精度不对
  • ir图与前端图,以及无控制流的网络图相同,但是ir图与执行序不一致,分析是由于有两个传递参数的Assing算子的Monad值被错误设置为常数,导致生成执行序的时候没有该算子。

Fix Solution

  • 在解析控制流配置输入参数时,设置正确的Monad信息。

Fix Description & Test Suggestion

Self-test Report

由于最新的RUN版本修改了LabelSwitch底层的一些逻辑,导致该用例在新的run包上无法验证通过。

**对于Run更新后的问题修改 **

Appearance & Root Cause

  • 新的labelswitch不允许label_id重复,但是在一些网络、用例中会出现label_id重复的问题,导致错误

Fix Solution

  • 对于相同label_id,使用新的label_id,同时插入新的label_set()

Fix Description & Test Suggestion

Self-test Report

enter image description here

liangzelang 任务状态WIP 修改为VALIDATION
liangzelang 里程碑B-ME 修改为B-ComponentTest
liangzelang 添加协作者liangzelang
liangzelang 负责人liangzelang 修改为echo_hua

r1.2分支回归通过
enter image description here

master分支回归通过 enter image description here

echo_hua 任务状态VALIDATION 修改为DONE

登录 后才可以发表评论

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

搜索帮助