提交 95b76164 编写于 作者: J Jiansong Wang

Manually merge the missed part of imagination nna integration after pull

upstream develop. test=develop
上级 ee6ec4a1
...@@ -87,7 +87,7 @@ lite_option(LITE_WITH_NPU "Enable NPU in lite mode" OFF) ...@@ -87,7 +87,7 @@ lite_option(LITE_WITH_NPU "Enable NPU in lite mode" OFF)
lite_option(LITE_WITH_RKNPU "Enable RKNPU in lite mode" OFF) lite_option(LITE_WITH_RKNPU "Enable RKNPU in lite mode" OFF)
lite_option(LITE_WITH_MLU "Enable MLU in lite mode" OFF) lite_option(LITE_WITH_MLU "Enable MLU in lite mode" OFF)
lite_option(LITE_WITH_HUAWEI_ASCEND_NPU "Enable HUAWEI_ASCEND_NPU in lite mode" OFF) lite_option(LITE_WITH_HUAWEI_ASCEND_NPU "Enable HUAWEI_ASCEND_NPU in lite mode" OFF)
lite_option(LITE_WITH_IMAGINATION "Enable IMAGINATION_NNA in lite mode" OFF) lite_option(LITE_WITH_IMAGINATION_NNA "Enable IMAGINATION_NNA in lite mode" OFF)
lite_option(LITE_WITH_XPU "Enable XPU in lite mode" OFF) lite_option(LITE_WITH_XPU "Enable XPU in lite mode" OFF)
lite_option(LITE_WITH_XTCL "Enable XPU via XTCL" OFF IF LITE_WITH_XPU) lite_option(LITE_WITH_XTCL "Enable XPU via XTCL" OFF IF LITE_WITH_XPU)
lite_option(LITE_WITH_BM "Enable BM in lite mode" OFF) lite_option(LITE_WITH_BM "Enable BM in lite mode" OFF)
......
...@@ -342,9 +342,9 @@ imgdnn_network_object ImgdnnManager::createNetworkObject( ...@@ -342,9 +342,9 @@ imgdnn_network_object ImgdnnManager::createNetworkObject(
"nna_config/mirage_hw_config06_23_2_6500_301.json"; "nna_config/mirage_hw_config06_23_2_6500_301.json";
const std::string mapconfig = "nna_config/mapconfig_q8a.json"; const std::string mapconfig = "nna_config/mapconfig_q8a.json";
testConfigFileExists(hwconfig, mapconfig) testConfigFileExists(hwconfig, mapconfig);
std::string options_str; std::string options_str;
options_str += "-h " + hwconfig; options_str += "-h " + hwconfig;
options_str += " -m " + mapconfig; options_str += " -m " + mapconfig;
// Add " --dump_debug_binaries enabled" to options_str if need debug info. // Add " --dump_debug_binaries enabled" to options_str if need debug info.
......
...@@ -59,7 +59,6 @@ class ImgdnnManager { ...@@ -59,7 +59,6 @@ class ImgdnnManager {
bool testConfigFileExists(const std::string &hwconfig, bool testConfigFileExists(const std::string &hwconfig,
const std::string &mapconfig); const std::string &mapconfig);
{ return (access(name.c_str(), F_OK) != -1); }
public: public:
ImgdnnManager(); ImgdnnManager();
......
...@@ -142,7 +142,7 @@ if (NOT LITE_ON_TINY_PUBLISH) ...@@ -142,7 +142,7 @@ if (NOT LITE_ON_TINY_PUBLISH)
add_subdirectory(arena) add_subdirectory(arena)
endif() endif()
if(LITE_WITH_NPU OR LITE_WITH_XTCL OR LITE_WITH_BM OR LITE_WITH_RKNPU OR LITE_WITH_MLU OR LITE_WITH_APU OR LITE_WITH_HUAWEI_ASCEND_NPU) if(LITE_WITH_NPU OR LITE_WITH_XTCL OR LITE_WITH_BM OR LITE_WITH_RKNPU OR LITE_WITH_MLU OR LITE_WITH_APU OR LITE_WITH_HUAWEI_ASCEND_NPU OR LITE_WITH_IMAGINATION_NNA)
lite_cc_library(subgraph_bridge_registry lite_cc_library(subgraph_bridge_registry
SRCS subgraph_bridge_registry.cc SRCS subgraph_bridge_registry.cc
DEPS op) DEPS op)
......
add_subdirectory(bridges) add_subdirectory(bridges)
add_kernel(subgraph_compute_imagination_nna IMAGINATION_NNA basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_imagination_nna subgraph_bridge_engine ${imagination_nna_subgraph_bridges}) add_kernel(subgraph_compute_imagination_nna IMAGINATION_NNA basic SRCS subgraph_compute.cc DEPS ${lite_kernel_deps} device_imagination_nna subgraph_engine_base ${imagination_nna_subgraph_bridges})
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
// 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 "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/imagination_nna/bridges/utility.h" #include "lite/kernels/imagination_nna/bridges/utility.h"
#include "lite/kernels/npu/bridges/registry.h"
namespace paddle { namespace paddle {
namespace lite { namespace lite {
...@@ -68,47 +68,6 @@ int ActConverter(void* ctx, OpLite* op, KernelBase* kernel) { ...@@ -68,47 +68,6 @@ int ActConverter(void* ctx, OpLite* op, KernelBase* kernel) {
} // namespace subgraph } // namespace subgraph
} // namespace lite } // namespace lite
} // namespace paddle } // namespace paddle
#if 0
REGISTER_SUBGRAPH_BRIDGE(
sigmoid,
kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
#endif
REGISTER_SUBGRAPH_BRIDGE(relu, REGISTER_SUBGRAPH_BRIDGE(relu,
kImaginationNNA, kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter); paddle::lite::subgraph::imagination_nna::ActConverter);
#if 0
REGISTER_SUBGRAPH_BRIDGE(
tanh, kImaginationNNA, paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
relu_clipped,
kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
relu6, kImaginationNNA, paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
leaky_relu,
kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
abs, kImaginationNNA, paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
softsign,
kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
softplus,
kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
hard_sigmoid,
kImaginationNNA,
paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Activation>);
REGISTER_SUBGRAPH_BRIDGE(
log, kImaginationNNA, paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Log>);
REGISTER_SUBGRAPH_BRIDGE(
square, kImaginationNNA, paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Square>);
REGISTER_SUBGRAPH_BRIDGE(
sqrt, kImaginationNNA, paddle::lite::subgraph::imagination_nna::ActConverter<ge::op::Sqrt>);
#endif
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
// 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 "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/imagination_nna/bridges/registry.h"
#include "lite/kernels/imagination_nna/bridges/utility.h" #include "lite/kernels/imagination_nna/bridges/utility.h"
namespace paddle { namespace paddle {
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
// limitations under the License. // limitations under the License.
#include "lite/operators/conv_op.h" #include "lite/operators/conv_op.h"
#include "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/imagination_nna/bridges/utility.h" #include "lite/kernels/imagination_nna/bridges/utility.h"
#include "lite/kernels/npu/bridges/registry.h"
namespace paddle { namespace paddle {
namespace lite { namespace lite {
......
...@@ -12,9 +12,8 @@ ...@@ -12,9 +12,8 @@
// 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 "imgdnn.h" // NOLINT #include "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/npu/bridges/registry.h"
namespace paddle { namespace paddle {
namespace lite { namespace lite {
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include "lite/operators/pool_op.h" #include "lite/operators/pool_op.h"
#include "imgdnn.h" // NOLINT #include "imgdnn.h" // NOLINT
#include "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/imagination_nna/bridges/utility.h" #include "lite/kernels/imagination_nna/bridges/utility.h"
#include "lite/kernels/npu/bridges/registry.h"
namespace paddle { namespace paddle {
namespace lite { namespace lite {
......
...@@ -12,9 +12,8 @@ ...@@ -12,9 +12,8 @@
// 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 "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/imagination_nna/bridges/registry.h"
#include "lite/kernels/npu/bridges/utility.h"
namespace paddle { namespace paddle {
namespace lite { namespace lite {
......
...@@ -33,7 +33,7 @@ bool SubgraphEngine::BuildDeviceProgram() { ...@@ -33,7 +33,7 @@ bool SubgraphEngine::BuildDeviceProgram() {
// Convert all of ops and their input vars and weights and added into the NNA // Convert all of ops and their input vars and weights and added into the NNA
// IMG IR graph // IMG IR graph
subgraph::imagination_nna::Graph graph{&imgdnn_mgr_}; subgraph::imagination_nna::Graph graph{&imgdnn_mgr_};
const auto& bridges = subgraph::Registry::Instance(); const auto& bridges = subgraph::SubgraphBridgeRegistry::Instance();
if (!origin_program_) { if (!origin_program_) {
BuildOriginProgram(); BuildOriginProgram();
} }
...@@ -57,8 +57,8 @@ bool SubgraphEngine::BuildDeviceProgram() { ...@@ -57,8 +57,8 @@ bool SubgraphEngine::BuildDeviceProgram() {
} }
} }
// Collect the valid input and output nodes in the IMGDNN IR graph and // Collect the valid input and output nodes in the IMGDNN IR graph and update
// update the input and output names // the input and output names
device_inames_.clear(); device_inames_.clear();
std::vector<imgdnn_tensor> device_inodes; std::vector<imgdnn_tensor> device_inodes;
for (auto& input_name : input_names_) { for (auto& input_name : input_names_) {
......
...@@ -17,19 +17,18 @@ ...@@ -17,19 +17,18 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <vector> #include <vector>
#include "imgdnn.h" // NOLINT
#include "lite/backends/imagination_nna/imgdnn_manager.h" #include "lite/backends/imagination_nna/imgdnn_manager.h"
#include "lite/core/kernel.h" #include "lite/core/kernel.h"
#include "lite/core/subgraph_bridge_registry.h"
#include "lite/core/subgraph_engine_base.h"
#include "lite/kernels/imagination_nna/bridges/graph.h" #include "lite/kernels/imagination_nna/bridges/graph.h"
#include "lite/kernels/npu/bridges/engine.h"
#include "lite/kernels/npu/bridges/registry.h"
namespace paddle { namespace paddle {
namespace lite { namespace lite {
namespace kernels { namespace kernels {
namespace imagination_nna { namespace imagination_nna {
class SubgraphEngine : public subgraph::Engine { class SubgraphEngine : public subgraph::SubgraphEngineBase {
public: public:
SubgraphEngine(KernelContext* ctx, SubgraphEngine(KernelContext* ctx,
int block_idx, int block_idx,
...@@ -37,12 +36,12 @@ class SubgraphEngine : public subgraph::Engine { ...@@ -37,12 +36,12 @@ class SubgraphEngine : public subgraph::Engine {
Scope* exec_scope, Scope* exec_scope,
const std::vector<std::string>& input_names, const std::vector<std::string>& input_names,
const std::vector<std::string>& output_names) const std::vector<std::string>& output_names)
: subgraph::Engine(ctx, : subgraph::SubgraphEngineBase(ctx,
block_idx, block_idx,
program_desc, program_desc,
exec_scope, exec_scope,
input_names, input_names,
output_names) {} output_names) {}
~SubgraphEngine() {} ~SubgraphEngine() {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册