Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
17d71280
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看板
提交
17d71280
编写于
7月 29, 2020
作者:
G
geekun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix codex and support akg op profiling
上级
980b67d1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
7 deletion
+24
-7
mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc
mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc
+5
-0
mindspore/ccsrc/runtime/device/ascend/profiling/profiling_utils.cc
.../ccsrc/runtime/device/ascend/profiling/profiling_utils.cc
+2
-2
mindspore/core/ir/pattern_matcher.h
mindspore/core/ir/pattern_matcher.h
+17
-5
未找到文件。
mindspore/ccsrc/backend/session/anf_runtime_algorithm.cc
浏览文件 @
17d71280
...
...
@@ -221,6 +221,11 @@ std::string AnfRuntimeAlgorithm::GetCNodeName(const AnfNodePtr &node) {
}
auto
func_graph
=
AnfAlgo
::
GetCNodeFuncGraphPtr
(
node
);
MS_EXCEPTION_IF_NULL
(
func_graph
);
if
(
func_graph
->
has_attr
(
FUNC_GRAPH_ATTR_GRAPH_KERNEL
))
{
std
::
string
fg_name
=
"GraphKernel_"
;
fg_name
+=
GetValue
<
std
::
string
>
(
func_graph
->
get_attr
(
FUNC_GRAPH_ATTR_GRAPH_KERNEL
));
return
fg_name
;
}
return
func_graph
->
ToString
();
}
MS_LOG
(
EXCEPTION
)
<<
"Unknown anf node type "
<<
node
->
DebugString
();
...
...
mindspore/ccsrc/runtime/device/ascend/profiling/profiling_utils.cc
浏览文件 @
17d71280
...
...
@@ -167,7 +167,7 @@ std::string ProfilingUtils::GetGraphLastTbeKernelName(const std::vector<CNodePtr
std
::
string
last_tbe_kernel_name
;
// find last tbe_kernel
for
(
auto
iter
=
cnode_exec_order
.
rbegin
();
iter
!=
cnode_exec_order
.
rend
();
++
iter
)
{
if
(
AnfAlgo
::
GetKernelType
(
*
iter
)
==
TBE_KERNEL
)
{
if
(
AnfAlgo
::
GetKernelType
(
*
iter
)
==
TBE_KERNEL
||
AnfAlgo
::
GetKernelType
(
*
iter
)
==
AKG_KERNEL
)
{
last_tbe_kernel_name
=
(
*
iter
)
->
fullname_with_scope
();
break
;
}
...
...
@@ -319,7 +319,7 @@ void ProfilingUtils::SetGraphProfilingCNode(uint32_t graph_id, const std::vector
bool
ProfilingUtils
::
ValidComputeGraph
(
NotNull
<
const
session
::
KernelGraph
*>
graph_ptr
)
{
for
(
const
auto
&
node
:
graph_ptr
->
execution_order
())
{
if
(
AnfAlgo
::
GetKernelType
(
node
)
==
TBE_KERNEL
)
{
if
(
AnfAlgo
::
GetKernelType
(
node
)
==
TBE_KERNEL
||
AnfAlgo
::
GetKernelType
(
node
)
==
AKG_KERNEL
)
{
return
true
;
}
}
...
...
mindspore/core/ir/pattern_matcher.h
浏览文件 @
17d71280
...
...
@@ -91,6 +91,7 @@ class PBinOperation : public PBase<PBinOperation<T, T2> > {
public:
PBinOperation
(
const
PrimitivePtr
&
prim
,
const
T
&
x
,
const
T2
&
y
,
bool
is_commutative
=
false
)
:
prim_
(
prim
),
x_
(
x
),
y_
(
y
),
is_commutative_
(
is_commutative
)
{}
~
PBinOperation
()
=
default
;
AnfNodePtr
GetNode
(
const
AnfNodePtr
&
node
)
const
{
AnfNodePtr
lhs
=
x_
.
GetNode
(
node
->
func_graph
());
...
...
@@ -282,6 +283,7 @@ template <typename... TArgs>
class
PPrimitive
:
public
PBase
<
PPrimitive
<
TArgs
...
>
>
{
public:
explicit
PPrimitive
(
const
PrimitivePtr
&
prim
,
const
TArgs
&
...
args
)
:
prim_
(
prim
),
args_
(
args
...)
{}
~
PPrimitive
()
=
default
;
AnfNodePtr
GetNode
(
const
AnfNodePtr
&
node
)
const
{
tuple_utils
::
PTupleGetNode
get_node
(
node
);
...
...
@@ -378,6 +380,7 @@ class PConstant : public PBase<PConstant<T> > {
check_value_
(
check_value
),
is_scalar_
(
is_scalar
)
{}
~
PConstant
()
=
default
;
// Sets as_node_ as the node received as argument to produce a same-shape node with GetNode
const
PConstant
<
T
>
&
WithShapeAs
(
const
AnfNodePtr
&
node
)
const
{
if
(
node
==
nullptr
)
{
...
...
@@ -556,7 +559,9 @@ class PConstant : public PBase<PConstant<T> > {
char
*
data
=
reinterpret_cast
<
char
*>
(
new_tensor_ptr
->
data_c
());
if
(
x
==
nullptr
)
{
memset_s
(
data
,
mem_size
,
0
,
mem_size
);
if
(
memset_s
(
data
,
mem_size
,
0
,
mem_size
)
!=
0
)
{
return
nullptr
;
}
auto
new_vnode
=
NewValueNode
(
new_tensor_ptr
);
new_vnode
->
set_abstract
(
new_tensor_ptr
->
ToAbstract
());
return
new_vnode
;
...
...
@@ -588,14 +593,19 @@ class PConstant : public PBase<PConstant<T> > {
if
((
x_tensor_ptr
->
DataSize
()
>
1
)
&&
(
x_tensor_ptr
->
DataSize
()
!=
new_tensor_ptr
->
DataSize
()))
{
return
nullptr
;
}
int
ret
=
0
;
char
*
source_data
=
reinterpret_cast
<
char
*>
(
GetPointerToTensorData
(
x
));
if
(
x_tensor_ptr
->
DataSize
()
==
1
)
{
for
(
int
i
=
0
;
i
<
new_tensor_ptr
->
ElementsNum
();
i
++
)
{
memcpy_s
(
data
+
i
*
GetTypeByte
(
tensor_type_ptr
),
GetTypeByte
(
tensor_type_ptr
),
source_data
,
GetTypeByte
(
tensor_type_ptr
));
ret
=
memcpy_s
(
data
+
i
*
GetTypeByte
(
tensor_type_ptr
),
GetTypeByte
(
tensor_type_ptr
),
source_data
,
GetTypeByte
(
tensor_type_ptr
));
}
}
else
{
memcpy_s
(
data
,
mem_size
,
source_data
,
mem_size
);
ret
=
memcpy_s
(
data
,
mem_size
,
source_data
,
mem_size
);
}
if
(
ret
!=
0
)
{
MS_LOG
(
EXCEPTION
)
<<
"memcpy_s error, errorno "
<<
ret
<<
", source size "
<<
mem_size
<<
"dest size"
<<
new_tensor_ptr
->
DataSize
();
}
auto
new_vnode
=
NewValueNode
(
new_tensor_ptr
);
new_vnode
->
set_abstract
(
new_tensor_ptr
->
ToAbstract
());
...
...
@@ -615,7 +625,9 @@ class PConstant : public PBase<PConstant<T> > {
size_t
mem_size
=
GetTypeByte
(
tensor_type_ptr
)
*
IntToSize
(
new_tensor_ptr
->
ElementsNum
());
char
*
data
=
reinterpret_cast
<
char
*>
(
new_tensor_ptr
->
data_c
());
memset_s
(
data
,
mem_size
,
value
,
mem_size
);
if
(
memset_s
(
data
,
mem_size
,
value
,
mem_size
)
!=
0
)
{
return
nullptr
;
}
auto
new_vnode
=
NewValueNode
(
new_tensor_ptr
);
new_vnode
->
set_abstract
(
new_tensor_ptr
->
ToAbstract
());
return
new_vnode
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录