From e282915a9c76964551d600bc01602dc53d7a4da1 Mon Sep 17 00:00:00 2001 From: Lianmin Zheng <mercy_zheng@sjtu.edu.cn> Date: Thu, 16 Aug 2018 16:37:03 -0700 Subject: [PATCH] add -mattr=+neon for all arm cpu target (#1612) --- apps/benchmark/README.md | 11 +++++++---- python/tvm/target.py | 16 ++++++++-------- tutorials/nnvm/deploy_model_on_rasp.py | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apps/benchmark/README.md b/apps/benchmark/README.md index e83e47c46..ee22f90dc 100644 --- a/apps/benchmark/README.md +++ b/apps/benchmark/README.md @@ -63,8 +63,11 @@ python3 -m tvm.exec.rpc_tracker python3 arm_cpu_imagenet_bench.py --device mate10pro --rpc-key mate10pro ``` - If your device has a same SoC of the above device, you can reuse these parameters - (e.g. use `llvm -device=arm_cpu -mode=rk3399 -target=aarch64-linux-gnu` as target). - Otherwise, you need to tune for your own device, please follow this - [tutorial](https://docs.tvm.ai/tutorials/autotvm/tune_nnvm_arm.html). + If your device has a same or similar SoC of the above devices, you can reuse these parameters. + For example, if your SoC is similar to rasp3b, use + ```bash + python3 arm_cpu_imagenet_bench.py --device rasp3b --rpc-key your_custom_key + ``` + For other devices, to get the best performance, it is recommended that you tune your network by yourself. + Please follow this [tutorial](https://docs.tvm.ai/tutorials/autotvm/tune_nnvm_arm.html). diff --git a/python/tvm/target.py b/python/tvm/target.py index fed20c391..e2d780f75 100644 --- a/python/tvm/target.py +++ b/python/tvm/target.py @@ -427,14 +427,14 @@ def arm_cpu(model='unknown', options=None): from . import autotvm trans_table = { - "pixel2": ["-model=snapdragon835", "-target=arm64-linux-android"], - "mate10": ["-model=kirin970", "-target=arm64-linux-android"], - "mate10pro": ["-model=kirin970", "-target=arm64-linux-android"], - "p20": ["-model=kirin970", "-target=arm64-linux-android"], - "p20pro": ["-model=kirin970", "-target=arm64-linux-android"], - "rasp3b": ["-model=bcm2837", "-target=armv7l-linux-gnueabihf"], - "rk3399": ["-model=rk3399", "-target=aarch64-linux-gnu"], - "pynq": ["-model=pynq", "-target=armv7a-linux-eabi"], + "pixel2": ["-model=snapdragon835", "-target=arm64-linux-android -mattr=+neon"], + "mate10": ["-model=kirin970", "-target=arm64-linux-android -mattr=+neon"], + "mate10pro": ["-model=kirin970", "-target=arm64-linux-android -mattr=+neon"], + "p20": ["-model=kirin970", "-target=arm64-linux-android -mattr=+neon"], + "p20pro": ["-model=kirin970", "-target=arm64-linux-android -mattr=+neon"], + "rasp3b": ["-model=bcm2837", "-target=armv7l-linux-gnueabihf -mattr=+neon"], + "rk3399": ["-model=rk3399", "-target=aarch64-linux-gnu -mattr=+neon"], + "pynq": ["-model=pynq", "-target=armv7a-linux-eabi -mattr=+neon"], } pre_defined_opt = trans_table.get(model, ["-model=%s" % model]) diff --git a/tutorials/nnvm/deploy_model_on_rasp.py b/tutorials/nnvm/deploy_model_on_rasp.py index c11f202c1..40dbdaeb0 100644 --- a/tutorials/nnvm/deploy_model_on_rasp.py +++ b/tutorials/nnvm/deploy_model_on_rasp.py @@ -154,7 +154,7 @@ if local_demo: else: target = tvm.target.arm_cpu('rasp3b') # The above line is a simple form of - # target = tvm.target.create('llvm -devcie=arm_cpu -target=armv7l-linux-gnueabihf') + # target = tvm.target.create('llvm -devcie=arm_cpu -model=bcm2837 -target=armv7l-linux-gnueabihf -mattr=+neon') with nnvm.compiler.build_config(opt_level=2, add_pass=['AlterOpLayout']): graph, lib, params = nnvm.compiler.build( -- GitLab