From cdb12e59805f7bcb7b7aa51a1c4a0af2fe134b4d Mon Sep 17 00:00:00 2001 From: superjomn Date: Tue, 16 Apr 2019 17:03:26 +0800 Subject: [PATCH] add ssa_graph test --- paddle/fluid/lite/core/CMakeLists.txt | 2 +- paddle/fluid/lite/core/mir/CMakeLists.txt | 16 ++- paddle/fluid/lite/core/mir/demo_pass.cc | 6 +- .../lite/core/mir/generate_program_pass.cc | 13 +++ .../lite/core/mir/generate_program_pass.h | 33 ++++++ .../lite/core/mir/graph_visualize_pass.cc | 71 ++++++++++++ .../lite/core/mir/graph_visualize_pass.h | 37 +++++++ .../fluid/lite/core/mir/io_complement_pass.cc | 13 +++ .../fluid/lite/core/mir/io_complement_pass.h | 33 ++++++ paddle/fluid/lite/core/mir/node.h | 12 +++ paddle/fluid/lite/core/mir/pass.h | 39 +++++++ paddle/fluid/lite/core/mir/pass_manager.cc | 6 +- .../fluid/lite/core/mir/pass_manager_test.cc | 3 + paddle/fluid/lite/core/mir/pass_registry.h | 12 +++ paddle/fluid/lite/core/mir/ssa_graph.h | 25 ++++- paddle/fluid/lite/core/mir/ssa_graph_test.cc | 102 ++++++++++++++++++ .../lite/core/mir/static_kernel_pick_pass.cc | 13 +++ .../lite/core/mir/static_kernel_pick_pass.h | 27 +++++ paddle/fluid/lite/core/type_system.cc | 2 +- paddle/fluid/lite/kernels/host/CMakeLists.txt | 1 + 20 files changed, 455 insertions(+), 11 deletions(-) create mode 100644 paddle/fluid/lite/core/mir/generate_program_pass.cc create mode 100644 paddle/fluid/lite/core/mir/generate_program_pass.h create mode 100644 paddle/fluid/lite/core/mir/graph_visualize_pass.cc create mode 100644 paddle/fluid/lite/core/mir/graph_visualize_pass.h create mode 100644 paddle/fluid/lite/core/mir/io_complement_pass.cc create mode 100644 paddle/fluid/lite/core/mir/io_complement_pass.h create mode 100644 paddle/fluid/lite/core/mir/ssa_graph_test.cc create mode 100644 paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc create mode 100644 paddle/fluid/lite/core/mir/static_kernel_pick_pass.h diff --git a/paddle/fluid/lite/core/CMakeLists.txt b/paddle/fluid/lite/core/CMakeLists.txt index b915b6f3e..08ba80410 100644 --- a/paddle/fluid/lite/core/CMakeLists.txt +++ b/paddle/fluid/lite/core/CMakeLists.txt @@ -1,6 +1,6 @@ cc_library(memory_lite SRCS memory.cc) cc_library(tensor_lite SRCS tensor.cc DEPS memory_lite) -cc_library(kernel_lite SRCS kernel.cc) +cc_library(kernel_lite SRCS kernel.cc DEPS type_system) cc_library(variable_lite SRCS variable.cc) cc_library(op_registry_lite SRCS op_registry.cc) cc_library(scope_lite SRCS scope.cc) diff --git a/paddle/fluid/lite/core/mir/CMakeLists.txt b/paddle/fluid/lite/core/mir/CMakeLists.txt index 8573a239b..6bdf8cb2f 100644 --- a/paddle/fluid/lite/core/mir/CMakeLists.txt +++ b/paddle/fluid/lite/core/mir/CMakeLists.txt @@ -3,6 +3,18 @@ cc_library(mir_ssa_graph SRCS ssa_graph.cc DEPS mir_node) cc_library(mir_pass SRCS pass.cc DEPS mir_ssa_graph) cc_library(mir_pass_manager SRCS pass_manager.cc DEPS mir_pass mir_ssa_graph) cc_library(mir_pass_registry SRCS pass_registry.cc DEPS mir_pass_manager) -cc_library(mir_demo_pass SRCS demo_pass.cc DEPS mir_pass) +cc_library(mir_passes + SRCS static_kernel_pick_pass.cc + io_complement_pass.cc + graph_visualize_pass.cc + generate_program_pass.cc + demo_pass.cc + DEPS mir_pass) -cc_test(test_mir_pass_manager SRCS pass_manager_test.cc DEPS mir_pass_manager mir_demo_pass) +cc_test(test_mir_pass_manager SRCS pass_manager_test.cc DEPS mir_pass_manager mir_passes) +cc_test(test_ssa_graph SRCS ssa_graph_test.cc DEPS + mir_ssa_graph scope_lite op_lite + proto_desc ops_lite + host_kernels + mir_passes + ) diff --git a/paddle/fluid/lite/core/mir/demo_pass.cc b/paddle/fluid/lite/core/mir/demo_pass.cc index 63dd44af9..36542dcaf 100644 --- a/paddle/fluid/lite/core/mir/demo_pass.cc +++ b/paddle/fluid/lite/core/mir/demo_pass.cc @@ -19,15 +19,19 @@ namespace paddle { namespace lite { namespace mir { -class DemoPass : public mir::Pass { +class DemoPass : public mir::DebugPass { public: void Apply(std::unique_ptr& graph) override {} }; +/* bool RegisterDemoPass() { return PassManager::Global().AddNewPass("demo", new DemoPass); } + */ } // namespace mir } // namespace lite } // namespace paddle + +REGISTER_MIR_PASS(demo, paddle::lite::mir::DemoPass); diff --git a/paddle/fluid/lite/core/mir/generate_program_pass.cc b/paddle/fluid/lite/core/mir/generate_program_pass.cc new file mode 100644 index 000000000..ce71e4de2 --- /dev/null +++ b/paddle/fluid/lite/core/mir/generate_program_pass.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/paddle/fluid/lite/core/mir/generate_program_pass.h b/paddle/fluid/lite/core/mir/generate_program_pass.h new file mode 100644 index 000000000..bee6a3c8f --- /dev/null +++ b/paddle/fluid/lite/core/mir/generate_program_pass.h @@ -0,0 +1,33 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "paddle/fluid/lite/core/mir/pass.h" + +namespace paddle { +namespace lite { +namespace mir { + +/* + * GenerateProgramPass will build the execution program for executor from a mir + * graph. + */ +class GenerateProgramPass : public Pass { + public: +}; + +} // namespace mir +} // namespace lite +} // namespace paddle diff --git a/paddle/fluid/lite/core/mir/graph_visualize_pass.cc b/paddle/fluid/lite/core/mir/graph_visualize_pass.cc new file mode 100644 index 000000000..675ef29fe --- /dev/null +++ b/paddle/fluid/lite/core/mir/graph_visualize_pass.cc @@ -0,0 +1,71 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "paddle/fluid/lite/core/mir/graph_visualize_pass.h" +#include +#include "paddle/fluid/lite/core/mir/pass_registry.h" + +namespace paddle { +namespace lite { +namespace mir { + +void GraphVisualizePass::Apply(std::unique_ptr& graph) { + Visualize(graph.get()); +} + +std::string Visualize(mir::SSAGraph* graph) { + inference::analysis::Dot dot; + + int id = 0; + std::set exists_args; + + for (auto& node : graph->mutable_nodes()) { + std::string key; + if (node.IsArgument()) { + key = node.AsArgument().name; + } else { + key = node.AsInstruct().op_type + std::to_string(id++); + } + + if (node.IsInstruct()) { + dot.AddNode(key, {}); + for (auto& x : node.inlinks) { + auto name = x->AsArgument().name; + if (!exists_args.count(name)) { + dot.AddNode(name, {}); + } + dot.AddEdge(name, key, {}); + exists_args.insert(name); + } + for (auto& x : node.outlinks) { + auto name = x->AsArgument().name; + if (!exists_args.count(name)) { + dot.AddNode(name, {}); + } + dot.AddEdge(key, name, {}); + exists_args.insert(name); + } + } + } + + auto res = dot.Build(); + LOG(INFO) << "dot:\n" << res; + return res; +} + +} // namespace mir +} // namespace lite +} // namespace paddle + +REGISTER_MIR_PASS(graph_visualze, paddle::lite::mir::GraphVisualizePass); diff --git a/paddle/fluid/lite/core/mir/graph_visualize_pass.h b/paddle/fluid/lite/core/mir/graph_visualize_pass.h new file mode 100644 index 000000000..79dbd4080 --- /dev/null +++ b/paddle/fluid/lite/core/mir/graph_visualize_pass.h @@ -0,0 +1,37 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "paddle/fluid/inference/analysis/dot.h" +#include "paddle/fluid/lite/core/mir/pass.h" + +namespace paddle { +namespace lite { +namespace mir { + +/* + * GraphVisualizePass helps to visualize an mir graph by exporting a DOT + * language file. + */ +class GraphVisualizePass : public DebugPass { + public: + void Apply(std::unique_ptr& graph) override; +}; + +std::string Visualize(mir::SSAGraph* graph); + +} // namespace mir +} // namespace lite +} // namespace paddle diff --git a/paddle/fluid/lite/core/mir/io_complement_pass.cc b/paddle/fluid/lite/core/mir/io_complement_pass.cc new file mode 100644 index 000000000..ce71e4de2 --- /dev/null +++ b/paddle/fluid/lite/core/mir/io_complement_pass.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/paddle/fluid/lite/core/mir/io_complement_pass.h b/paddle/fluid/lite/core/mir/io_complement_pass.h new file mode 100644 index 000000000..ff071ce03 --- /dev/null +++ b/paddle/fluid/lite/core/mir/io_complement_pass.h @@ -0,0 +1,33 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "paddle/fluid/lite/core/mir/pass.h" + +namespace paddle { +namespace lite { +namespace mir { + +/* + * IoComplementPass complement the necessary instruction to make data + * transferring or transformation between different places. + */ +class IoComplementPass : public Pass { + public: +}; + +} // namespace mir +} // namespace lite +} // namespace paddle diff --git a/paddle/fluid/lite/core/mir/node.h b/paddle/fluid/lite/core/mir/node.h index c1c24bce2..15b18b5e8 100644 --- a/paddle/fluid/lite/core/mir/node.h +++ b/paddle/fluid/lite/core/mir/node.h @@ -51,6 +51,18 @@ class Node { Place place; }; + Argument& AsArgument(const std::string& name) { + auto& x = AsArgument(); + x.name = name; + return x; + } + + Instruct& AsInstruct(const std::string& op_type) { + auto& x = AsInstruct(); + x.op_type = op_type; + return x; + } + // Set roles. Argument& AsArgument() { if (role_ != Role::kUnk) { diff --git a/paddle/fluid/lite/core/mir/pass.h b/paddle/fluid/lite/core/mir/pass.h index 4264f8937..36c70e243 100644 --- a/paddle/fluid/lite/core/mir/pass.h +++ b/paddle/fluid/lite/core/mir/pass.h @@ -22,14 +22,53 @@ namespace mir { class Pass { public: + // Some appoint here, one pass should be only one of the following kinds. + enum class Kind { + // Will modify the program/graph topology. + kProgramWise = 0, + // Will modify the instruction, with the graph topology fixed. + kInstructionWise, + // Will not modify the IR, just collect information or visualization. + kDebug, + }; + + Pass(Kind kind) : kind_(kind) {} + virtual void Apply(std::unique_ptr& graph) = 0; + void set_name(const std::string& name) { name_ = name; } const std::string& name() const { return name_; } + void set_doc(const std::string& doc) { doc_ = doc; } + const std::string& doc() const { return doc_; } + + Kind kind() const { return kind_; } + bool is_debug_pass() const { return kind_ == Kind::kDebug; } + bool is_program_pass() const { return kind_ == Kind::kProgramWise; } + bool is_instruction_pass() const { return kind_ == Kind::kInstructionWise; } + virtual ~Pass() = default; private: + const Kind kind_; std::string name_; + std::string doc_; +}; + +// Different kinds. +class ProgramPass : public Pass { + public: + ProgramPass() : Pass(Kind::kProgramWise) {} +}; + +class InstructionPass : public Pass { + public: + InstructionPass() : Pass(Kind::kInstructionWise) {} +}; + +class DebugPass : public Pass { + public: + DebugPass() : Pass(Kind::kDebug) {} }; } // namespace mir diff --git a/paddle/fluid/lite/core/mir/pass_manager.cc b/paddle/fluid/lite/core/mir/pass_manager.cc index 7d4bb685a..2767218f4 100644 --- a/paddle/fluid/lite/core/mir/pass_manager.cc +++ b/paddle/fluid/lite/core/mir/pass_manager.cc @@ -21,10 +21,8 @@ namespace mir { PassManager::PassManager() {} -// Manually register here. -extern bool RegisterDemoPass(); -static bool xx __attribute__((unused)) = RegisterDemoPass(); - } // namespace mir } // namespace lite } // namespace paddle + +USE_MIR_PASS(demo); diff --git a/paddle/fluid/lite/core/mir/pass_manager_test.cc b/paddle/fluid/lite/core/mir/pass_manager_test.cc index 74cf90a49..a83ecf7dc 100644 --- a/paddle/fluid/lite/core/mir/pass_manager_test.cc +++ b/paddle/fluid/lite/core/mir/pass_manager_test.cc @@ -14,6 +14,7 @@ #include "paddle/fluid/lite/core/mir/pass_manager.h" #include +#include "paddle/fluid/lite/core/mir/pass_registry.h" namespace paddle { namespace lite { @@ -28,3 +29,5 @@ TEST(PassManager, test) { } // namespace mir } // namespace lite } // namespace paddle + +USE_MIR_PASS(demo); diff --git a/paddle/fluid/lite/core/mir/pass_registry.h b/paddle/fluid/lite/core/mir/pass_registry.h index fc743740a..4190f96c0 100644 --- a/paddle/fluid/lite/core/mir/pass_registry.h +++ b/paddle/fluid/lite/core/mir/pass_registry.h @@ -32,6 +32,18 @@ class PassRegistry { bool Touch() const { return true; } }; +#define REGISTER_MIR_PASS(name__, class__) \ + paddle::lite::mir::PassRegistry mir_pass_registry##name__(#name__, \ + new class__); \ + bool mir_pass_registry##name__##_fake() { \ + return mir_pass_registry##name__.Touch(); \ + } + +#define USE_MIR_PASS(name__) \ + extern bool mir_pass_registry##name__##_fake(); \ + static bool mir_pass_usage##name__ __attribute__((unused)) = \ + mir_pass_registry##name__##_fake(); + } // namespace mir } // namespace lite } // namespace paddle diff --git a/paddle/fluid/lite/core/mir/ssa_graph.h b/paddle/fluid/lite/core/mir/ssa_graph.h index d7524c1cb..03aebd7ad 100644 --- a/paddle/fluid/lite/core/mir/ssa_graph.h +++ b/paddle/fluid/lite/core/mir/ssa_graph.h @@ -30,8 +30,9 @@ namespace mir { // - main block, which is a list of OpLite // - scope: which contains all the weights struct Program { + std::list inputs; std::list> ops; - lite::Scope *scope; + std::unique_ptr scope; }; // An Graph for MIR. It is built from a list of Op and a scope. @@ -42,21 +43,38 @@ class SSAGraph : GraphBase { // @param program: the op program // @param valid_places: the valid places user set for the system. void Build(const Program &program, const std::vector &valid_places) { + // create inputs + for (const auto &name : program.inputs) { + node_storage_.emplace_back(); + auto &new_node = node_storage_.back(); + auto &arg = new_node.AsArgument(); + arg.name = name; + arguments_[name] = &new_node; + } + for (auto &op : program.ops) { node_storage_.emplace_back(); // TODO(Superjomn) remove one valid_places here. op->SetValidPlaces(valid_places); auto &new_node = node_storage_.back(); - auto &new_kernel = node_storage_.back().AsInstruct(); + auto &new_kernel = node_storage_.back().AsInstruct(op->op_type_); new_kernel.valid_kernels = op->CreateKernels(valid_places); CHECK(new_node.inlinks.empty()) << "duplicate Build found"; CHECK(new_node.outlinks.empty()) << "duplicate Build found"; + // collect inputs and outputs for (const std::string &name : op->input_names()) { new_node.inlinks.push_back(arguments_.at(name)); } for (const std::string &name : op->output_names()) { + if (!arguments_.count(name)) { + node_storage_.emplace_back(); + auto &new_node = node_storage_.back(); + auto &arg = new_node.AsArgument(name); + arg.name = name; + arguments_.emplace(name, &new_node); + } new_node.outlinks.push_back(arguments_.at(name)); } } @@ -64,6 +82,9 @@ class SSAGraph : GraphBase { std::vector TopoloticalOrder() const; + const std::list &nodes() const { return node_storage_; } + std::list &mutable_nodes() { return node_storage_; } + private: std::list node_storage_; std::map arguments_; diff --git a/paddle/fluid/lite/core/mir/ssa_graph_test.cc b/paddle/fluid/lite/core/mir/ssa_graph_test.cc new file mode 100644 index 000000000..a492590ed --- /dev/null +++ b/paddle/fluid/lite/core/mir/ssa_graph_test.cc @@ -0,0 +1,102 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "paddle/fluid/lite/core/mir/ssa_graph.h" +#include +#include "paddle/fluid/framework/program_desc.h" +#include "paddle/fluid/lite/core/mir/graph_visualize_pass.h" +#include "paddle/fluid/lite/core/op_registry.h" + +namespace paddle { +namespace lite { +namespace mir { + +void BuildFc(framework::ProgramDesc* desc, const std::string& x, + const std::string& w, const std::string& b, + const std::string& out) { + auto* fc = desc->MutableBlock(0)->AppendOp(); + fc->SetInput("Input", {x}); + fc->SetInput("W", {w}); + fc->SetInput("Bias", {b}); + fc->SetOutput("Out", {out}); +} + +Program FakeProgram() { + Program program; + program.scope.reset(new lite::Scope); + + auto add_fc = [&](int id, std::string x) { + // create variables + std::string w1 = "w" + std::to_string(id); + std::string b1 = "b" + std::to_string(id); + std::string out1 = "out" + std::to_string(id); + auto w1v = program.scope->Var(w1)->GetMutable(); + auto b1v = program.scope->Var(b1)->GetMutable(); + auto out1v = program.scope->Var(out1)->GetMutable(); + + framework::OpDesc desc; + desc.SetInput("Input", {x}); + desc.SetInput("W", {w1}); + desc.SetInput("Bias", {b1}); + desc.SetOutput("Out", {out1}); + desc.SetType("fc"); + desc.SetAttr("in_num_col_dims", 1); + desc.Flush(); + + // add to input + program.inputs.push_back(w1); + program.inputs.push_back(b1); + + auto fc_op = LiteOpRegistry::Global().Create("fc"); + fc_op->PickKernel({Place{TARGET(kHost), PRECISION(kFloat)}}); + fc_op->Attach(desc, program.scope.get()); + program.ops.emplace_back(std::move(fc_op)); + + w1v->Resize({100, 100}); + b1v->Resize({100, 1}); + out1v->Resize({100, 100}); + + return out1; + }; + + // x1, w1, b1 -fc-> out1 + // out1, w2, b2 -fc-> out2 + + std::string x = "x"; + program.inputs.push_back(x); + auto* xv = program.scope->Var(x)->GetMutable(); + xv->Resize({100, 100}); + + for (int i = 0; i < 3; i++) { + x = add_fc(i, x); + } + return program; +} + +TEST(SSAGraph, test) { + auto program = FakeProgram(); + SSAGraph graph; + std::vector places{{TARGET(kHost), PRECISION(kFloat)}}; + + graph.Build(program, places); + + Visualize(&graph); +} + +} // namespace mir +} // namespace lite +} // namespace paddle + +USE_LITE_OP(fc); +USE_LITE_KERNEL(fc, kHost, kFloat); diff --git a/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc b/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc new file mode 100644 index 000000000..ce71e4de2 --- /dev/null +++ b/paddle/fluid/lite/core/mir/static_kernel_pick_pass.cc @@ -0,0 +1,13 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. diff --git a/paddle/fluid/lite/core/mir/static_kernel_pick_pass.h b/paddle/fluid/lite/core/mir/static_kernel_pick_pass.h new file mode 100644 index 000000000..becdd50dd --- /dev/null +++ b/paddle/fluid/lite/core/mir/static_kernel_pick_pass.h @@ -0,0 +1,27 @@ +// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#include "paddle/fluid/lite/core/mir/pass.h" + +namespace paddle { +namespace lite { +namespace mir { + +class StaticKernelPickPass : public mir::Pass {}; + +} // namespace mir +} // namespace lite +} // namespace paddle diff --git a/paddle/fluid/lite/core/type_system.cc b/paddle/fluid/lite/core/type_system.cc index a558383f7..1d2ad240e 100644 --- a/paddle/fluid/lite/core/type_system.cc +++ b/paddle/fluid/lite/core/type_system.cc @@ -35,7 +35,7 @@ Type::Get -const Type* Type::Get(TargetType target, int device) { +const Type* Type::Get(TargetType target) { return Get(); } diff --git a/paddle/fluid/lite/kernels/host/CMakeLists.txt b/paddle/fluid/lite/kernels/host/CMakeLists.txt index 17935f809..7c416dbf5 100644 --- a/paddle/fluid/lite/kernels/host/CMakeLists.txt +++ b/paddle/fluid/lite/kernels/host/CMakeLists.txt @@ -8,6 +8,7 @@ cc_library(host_kernels DEPS relu_compute_host mul_compute_host scale_compute_host + DEPS kernel_lite ) cc_test(test_fc_compute SRCS fc_compute_test.cc DEPS fc_compute_host fc_op_lite) -- GitLab