Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
b91d3270
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看板
提交
b91d3270
编写于
6月 22, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2401 fix code review
Merge pull request !2401 from lianliguang/fix-code-review
上级
932b7649
88d3dc66
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
17 deletion
+22
-17
mindspore/ccsrc/device/ascend/kernel_select_ascend.cc
mindspore/ccsrc/device/ascend/kernel_select_ascend.cc
+15
-11
mindspore/ccsrc/kernel/kernel_query.cc
mindspore/ccsrc/kernel/kernel_query.cc
+7
-6
未找到文件。
mindspore/ccsrc/device/ascend/kernel_select_ascend.cc
浏览文件 @
b91d3270
...
...
@@ -106,7 +106,7 @@ string GetPriorityMatchFormat(const CNodePtr &cnode) {
bool
PriorityChooseItem
(
const
std
::
vector
<
int
>
&
cur_item
,
std
::
vector
<
int
>
*
best_item
)
{
MS_EXCEPTION_IF_NULL
(
best_item
);
if
(
cur_item
.
size
()
!=
best_item
->
size
())
{
MS_LOG
(
ERROR
)
<<
"
i
tem size should be same!"
;
MS_LOG
(
ERROR
)
<<
"
I
tem size should be same!"
;
return
false
;
}
// Update the best_item by comparing the cur_item and best_item
...
...
@@ -280,8 +280,12 @@ bool RaiseDataTypePrecisionSelect(const std::vector<int> &node_mix_precision_dat
bool
CanDataTypeReduce
(
const
std
::
vector
<
int
>
&
datatype_indexes
,
int
check_index
,
const
std
::
vector
<
int
>
&
node_mix_precision_datatype_index
)
{
return
datatype_indexes
[
check_index
]
!=
kUnSupportMixedDataTypeIndex
&&
datatype_indexes
[
check_index
]
<=
node_mix_precision_datatype_index
[
check_index
];
auto
check_index_tmp
=
IntToSize
(
check_index
);
if
(
check_index_tmp
<
datatype_indexes
.
size
()
&&
check_index_tmp
<
node_mix_precision_datatype_index
.
size
())
{
return
datatype_indexes
[
check_index
]
!=
kUnSupportMixedDataTypeIndex
&&
datatype_indexes
[
check_index
]
<=
node_mix_precision_datatype_index
[
check_index
];
}
MS_LOG
(
EXCEPTION
)
<<
"Check index "
<<
check_index
<<
"is outof range"
;
}
bool
RaiseOrReduceDataTypePrecisionSelect
(
const
std
::
vector
<
int
>
&
node_mix_precision_datatype_index
,
...
...
@@ -300,10 +304,10 @@ bool RaiseOrReduceDataTypePrecisionSelect(const std::vector<int> &node_mix_preci
if
(
node_mix_precision_datatype_index
[
i
]
==
kUnSupportMixedDataTypeIndex
)
{
auto
find_iter
=
kernel_support_datatypes
.
find
(
iter
->
first
);
if
(
find_iter
==
kernel_support_datatypes
.
end
())
{
MS_LOG
(
EXCEPTION
)
<<
"
k
ernel datatype index:%lu can not be found "
<<
iter
->
first
;
MS_LOG
(
EXCEPTION
)
<<
"
K
ernel datatype index:%lu can not be found "
<<
iter
->
first
;
}
if
(
i
>=
find_iter
->
second
.
size
())
{
MS_LOG
(
EXCEPTION
)
<<
"
n
ode index "
<<
i
<<
" >= kernel datatype size "
<<
find_iter
->
second
.
size
();
MS_LOG
(
EXCEPTION
)
<<
"
N
ode index "
<<
i
<<
" >= kernel datatype size "
<<
find_iter
->
second
.
size
();
}
if
(
node_mix_precision_datatype
[
i
]
!=
find_iter
->
second
[
i
])
{
iter
=
kernel_match_datatype_idx
->
erase
(
iter
);
...
...
@@ -314,7 +318,7 @@ bool RaiseOrReduceDataTypePrecisionSelect(const std::vector<int> &node_mix_preci
}
auto
datatype_indexes
=
iter
->
second
;
if
(
i
>=
datatype_indexes
.
size
())
{
MS_LOG
(
EXCEPTION
)
<<
"
i
ndex "
<<
i
<<
"> kernel datatype indexes size "
<<
datatype_indexes
.
size
();
MS_LOG
(
EXCEPTION
)
<<
"
I
ndex "
<<
i
<<
"> kernel datatype indexes size "
<<
datatype_indexes
.
size
();
}
if
(
!
CanDataTypeReduce
(
datatype_indexes
,
i
,
node_mix_precision_datatype_index
))
{
iter
=
kernel_match_datatype_idx
->
erase
(
iter
);
...
...
@@ -384,9 +388,9 @@ void PrintRaiseOrReducePrecisionSelectedInfo(const CNodePtr &cnode,
std
::
ostringstream
buffer
;
buffer
<<
cnode
->
DebugString
();
if
(
precision_reduce
)
{
buffer
<<
"
r
educe precision, node datatype:
\n
"
;
buffer
<<
"
R
educe precision, node datatype:
\n
"
;
}
else
{
buffer
<<
"
r
aise precision, node datatype:
\n
"
;
buffer
<<
"
R
aise precision, node datatype:
\n
"
;
}
PrintInputAndOutputInferType
(
buffer
,
cnode
);
buffer
<<
", select kernel:"
<<
selected_kernel_build_info
->
ToString
();
...
...
@@ -554,12 +558,12 @@ KernelSelectStatus SelectKernelInfo(const CNodePtr &kernel_node, KernelType kern
if
(
select_status
==
kNoMatched
)
{
std
::
ostringstream
buffer
;
PrintInputAndOutputInferType
(
buffer
,
kernel_node
);
MS_LOG
(
WARNING
)
<<
">>>
c
andidates kernel info list:"
;
MS_LOG
(
WARNING
)
<<
">>>
C
andidates kernel info list:"
;
for
(
size_t
index
=
0
;
index
<
kernel_info_list
.
size
();
++
index
)
{
MS_LOG
(
WARNING
)
<<
"
k
ernel ["
<<
index
<<
"] :"
<<
kernel_info_list
[
index
]
->
ToString
();
MS_LOG
(
WARNING
)
<<
"
K
ernel ["
<<
index
<<
"] :"
<<
kernel_info_list
[
index
]
->
ToString
();
}
for
(
size_t
index
=
0
;
index
<
aicpu_kernel_info_list
.
size
();
++
index
)
{
MS_LOG
(
WARNING
)
<<
"
k
ernel ["
<<
(
kernel_info_list
.
size
()
+
index
)
MS_LOG
(
WARNING
)
<<
"
K
ernel ["
<<
(
kernel_info_list
.
size
()
+
index
)
<<
"] :"
<<
aicpu_kernel_info_list
[
index
]
->
ToString
();
}
MS_LOG
(
WARNING
)
<<
" <<<"
;
...
...
mindspore/ccsrc/kernel/kernel_query.cc
浏览文件 @
b91d3270
...
...
@@ -32,7 +32,7 @@ void FilterInvalidKernelInfo(const CNodePtr &kernel_node,
MS_EXCEPTION_IF_NULL
(
kernel_info_list
);
std
::
vector
<
std
::
shared_ptr
<
kernel
::
KernelBuildInfo
>>
filtered_list
;
(
void
)
std
::
copy_if
(
kernel_info_list
->
begin
(),
kernel_info_list
->
end
(),
std
::
back_inserter
(
filtered_list
),
[
&
](
const
std
::
shared_ptr
<
kernel
::
KernelBuildInfo
>
&
kernel_build_info
)
{
[
&
kernel_node
](
const
std
::
shared_ptr
<
kernel
::
KernelBuildInfo
>
&
kernel_build_info
)
{
return
AnfAlgo
::
GetOutputTensorNum
(
kernel_node
)
==
kernel_build_info
->
GetOutputNum
()
&&
AnfAlgo
::
GetInputTensorNum
(
kernel_node
)
==
kernel_build_info
->
GetInputNum
();
});
...
...
@@ -43,15 +43,16 @@ void FilterInvalidKernelInfo(const CNodePtr &kernel_node,
MS_LOG
(
INFO
)
<<
"All kernel Info list does not match any kernel info "
;
for
(
size_t
index
=
0
;
index
<
kernel_info_list
->
size
();
++
index
)
{
std
::
ostringstream
buffer
;
MS_EXCEPTION_IF_NULL
(
kernel_info_list
->
at
(
index
));
if
(
AnfAlgo
::
GetOutputTensorNum
(
kernel_node
)
!=
kernel_info_list
->
at
(
index
)
->
GetOutputNum
())
{
auto
kernel_info
=
kernel_info_list
->
at
(
index
);
MS_EXCEPTION_IF_NULL
(
kernel_info
);
if
(
AnfAlgo
::
GetOutputTensorNum
(
kernel_node
)
!=
kernel_info
->
GetOutputNum
())
{
buffer
<<
"Kernel node's output size ["
<<
AnfAlgo
::
GetOutputTensorNum
(
kernel_node
)
<<
"]"
<<
" cannot match the kernel's output size ["
<<
kernel_info
_list
->
at
(
index
)
->
GetOutputNum
()
<<
"]"
;
<<
" cannot match the kernel's output size ["
<<
kernel_info
->
GetOutputNum
()
<<
"]"
;
}
else
{
buffer
<<
"Kernel node's output size ["
<<
AnfAlgo
::
GetInputTensorNum
(
kernel_node
)
<<
"]"
<<
" cannot match the kernel's output size ["
<<
kernel_info
_list
->
at
(
index
)
->
GetInputNum
()
<<
"]"
;
<<
" cannot match the kernel's output size ["
<<
kernel_info
->
GetInputNum
()
<<
"]"
;
}
MS_LOG
(
INFO
)
<<
"kernel [ "
<<
index
<<
" ] :"
<<
kernel_info
_list
->
at
(
index
)
->
ToString
()
<<
buffer
.
str
();
MS_LOG
(
INFO
)
<<
"kernel [ "
<<
index
<<
" ] :"
<<
kernel_info
->
ToString
()
<<
buffer
.
str
();
}
kernel_info_list
->
clear
();
MS_LOG
(
INFO
)
<<
"node"
<<
kernel_node
->
DebugString
()
<<
"'s output size : ["
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录