diff --git a/mace/core/mace.cc b/mace/core/mace.cc index 2150e83afcdbf05795360bfef7e55cbe4b38b08a..db04fcc699c481f0e06c385a7b7cc8325a463aa7 100644 --- a/mace/core/mace.cc +++ b/mace/core/mace.cc @@ -204,9 +204,6 @@ MaceStatus MaceEngine::Impl::Init( MACE_CHECK(hexagon_controller_->Init(), "hexagon init error"); hexagon_controller_->SetDebugLevel( static_cast(mace::logging::LogMessage::MinVLogLevel())); - int dsp_mode = - ProtoArgHelper::GetOptionalArg(*net_def, "dsp_mode", 0); - hexagon_controller_->SetGraphMode(dsp_mode); MACE_CHECK(hexagon_controller_->SetupGraph(*net_def, model_data), "hexagon setup graph error"); if (VLOG_IS_ON(2)) { diff --git a/mace/core/runtime/hexagon/hexagon_control_wrapper.cc b/mace/core/runtime/hexagon/hexagon_control_wrapper.cc index 0dac0c327692fbc998c2e6f03bd930f0a93f7b09..62312744845055bc05370dc51bb6e8e7ed33c812 100644 --- a/mace/core/runtime/hexagon/hexagon_control_wrapper.cc +++ b/mace/core/runtime/hexagon/hexagon_control_wrapper.cc @@ -51,7 +51,7 @@ int HexagonControlWrapper::GetVersion() { bool HexagonControlWrapper::Config() { LOG(INFO) << "Hexagon config"; - if (hexagon_controller_InitHexagonWithMaxAttributes(0, 100) != 0) { + if (hexagon_nn_set_powersave_level(0) != 0) { return false; } return hexagon_nn_config() == 0; @@ -66,7 +66,7 @@ bool HexagonControlWrapper::Init() { bool HexagonControlWrapper::Finalize() { LOG(INFO) << "Hexagon finalize"; - return hexagon_controller_DeInitHexagon() == 0; + return hexagon_nn_set_powersave_level(1) == 0; } bool HexagonControlWrapper::SetupGraph(const NetDef &net_def, @@ -271,11 +271,6 @@ void HexagonControlWrapper::SetDebugLevel(int level) { "set debug level error"); } -void HexagonControlWrapper::SetGraphMode(int mode) { - LOG(INFO) << "Set dsp mode: " << mode; - MACE_CHECK(hexagon_nn_set_graph_mode(nn_id_, mode) == 0, "set mode error"); -} - void HexagonControlWrapper::GetPerfInfo() { LOG(INFO) << "Get perf info"; std::vector perf_info(MACE_MAX_NODE); diff --git a/mace/core/runtime/hexagon/hexagon_control_wrapper.h b/mace/core/runtime/hexagon/hexagon_control_wrapper.h index 4e4d8499e45c1b174caa06c8e3c2be679affd288..adcd5224e447ae565a1286246ae84e1be23d08f8 100644 --- a/mace/core/runtime/hexagon/hexagon_control_wrapper.h +++ b/mace/core/runtime/hexagon/hexagon_control_wrapper.h @@ -17,10 +17,10 @@ #include -#include "mace/core/runtime/hexagon/hexagon_controller.h" #include "mace/core/runtime/hexagon/quantize.h" #include "mace/core/tensor.h" #include "mace/public/mace.h" +#include "third_party/nnlib/hexagon_nn.h" namespace mace { @@ -44,7 +44,6 @@ class HexagonControlWrapper { void GetPerfInfo(); void ResetPerfInfo(); void SetDebugLevel(int level); - void SetGraphMode(int mode); private: static constexpr int NODE_ID_OFFSET = 10000; diff --git a/mace/core/runtime/hexagon/hexagon_controller.h b/mace/core/runtime/hexagon/hexagon_controller.h deleted file mode 100644 index afe4b727de4936aedee3c9515963d013050e48eb..0000000000000000000000000000000000000000 --- a/mace/core/runtime/hexagon/hexagon_controller.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 Xiaomi, Inc. 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. - -#ifndef MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_ -#define MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_ - -#include "third_party/nnlib/hexagon_nn.h" - -#ifdef __cplusplus -extern "C" { -#else -#include -#endif // __cplusplus - -int hexagon_controller_InitHexagonWithMaxAttributes(int enable_dcvs, - int bus_usage); - -int hexagon_controller_DeInitHexagon(); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#endif // MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_ - diff --git a/third_party/nnlib/hexagon_nn.h b/third_party/nnlib/hexagon_nn.h index b8dbad353a059c2e55c10785b33c97880ca1dadb..b7485c93f4db702b60091b66ac2a9af9b2438719 100644 --- a/third_party/nnlib/hexagon_nn.h +++ b/third_party/nnlib/hexagon_nn.h @@ -37,7 +37,7 @@ #define THIRD_PARTY_NNLIB_HEXAGON_NN_H_ #ifndef __QAIC_HEADER #define __QAIC_HEADER(ff) ff -#endif // __QAIC_HEADER +#endif //__QAIC_HEADER #ifndef __QAIC_HEADER_EXPORT #define __QAIC_HEADER_EXPORT @@ -49,7 +49,7 @@ #ifndef __QAIC_IMPL #define __QAIC_IMPL(ff) ff -#endif // __QAIC_IMPL +#endif //__QAIC_IMPL #ifndef __QAIC_IMPL_EXPORT #define __QAIC_IMPL_EXPORT @@ -131,7 +131,7 @@ struct hexagon_nn_const_node { }; __QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_config)(void) __QAIC_HEADER_ATTRIBUTE; -__QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_init)(hexagon_nn_nn_id* g) +__QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_init)(hexagon_nn_nn_id *g) __QAIC_HEADER_ATTRIBUTE; __QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_set_debug_level)( hexagon_nn_nn_id id, int level) __QAIC_HEADER_ATTRIBUTE; @@ -221,6 +221,8 @@ __QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_execute_new)( int inputsLen, hexagon_nn_tensordef *outputs, int outputsLen) __QAIC_HEADER_ATTRIBUTE; +__QAIC_HEADER_EXPORT unsigned int __QAIC_HEADER(hexagon_nn_get_dsp_offset)(void) + __QAIC_HEADER_ATTRIBUTE; #ifdef __cplusplus } #endif diff --git a/third_party/nnlib/libhexagon_controller.so b/third_party/nnlib/libhexagon_controller.so index 7daedd621b12686032f952a0da6564a13b63981a..05c8f3d8d71401ff117ce9b75f21cebc5e44dc66 100755 Binary files a/third_party/nnlib/libhexagon_controller.so and b/third_party/nnlib/libhexagon_controller.so differ