Skip to content

Commit 32da5e9

Browse files
authored
remove unused expected_kernel_cache_pass (#17486)
test=develop
1 parent 65dd7ec commit 32da5e9

9 files changed

+4
-92
lines changed

paddle/fluid/framework/details/build_strategy.cc

-6
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,6 @@ class ParallelExecutorPassBuilder : public ir::PassBuilder {
171171
AppendPass("runtime_context_cache_pass");
172172
}
173173

174-
if (strategy_.cache_expected_kernel_) {
175-
VLOG(10) << "Add expected_kernel_cache_pass";
176-
AppendPass("expected_kernel_cache_pass");
177-
}
178-
179174
AppendMultiDevPass(strategy_);
180175

181176
if (strategy_.fuse_all_reduce_ops_) {
@@ -371,7 +366,6 @@ USE_PASS(fuse_sgd_op_pass);
371366
USE_PASS(fuse_momentum_op_pass);
372367
USE_PASS(fuse_all_reduce_op_pass);
373368
USE_PASS(runtime_context_cache_pass);
374-
USE_PASS(expected_kernel_cache_pass);
375369
USE_PASS(record_skip_memory_opt_vars_pass);
376370
#ifdef PADDLE_WITH_MKLDNN
377371
USE_PASS(mkldnn_placement_pass);

paddle/fluid/framework/details/build_strategy.h

-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ struct BuildStrategy {
109109
bool remove_unnecessary_lock_{true};
110110

111111
bool cache_runtime_context_{false};
112-
bool cache_expected_kernel_{true};
113112
std::unordered_set<std::string> mkldnn_enabled_op_types_;
114113

115114
// NOTE:

paddle/fluid/framework/ir/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pass_library(transpose_flatten_concat_fuse_pass inference)
7272
pass_library(identity_scale_op_clean_pass base)
7373
pass_library(sync_batch_norm_pass base)
7474
pass_library(runtime_context_cache_pass base)
75-
pass_library(expected_kernel_cache_pass base)
7675
pass_library(quant_conv2d_dequant_fuse_pass inference)
7776
pass_library(fillconstant_elementwisemul_fuse inference)
7877
pass_library(shuffle_channel_detect_pass inference)

paddle/fluid/framework/ir/expected_kernel_cache_pass.cc

-37
This file was deleted.

paddle/fluid/framework/ir/expected_kernel_cache_pass.h

-31
This file was deleted.

paddle/fluid/framework/operator.h

-6
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ constexpr char kNewGradSuffix[] = "@NEWGRAD@";
7171
/// this Op's execution to save the elapsed time.
7272
constexpr char kEnableCacheRuntimeContext[] = "@ENABLE_CACHE_RUNTIME_CONTEXT@";
7373

74-
/// If an Op has attribtue kEnableCacheExpectedKernel, it means that in a same
75-
/// name scope and same place, since the expected kerenl of this Op does not
76-
/// change in the execution, it could be recorded only at the first iteration of
77-
/// this Op's execution to save the elapsed time.
78-
constexpr char kEnableCacheExpectedKernel[] = "@ENABLE_CACHE_EXPECTED_KERNEL@";
79-
8074
/// If an Op has this attribute, all its kernels should calculate output
8175
/// variable's shape in the corresponding Compute() function. And
8276
/// OperatorWithKernel::RunImpl() would skip call this Op's InferShape()

paddle/fluid/inference/api/analysis_config.cc

-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ void AnalysisConfig::Update() {
235235
pass_builder()->InsertPass(3, "tensorrt_subgraph_pass");
236236
}
237237
pass_builder()->DeletePass("runtime_context_cache_pass");
238-
pass_builder()->DeletePass("expected_kernel_cache_pass");
239238
}
240239

241240
if (use_mkldnn_) {

paddle/fluid/inference/api/paddle_pass_builder.cc

+3-5
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ GpuPassStrategy::GpuPassStrategy() : PassStrategy({}) {
9898
"conv_elementwise_add_fuse_pass", //
9999
#endif //
100100
"transpose_flatten_concat_fuse_pass",
101-
// following two passes should be located in the last, since they will
101+
// following pass should be located in the last, since it will
102102
// work on all fused ops.
103-
"expected_kernel_cache_pass", //
104103
"runtime_context_cache_pass"
105104
});
106105

@@ -134,9 +133,8 @@ CpuPassStrategy::CpuPassStrategy() : PassStrategy({}) {
134133
"conv_bn_fuse_pass", //
135134
"conv_eltwiseadd_bn_fuse_pass", //
136135
"is_test_pass", //
137-
// following two passes should be located in the last, since
138-
// they will work on all fused ops.
139-
"expected_kernel_cache_pass", //
136+
// following pass should be located in the last, since
137+
// it will work on all fused ops.
140138
"runtime_context_cache_pass"});
141139

142140
use_gpu_ = false;

paddle/fluid/pybind/pybind.cc

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License. */
1818
#include <mutex> // NOLINT // for call_once
1919
#include <string>
2020
#include <unordered_map>
21+
#include <unordered_set>
2122
#include <utility>
2223
#include <vector>
2324

@@ -1492,10 +1493,6 @@ All parameter, weight, gradient are variables in Paddle.
14921493
"cache_runtime_context",
14931494
[](const BuildStrategy &self) { return self.cache_runtime_context_; },
14941495
[](BuildStrategy &self, bool b) { self.cache_runtime_context_ = b; })
1495-
.def_property(
1496-
"cache_expected_kernel",
1497-
[](const BuildStrategy &self) { return self.cache_expected_kernel_; },
1498-
[](BuildStrategy &self, bool b) { self.cache_expected_kernel_ = b; })
14991496
.def_property(
15001497
"mkldnn_enabled_op_types",
15011498
[](const BuildStrategy &self) {

0 commit comments

Comments
 (0)