Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
18efdc8f
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看板
提交
18efdc8f
编写于
7月 15, 2020
作者:
Z
Zhang Qinghua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move abstract/base into core, and remove static_analysis including symbols in ir.
上级
bc0a53cf
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
36 addition
and
59 deletion
+36
-59
mindspore/ccsrc/CMakeLists.txt
mindspore/ccsrc/CMakeLists.txt
+6
-2
mindspore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc
...ore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc
+27
-3
mindspore/core/abstract/CMakeLists.txt
mindspore/core/abstract/CMakeLists.txt
+0
-0
mindspore/core/abstract/abstract_value.cc
mindspore/core/abstract/abstract_value.cc
+0
-0
mindspore/core/abstract/abstract_value.h
mindspore/core/abstract/abstract_value.h
+0
-0
mindspore/core/abstract/analysis_context.cc
mindspore/core/abstract/analysis_context.cc
+0
-0
mindspore/core/abstract/analysis_context.h
mindspore/core/abstract/analysis_context.h
+0
-0
mindspore/core/abstract/dshape.cc
mindspore/core/abstract/dshape.cc
+0
-0
mindspore/core/abstract/dshape.h
mindspore/core/abstract/dshape.h
+0
-0
mindspore/core/abstract/param_validator.cc
mindspore/core/abstract/param_validator.cc
+0
-0
mindspore/core/abstract/param_validator.h
mindspore/core/abstract/param_validator.h
+0
-0
mindspore/core/abstract/utils.cc
mindspore/core/abstract/utils.cc
+0
-0
mindspore/core/abstract/utils.h
mindspore/core/abstract/utils.h
+0
-0
mindspore/core/base/CMakeLists.txt
mindspore/core/base/CMakeLists.txt
+0
-0
mindspore/core/base/base.cc
mindspore/core/base/base.cc
+0
-0
mindspore/core/base/base.h
mindspore/core/base/base.h
+0
-0
mindspore/core/ir/anf_extends.cc
mindspore/core/ir/anf_extends.cc
+1
-1
mindspore/core/ir/func_graph.h
mindspore/core/ir/func_graph.h
+0
-1
mindspore/core/ir/func_graph_extends.cc
mindspore/core/ir/func_graph_extends.cc
+0
-11
mindspore/core/ir/meta_func_graph.cc
mindspore/core/ir/meta_func_graph.cc
+0
-13
mindspore/core/ir/meta_func_graph.h
mindspore/core/ir/meta_func_graph.h
+0
-1
mindspore/core/ir/primitive_extends.cc
mindspore/core/ir/primitive_extends.cc
+0
-25
tests/ut/cpp/CMakeLists.txt
tests/ut/cpp/CMakeLists.txt
+2
-2
未找到文件。
mindspore/ccsrc/CMakeLists.txt
浏览文件 @
18efdc8f
...
...
@@ -138,7 +138,7 @@ set(SUB_COMP
frontend/operator
pipeline/jit
pipeline/pynative
common debug gvar predict pybind_api utils vm
base abstract
common debug gvar predict pybind_api utils vm
)
foreach
(
_comp
${
SUB_COMP
}
)
...
...
@@ -149,9 +149,13 @@ foreach (_comp ${SUB_COMP})
add_dependencies
(
_mindspore_
${
sub
}
_obj proto_input flat_input
)
endif
()
endforeach
()
add_subdirectory
(
${
CMAKE_SOURCE_DIR
}
/mindspore/core/base base
)
list
(
APPEND SUB_OBJECTS_SRC $<TARGET_OBJECTS:_mindspore_base_obj>
)
add_subdirectory
(
${
CMAKE_SOURCE_DIR
}
/mindspore/core/abstract abstract
)
list
(
APPEND SUB_OBJECTS_SRC $<TARGET_OBJECTS:_mindspore_abstract_obj>
)
add_subdirectory
(
${
CMAKE_SOURCE_DIR
}
/mindspore/core/ir ir
)
list
(
APPEND SUB_OBJECTS_SRC $<TARGET_OBJECTS:_mindspore_ir_obj>
)
add_dependencies
(
_mindspore_
ir
_obj proto_input flat_input
)
add_dependencies
(
_mindspore_
base_obj _mindspore_ir_obj _mindspore_abstract
_obj proto_input flat_input
)
set_property
(
SOURCE
${
SUB_OBJECTS_SRC
}
PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_ME
)
add_library
(
mindspore STATIC
${
SUB_OBJECTS_SRC
}
)
...
...
mindspore/ccsrc/pipeline/jit/static_analysis/static_analysis.cc
浏览文件 @
18efdc8f
...
...
@@ -612,10 +612,34 @@ EvalResultPtr AnfNodeConfig::GetEvaluatedValue() {
return
engine_
.
lock
()
->
GetEvaluatedValue
(
self
);
}
abstract
::
AbstractBasePtr
MakeAbstractClosure
(
const
FuncGraphPtr
&
func_graph
,
const
abstract
::
AnalysisContextPtr
&
context
)
{
AnalysisContextPtr
temp_context
=
context
;
if
(
temp_context
==
nullptr
)
{
temp_context
=
abstract
::
AnalysisContext
::
DummyContext
();
}
return
std
::
make_shared
<
abstract
::
FuncGraphAbstractClosure
>
(
func_graph
,
temp_context
);
}
abstract
::
AbstractBasePtr
MakeAbstractClosure
(
const
MetaFuncGraphPtr
&
meta_func_graph
,
const
AnfNodePtr
&
anf_node
)
{
abstract
::
MetaFuncGraphAbstractClosurePtr
meta_func_graph_fn
;
if
(
anf_node
==
nullptr
)
{
meta_func_graph_fn
=
std
::
make_shared
<
abstract
::
MetaFuncGraphAbstractClosure
>
(
meta_func_graph
);
}
else
{
meta_func_graph_fn
=
std
::
make_shared
<
abstract
::
MetaFuncGraphAbstractClosure
>
(
meta_func_graph
,
anf_node
->
scope
());
}
return
meta_func_graph_fn
;
}
abstract
::
AbstractBasePtr
MakeAbstractClosure
(
const
PrimitivePtr
&
primitive
,
const
AnfNodePtr
&
anf_node
)
{
auto
prim_func
=
std
::
make_shared
<
abstract
::
PrimitiveAbstractClosure
>
(
primitive
,
anf_node
);
return
prim_func
;
}
AbstractBasePtr
ToAbstract
(
const
ValuePtr
&
value
,
const
AnalysisContextPtr
&
context
,
const
AnfNodeConfigPtr
&
conf
)
{
if
(
value
->
isa
<
FuncGraph
>
())
{
auto
func_graph
=
value
->
cast
<
FuncGraphPtr
>
();
return
func_graph
->
MakeAbstractClosure
(
context
);
return
MakeAbstractClosure
(
func_graph
,
context
);
}
AnfNodePtr
anf_node
=
nullptr
;
if
(
conf
!=
nullptr
)
{
...
...
@@ -623,11 +647,11 @@ AbstractBasePtr ToAbstract(const ValuePtr &value, const AnalysisContextPtr &cont
}
if
(
value
->
isa
<
MetaFuncGraph
>
())
{
auto
meta_func_graph
=
value
->
cast
<
MetaFuncGraphPtr
>
();
return
meta_func_graph
->
MakeAbstractClosure
(
anf_node
);
return
MakeAbstractClosure
(
meta_func_graph
,
anf_node
);
}
if
(
value
->
isa
<
Primitive
>
())
{
auto
prim
=
value
->
cast
<
PrimitivePtr
>
();
return
prim
->
ToPrimAbstract
(
anf_node
);
return
MakeAbstractClosure
(
prim
,
anf_node
);
}
return
value
->
ToAbstract
();
}
...
...
mindspore/c
csrc
/abstract/CMakeLists.txt
→
mindspore/c
ore
/abstract/CMakeLists.txt
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/abstract_value.cc
→
mindspore/c
ore
/abstract/abstract_value.cc
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/abstract_value.h
→
mindspore/c
ore
/abstract/abstract_value.h
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/analysis_context.cc
→
mindspore/c
ore
/abstract/analysis_context.cc
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/analysis_context.h
→
mindspore/c
ore
/abstract/analysis_context.h
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/dshape.cc
→
mindspore/c
ore
/abstract/dshape.cc
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/dshape.h
→
mindspore/c
ore
/abstract/dshape.h
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/param_validator.cc
→
mindspore/c
ore
/abstract/param_validator.cc
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/param_validator.h
→
mindspore/c
ore
/abstract/param_validator.h
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/utils.cc
→
mindspore/c
ore
/abstract/utils.cc
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/abstract/utils.h
→
mindspore/c
ore
/abstract/utils.h
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/base/CMakeLists.txt
→
mindspore/c
ore
/base/CMakeLists.txt
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/base/base.cc
→
mindspore/c
ore
/base/base.cc
浏览文件 @
18efdc8f
文件已移动
mindspore/c
csrc
/base/base.h
→
mindspore/c
ore
/base/base.h
浏览文件 @
18efdc8f
文件已移动
mindspore/core/ir/anf_extends.cc
浏览文件 @
18efdc8f
...
...
@@ -22,7 +22,7 @@
#include <unordered_map>
#include "ir/visitor.h"
#include "
pipeline/jit/static_analysis/static_analysis
.h"
#include "
ir/func_graph
.h"
#include "frontend/operator/ops.h"
#include "frontend/parallel/ops_info/ops_utils.h"
#include "debug/label.h"
...
...
mindspore/core/ir/func_graph.h
浏览文件 @
18efdc8f
...
...
@@ -149,7 +149,6 @@ class FuncGraph : public FuncGraphBase {
// get the graph's abstract
abstract
::
AbstractFunctionPtr
abstract
();
abstract
::
AbstractBasePtr
MakeAbstractClosure
(
const
abstract
::
AnalysisContextPtr
&
context
);
// return the graph's output, or nullptr if not yet deduced
AnfNodePtr
output
()
const
;
...
...
mindspore/core/ir/func_graph_extends.cc
浏览文件 @
18efdc8f
...
...
@@ -25,9 +25,6 @@
#include "frontend/operator/ops.h"
#include "utils/ordered_set.h"
#include "abstract/abstract_value.h"
#include "pipeline/jit/static_analysis/static_analysis.h"
#include "pipeline/jit/static_analysis/abstract_function.h"
#include "debug/anf_ir_dump.h"
#include "debug/trace.h"
#include "debug/draw.h"
...
...
@@ -60,14 +57,6 @@ AbstractFunctionPtr FuncGraph::abstract() {
return
std
::
make_shared
<
VirtualAbstractClosure
>
(
args_spec_list
,
output
()
->
abstract
());
}
abstract
::
AbstractBasePtr
FuncGraph
::
MakeAbstractClosure
(
const
abstract
::
AnalysisContextPtr
&
context
)
{
AnalysisContextPtr
temp_context
=
context
;
if
(
temp_context
==
nullptr
)
{
temp_context
=
abstract
::
AnalysisContext
::
DummyContext
();
}
return
std
::
make_shared
<
abstract
::
FuncGraphAbstractClosure
>
(
shared_from_base
<
FuncGraph
>
(),
temp_context
);
}
void
FuncGraph
::
set_output
(
const
AnfNodePtr
&
value
,
bool
force_new_ret
)
{
if
(
force_new_ret
||
return_
==
nullptr
)
{
std
::
vector
<
AnfNodePtr
>
params
({
NewValueNode
(
prim
::
kPrimReturn
),
value
});
...
...
mindspore/core/ir/meta_func_graph.cc
浏览文件 @
18efdc8f
...
...
@@ -17,22 +17,9 @@
*/
#include "ir/meta_func_graph.h"
#include "pipeline/jit/static_analysis/static_analysis.h"
#include "pipeline/jit/static_analysis/abstract_function.h"
// namespace to support intermediate representation definition
namespace
mindspore
{
abstract
::
AbstractBasePtr
MetaFuncGraph
::
MakeAbstractClosure
(
const
AnfNodePtr
&
anf_node
)
{
abstract
::
MetaFuncGraphAbstractClosurePtr
meta_func_graph_fn
;
if
(
anf_node
==
nullptr
)
{
meta_func_graph_fn
=
std
::
make_shared
<
abstract
::
MetaFuncGraphAbstractClosure
>
(
shared_from_base
<
MetaFuncGraph
>
());
}
else
{
meta_func_graph_fn
=
std
::
make_shared
<
abstract
::
MetaFuncGraphAbstractClosure
>
(
shared_from_base
<
MetaFuncGraph
>
(),
anf_node
->
scope
());
}
return
meta_func_graph_fn
;
}
FuncGraphPtr
MetaFuncGraph
::
GenerateFuncGraph
(
const
abstract
::
AbstractBasePtrList
&
args_spec_list
)
{
TypePtrList
types
;
(
void
)
std
::
transform
(
args_spec_list
.
begin
(),
args_spec_list
.
end
(),
std
::
back_inserter
(
types
),
...
...
mindspore/core/ir/meta_func_graph.h
浏览文件 @
18efdc8f
...
...
@@ -44,7 +44,6 @@ class MetaFuncGraph : public FuncGraphBase {
~
MetaFuncGraph
()
override
=
default
;
MS_DECLARE_PARENT
(
MetaFuncGraph
,
FuncGraphBase
);
abstract
::
AbstractBasePtr
MakeAbstractClosure
(
const
AnfNodePtr
&
anf_node
);
// Return normalized versions of the arguments.
// By default, this returns args unchanged.
virtual
abstract
::
AbstractBasePtrList
NormalizeArgs
(
const
abstract
::
AbstractBasePtrList
&
args_spec_list
)
const
{
...
...
mindspore/core/ir/primitive_extends.cc
已删除
100644 → 0
浏览文件 @
bc0a53cf
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ir/primitive.h"
#include "pipeline/jit/static_analysis/abstract_function.h"
namespace
mindspore
{
abstract
::
AbstractBasePtr
Primitive
::
ToPrimAbstract
(
const
AnfNodePtr
&
anf_node
)
{
auto
prim_func
=
std
::
make_shared
<
abstract
::
PrimitiveAbstractClosure
>
(
shared_from_base
<
Primitive
>
(),
anf_node
);
return
prim_func
;
}
}
// namespace mindspore
tests/ut/cpp/CMakeLists.txt
浏览文件 @
18efdc8f
...
...
@@ -52,8 +52,8 @@ else()
endif
()
file
(
GLOB_RECURSE MINDSPORE_SRC_LIST RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
"../../../mindspore/c
csrc
/base/*.cc"
"../../../mindspore/c
csrc
/abstract/*.cc"
"../../../mindspore/c
ore
/base/*.cc"
"../../../mindspore/c
ore
/abstract/*.cc"
"../../../mindspore/core/ir/*.cc"
"../../../mindspore/ccsrc/common/*.cc"
"../../../mindspore/ccsrc/utils/*.cc"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录