Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
46677fb0
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
46677fb0
编写于
3月 25, 2019
作者:
W
Wojciech Uss
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move cpu_quantize_* passes into mkldnn subfolder
test=develop
上级
de3b70a1
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
19 addition
and
12 deletion
+19
-12
paddle/fluid/framework/ir/CMakeLists.txt
paddle/fluid/framework/ir/CMakeLists.txt
+6
-6
paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.cc
paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.cc
+1
-1
paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h
paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass.h
+0
-0
paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass_tester.cc
paddle/fluid/framework/ir/mkldnn/cpu_quantize_pass_tester.cc
+1
-1
paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.cc
.../fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.cc
+1
-1
paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h
...e/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass.h
+0
-0
paddle/fluid/framework/ir/mkldnn/cpu_quantize_placement_pass_tester.cc
...framework/ir/mkldnn/cpu_quantize_placement_pass_tester.cc
+1
-1
paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc
paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc
+1
-1
paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h
paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.h
+0
-0
paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass_tester.cc
...id/framework/ir/mkldnn/cpu_quantize_squash_pass_tester.cc
+1
-1
paddle/fluid/inference/analysis/argument.h
paddle/fluid/inference/analysis/argument.h
+5
-0
paddle/fluid/inference/analysis/ir_pass_manager.cc
paddle/fluid/inference/analysis/ir_pass_manager.cc
+2
-0
未找到文件。
paddle/fluid/framework/ir/CMakeLists.txt
浏览文件 @
46677fb0
...
@@ -46,9 +46,6 @@ cc_library(fuse_pass_base SRCS fuse_pass_base.cc DEPS pass)
...
@@ -46,9 +46,6 @@ cc_library(fuse_pass_base SRCS fuse_pass_base.cc DEPS pass)
pass_library
(
graph_to_program_pass base
)
pass_library
(
graph_to_program_pass base
)
pass_library
(
graph_viz_pass base
)
pass_library
(
graph_viz_pass base
)
pass_library
(
lock_free_optimize_pass base
)
pass_library
(
lock_free_optimize_pass base
)
pass_library
(
cpu_quantize_placement_pass base
)
pass_library
(
cpu_quantize_pass inference
)
pass_library
(
cpu_quantize_squash_pass inference
)
pass_library
(
fc_fuse_pass inference
)
pass_library
(
fc_fuse_pass inference
)
pass_library
(
attention_lstm_fuse_pass inference
)
pass_library
(
attention_lstm_fuse_pass inference
)
pass_library
(
infer_clean_graph_pass inference
)
pass_library
(
infer_clean_graph_pass inference
)
...
@@ -87,6 +84,9 @@ if(WITH_MKLDNN)
...
@@ -87,6 +84,9 @@ if(WITH_MKLDNN)
pass_library
(
conv_bias_mkldnn_fuse_pass inference mkldnn
)
pass_library
(
conv_bias_mkldnn_fuse_pass inference mkldnn
)
pass_library
(
conv_relu_mkldnn_fuse_pass inference mkldnn
)
pass_library
(
conv_relu_mkldnn_fuse_pass inference mkldnn
)
pass_library
(
conv_elementwise_add_mkldnn_fuse_pass inference mkldnn
)
pass_library
(
conv_elementwise_add_mkldnn_fuse_pass inference mkldnn
)
pass_library
(
cpu_quantize_placement_pass base mkldnn
)
pass_library
(
cpu_quantize_pass inference mkldnn
)
pass_library
(
cpu_quantize_squash_pass inference mkldnn
)
endif
()
endif
()
cc_library
(
fuse_elewise_add_act_pass SRCS fuse_elewise_add_act_pass.cc DEPS pass graph_pattern_detector
)
cc_library
(
fuse_elewise_add_act_pass SRCS fuse_elewise_add_act_pass.cc DEPS pass graph_pattern_detector
)
...
@@ -105,9 +105,6 @@ cc_test(test_graph_pattern_detector SRCS graph_pattern_detector_tester.cc DEPS g
...
@@ -105,9 +105,6 @@ cc_test(test_graph_pattern_detector SRCS graph_pattern_detector_tester.cc DEPS g
cc_test
(
test_fc_fuse_pass SRCS fc_fuse_pass_tester.cc DEPS fc_fuse_pass framework_proto
)
cc_test
(
test_fc_fuse_pass SRCS fc_fuse_pass_tester.cc DEPS fc_fuse_pass framework_proto
)
cc_test
(
test_seqpool_concat_fuse_pass SRCS seqpool_concat_fuse_pass_tester.cc DEPS seqpool_concat_fuse_pass framework_proto
)
cc_test
(
test_seqpool_concat_fuse_pass SRCS seqpool_concat_fuse_pass_tester.cc DEPS seqpool_concat_fuse_pass framework_proto
)
cc_test
(
test_is_test_pass SRCS is_test_pass_tester.cc DEPS is_test_pass
)
cc_test
(
test_is_test_pass SRCS is_test_pass_tester.cc DEPS is_test_pass
)
cc_test
(
test_cpu_quantize_placement_pass SRCS cpu_quantize_placement_pass_tester.cc DEPS cpu_quantize_placement_pass
)
cc_test
(
test_cpu_quantize_pass SRCS cpu_quantize_pass_tester.cc DEPS cpu_quantize_pass naive_executor
)
cc_test
(
test_cpu_quantize_squash_pass SRCS cpu_quantize_squash_pass_tester.cc DEPS cpu_quantize_squash_pass naive_executor
)
if
(
NOT WIN32
)
if
(
NOT WIN32
)
cc_test
(
test_sync_batch_norm_pass SRCS sync_batch_norm_pass_tester.cc DEPS sync_batch_norm_pass
)
cc_test
(
test_sync_batch_norm_pass SRCS sync_batch_norm_pass_tester.cc DEPS sync_batch_norm_pass
)
endif
()
endif
()
...
@@ -117,4 +114,7 @@ if (WITH_MKLDNN)
...
@@ -117,4 +114,7 @@ if (WITH_MKLDNN)
cc_test
(
test_conv_relu_mkldnn_fuse_pass SRCS mkldnn/conv_relu_mkldnn_fuse_pass_tester.cc DEPS conv_relu_mkldnn_fuse_pass
)
cc_test
(
test_conv_relu_mkldnn_fuse_pass SRCS mkldnn/conv_relu_mkldnn_fuse_pass_tester.cc DEPS conv_relu_mkldnn_fuse_pass
)
cc_test
(
test_conv_elementwise_add_mkldnn_fuse_pass SRCS mkldnn/conv_elementwise_add_mkldnn_fuse_pass_tester.cc DEPS conv_elementwise_add_mkldnn_fuse_pass
)
cc_test
(
test_conv_elementwise_add_mkldnn_fuse_pass SRCS mkldnn/conv_elementwise_add_mkldnn_fuse_pass_tester.cc DEPS conv_elementwise_add_mkldnn_fuse_pass
)
cc_test
(
test_mkldnn_placement_pass SRCS mkldnn/mkldnn_placement_pass_tester.cc DEPS mkldnn_placement_pass
)
cc_test
(
test_mkldnn_placement_pass SRCS mkldnn/mkldnn_placement_pass_tester.cc DEPS mkldnn_placement_pass
)
cc_test
(
test_cpu_quantize_placement_pass SRCS mkldnn/cpu_quantize_placement_pass_tester.cc DEPS cpu_quantize_placement_pass
)
cc_test
(
test_cpu_quantize_pass SRCS mkldnn/cpu_quantize_pass_tester.cc DEPS cpu_quantize_pass naive_executor
)
cc_test
(
test_cpu_quantize_squash_pass SRCS mkldnn/cpu_quantize_squash_pass_tester.cc DEPS cpu_quantize_squash_pass naive_executor
)
endif
()
endif
()
paddle/fluid/framework/ir/cpu_quantize_pass.cc
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_pass.cc
浏览文件 @
46677fb0
...
@@ -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/framework/ir/cpu_quantize_pass.h"
#include "paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_pass.h"
#include <utility>
#include <utility>
#include <vector>
#include <vector>
#include "paddle/fluid/framework/eigen.h"
#include "paddle/fluid/framework/eigen.h"
...
...
paddle/fluid/framework/ir/cpu_quantize_pass.h
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_pass.h
浏览文件 @
46677fb0
文件已移动
paddle/fluid/framework/ir/cpu_quantize_pass_tester.cc
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_pass_tester.cc
浏览文件 @
46677fb0
...
@@ -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/framework/ir/cpu_quantize_pass.h"
#include "paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_pass.h"
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "paddle/fluid/framework/naive_executor.h"
#include "paddle/fluid/framework/naive_executor.h"
#include "paddle/fluid/platform/place.h"
#include "paddle/fluid/platform/place.h"
...
...
paddle/fluid/framework/ir/cpu_quantize_placement_pass.cc
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_placement_pass.cc
浏览文件 @
46677fb0
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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/framework/ir/cpu_quantize_placement_pass.h"
#include "paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_placement_pass.h"
#include <string>
#include <string>
#include <unordered_set>
#include <unordered_set>
...
...
paddle/fluid/framework/ir/cpu_quantize_placement_pass.h
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_placement_pass.h
浏览文件 @
46677fb0
文件已移动
paddle/fluid/framework/ir/cpu_quantize_placement_pass_tester.cc
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_placement_pass_tester.cc
浏览文件 @
46677fb0
...
@@ -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/framework/ir/cpu_quantize_placement_pass.h"
#include "paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_placement_pass.h"
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <boost/logic/tribool.hpp>
#include <boost/logic/tribool.hpp>
...
...
paddle/fluid/framework/ir/cpu_quantize_squash_pass.cc
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_squash_pass.cc
浏览文件 @
46677fb0
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,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/framework/ir/cpu_quantize_squash_pass.h"
#include "paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_squash_pass.h"
#include <string>
#include <string>
#include <vector>
#include <vector>
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/platform/enforce.h"
...
...
paddle/fluid/framework/ir/cpu_quantize_squash_pass.h
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_squash_pass.h
浏览文件 @
46677fb0
文件已移动
paddle/fluid/framework/ir/cpu_quantize_squash_pass_tester.cc
→
paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_squash_pass_tester.cc
浏览文件 @
46677fb0
...
@@ -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/framework/ir/cpu_quantize_squash_pass.h"
#include "paddle/fluid/framework/ir/
mkldnn/
cpu_quantize_squash_pass.h"
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include "paddle/fluid/framework/naive_executor.h"
#include "paddle/fluid/framework/naive_executor.h"
#include "paddle/fluid/platform/place.h"
#include "paddle/fluid/platform/place.h"
...
...
paddle/fluid/inference/analysis/argument.h
浏览文件 @
46677fb0
...
@@ -41,8 +41,11 @@ namespace inference {
...
@@ -41,8 +41,11 @@ namespace inference {
namespace
analysis
{
namespace
analysis
{
using
framework
::
ir
::
Graph
;
using
framework
::
ir
::
Graph
;
#ifdef PADDLE_WITH_MKLDNN
using
VarQuantScale
=
using
VarQuantScale
=
std
::
unordered_map
<
std
::
string
,
std
::
pair
<
bool
,
framework
::
LoDTensor
>>
;
std
::
unordered_map
<
std
::
string
,
std
::
pair
<
bool
,
framework
::
LoDTensor
>>
;
#endif
/*
/*
* The argument definition of both Pass and PassManagers.
* The argument definition of both Pass and PassManagers.
...
@@ -132,6 +135,7 @@ struct Argument {
...
@@ -132,6 +135,7 @@ struct Argument {
DECL_ARGUMENT_FIELD
(
mkldnn_enabled_op_types
,
MKLDNNEnabledOpTypes
,
DECL_ARGUMENT_FIELD
(
mkldnn_enabled_op_types
,
MKLDNNEnabledOpTypes
,
std
::
unordered_set
<
std
::
string
>
);
std
::
unordered_set
<
std
::
string
>
);
#ifdef PADDLE_WITH_MKLDNN
// A set of op types to enable their quantized kernels
// A set of op types to enable their quantized kernels
DECL_ARGUMENT_FIELD
(
quantize_enabled_op_types
,
QuantizeEnabledOpTypes
,
DECL_ARGUMENT_FIELD
(
quantize_enabled_op_types
,
QuantizeEnabledOpTypes
,
std
::
unordered_set
<
std
::
string
>
);
std
::
unordered_set
<
std
::
string
>
);
...
@@ -142,6 +146,7 @@ struct Argument {
...
@@ -142,6 +146,7 @@ struct Argument {
// Scales for variables to be quantized
// Scales for variables to be quantized
DECL_ARGUMENT_FIELD
(
quant_var_scales
,
QuantVarScales
,
VarQuantScale
);
DECL_ARGUMENT_FIELD
(
quant_var_scales
,
QuantVarScales
,
VarQuantScale
);
#endif
// Passed from config.
// Passed from config.
DECL_ARGUMENT_FIELD
(
use_gpu
,
UseGPU
,
bool
);
DECL_ARGUMENT_FIELD
(
use_gpu
,
UseGPU
,
bool
);
...
...
paddle/fluid/inference/analysis/ir_pass_manager.cc
浏览文件 @
46677fb0
...
@@ -61,6 +61,7 @@ void IRPassManager::CreatePasses(Argument *argument,
...
@@ -61,6 +61,7 @@ void IRPassManager::CreatePasses(Argument *argument,
pass
->
Set
(
"mkldnn_enabled_op_types"
,
pass
->
Set
(
"mkldnn_enabled_op_types"
,
new
std
::
unordered_set
<
std
::
string
>
(
new
std
::
unordered_set
<
std
::
string
>
(
argument
->
mkldnn_enabled_op_types
()));
argument
->
mkldnn_enabled_op_types
()));
#ifdef PADDLE_WITH_MKLDNN
}
else
if
(
pass_name
==
"cpu_quantize_placement_pass"
)
{
}
else
if
(
pass_name
==
"cpu_quantize_placement_pass"
)
{
pass
->
Set
(
"quantize_enabled_op_types"
,
pass
->
Set
(
"quantize_enabled_op_types"
,
new
std
::
unordered_set
<
std
::
string
>
(
new
std
::
unordered_set
<
std
::
string
>
(
...
@@ -71,6 +72,7 @@ void IRPassManager::CreatePasses(Argument *argument,
...
@@ -71,6 +72,7 @@ void IRPassManager::CreatePasses(Argument *argument,
}
else
if
(
pass_name
==
"cpu_quantize_pass"
)
{
}
else
if
(
pass_name
==
"cpu_quantize_pass"
)
{
pass
->
Set
(
"quant_var_scales"
,
pass
->
Set
(
"quant_var_scales"
,
new
VarQuantScale
(
argument
->
quant_var_scales
()));
new
VarQuantScale
(
argument
->
quant_var_scales
()));
#endif
}
else
if
(
pass_name
==
"tensorrt_subgraph_pass"
)
{
}
else
if
(
pass_name
==
"tensorrt_subgraph_pass"
)
{
pass
->
Set
(
"workspace_size"
,
new
int
(
argument
->
tensorrt_workspace_size
()));
pass
->
Set
(
"workspace_size"
,
new
int
(
argument
->
tensorrt_workspace_size
()));
pass
->
Set
(
"max_batch_size"
,
new
int
(
argument
->
tensorrt_max_batch_size
()));
pass
->
Set
(
"max_batch_size"
,
new
int
(
argument
->
tensorrt_max_batch_size
()));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录