Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
1ae26706
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1ae26706
编写于
7月 01, 2019
作者:
C
Chunwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some code clean
上级
0d773c77
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
23 addition
and
22 deletion
+23
-22
paddle/fluid/lite/api/paddle_use_passes.h
paddle/fluid/lite/api/paddle_use_passes.h
+2
-2
paddle/fluid/lite/core/mir/CMakeLists.txt
paddle/fluid/lite/core/mir/CMakeLists.txt
+2
-2
paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc
paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc
+1
-1
paddle/fluid/lite/core/mir/type_precision_cast_pass.cc
paddle/fluid/lite/core/mir/type_precision_cast_pass.cc
+2
-2
paddle/fluid/lite/core/mir/type_precision_cast_pass.h
paddle/fluid/lite/core/mir/type_precision_cast_pass.h
+0
-0
paddle/fluid/lite/core/mir/type_target_cast_pass.cc
paddle/fluid/lite/core/mir/type_target_cast_pass.cc
+2
-2
paddle/fluid/lite/core/mir/type_target_cast_pass.h
paddle/fluid/lite/core/mir/type_target_cast_pass.h
+0
-0
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
+4
-4
paddle/fluid/lite/core/type_system.h
paddle/fluid/lite/core/type_system.h
+5
-4
paddle/fluid/lite/core/types.h
paddle/fluid/lite/core/types.h
+2
-2
paddle/fluid/lite/tools/debug/model_debug_tool.cc
paddle/fluid/lite/tools/debug/model_debug_tool.cc
+1
-1
未找到文件。
paddle/fluid/lite/api/paddle_use_passes.h
浏览文件 @
1ae26706
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
USE_MIR_PASS
(
demo
);
USE_MIR_PASS
(
demo
);
USE_MIR_PASS
(
static_kernel_pick_pass
);
USE_MIR_PASS
(
static_kernel_pick_pass
);
USE_MIR_PASS
(
variable_place_inference_pass
);
USE_MIR_PASS
(
variable_place_inference_pass
);
USE_MIR_PASS
(
type_target_
transform
_pass
);
USE_MIR_PASS
(
type_target_
cast
_pass
);
USE_MIR_PASS
(
generate_program_pass
);
USE_MIR_PASS
(
generate_program_pass
);
USE_MIR_PASS
(
io_copy_kernel_pick_pass
);
USE_MIR_PASS
(
io_copy_kernel_pick_pass
);
USE_MIR_PASS
(
argument_type_display_pass
);
USE_MIR_PASS
(
argument_type_display_pass
);
...
@@ -31,5 +31,5 @@ USE_MIR_PASS(identity_scale_eliminate_pass);
...
@@ -31,5 +31,5 @@ USE_MIR_PASS(identity_scale_eliminate_pass);
USE_MIR_PASS
(
lite_conv_elementwise_add_activation_fuse_pass
);
USE_MIR_PASS
(
lite_conv_elementwise_add_activation_fuse_pass
);
USE_MIR_PASS
(
lite_elementwise_add_activation_fuse_pass
);
USE_MIR_PASS
(
lite_elementwise_add_activation_fuse_pass
);
USE_MIR_PASS
(
lite_quant_dequant_fuse_pass
);
USE_MIR_PASS
(
lite_quant_dequant_fuse_pass
);
USE_MIR_PASS
(
precision_cast_transform
_pass
);
USE_MIR_PASS
(
type_precision_cast
_pass
);
USE_MIR_PASS
(
trans_weight_pass
);
USE_MIR_PASS
(
trans_weight_pass
);
paddle/fluid/lite/core/mir/CMakeLists.txt
浏览文件 @
1ae26706
...
@@ -17,8 +17,8 @@ lite_cc_library(mir_passes
...
@@ -17,8 +17,8 @@ lite_cc_library(mir_passes
elimination/identity_scale_eliminate_pass.cc
elimination/identity_scale_eliminate_pass.cc
static_kernel_pick_pass.cc
static_kernel_pick_pass.cc
variable_place_inference_pass.cc
variable_place_inference_pass.cc
type_target_
transform
_pass.cc
type_target_
cast
_pass.cc
precision_cast_transform
_pass.cc
type_precision_cast
_pass.cc
io_copy_kernel_pick_pass.cc
io_copy_kernel_pick_pass.cc
graph_visualize_pass.cc
graph_visualize_pass.cc
generate_program_pass.cc
generate_program_pass.cc
...
...
paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc
浏览文件 @
1ae26706
...
@@ -29,7 +29,7 @@ bool KernelScoreCmp(const std::pair<size_t, std::unique_ptr<KernelBase>>& a,
...
@@ -29,7 +29,7 @@ bool KernelScoreCmp(const std::pair<size_t, std::unique_ptr<KernelBase>>& a,
}
}
void
StaticKernelPickPass
::
Apply
(
const
std
::
unique_ptr
<
SSAGraph
>&
graph
)
{
void
StaticKernelPickPass
::
Apply
(
const
std
::
unique_ptr
<
SSAGraph
>&
graph
)
{
CHECK
(
kernel_pick_factors_
.
AnyFactorC
onsidered
())
CHECK
(
kernel_pick_factors_
.
any_factor_c
onsidered
())
<<
"kernel_pick_factors should be specified first"
;
<<
"kernel_pick_factors should be specified first"
;
CHECK
(
graph
)
<<
"graph not valid"
;
CHECK
(
graph
)
<<
"graph not valid"
;
// sort kernels by the factors.
// sort kernels by the factors.
...
...
paddle/fluid/lite/core/mir/
precision_cast_transform
_pass.cc
→
paddle/fluid/lite/core/mir/
type_precision_cast
_pass.cc
浏览文件 @
1ae26706
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#include "paddle/fluid/lite/core/mir/
precision_cast_transform
_pass.h"
#include "paddle/fluid/lite/core/mir/
type_precision_cast
_pass.h"
#include <list>
#include <list>
#include <memory>
#include <memory>
#include <string>
#include <string>
...
@@ -162,5 +162,5 @@ void PrecisionCastPass::SetValidPlaces(const std::vector<Place>& valid_places) {
...
@@ -162,5 +162,5 @@ void PrecisionCastPass::SetValidPlaces(const std::vector<Place>& valid_places) {
}
// namespace lite
}
// namespace lite
}
// namespace paddle
}
// namespace paddle
REGISTER_MIR_PASS
(
precision_cast_transform
_pass
,
REGISTER_MIR_PASS
(
type_precision_cast
_pass
,
paddle
::
lite
::
mir
::
PrecisionCastPass
);
paddle
::
lite
::
mir
::
PrecisionCastPass
);
paddle/fluid/lite/core/mir/
precision_cast_transform
_pass.h
→
paddle/fluid/lite/core/mir/
type_precision_cast
_pass.h
浏览文件 @
1ae26706
文件已移动
paddle/fluid/lite/core/mir/type_target_
transform
_pass.cc
→
paddle/fluid/lite/core/mir/type_target_
cast
_pass.cc
浏览文件 @
1ae26706
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#include "paddle/fluid/lite/core/mir/type_target_
transform
_pass.h"
#include "paddle/fluid/lite/core/mir/type_target_
cast
_pass.h"
#include <list>
#include <list>
#include <memory>
#include <memory>
#include <string>
#include <string>
...
@@ -142,5 +142,5 @@ void TypeTargetTransformPass::SetValidPlaces(
...
@@ -142,5 +142,5 @@ void TypeTargetTransformPass::SetValidPlaces(
}
// namespace lite
}
// namespace lite
}
// namespace paddle
}
// namespace paddle
REGISTER_MIR_PASS
(
type_target_
transform
_pass
,
REGISTER_MIR_PASS
(
type_target_
cast
_pass
,
paddle
::
lite
::
mir
::
TypeTargetTransformPass
);
paddle
::
lite
::
mir
::
TypeTargetTransformPass
);
paddle/fluid/lite/core/mir/type_target_
transform
_pass.h
→
paddle/fluid/lite/core/mir/type_target_
cast
_pass.h
浏览文件 @
1ae26706
文件已移动
paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc
浏览文件 @
1ae26706
...
@@ -60,7 +60,7 @@ TEST(variable_place_inference_pass, test) {
...
@@ -60,7 +60,7 @@ TEST(variable_place_inference_pass, test) {
"argument_type_display_pass"
,
//
"argument_type_display_pass"
,
//
"variable_place_inference_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"argument_type_display_pass"
,
//
"type_target_
transform_pass"
,
//
"type_target_
cast_pass"
,
//
});
});
Place
prefered_place
{
Place
prefered_place
{
...
...
paddle/fluid/lite/core/optimizer.cc
浏览文件 @
1ae26706
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#include "paddle/fluid/lite/core/optimizer.h"
#include "paddle/fluid/lite/core/optimizer.h"
#include <fstream>
#include <fstream>
#include "paddle/fluid/lite/core/mir/static_kernel_pick_pass.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/mir/type_target_
cast
_pass.h"
#include "paddle/fluid/lite/model_parser/model_parser.h"
#include "paddle/fluid/lite/model_parser/model_parser.h"
#include "paddle/fluid/lite/utils/all.h"
#include "paddle/fluid/lite/utils/all.h"
...
...
paddle/fluid/lite/core/optimizer.h
浏览文件 @
1ae26706
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#include "paddle/fluid/lite/core/mir/pass_manager.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/ssa_graph.h"
#include "paddle/fluid/lite/core/mir/static_kernel_pick_pass.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/mir/type_target_
cast
_pass.h"
#include "paddle/fluid/lite/core/program.h"
#include "paddle/fluid/lite/core/program.h"
#include "paddle/fluid/lite/core/types.h"
#include "paddle/fluid/lite/core/types.h"
#include "paddle/fluid/lite/model_parser/model_parser.h"
#include "paddle/fluid/lite/model_parser/model_parser.h"
...
@@ -70,12 +70,12 @@ class Optimizer {
...
@@ -70,12 +70,12 @@ class Optimizer {
"static_kernel_pick_pass"
,
//
"static_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"argument_type_display_pass"
,
//
"type_target_
transform_pass"
,
//
"type_target_
cast_pass"
,
//
"variable_place_inference_pass"
,
//
"variable_place_inference_pass"
,
//
"argument_type_display_pass"
,
//
"argument_type_display_pass"
,
//
"io_copy_kernel_pick_pass"
,
//
"io_copy_kernel_pick_pass"
,
//
"variable_place_inference_pass"
,
//
"variable_place_inference_pass"
,
//
"
precision_cast_transform_pass"
,
//
"
type_precision_cast_pass"
,
//
"argument_type_display_pass"
,
//
"argument_type_display_pass"
,
//
"trans_weight_pass"
,
//
"trans_weight_pass"
,
//
"runtime_context_assign_pass"
,
//
"runtime_context_assign_pass"
,
//
...
@@ -109,7 +109,7 @@ class Optimizer {
...
@@ -109,7 +109,7 @@ class Optimizer {
void
InitTargetTypeTransformPass
()
{
void
InitTargetTypeTransformPass
()
{
auto
*
pass
=
auto
*
pass
=
mir
::
PassManager
::
Global
().
LookUp
<
mir
::
TypeTargetTransformPass
>
(
mir
::
PassManager
::
Global
().
LookUp
<
mir
::
TypeTargetTransformPass
>
(
"type_target_
transform
_pass"
);
"type_target_
cast
_pass"
);
CHECK
(
pass
);
CHECK
(
pass
);
CHECK
(
!
valid_places_
.
empty
());
CHECK
(
!
valid_places_
.
empty
());
LOG
(
INFO
)
<<
"valid_places.size "
<<
valid_places_
.
size
();
LOG
(
INFO
)
<<
"valid_places.size "
<<
valid_places_
.
size
();
...
...
paddle/fluid/lite/core/type_system.h
浏览文件 @
1ae26706
...
@@ -34,11 +34,12 @@ namespace lite {
...
@@ -34,11 +34,12 @@ namespace lite {
// Type is the definition of all the types that supported by the Variable that
// Type is the definition of all the types that supported by the Variable that
// represents as the input and output of an operator or kernel.
// represents as the input and output of an operator or kernel.
// The DNN system is simple, and the architecture can not process that many data
// The DNN system is simple, just a list of operators, and the architecture
// types as a compiler, or that will turn out to a chaos.
// can not process that many data types as a compiler, or that will turn out to
// a chaos.
//
//
// We should make sure that the supported data types be registered here, and
// We should make sure that the supported data types be registered here, and
// keep the
quantity
small and avoid using some special data types as op's
// keep the
set
small and avoid using some special data types as op's
// inputs or outputs, such as some runtime cache, those types can't be processed
// inputs or outputs, such as some runtime cache, those types can't be processed
// by the MIR.
// by the MIR.
//
//
...
@@ -51,7 +52,7 @@ namespace lite {
...
@@ -51,7 +52,7 @@ namespace lite {
// transforming operators, for example, a DataLayoutTransformOp can convert a
// transforming operators, for example, a DataLayoutTransformOp can convert a
// `TensorFp32NCHWTy` to a `TensorFp32NHWCTy`; a IoCopyOp can convert a
// `TensorFp32NCHWTy` to a `TensorFp32NHWCTy`; a IoCopyOp can convert a
// `TensorFp32NCHWTy(kHost)` to `TensorFp32NCHWTy(kCUDA)`. There are many other
// `TensorFp32NCHWTy(kHost)` to `TensorFp32NCHWTy(kCUDA)`. There are many other
// convertions between different Types, but there are some unsupport
t
ed type
// convertions between different Types, but there are some unsupported type
// convertions, for example, there is noway to convert a `UnsupportedTy` to a
// convertions, for example, there is noway to convert a `UnsupportedTy` to a
// `TensorAnyTy`.
// `TensorAnyTy`.
//
//
...
...
paddle/fluid/lite/core/types.h
浏览文件 @
1ae26706
...
@@ -36,10 +36,10 @@ class KernelPickFactor {
...
@@ -36,10 +36,10 @@ class KernelPickFactor {
};
};
// Has any factors considered.
// Has any factors considered.
bool
AnyFactorC
onsidered
()
const
{
return
data_
;
}
bool
any_factor_c
onsidered
()
const
{
return
data_
;
}
KernelPickFactor
&
ConsiderTarget
();
KernelPickFactor
&
ConsiderTarget
();
// P
er
fer a specific target, e.g. prefer CUDA kernels.
// P
re
fer a specific target, e.g. prefer CUDA kernels.
KernelPickFactor
&
ConsiderPrecision
();
KernelPickFactor
&
ConsiderPrecision
();
KernelPickFactor
&
ConsiderDataLayout
();
KernelPickFactor
&
ConsiderDataLayout
();
KernelPickFactor
&
ConsiderDevice
();
KernelPickFactor
&
ConsiderDevice
();
...
...
paddle/fluid/lite/tools/debug/model_debug_tool.cc
浏览文件 @
1ae26706
...
@@ -46,7 +46,7 @@ void Run(DebugConfig* conf) {
...
@@ -46,7 +46,7 @@ void Run(DebugConfig* conf) {
std
::
vector
<
std
::
string
>
passes
{{
std
::
vector
<
std
::
string
>
passes
{{
"static_kernel_pick_pass"
,
"variable_place_inference_pass"
,
"static_kernel_pick_pass"
,
"variable_place_inference_pass"
,
"type_target_
transform
_pass"
,
"variable_place_inference_pass"
,
"type_target_
cast
_pass"
,
"variable_place_inference_pass"
,
"io_copy_kernel_pick_pass"
,
"variable_place_inference_pass"
,
"io_copy_kernel_pick_pass"
,
"variable_place_inference_pass"
,
"runtime_context_assign_pass"
,
"runtime_context_assign_pass"
,
}};
}};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录