diff --git a/paddle/fluid/lite/api/paddle_use_passes.h b/paddle/fluid/lite/api/paddle_use_passes.h index cae0bdd19e175d0d8cd68a52701de9da47dace2b..b64f9638133bedb5129c0e8bbfe7f920437f9efa 100644 --- a/paddle/fluid/lite/api/paddle_use_passes.h +++ b/paddle/fluid/lite/api/paddle_use_passes.h @@ -18,7 +18,7 @@ USE_MIR_PASS(demo); USE_MIR_PASS(static_kernel_pick_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(io_copy_kernel_pick_pass); USE_MIR_PASS(argument_type_display_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_elementwise_add_activation_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); diff --git a/paddle/fluid/lite/core/mir/CMakeLists.txt b/paddle/fluid/lite/core/mir/CMakeLists.txt index 647336a4215ccc9e2ef1e38e17925870a28c39ef..92a31f45327c63b919e36d8557eeb1115697ec67 100644 --- a/paddle/fluid/lite/core/mir/CMakeLists.txt +++ b/paddle/fluid/lite/core/mir/CMakeLists.txt @@ -17,8 +17,8 @@ lite_cc_library(mir_passes elimination/identity_scale_eliminate_pass.cc static_kernel_pick_pass.cc variable_place_inference_pass.cc - type_target_transform_pass.cc - precision_cast_transform_pass.cc + type_target_cast_pass.cc + type_precision_cast_pass.cc io_copy_kernel_pick_pass.cc graph_visualize_pass.cc generate_program_pass.cc diff --git a/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc b/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc index 620aa48fdb536ae5efc84836a965eb31cf884fca..d703db1f3d037a918abe91066fcb5a4065c548dc 100644 --- a/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc +++ b/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc @@ -29,7 +29,7 @@ bool KernelScoreCmp(const std::pair>& a, } void StaticKernelPickPass::Apply(const std::unique_ptr& graph) { - CHECK(kernel_pick_factors_.AnyFactorConsidered()) + CHECK(kernel_pick_factors_.any_factor_considered()) << "kernel_pick_factors should be specified first"; CHECK(graph) << "graph not valid"; // sort kernels by the factors. diff --git a/paddle/fluid/lite/core/mir/precision_cast_transform_pass.cc b/paddle/fluid/lite/core/mir/type_precision_cast_pass.cc similarity index 98% rename from paddle/fluid/lite/core/mir/precision_cast_transform_pass.cc rename to paddle/fluid/lite/core/mir/type_precision_cast_pass.cc index e75fd1863d879556aaa0359a3f9475e299f7f65c..c424b2f23863f69cb02aecb620e7bc06de4200c4 100644 --- a/paddle/fluid/lite/core/mir/precision_cast_transform_pass.cc +++ b/paddle/fluid/lite/core/mir/type_precision_cast_pass.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // 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 #include #include @@ -162,5 +162,5 @@ void PrecisionCastPass::SetValidPlaces(const std::vector& valid_places) { } // namespace lite } // namespace paddle -REGISTER_MIR_PASS(precision_cast_transform_pass, +REGISTER_MIR_PASS(type_precision_cast_pass, paddle::lite::mir::PrecisionCastPass); diff --git a/paddle/fluid/lite/core/mir/precision_cast_transform_pass.h b/paddle/fluid/lite/core/mir/type_precision_cast_pass.h similarity index 100% rename from paddle/fluid/lite/core/mir/precision_cast_transform_pass.h rename to paddle/fluid/lite/core/mir/type_precision_cast_pass.h diff --git a/paddle/fluid/lite/core/mir/type_target_transform_pass.cc b/paddle/fluid/lite/core/mir/type_target_cast_pass.cc similarity index 97% rename from paddle/fluid/lite/core/mir/type_target_transform_pass.cc rename to paddle/fluid/lite/core/mir/type_target_cast_pass.cc index 93ac94b38917648c24afa0d3f40e3b93a442f7bc..1d8095cb63f7f24c261098a011566ccf40424f76 100644 --- a/paddle/fluid/lite/core/mir/type_target_transform_pass.cc +++ b/paddle/fluid/lite/core/mir/type_target_cast_pass.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // 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 #include #include @@ -142,5 +142,5 @@ void TypeTargetTransformPass::SetValidPlaces( } // namespace lite } // namespace paddle -REGISTER_MIR_PASS(type_target_transform_pass, +REGISTER_MIR_PASS(type_target_cast_pass, paddle::lite::mir::TypeTargetTransformPass); diff --git a/paddle/fluid/lite/core/mir/type_target_transform_pass.h b/paddle/fluid/lite/core/mir/type_target_cast_pass.h similarity index 100% rename from paddle/fluid/lite/core/mir/type_target_transform_pass.h rename to paddle/fluid/lite/core/mir/type_target_cast_pass.h diff --git a/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc b/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc index 808835a6f6e530845e61701e383f9fb3b65defb2..aeffdd2eec42be85e33104530e1df5bccab36f11 100644 --- a/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc +++ b/paddle/fluid/lite/core/mir/variable_place_inference_pass_test.cc @@ -60,7 +60,7 @@ TEST(variable_place_inference_pass, test) { "argument_type_display_pass", // "variable_place_inference_pass", // "argument_type_display_pass", // - "type_target_transform_pass", // + "type_target_cast_pass", // }); Place prefered_place{ diff --git a/paddle/fluid/lite/core/optimizer.cc b/paddle/fluid/lite/core/optimizer.cc index 1502d15e2bfa70b94a87686c72108e26175730b0..0c08688aa7db7d013090fbeb821b77e527fc58c3 100644 --- a/paddle/fluid/lite/core/optimizer.cc +++ b/paddle/fluid/lite/core/optimizer.cc @@ -15,7 +15,7 @@ #include "paddle/fluid/lite/core/optimizer.h" #include #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/utils/all.h" diff --git a/paddle/fluid/lite/core/optimizer.h b/paddle/fluid/lite/core/optimizer.h index 437eec50dc52db994da0493b3fe87d7927a77be3..7c6e4a2dff1ae54b182f88428558d9bffa55da98 100644 --- a/paddle/fluid/lite/core/optimizer.h +++ b/paddle/fluid/lite/core/optimizer.h @@ -20,7 +20,7 @@ #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/mir/type_target_cast_pass.h" #include "paddle/fluid/lite/core/program.h" #include "paddle/fluid/lite/core/types.h" #include "paddle/fluid/lite/model_parser/model_parser.h" @@ -70,12 +70,12 @@ class Optimizer { "static_kernel_pick_pass", // "variable_place_inference_pass", // "argument_type_display_pass", // - "type_target_transform_pass", // + "type_target_cast_pass", // "variable_place_inference_pass", // "argument_type_display_pass", // "io_copy_kernel_pick_pass", // "variable_place_inference_pass", // - "precision_cast_transform_pass", // + "type_precision_cast_pass", // "argument_type_display_pass", // "trans_weight_pass", // "runtime_context_assign_pass", // @@ -109,7 +109,7 @@ class Optimizer { void InitTargetTypeTransformPass() { auto* pass = mir::PassManager::Global().LookUp( - "type_target_transform_pass"); + "type_target_cast_pass"); CHECK(pass); CHECK(!valid_places_.empty()); LOG(INFO) << "valid_places.size " << valid_places_.size(); diff --git a/paddle/fluid/lite/core/type_system.h b/paddle/fluid/lite/core/type_system.h index 8bd1f3739498367fd47dfcceceee7b345c9499b8..d8b88f8e2611a0b4f4674e933d4af0cdca047a2d 100644 --- a/paddle/fluid/lite/core/type_system.h +++ b/paddle/fluid/lite/core/type_system.h @@ -34,11 +34,12 @@ namespace lite { // 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. -// The DNN system is simple, and the architecture can not process that many data -// types as a compiler, or that will turn out to a chaos. +// The DNN system is simple, just a list of operators, and the architecture +// 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 -// 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 // by the MIR. // @@ -51,7 +52,7 @@ namespace lite { // transforming operators, for example, a DataLayoutTransformOp can convert a // `TensorFp32NCHWTy` to a `TensorFp32NHWCTy`; a IoCopyOp can convert a // `TensorFp32NCHWTy(kHost)` to `TensorFp32NCHWTy(kCUDA)`. There are many other -// convertions between different Types, but there are some unsupportted type +// convertions between different Types, but there are some unsupported type // convertions, for example, there is noway to convert a `UnsupportedTy` to a // `TensorAnyTy`. // diff --git a/paddle/fluid/lite/core/types.h b/paddle/fluid/lite/core/types.h index 810901d15baf0fdb92b913e57dae99a7aa740461..50c3d69d8542e5cf0d9e1ee36ca256193213c399 100644 --- a/paddle/fluid/lite/core/types.h +++ b/paddle/fluid/lite/core/types.h @@ -36,10 +36,10 @@ class KernelPickFactor { }; // Has any factors considered. - bool AnyFactorConsidered() const { return data_; } + bool any_factor_considered() const { return data_; } KernelPickFactor& ConsiderTarget(); - // Perfer a specific target, e.g. prefer CUDA kernels. + // Prefer a specific target, e.g. prefer CUDA kernels. KernelPickFactor& ConsiderPrecision(); KernelPickFactor& ConsiderDataLayout(); KernelPickFactor& ConsiderDevice(); diff --git a/paddle/fluid/lite/tools/debug/model_debug_tool.cc b/paddle/fluid/lite/tools/debug/model_debug_tool.cc index 00552f18fd3887d93582c8af8aa562794898607e..7e8556a1579e09193c3c2abb1f6ea7909e8ccb69 100644 --- a/paddle/fluid/lite/tools/debug/model_debug_tool.cc +++ b/paddle/fluid/lite/tools/debug/model_debug_tool.cc @@ -46,7 +46,7 @@ void Run(DebugConfig* conf) { std::vector passes{{ "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", "runtime_context_assign_pass", }};