Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
42c00b15
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看板
提交
42c00b15
编写于
6月 18, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 18, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2222 fix op compile log bug
Merge pull request !2222 from wangcong/master
上级
19e66f06
aed393d5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
13 deletion
+27
-13
mindspore/_extends/parallel_compile/tbe_compiler/compiler.py
mindspore/_extends/parallel_compile/tbe_compiler/compiler.py
+4
-7
mindspore/_extends/parallel_compile/tbe_compiler/tbe_process.py
...ore/_extends/parallel_compile/tbe_compiler/tbe_process.py
+3
-3
mindspore/ccsrc/device/ascend/kernel_build_ascend.cc
mindspore/ccsrc/device/ascend/kernel_build_ascend.cc
+2
-1
mindspore/ccsrc/kernel/kernel.h
mindspore/ccsrc/kernel/kernel.h
+1
-0
mindspore/ccsrc/kernel/tbe/tbe_convert_utils.cc
mindspore/ccsrc/kernel/tbe/tbe_convert_utils.cc
+1
-1
mindspore/ccsrc/kernel/tbe/tbe_kernel_parallel_build.cc
mindspore/ccsrc/kernel/tbe/tbe_kernel_parallel_build.cc
+14
-0
mindspore/ccsrc/session/ascend_session.cc
mindspore/ccsrc/session/ascend_session.cc
+1
-0
mindspore/ops/_op_impl/tbe/matmul.py
mindspore/ops/_op_impl/tbe/matmul.py
+1
-1
未找到文件。
mindspore/_extends/parallel_compile/tbe_compiler/compiler.py
浏览文件 @
42c00b15
...
...
@@ -28,8 +28,8 @@ build_in_impl_path = get_build_in_impl_path()
# op function list
op_build
=
"compile"
op_pre_build
=
"pre_build"
fusion_
type_map
=
{
'Convolution'
:
0
,
'ElemWise'
:
1
,
'CommReduce'
:
2
,
'Segment'
:
3
,
'Opaque'
:
4
}
fusion_
pattern_start_flag
=
"fusion_pattern_start"
fusion_pattern_end_flag
=
"fusion_pattern_end"
def
_initialize
(
impl_path
):
"""Initialize"""
...
...
@@ -43,7 +43,6 @@ def _initialize(impl_path):
sys
.
path
.
insert
(
0
,
op_module_name
)
def
build_op
(
build_type
,
json_str
):
"""
call op functions with function name and input args json_str
...
...
@@ -169,7 +168,5 @@ def compile_with_json(json_str):
if
__name__
==
"__main__"
:
in_args
=
sys
.
stdin
.
readline
()
result
=
compile_with_json
(
in_args
)
if
result
in
fusion_type_map
:
exit
(
fusion_type_map
[
result
])
else
:
exit
(
100
)
sys
.
stdout
.
write
(
fusion_pattern_start_flag
+
str
(
result
)
+
fusion_pattern_end_flag
)
sys
.
stdout
.
flush
()
mindspore/_extends/parallel_compile/tbe_compiler/tbe_process.py
浏览文件 @
42c00b15
...
...
@@ -88,10 +88,10 @@ def run_compiler(op_json):
try
:
tbe_compiler
=
os
.
path
.
join
(
os
.
path
.
split
(
os
.
path
.
realpath
(
__file__
))[
0
],
"compiler.py"
)
completed_object
=
subprocess
.
run
([
sys
.
executable
,
tbe_compiler
],
input
=
op_json
,
timeout
=
300
,
text
=
True
,
capture_output
=
True
,
check
=
Fals
e
)
text
=
True
,
capture_output
=
True
,
check
=
Tru
e
)
if
completed_object
:
code
=
completed_object
.
returncode
return
"Success"
,
str
(
code
)
out
=
completed_object
.
stdout
return
"Success"
,
out
except
subprocess
.
TimeoutExpired
:
tb
=
traceback
.
format_exc
()
return
"TBEException"
,
"PreCompileTimeOut: "
+
tb
+
"
\n
input_args: "
+
op_json
...
...
mindspore/ccsrc/device/ascend/kernel_build_ascend.cc
浏览文件 @
42c00b15
...
...
@@ -73,7 +73,8 @@ static bool KernelPreBuildParallelCompile(const mindspore::session::KernelGraph
KernelType
kernel_type
=
AnfAlgo
::
GetKernelType
(
anf_node
);
switch
(
kernel_type
)
{
case
KernelType
::
TBE_KERNEL
:
{
if
(
AnfAlgo
::
GetKernelMod
(
anf_node
)
==
nullptr
)
{
if
(
AnfAlgo
::
GetKernelMod
(
anf_node
)
==
nullptr
&&
AnfAlgo
::
GetFusionType
(
anf_node
)
==
kernel
::
FusionType
::
DYNAMIC
)
{
tbe_nodes
.
push_back
(
anf_node
);
}
break
;
...
...
mindspore/ccsrc/kernel/kernel.h
浏览文件 @
42c00b15
...
...
@@ -45,6 +45,7 @@ enum FusionType {
COMMREDUCE
,
SEGMENT
,
OPAQUE
,
DYNAMIC
,
UNKNOWN_FUSION_TYPE
=
-
1
,
};
enum
OpPattern
{
...
...
mindspore/ccsrc/kernel/tbe/tbe_convert_utils.cc
浏览文件 @
42c00b15
...
...
@@ -63,7 +63,7 @@ const std::unordered_map<std::string, size_t> type_nbyte_maps = {
const
std
::
unordered_map
<
std
::
string
,
FusionType
>
fusion_type_maps
=
{
{
"CONVLUTION"
,
FusionType
::
CONVLUTION
},
{
"ELEMWISE"
,
FusionType
::
ELEMWISE
},
{
"COMMREDUCE"
,
FusionType
::
COMMREDUCE
},
{
"SEGMENT"
,
FusionType
::
SEGMENT
},
{
"OPAQUE"
,
FusionType
::
OPAQUE
},
{
"SEGMENT"
,
FusionType
::
SEGMENT
},
{
"
DYNAMIC"
,
FusionType
::
DYNAMIC
},
{
"
OPAQUE"
,
FusionType
::
OPAQUE
},
};
TypeId
DtypeToTypeId
(
const
std
::
string
&
dtypes
)
{
...
...
mindspore/ccsrc/kernel/tbe/tbe_kernel_parallel_build.cc
浏览文件 @
42c00b15
...
...
@@ -205,6 +205,20 @@ void ParallelBuildManager::PreTaskFinishProcess(int32_t task_id, const std::stri
if
(
task_iter
==
pre_task_map_
.
end
())
{
MS_EXCEPTION
(
ArgumentError
)
<<
"can find pre task_id:"
<<
task_id
;
}
auto
node
=
task_iter
->
second
;
auto
builder
=
std
::
make_shared
<
kernel
::
KernelBuildInfo
::
KernelBuildInfoBuilder
>
(
AnfAlgo
::
GetSelectKernelBuildInfo
(
node
));
std
::
string
start_flag
=
"fusion_pattern_start"
;
std
::
string
end_flag
=
"fusion_pattern_end"
;
int
start
=
pre_build_result
.
find
(
start_flag
);
int
end
=
pre_build_result
.
find
(
end_flag
);
if
(
start
!=
-
1
&&
end
!=
-
1
)
{
std
::
string
result
=
pre_build_result
.
substr
(
start
+
start_flag
.
size
(),
end
-
start
-
start_flag
.
size
());
transform
(
result
.
begin
(),
result
.
end
(),
result
.
begin
(),
::
toupper
);
FusionType
fusion_type
=
tbe
::
GetFusionType
(
result
);
builder
->
SetFusionType
(
fusion_type
);
AnfAlgo
::
SetSelectKernelBuildInfo
(
builder
->
Build
(),
node
.
get
());
}
(
void
)
pre_task_map_
.
erase
(
task_iter
);
}
...
...
mindspore/ccsrc/session/ascend_session.cc
浏览文件 @
42c00b15
...
...
@@ -535,6 +535,7 @@ void AscendSession::InitRuntimeResource() {
}
void
AscendSession
::
HardwareOptimize
(
const
std
::
shared_ptr
<
KernelGraph
>
&
kernel_graph
)
const
{
device
::
ascend
::
KernelPreBuild
(
kernel_graph
.
get
());
MS_LOG
(
INFO
)
<<
"HardwareOptimize start!"
;
opt
::
AscendBackendOptimization
(
kernel_graph
);
MS_EXCEPTION_IF_NULL
(
kernel_graph
);
...
...
mindspore/ops/_op_impl/tbe/matmul.py
浏览文件 @
42c00b15
...
...
@@ -17,7 +17,7 @@
from
mindspore.ops.op_info_register
import
op_info_register
,
TBERegOp
,
DataType
matmul_op_info
=
TBERegOp
(
"MatMul"
)
\
.
fusion_type
(
"
OPAQUE
"
)
\
.
fusion_type
(
"
DYNAMIC
"
)
\
.
async_flag
(
False
)
\
.
binfile_name
(
"matmul.so"
)
\
.
compute_cost
(
10
)
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录