From 0f6aac706befc6ae053d0027ba4b8af59f10278f Mon Sep 17 00:00:00 2001 From: Ramana Radhakrishnan Date: Fri, 18 Jun 2021 21:04:14 +0100 Subject: [PATCH 1/3] Turn on Compute library testing in CI. This pull request turns on compute library testing in CI by 1. Handling import errors in Compute Library Integration. 2. Setting the configuration to the right path for ACL. This handles import errors for packages in Compute library integration. This pull request allows for the AArch64 CI to pick up native compute library testing and tests the operators being offloaded at runtime. --- .../test_arm_compute_lib/test_network.py | 25 +++++++++++++++---- tests/scripts/task_config_build_arm.sh | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/python/contrib/test_arm_compute_lib/test_network.py b/tests/python/contrib/test_arm_compute_lib/test_network.py index bb44b79078dd..8fcafe489cb9 100644 --- a/tests/python/contrib/test_arm_compute_lib/test_network.py +++ b/tests/python/contrib/test_arm_compute_lib/test_network.py @@ -56,7 +56,10 @@ def _build_and_run_network(mod, params, inputs, device, tvm_ops, acl_partitions, def _get_tflite_model(tflite_model_path, inputs_dict): """Convert TFlite graph to relay.""" - import tflite.Model + try: + import tflite.Model + except ImportError: + pytest.skip("Missing Tflite support") with open(tflite_model_path, "rb") as f: tflite_model_buffer = f.read() @@ -92,7 +95,10 @@ def test_vgg16(): device = Device() def get_model(): - from keras.applications import VGG16 + try: + from keras.applications import VGG16 + except ImportError: + pytest.skip("Missing Keras Package") vgg16 = VGG16(include_top=True, weights="imagenet", input_shape=(224, 224, 3), classes=1000) inputs = {vgg16.input_names[0]: ((1, 224, 224, 3), "float32")} @@ -113,7 +119,10 @@ def test_mobilenet(): device = Device() def get_model(): - from keras.applications import MobileNet + try: + from keras.applications import MobileNet + except ImportError: + pytest.skip("Missing keras module") mobilenet = MobileNet( include_top=True, weights="imagenet", input_shape=(224, 224, 3), classes=1000 @@ -133,7 +142,10 @@ def test_quantized_mobilenet(): if skip_runtime_test(): return - import tvm.relay.testing.tf as tf_testing + try: + import tvm.relay.testing.tf as tf_testing + except ImportError: + pytest.skip("Missing Tflite support") device = Device() @@ -158,7 +170,10 @@ def test_squeezenet(): if skip_runtime_test(): return - import tvm.relay.testing.tf as tf_testing + try: + import tvm.relay.testing.tf as tf_testing + except ImportError: + pytest.skip("Missing TF Support") device = Device() diff --git a/tests/scripts/task_config_build_arm.sh b/tests/scripts/task_config_build_arm.sh index b3a084aef371..6960338f3096 100755 --- a/tests/scripts/task_config_build_arm.sh +++ b/tests/scripts/task_config_build_arm.sh @@ -34,3 +34,4 @@ echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake echo set\(USE_VTA_TSIM ON\) >> config.cmake echo set\(USE_VTA_FSIM ON\) >> config.cmake echo set\(USE_ARM_COMPUTE_LIB ON\) >> config.cmake +echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/arm/acl") >> config.cmake From f97f773ac352b8b6a50db27db41d634ca5f03958 Mon Sep 17 00:00:00 2001 From: Ramana Radhakrishnan Date: Mon, 21 Jun 2021 21:40:47 +0100 Subject: [PATCH 2/3] Fix typo --- tests/scripts/task_config_build_arm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/scripts/task_config_build_arm.sh b/tests/scripts/task_config_build_arm.sh index 6960338f3096..49a55a61da70 100755 --- a/tests/scripts/task_config_build_arm.sh +++ b/tests/scripts/task_config_build_arm.sh @@ -34,4 +34,4 @@ echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake echo set\(USE_VTA_TSIM ON\) >> config.cmake echo set\(USE_VTA_FSIM ON\) >> config.cmake echo set\(USE_ARM_COMPUTE_LIB ON\) >> config.cmake -echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/arm/acl") >> config.cmake +echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/arm/acl"\) >> config.cmake From dca09cd8faa1c6b13bc660f5880f574e0ef1f51b Mon Sep 17 00:00:00 2001 From: Ramana Radhakrishnan Date: Tue, 22 Jun 2021 10:18:48 +0100 Subject: [PATCH 3/3] Fix up use of ubuntu_install_arm_compute_lib.sh in Dockerfile.ci_arm * Move to using pre-built ACL binaries for ci_arm * Fixup the path for installation to be /opt/acl as it originally was. * Fix up the issues with paths. Once this is done ci_arm will need to be rebuilt though will continue to work seamlessly. --- docker/Dockerfile.ci_arm | 4 ++-- docker/install/ubuntu_download_arm_compute_lib_binaries.sh | 3 ++- tests/scripts/task_config_build_arm.sh | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile.ci_arm b/docker/Dockerfile.ci_arm index 671ce04e8c1d..9479d7194d3b 100644 --- a/docker/Dockerfile.ci_arm +++ b/docker/Dockerfile.ci_arm @@ -43,5 +43,5 @@ COPY install/ubuntu_install_redis.sh /install/ubuntu_install_redis.sh RUN bash /install/ubuntu_install_redis.sh # Arm(R) Compute Library -COPY install/ubuntu_install_arm_compute_lib.sh /install/ubuntu_install_arm_compute_lib.sh -RUN bash /install/ubuntu_install_arm_compute_lib.sh +COPY install/ubuntu_download_arm_compute_lib_binaries.sh /install/ubuntu_download_arm_compute_lib_binaries.sh +RUN bash /install/ubuntu_download_arm_compute_lib_binaries.sh diff --git a/docker/install/ubuntu_download_arm_compute_lib_binaries.sh b/docker/install/ubuntu_download_arm_compute_lib_binaries.sh index ff8ad0eb9073..e71cff0f7ba6 100755 --- a/docker/install/ubuntu_download_arm_compute_lib_binaries.sh +++ b/docker/install/ubuntu_download_arm_compute_lib_binaries.sh @@ -38,7 +38,7 @@ target_lib="linux-arm64-v8a-neon" # target_lib="${target_lib}-asserts" extract_dir="arm_compute-${compute_lib_version}-bin-linux" -install_path="/opt/arm/acl" +install_path="/opt/acl" tmpdir=$(mktemp -d) @@ -54,6 +54,7 @@ cd "$tmpdir" curl -sL "${compute_lib_download_url}" -o "${compute_lib_file_name}" tar xzf "${compute_lib_file_name}" +rm -rf "${install_path}" mkdir -p "${install_path}" cp -r "${extract_dir}/include" "${install_path}/" cp -r "${extract_dir}/arm_compute" "${install_path}/include/" diff --git a/tests/scripts/task_config_build_arm.sh b/tests/scripts/task_config_build_arm.sh index 49a55a61da70..cae28467830f 100755 --- a/tests/scripts/task_config_build_arm.sh +++ b/tests/scripts/task_config_build_arm.sh @@ -34,4 +34,4 @@ echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake echo set\(USE_VTA_TSIM ON\) >> config.cmake echo set\(USE_VTA_FSIM ON\) >> config.cmake echo set\(USE_ARM_COMPUTE_LIB ON\) >> config.cmake -echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/arm/acl"\) >> config.cmake +echo set\(USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR "/opt/acl"\) >> config.cmake