Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
9fd9a1af
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看板
提交
9fd9a1af
编写于
4月 29, 2020
作者:
L
lianliguang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add warning info to statistics how much nodes using raise or reduce to selected kernel info
上级
3dd369ce
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
5 deletion
+26
-5
mindspore/ccsrc/device/ascend/kernel_select_ascend.cc
mindspore/ccsrc/device/ascend/kernel_select_ascend.cc
+5
-2
mindspore/ccsrc/device/ascend/kernel_select_ascend.h
mindspore/ccsrc/device/ascend/kernel_select_ascend.h
+1
-1
mindspore/ccsrc/session/ascend_session.cc
mindspore/ccsrc/session/ascend_session.cc
+16
-1
mindspore/ccsrc/utils/utils.h
mindspore/ccsrc/utils/utils.h
+4
-1
未找到文件。
mindspore/ccsrc/device/ascend/kernel_select_ascend.cc
浏览文件 @
9fd9a1af
...
...
@@ -342,7 +342,7 @@ void AddNodeAndKernelDataType(const CNodePtr &kernel_node, const kernel::KernelB
std
::
vector
<
int
>
*
node_mix_precision_datatype_index
)
{
MS_EXCEPTION_IF_NULL
(
node_mix_precision_datatype
);
bool
add_node_datatype_flag
=
false
;
if
(
node_mix_precision_datatype
->
size
()
==
0
)
{
if
(
node_mix_precision_datatype
->
empty
()
)
{
add_node_datatype_flag
=
true
;
}
for
(
size_t
input_index
=
0
;
input_index
<
kernel_build_info
.
GetInputNum
();
++
input_index
)
{
...
...
@@ -464,8 +464,9 @@ std::vector<std::shared_ptr<kernel::KernelBuildInfo>> FilterRaisedOrReducePrecis
}
}
// namespace
void
SelectKernelInfo
(
const
CNodePtr
&
kernel_node
)
{
int
SelectKernelInfo
(
const
CNodePtr
&
kernel_node
)
{
std
::
vector
<
std
::
shared_ptr
<
kernel
::
KernelBuildInfo
>>
kernel_info_list
;
int
status
=
kStatusAllMatched
;
MS_EXCEPTION_IF_NULL
(
kernel_node
);
bool
precision_reduce
=
false
;
std
::
shared_ptr
<
kernel
::
KernelBuildInfo
>
selected_kernel_info
=
nullptr
;
...
...
@@ -486,11 +487,13 @@ void SelectKernelInfo(const CNodePtr &kernel_node) {
<<
"] cannot find valid kernel info, not supported the type"
<<
buffer
.
str
();
}
else
{
PrintRaiseOrReducePrecisionSelectedInfo
(
kernel_node
,
selected_kernel_info
,
precision_reduce
);
status
=
precision_reduce
?
kStatusReducePrecision
:
kStatusRaisePrecision
;
}
}
AnfAlgo
::
SetSelectKernelBuildInfo
(
selected_kernel_info
,
kernel_node
.
get
());
// Set format and data type for input tensor.
SetTensorDeviceInfo
(
*
selected_kernel_info
,
kernel_node
);
return
status
;
}
bool
CheckKernelAccuracySupported
(
const
CNodePtr
&
kernel_node
,
...
...
mindspore/ccsrc/device/ascend/kernel_select_ascend.h
浏览文件 @
9fd9a1af
...
...
@@ -21,7 +21,7 @@
namespace
mindspore
{
namespace
device
{
namespace
ascend
{
void
SelectKernelInfo
(
const
CNodePtr
&
kernel_node
);
int
SelectKernelInfo
(
const
CNodePtr
&
kernel_node
);
bool
CheckKernelAccuracySupported
(
const
CNodePtr
&
kernel_node
,
const
kernel
::
KernelBuildInfoPtr
&
new_kernel_build_info
);
}
// namespace ascend
}
// namespace device
...
...
mindspore/ccsrc/session/ascend_session.cc
浏览文件 @
9fd9a1af
...
...
@@ -312,10 +312,25 @@ py::tuple AscendSession::RunOp(const OpRunInfo &op_run_info, const GraphInfo &gr
// compile graph steps
void
AscendSession
::
SelectKernel
(
const
KernelGraph
&
kernel_graph
)
const
{
MS_LOG
(
INFO
)
<<
"Start!"
;
size_t
raise_precision_count
=
0
;
size_t
reduce_precision_count
=
0
;
for
(
const
auto
&
cnode
:
kernel_graph
.
execution_order
())
{
device
::
ascend
::
SelectKernelInfo
(
cnode
);
auto
status
=
device
::
ascend
::
SelectKernelInfo
(
cnode
);
if
(
status
==
kStatusRaisePrecision
)
{
raise_precision_count
++
;
}
else
if
(
status
==
kStatusReducePrecision
)
{
reduce_precision_count
++
;
}
MS_LOG
(
INFO
)
<<
"Select ApplyKernel: "
<<
cnode
->
DebugString
();
}
if
(
raise_precision_count
>
0
)
{
MS_LOG
(
WARNING
)
<<
"There has "
<<
raise_precision_count
<<
" node/nodes used raise precision to selected the kernel!"
;
}
if
(
reduce_precision_count
>
0
)
{
MS_LOG
(
WARNING
)
<<
"There has "
<<
reduce_precision_count
<<
" node/nodes used reduce precision to selected the kernel!"
;
}
MS_LOG
(
INFO
)
<<
"Finish!"
;
}
...
...
mindspore/ccsrc/utils/utils.h
浏览文件 @
9fd9a1af
...
...
@@ -184,7 +184,10 @@ constexpr auto kControlDependBehindIndex = 2;
// index define of depend
constexpr
auto
kRealInputIndexInDepend
=
1
;
constexpr
auto
kDependAttachNodeIndex
=
2
;
// status of kernel select result
const
int
kStatusReducePrecision
=
-
1
;
const
int
kStatusRaisePrecision
=
1
;
const
int
kStatusAllMatched
=
0
;
// format
constexpr
auto
kOpFormat_DEFAULT
=
"DefaultFormat"
;
constexpr
auto
kOpFormat_NC1KHKWHWC0
=
"NC1KHKWHWC0"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录