提交 b275e16a 编写于 作者: C Chunwei

Merge branch 'chunwei/code-clean' into 'incubate/lite'

some code clean

See merge request inference/paddlelite!94
......@@ -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);
......@@ -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
......
......@@ -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) {
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.
......
......@@ -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 <list>
#include <memory>
#include <string>
......@@ -162,5 +162,5 @@ void PrecisionCastPass::SetValidPlaces(const std::vector<Place>& valid_places) {
} // namespace lite
} // namespace paddle
REGISTER_MIR_PASS(precision_cast_transform_pass,
REGISTER_MIR_PASS(type_precision_cast_pass,
paddle::lite::mir::PrecisionCastPass);
......@@ -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 <list>
#include <memory>
#include <string>
......@@ -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);
......@@ -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{
......
......@@ -15,7 +15,7 @@
#include "paddle/fluid/lite/core/optimizer.h"
#include <fstream>
#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"
......
......@@ -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<mir::TypeTargetTransformPass>(
"type_target_transform_pass");
"type_target_cast_pass");
CHECK(pass);
CHECK(!valid_places_.empty());
LOG(INFO) << "valid_places.size " << valid_places_.size();
......
......@@ -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`.
//
......
......@@ -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();
......
......@@ -46,7 +46,7 @@ void Run(DebugConfig* conf) {
std::vector<std::string> 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",
}};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册