提交 7819bebf 编写于 作者: L Liangliang He

refactor third_party

上级 6751c7be
...@@ -59,7 +59,7 @@ please refer to [the contribution guide](docs/development/contributing.md). ...@@ -59,7 +59,7 @@ please refer to [the contribution guide](docs/development/contributing.md).
## Acknowledgement ## Acknowledgement
MiAI Compute Engine depends on several open source projects located in MiAI Compute Engine depends on several open source projects located in
[third_party](mace/third_party) directory. Particularly, we learned a lot from [third_party](third_party) directory. Particularly, we learned a lot from
the following projects during the development: the following projects during the development:
* [Qualcomm Hexagon NN Offload Framework](https://source.codeaurora.org/quic/hexagon_nn/nnlib): the Hexagon DSP runtime * [Qualcomm Hexagon NN Offload Framework](https://source.codeaurora.org/quic/hexagon_nn/nnlib): the Hexagon DSP runtime
depends on this library. depends on this library.
......
...@@ -15,7 +15,7 @@ http_archive( ...@@ -15,7 +15,7 @@ http_archive(
new_http_archive( new_http_archive(
name = "gtest", name = "gtest",
build_file = "mace/third_party/googletest/googletest.BUILD", build_file = "third_party/googletest/googletest.BUILD",
sha256 = "f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf", sha256 = "f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf",
strip_prefix = "googletest-release-1.8.0", strip_prefix = "googletest-release-1.8.0",
urls = [ urls = [
...@@ -26,7 +26,7 @@ new_http_archive( ...@@ -26,7 +26,7 @@ new_http_archive(
new_http_archive( new_http_archive(
name = "opencl_headers", name = "opencl_headers",
build_file = "mace/third_party/opencl-headers/opencl-headers.BUILD", build_file = "third_party/opencl-headers/opencl-headers.BUILD",
sha256 = "5dc7087680853b5c825360fc04ca26534f4b9f22ac114c4d3a306bfbec3cd0f2", sha256 = "5dc7087680853b5c825360fc04ca26534f4b9f22ac114c4d3a306bfbec3cd0f2",
strip_prefix = "OpenCL-Headers-master", strip_prefix = "OpenCL-Headers-master",
urls = [ urls = [
...@@ -37,7 +37,7 @@ new_http_archive( ...@@ -37,7 +37,7 @@ new_http_archive(
new_http_archive( new_http_archive(
name = "opencl_clhpp", name = "opencl_clhpp",
build_file = "mace/third_party/opencl-clhpp/opencl-clhpp.BUILD", build_file = "third_party/opencl-clhpp/opencl-clhpp.BUILD",
sha256 = "dab6f1834ec6e3843438cc0f97d63817902aadd04566418c1fcc7fb78987d4e7", sha256 = "dab6f1834ec6e3843438cc0f97d63817902aadd04566418c1fcc7fb78987d4e7",
strip_prefix = "OpenCL-CLHPP-4c6f7d56271727e37fb19a9b47649dd175df2b12", strip_prefix = "OpenCL-CLHPP-4c6f7d56271727e37fb19a9b47649dd175df2b12",
urls = [ urls = [
...@@ -48,7 +48,7 @@ new_http_archive( ...@@ -48,7 +48,7 @@ new_http_archive(
new_http_archive( new_http_archive(
name = "half", name = "half",
build_file = "mace/third_party/half/half.BUILD", build_file = "third_party/half/half.BUILD",
sha256 = "0f514a1e877932b21dc5edc26a148ddc700b6af2facfed4c030ca72f74d0219e", sha256 = "0f514a1e877932b21dc5edc26a148ddc700b6af2facfed4c030ca72f74d0219e",
strip_prefix = "half-code-356-trunk", strip_prefix = "half-code-356-trunk",
urls = [ urls = [
...@@ -59,7 +59,7 @@ new_http_archive( ...@@ -59,7 +59,7 @@ new_http_archive(
new_http_archive( new_http_archive(
name = "six_archive", name = "six_archive",
build_file = "mace/third_party/six/six.BUILD", build_file = "third_party/six/six.BUILD",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
strip_prefix = "six-1.10.0", strip_prefix = "six-1.10.0",
urls = [ urls = [
......
...@@ -15,7 +15,6 @@ cc_library( ...@@ -15,7 +15,6 @@ cc_library(
name = "statistics", name = "statistics",
srcs = ["statistics.cc"], srcs = ["statistics.cc"],
hdrs = ["statistics.h"], hdrs = ["statistics.h"],
linkstatic = 1,
copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/kernels", "//mace/kernels",
......
...@@ -9,7 +9,6 @@ cc_library( ...@@ -9,7 +9,6 @@ cc_library(
name = "generated_models", name = "generated_models",
srcs = glob(["models/*/*.cc"]), srcs = glob(["models/*/*.cc"]),
hdrs = glob(["models/*/*.h"]), hdrs = glob(["models/*/*.h"]),
linkstatic = 1,
copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/core", "//mace/core",
...@@ -21,21 +20,18 @@ cc_library( ...@@ -21,21 +20,18 @@ cc_library(
name = "generated_opencl", name = "generated_opencl",
srcs = glob(["opencl/*.cc"]), srcs = glob(["opencl/*.cc"]),
copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkstatic = 1,
) )
cc_library( cc_library(
name = "generated_tuning_params", name = "generated_tuning_params",
srcs = ["tuning/tuning_params.cc"], srcs = ["tuning/tuning_params.cc"],
copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkstatic = 1,
) )
cc_library( cc_library(
name = "generated_version", name = "generated_version",
srcs = ["version/version.cc"], srcs = ["version/version.cc"],
copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkstatic = 1,
) )
cc_library( cc_library(
......
...@@ -75,7 +75,7 @@ cc_library( ...@@ -75,7 +75,7 @@ cc_library(
]) + if_not_production_mode([ ]) + if_not_production_mode([
"//mace/utils:utils_dev", "//mace/utils:utils_dev",
]) + if_hexagon_enabled([ ]) + if_hexagon_enabled([
"//mace/third_party/nnlib:libhexagon", "//third_party/nnlib:libhexagon",
]), ]),
) )
...@@ -109,3 +109,11 @@ cc_library( ...@@ -109,3 +109,11 @@ cc_library(
], ],
alwayslink = 1, alwayslink = 1,
) )
cc_binary(
name = "libmace.so",
linkshared = 1,
deps = [
"//mace/core",
],
)
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#ifndef MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_ #ifndef MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_
#define MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_ #define MACE_CORE_RUNTIME_HEXAGON_HEXAGON_CONTROLLER_H_
#include "mace/third_party/nnlib/hexagon_nn.h" #include "third_party/nnlib/hexagon_nn.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
......
...@@ -27,7 +27,7 @@ namespace mace { ...@@ -27,7 +27,7 @@ namespace mace {
typedef enum op_type_enum { typedef enum op_type_enum {
#define DEF_OP(NAME, ...) OP_##NAME, #define DEF_OP(NAME, ...) OP_##NAME,
#include "mace/third_party/nnlib/ops.h" // NOLINT(build/include) #include "third_party/nnlib/ops.h" // NOLINT(build/include)
NN_OPS_MAX NN_OPS_MAX
#undef DEF_OP #undef DEF_OP
...@@ -38,7 +38,7 @@ class OpMap { ...@@ -38,7 +38,7 @@ class OpMap {
void Init() { void Init() {
#define DEF_OP(NAME) op_map_[#NAME] = OP_##NAME; #define DEF_OP(NAME) op_map_[#NAME] = OP_##NAME;
#include "mace/third_party/nnlib/ops.h" // NOLINT(build/include) #include "third_party/nnlib/ops.h" // NOLINT(build/include)
#undef DEF_OP #undef DEF_OP
} }
......
...@@ -15,7 +15,7 @@ py_library( ...@@ -15,7 +15,7 @@ py_library(
deps = [ deps = [
":memory_optimizer", ":memory_optimizer",
"//mace/proto:mace_py", "//mace/proto:mace_py",
"//mace/third_party/caffe:caffe_py", "//third_party/caffe:caffe_py",
], ],
) )
......
...@@ -18,7 +18,6 @@ import numpy as np ...@@ -18,7 +18,6 @@ import numpy as np
import google.protobuf.text_format import google.protobuf.text_format
from mace.proto import mace_pb2 from mace.proto import mace_pb2
from mace.third_party.caffe import caffe_pb2
from mace.python.tools.converter_tool import base_converter from mace.python.tools.converter_tool import base_converter
from mace.python.tools.converter_tool import shape_inference from mace.python.tools.converter_tool import shape_inference
from mace.python.tools.converter_tool.base_converter import PoolingType from mace.python.tools.converter_tool.base_converter import PoolingType
...@@ -31,6 +30,8 @@ from mace.python.tools.converter_tool.base_converter import MaceKeyword ...@@ -31,6 +30,8 @@ from mace.python.tools.converter_tool.base_converter import MaceKeyword
from mace.python.tools.converter_tool.base_converter import ConverterUtil from mace.python.tools.converter_tool.base_converter import ConverterUtil
from mace.python.tools.convert_util import mace_check from mace.python.tools.convert_util import mace_check
from third_party.caffe import caffe_pb2
caffe_group_str = 'group' caffe_group_str = 'group'
caffe_kernel_h_str = 'kernel_h' caffe_kernel_h_str = 'kernel_h'
caffe_kernel_w_str = 'kernel_w' caffe_kernel_w_str = 'kernel_w'
......
...@@ -140,7 +140,7 @@ class Tuner { ...@@ -140,7 +140,7 @@ class Tuner {
int num_runs, int num_runs,
double *time_us, double *time_us,
std::vector<param_type> *tuning_result) { std::vector<param_type> *tuning_result) {
RetType res; RetType res = 0;
int iter = 0; int iter = 0;
int64_t total_time_us = 0; int64_t total_time_us = 0;
for (iter = 0; iter < num_runs; ++iter) { for (iter = 0; iter < num_runs; ++iter) {
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
* *
*/ */
#ifndef MACE_THIRD_PARTY_NNLIB_HEXAGON_NN_H_ #ifndef THIRD_PARTY_NNLIB_HEXAGON_NN_H_
#define MACE_THIRD_PARTY_NNLIB_HEXAGON_NN_H_ #define THIRD_PARTY_NNLIB_HEXAGON_NN_H_
#ifndef __QAIC_HEADER #ifndef __QAIC_HEADER
#define __QAIC_HEADER(ff) ff #define __QAIC_HEADER(ff) ff
#endif // __QAIC_HEADER #endif // __QAIC_HEADER
...@@ -221,4 +221,4 @@ __QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_execute_new)( ...@@ -221,4 +221,4 @@ __QAIC_HEADER_EXPORT int __QAIC_HEADER(hexagon_nn_execute_new)(
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // MACE_THIRD_PARTY_NNLIB_HEXAGON_NN_H_ #endif // THIRD_PARTY_NNLIB_HEXAGON_NN_H_
...@@ -657,7 +657,7 @@ def tuning_run(abi, ...@@ -657,7 +657,7 @@ def tuning_run(abi,
if not embed_model_data: if not embed_model_data:
adb_push("%s/%s.data" % (model_output_dir, model_tag), adb_push("%s/%s.data" % (model_output_dir, model_tag),
phone_data_dir, serialno) phone_data_dir, serialno)
adb_push("mace/third_party/nnlib/libhexagon_controller.so", adb_push("nnlib/libhexagon_controller.so",
phone_data_dir, serialno) phone_data_dir, serialno)
if mace_model_dir: if mace_model_dir:
...@@ -772,7 +772,7 @@ def validate_model(abi, ...@@ -772,7 +772,7 @@ def validate_model(abi,
if not docker_image_id: if not docker_image_id:
print("Build caffe docker") print("Build caffe docker")
sh.docker("build", "-t", image_name, sh.docker("build", "-t", image_name,
"mace/third_party/caffe") "third_party/caffe")
container_id = sh.docker("ps", "-qa", "-f", container_id = sh.docker("ps", "-qa", "-f",
"name=%s" % container_name) "name=%s" % container_name)
...@@ -866,7 +866,7 @@ def merge_libs(target_soc, ...@@ -866,7 +866,7 @@ def merge_libs(target_soc,
project_output_dir = "%s/%s" % (libmace_output_dir, project_name) project_output_dir = "%s/%s" % (libmace_output_dir, project_name)
model_header_dir = "%s/include/mace/public" % project_output_dir model_header_dir = "%s/include/mace/public" % project_output_dir
model_data_dir = "%s/data" % project_output_dir model_data_dir = "%s/data" % project_output_dir
hexagon_lib_file = "mace/third_party/nnlib/libhexagon_controller.so" hexagon_lib_file = "third_party/nnlib/libhexagon_controller.so"
model_bin_dir = "%s/%s/" % (project_output_dir, abi) model_bin_dir = "%s/%s/" % (project_output_dir, abi)
if not os.path.exists(model_bin_dir): if not os.path.exists(model_bin_dir):
...@@ -1197,7 +1197,7 @@ def build_run_throughput_test(abi, ...@@ -1197,7 +1197,7 @@ def build_run_throughput_test(abi,
adb_push("codegen/models/%s/%s.data" % dsp_model_tag, adb_push("codegen/models/%s/%s.data" % dsp_model_tag,
phone_data_dir, phone_data_dir,
serialno) serialno)
adb_push("mace/third_party/nnlib/libhexagon_controller.so", adb_push("third_party/nnlib/libhexagon_controller.so",
phone_data_dir, phone_data_dir,
serialno) serialno)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册