├── .bazelrc
├── .bazelversion
├── .clang-format
├── .gitignore
├── .gitlab-ci-new.yml
├── .gitlab-ci.yml
├── .gitmodules
├── .travis.yml
├── BUILD.bazel
├── CMakeLists.txt
├── ISSUE_TEMPLATE.md
├── JOBS.md
├── LICENSE
├── README.md
├── README_zh.md
├── RELEASE.md
├── ROADMAP.md
├── WORKSPACE
├── cmake
└── toolchains
│ ├── aarch64-linux-gnu.cmake
│ ├── arm-linux-gnueabi.cmake
│ ├── arm-linux-gnueabihf.cmake
│ └── ios.toolchain.cmake
├── docker
├── gitlab-runner
│ └── Dockerfile
├── mace-dev-lite
│ └── Dockerfile
├── mace-dev
│ └── Dockerfile
├── mace-dev2.dockerfile
├── mace-micro-dev
│ └── mace-micro-dev.dockerfile
└── update_images.sh
├── docs
├── Makefile
├── README
├── chinese.rst
├── conf.py
├── development
│ ├── adding_a_new_op.md
│ ├── contributing.md
│ ├── data_format.md
│ ├── dynamic_lstm.rst
│ ├── how_to_debug.rst
│ ├── how_to_run_tests.md
│ ├── imgs
│ │ ├── DynamicLSTM.png
│ │ └── FuseLSTM.png
│ └── memory_layout.rst
├── faq.md
├── index.rst
├── installation
│ ├── env_requirement.rst
│ ├── manual_setup.rst
│ └── using_docker.rst
├── introduction.rst
├── mace-arch.png
├── mace-logo.png
├── mace-work-flow-zh.png
├── mace-work-flow.png
├── micro-controllers
│ ├── basic_usage.rst
│ ├── deploy.rst
│ └── op_lists.rst
├── user_guide
│ ├── advanced_usage.rst
│ ├── advanced_usage_cmake.rst
│ ├── basic_usage.rst
│ ├── basic_usage_cmake.rst
│ ├── benchmark.rst
│ ├── devices
│ │ └── demo_device_nanopi.yml
│ ├── models
│ │ ├── demo_models.yml
│ │ ├── demo_models_caffe.yml
│ │ ├── demo_models_cmake.yml
│ │ ├── demo_models_onnx.yml
│ │ └── demo_models_tf.yml
│ ├── op_lists.rst
│ └── quantization_usage.rst
└── zh
│ ├── installation
│ └── env_requirement.rst
│ └── user_guide
│ └── basic_usage.rst
├── examples
└── android
│ ├── .gitignore
│ ├── README.md
│ ├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── mace_demo.jks
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ └── cacheLabel.txt
│ │ ├── java
│ │ └── com
│ │ │ └── xiaomi
│ │ │ └── mace
│ │ │ └── demo
│ │ │ ├── AppModel.java
│ │ │ ├── CameraActivity.java
│ │ │ ├── CameraFactory.java
│ │ │ ├── Constant.java
│ │ │ ├── MaceApp.java
│ │ │ ├── camera
│ │ │ ├── CameraApiLessM.java
│ │ │ ├── CameraApiMoreM.java
│ │ │ ├── CameraEngage.java
│ │ │ ├── CameraTextureView.java
│ │ │ ├── ContextMenuDialog.java
│ │ │ ├── ItemAdapter.java
│ │ │ ├── MessageEvent.java
│ │ │ └── MobilenetResultCallback.java
│ │ │ └── result
│ │ │ ├── InitData.java
│ │ │ ├── LabelCache.java
│ │ │ └── ResultData.java
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ ├── activity_camera.xml
│ │ ├── layout_dialog.xml
│ │ └── layout_item.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── build.gradle
│ ├── build.sh
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── macelibrary
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── build.gradle
│ ├── proguard-rules.pro
│ ├── src
│ │ └── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── cpp
│ │ │ ├── image_classify.cc
│ │ │ └── image_classify.h
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── xiaomi
│ │ │ │ └── mace
│ │ │ │ └── JniMaceUtils.java
│ │ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ └── version_script.lds
│ ├── mobilenet.yml
│ └── settings.gradle
├── include
├── BUILD.bazel
├── CMakeLists.txt
└── mace
│ ├── port
│ ├── env.h
│ ├── file_system.h
│ ├── logger.h
│ ├── port-arch.h
│ └── port.h
│ ├── public
│ └── mace.h
│ └── utils
│ ├── logging.h
│ ├── mace_engine_config.h
│ ├── macros.h
│ ├── memory.h
│ └── string_util.h
├── mace
├── BUILD.bazel
├── CMakeLists.txt
├── codegen
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── model_version_script.lds
│ └── tools
│ │ └── gen_version_source.sh
├── core
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── bfloat16.h
│ ├── flow
│ │ ├── base_flow.cc
│ │ ├── base_flow.h
│ │ ├── common_fp32_flow.cc
│ │ ├── common_fp32_flow.h
│ │ ├── flow_registry.cc
│ │ └── flow_registry.h
│ ├── fp16.h
│ ├── future.h
│ ├── kv_storage.cc
│ ├── kv_storage.h
│ ├── mace_tensor_impl.h
│ ├── memory
│ │ ├── allocator.h
│ │ ├── buffer.h
│ │ ├── general_memory_manager.cc
│ │ ├── general_memory_manager.h
│ │ ├── memory_manager.h
│ │ ├── rpcmem
│ │ │ ├── rpcmem.cc
│ │ │ └── rpcmem.h
│ │ └── slice.h
│ ├── net
│ │ ├── allocate_opt_strategy.cc
│ │ ├── allocate_ref_strategy.cc
│ │ ├── allocate_strategy.h
│ │ ├── base_net.h
│ │ ├── serial_net.cc
│ │ └── serial_net.h
│ ├── net_def_adapter.cc
│ ├── net_def_adapter.h
│ ├── net_optimizer.cc
│ ├── net_optimizer.h
│ ├── ops
│ │ ├── op_condition_builder.cc
│ │ ├── op_condition_builder.h
│ │ ├── op_condition_context.cc
│ │ ├── op_condition_context.h
│ │ ├── op_construct_context.cc
│ │ ├── op_construct_context.h
│ │ ├── op_context.cc
│ │ ├── op_context.h
│ │ ├── op_delegator.h
│ │ ├── op_init_context.cc
│ │ ├── op_init_context.h
│ │ ├── operator.cc
│ │ ├── operator.h
│ │ ├── ops_utils.cc
│ │ └── ops_utils.h
│ ├── proto
│ │ ├── arg_helper.cc
│ │ ├── arg_helper.h
│ │ ├── net_def_helper.cc
│ │ └── net_def_helper.h
│ ├── quantize.cc
│ ├── quantize.h
│ ├── registry
│ │ ├── op_delegator_registry.cc
│ │ ├── op_delegator_registry.h
│ │ ├── op_registration_info.cc
│ │ ├── op_registration_info.h
│ │ ├── ops_registry.cc
│ │ └── ops_registry.h
│ ├── runtime
│ │ ├── runtime.cc
│ │ ├── runtime.h
│ │ ├── runtime_context.h
│ │ ├── runtime_registry.cc
│ │ └── runtime_registry.h
│ ├── runtime_failure_mock.cc
│ ├── runtime_failure_mock.h
│ ├── tensor.cc
│ ├── tensor.h
│ ├── types.cc
│ ├── types.h
│ ├── workspace.cc
│ └── workspace.h
├── flows
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── apu
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── apu_ref_flow.cc
│ │ └── apu_ref_flow.h
│ ├── cpu
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── cpu_bf16_flow.cc
│ │ ├── cpu_bf16_flow.h
│ │ ├── cpu_fp16_flow.cc
│ │ ├── cpu_fp16_flow.h
│ │ ├── cpu_ref_flow.cc
│ │ ├── cpu_ref_flow.h
│ │ ├── transpose_const.cc
│ │ └── transpose_const.h
│ ├── flow_registry.cc
│ ├── hexagon
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── hexagon_ref_flow.cc
│ │ └── hexagon_ref_flow.h
│ ├── opencl
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── opencl_ref_flow.cc
│ │ └── opencl_ref_flow.h
│ └── qnn
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── qnn_ref_flow.cc
│ │ └── qnn_ref_flow.h
├── libmace
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── capability.cc
│ ├── combine_static_libs.sh
│ ├── engines
│ │ ├── base_engine.cc
│ │ ├── base_engine.h
│ │ ├── engine_registry.cc
│ │ ├── engine_registry.h
│ │ ├── serial_engine.cc
│ │ ├── serial_engine.h
│ │ ├── single_flow_engine.cc
│ │ └── single_flow_engine.h
│ ├── gpu_context_builder.cc
│ ├── mace.mri.in
│ ├── mace_engine.cc
│ ├── mace_engine_config.cc
│ ├── mace_tensor.cc
│ └── mace_version_script.lds
├── mace.bzl
├── ops
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── activation.cc
│ ├── activation.h
│ ├── addn.cc
│ ├── argmax.cc
│ ├── arm
│ │ ├── README
│ │ ├── base
│ │ │ ├── activation.cc
│ │ │ ├── activation.h
│ │ │ ├── bias_add.cc
│ │ │ ├── bias_add.h
│ │ │ ├── common_neon.h
│ │ │ ├── conv_2d.cc
│ │ │ ├── conv_2d.h
│ │ │ ├── conv_2d_1x1.cc
│ │ │ ├── conv_2d_1x1.h
│ │ │ ├── conv_2d_1xn.cc
│ │ │ ├── conv_2d_1xn.h
│ │ │ ├── conv_2d_3x3.cc
│ │ │ ├── conv_2d_3x3.h
│ │ │ ├── conv_2d_3x3_winograd.cc
│ │ │ ├── conv_2d_3x3_winograd.h
│ │ │ ├── conv_2d_5x5.cc
│ │ │ ├── conv_2d_5x5.h
│ │ │ ├── conv_2d_7x7.cc
│ │ │ ├── conv_2d_7x7.h
│ │ │ ├── conv_2d_general.cc
│ │ │ ├── conv_2d_general.h
│ │ │ ├── conv_2d_mxn.h
│ │ │ ├── deconv_2d.cc
│ │ │ ├── deconv_2d.h
│ │ │ ├── deconv_2d_2x2.cc
│ │ │ ├── deconv_2d_2x2.h
│ │ │ ├── deconv_2d_3x3.cc
│ │ │ ├── deconv_2d_3x3.h
│ │ │ ├── deconv_2d_4x4.cc
│ │ │ ├── deconv_2d_4x4.h
│ │ │ ├── deconv_2d_general.cc
│ │ │ ├── deconv_2d_general.h
│ │ │ ├── deconv_2d_mxn.h
│ │ │ ├── depthwise_conv_2d_3x3.cc
│ │ │ ├── depthwise_conv_2d_3x3.h
│ │ │ ├── depthwise_conv_2d_mxn.h
│ │ │ ├── depthwise_deconv_2d_3x3.cc
│ │ │ ├── depthwise_deconv_2d_3x3.h
│ │ │ ├── depthwise_deconv_2d_4x4.cc
│ │ │ ├── depthwise_deconv_2d_4x4.h
│ │ │ ├── depthwise_deconv_2d_general.cc
│ │ │ ├── depthwise_deconv_2d_general.h
│ │ │ ├── depthwise_deconv_2d_mxn.h
│ │ │ ├── gemm.cc
│ │ │ ├── gemm.h
│ │ │ ├── gemv.cc
│ │ │ └── gemv.h
│ │ ├── bf16
│ │ │ ├── conv_2d_3x3.cc
│ │ │ └── gemm.cc
│ │ ├── fp16
│ │ │ ├── conv_2d_3x3.cc
│ │ │ ├── depthwise_conv_2d_3x3.cc
│ │ │ ├── gemm.cc
│ │ │ └── gemv.h
│ │ ├── fp32
│ │ │ ├── conv_2d_1xn.cc
│ │ │ ├── conv_2d_3x3.cc
│ │ │ ├── conv_2d_5x5.cc
│ │ │ ├── conv_2d_7x7.cc
│ │ │ ├── deconv_2d_2x2.cc
│ │ │ ├── deconv_2d_3x3.cc
│ │ │ ├── deconv_2d_4x4.cc
│ │ │ ├── depthwise_deconv_2d_3x3.cc
│ │ │ ├── depthwise_deconv_2d_4x4.cc
│ │ │ ├── gemm.cc
│ │ │ └── gemv.cc
│ │ └── q8
│ │ │ ├── activation.cc
│ │ │ ├── bias_add.cc
│ │ │ ├── eltwise.cc
│ │ │ ├── gemv.cc
│ │ │ ├── gemv.h
│ │ │ ├── quantization_util.cc
│ │ │ ├── quantization_util.h
│ │ │ └── quantize.cc
│ ├── batch_norm.cc
│ ├── batch_to_space.cc
│ ├── bias_add.cc
│ ├── cast.cc
│ ├── channel_shuffle.cc
│ ├── common
│ │ ├── activation_type.h
│ │ ├── conv_pool_2d_util.cc
│ │ ├── conv_pool_2d_util.h
│ │ ├── coordinate_transformation_mode.h
│ │ ├── eltwise_type.h
│ │ ├── gemmlowp_util.h
│ │ ├── lstm.h
│ │ ├── matrix.h
│ │ ├── pad_type.h
│ │ ├── pooling_type.h
│ │ ├── reduce_type.h
│ │ ├── utils.cc
│ │ └── utils.h
│ ├── concat.cc
│ ├── conv_2d.cc
│ ├── conv_pool_2d_base.h
│ ├── crop.cc
│ ├── cumsum.cc
│ ├── deconv_2d.cc
│ ├── deconv_2d.h
│ ├── delegator
│ │ ├── activation.h
│ │ ├── bias_add.h
│ │ ├── conv_2d.h
│ │ ├── deconv_2d.h
│ │ ├── depthwise_conv_2d.h
│ │ ├── depthwise_deconv_2d.h
│ │ ├── eltwise.h
│ │ ├── gemm.h
│ │ └── gemv.h
│ ├── depth_to_space.cc
│ ├── depthwise_conv2d.cc
│ ├── depthwise_deconv2d.cc
│ ├── detection_output.cc
│ ├── dynamic_lstm.cc
│ ├── eltwise.cc
│ ├── eltwise.h
│ ├── expand_dims.cc
│ ├── extract_image_patches.cc
│ ├── extract_pooling.cc
│ ├── fill.cc
│ ├── fixpoint.h
│ ├── fully_connected.cc
│ ├── gather.cc
│ ├── group_norm.cc
│ ├── identity.cc
│ ├── ifdefined.cc
│ ├── infer_conv2d_shape.cc
│ ├── instance_norm.cc
│ ├── kaldi_batch_norm.cc
│ ├── local_response_norm.cc
│ ├── lpnorm.cc
│ ├── lstm_nonlinear.cc
│ ├── matmul.cc
│ ├── mvnorm.cc
│ ├── nonlocal_reshape.cc
│ ├── one_hot.cc
│ ├── opencl
│ │ ├── activation.h
│ │ ├── addn.h
│ │ ├── batch_norm.h
│ │ ├── batch_to_space.h
│ │ ├── bias_add.h
│ │ ├── buffer
│ │ │ ├── conv_2d.cc
│ │ │ ├── conv_2d.h
│ │ │ ├── conv_2d_1x1.cc
│ │ │ ├── conv_2d_general.cc
│ │ │ ├── depthwise_conv2d.cc
│ │ │ ├── depthwise_conv2d.h
│ │ │ ├── pooling.cc
│ │ │ ├── pooling.h
│ │ │ ├── reshape.cc
│ │ │ ├── reshape.h
│ │ │ ├── softmax.cc
│ │ │ ├── softmax.h
│ │ │ ├── transpose.cc
│ │ │ ├── transpose.h
│ │ │ ├── utils.cc
│ │ │ └── utils.h
│ │ ├── buffer_transform.cc
│ │ ├── channel_shuffle.h
│ │ ├── cl
│ │ │ ├── activation.cl
│ │ │ ├── addn.cl
│ │ │ ├── batch_norm.cl
│ │ │ ├── batch_to_space.cl
│ │ │ ├── bias_add.cl
│ │ │ ├── buffer_to_image.cl
│ │ │ ├── buffer_transform.cl
│ │ │ ├── channel_shuffle.cl
│ │ │ ├── common.h
│ │ │ ├── concat.cl
│ │ │ ├── conv_2d.cl
│ │ │ ├── conv_2d_1x1.cl
│ │ │ ├── conv_2d_1x1_buffer.cl
│ │ │ ├── conv_2d_3x3.cl
│ │ │ ├── conv_2d_buffer.cl
│ │ │ ├── crop.cl
│ │ │ ├── deconv_2d.cl
│ │ │ ├── depth_to_space.cl
│ │ │ ├── depthwise_conv2d.cl
│ │ │ ├── depthwise_conv2d_buffer.cl
│ │ │ ├── depthwise_deconv2d.cl
│ │ │ ├── eltwise.cl
│ │ │ ├── extract_image_patches.cl
│ │ │ ├── fully_connected.cl
│ │ │ ├── instance_norm.cl
│ │ │ ├── lpnorm.cl
│ │ │ ├── lstmcell.cl
│ │ │ ├── matmul.cl
│ │ │ ├── mvnorm.cl
│ │ │ ├── pad.cl
│ │ │ ├── pooling.cl
│ │ │ ├── pooling_buffer.cl
│ │ │ ├── reduce.cl
│ │ │ ├── resize_bicubic.cl
│ │ │ ├── resize_bilinear.cl
│ │ │ ├── resize_nearest_neighbor.cl
│ │ │ ├── softmax.cl
│ │ │ ├── softmax_buffer.cl
│ │ │ ├── space_to_batch.cl
│ │ │ ├── space_to_depth.cl
│ │ │ ├── split.cl
│ │ │ ├── sqrdiff_mean.cl
│ │ │ ├── transpose.cl
│ │ │ └── winograd_transform.cl
│ │ ├── concat.h
│ │ ├── conv_2d.h
│ │ ├── crop.h
│ │ ├── deconv_2d.h
│ │ ├── depth_to_space.h
│ │ ├── depthwise_conv2d.h
│ │ ├── depthwise_deconv2d.h
│ │ ├── eltwise.h
│ │ ├── extract_image_patches.h
│ │ ├── fully_connected.h
│ │ ├── image
│ │ │ ├── activation.cc
│ │ │ ├── activation.h
│ │ │ ├── addn.cc
│ │ │ ├── addn.h
│ │ │ ├── batch_norm.cc
│ │ │ ├── batch_norm.h
│ │ │ ├── batch_to_space.cc
│ │ │ ├── batch_to_space.h
│ │ │ ├── bias_add.cc
│ │ │ ├── bias_add.h
│ │ │ ├── channel_shuffle.cc
│ │ │ ├── channel_shuffle.h
│ │ │ ├── concat.cc
│ │ │ ├── concat.h
│ │ │ ├── conv_2d.cc
│ │ │ ├── conv_2d.h
│ │ │ ├── conv_2d_1x1.cc
│ │ │ ├── conv_2d_3x3.cc
│ │ │ ├── conv_2d_general.cc
│ │ │ ├── crop.cc
│ │ │ ├── crop.h
│ │ │ ├── deconv_2d.cc
│ │ │ ├── deconv_2d.h
│ │ │ ├── depth_to_space.cc
│ │ │ ├── depth_to_space.h
│ │ │ ├── depthwise_conv2d.cc
│ │ │ ├── depthwise_conv2d.h
│ │ │ ├── depthwise_deconv2d.cc
│ │ │ ├── depthwise_deconv2d.h
│ │ │ ├── eltwise.cc
│ │ │ ├── eltwise.h
│ │ │ ├── extract_image_patches.cc
│ │ │ ├── extract_image_patches.h
│ │ │ ├── fully_connected.cc
│ │ │ ├── fully_connected.h
│ │ │ ├── instance_norm.cc
│ │ │ ├── instance_norm.h
│ │ │ ├── lpnorm.cc
│ │ │ ├── lpnorm.h
│ │ │ ├── lstm_cell.cc
│ │ │ ├── lstm_cell.h
│ │ │ ├── matmul.cc
│ │ │ ├── matmul.h
│ │ │ ├── mvnorm.cc
│ │ │ ├── mvnorm.h
│ │ │ ├── pad.cc
│ │ │ ├── pad.h
│ │ │ ├── pooling.cc
│ │ │ ├── pooling.h
│ │ │ ├── reduce.cc
│ │ │ ├── reduce.h
│ │ │ ├── reshape.cc
│ │ │ ├── reshape.h
│ │ │ ├── resize_bicubic.cc
│ │ │ ├── resize_bicubic.h
│ │ │ ├── resize_bilinear.cc
│ │ │ ├── resize_bilinear.h
│ │ │ ├── resize_nearest_neighbor.cc
│ │ │ ├── resize_nearest_neighbor.h
│ │ │ ├── softmax.cc
│ │ │ ├── softmax.h
│ │ │ ├── space_to_batch.cc
│ │ │ ├── space_to_batch.h
│ │ │ ├── space_to_depth.cc
│ │ │ ├── space_to_depth.h
│ │ │ ├── split.cc
│ │ │ ├── split.h
│ │ │ ├── sqrdiff_mean.cc
│ │ │ ├── sqrdiff_mean.h
│ │ │ └── winograd_conv2d.cc
│ │ ├── instance_norm.h
│ │ ├── lpnorm.h
│ │ ├── lstm_cell.cc
│ │ ├── lstm_cell.h
│ │ ├── matmul.h
│ │ ├── mvnorm.h
│ │ ├── pad.h
│ │ ├── pooling.h
│ │ ├── reduce.h
│ │ ├── reshape.h
│ │ ├── resize_bicubic.h
│ │ ├── resize_bilinear.h
│ │ ├── resize_nearest_neighbor.h
│ │ ├── softmax.h
│ │ ├── space_to_batch.h
│ │ ├── space_to_depth.h
│ │ ├── split.h
│ │ ├── sqrdiff_mean.h
│ │ └── transpose.h
│ ├── pad.cc
│ ├── pad_context.cc
│ ├── pnorm.cc
│ ├── pooling.cc
│ ├── prior_box.cc
│ ├── reduce.cc
│ ├── ref
│ │ ├── activation.cc
│ │ ├── bias_add.cc
│ │ ├── conv_2d.cc
│ │ ├── deconv_2d.cc
│ │ ├── depthwise_conv_2d.cc
│ │ ├── depthwise_deconv_2d.cc
│ │ ├── gemm.cc
│ │ ├── gemv.cc
│ │ └── q8
│ │ │ ├── eltwise.cc
│ │ │ └── gemv.cc
│ ├── registry
│ │ ├── op_delegators_registry.cc
│ │ ├── ops_registry.cc
│ │ └── registry.h
│ ├── replace_index.cc
│ ├── reshape.cc
│ ├── resize_bicubic.cc
│ ├── resize_bilinear.cc
│ ├── resize_nearest_neighbor.cc
│ ├── reverse.cc
│ ├── scalar_math.cc
│ ├── select.cc
│ ├── shape.cc
│ ├── slice.cc
│ ├── softmax.cc
│ ├── space_to_batch.cc
│ ├── space_to_depth.cc
│ ├── splice.cc
│ ├── split.cc
│ ├── sqrdiff_mean.cc
│ ├── squeeze.cc
│ ├── stack.cc
│ ├── strided_slice.cc
│ ├── subsample.cc
│ ├── sum_group.cc
│ ├── target_rms_norm.cc
│ ├── tile.cc
│ ├── transpose.cc
│ ├── unsqueeze.cc
│ ├── unstack.cc
│ └── where.cc
├── port
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── android
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── env.cc
│ │ ├── env.h
│ │ ├── logger.cc
│ │ ├── logger.h
│ │ ├── malloc_logger.cc
│ │ └── malloc_logger.h
│ ├── darwin
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── ar_merge_on_darwin.sh
│ │ ├── env.cc
│ │ └── env.h
│ ├── env.cc
│ ├── file_system.cc
│ ├── linux
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── env.cc
│ │ └── env.h
│ ├── linux_base
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── env.cc
│ │ └── env.h
│ ├── logger.cc
│ ├── posix
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── backtrace.h
│ │ ├── file_system.cc
│ │ ├── file_system.h
│ │ └── time.h
│ └── windows
│ │ ├── CMakeLists.txt
│ │ ├── env.cc
│ │ ├── env.h
│ │ ├── file_system.cc
│ │ └── file_system.h
├── proto
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── mace.proto
│ ├── micro_mem.proto
│ └── qnn_cache.proto
├── python
│ └── tools
│ │ ├── BUILD.bazel
│ │ ├── __init__.py
│ │ ├── archive_static_lib.py
│ │ ├── encrypt_opencl_codegen.py
│ │ ├── file_binary.cc.jinja2
│ │ ├── mace_engine_factory.h.jinja2
│ │ ├── mace_engine_factory_codegen.py
│ │ ├── opencl_binary_codegen.py
│ │ ├── operator.jinja2
│ │ ├── str2vec_maps.cc.jinja2
│ │ └── str2vec_maps.h.jinja2
├── rpcmems
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── dmabufheap
│ │ ├── dma_buf_heap_rpcmem.cc
│ │ ├── dma_buf_heap_rpcmem.h
│ │ ├── dma_buf_heap_wrapper.cc
│ │ └── dma_buf_heap_wrapper.h
│ ├── mtk
│ │ ├── mtk_ion_wrapper.cc
│ │ ├── mtk_ion_wrapper.h
│ │ ├── mtk_rpcmem.cc
│ │ └── mtk_rpcmem.h
│ ├── qualcomm
│ │ ├── qualcomm_rpcmem.cc
│ │ └── qualcomm_rpcmem.h
│ └── rpcmem_factory.cc
├── runtimes
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── apu
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── apu_runtime.cc
│ │ ├── apu_runtime.h
│ │ ├── ion
│ │ │ ├── apu_ion_runtime.cc
│ │ │ └── apu_ion_runtime.h
│ │ ├── v1v2v3
│ │ │ ├── apu_wrapper.h
│ │ │ ├── v1
│ │ │ │ └── apu_wrapper.cc
│ │ │ └── v2v3
│ │ │ │ └── apu_wrapper.cc
│ │ └── v4
│ │ │ ├── apu_wrapper.cc
│ │ │ ├── apu_wrapper.h
│ │ │ ├── neuron_delegate_builder.h
│ │ │ ├── neuron_delegate_kernel.cc
│ │ │ ├── neuron_delegate_kernel.h
│ │ │ ├── neuron_implementation.cc
│ │ │ └── neuron_implementation.h
│ ├── cpu
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── cpu_ref_allocator.cc
│ │ ├── cpu_ref_allocator.h
│ │ ├── cpu_ref_runtime.cc
│ │ ├── cpu_ref_runtime.h
│ │ ├── cpu_runtime.cc
│ │ ├── cpu_runtime.h
│ │ └── ion
│ │ │ ├── cpu_ion_allocator.cc
│ │ │ ├── cpu_ion_allocator.h
│ │ │ ├── cpu_ion_runtime.cc
│ │ │ └── cpu_ion_runtime.h
│ ├── hexagon
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── dsp
│ │ │ ├── hexagon_dsp_ops.h
│ │ │ ├── hexagon_dsp_runtime.cc
│ │ │ ├── hexagon_dsp_runtime.h
│ │ │ ├── hexagon_dsp_wrapper.cc
│ │ │ └── hexagon_dsp_wrapper.h
│ │ ├── hexagon_base_runtime.cc
│ │ ├── hexagon_base_runtime.h
│ │ ├── hexagon_control_wrapper.h
│ │ └── hta
│ │ │ ├── hexagon_hta_ops.h
│ │ │ ├── hexagon_hta_runtime.cc
│ │ │ ├── hexagon_hta_runtime.h
│ │ │ ├── hexagon_hta_transformer.cc
│ │ │ ├── hexagon_hta_transformer.h
│ │ │ ├── hexagon_hta_wrapper.cc
│ │ │ ├── hexagon_hta_wrapper.h
│ │ │ └── opencl
│ │ │ ├── hexagon_hta_opencl_runtime.cc
│ │ │ └── hexagon_hta_opencl_runtime.h
│ ├── opencl
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── core
│ │ │ ├── cl2_header.h
│ │ │ ├── opencl_context.cc
│ │ │ ├── opencl_context.h
│ │ │ ├── opencl_executor.cc
│ │ │ ├── opencl_executor.h
│ │ │ ├── opencl_extension.h
│ │ │ ├── opencl_helper.cc
│ │ │ ├── opencl_helper.h
│ │ │ ├── opencl_util.cc
│ │ │ ├── opencl_util.h
│ │ │ └── opencl_wrapper.cc
│ │ ├── mtk_ion
│ │ │ ├── opencl_base_mtk_ion_allocator.cc
│ │ │ ├── opencl_base_mtk_ion_allocator.h
│ │ │ ├── opencl_buffer_mtk_ion_allocator.cc
│ │ │ ├── opencl_buffer_mtk_ion_allocator.h
│ │ │ ├── opencl_image_mtk_ion_allocator.cc
│ │ │ ├── opencl_image_mtk_ion_allocator.h
│ │ │ ├── opencl_mtk_ion_executor.cc
│ │ │ ├── opencl_mtk_ion_executor.h
│ │ │ ├── opencl_mtk_ion_runtime.cc
│ │ │ └── opencl_mtk_ion_runtime.h
│ │ ├── opencl_buffer_allocator.cc
│ │ ├── opencl_buffer_allocator.h
│ │ ├── opencl_image_allocator.cc
│ │ ├── opencl_image_allocator.h
│ │ ├── opencl_image_manager.cc
│ │ ├── opencl_image_manager.h
│ │ ├── opencl_ref_runtime.cc
│ │ ├── opencl_ref_runtime.h
│ │ ├── opencl_runtime.cc
│ │ ├── opencl_runtime.h
│ │ ├── qc_ion
│ │ │ ├── opencl_base_qc_ion_allocator.cc
│ │ │ ├── opencl_base_qc_ion_allocator.h
│ │ │ ├── opencl_buffer_qc_ion_allocator.cc
│ │ │ ├── opencl_buffer_qc_ion_allocator.h
│ │ │ ├── opencl_image_qc_ion_allocator.cc
│ │ │ ├── opencl_image_qc_ion_allocator.h
│ │ │ ├── opencl_qc_ion_executor.cc
│ │ │ ├── opencl_qc_ion_executor.h
│ │ │ ├── opencl_qc_ion_runtime.cc
│ │ │ └── opencl_qc_ion_runtime.h
│ │ └── transform
│ │ │ ├── buffer_to_image.cc
│ │ │ ├── buffer_to_image.h
│ │ │ ├── buffer_transform.cc
│ │ │ ├── buffer_transform.h
│ │ │ ├── buffer_transform_kernel.h
│ │ │ ├── buffer_transformer.cc
│ │ │ ├── buffer_transformer.h
│ │ │ ├── buffer_type_transform.cc
│ │ │ ├── image_to_buffer.cc
│ │ │ └── image_to_buffer.h
│ ├── qnn
│ │ ├── BUILD.bazel
│ │ ├── CMakeLists.txt
│ │ ├── common.h
│ │ ├── op_builder.cc
│ │ ├── op_builder.h
│ │ ├── opencl
│ │ │ ├── qnn_opencl_runtime.cc
│ │ │ └── qnn_opencl_runtime.h
│ │ ├── ops
│ │ │ ├── activation_op_builder.cc
│ │ │ ├── argmax_op_builder.cc
│ │ │ ├── batch_norm_op_builder.cc
│ │ │ ├── cast_op_builder.cc
│ │ │ ├── concat_op_builder.cc
│ │ │ ├── conv2d_op_builder.cc
│ │ │ ├── conv_pool_2d_util.cc
│ │ │ ├── conv_pool_2d_util.h
│ │ │ ├── deconv2d_op_builder.cc
│ │ │ ├── depth_to_space_op_builder.cc
│ │ │ ├── eltwise_op_builder.cc
│ │ │ ├── expand_dims_op_builder.cc
│ │ │ ├── fully_connected_op_builder.cc
│ │ │ ├── gather_op_builder.cc
│ │ │ ├── instance_norm_op_builder.cc
│ │ │ ├── matmul_op_builder.cc
│ │ │ ├── moments_op_builder.cc
│ │ │ ├── pack_op_builder.cc
│ │ │ ├── pad_op_builder.cc
│ │ │ ├── pooling_op_builder.cc
│ │ │ ├── quantize_op_builder.cc
│ │ │ ├── reduce_op_builder.cc
│ │ │ ├── reshape_op_builder.cc
│ │ │ ├── resize_op_builder.cc
│ │ │ ├── softmax_op_builder.cc
│ │ │ ├── space_to_depth_op_builder.cc
│ │ │ ├── split_op_builder.cc
│ │ │ ├── squeeze_op_builder.cc
│ │ │ ├── strided_slice_op_builder.cc
│ │ │ ├── tile_op_builder.cc
│ │ │ └── transpose_op_builder.cc
│ │ ├── qnn_base_runtime.cc
│ │ ├── qnn_base_runtime.h
│ │ ├── qnn_performance.cc
│ │ ├── qnn_performance.h
│ │ ├── qnn_runtime.cc
│ │ ├── qnn_runtime.h
│ │ ├── qnn_wrapper.cc
│ │ └── qnn_wrapper.h
│ └── runtime_registry.cc
├── tools
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ └── mace_run.cc
└── utils
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ ├── conf_util.h
│ ├── count_down_latch.h
│ ├── math.h
│ ├── rwlock.h
│ ├── spinlock.h
│ ├── statistics.cc
│ ├── statistics.h
│ ├── status.cc
│ ├── stl_util.h
│ ├── string_util.cc
│ ├── thread_pool.cc
│ ├── thread_pool.h
│ ├── timer.h
│ ├── transpose.h
│ └── tuner.h
├── micro
├── CMakeLists.txt
├── base
│ ├── CMakeLists.txt
│ ├── logger.cc
│ ├── logger.h
│ ├── logging.h
│ ├── serialize.cc
│ ├── serialize.h
│ ├── serialize_type.h
│ ├── types.h
│ ├── utils.cc
│ ├── utils.h
│ ├── value_to_str.cc
│ └── value_to_str.h
├── cmake
│ ├── config_gcc_arm.cmake
│ ├── find_hexagon_sdk.cmake
│ └── toolchain
│ │ ├── gcc-arm-none-eabi.cmake
│ │ ├── hexagon6.toolchain.cmake
│ │ ├── hexagon8.toolchain.cmake
│ │ └── xcc.cmake
├── codegen
│ └── CMakeLists.txt
├── examples
│ ├── CMakeLists.txt
│ ├── classifier
│ │ ├── .gitignore
│ │ ├── .mbed
│ │ ├── CMakeLists.txt
│ │ ├── main.cc
│ │ └── mbed-os.lib
│ ├── data
│ │ ├── data.h
│ │ ├── har.h
│ │ ├── kws.h
│ │ └── mnist.h
│ └── runtime_load_model
│ │ ├── CMakeLists.txt
│ │ └── main.cc
├── framework
│ ├── CMakeLists.txt
│ ├── graph.cc
│ ├── graph.h
│ ├── micro_engine.cc
│ ├── op_context.cc
│ ├── op_context.h
│ ├── operator.cc
│ ├── operator.h
│ ├── scratch_buffer.cc
│ └── scratch_buffer.h
├── include
│ ├── CMakeLists.txt
│ ├── port
│ │ └── define.h
│ ├── public
│ │ └── micro.h
│ └── utils
│ │ ├── bfloat16.h
│ │ └── macros.h
├── model
│ ├── CMakeLists.txt
│ ├── argument.cc
│ ├── argument.h
│ ├── const_tensor.cc
│ ├── const_tensor.h
│ ├── input_output_info.cc
│ ├── input_output_info.h
│ ├── net_def.cc
│ ├── net_def.h
│ ├── operator_def.cc
│ ├── operator_def.h
│ ├── output_shape.cc
│ └── output_shape.h
├── ops
│ ├── CMakeLists.txt
│ ├── activation.cc
│ ├── activation.h
│ ├── argmax.h
│ ├── bias_add.cc
│ ├── bias_add.h
│ ├── cast.h
│ ├── cmsis_nn
│ │ ├── CMakeLists.txt
│ │ ├── arm_conv_2d_int8.cc
│ │ ├── arm_conv_2d_int8.h
│ │ ├── arm_depthwise_conv_2d_int8.cc
│ │ ├── arm_depthwise_conv_2d_int8.h
│ │ ├── arm_eltwise_int8.cc
│ │ ├── arm_eltwise_int8.h
│ │ ├── arm_mat_mul_int8.cc
│ │ ├── arm_mat_mul_int8.h
│ │ ├── arm_pooling_int8.cc
│ │ ├── arm_pooling_int8.h
│ │ ├── arm_softmax_int8.cc
│ │ ├── arm_softmax_int8.h
│ │ ├── dequantize.cc
│ │ ├── dequantize.h
│ │ ├── quantize.cc
│ │ ├── quantize.h
│ │ ├── utilities.cc
│ │ └── utilities.h
│ ├── concat.h
│ ├── eltwise.cc
│ ├── eltwise.h
│ ├── expand_dims.cc
│ ├── expand_dims.h
│ ├── matmul.cc
│ ├── matmul.h
│ ├── nhwc
│ │ ├── CMakeLists.txt
│ │ ├── base
│ │ │ ├── conv_2d_base.cc
│ │ │ ├── conv_2d_base.h
│ │ │ ├── depthwise_conv_2d_base.cc
│ │ │ ├── depthwise_conv_2d_base.h
│ │ │ ├── filter_op_base.cc
│ │ │ ├── filter_op_base.h
│ │ │ ├── pooling_base.cc
│ │ │ └── pooling_base.h
│ │ ├── batch_norm.cc
│ │ ├── batch_norm.h
│ │ ├── conv_2d_c2_s4.cc
│ │ ├── conv_2d_c2_s4.h
│ │ ├── conv_2d_c3_s4.cc
│ │ ├── conv_2d_c3_s4.h
│ │ ├── conv_2d_c4_s4.cc
│ │ ├── conv_2d_c4_s4.h
│ │ ├── conv_2d_ref.cc
│ │ ├── conv_2d_ref.h
│ │ ├── depthwise_conv_2d_kb1_s4.cc
│ │ ├── depthwise_conv_2d_kb1_s4.h
│ │ ├── depthwise_conv_2d_kb2_s4.cc
│ │ ├── depthwise_conv_2d_kb2_s4.h
│ │ ├── depthwise_conv_2d_kb3_s4.cc
│ │ ├── depthwise_conv_2d_kb3_s4.h
│ │ ├── depthwise_conv_2d_kb4_s4.cc
│ │ ├── depthwise_conv_2d_kb4_s4.h
│ │ ├── depthwise_conv_2d_ref.cc
│ │ ├── depthwise_conv_2d_ref.h
│ │ ├── pooling_ref.cc
│ │ ├── pooling_ref.h
│ │ ├── pooling_s4.cc
│ │ └── pooling_s4.h
│ ├── reduce.cc
│ ├── reduce.h
│ ├── reshape.h
│ ├── shape.cc
│ ├── shape.h
│ ├── softmax.cc
│ ├── softmax.h
│ ├── squeeze.cc
│ ├── squeeze.h
│ ├── stack.h
│ ├── strided_slice.h
│ ├── utils
│ │ ├── activation.cc
│ │ ├── activation.h
│ │ ├── crumb_utils.cc
│ │ ├── crumb_utils.h
│ │ ├── gemm.cc
│ │ ├── gemm.h
│ │ ├── gemv.cc
│ │ ├── gemv.h
│ │ └── matrix.h
│ └── xtensa
│ │ ├── CMakeLists.txt
│ │ ├── conv_2d_xtensa.cc
│ │ ├── conv_2d_xtensa.h
│ │ ├── depthwise_conv_2d_xtensa.cc
│ │ ├── depthwise_conv_2d_xtensa.h
│ │ ├── matmul_xtensa.cc
│ │ └── matmul_xtensa.h
├── port
│ ├── CMakeLists.txt
│ ├── api.cc
│ └── api.h
├── pretrained_models
│ ├── har-cnn
│ │ ├── har-cnn-bf16.yml
│ │ └── har-cnn.yml
│ ├── keras
│ │ ├── README.md
│ │ ├── har
│ │ │ ├── har-int8.yml
│ │ │ └── har.yml
│ │ └── mnist
│ │ │ ├── mnist-hifi4.yml
│ │ │ ├── mnist-int8.yml
│ │ │ ├── mnist.yml
│ │ │ └── mnist_keras.py
│ └── tensorflow
│ │ ├── README.md
│ │ └── kws
│ │ ├── kws-tc_resnet8-bf16.yml
│ │ ├── kws-tc_resnet8-hifi4.yml
│ │ └── kws-tc_resnet8.yml
├── test
│ ├── CMakeLists.txt
│ ├── ccbaseline
│ │ ├── CMakeLists.txt
│ │ ├── macemc
│ │ │ └── rpc
│ │ │ │ ├── macemc.idl
│ │ │ │ ├── skel
│ │ │ │ ├── macemc.cc
│ │ │ │ └── micro_tester.cc
│ │ │ │ └── stub
│ │ │ │ ├── macemc.cc
│ │ │ │ └── macemc.h
│ │ └── test_baseline_main.cc
│ ├── ccbenchmark
│ │ ├── CMakeLists.txt
│ │ └── micro
│ │ │ ├── benchmark_utils
│ │ │ ├── test_benchmark.cc
│ │ │ └── test_benchmark.h
│ │ │ ├── ops
│ │ │ ├── activation_benchmark.cc
│ │ │ ├── bias_add_benchmark.cc
│ │ │ ├── eltwise_benchmark.cc
│ │ │ ├── matmul_benchmark.cc
│ │ │ ├── nhwc
│ │ │ │ ├── batch_norm_benchmark.cc
│ │ │ │ ├── conv_2d_benchmark.cc
│ │ │ │ ├── conv_2d_opt_benchmark.cc
│ │ │ │ ├── depthwise_conv_2d_benchmark.cc
│ │ │ │ ├── depthwise_conv_2d_opt_benchmark.cc
│ │ │ │ └── pooling_benchmark.cc
│ │ │ ├── reduce_benchmark.cc
│ │ │ └── softmax_benchmark.cc
│ │ │ ├── rpc
│ │ │ ├── benchmark.idl
│ │ │ ├── skel
│ │ │ │ └── benchmark.c
│ │ │ └── stub
│ │ │ │ ├── benchmark.cc
│ │ │ │ └── benchmark.h
│ │ │ └── test_benchmark_main.cc
│ ├── ccunit
│ │ ├── CMakeLists.txt
│ │ └── micro
│ │ │ ├── codegen
│ │ │ └── engine_test.cc
│ │ │ ├── framework
│ │ │ └── graph_test.cc
│ │ │ ├── model
│ │ │ └── net_def_test.cc
│ │ │ └── ops
│ │ │ ├── activation_test.cc
│ │ │ ├── argmax_test.cc
│ │ │ ├── bias_add_test.cc
│ │ │ ├── concat_test.cc
│ │ │ ├── eltwise_test.cc
│ │ │ ├── expand_dims_test.cc
│ │ │ ├── matmul_test.cc
│ │ │ ├── nhwc
│ │ │ ├── batch_norm_test.cc
│ │ │ ├── conv_2d_opt_test.cc
│ │ │ ├── conv_2d_test.cc
│ │ │ ├── depthwise_conv_2d_opt_test.cc
│ │ │ ├── depthwise_conv_2d_test.cc
│ │ │ └── pooling_test.cc
│ │ │ ├── reduce_test.cc
│ │ │ ├── reshape_test.cc
│ │ │ ├── shape_test.cc
│ │ │ ├── softmax_test.cc
│ │ │ ├── squeeze_test.cc
│ │ │ ├── stack_test.cc
│ │ │ └── strided_slice_test.cc
│ └── ccutils
│ │ ├── CMakeLists.txt
│ │ ├── micro
│ │ ├── common
│ │ │ ├── global_buffer.cc
│ │ │ └── global_buffer.h
│ │ └── ops
│ │ │ ├── gtest_utils.h
│ │ │ ├── operator.test.cc
│ │ │ ├── substitute_op.cc
│ │ │ ├── substitute_op.h
│ │ │ ├── test_quantize_utils.h
│ │ │ ├── test_utils.cc
│ │ │ └── test_utils.h
│ │ └── rpc
│ │ ├── qaic.sh
│ │ ├── skel
│ │ ├── base_func.cc
│ │ └── base_func.h
│ │ └── stub
│ │ ├── base_handle.cc
│ │ └── base_handle.h
└── tools
│ ├── CMakeLists.txt
│ ├── build_docker.sh
│ ├── ci
│ ├── build_mbed_example.sh
│ ├── cross_build.sh
│ ├── host_build_and_run_examples.sh
│ ├── host_build_and_run_tests.sh
│ └── model_convert.sh
│ ├── cmake
│ ├── cmake-build-arm64-v8a-hexagon-stub.sh
│ ├── cmake-build-gcc-arm-none-eabi.sh
│ ├── cmake-build-hexagon6.sh
│ ├── cmake-build-hexagon8.sh
│ ├── cmake-build-host.sh
│ └── cmake-build-xcc.sh
│ ├── combine_static_libs.sh
│ └── micro_run.cc
├── repository
├── git
│ ├── BUILD.bazel
│ ├── BUILD.bazel.tpl
│ └── git_configure.bzl
└── opencl-kernel
│ ├── BUILD.bazel
│ ├── BUILD.bazel.tpl
│ └── opencl_kernel_configure.bzl
├── setup
├── optionals.txt
└── requirements.txt
├── test
├── CMakeLists.txt
├── ccbenchmark
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ └── mace
│ │ ├── benchmark_utils
│ │ ├── test_benchmark.cc
│ │ ├── test_benchmark.h
│ │ └── test_benchmark_main.cc
│ │ └── ops
│ │ ├── activation_benchmark.cc
│ │ ├── addn_benchmark.cc
│ │ ├── batch_norm_benchmark.cc
│ │ ├── batch_to_space_benchmark.cc
│ │ ├── bias_add_benchmark.cc
│ │ ├── buffer_to_image_benchmark.cc
│ │ ├── channel_shuffle_benchmark.cc
│ │ ├── concat_benchmark.cc
│ │ ├── conv_2d_benchmark.cc
│ │ ├── crop_benchmark.cc
│ │ ├── cumsum_benchmark.cc
│ │ ├── deconv_2d_benchmark.cc
│ │ ├── depth_to_space_benchmark.cc
│ │ ├── depthwise_conv2d_benchmark.cc
│ │ ├── depthwise_deconv2d_benchmark.cc
│ │ ├── dynamic_lstm_benchmark.cc
│ │ ├── eltwise_benchmark.cc
│ │ ├── extract_pooling_benchmark.cc
│ │ ├── fully_connected_benchmark.cc
│ │ ├── gather_benchmark.cc
│ │ ├── kaldi_batch_norm_benchmark.cc
│ │ ├── local_response_norm_benchmark.cc
│ │ ├── lstm_nonlinear_benchmark.cc
│ │ ├── lstmcell_benchmark.cc
│ │ ├── matmul_benchmark.cc
│ │ ├── memory_benchmark.cc
│ │ ├── one_hot_benchmark.cc
│ │ ├── pad_benchmark.cc
│ │ ├── pad_context_benchmark.cc
│ │ ├── pnorm_benchmark.cc
│ │ ├── pooling_benchmark.cc
│ │ ├── prior_box_benchmark.cc
│ │ ├── quantize_benchmark.cc
│ │ ├── reduce_benchmark.cc
│ │ ├── resize_bicubic_benchmark.cc
│ │ ├── resize_bilinear_benchmark.cc
│ │ ├── resize_nearest_neighbor_benchmark.cc
│ │ ├── reverse_benchmark.cc
│ │ ├── slice_benchmark.cc
│ │ ├── softmax_benchmark.cc
│ │ ├── space_to_batch_benchmark.cc
│ │ ├── space_to_depth_benchmark.cc
│ │ ├── splice_benchmark.cc
│ │ ├── split_benchmark.cc
│ │ ├── sqrdiff_mean_benchmark.cc
│ │ ├── sum_group_benchmark.cc
│ │ ├── target_rms_norm_benchmark.cc
│ │ ├── thread_pool_benchmark.cc
│ │ ├── tile_benchmark.cc
│ │ └── transpose_benchmark.cc
├── ccunit
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ └── mace
│ │ ├── core
│ │ └── runtime
│ │ │ └── hexagon
│ │ │ └── hta_transform_test.cc
│ │ ├── libmace
│ │ ├── device_capability_api_test.cc
│ │ ├── mace_api_exception_test.cc
│ │ ├── mace_api_mt_test.cc
│ │ ├── mace_api_test.cc
│ │ └── mace_api_test.h
│ │ ├── ops
│ │ ├── activation_test.cc
│ │ ├── addn_test.cc
│ │ ├── argmax_test.cc
│ │ ├── arm
│ │ │ ├── arm82
│ │ │ │ └── gemm_test.cc
│ │ │ ├── bf16
│ │ │ │ └── gemm_test.cc
│ │ │ ├── fp32
│ │ │ │ ├── gemm_test.cc
│ │ │ │ └── gemv_test.cc
│ │ │ └── q8
│ │ │ │ └── gemv_test.cc
│ │ ├── batch_norm_test.cc
│ │ ├── bias_add_test.cc
│ │ ├── buffer_to_image_test.cc
│ │ ├── buffer_transform_test.cc
│ │ ├── cast_test.cc
│ │ ├── channel_shuffle_test.cc
│ │ ├── concat_test.cc
│ │ ├── conv_2d_test.cc
│ │ ├── crop_test.cc
│ │ ├── cumsum_test.cc
│ │ ├── deconv_2d_test.cc
│ │ ├── depth_to_space_test.cc
│ │ ├── depthwise_conv2d_test.cc
│ │ ├── depthwise_deconv2d_test.cc
│ │ ├── detection_output_test.cc
│ │ ├── eltwise_test.cc
│ │ ├── expand_dims_test.cc
│ │ ├── extract_image_patches_test.cc
│ │ ├── extract_pooling_test.cc
│ │ ├── fill_test.cc
│ │ ├── fixpoint_test.cc
│ │ ├── folded_batch_norm_test.cc
│ │ ├── fully_connected_test.cc
│ │ ├── gather_test.cc
│ │ ├── group_norm_test.cc
│ │ ├── identity_test.cc
│ │ ├── infer_conv2d_shape_test.cc
│ │ ├── instance_norm_test.cc
│ │ ├── kaldi_batch_norm_test.cc
│ │ ├── local_response_norm_test.cc
│ │ ├── lpnorm_test.cc
│ │ ├── lstmcell_test.cc
│ │ ├── matmul_test.cc
│ │ ├── mvnorm_test.cc
│ │ ├── one_hot_test.cc
│ │ ├── opencl
│ │ │ └── out_of_range_check_test.cc
│ │ ├── pad_context_test.cc
│ │ ├── pad_test.cc
│ │ ├── pnorm_test.cc
│ │ ├── pooling_test.cc
│ │ ├── prior_box_test.cc
│ │ ├── quantize_test.cc
│ │ ├── reduce_test.cc
│ │ ├── reshape_test.cc
│ │ ├── resize_bicubic_test.cc
│ │ ├── resize_bilinear_test.cc
│ │ ├── resize_nearest_neighbor_test.cc
│ │ ├── reverse_test.cc
│ │ ├── scalar_math_test.cc
│ │ ├── select_test.cc
│ │ ├── shape_test.cc
│ │ ├── slice_test.cc
│ │ ├── softmax_test.cc
│ │ ├── space_to_batch_test.cc
│ │ ├── space_to_depth_test.cc
│ │ ├── splice_test.cc
│ │ ├── split_test.cc
│ │ ├── sqrdiff_mean_test.cc
│ │ ├── squeeze_test.cc
│ │ ├── stack_test.cc
│ │ ├── strided_slice_test.cc
│ │ ├── sum_group_test.cc
│ │ ├── target_rms_norm_test.cc
│ │ ├── tile_test.cc
│ │ ├── transpose_test.cc
│ │ ├── unstack_test.cc
│ │ └── where_test.cc
│ │ ├── port
│ │ ├── env_test.cc
│ │ └── logger_test.cc
│ │ └── utils
│ │ ├── count_down_latch_test.cc
│ │ ├── logging_test.cc
│ │ ├── spinlock_test.cc
│ │ ├── string_util_test.cc
│ │ ├── thread_pool_test.cc
│ │ └── tuner_test.cc
├── ccutils
│ ├── BUILD.bazel
│ ├── CMakeLists.txt
│ └── mace
│ │ └── ops
│ │ ├── lstmcell_test_util.h
│ │ ├── ops_test_util.cc
│ │ ├── ops_test_util.h
│ │ └── testing
│ │ └── test_utils.h
└── ci-mace-models
│ ├── onnx-models
│ └── pytorch2onnx
│ │ ├── reduce_test
│ │ ├── reduce_test_max_channel_103
│ │ │ └── reduce_test.gpu.fp16.speedupDownload.yml
│ │ ├── reduce_test_mean_channel_1003
│ │ │ └── reduce_test.gpu.fp32.speedupDownload.yml
│ │ ├── reduce_test_mean_channel_1024
│ │ │ └── reduce_test.gpu.fp32.speedupDownload.yml
│ │ ├── reduce_test_min_channel_1003
│ │ │ └── reduce_test.gpu.fp16.speedupDownload.yml
│ │ ├── reduce_test_prod_channel_101
│ │ │ └── reduce_test.gpu.fp32.speedupDownload.yml
│ │ ├── reduce_test_prod_channel_102
│ │ │ └── reduce_test.gpu.fp32.speedupDownload.yml
│ │ └── reduce_test_sum_channel_1003
│ │ │ └── reduce_test.gpu.fp32.speedupDownload.yml
│ │ └── test_const_input
│ │ ├── test_const_input.cpu.yml
│ │ ├── test_const_input.gpu.fp16.yml
│ │ └── test_const_input.gpu.fp32.yml
│ ├── run-ci-test-model.sh
│ └── tf-models
│ └── test_const_input
│ ├── test_const_input.cpu.yml
│ ├── test_const_input.gpu.fp16.yml
│ └── test_const_input.gpu.fp32.yml
├── third_party
├── apu
│ ├── BUILD
│ ├── LICENSE
│ ├── android_Q
│ │ ├── mt67xx
│ │ │ ├── ApuFrontend.h
│ │ │ ├── libapu-frontend.so
│ │ │ ├── mt6779
│ │ │ │ └── libapu-platform.so
│ │ │ └── mt6785
│ │ │ │ └── libapu-platform.so
│ │ └── mt68xx
│ │ │ ├── libapu-frontend.so
│ │ │ ├── mt6853
│ │ │ ├── libapu-frontend.so
│ │ │ └── libapu-platform.so
│ │ │ ├── mt6873
│ │ │ ├── libapu-frontend.so
│ │ │ └── libapu-platform.so
│ │ │ └── mt6885
│ │ │ ├── libapu-frontend.so
│ │ │ └── libapu-platform.so
│ ├── android_R
│ │ ├── ApuFrontend.h
│ │ ├── libapu-apuwareapusys.mtk.so
│ │ ├── libapu-apuwareutils.mtk.so
│ │ ├── libapu-apuwarexrp.mtk.so
│ │ ├── libapu-frontend.so
│ │ └── libapu-platform.so
│ ├── android_R2
│ │ └── neuron_types.h
│ └── apu.cmake
├── caffe
│ ├── BUILD.bazel
│ ├── Dockerfile
│ ├── LICENSE
│ ├── caffe.cmake
│ └── caffe.proto
├── compilers
│ ├── aarch64_compiler.BUILD
│ └── arm_compiler.BUILD
├── dmabufheap
│ ├── BUILD.bazel
│ ├── dmabufheap.cmake
│ └── include
│ │ ├── BufferAllocatorWrapper.h
│ │ └── dmabufheap-defs.h
├── eigen3
│ ├── BUILD.bazel
│ ├── Eigen
│ │ ├── Cholesky
│ │ ├── Core
│ │ ├── Eigenvalues
│ │ ├── LU
│ │ ├── QR
│ │ └── SVD
│ ├── LICENSE
│ ├── eigen.BUILD
│ ├── eigen3.cmake
│ └── unsupported
│ │ └── Eigen
│ │ ├── CXX11
│ │ ├── Core
│ │ ├── FixedPoint
│ │ ├── NeuralNetworks
│ │ ├── Tensor
│ │ ├── ThreadPool
│ │ └── src
│ │ │ ├── FixedPoint
│ │ │ ├── FixedPointTypes.h
│ │ │ ├── MatMatProduct.h
│ │ │ ├── MatMatProductAVX2.h
│ │ │ ├── MatMatProductNEON.h
│ │ │ ├── MatVecProduct.h
│ │ │ ├── PacketMathAVX2.h
│ │ │ ├── PacketMathAVX512.h
│ │ │ ├── TypeCastingAVX2.h
│ │ │ └── TypeCastingAVX512.h
│ │ │ └── NeuralNetworks
│ │ │ ├── Activations.h
│ │ │ ├── Attention.h
│ │ │ ├── BackwardCuboidConvolutions.h
│ │ │ ├── BackwardSpatialConvolutions.h
│ │ │ ├── CuboidConvolution.h
│ │ │ ├── Patch3d.h
│ │ │ ├── Pooling.h
│ │ │ ├── SoftMax.h
│ │ │ ├── SpatialConvolutions.h
│ │ │ └── TensorConvolutionByFFT.h
│ │ └── SpecialFunctions
├── gemmlowp
│ ├── LICENSE
│ └── gemmlowp.cmake
├── gflags
│ ├── COPYING.txt
│ └── gflags.cmake
├── googletest
│ ├── LICENSE
│ ├── googletest.BUILD
│ └── googletest.cmake
├── half
│ ├── LICENSE.txt
│ ├── half.BUILD
│ └── half.cmake
├── hexagon
│ ├── hexagon_sdk.BUILD
│ └── hexagon_tools.BUILD
├── mtk_rpcmem
│ ├── BUILD.bazel
│ ├── includes
│ │ ├── libion
│ │ │ └── ion.h
│ │ ├── libion_mtk
│ │ │ └── ion.h
│ │ └── linux
│ │ │ └── ion_drv.h
│ ├── libs
│ │ └── arm64-v8a
│ │ │ ├── libion.so
│ │ │ └── libion_mtk.so
│ └── mtk_rpcmem.cmake
├── nnlib
│ ├── BUILD.bazel
│ ├── arm64-v8a
│ │ ├── libcdsprpc.so
│ │ └── libhexagon_controller.so
│ ├── armeabi-v7a
│ │ └── libhexagon_controller.so
│ ├── hexagon_nn.h
│ ├── hexnn_dsp_controller.h
│ ├── license.txt
│ ├── nnlib.cmake
│ ├── ops.h
│ ├── v60
│ │ └── libhexagon_nn_skel.so
│ ├── v65
│ │ └── libhexagon_nn_skel.so
│ └── v66
│ │ └── libhexagon_nn_skel.so
├── opencl-clhpp
│ ├── LICENSE.txt
│ ├── opencl-clhpp.BUILD
│ └── opencl-clhpp.cmake
├── opencl-headers
│ ├── LICENSE
│ ├── opencl-headers.BUILD
│ └── opencl-headers.cmake
├── protobuf
│ ├── LICENSE
│ └── protobuf.cmake
├── rpcmem
│ ├── BUILD.bazel
│ ├── arm64-v8a
│ │ └── rpcmem.a
│ ├── armeabi-v7a
│ │ └── rpcmem.a
│ ├── license.txt
│ ├── rpcmem.cmake
│ └── rpcmem.h
├── six
│ ├── LICENSE
│ └── six.BUILD
├── tflite
│ ├── LICENSE
│ └── tflite.cmake
└── third_party.cmake
└── tools
├── aarch64_compiler
├── BUILD.bazel
├── CROSSTOOL
└── linaro_linux_gcc
│ ├── BUILD.bazel
│ ├── aarch64-linux-gnu-ar
│ ├── aarch64-linux-gnu-as
│ ├── aarch64-linux-gnu-gcc
│ ├── aarch64-linux-gnu-gcov
│ ├── aarch64-linux-gnu-ld
│ ├── aarch64-linux-gnu-nm
│ ├── aarch64-linux-gnu-objcopy
│ ├── aarch64-linux-gnu-objdump
│ └── aarch64-linux-gnu-strip
├── accuracy_validator.py
├── arm_compiler
├── BUILD.bazel
├── CROSSTOOL
└── linaro_linux_gcc
│ ├── BUILD.bazel
│ ├── arm-linux-gnueabihf-ar
│ ├── arm-linux-gnueabihf-as
│ ├── arm-linux-gnueabihf-gcc
│ ├── arm-linux-gnueabihf-gcov
│ ├── arm-linux-gnueabihf-ld
│ ├── arm-linux-gnueabihf-nm
│ ├── arm-linux-gnueabihf-objcopy
│ ├── arm-linux-gnueabihf-objdump
│ └── arm-linux-gnueabihf-strip
├── bazel.rc
├── bazel_adb_run.py
├── bazel_build_standalone_lib.sh
├── clear_workspace.sh
├── cmake
├── cmake-build-aarch64-linux-gnu.sh
├── cmake-build-arm-linux-gnueabihf.sh
├── cmake-build-arm64-v8a.sh
├── cmake-build-armeabi-v7a.sh
├── cmake-build-host.sh
└── cmake-generate-proto-py-host.sh
├── common.py
├── converter.py
├── cpplint.sh
├── dana
├── __init__.py
├── dana_cli.py
└── dana_util.py
├── device.py
├── extract_pooling.py
├── generate_data.py
├── hexagon_compiler
├── BUILD.bazel
├── CROSSTOOL
└── hexagon_gcc
│ ├── BUILD.bazel
│ ├── hexagon-qualcomm-ar
│ ├── hexagon-qualcomm-as
│ ├── hexagon-qualcomm-gcc
│ ├── hexagon-qualcomm-gcov
│ ├── hexagon-qualcomm-ld
│ ├── hexagon-qualcomm-nm
│ ├── hexagon-qualcomm-objcopy
│ ├── hexagon-qualcomm-objdump
│ └── hexagon-qualcomm-strip
├── image
├── image_to_tensor.py
└── tensor_to_image.py
├── layers_validate.py
├── onnx_optimizer.py
├── python
├── CMakeLists.txt
├── __init__.py
├── apu_utils.py
├── config
│ └── model
│ │ └── model-template.yaml
├── convert.py
├── encrypt.py
├── gen_opencl.py
├── hexagon_soc_defines.py
├── layers_validate.py
├── micro
│ ├── __init__.py
│ ├── graph_builder.py
│ ├── jinja2_files
│ │ ├── CMakeLists.txt.jinja2
│ │ ├── micro_engine_c_interface.cc.jinja2
│ │ ├── micro_engine_c_interface.h.jinja2
│ │ ├── micro_engine_config.cc.jinja2
│ │ ├── micro_engine_factory.cc.jinja2
│ │ ├── micro_engine_factory.h.jinja2
│ │ ├── micro_graph_data.h.jinja2
│ │ ├── micro_model_data.h.jinja2
│ │ ├── micro_net_def.h.jinja2
│ │ └── micro_ops_list.h.jinja2
│ ├── mem_computer.py
│ ├── micro_codegen.py
│ ├── micro_io_converter.py
│ ├── micro_op_converter.py
│ ├── micro_op_resolver_cmsis_rules.py
│ ├── micro_op_resolver_rules.py
│ ├── micro_op_resolver_xtensa_rules.py
│ ├── micro_support_ops.py
│ ├── proto_to_bytes.py
│ └── scratch_computer.py
├── micro_converter.py
├── py_proto
│ └── __init__.py
├── quantize
│ ├── __init__.py
│ ├── quantize_stat.py
│ ├── quantize_util.py
│ └── quantize_util_test.py
├── run_micro.py
├── run_model.py
├── run_target.py
├── template
│ ├── file_binary.cc.jinja2
│ ├── graph.jinja2
│ ├── mace_engine_factory.h.jinja2
│ ├── model.jinja2
│ ├── model_header.jinja2
│ ├── operator.jinja2
│ ├── tensor_data.jinja2
│ └── tensor_source.jinja2
├── transform
│ ├── __init__.py
│ ├── apu_converter.py
│ ├── base_converter.py
│ ├── caffe_converter.py
│ ├── hexagon_converter.py
│ ├── keras_converter.py
│ ├── megengine_converter.py
│ ├── onnx_converter.py
│ ├── pytorch_converter.py
│ ├── shape_inference.py
│ ├── tensorflow_converter.py
│ └── transformer.py
├── utils
│ ├── __init__.py
│ ├── config_parser.py
│ ├── convert_util.py
│ ├── device.py
│ ├── net_util.py
│ ├── target.py
│ └── util.py
├── validate.py
└── visualize
│ ├── __init__.py
│ ├── index.html
│ └── visualize_model.py
├── sh_commands.py
├── validate.py
└── wino_conv.py
/.bazelrc:
--------------------------------------------------------------------------------
1 | # To support new bazelrc file list:
2 | # https://github.com/bazelbuild/bazel/issues/4502
3 | import %workspace%/tools/bazel.rc
4 |
--------------------------------------------------------------------------------
/.bazelversion:
--------------------------------------------------------------------------------
1 | 0.13.0
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | BasedOnStyle: google
2 | MaxEmptyLinesToKeep: 3
3 | DerivePointerAlignment: false
4 | PointerAlignment: Right
5 | BinPackParameters: false
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bazel-*
2 | build/*
3 | cmake-build/
4 | cmake-build-debug/
5 | docs/_build/
6 |
7 | .idea/
8 | .vscode/
9 | tags
10 |
11 | \.project/
12 | *swp
13 | *~
14 | *.pyc
15 | .python-version
16 |
17 | mace/codegen/models/
18 | mace/codegen/opencl/
19 | mace/codegen/opencl_bin/
20 | mace/codegen/tuning/
21 | mace/codegen/version/
22 | mace/codegen/engine/
23 | mace/codegen/lib/
24 |
25 | examples/android/macelibrary/src/main/cpp/mace/
26 | examples/android/macelibrary/src/main/cpp/include/
27 | examples/android/macelibrary/src/main/cpp/lib/arm64-v8a/
28 | examples/android/macelibrary/src/main/jniLibs/arm64-v8a/
29 |
30 | tools/python/py_proto/*_pb2.py
31 |
32 | micro/codegen/**
33 | micro/examples/micro
34 | micro/build
35 |
36 | mace-models
37 |
38 | __pycache__
39 | *.egg-info
40 | .mace_run
41 | .model
42 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "micro/third_party/CMSIS_5"]
2 | path = micro/third_party/CMSIS_5
3 | url = https://github.com/ARM-software/CMSIS_5.git
4 | shallow = true
5 | [submodule "micro/third_party/googletest"]
6 | path = micro/third_party/googletest
7 | url = https://github.com/google/googletest.git
8 | shallow = true
9 | [submodule "micro/third_party/gflags"]
10 | path = micro/third_party/gflags
11 | url = https://github.com/gflags/gflags.git
12 | shallow = true
13 |
--------------------------------------------------------------------------------
/BUILD.bazel:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/BUILD.bazel
--------------------------------------------------------------------------------
/JOBS.md:
--------------------------------------------------------------------------------
1 | ## Join Us
2 | We are hiring talents (full-time or interns) with the following skills:
3 |
4 | * Solid C++ skills (required)
5 | * Heterogeneous computing (NEON, OpenCL, CUDA, HVX, TVM, MLIR etc.)
6 | * Model compression and quantization
7 | * Large scale distributed system
8 | * Computer vision, image processing and/or autonomous driving
9 |
10 | Contacts: please find email from the commit log.
11 |
12 | ## 加入我们
13 | 欢迎加入我们 (全职或实习生):
14 |
15 | * 扎实的C++编程基础与良好的工程习惯 (必须)
16 | * 异构计算 (NEON, OpenCL, CUDA, HVX, TVM, MLIR等)
17 | * 神经网络模型压缩与量化
18 | * 大规模分布式系统
19 | * 计算机视觉,图像处理,自动驾驶
20 |
21 | 联系方式:提交记录中的email。
22 |
--------------------------------------------------------------------------------
/ROADMAP.md:
--------------------------------------------------------------------------------
1 | Roadmap
2 | =======
3 |
4 | * CUDA support
5 | * Mixed-precision inference
6 | * Improved host/x86 performance
7 |
8 | *Last updated: April 15, 2019*
9 |
--------------------------------------------------------------------------------
/cmake/toolchains/aarch64-linux-gnu.cmake:
--------------------------------------------------------------------------------
1 | # Tested with gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu
2 | # https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/
3 |
4 | set(CMAKE_SYSTEM_NAME Linux)
5 | set(CMAKE_SYSTEM_PROCESSOR aarch64)
6 |
7 | set(CMAKE_C_COMPILER "${CROSSTOOL_ROOT}/bin/aarch64-linux-gnu-gcc")
8 | set(CMAKE_CXX_COMPILER "${CROSSTOOL_ROOT}/bin/aarch64-linux-gnu-g++")
9 |
10 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
13 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14 |
15 | set(CMAKE_CXX_FLAGS "-march=armv8-a ${CMAKE_CXX_FLAGS}")
16 |
--------------------------------------------------------------------------------
/cmake/toolchains/arm-linux-gnueabi.cmake:
--------------------------------------------------------------------------------
1 | # Tested with gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabi
2 | # https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/
3 |
4 | set(CMAKE_SYSTEM_NAME Linux)
5 | set(CMAKE_SYSTEM_PROCESSOR arm)
6 |
7 | set(CMAKE_C_COMPILER "${CROSSTOOL_ROOT}/bin/arm-linux-gnueabi-gcc")
8 | set(CMAKE_CXX_COMPILER "${CROSSTOOL_ROOT}/bin/arm-linux-gnueabi-g++")
9 |
10 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
13 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14 |
15 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4 ${CMAKE_CXX_FLAGS}")
16 |
--------------------------------------------------------------------------------
/cmake/toolchains/arm-linux-gnueabihf.cmake:
--------------------------------------------------------------------------------
1 | # Tested with gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf
2 | # https://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/
3 |
4 | set(CMAKE_SYSTEM_NAME Linux)
5 | set(CMAKE_SYSTEM_PROCESSOR arm)
6 |
7 | set(CMAKE_C_COMPILER "${CROSSTOOL_ROOT}/bin/arm-linux-gnueabihf-gcc")
8 | set(CMAKE_CXX_COMPILER "${CROSSTOOL_ROOT}/bin/arm-linux-gnueabihf-g++")
9 |
10 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
13 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14 |
15 | set(CMAKE_CXX_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 ${CMAKE_CXX_FLAGS}")
16 |
--------------------------------------------------------------------------------
/docker/gitlab-runner/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev:latest
2 |
3 | # Update source
4 | RUN apt-get update -y
5 |
6 | # Install gitlab runner
7 | RUN curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | bash
8 | RUN apt-get install gitlab-ci-multi-runner
9 |
10 | # set timezone
11 | RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
12 |
13 | ENTRYPOINT gitlab-runner run
14 |
--------------------------------------------------------------------------------
/docker/mace-micro-dev/mace-micro-dev.dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:18.04
2 |
3 | RUN apt-get update --fix-missing
4 | RUN apt-get install -y wget
5 |
6 | RUN wget https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4-Linux-x86_64.sh && chmod +x cmake-3.18.4-Linux-x86_64.sh && ./cmake-3.18.4-Linux-x86_64.sh --skip-license --prefix=/usr
7 |
8 | RUN apt-get install -y g++-5 gcc-5
9 | RUN apt-get install -y gcc-arm-none-eabi
10 | RUN apt-get install -y git mercurial
11 | RUN apt-get install -y python python-pip
12 | RUN apt-get install -y python3 python3-pip
13 |
14 | RUN python -m pip install -U pip
15 | RUN python -m pip install jinja2 pyyaml sh numpy six filelock
16 | RUN python -m pip install tensorflow==1.8.0
17 |
18 | RUN python3 -m pip install -U pip
19 | RUN python3 -m pip install jinja2 pyyaml sh numpy six filelock
20 | RUN python3 -m pip install tensorflow==2.3.0 tensorflow_model_optimization
21 | RUN python3 -m pip install mbed-cli
22 |
--------------------------------------------------------------------------------
/docker/update_images.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | BUILD_DIR_NAME="docker"
6 | CURRENT_DIR_NAME=`basename "$PWD"`
7 |
8 | if [ $BUILD_DIR_NAME != $CURRENT_DIR_NAME ]; then
9 | echo "You can run script only in 'mace/docker' directory"
10 | exit 1
11 | fi
12 |
13 | # build images
14 | docker build --network host -t registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev-lite ./mace-dev-lite
15 | docker build --network host -t registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev ./mace-dev
16 | docker build --network host -t registry.cn-hangzhou.aliyuncs.com/xiaomimace/gitlab-runner ./gitlab-runner
17 |
18 | if grep -lq registry.cn-hangzhou.aliyuncs.com ~/.docker/config.json; then
19 | # update images to repository
20 | docker push registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev-lite
21 | docker push registry.cn-hangzhou.aliyuncs.com/xiaomimace/mace-dev
22 | docker push registry.cn-hangzhou.aliyuncs.com/xiaomimace/gitlab-runner
23 | else
24 | echo "Login docker registry server is needed!"
25 | exit 1
26 | fi
27 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = MACE
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/docs/README:
--------------------------------------------------------------------------------
1 | The documents are based on Sphinx, run the following commands to build the documents:
2 |
3 | pip install sphinx sphinx-autobuild sphinx-rtd-theme
4 | pip install recommonmark
5 | make html
6 |
7 | After building, the generated documents are located in _build.
8 |
--------------------------------------------------------------------------------
/docs/chinese.rst:
--------------------------------------------------------------------------------
1 | 中文
2 | ============
3 |
4 | 简介
5 | ----
6 |
7 | Mobile AI Compute Engine (MACE) 是一个专为移动端异构计算设备优化的深度学习前向预测框架。
8 | MACE覆盖了常见的移动端计算设备(CPU、GPU、Hexagon DSP、Hexagon HTA、MTK APU),并且提供了完整的工具链和文档,用户借助MACE能够
9 | 很方便地在移动端部署深度学习模型。MACE已经在小米内部广泛使用并且被充分验证具有业界领先的性能和稳定性。
10 |
11 | 框架
12 | ----
13 | 下图描述了MACE的基本框架。
14 |
15 | .. image:: mace-arch.png
16 | :scale: 40 %
17 | :align: center
18 |
19 | .. toctree::
20 | :maxdepth: 1
21 | :caption: 安装方法
22 | :name: sec-install-ch
23 |
24 | zh/installation/env_requirement
25 |
26 | .. toctree::
27 | :maxdepth: 1
28 | :caption: 基本使用
29 | :name: sec-user-ch
30 |
31 | zh/user_guide/basic_usage
--------------------------------------------------------------------------------
/docs/development/dynamic_lstm.rst:
--------------------------------------------------------------------------------
1 | Dynamic LSTM
2 | ============
3 |
4 |
5 | The DynamicLSTM in MACE is implemented for Kaldi's time delay RNN models.
6 |
7 | The following pictures explain how to fuse components into a DynamicLSTMCell.
8 |
9 | Before fusing:
10 |
11 | .. image:: imgs/FuseLSTM.png
12 | :scale: 100 %
13 | :align: center
14 |
15 |
16 | After fusing:
17 |
18 | .. image:: imgs/DynamicLSTM.png
19 | :scale: 100 %
20 | :align: center
21 |
22 | For more details about LSTMNonlinear in Kaldi,
23 | please refer to [LstmNonlinearityComponent](http://kaldi-asr.org/doc/nnet-combined-component_8h_source.html#l00255)
24 |
--------------------------------------------------------------------------------
/docs/development/imgs/DynamicLSTM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/docs/development/imgs/DynamicLSTM.png
--------------------------------------------------------------------------------
/docs/development/imgs/FuseLSTM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/docs/development/imgs/FuseLSTM.png
--------------------------------------------------------------------------------
/docs/mace-arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/docs/mace-arch.png
--------------------------------------------------------------------------------
/docs/mace-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/docs/mace-logo.png
--------------------------------------------------------------------------------
/docs/mace-work-flow-zh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/docs/mace-work-flow-zh.png
--------------------------------------------------------------------------------
/docs/mace-work-flow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/docs/mace-work-flow.png
--------------------------------------------------------------------------------
/docs/micro-controllers/op_lists.rst:
--------------------------------------------------------------------------------
1 | Operator lists
2 | ===============
3 |
4 | MACE Micro supported operators
5 | ------------------------------
6 |
7 | Float32 and bfloat16 operators
8 |
9 | * batch_norm
10 | * conv_2d
11 | * depthwise_conv_2d
12 | * pooling
13 | * activation
14 | * argmax
15 | * bias_add
16 | * cast
17 | * concat
18 | * eltwise
19 | * expand_dims
20 | * matmul
21 | * reduce
22 | * reshape
23 | * softmax
24 | * squeeze
25 | * stack
26 | * stride_slice
27 |
28 | Int8 operators
29 |
30 | * conv_2d
31 | * depthwsie_conv_2d
32 | * eltwise
33 | * mat_mul
34 | * pooling
35 | * softmax
36 | * quantize
37 | * dequantize
38 |
39 | Tensorflow Keras Converter supported layers
40 |
41 | * InputLayer
42 | * Flatten
43 | * Dense
44 | * Conv2D
45 | * MaxPooling2D
46 | * Dropout
47 | * DepthwiseConv2D
48 | * Softmax
49 | * BatchNormalization
50 | * Activation
51 | * ReLU
52 | * Concatenate
53 | * GlobalAveragePooling2D
54 | * Add
55 | * QuantizeLayer
56 | * QuantizeWrapper
57 |
--------------------------------------------------------------------------------
/docs/user_guide/devices/demo_device_nanopi.yml:
--------------------------------------------------------------------------------
1 | # one yaml config file can contain multi device info
2 | devices:
3 | # The name of the device
4 | nanopi:
5 | # arm64 or armhf
6 | target_abis: [arm64, armhf]
7 | # device soc, you can get it from device manual
8 | target_socs: RK3399
9 | # device model full name
10 | models: FriendlyElec Nanopi M4
11 | # device ip address
12 | address: 10.0.0.0
13 | # login username
14 | username: user
15 | raspberry:
16 | target_abis: [armv7l]
17 | target_socs: BCM2837
18 | models: Raspberry Pi 3 Model B Plus Rev 1.3
19 | address: 10.0.0.1
20 | username: user
21 |
--------------------------------------------------------------------------------
/examples/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/examples/android/README.md:
--------------------------------------------------------------------------------
1 | Android Demo
2 | =============
3 |
4 | How to build
5 | ---------------
6 |
7 | ```sh
8 | cd mace/examples/android
9 | ./build.sh dynamic
10 | # if libmace.a is needed, update `macelibrary/CMakeLists.txt` and run with `./build.sh static`.
11 | ```
12 |
13 | Install
14 | ---------------
15 |
16 | ```sh
17 | # running after build step and in `mace/exampls/android` directory
18 | adb install ./app/build/outputs/apk/app/release/app-app-release.apk
19 | ```
20 |
21 | Pre-built APK
22 | --------------
23 | Pre-built Android APK can be downloaded [here](https://cnbj1.fds.api.xiaomi.com/mace/demo/mace_android_demo.apk).
24 |
25 | Note
26 | --------------
27 | We use two big cores for CPU inference.
28 |
--------------------------------------------------------------------------------
/examples/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/examples/android/app/mace_demo.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/mace_demo.jks
--------------------------------------------------------------------------------
/examples/android/app/src/main/java/com/xiaomi/mace/demo/Constant.java:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package com.xiaomi.mace.demo;
16 |
17 | public class Constant {
18 |
19 | public static final int CAMERA_PERMISSION_REQ = 1;
20 | }
21 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/java/com/xiaomi/mace/demo/camera/MobilenetResultCallback.java:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package com.xiaomi.mace.demo.camera;
16 |
17 | public interface MobilenetResultCallback {
18 | void onMaceResult(float[] result, long costTime);
19 | }
20 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/layout/layout_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/layout/layout_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 识物
3 |
4 |
--------------------------------------------------------------------------------
/examples/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/examples/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.2.0'
11 |
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/examples/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 | #android.useDeprecatedNdk=true
14 |
15 | # When configured, Gradle will run in incubating parallel model.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
--------------------------------------------------------------------------------
/examples/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/examples/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/examples/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Sep 12 13:35:24 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
7 |
--------------------------------------------------------------------------------
/examples/android/macelibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/examples/android/macelibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/examples/android/macelibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/examples/android/macelibrary/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MaceLibrary
3 |
4 |
--------------------------------------------------------------------------------
/examples/android/macelibrary/version_script.lds:
--------------------------------------------------------------------------------
1 | VERS_1.0 {
2 | # Export JNI symbols.
3 | global:
4 | Java_*;
5 | JNI_OnLoad;
6 | JNI_OnUnload;
7 |
8 | # Hide everything else.
9 | local:
10 | *;
11 | };
12 |
--------------------------------------------------------------------------------
/examples/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':macelibrary'
2 |
--------------------------------------------------------------------------------
/include/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "public_headers",
9 | hdrs = glob([
10 | "mace/public/*.h",
11 | "mace/port/*.h",
12 | "mace/utils/*.h",
13 | ]),
14 | strip_include_prefix = "",
15 | copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
16 | )
17 |
--------------------------------------------------------------------------------
/include/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | install(DIRECTORY mace DESTINATION include)
2 |
--------------------------------------------------------------------------------
/include/mace/port/port-arch.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_PORT_PORT_ARCH_H_
16 | #define MACE_PORT_PORT_ARCH_H_
17 |
18 | #if defined __APPLE__
19 | # define MACE_OS_MAC 1
20 | # if TARGET_OS_IPHONE
21 | # define MACE_OS_IOS 1
22 | # endif
23 | #elif defined __linux__
24 | # define MACE_OS_LINUX 1
25 | # if defined(__ANDROID__) || defined(ANDROID)
26 | # define MACE_OS_LINUX_ANDROID 1
27 | # endif
28 | #endif
29 |
30 | #endif // MACE_PORT_PORT_ARCH_H_
31 |
--------------------------------------------------------------------------------
/include/mace/port/port.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_PORT_PORT_H_
16 | #define MACE_PORT_PORT_H_
17 |
18 | #include "mace/port/port-arch.h"
19 | #include "mace/public/mace.h"
20 | #include "mace/utils/logging.h"
21 |
22 | #if defined(MACE_OS_LINUX_ANDROID)
23 | #define MACE_THREAD_POOL_USE_SPIN 1
24 | #endif // MACE_OS_LINUX_ANDROID
25 |
26 | #endif // MACE_PORT_PORT_H_
27 |
--------------------------------------------------------------------------------
/mace/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_subdirectory(codegen)
2 | add_subdirectory(core)
3 | add_subdirectory(flows)
4 | add_subdirectory(libmace)
5 | add_subdirectory(ops)
6 | add_subdirectory(port)
7 | add_subdirectory(proto)
8 | add_subdirectory(rpcmems)
9 | add_subdirectory(runtimes)
10 | add_subdirectory(tools)
11 | add_subdirectory(utils)
12 |
--------------------------------------------------------------------------------
/mace/codegen/model_version_script.lds:
--------------------------------------------------------------------------------
1 | mace {
2 | global:
3 | *LoadModelData*;
4 | *GetModelSize*;
5 | *CreateNet*;
6 | *ModelName*;
7 | *ModelChecksum*;
8 | *ModelBuildTime*;
9 | *ModelBuildOptions*;
10 | *MaceVersion*;
11 |
12 | local:
13 | *;
14 | };
15 |
--------------------------------------------------------------------------------
/mace/core/mace_tensor_impl.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | #ifndef MACE_CORE_MACE_TENSOR_IMPL_H_
17 | #define MACE_CORE_MACE_TENSOR_IMPL_H_
18 |
19 | #include
20 | #include
21 |
22 | namespace mace {
23 |
24 | // Mace Tensor
25 | class MaceTensor::Impl {
26 | public:
27 | std::vector shape;
28 | std::shared_ptr data;
29 | DataFormat format;
30 | IDataType data_type;
31 | MemoryType mem_type;
32 | int64_t buffer_size;
33 | };
34 |
35 | } // namespace mace
36 |
37 |
38 | #endif // MACE_CORE_MACE_TENSOR_IMPL_H_
39 |
--------------------------------------------------------------------------------
/mace/core/ops/op_construct_context.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include "mace/core/ops/op_construct_context.h"
16 |
17 | namespace mace {
18 |
19 | OpConstructContext::OpConstructContext(Workspace *ws)
20 | : operator_def_(nullptr),
21 | ws_(ws),
22 | runtime_(nullptr) {}
23 |
24 | void OpConstructContext::set_operator_def(
25 | std::shared_ptr operator_def) {
26 | operator_def_ = operator_def;
27 | }
28 |
29 | } // namespace mace
30 |
--------------------------------------------------------------------------------
/mace/core/runtime_failure_mock.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_CORE_RUNTIME_FAILURE_MOCK_H_
16 | #define MACE_CORE_RUNTIME_FAILURE_MOCK_H_
17 |
18 | namespace mace {
19 |
20 | bool ShouldMockRuntimeFailure();
21 |
22 | } // namespace mace
23 |
24 | #endif // MACE_CORE_RUNTIME_FAILURE_MOCK_H_
25 |
--------------------------------------------------------------------------------
/mace/flows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(FLOWS_SRCS flow_registry.cc)
2 |
3 | add_subdirectory(cpu)
4 |
5 | if(MACE_ENABLE_OPENCL)
6 | add_subdirectory(opencl)
7 | endif(MACE_ENABLE_OPENCL)
8 |
9 | if(MACE_ENABLE_HEXAGON)
10 | add_subdirectory(hexagon)
11 | endif(MACE_ENABLE_HEXAGON)
12 |
13 | if(MACE_ENABLE_MTK_APU)
14 | add_subdirectory(apu)
15 | endif(MACE_ENABLE_MTK_APU)
16 |
17 | if(MACE_ENABLE_QNN)
18 | add_subdirectory(qnn)
19 | endif(MACE_ENABLE_QNN)
20 |
21 | add_library(flows STATIC ${FLOWS_SRCS})
22 | target_link_libraries(flows PRIVATE core cpu_flow)
23 | if(MACE_ENABLE_OPENCL)
24 | target_link_libraries(flows PRIVATE opencl_flow)
25 | endif(MACE_ENABLE_OPENCL)
26 | install(TARGETS flows ARCHIVE DESTINATION lib)
27 |
--------------------------------------------------------------------------------
/mace/flows/apu/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | load(
8 | "//mace:mace.bzl",
9 | "apu_version_select",
10 | )
11 |
12 | cc_library(
13 | name = "apu_flows",
14 | srcs = glob([
15 | "*.cc",
16 | ]),
17 | hdrs = glob([
18 | "*.h",
19 | ]),
20 | copts = [
21 | "-Werror",
22 | "-Wextra",
23 | "-Wno-missing-field-initializers",
24 | ] + apu_version_select(
25 | ["-DMACE_MTK_APU_VERSION=1"],
26 | ["-DMACE_MTK_APU_VERSION=2"],
27 | ["-DMACE_MTK_APU_VERSION=3"],
28 | ["-DMACE_MTK_APU_VERSION=4"],
29 | ),
30 | linkopts = ["-ldl"],
31 | deps = [
32 | "//mace/core",
33 | "//mace/runtimes/apu:apu_runtimes",
34 | ],
35 | )
36 |
--------------------------------------------------------------------------------
/mace/flows/apu/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(apu_flow STATIC
2 | apu_ref_flow.cc
3 | )
4 |
5 | target_link_libraries(apu_flow core ${EXTRA_LINK_LIBS})
6 |
7 | install(TARGETS apu_flow ARCHIVE DESTINATION lib)
8 |
--------------------------------------------------------------------------------
/mace/flows/cpu/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | load(
8 | "//mace:mace.bzl",
9 | "if_bfloat16_enabled",
10 | "if_fp16_enabled",
11 | )
12 |
13 | cc_library(
14 | name = "cpu_flows",
15 | srcs = glob([
16 | "cpu_ref*.cc",
17 | "transpose_const.cc",
18 | ]) + if_bfloat16_enabled(glob([
19 | "cpu_bf16*.cc",
20 | ])) + if_fp16_enabled(glob([
21 | "cpu_fp16*.cc",
22 | ])),
23 | hdrs = glob([
24 | "cpu_ref*.h",
25 | "transpose_const.h",
26 | ]) + if_bfloat16_enabled(glob([
27 | "cpu_bf16*.h",
28 | ])) + if_fp16_enabled(glob([
29 | "cpu_fp16*.h",
30 | ])),
31 | copts = [
32 | "-Werror",
33 | "-Wextra",
34 | "-Wno-missing-field-initializers",
35 | ] + if_bfloat16_enabled([
36 | "-DMACE_ENABLE_BFLOAT16",
37 | ]) + if_fp16_enabled([
38 | "-DMACE_ENABLE_FP16",
39 | "-march=armv8.2-a+fp16",
40 | ]),
41 | linkopts = ["-ldl"],
42 | deps = [
43 | "//mace/core",
44 | ],
45 | )
46 |
--------------------------------------------------------------------------------
/mace/flows/cpu/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(CPU_SRCS
2 | cpu_ref_flow.cc
3 | transpose_const.cc
4 | )
5 |
6 | if(MACE_ENABLE_FP16)
7 | set(CPU_SRCS ${CPU_SRCS} cpu_fp16_flow.cc)
8 | endif(MACE_ENABLE_FP16)
9 |
10 | if(MACE_ENABLE_BFLOAT16)
11 | set(CPU_SRCS ${CPU_SRCS} cpu_bf16_flow.cc)
12 | endif(MACE_ENABLE_BFLOAT16)
13 |
14 | add_library(cpu_flow STATIC ${CPU_SRCS})
15 | target_link_libraries(cpu_flow core)
16 | install(TARGETS cpu_flow ARCHIVE DESTINATION lib)
17 |
--------------------------------------------------------------------------------
/mace/flows/cpu/transpose_const.h:
--------------------------------------------------------------------------------
1 | // Copyright 2021 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_FLOWS_CPU_TRANSPOSE_CONST_H_
16 | #define MACE_FLOWS_CPU_TRANSPOSE_CONST_H_
17 |
18 | #include "mace/public/mace.h"
19 | #include "mace/utils/thread_pool.h"
20 |
21 | namespace mace {
22 | class Workspace;
23 | MaceStatus TransposeConstForCPU(
24 | mace::utils::ThreadPool *thread_pool,
25 | Workspace *ws,
26 | Runtime *runtime,
27 | NetDef *net_def);
28 |
29 | } // namespace mace
30 |
31 | #endif // MACE_FLOWS_CPU_TRANSPOSE_CONST_H_
32 |
--------------------------------------------------------------------------------
/mace/flows/hexagon/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "hexagon_flows",
9 | srcs = glob([
10 | "*.cc",
11 | ]),
12 | hdrs = glob([
13 | "*.h",
14 | ]),
15 | copts = [
16 | "-Werror",
17 | "-Wextra",
18 | "-Wno-missing-field-initializers",
19 | ],
20 | linkopts = ["-ldl"],
21 | deps = [
22 | "//mace/core",
23 | "//mace/runtimes/hexagon:hexagon_runtimes",
24 | ],
25 | )
26 |
--------------------------------------------------------------------------------
/mace/flows/hexagon/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(HEXAGON_SRCS
2 | hexagon_ref_flow.cc
3 | )
4 |
5 | add_library(hexagon_flow STATIC ${HEXAGON_SRCS})
6 | target_link_libraries(hexagon_flow core)
7 | install(TARGETS hexagon_flow ARCHIVE DESTINATION lib)
8 |
--------------------------------------------------------------------------------
/mace/flows/opencl/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "opencl_flows",
9 | srcs = glob([
10 | "*.cc",
11 | ]),
12 | hdrs = glob([
13 | "*.h",
14 | ]),
15 | copts = [
16 | "-Werror",
17 | "-Wextra",
18 | "-Wno-missing-field-initializers",
19 | ],
20 | linkopts = ["-ldl"],
21 | deps = [
22 | "//mace/core",
23 | "//mace/flows/cpu:cpu_flows",
24 | "//mace/runtimes/opencl:opencl_runtimes",
25 | ],
26 | )
27 |
--------------------------------------------------------------------------------
/mace/flows/opencl/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(OPENCL_SRCS
2 | opencl_ref_flow.cc
3 | )
4 |
5 | add_library(opencl_flow STATIC ${OPENCL_SRCS})
6 | add_dependencies(opencl_flow opencl_clhpp)
7 |
8 | target_link_libraries(opencl_flow core ${EXTRA_LINK_LIBS})
9 | install(TARGETS opencl_flow ARCHIVE DESTINATION lib)
10 |
--------------------------------------------------------------------------------
/mace/flows/qnn/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "qnn_flows",
9 | srcs = glob([
10 | "*.cc",
11 | ]),
12 | hdrs = glob([
13 | "*.h",
14 | ]),
15 | copts = [
16 | "-Werror",
17 | "-Wextra",
18 | "-Wno-missing-field-initializers",
19 | ],
20 | linkopts = ["-ldl"],
21 | deps = [
22 | "//mace/core",
23 | "//mace/runtimes/qnn:qnn_runtimes",
24 | ],
25 | )
26 |
--------------------------------------------------------------------------------
/mace/flows/qnn/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(QNN_SRCS
2 | qnn_ref_flow.cc
3 | )
4 |
5 | add_library(qnn_flow STATIC ${QNN_SRCS})
6 | target_link_libraries(qnn_flow core)
7 | install(TARGETS qnn_flow ARCHIVE DESTINATION lib)
8 |
--------------------------------------------------------------------------------
/mace/libmace/combine_static_libs.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | output_name=$1
4 |
5 | shift
6 |
7 | for i in "$@"
8 | do
9 | echo "$i" | tr -s ';' ' ' | xargs ar qc $output_name
10 | done
--------------------------------------------------------------------------------
/mace/libmace/engines/engine_registry.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | #include "mace/libmace/engines/engine_registry.h"
17 |
18 | #include "mace/libmace/engines/serial_engine.h"
19 | #include "mace/utils/memory.h"
20 |
21 | namespace mace {
22 |
23 | std::unique_ptr SmartCreateEngine(const MaceEngineConfig &config) {
24 | return make_unique(config);
25 | }
26 |
27 | } // namespace mace
28 |
--------------------------------------------------------------------------------
/mace/libmace/engines/engine_registry.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_LIBMACE_ENGINES_ENGINE_REGISTRY_H_
16 | #define MACE_LIBMACE_ENGINES_ENGINE_REGISTRY_H_
17 |
18 | #include
19 |
20 | #include "mace/libmace/engines/base_engine.h"
21 |
22 | namespace mace {
23 |
24 | std::unique_ptr SmartCreateEngine(const MaceEngineConfig &config);
25 |
26 | } // namespace mace
27 |
28 | #endif // MACE_LIBMACE_ENGINES_ENGINE_REGISTRY_H_
29 |
--------------------------------------------------------------------------------
/mace/libmace/mace.mri.in:
--------------------------------------------------------------------------------
1 | create @BASE_PATH@/mace/libmace/libmace_static.a
2 | addlib @BASE_PATH@/mace/libmace/libmace_API.a
3 | addlib @BASE_PATH@/mace/ops/libops.a
4 | @FLOW_LIBS_MRI@
5 | @RUNTIME_LIBS_MRI@
6 | addlib @BASE_PATH@/mace/core/libcore.a
7 | addlib @BASE_PATH@/mace/utils/libutils.a
8 | addlib @BASE_PATH@/mace/proto/libproto.a
9 | addlib @BASE_PATH@/mace/port/libport_base.a
10 | @PORT_LIBS_MRI@
11 | addlib @BASE_PATH@/mace/codegen/libgenerated_version.a
12 | addlib @BASE_PATH@/mace/codegen/libgenerated_opencl_kernel.a
13 | addlib @BASE_PATH@/third_party/protobuf/src/protobuf-build/libprotobuf-lite.a
14 | save
15 | end
16 |
--------------------------------------------------------------------------------
/mace/libmace/mace_version_script.lds:
--------------------------------------------------------------------------------
1 | mace {
2 | global:
3 | *GPUContextBuilder*;
4 | *MaceEngineConfig*;
5 | *MaceTensor*;
6 | *MaceEngine*;
7 | *CreateMaceEngineFromProto*;
8 | *GetBigLittleCoreIDs*;
9 | *MaceVersion*;
10 | *GetCapability*;
11 |
12 | # api for static library of models
13 | *mace*port**;
14 | *mace*MaceStatus*;
15 | *mace*NetDef*;
16 | *mace*MemoryType*;
17 | *mace*DataType*;
18 | *mace*InputOutputInfo*;
19 | *mace*OutputShape*;
20 | *mace*OperatorDef*;
21 | *mace*ConstTensor*;
22 | *mace*Argument*;
23 | *mace*Split*;
24 | *mace*MemoryBlock*;
25 | *google*protobuf*;
26 |
27 | local:
28 | *;
29 | };
30 |
--------------------------------------------------------------------------------
/mace/ops/arm/README:
--------------------------------------------------------------------------------
1 | # Notes for Contributors and Roadmap
2 |
3 | We are going to refactor and optimize ARM related kernels one step at a time.
4 |
5 | The code structure will be organized as that kernels for each data type are separated.
6 | By this way, they are independent to each other and can be linked and shipped as a submodule,
7 | and it saves us from writing macro boilerplate. The reason we do not use a unified header file for each kernel
8 | is that we are not forcing developers to use exact same interface for kernels of different data types at this level,
9 | although doing this is recommended if convenient to do so. A reference version is put right in `ops` directory to be used
10 | as non-NEON kernels, which are not separated for different data types for simplicity.
11 |
12 | Although interface is kept flexible and can be defined according to demand,
13 | input/output parameters should be of `Tensor` type instead of raw pointer, as
14 | `Tensor` has more information kernel might use.
15 |
16 |
--------------------------------------------------------------------------------
/mace/ops/arm/base/conv_2d_5x5.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #include "mace/ops/arm/base/conv_2d_5x5.h"
16 |
17 | namespace mace {
18 | namespace ops {
19 | namespace arm {
20 |
21 | void RegisterConv2dK5x5Delegator(OpDelegatorRegistry *registry) {
22 | MACE_REGISTER_DELEGATOR(
23 | registry, Conv2dK5x5S1, delegator::Conv2dParam,
24 | MACE_DELEGATOR_KEY_EX(Conv2d, RuntimeType::RT_CPU,
25 | float, ImplType::NEON, K5x5S1));
26 | }
27 |
28 | } // namespace arm
29 | } // namespace ops
30 | } // namespace mace
31 |
--------------------------------------------------------------------------------
/mace/ops/arm/base/gemv.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | #include "mace/ops/arm/base/gemv.h"
17 |
18 | namespace mace {
19 | namespace ops {
20 | namespace arm {
21 |
22 | void RegisterGemvDelegator(OpDelegatorRegistry *registry) {
23 | MACE_REGISTER_DELEGATOR(
24 | registry, Gemv, DelegatorParam,
25 | MACE_DELEGATOR_KEY(Gemv, RuntimeType::RT_CPU, float, ImplType::NEON));
26 | }
27 |
28 | } // namespace arm
29 | } // namespace ops
30 | } // namespace mace
31 |
--------------------------------------------------------------------------------
/mace/ops/common/activation_type.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_COMMON_ACTIVATION_TYPE_H_
16 | #define MACE_OPS_COMMON_ACTIVATION_TYPE_H_
17 |
18 | namespace mace {
19 | namespace ops {
20 |
21 | enum ActivationType {
22 | NOOP = 0,
23 | RELU = 1,
24 | RELUX = 2,
25 | PRELU = 3,
26 | TANH = 4,
27 | SIGMOID = 5,
28 | LEAKYRELU = 6,
29 | ELU = 7,
30 | HARDSIGMOID = 8,
31 | };
32 |
33 | } // namespace ops
34 | } // namespace mace
35 |
36 | #endif // MACE_OPS_COMMON_ACTIVATION_TYPE_H_
37 |
--------------------------------------------------------------------------------
/mace/ops/common/pad_type.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_COMMON_PAD_TYPE_H_
16 | #define MACE_OPS_COMMON_PAD_TYPE_H_
17 |
18 | namespace mace {
19 | namespace ops {
20 |
21 | enum PadType {
22 | CONSTANT = 0,
23 | REFLECT = 1,
24 | SYMMETRIC = 2,
25 | };
26 |
27 | } // namespace ops
28 | } // namespace mace
29 |
30 | #endif // MACE_OPS_COMMON_PAD_TYPE_H_
31 |
--------------------------------------------------------------------------------
/mace/ops/common/pooling_type.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_COMMON_POOLING_TYPE_H_
16 | #define MACE_OPS_COMMON_POOLING_TYPE_H_
17 |
18 |
19 | namespace mace {
20 | enum PoolingType {
21 | AVG = 1, // avg_pool
22 | MAX = 2, // max_pool
23 | };
24 | } // namespace mace
25 |
26 | #endif // MACE_OPS_COMMON_POOLING_TYPE_H_
27 |
--------------------------------------------------------------------------------
/mace/ops/common/reduce_type.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_COMMON_REDUCE_TYPE_H_
16 | #define MACE_OPS_COMMON_REDUCE_TYPE_H_
17 |
18 |
19 | namespace mace {
20 | enum ReduceType {
21 | MEAN = 0,
22 | MIN = 1,
23 | MAX = 2,
24 | PROD = 3,
25 | SUM = 4,
26 | // SUM_SQR = 4,
27 | // SQR_MEAN = 5,
28 | };
29 | } // namespace mace
30 |
31 | #endif // MACE_OPS_COMMON_REDUCE_TYPE_H_
32 |
--------------------------------------------------------------------------------
/mace/ops/delegator/depthwise_conv_2d.h:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 |
16 | #ifndef MACE_OPS_DELEGATOR_DEPTHWISE_CONV_2D_H_
17 | #define MACE_OPS_DELEGATOR_DEPTHWISE_CONV_2D_H_
18 |
19 | #include "mace/ops/delegator/conv_2d.h"
20 |
21 | namespace mace {
22 | namespace ops {
23 | namespace delegator {
24 |
25 | typedef Conv2dParam DepthwiseConv2dParam;
26 | typedef Conv2d DepthwiseConv2d;
27 |
28 | } // namespace delegator
29 | } // namespace ops
30 | } // namespace mace
31 |
32 | #endif // MACE_OPS_DELEGATOR_DEPTHWISE_CONV_2D_H_
33 |
34 |
--------------------------------------------------------------------------------
/mace/ops/eltwise.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_ELTWISE_H_
16 | #define MACE_OPS_ELTWISE_H_
17 |
18 | #include "mace/ops/common/eltwise_type.h"
19 |
20 | namespace mace {
21 | namespace ops {
22 |
23 | inline bool IsLogicalType(EltwiseType type) {
24 | return type == EQUAL || type == NOT_EQUAL;
25 | }
26 |
27 | template int Sign(T val) {
28 | return (T(0) < val) - (val < T(0));
29 | }
30 |
31 | } // namespace ops
32 | } // namespace mace
33 |
34 | #endif // MACE_OPS_ELTWISE_H_
35 |
--------------------------------------------------------------------------------
/mace/ops/opencl/cl/addn.cl:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | __kernel void addn(OUT_OF_RANGE_PARAMS
4 | GLOBAL_WORK_GROUP_SIZE_DIM2
5 | __read_only image2d_t input0, /* [c%4 * w * c/4, h * b] */
6 | __read_only image2d_t input1,
7 | #if INPUT_NUM > 2
8 | __read_only image2d_t input2,
9 | #endif
10 | #if INPUT_NUM > 3
11 | __read_only image2d_t input3,
12 | #endif
13 | __write_only image2d_t output) {
14 | const int w = get_global_id(0);
15 | const int hb = get_global_id(1);
16 |
17 | #ifndef NON_UNIFORM_WORK_GROUP
18 | if (w >= global_size_dim0 || hb >= global_size_dim1) return;
19 | #endif
20 |
21 | DATA_TYPE4 in0 = READ_IMAGET(input0, SAMPLER, (int2)(w, hb));
22 | DATA_TYPE4 in1 = READ_IMAGET(input1, SAMPLER, (int2)(w, hb));
23 | DATA_TYPE4 out = in0 + in1;
24 |
25 | #if INPUT_NUM > 2
26 | DATA_TYPE4 in2 = READ_IMAGET(input2, SAMPLER, (int2)(w, hb));
27 | out = out + in2;
28 | #endif
29 |
30 | #if INPUT_NUM > 3
31 | DATA_TYPE4 in3 = READ_IMAGET(input3, SAMPLER, (int2)(w, hb));
32 | out = out + in3;
33 | #endif
34 |
35 | WRITE_IMAGET(output, (int2)(w, hb), out);
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/mace/ops/opencl/cl/bias_add.cl:
--------------------------------------------------------------------------------
1 | #include
2 | // Supported data types: half/float
3 | __kernel void bias_add(OUT_OF_RANGE_PARAMS
4 | GLOBAL_WORK_GROUP_SIZE_DIM3
5 | __private const int input_height,
6 | __read_only image2d_t input,
7 | __read_only image2d_t bias,
8 | __write_only image2d_t output) {
9 | const int ch_blk = get_global_id(0);
10 | const int width_idx = get_global_id(1);
11 | const int hb_idx = get_global_id(2);
12 |
13 | #ifndef NON_UNIFORM_WORK_GROUP
14 | if (ch_blk >= global_size_dim0 || width_idx >= global_size_dim1
15 | || hb_idx >= global_size_dim2) {
16 | return;
17 | }
18 | #endif
19 | const int width = global_size_dim1;
20 |
21 | const int pos = mad24(ch_blk, width, width_idx);
22 | DATA_TYPE4 in = READ_IMAGET(input, SAMPLER, (int2)(pos, hb_idx));
23 | const int b_idx = select(0, hb_idx / input_height, input_height > 0);
24 | DATA_TYPE4 bias_value = READ_IMAGET(bias, SAMPLER, (int2)(ch_blk, b_idx));
25 | DATA_TYPE4 out = in + bias_value;
26 |
27 | WRITE_IMAGET(output, (int2)(pos, hb_idx), out);
28 | }
29 |
--------------------------------------------------------------------------------
/mace/ops/opencl/cl/split.cl:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | __kernel void split(OUT_OF_RANGE_PARAMS
4 | GLOBAL_WORK_GROUP_SIZE_DIM3
5 | __read_only image2d_t input,
6 | __private const int chan_blk_offset,
7 | __write_only image2d_t output) {
8 | const int chan_blk_idx = get_global_id(0);
9 | const int width_idx = get_global_id(1);
10 | const int hb_idx = get_global_id(2);
11 |
12 | #ifndef NON_UNIFORM_WORK_GROUP
13 | if (chan_blk_idx >= global_size_dim0 || width_idx >= global_size_dim1
14 | || hb_idx >= global_size_dim2) {
15 | return;
16 | }
17 | #endif
18 | const int width = global_size_dim1;
19 |
20 | DATA_TYPE4 data = READ_IMAGET(input, SAMPLER,
21 | (int2)(mad24(chan_blk_idx + chan_blk_offset,
22 | width, width_idx), hb_idx));
23 |
24 | const int pos = mad24(chan_blk_idx, width, width_idx);
25 | WRITE_IMAGET(output, (int2)(pos, hb_idx), data);
26 | }
27 |
--------------------------------------------------------------------------------
/mace/ops/opencl/mvnorm.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_OPENCL_MVNORM_H_
16 | #define MACE_OPS_OPENCL_MVNORM_H_
17 |
18 | #include "mace/public/mace.h"
19 |
20 | namespace mace {
21 |
22 | class OpContext;
23 | class Tensor;
24 |
25 | namespace ops {
26 | class OpenCLMVNormKernel {
27 | public:
28 | virtual MaceStatus Compute(
29 | OpContext *context,
30 | const Tensor *input,
31 | Tensor *output) = 0;
32 | MACE_EMPTY_VIRTUAL_DESTRUCTOR(OpenCLMVNormKernel);
33 | };
34 |
35 | } // namespace ops
36 | } // namespace mace
37 |
38 | #endif // MACE_OPS_OPENCL_MVNORM_H_
39 |
--------------------------------------------------------------------------------
/mace/ops/registry/registry.h:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_OPS_REGISTRY_REGISTRY_H_
16 | #define MACE_OPS_REGISTRY_REGISTRY_H_
17 |
18 | #include "mace/utils/macros.h"
19 |
20 | namespace mace {
21 | class OpRegistry;
22 | class OpDelegatorRegistry;
23 |
24 | namespace ops {
25 |
26 | void RegisterAllOps(OpRegistry *registry);
27 | void RegisterAllOpDelegators(OpDelegatorRegistry *registry);
28 |
29 | } // namespace ops
30 | } // namespace mace
31 |
32 | #endif // MACE_OPS_REGISTRY_REGISTRY_H_
33 |
--------------------------------------------------------------------------------
/mace/port/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "port",
9 | deps = [
10 | "//mace/port/android:port_android",
11 | "//mace/port/darwin:port_darwin",
12 | "//mace/port/linux:port_linux",
13 | ],
14 | )
15 |
16 | cc_library(
17 | name = "port_base",
18 | srcs = [
19 | "env.cc",
20 | "logger.cc",
21 | "file_system.cc",
22 | ],
23 | deps = [
24 | "//mace/utils",
25 | "//include:public_headers",
26 | ],
27 | )
28 |
--------------------------------------------------------------------------------
/mace/port/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_base STATIC
2 | env.cc
3 | logger.cc
4 | file_system.cc
5 | )
6 |
7 | target_link_libraries(port_base utils)
8 |
9 | if(ANDROID)
10 | add_subdirectory(posix)
11 | add_subdirectory(linux_base)
12 | add_subdirectory(android)
13 | add_library(port ALIAS port_android)
14 | elseif(APPLE)
15 | add_subdirectory(posix)
16 | add_subdirectory(darwin)
17 | add_library(port ALIAS port_darwin)
18 | elseif(WIN32)
19 | add_subdirectory(windows)
20 | add_library(port ALIAS port_windows)
21 | else(WIN32)
22 | add_subdirectory(posix)
23 | add_subdirectory(linux_base)
24 | add_subdirectory(linux)
25 | add_library(port ALIAS port_linux)
26 | endif(ANDROID)
27 |
--------------------------------------------------------------------------------
/mace/port/README.md:
--------------------------------------------------------------------------------
1 | # port
2 |
3 | This module contains the interface and implementations for different platforms.
4 | All platform specific code should go here. It's not allowed to use non standard
5 | headers in other modules.
6 |
7 | This module splits into `port_api` and `port`. `port_api` is the interface, and
8 | it should not depends on any other modules including `utils`.
9 |
10 | If the code base goes large in the future, it should be split into core and
11 | test to keep the footprint for production libs as small as possible.
12 |
13 | Currently Linux, Darwin (MacOS, iOS etc.) are treated as POSIX. They will be
14 | handled differently if needed.
15 |
--------------------------------------------------------------------------------
/mace/port/android/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | load("//mace:mace.bzl", "if_android")
8 |
9 | cc_library(
10 | name = "port_android",
11 | srcs = if_android(glob([
12 | "*.cc",
13 | ])),
14 | hdrs = if_android(glob([
15 | "*.h",
16 | ])),
17 | deps = if_android([
18 | "//mace/port/linux_base:port_linux_base",
19 | ]),
20 | alwayslink = 1,
21 | )
22 |
--------------------------------------------------------------------------------
/mace/port/android/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_android STATIC
2 | logger.cc
3 | malloc_logger.cc
4 | env.cc
5 | )
6 |
7 | target_link_libraries(port_android port_linux_base log)
8 |
--------------------------------------------------------------------------------
/mace/port/android/logger.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_PORT_ANDROID_LOGGER_H_
16 | #define MACE_PORT_ANDROID_LOGGER_H_
17 |
18 | #include "mace/port/logger.h"
19 |
20 | namespace mace {
21 | namespace port {
22 |
23 | class AndroidLogWriter : public LogWriter {
24 | protected:
25 | void WriteLogMessage(const char *fname,
26 | const int line,
27 | const LogLevel severity,
28 | const char *message) override;
29 | };
30 |
31 | } // namespace port
32 | } // namespace mace
33 |
34 | #endif // MACE_PORT_ANDROID_LOGGER_H_
35 |
--------------------------------------------------------------------------------
/mace/port/darwin/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | load("//mace:mace.bzl", "if_darwin")
8 |
9 | cc_library(
10 | name = "port_darwin",
11 | srcs = if_darwin(glob([
12 | "*.cc",
13 | ])),
14 | hdrs = if_darwin(glob([
15 | "*.h",
16 | ])),
17 | deps = [
18 | "//mace/port:port_base",
19 | "//mace/port/posix:port_posix",
20 | ],
21 | alwayslink = 1,
22 | )
23 |
24 | sh_library(
25 | name = "darwin_ar_merge",
26 | srcs = ["ar_merge_on_darwin.sh"],
27 | )
28 |
--------------------------------------------------------------------------------
/mace/port/darwin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_darwin STATIC
2 | env.cc
3 | )
4 |
5 | target_link_libraries(port_darwin port_posix)
6 |
--------------------------------------------------------------------------------
/mace/port/linux/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | load("//mace:mace.bzl", "if_linux")
8 |
9 | cc_library(
10 | name = "port_linux",
11 | srcs = if_linux(glob([
12 | "*.cc",
13 | ])),
14 | hdrs = if_linux(glob([
15 | "*.h",
16 | ])),
17 | deps = if_linux([
18 | "//mace/port/linux_base:port_linux_base",
19 | ]),
20 | alwayslink = 1,
21 | )
22 |
--------------------------------------------------------------------------------
/mace/port/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_linux STATIC
2 | env.cc
3 | )
4 |
5 | target_link_libraries(port_linux port_linux_base)
6 |
--------------------------------------------------------------------------------
/mace/port/linux_base/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "port_linux_base",
9 | srcs = glob([
10 | "*.cc",
11 | ]),
12 | hdrs = glob([
13 | "*.h",
14 | ]),
15 | deps = [
16 | "//mace/port:port_base",
17 | "//mace/port/posix:port_posix",
18 | ],
19 | alwayslink = 1,
20 | )
21 |
--------------------------------------------------------------------------------
/mace/port/linux_base/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_linux_base STATIC
2 | env.cc
3 | )
4 |
5 | target_link_libraries(port_linux_base port_posix)
6 |
--------------------------------------------------------------------------------
/mace/port/posix/BUILD.bazel:
--------------------------------------------------------------------------------
1 | package(
2 | default_visibility = ["//visibility:public"],
3 | )
4 |
5 | licenses(["notice"]) # Apache 2.0
6 |
7 | cc_library(
8 | name = "port_posix",
9 | srcs = glob([
10 | "*.cc",
11 | ]),
12 | hdrs = glob([
13 | "*.h",
14 | ]),
15 | deps = [
16 | "//mace/port:port_base",
17 | "//mace/utils",
18 | ],
19 | )
20 |
--------------------------------------------------------------------------------
/mace/port/posix/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_posix STATIC
2 | file_system.cc
3 | )
4 |
5 | target_link_libraries(port_posix port_base)
6 |
--------------------------------------------------------------------------------
/mace/port/posix/time.h:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef MACE_PORT_POSIX_TIME_H_
16 | #define MACE_PORT_POSIX_TIME_H_
17 |
18 | #include
19 |
20 | #include
21 |
22 | namespace mace {
23 | namespace port {
24 | namespace posix {
25 |
26 | inline int64_t NowMicros() {
27 | struct timeval tv;
28 | gettimeofday(&tv, nullptr);
29 | return static_cast(tv.tv_sec) * 1000000 + tv.tv_usec;
30 | }
31 |
32 | } // namespace posix
33 | } // namespace port
34 | } // namespace mace
35 |
36 | #endif // MACE_PORT_POSIX_TIME_H_
37 |
--------------------------------------------------------------------------------
/mace/port/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(port_windows STATIC
2 | env.cc
3 | file_system.cc
4 | )
5 |
6 | target_link_libraries(port_windows port_base)
7 |
--------------------------------------------------------------------------------
/mace/proto/micro_mem.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto2";
2 |
3 | package micro;
4 |
5 | message OutputShape {
6 | repeated int64 dims = 1;
7 | }
8 |
9 | message OpContext {
10 | optional int32 op_idx = 1;
11 | // The input info of downstream operator is the output info of upstream
12 | // operator, so there is no output info defined here
13 | repeated uint32 input_infos = 2;
14 | repeated OutputShape output_resize_shapes = 3;
15 | }
16 |
17 | message Graph {
18 | repeated OpContext op_contexts = 1;
19 | repeated uint32 input_op_idxs = 2;
20 | // The output info of the last operator, which is not recorded in opcontext,
21 | // is the output of graph
22 | repeated uint32 output_infos = 3;
23 | }
24 |
--------------------------------------------------------------------------------
/mace/proto/qnn_cache.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto2";
2 |
3 | package qnn_cache;
4 |
5 | option optimize_for = LITE_RUNTIME;
6 |
7 | message CacheContext {
8 | repeated uint32 input_ids = 1;
9 | repeated uint32 output_ids = 2;
10 | optional string graph_name = 3;
11 | optional bytes graph_cache = 4;
12 | }
13 |
--------------------------------------------------------------------------------
/mace/python/tools/BUILD.bazel:
--------------------------------------------------------------------------------
1 | py_binary(
2 | name = "archive_static_lib",
3 | srcs = ["archive_static_lib.py"],
4 | srcs_version = "PY2AND3",
5 | visibility = ["//visibility:public"],
6 | )
7 |
--------------------------------------------------------------------------------
/mace/python/tools/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XiaoMi/mace/0fc55a548ef41b37fd15fd8944de5155eb09b3c1/mace/python/tools/__init__.py
--------------------------------------------------------------------------------
/mace/python/tools/file_binary.cc.jinja2:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // This is a generated file. DO NOT EDIT!
16 |
17 | #include
18 |
19 | namespace mace {
20 |
21 | const unsigned char *{{ load_func_name }}() {
22 | {% if data_size == 0 %}
23 | return nullptr;
24 | {% else %}
25 | static const unsigned char kData[{{ data_size }}] = {
26 | {% for d in data %}{{"0x%02X, " % d }}{%endfor%}
27 | };
28 |
29 | return kData;
30 | {% endif %}
31 | }
32 |
33 | size_t {{ size_func_name }}() {
34 | return {{ data_size }};
35 | }
36 |
37 | } // namespace mace
38 |
39 |
--------------------------------------------------------------------------------
/mace/python/tools/str2vec_maps.h.jinja2:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The MACE Authors. All Rights Reserved.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // This is a generated file. DO NOT EDIT!
16 |
17 | #include