diff --git a/mace/core/mace.cc b/mace/core/mace.cc index 770a8067cc735e02c89123d98aab879c1c619986..47d49dfeb3c0441ab4b34fb2888bd1b471724a5f 100644 --- a/mace/core/mace.cc +++ b/mace/core/mace.cc @@ -513,14 +513,22 @@ const OperatorDef &NetDef::op(const int idx) const { MaceEngine::MaceEngine(const NetDef *net_def, DeviceType device_type) : op_registry_(new OperatorRegistry()), device_type_(device_type), ws_(new Workspace()), net_(nullptr), hexagon_controller_(nullptr) { - + ws_->CreateTensor("mace_input_node:0", + GetDeviceAllocator(device_type_), + DT_FLOAT); + ws_->CreateTensor("mace_output_node:0", + GetDeviceAllocator(device_type_), + DT_FLOAT); if (device_type == HEXAGON) { hexagon_controller_.reset(new HexagonControlWrapper()); hexagon_controller_->Init(); - hexagon_controller_->SetDebugLevel(0); + hexagon_controller_->SetDebugLevel( + static_cast(mace::internal::LogMessage::MinVLogLevel())); hexagon_controller_->Config(); hexagon_controller_->SetupGraph(*net_def); - hexagon_controller_->PrintGraph(); + if (VLOG_IS_ON(2)) { + hexagon_controller_->PrintGraph(); + } } else { ws_->LoadModelTensor(*net_def, device_type); @@ -531,19 +539,15 @@ MaceEngine::MaceEngine(const NetDef *net_def, DeviceType device_type) : LOG(FATAL) << "Net init run failed"; } ws_->RemoveUnsedTensor(); - ws_->CreateTensor("mace_input_node:0", - GetDeviceAllocator(device_type_), - DT_FLOAT); - ws_->CreateTensor("mace_output_node:0", - GetDeviceAllocator(device_type_), - DT_FLOAT); net_ = std::move(CreateNet(op_registry_, *net_def, ws_.get(), device_type)); } } MaceEngine::~MaceEngine() { if (device_type_ == HEXAGON) { - hexagon_controller_->GetPerfInfo(); - hexagon_controller_->PrintLog(); + if (VLOG_IS_ON(2)) { + hexagon_controller_->GetPerfInfo(); + hexagon_controller_->PrintLog(); + } hexagon_controller_->TeardownGraph(); hexagon_controller_->Finalize(); } diff --git a/mace/core/runtime/hexagon/hexagon_control_wrapper.cc b/mace/core/runtime/hexagon/hexagon_control_wrapper.cc index 89c09c91e78cc24b8558949067d3a4a48facb553..032f29d1e5a24226585cde6ca92ab17aa953d9cf 100644 --- a/mace/core/runtime/hexagon/hexagon_control_wrapper.cc +++ b/mace/core/runtime/hexagon/hexagon_control_wrapper.cc @@ -184,7 +184,7 @@ void HexagonControlWrapper::SetDebugLevel(int level) { void HexagonControlWrapper::GetPerfInfo() { LOG(INFO) << "Get perf info"; vector perf_info(MAX_NODE); - unsigned int n_items; + unsigned int n_items = 0; hexagon_nn_get_perfinfo(nn_id_, perf_info.data(), MAX_NODE, &n_items); std::unordered_map node_id_counters; diff --git a/mace/core/runtime/hexagon/libhexagon_controller.so b/mace/core/runtime/hexagon/libhexagon_controller.so index da6f257e152d486dc82e686e2fe6cad2f60bd173..0ff470a75cf04a6f489fdc9e2113c7ea09cb35e5 100755 Binary files a/mace/core/runtime/hexagon/libhexagon_controller.so and b/mace/core/runtime/hexagon/libhexagon_controller.so differ diff --git a/mace/examples/mace_run.cc b/mace/examples/mace_run.cc index 825a19645dc88f743f8b3365d57be958b9496de7..2d57d7f794922ff001327fca7928768af25f8f11 100644 --- a/mace/examples/mace_run.cc +++ b/mace/examples/mace_run.cc @@ -124,7 +124,7 @@ int main(int argc, char **argv) { Flag("output_shape", &output_shape, "output shape, separated by comma"), Flag("input_file", &input_file, "input file name"), Flag("output_file", &output_file, "output file name"), - Flag("device", &device, "CPU/NEON"), + Flag("device", &device, "CPU/NEON/OPENCL/HEXAGON"), Flag("round", &round, "round"), Flag("malloc_check_cycle", &malloc_check_cycle, "malloc debug check cycle, -1 to disable"), @@ -175,7 +175,7 @@ int main(int argc, char **argv) { input_size * sizeof(float)); in_file.close(); } else { - LOG(ERROR) << "Open input file failed"; + LOG(FATAL) << "Open input file failed"; } // Init model diff --git a/tools/validate_gcn_dsp.sh b/tools/validate_gcn_dsp.sh index d155136b923b1075bdf21e2bcdd55dd1dba668d2..5bd30df44822beca6c2f92f2b0e6c688de28a452 100755 --- a/tools/validate_gcn_dsp.sh +++ b/tools/validate_gcn_dsp.sh @@ -36,13 +36,17 @@ build_and_run() --cpu=armeabi-v7a \ --copt="-std=c++11" \ --copt="-D_GLIBCXX_USE_C99_MATH_TR1" \ - --copt="-Werror=return-type" + --copt="-Werror=return-type" \ + --copt="-DMACE_MODEL_TAG=${MODEL_TAG}" \ + --define hexagon=true --define production=true || exit -1 - adb shell "mkdir -p ${PHONE_DATA_DIR}" - adb push ${MODEL_DIR}/${INPUT_FILE_NAME} ${PHONE_DATA_DIR} - adb push bazel-bin/mace/examples/mace_run ${PHONE_DATA_DIR} + adb shell "mkdir -p ${PHONE_DATA_DIR}" || exit -1 + adb push ${MODEL_DIR}/${INPUT_FILE_NAME} ${PHONE_DATA_DIR} || exit -1 + adb push bazel-bin/mace/examples/mace_run ${PHONE_DATA_DIR} || exit -1 + adb push mace/core/runtime/hexagon/libhexagon_controller.so ${PHONE_DATA_DIR} || exit -1 adb