You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by le...@apache.org on 2022/07/25 08:55:36 UTC

[tvm] branch ci-docker-staging updated (a7e9360064 -> 8ae520b1be)

This is an automated email from the ASF dual-hosted git repository.

leandron pushed a change to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git


 discard a7e9360064 This is PR #12130.
 discard cb6f6409a5 [TFLite][CI] Update TensorFlow dependency to 2.9.1
     add a07e18ea4e [HEXAGON] QCOM hexagon library (qhl) (#12149)
     add 9863cf0d5f [hexagon][testing] Better pytest ID strings (#12154)
     add ecd3c884de [Runtime][PipelineExecutor]  Tutorial of using pipeline executor. (#11557)
     add 76155c2f3c [QNN] Support different qnn params between in/out tensor in leaky_relu (#12116)
     add 832c7674fe [hexagon][testing] nonrandom tests (#12164)
     add dc1324635a tanh float16 (#12165)
     add 4d84620d07 [TIR] Well-Formed Verifier (#12166)
     add 6eb3a1fc36 [BYOC-DNNL] suppport more dnnl ops (#11823)
     new 15cf56e7df [TFLite][CI] Update TensorFlow dependency to 2.9.1
     new 8ae520b1be This is PR #12130.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a7e9360064)
            \
             N -- N -- N   refs/heads/ci-docker-staging (8ae520b1be)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 apps/hexagon_api/CMakeLists.txt                    |   1 +
 cmake/config.cmake                                 |   3 +
 cmake/modules/Hexagon.cmake                        |  28 ++-
 .../work_with_relay/using_pipeline_executor.py     | 248 +++++++++++++++++++++
 include/tvm/tir/analysis.h                         |  11 +-
 python/tvm/contrib/pipeline_executor.py            |  26 ++-
 python/tvm/contrib/pipeline_executor_build.py      |  14 +-
 python/tvm/relay/frontend/qnn_torch.py             |   6 +-
 python/tvm/relay/op/contrib/dnnl.py                |  14 ++
 python/tvm/relay/qnn/op/qnn.py                     |  21 +-
 .../transform/fake_quantization_to_integer.py      |   9 +-
 python/tvm/tir/analysis/analysis.py                |  20 ++
 python/tvm/topi/hexagon/slice_ops/__init__.py      |   1 +
 python/tvm/topi/hexagon/slice_ops/tanh.py          |  56 +++++
 src/relay/qnn/op/leaky_relu.cc                     |  85 ++++---
 src/runtime/contrib/dnnl/dnnl_json_runtime.cc      |  36 ++-
 src/runtime/hexagon/qhl/qhl_wrapper.cc             |  89 ++++++++
 src/target/llvm/codegen_hexagon.cc                 |  59 +++++
 src/target/llvm/intrin_rule_hexagon.cc             | 171 ++++++++++++--
 src/tir/analysis/verify_well_formed.cc             | 137 ++++++++++++
 src/tir/schedule/state.cc                          |   1 +
 tests/python/contrib/test_dnnl.py                  |  25 +++
 tests/python/contrib/test_hexagon/pytest_util.py   | 159 +++++++++++++
 .../test_hexagon/topi/test_avg_pool2d_slice.py     |  71 ++++--
 .../{test_argmax_slice.py => test_tanh_slice.py}   |  76 +++----
 tests/python/relay/test_op_qnn_leaky_relu.py       |  30 ++-
 tests/python/relay/test_pass_partition_graph.py    |   4 +-
 .../test_tir_analysis_verify_well_formed.py        |  57 +++++
 .../test_tir_schedule_set_axis_separator.py        |   9 +-
 .../python/unittest/test_tir_schedule_set_scope.py |  15 +-
 tests/scripts/task_config_build_gpu.sh             |   2 +
 tests/scripts/task_config_build_hexagon.sh         |   1 +
 32 files changed, 1324 insertions(+), 161 deletions(-)
 create mode 100755 gallery/how_to/work_with_relay/using_pipeline_executor.py
 create mode 100644 python/tvm/topi/hexagon/slice_ops/tanh.py
 create mode 100644 src/runtime/hexagon/qhl/qhl_wrapper.cc
 create mode 100644 src/tir/analysis/verify_well_formed.cc
 create mode 100644 tests/python/contrib/test_hexagon/pytest_util.py
 copy tests/python/contrib/test_hexagon/topi/{test_argmax_slice.py => test_tanh_slice.py} (56%)
 create mode 100644 tests/python/unittest/test_tir_analysis_verify_well_formed.py


[tvm] 01/02: [TFLite][CI] Update TensorFlow dependency to 2.9.1

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leandron pushed a commit to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 15cf56e7df5559a5eff471a08b280f69933c7154
Author: Leandro Nunes <le...@arm.com>
AuthorDate: Mon May 23 11:55:08 2022 +0100

    [TFLite][CI] Update TensorFlow dependency to 2.9.1
    
    This updates the TF version to be used in TVM CI to 2.9.1,
    which brings improvements so that more platforms are supported by
    official packages.
    
    ethos-u-vela dependency is also updated, from version 3.2.0 to 3.4.0
    so that it is closer to the TensorFlow version being proposed here.
    
    This PR updates the Docker images scripting to install TF and TFLite.
---
 cmake/modules/contrib/TFLite.cmake                  |  2 ++
 docker/Dockerfile.ci_cpu                            |  4 ++++
 docker/Dockerfile.ci_gpu                            |  3 +++
 docker/Dockerfile.ci_qemu                           |  3 +++
 docker/install/ubuntu_install_cmake_source.sh       |  4 ++--
 docker/install/ubuntu_install_python_package.sh     |  2 +-
 docker/install/ubuntu_install_tensorflow.sh         |  5 ++---
 docker/install/ubuntu_install_tensorflow_aarch64.sh | 11 ++---------
 docker/install/ubuntu_install_tflite.sh             | 13 +++++++++++--
 docker/install/ubuntu_install_vela.sh               |  2 +-
 tests/scripts/task_config_build_cpu.sh              |  2 +-
 11 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/cmake/modules/contrib/TFLite.cmake b/cmake/modules/contrib/TFLite.cmake
index 3159710909..b8d6a0daff 100644
--- a/cmake/modules/contrib/TFLite.cmake
+++ b/cmake/modules/contrib/TFLite.cmake
@@ -38,8 +38,10 @@ if(NOT USE_TFLITE STREQUAL "OFF")
     set(USE_TFLITE ${USE_TENSORFLOW_PATH}/tensorflow/lite/tools/make/gen/*/lib)
   endif()
   find_library(TFLITE_CONTRIB_LIB libtensorflow-lite.a ${USE_TFLITE})
+  file(GLOB_RECURSE TFLITE_DEPS "${USE_TFLITE}/*.a")
 
   list(APPEND TVM_RUNTIME_LINKER_LIBS ${TFLITE_CONTRIB_LIB})
+  list(APPEND TVM_RUNTIME_LINKER_LIBS ${TFLITE_DEPS})
 
   if (NOT USE_FLATBUFFERS_PATH STREQUAL "none")
     include_directories(${USE_FLATBUFFERS_PATH}/include)
diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu
index 2dc075d29b..28a7d89154 100644
--- a/docker/Dockerfile.ci_cpu
+++ b/docker/Dockerfile.ci_cpu
@@ -40,6 +40,9 @@ RUN bash /install/ubuntu_install_python_package.sh
 COPY install/ubuntu1804_install_llvm.sh /install/ubuntu1804_install_llvm.sh
 RUN bash /install/ubuntu1804_install_llvm.sh
 
+COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
+RUN bash /install/ubuntu_install_cmake_source.sh
+
 COPY install/ubuntu_install_dnnl.sh /install/ubuntu_install_dnnl.sh
 RUN bash /install/ubuntu_install_dnnl.sh
 
@@ -152,3 +155,4 @@ ENV PATH /opt/sccache:$PATH
 # Libxsmm deps
 COPY install/ubuntu_install_libxsmm.sh /install
 RUN bash /install/ubuntu_install_libxsmm.sh
+
diff --git a/docker/Dockerfile.ci_gpu b/docker/Dockerfile.ci_gpu
index f04d8515b8..6f02ab97c0 100644
--- a/docker/Dockerfile.ci_gpu
+++ b/docker/Dockerfile.ci_gpu
@@ -32,6 +32,9 @@ RUN apt-get update --fix-missing
 COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
 RUN bash /install/ubuntu_install_core.sh
 
+COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
+RUN bash /install/ubuntu_install_cmake_source.sh
+
 COPY install/ubuntu_install_googletest.sh /install/ubuntu_install_googletest.sh
 RUN bash /install/ubuntu_install_googletest.sh
 
diff --git a/docker/Dockerfile.ci_qemu b/docker/Dockerfile.ci_qemu
index 63089f3d65..06e6bd1154 100644
--- a/docker/Dockerfile.ci_qemu
+++ b/docker/Dockerfile.ci_qemu
@@ -26,6 +26,9 @@ RUN apt-get update --fix-missing
 COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh
 RUN bash /install/ubuntu_install_core.sh
 
+COPY install/ubuntu_install_cmake_source.sh /install/ubuntu_install_cmake_source.sh
+RUN bash /install/ubuntu_install_cmake_source.sh
+
 COPY install/ubuntu_install_googletest.sh /install/ubuntu_install_googletest.sh
 RUN bash /install/ubuntu_install_googletest.sh
 
diff --git a/docker/install/ubuntu_install_cmake_source.sh b/docker/install/ubuntu_install_cmake_source.sh
index 18335c98c4..e90ca3d8f1 100755
--- a/docker/install/ubuntu_install_cmake_source.sh
+++ b/docker/install/ubuntu_install_cmake_source.sh
@@ -20,8 +20,8 @@ set -e
 set -u
 set -o pipefail
 
-v=3.14
-version=3.14.7
+v=3.22
+version=3.22.4
 wget https://cmake.org/files/v${v}/cmake-${version}.tar.gz
 tar xvf cmake-${version}.tar.gz
 cd cmake-${version}
diff --git a/docker/install/ubuntu_install_python_package.sh b/docker/install/ubuntu_install_python_package.sh
index 8fa9d0c058..fca4bb68e7 100755
--- a/docker/install/ubuntu_install_python_package.sh
+++ b/docker/install/ubuntu_install_python_package.sh
@@ -27,7 +27,7 @@ pip3 install --upgrade \
     cython \
     decorator \
     mypy \
-    numpy~=1.19.5 \
+    numpy==1.21.* \
     orderedset \
     packaging \
     Pillow==9.1.0 \
diff --git a/docker/install/ubuntu_install_tensorflow.sh b/docker/install/ubuntu_install_tensorflow.sh
index 17d2b31d9b..2225b7aef3 100755
--- a/docker/install/ubuntu_install_tensorflow.sh
+++ b/docker/install/ubuntu_install_tensorflow.sh
@@ -21,6 +21,5 @@ set -u
 set -o pipefail
 
 pip3 install \
-    "h5py==3.1.0" \
-    keras==2.6 \
-    tensorflow==2.6.5
+    keras==2.9 \
+    tensorflow==2.9.1
diff --git a/docker/install/ubuntu_install_tensorflow_aarch64.sh b/docker/install/ubuntu_install_tensorflow_aarch64.sh
index 59cc5b4814..c01b8d4aac 100755
--- a/docker/install/ubuntu_install_tensorflow_aarch64.sh
+++ b/docker/install/ubuntu_install_tensorflow_aarch64.sh
@@ -21,11 +21,6 @@ set -euxo pipefail
 # Build dependencies
 apt-install-and-clear -y --no-install-recommends libhdf5-dev
 
-# Downloading Tensorflow and installing it manually is needed
-# just as a temporary workaround while we move to a newer
-# version (>2.7) that is hosted in the official PyPI repository.
-linaro_repo="https://snapshots.linaro.org/ldcg/python/tensorflow-manylinux/43/tensorflow-aarch64"
-tensorflow_package="tensorflow_aarch64-2.6.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
 tmpdir=$(mktemp -d)
 
 cleanup()
@@ -36,12 +31,10 @@ cleanup()
 trap cleanup 0
 
 cd "${tmpdir}"
-wget -q "${linaro_repo}/${tensorflow_package}"
 
 # We're only using the TensorFlow wheel snapshot here as the
 # h5py wheel tries to use the wrong .so file
 pip3 install \
-    ${tensorflow_package} \
     "h5py==3.1.0" \
-    keras==2.6 \
-    "protobuf<4"
+    keras==2.9.0 \
+    tensorflow-aarch64==2.9.1
diff --git a/docker/install/ubuntu_install_tflite.sh b/docker/install/ubuntu_install_tflite.sh
index 8a394302fd..4b73c202bc 100755
--- a/docker/install/ubuntu_install_tflite.sh
+++ b/docker/install/ubuntu_install_tflite.sh
@@ -18,6 +18,7 @@
 
 set -e
 set -u
+set -x
 set -o pipefail
 
 # The tflite version should have matched versions to the tensorflow
@@ -38,8 +39,16 @@ pip3 install flatbuffers
 # The library is built at:
 # tensorflow/tensorflow/lite/tools/make/gen/*/lib/libtensorflow-lite.a.
 git clone https://github.com/tensorflow/tensorflow --branch=v${TENSORFLOW_VERSION} --depth 1
-./tensorflow/tensorflow/lite/tools/make/download_dependencies.sh
-./tensorflow/tensorflow/lite/tools/make/build_lib.sh
+
+mkdir -p /opt/tflite
+cd /opt/tflite
+cmake \
+  -DTFLITE_ENABLE_XNNPACK=OFF \
+  /tensorflow/tensorflow/lite
+
+cmake --build .
+cd -
+
 
 # Setup tflite from schema
 mkdir tflite
diff --git a/docker/install/ubuntu_install_vela.sh b/docker/install/ubuntu_install_vela.sh
index c72d118233..9e32889cd4 100755
--- a/docker/install/ubuntu_install_vela.sh
+++ b/docker/install/ubuntu_install_vela.sh
@@ -20,4 +20,4 @@ set -e
 set -u
 set -o pipefail
 
-pip3 install ethos-u-vela==3.2.0
+pip3 install ethos-u-vela==3.4.0
diff --git a/tests/scripts/task_config_build_cpu.sh b/tests/scripts/task_config_build_cpu.sh
index 84213be860..e4fac84055 100755
--- a/tests/scripts/task_config_build_cpu.sh
+++ b/tests/scripts/task_config_build_cpu.sh
@@ -37,7 +37,7 @@ echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake
 echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake
 echo set\(USE_VTA_TSIM ON\) >> config.cmake
 echo set\(USE_VTA_FSIM ON\) >> config.cmake
-echo set\(USE_TFLITE ON\) >> config.cmake
+echo set\(USE_TFLITE \"/opt/tflite\"\) >> config.cmake
 echo set\(USE_TENSORFLOW_PATH \"/tensorflow\"\) >> config.cmake
 echo set\(USE_FLATBUFFERS_PATH \"/flatbuffers\"\) >> config.cmake
 echo set\(USE_ETHOSN /opt/arm/ethosn-driver\) >> config.cmake


[tvm] 02/02: This is PR #12130.

Posted by le...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

leandron pushed a commit to branch ci-docker-staging
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 8ae520b1be5bd452d34237f812de6cab3120773e
Author: Leandro Nunes <le...@arm.com>
AuthorDate: Fri Jul 22 16:41:03 2022 +0100

    This is PR #12130.
---
 python/tvm/relay/frontend/keras.py           |  8 ++++---
 tests/python/frontend/tflite/test_forward.py | 35 +++++++++++++++++++++-------
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/python/tvm/relay/frontend/keras.py b/python/tvm/relay/frontend/keras.py
index 3f7a96544a..8c8a4a1ddc 100644
--- a/python/tvm/relay/frontend/keras.py
+++ b/python/tvm/relay/frontend/keras.py
@@ -635,9 +635,11 @@ def _convert_pooling(
             _op.nn.global_max_pool2d(inexpr, **global_pool_params), keras_layer, etab, data_layout
         )
     if pool_type == "GlobalAveragePooling2D":
-        return _convert_flatten(
-            _op.nn.global_avg_pool2d(inexpr, **global_pool_params), keras_layer, etab, data_layout
-        )
+        global_avg_pool2d = _op.nn.global_avg_pool2d(inexpr, **global_pool_params)
+        keep_dims = len(keras_layer.input.shape) == len(keras_layer.output.shape)
+        if keep_dims:
+            return global_avg_pool2d
+        return _convert_flatten(global_avg_pool2d, keras_layer, etab, data_layout)
     pool_h, pool_w = keras_layer.pool_size
     stride_h, stride_w = keras_layer.strides
     params = {
diff --git a/tests/python/frontend/tflite/test_forward.py b/tests/python/frontend/tflite/test_forward.py
index 6acc8554b4..709ed3f2bf 100644
--- a/tests/python/frontend/tflite/test_forward.py
+++ b/tests/python/frontend/tflite/test_forward.py
@@ -935,7 +935,11 @@ def _test_tflite2_quantized_convolution(
     )
 
     tflite_output = run_tflite_graph(tflite_model_quant, data)
-    tvm_output = run_tvm_graph(tflite_model_quant, data, data_in.name.replace(":0", ""))
+    if tf.__version__ < LooseVersion("2.9"):
+        input_node = data_in.name.replace(":0", "")
+    else:
+        input_node = "serving_default_" + data_in.name + ":0"
+    tvm_output = run_tvm_graph(tflite_model_quant, data, input_node)
     tvm.testing.assert_allclose(
         np.squeeze(tvm_output[0]), np.squeeze(tflite_output[0]), rtol=1e-2, atol=1e-2
     )
@@ -1934,10 +1938,12 @@ def _test_abs(data, quantized, int_quant_dtype=tf.int8):
         # TFLite 2.6.x upgrade support
         if tf.__version__ < LooseVersion("2.6.1"):
             in_node = ["serving_default_input_int8"]
-        else:
+        elif tf.__version__ < LooseVersion("2.9"):
             in_node = (
                 ["serving_default_input_int16"] if int_quant_dtype == tf.int16 else ["tfl.quantize"]
             )
+        else:
+            in_node = "serving_default_input"
 
         tvm_output = run_tvm_graph(tflite_model_quant, data, in_node)
         tvm.testing.assert_allclose(
@@ -1965,8 +1971,10 @@ def _test_rsqrt(data, quantized, int_quant_dtype=tf.int8):
             tf.math.rsqrt, data, int_quant_dtype=int_quant_dtype
         )
         tflite_output = run_tflite_graph(tflite_model_quant, data)
-        in_node = ["tfl.quantize"]
-
+        if tf.__version__ < LooseVersion("2.9"):
+            in_node = ["tfl.quantize"]
+        else:
+            in_node = "serving_default_input"
         tvm_output = run_tvm_graph(tflite_model_quant, data, in_node)
         tvm.testing.assert_allclose(
             np.squeeze(tvm_output[0]), np.squeeze(tflite_output[0]), rtol=1e-5, atol=1e-2
@@ -2047,7 +2055,10 @@ def _test_cos(data, quantized, int_quant_dtype=tf.int8):
             tf.math.cos, data, int_quant_dtype=int_quant_dtype
         )
         tflite_output = run_tflite_graph(tflite_model_quant, data)
-        in_node = ["tfl.quantize"]
+        if tf.__version__ < LooseVersion("2.9"):
+            in_node = ["tfl.quantize"]
+        else:
+            in_node = "serving_default_input"
         tvm_output = run_tvm_graph(tflite_model_quant, data, in_node)
         tvm.testing.assert_allclose(
             np.squeeze(tvm_output[0]), np.squeeze(tflite_output[0]), rtol=1e-5, atol=1e-2
@@ -2955,7 +2966,6 @@ def _test_quantize_dequantize(data):
     add = tf.keras.layers.Add()([data_in, relu])
     concat = tf.keras.layers.Concatenate(axis=0)([relu, add])
     keras_model = tf.keras.models.Model(inputs=data_in, outputs=concat)
-    input_name = data_in.name.split(":")[0]
 
     # To create quantized values with dynamic range of activations, needs representative dataset
     def representative_data_gen():
@@ -2965,7 +2975,11 @@ def _test_quantize_dequantize(data):
     tflite_model_quant = _quantize_keras_model(keras_model, representative_data_gen, True, True)
 
     tflite_output = run_tflite_graph(tflite_model_quant, data)
-    tvm_output = run_tvm_graph(tflite_model_quant, data, input_name)
+    if tf.__version__ < LooseVersion("2.9"):
+        in_node = data_in.name.split(":")[0]
+    else:
+        in_node = "serving_default_" + data_in.name + ":0"
+    tvm_output = run_tvm_graph(tflite_model_quant, data, in_node)
     tvm.testing.assert_allclose(
         np.squeeze(tvm_output[0]), np.squeeze(tflite_output[0]), rtol=1e-5, atol=1e-2
     )
@@ -2982,7 +2996,6 @@ def _test_quantize_dequantize_const(data):
     add = tf.keras.layers.Add()([data, relu])
     concat = tf.keras.layers.Concatenate(axis=0)([relu, add])
     keras_model = tf.keras.models.Model(inputs=data_in, outputs=concat)
-    input_name = data_in.name.split(":")[0]
 
     # To create quantized values with dynamic range of activations, needs representative dataset
     def representative_data_gen():
@@ -2992,7 +3005,11 @@ def _test_quantize_dequantize_const(data):
     tflite_model_quant = _quantize_keras_model(keras_model, representative_data_gen, True, True)
 
     tflite_output = run_tflite_graph(tflite_model_quant, data)
-    tvm_output = run_tvm_graph(tflite_model_quant, data, input_name)
+    if tf.__version__ < LooseVersion("2.9"):
+        in_node = data_in.name.split(":")[0]
+    else:
+        in_node = "serving_default_" + data_in.name + ":0"
+    tvm_output = run_tvm_graph(tflite_model_quant, data, in_node)
     tvm.testing.assert_allclose(
         np.squeeze(tvm_output[0]), np.squeeze(tflite_output[0]), rtol=1e-5, atol=1e-2
     )