Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
0fb566b7
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0fb566b7
编写于
4月 29, 2019
作者:
S
superjomn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename io_complement_pass to type_target_transform_pass
上级
72b734e4
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
24 addition
and
20 deletion
+24
-20
paddle/fluid/lite/core/mir/CMakeLists.txt
paddle/fluid/lite/core/mir/CMakeLists.txt
+1
-1
paddle/fluid/lite/core/mir/passes.h
paddle/fluid/lite/core/mir/passes.h
+1
-1
paddle/fluid/lite/core/mir/type_target_transform_pass.cc
paddle/fluid/lite/core/mir/type_target_transform_pass.cc
+11
-10
paddle/fluid/lite/core/mir/type_target_transform_pass.h
paddle/fluid/lite/core/mir/type_target_transform_pass.h
+4
-2
paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc
...fluid/lite/core/mir/variable_place_inference_pass_test.cc
+1
-1
paddle/fluid/lite/core/optimizer.cc
paddle/fluid/lite/core/optimizer.cc
+1
-1
paddle/fluid/lite/core/optimizer.h
paddle/fluid/lite/core/optimizer.h
+5
-4
未找到文件。
paddle/fluid/lite/core/mir/CMakeLists.txt
浏览文件 @
0fb566b7
...
...
@@ -6,7 +6,7 @@ cc_library(mir_pass_registry SRCS pass_registry.cc DEPS mir_pass_manager)
cc_library
(
mir_passes
SRCS static_kernel_pick_pass.cc
variable_place_inference_pass.cc
io_complement
_pass.cc
type_target_transform
_pass.cc
io_copy_kernel_pick_pass.cc
graph_visualize_pass.cc
generate_program_pass.cc
...
...
paddle/fluid/lite/core/mir/passes.h
浏览文件 @
0fb566b7
...
...
@@ -24,7 +24,7 @@ namespace mir {} // namespace mir
USE_MIR_PASS
(
demo
);
USE_MIR_PASS
(
static_kernel_pick_pass
);
USE_MIR_PASS
(
variable_place_inference_pass
);
USE_MIR_PASS
(
io_complement
_pass
);
USE_MIR_PASS
(
type_target_transform
_pass
);
USE_MIR_PASS
(
generate_program_pass
);
USE_MIR_PASS
(
io_copy_kernel_pick_pass
);
USE_MIR_PASS
(
argument_type_display_pass
);
...
...
paddle/fluid/lite/core/mir/
io_complement
_pass.cc
→
paddle/fluid/lite/core/mir/
type_target_transform
_pass.cc
浏览文件 @
0fb566b7
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "paddle/fluid/lite/core/mir/
io_complement
_pass.h"
#include "paddle/fluid/lite/core/mir/
type_target_transform
_pass.h"
#include <list>
#include <string>
#include <vector>
...
...
@@ -23,7 +23,7 @@ namespace paddle {
namespace
lite
{
namespace
mir
{
void
IoComplement
Pass
::
Apply
(
std
::
unique_ptr
<
mir
::
SSAGraph
>&
graph
)
{
void
TypeTargetTransform
Pass
::
Apply
(
std
::
unique_ptr
<
mir
::
SSAGraph
>&
graph
)
{
// Start from inputs of the graph, those should have place set.
std
::
list
<
Node
*>
nodes
;
for
(
auto
&
node
:
graph
->
mutable_nodes
())
{
...
...
@@ -42,7 +42,7 @@ void IoComplementPass::Apply(std::unique_ptr<mir::SSAGraph>& graph) {
VLOG
(
3
)
<<
"
\n
"
<<
Visualize
(
graph
.
get
());
}
void
IoComplement
Pass
::
ComplementInputs
(
SSAGraph
*
graph
,
Node
*
inst_node
,
void
TypeTargetTransform
Pass
::
ComplementInputs
(
SSAGraph
*
graph
,
Node
*
inst_node
,
Node
*
in
)
{
// If this input is out of date.
if
(
inst_node
->
inlinks
.
end
()
==
...
...
@@ -68,10 +68,9 @@ void IoComplementPass::ComplementInputs(SSAGraph* graph, Node* inst_node,
}
}
void
IoComplementPass
::
AddIoCopyInst
(
const
Type
&
from
,
const
Type
&
to
,
const
std
::
string
&
var
,
SSAGraph
*
graph
,
Node
*
inst_node
,
const
std
::
vector
<
Place
>&
valid_places
)
{
void
TypeTargetTransformPass
::
AddIoCopyInst
(
const
Type
&
from
,
const
Type
&
to
,
const
std
::
string
&
var
,
SSAGraph
*
graph
,
Node
*
inst_node
,
const
std
::
vector
<
Place
>&
valid_places
)
{
CHECK
(
!
valid_places
.
empty
())
<<
"valid_place should be set"
;
// var -> new_transform_op -> new_var -> inst
// So there will be a new Argument node and a new IoCopy Instruct Node.
...
...
@@ -131,7 +130,8 @@ void IoComplementPass::AddIoCopyInst(const Type& from, const Type& to,
graph
->
CheckValid
();
}
void
IoComplementPass
::
SetValidPlaces
(
const
std
::
vector
<
Place
>&
valid_places
)
{
void
TypeTargetTransformPass
::
SetValidPlaces
(
const
std
::
vector
<
Place
>&
valid_places
)
{
CHECK
(
!
valid_places
.
empty
());
valid_places_
=
valid_places
;
}
...
...
@@ -140,4 +140,5 @@ void IoComplementPass::SetValidPlaces(const std::vector<Place>& valid_places) {
}
// namespace lite
}
// namespace paddle
REGISTER_MIR_PASS
(
io_complement_pass
,
paddle
::
lite
::
mir
::
IoComplementPass
);
REGISTER_MIR_PASS
(
type_target_transform_pass
,
paddle
::
lite
::
mir
::
TypeTargetTransformPass
);
paddle/fluid/lite/core/mir/
io_complement
_pass.h
→
paddle/fluid/lite/core/mir/
type_target_transform
_pass.h
浏览文件 @
0fb566b7
...
...
@@ -14,6 +14,8 @@
#pragma once
#include <string>
#include <vector>
#include "paddle/fluid/lite/core/mir/pass.h"
#include "paddle/fluid/lite/core/op_registry.h"
...
...
@@ -36,7 +38,7 @@ static void UpdateInputTo(framework::proto::OpDesc* desc,
* IoComplementPass complement the necessary instruction to make data
* transferring or transformation between different places.
*/
class
IoComplement
Pass
:
public
ProgramPass
{
class
TypeTargetTransform
Pass
:
public
ProgramPass
{
public:
void
Apply
(
std
::
unique_ptr
<
mir
::
SSAGraph
>&
graph
)
override
;
...
...
@@ -48,7 +50,7 @@ class IoComplementPass : public ProgramPass {
void
SetValidPlaces
(
const
std
::
vector
<
Place
>&
valid_places
);
const
std
::
vector
<
Place
>&
valid_places
()
const
{
return
valid_places_
;
}
;
const
std
::
vector
<
Place
>&
valid_places
()
const
{
return
valid_places_
;
}
private:
std
::
vector
<
Place
>
valid_places_
;
...
...
paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc
浏览文件 @
0fb566b7
...
...
@@ -54,7 +54,7 @@ TEST(variable_place_inference_pass, test) {
"argument_type_display_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"
io_complement_pass"
,
//
"
type_target_transform_pass"
,
//
});
Place
prefered_place
{
...
...
paddle/fluid/lite/core/optimizer.cc
浏览文件 @
0fb566b7
...
...
@@ -13,8 +13,8 @@
// limitations under the License.
#include "paddle/fluid/lite/core/optimizer.h"
#include "paddle/fluid/lite/core/mir/io_complement_pass.h"
#include "paddle/fluid/lite/core/mir/static_kernel_pick_pass.h"
#include "paddle/fluid/lite/core/mir/type_target_transform_pass.h"
namespace
paddle
{
namespace
lite
{
...
...
paddle/fluid/lite/core/optimizer.h
浏览文件 @
0fb566b7
...
...
@@ -16,10 +16,10 @@
#include <string>
#include <vector>
#include "paddle/fluid/lite/core/mir/generate_program_pass.h"
#include "paddle/fluid/lite/core/mir/io_complement_pass.h"
#include "paddle/fluid/lite/core/mir/pass_manager.h"
#include "paddle/fluid/lite/core/mir/ssa_graph.h"
#include "paddle/fluid/lite/core/mir/static_kernel_pick_pass.h"
#include "paddle/fluid/lite/core/mir/type_target_transform_pass.h"
#include "paddle/fluid/lite/core/program.h"
#include "paddle/fluid/lite/core/types.h"
...
...
@@ -48,7 +48,7 @@ class Optimizer {
"static_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"
io_complement_pass"
,
//
"
type_target_transform_pass"
,
//
"argument_type_display_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
...
...
@@ -83,8 +83,9 @@ class Optimizer {
}
void
InitIoComplement
()
{
auto
*
pass
=
mir
::
PassManager
::
Global
().
LookUp
<
mir
::
IoComplementPass
>
(
"io_complement_pass"
);
auto
*
pass
=
mir
::
PassManager
::
Global
().
LookUp
<
mir
::
TypeTargetTransformPass
>
(
"type_target_transform_pass"
);
CHECK
(
pass
);
CHECK
(
!
valid_places_
.
empty
());
LOG
(
INFO
)
<<
"valid_places.size "
<<
valid_places_
.
size
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录