Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
729ea8cc
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
729ea8cc
编写于
5月 19, 2020
作者:
W
wenchunjiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug of loadding ctrl input tensors failed in control sink mode
上级
017cdbe8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
28 deletion
+20
-28
mindspore/ccsrc/device/kernel_adjust.cc
mindspore/ccsrc/device/kernel_adjust.cc
+2
-4
mindspore/ccsrc/device/kernel_adjust.h
mindspore/ccsrc/device/kernel_adjust.h
+1
-2
mindspore/ccsrc/session/ascend_session.cc
mindspore/ccsrc/session/ascend_session.cc
+1
-1
mindspore/ccsrc/session/kernel_graph.h
mindspore/ccsrc/session/kernel_graph.h
+8
-0
mindspore/ccsrc/session/session_basic.cc
mindspore/ccsrc/session/session_basic.cc
+7
-19
tests/ut/cpp/stub/tasksink/ascend_stream_assign_stub.cc
tests/ut/cpp/stub/tasksink/ascend_stream_assign_stub.cc
+1
-2
未找到文件。
mindspore/ccsrc/device/kernel_adjust.cc
浏览文件 @
729ea8cc
...
...
@@ -375,18 +375,16 @@ CNodePtr KernelAdjust::CreateStreamAssignAddnOP(
return
assign_add_one
;
}
bool
KernelAdjust
::
StepLoadCtrlInputs
(
const
std
::
shared_ptr
<
session
::
Context
>
&
context
,
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
)
{
bool
KernelAdjust
::
StepLoadCtrlInputs
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
)
{
if
(
!
NeedInsertSwitch
())
{
return
true
;
}
MS_EXCEPTION_IF_NULL
(
context
);
MS_EXCEPTION_IF_NULL
(
kernel_graph_ptr
);
auto
input_nodes
=
kernel_graph_ptr
->
inputs
();
std
::
vector
<
tensor
::
TensorPtr
>
inputs
;
LoadSwitchInputs
(
&
inputs
);
std
::
shared_ptr
<
std
::
vector
<
tensor
::
TensorPtr
>>
inputsPtr
=
std
::
make_shared
<
std
::
vector
<
tensor
::
TensorPtr
>>
(
inputs
);
context
->
SetResult
(
session
::
kInputCtrlTensors
,
inputsPtr
);
kernel_graph_ptr
->
set_input_ctrl_tensors
(
inputsPtr
);
size_t
input_ctrl_size
=
inputs
.
size
();
// inputs_node:include four ctrl nodes in the back. such as:conv,loop_cnt, ites_loop, zero, one.
// deal four ctrl nodes.
...
...
mindspore/ccsrc/device/kernel_adjust.h
浏览文件 @
729ea8cc
...
...
@@ -53,8 +53,7 @@ class KernelAdjust {
}
void
Reorder
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
);
void
InsertSwitchLoop
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
);
bool
StepLoadCtrlInputs
(
const
std
::
shared_ptr
<
session
::
Context
>
&
context
,
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
);
bool
StepLoadCtrlInputs
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
);
void
Profiling
(
NotNull
<
session
::
KernelGraph
*>
kernel_graph_ptr
);
static
bool
NeedInsertSwitch
();
CNodePtr
CreateStreamActiveOp
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
);
...
...
mindspore/ccsrc/session/ascend_session.cc
浏览文件 @
729ea8cc
...
...
@@ -517,7 +517,7 @@ void AscendSession::RunOpMemoryAlloc(const std::vector<tensor::TensorPtr> &input
void
AscendSession
::
GenerateTaskInfo
(
const
std
::
shared_ptr
<
KernelGraph
>
&
kernel_graph
)
const
{
MS_LOG
(
INFO
)
<<
"Start!"
;
(
void
)
device
::
KernelAdjust
::
GetInstance
().
StepLoadCtrlInputs
(
context_
,
kernel_graph
);
(
void
)
device
::
KernelAdjust
::
GetInstance
().
StepLoadCtrlInputs
(
kernel_graph
);
auto
runtime_instance
=
device
::
KernelRuntimeManager
::
Instance
().
GetKernelRuntime
(
kAscendDevice
,
device_id_
);
MS_EXCEPTION_IF_NULL
(
runtime_instance
);
bool
ret_ok
=
runtime_instance
->
GenTask
(
kernel_graph
.
get
());
...
...
mindspore/ccsrc/session/kernel_graph.h
100755 → 100644
浏览文件 @
729ea8cc
...
...
@@ -107,6 +107,12 @@ class KernelGraph : public FuncGraph {
std
::
vector
<
std
::
shared_ptr
<
KernelGraph
>>
child_graph_order
()
const
{
return
child_graph_order_
;
}
// checkout whether current graph is leaf graph
bool
IsLeafGraph
()
const
;
// set input_tensors pointer of control parameter
void
set_input_ctrl_tensors
(
const
std
::
shared_ptr
<
std
::
vector
<
tensor
::
TensorPtr
>>
&
input_tensors_ptr
)
{
input_ctrl_tensors_
=
input_tensors_ptr
;
}
// get input_tensors pointer of control parameter
std
::
shared_ptr
<
std
::
vector
<
tensor
::
TensorPtr
>>
input_ctrl_tensors
()
const
{
return
input_ctrl_tensors_
;
}
private:
// remove value node form graph
...
...
@@ -150,6 +156,8 @@ class KernelGraph : public FuncGraph {
std
::
map
<
AnfNodePtr
,
std
::
shared_ptr
<
KernelGraph
>>
node_to_child_graphs_
;
// child graph execute order in root graph
std
::
vector
<
std
::
shared_ptr
<
KernelGraph
>>
child_graph_order_
;
// input_tensors of control parameter
std
::
shared_ptr
<
std
::
vector
<
tensor
::
TensorPtr
>>
input_ctrl_tensors_
;
};
}
// namespace session
using
KernelGraphPtr
=
std
::
shared_ptr
<
session
::
KernelGraph
>
;
...
...
mindspore/ccsrc/session/session_basic.cc
浏览文件 @
729ea8cc
...
...
@@ -266,23 +266,12 @@ AnfNodePtr CreateNewParameterFromCNode(const AnfNodePtr &anf, bool valid_input,
return
make_tuple
;
}
bool
NeedInsertSwitch
()
{
auto
context_ptr
=
MsContext
::
GetInstance
();
MS_EXCEPTION_IF_NULL
(
context_ptr
);
return
(
context_ptr
->
enable_task_sink
()
&&
context_ptr
->
loop_sink_flag
()
&&
ConfigManager
::
GetInstance
().
iter_num
()
>
1
);
}
size_t
LoadCtrlInputTensor
(
const
std
::
shared_ptr
<
Context
>
&
context
,
std
::
vector
<
tensor
::
TensorPtr
>
*
inputs
)
{
MS_EXCEPTION_IF_NULL
(
context
);
if
(
!
NeedInsertSwitch
())
{
(
void
)
context
->
results_
.
erase
(
kInputCtrlTensors
);
size_t
LoadCtrlInputTensor
(
const
std
::
shared_ptr
<
KernelGraph
>
&
graph
,
std
::
vector
<
tensor
::
TensorPtr
>
*
inputs
)
{
MS_LOG
(
INFO
)
<<
"Load kInputCtrlTensors"
;
auto
inputs_params
=
graph
->
input_ctrl_tensors
();
if
(
inputs_params
==
nullptr
)
{
return
0
;
}
MS_LOG
(
INFO
)
<<
"Load kInputCtrlTensors"
;
auto
inputs_params
=
context
->
GetResult
(
kInputCtrlTensors
).
cast
<
const
std
::
shared_ptr
<
std
::
vector
<
tensor
::
TensorPtr
>>>
();
MS_EXCEPTION_IF_NULL
(
inputs_params
);
if
(
inputs_params
->
empty
())
{
MS_LOG
(
EXCEPTION
)
<<
"Illegal empty inputs_params"
;
}
...
...
@@ -686,11 +675,10 @@ void SessionBasic::LoadInputData(const std::shared_ptr<KernelGraph> &kernel_grap
const
std
::
vector
<
tensor
::
TensorPtr
>
&
inputs_const
)
const
{
std
::
vector
<
tensor
::
TensorPtr
>
inputs
(
inputs_const
);
size_t
input_ctrl_size
=
1
;
MS_EXCEPTION_IF_NULL
(
context_
);
if
(
context_
->
HasResult
(
kInputCtrlTensors
))
{
input_ctrl_size
=
LoadCtrlInputTensor
(
context_
,
&
inputs
);
}
MS_EXCEPTION_IF_NULL
(
kernel_graph
);
if
(
kernel_graph
->
input_ctrl_tensors
())
{
input_ctrl_size
=
LoadCtrlInputTensor
(
kernel_graph
,
&
inputs
);
}
auto
input_nodes
=
kernel_graph
->
inputs
();
if
((
inputs
.
size
()
+
input_ctrl_size
)
-
1
!=
input_nodes
.
size
())
{
MS_LOG
(
EXCEPTION
)
<<
"tensor input:"
<<
inputs
.
size
()
<<
" is not equal graph inputs:"
<<
input_nodes
.
size
()
...
...
tests/ut/cpp/stub/tasksink/ascend_stream_assign_stub.cc
浏览文件 @
729ea8cc
...
...
@@ -39,8 +39,7 @@ bool TaskGenerator::GenTasks(const std::vector<CNodePtr> &anf_node_list, std::ve
}
// namespace ascend
void
KernelAdjust
::
Reorder
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
)
{
return
;
}
void
KernelAdjust
::
InsertSwitchLoop
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
)
{
return
;
}
bool
KernelAdjust
::
StepLoadCtrlInputs
(
const
std
::
shared_ptr
<
session
::
Context
>
&
context
,
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
)
{
bool
KernelAdjust
::
StepLoadCtrlInputs
(
const
std
::
shared_ptr
<
session
::
KernelGraph
>
&
kernel_graph_ptr
)
{
return
true
;
}
bool
KernelAdjust
::
NeedInsertSwitch
()
{
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录