From 86c69fa49debaa2c72a755cbb69623ae41945fb1 Mon Sep 17 00:00:00 2001 From: Florin-Gabriel Blanaru Date: Sun, 24 Jul 2022 04:05:50 -0700 Subject: [PATCH 1/4] Add new docker image with minimal TVM configuration --- docker/Dockerfile.ci_minimal | 57 +++++++++++++++++++ .../install/ubuntu1804_manual_install_llvm.sh | 38 +++++++++++++ .../test_meta_schedule_task_scheduler.py | 1 + tests/scripts/ci.py | 13 +++++ tests/scripts/task_config_build_minimal.sh | 33 +++++++++++ tests/scripts/task_cpp_unittest.sh | 23 ++++---- 6 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 docker/Dockerfile.ci_minimal create mode 100755 docker/install/ubuntu1804_manual_install_llvm.sh create mode 100755 tests/scripts/task_config_build_minimal.sh diff --git a/docker/Dockerfile.ci_minimal b/docker/Dockerfile.ci_minimal new file mode 100644 index 000000000000..cf548989eba2 --- /dev/null +++ b/docker/Dockerfile.ci_minimal @@ -0,0 +1,57 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# CI docker minimal CPU env +FROM ubuntu:18.04 + +COPY utils/apt-install-and-clear.sh /usr/local/bin/apt-install-and-clear + +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_googletest.sh /install/ubuntu_install_googletest.sh +RUN bash /install/ubuntu_install_googletest.sh + +COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh +RUN bash /install/ubuntu1804_install_python.sh + +# Globally disable pip cache +RUN pip config set global.no-cache-dir false + +COPY install/ubuntu_install_python_package.sh /install/ubuntu_install_python_package.sh +RUN bash /install/ubuntu_install_python_package.sh + +COPY install/ubuntu1804_manual_install_llvm.sh /install/ubuntu1804_manual_install_llvm.sh +RUN bash /install/ubuntu1804_manual_install_llvm.sh + +# Rust env (build early; takes a while) +COPY install/ubuntu_install_rust.sh /install/ubuntu_install_rust.sh +RUN bash /install/ubuntu_install_rust.sh +ENV RUSTUP_HOME /opt/rust +ENV CARGO_HOME /opt/rust +ENV PATH $PATH:$CARGO_HOME/bin + +# AutoTVM deps +COPY install/ubuntu_install_redis.sh /install/ubuntu_install_redis.sh +RUN bash /install/ubuntu_install_redis.sh + +# sccache +COPY install/ubuntu_install_sccache.sh /install/ubuntu_install_sccache.sh +RUN bash /install/ubuntu_install_sccache.sh +ENV PATH /opt/sccache:$PATH \ No newline at end of file diff --git a/docker/install/ubuntu1804_manual_install_llvm.sh b/docker/install/ubuntu1804_manual_install_llvm.sh new file mode 100755 index 000000000000..f0e9abd1d9fd --- /dev/null +++ b/docker/install/ubuntu1804_manual_install_llvm.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e +set -u +set -o pipefail + +git clone --depth 1 --branch release/11.x https://github.com/llvm/llvm-project.git +pushd llvm-project +mkdir build +pushd build +cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_ENABLE_ASSERTIONS=ON \ + -DLLVM_ENABLE_PROJECTS="llvm;clang" \ + ../llvm +ninja install +popd +popd +rm -rf llvm-project + diff --git a/tests/python/unittest/test_meta_schedule_task_scheduler.py b/tests/python/unittest/test_meta_schedule_task_scheduler.py index fc2497f05303..ad4e78b68f18 100644 --- a/tests/python/unittest/test_meta_schedule_task_scheduler.py +++ b/tests/python/unittest/test_meta_schedule_task_scheduler.py @@ -337,6 +337,7 @@ def test_meta_schedule_task_scheduler_override_next_task_id_only(): # pylint: d ) +@pytest.mark.skip("Does array access OOB") def test_meta_schedule_task_scheduler_multiple_gradient_based(): num_trials_per_iter = 6 max_trials_per_task = 101 diff --git a/tests/scripts/ci.py b/tests/scripts/ci.py index f5c60c94502a..4cc19462c907 100755 --- a/tests/scripts/ci.py +++ b/tests/scripts/ci.py @@ -595,6 +595,19 @@ def add_subparser( "frontend": ("run frontend tests", ["./tests/scripts/task_python_frontend_cpu.sh"]), }, ), + generate_command( + name="minimal", + help="Run minimal CPU build and test(s)", + options={ + "cpp": CPP_UNITTEST, + "unittest": ( + "run unit tests", + [ + "./tests/scripts/task_python_unittest.sh", + ], + ), + }, + ), generate_command( name="i386", help="Run i386 build and test(s)", diff --git a/tests/scripts/task_config_build_minimal.sh b/tests/scripts/task_config_build_minimal.sh new file mode 100755 index 000000000000..21582cc752c2 --- /dev/null +++ b/tests/scripts/task_config_build_minimal.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -euxo pipefail + +BUILD_DIR=$1 +mkdir -p "$BUILD_DIR" +cd "$BUILD_DIR" +cp ../cmake/config.cmake . + +echo set\(USE_SORT ON\) >> config.cmake +echo set\(USE_LLVM llvm-config\) >> config.cmake +echo set\(USE_RELAY_DEBUG ON\) >> config.cmake +echo set\(CMAKE_CXX_FLAGS \"-Werror -Wp,-D_GLIBCXX_ASSERTIONS\"\) >> config.cmake +echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake +echo set\(USE_LIBBACKTRACE ON\) >> config.cmake +echo set\(USE_CCACHE OFF\) >> config.cmake +echo set\(SUMMARIZE ON\) >> config.cmake diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index 8ae2e9b1109f..ade05b9e461f 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -45,20 +45,23 @@ python3 tests/scripts/task_build.py \ --cmake-target cpptest \ --build-dir "${BUILD_DIR}" -# crttest requires USE_MICRO to be enabled, which is currently the case -# with all CI configs -pushd "${BUILD_DIR}" -ninja crttest -popd +# crttest requires USE_MICRO to be enabled. +if grep -Fq "set(USE_MICRO ON)" ${BUILD_DIR}/config.cmake; then + pushd "${BUILD_DIR}" + ninja crttest + popd +fi pushd "${BUILD_DIR}" ctest --gtest_death_test_style=threadsafe popd -# Test MISRA-C runtime -pushd apps/bundle_deploy -rm -rf build -make test_dynamic test_static -popd +# Test MISRA-C runtime. It requires USE_MICRO to be enabled. +if grep -Fq "set(USE_MICRO ON)" ${BUILD_DIR}/config.cmake; then + pushd apps/bundle_deploy + rm -rf build + make test_dynamic test_static + popd +fi From 87b4005d71dc6303f38e633c136dfcb8bf3ca7dc Mon Sep 17 00:00:00 2001 From: Florin-Gabriel Blanaru Date: Mon, 25 Jul 2022 11:12:09 -0700 Subject: [PATCH 2/4] Add minimal TVM build and testing to Jenkinsfile --- Jenkinsfile | 114 +++++++++++++++++- ci/jenkins/Build.groovy.j2 | 26 ++++ ci/jenkins/Jenkinsfile.j2 | 1 + ci/jenkins/Test.groovy.j2 | 22 ++++ ci/jenkins/generate.py | 4 + ci/jenkins/macros.j2 | 22 ++++ tests/python/ci/test_ci.py | 1 + .../test_meta_schedule_task_scheduler.py | 14 ++- tests/scripts/ci.py | 11 ++ tests/scripts/task_config_build_minimal.sh | 1 + tests/scripts/task_cpp_unittest.sh | 16 --- tests/scripts/task_cpp_unittest_micro.sh | 58 +++++++++ 12 files changed, 272 insertions(+), 18 deletions(-) create mode 100755 tests/scripts/task_cpp_unittest_micro.sh diff --git a/Jenkinsfile b/Jenkinsfile index a2fe67d4b5f3..a042d253c688 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,6 +52,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils ci_lint = 'tlcpack/ci-lint:20220715-060127-37f9d3c49' ci_gpu = 'tlcpack/ci-gpu:20220801-060139-d332eb374' ci_cpu = 'tlcpack/ci-cpu:20220715-060127-37f9d3c49' +ci_minimal = 'tlcpack/ci-minimal:20220725-133226-d3cefdaf1' ci_wasm = 'tlcpack/ci-wasm:20220715-060127-37f9d3c49' ci_i386 = 'tlcpack/ci-i386:20220715-060127-37f9d3c49' ci_cortexm = 'tlcpack/ci-cortexm:v0.01' @@ -66,6 +67,7 @@ properties([ parameters([ string(name: 'ci_arm_param', defaultValue: ''), string(name: 'ci_cpu_param', defaultValue: ''), + string(name: 'ci_minimal_param', defaultValue: ''), string(name: 'ci_gpu_param', defaultValue: ''), string(name: 'ci_hexagon_param', defaultValue: ''), string(name: 'ci_i386_param', defaultValue: ''), @@ -79,6 +81,7 @@ properties([ // is used) built_ci_arm = null; built_ci_cpu = null; + built_ci_minimal = null; built_ci_gpu = null; built_ci_hexagon = null; built_ci_i386 = null; @@ -273,7 +276,7 @@ def prepare() { if (env.DETERMINE_DOCKER_IMAGES == 'yes') { sh( - script: "./tests/scripts/determine_docker_images.py ci_arm=${ci_arm} ci_cpu=${ci_cpu} ci_gpu=${ci_gpu} ci_hexagon=${ci_hexagon} ci_i386=${ci_i386} ci_lint=${ci_lint} ci_cortexm=${ci_cortexm} ci_wasm=${ci_wasm} ", + script: "./tests/scripts/determine_docker_images.py ci_arm=${ci_arm} ci_cpu=${ci_cpu} ci_minimal=${ci_minimal} ci_gpu=${ci_gpu} ci_hexagon=${ci_hexagon} ci_i386=${ci_i386} ci_lint=${ci_lint} ci_cortexm=${ci_cortexm} ci_wasm=${ci_wasm} ", label: 'Decide whether to use tlcpack or tlcpackstaging for Docker images', ) // Pull image names from the results of should_rebuild_docker.py @@ -287,6 +290,11 @@ def prepare() { label: "Find docker image name for ci_cpu", returnStdout: true, ).trim() + ci_minimal = sh( + script: "cat .docker-image-names/ci_minimal", + label: "Find docker image name for ci_minimal", + returnStdout: true, + ).trim() ci_gpu = sh( script: "cat .docker-image-names/ci_gpu", label: "Find docker image name for ci_gpu", @@ -321,6 +329,7 @@ def prepare() { ci_arm = params.ci_arm_param ?: ci_arm ci_cpu = params.ci_cpu_param ?: ci_cpu + ci_minimal = params.ci_minimal_param ?: ci_minimal ci_gpu = params.ci_gpu_param ?: ci_gpu ci_hexagon = params.ci_hexagon_param ?: ci_hexagon ci_i386 = params.ci_i386_param ?: ci_i386 @@ -332,6 +341,7 @@ def prepare() { echo "Docker images being used in this build:" echo " ci_arm = ${ci_arm}" echo " ci_cpu = ${ci_cpu}" + echo " ci_minimal = ${ci_minimal}" echo " ci_gpu = ${ci_gpu}" echo " ci_hexagon = ${ci_hexagon}" echo " ci_i386 = ${ci_i386}" @@ -483,6 +493,17 @@ def build_docker_images() { } } }, + 'ci_minimal': { + node('CPU') { + timeout(time: max_time, unit: 'MINUTES') { + init_git() + // We're purposefully not setting the built image here since they + // are not yet being uploaded to tlcpack + // ci_minimal = build_image('ci_minimal') + built_ci_minimal = build_image('ci_minimal') + } + } + }, 'ci_gpu': { node('CPU') { timeout(time: max_time, unit: 'MINUTES') { @@ -629,6 +650,13 @@ def cpp_unittest(image) { ) } +def cpp_micro_unittest(image) { + sh ( + script: "${docker_run} --env CI_NUM_EXECUTORS ${image} ./tests/scripts/task_cpp_unittest_micro.sh", + label: 'Build and run Micro C++ tests', + ) +} + def add_microtvm_permissions() { sh( @@ -820,6 +848,36 @@ stage('Build') { Utils.markStageSkippedForConditional('BUILD: CPU') } }, + 'BUILD: CPU MINIMAL': { + if (!skip_ci && is_docs_only_build != 1) { + node('CPU-SMALL') { + ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/build-cpu-minimal") { + docker_init(ci_minimal) + init_git() + sh ( + script: "${docker_run} ${ci_minimal} ./tests/scripts/task_config_build_minimal.sh build", + label: 'Create CPU minimal cmake config', + ) + make(ci_minimal, 'build', '-j2') + sh( + script: """ + set -eux + md5sum build/libtvm.so + aws s3 cp --no-progress build/libtvm.so s3://${s3_prefix}/cpu-minimal/build/libtvm.so + md5sum build/libtvm_runtime.so + aws s3 cp --no-progress build/libtvm_runtime.so s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so + md5sum build/config.cmake + aws s3 cp --no-progress build/config.cmake s3://${s3_prefix}/cpu-minimal/build/config.cmake + """, + label: 'Upload artifacts to S3', + ) + + } + } + } else { + Utils.markStageSkippedForConditional('BUILD: CPU MINIMAL') + } + }, 'BUILD: WASM': { if (!skip_ci && is_docs_only_build != 1) { node('CPU-SMALL') { @@ -832,6 +890,7 @@ stage('Build') { ) make(ci_wasm, 'build', '-j2') cpp_unittest(ci_wasm) + cpp_micro_unittest(ci_wasm) timeout(time: max_time, unit: 'MINUTES') { ci_setup(ci_wasm) sh ( @@ -1114,6 +1173,7 @@ def shard_run_unittest_GPU_1_of_3() { ) cpp_unittest(ci_gpu) + cpp_micro_unittest(ci_gpu) sh( script: """ @@ -1152,6 +1212,7 @@ def shard_run_unittest_GPU_1_of_3() { ci_setup(ci_gpu) cpp_unittest(ci_gpu) + cpp_micro_unittest(ci_gpu) sh ( script: "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh", label: 'Run Python GPU unit tests', @@ -2127,6 +2188,7 @@ def shard_run_python_i386_1_of_5() { ci_setup(ci_i386) cpp_unittest(ci_i386) + cpp_micro_unittest(ci_i386) python_unittest(ci_i386) sh ( script: "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration_i386only.sh", @@ -2495,6 +2557,7 @@ def shard_run_test_Hexagon_1_of_7() { add_hexagon_permissions() ci_setup(ci_hexagon) cpp_unittest(ci_hexagon) + cpp_micro_unittest(ci_hexagon) sh ( script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh", label: 'Run Hexagon tests', @@ -4016,6 +4079,7 @@ def shard_run_topi_aarch64_1_of_2() { ci_setup(ci_arm) cpp_unittest(ci_arm) + cpp_micro_unittest(ci_arm) sh ( script: "${docker_run} ${ci_arm} ./tests/scripts/task_python_arm_compute_library.sh", label: 'Run test_arm_compute_lib test', @@ -4848,6 +4912,49 @@ def shard_run_test_Cortex_M_8_of_8() { } +def run_unittest_minimal() { + if (!skip_ci && is_docs_only_build != 1) { + node('CPU-SMALL') { + ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/ut-python-cpu-minimal") { + timeout(time: max_time, unit: 'MINUTES') { + try { + docker_init(ci_minimal) + init_git() + withEnv(['PLATFORM=minimal'], { + sh( + script: """ + set -eux + aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm.so build/libtvm.so + md5sum build/libtvm.so + aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so build/libtvm_runtime.so + md5sum build/libtvm_runtime.so + aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/config.cmake build/config.cmake + md5sum build/config.cmake + """, + label: 'Download artifacts from S3', + ) + + cpp_unittest(ci_minimal) + python_unittest(ci_minimal) + }) + } finally { + sh( + script: """ + set -eux + aws s3 cp --no-progress build/pytest-results s3://${s3_prefix}/pytest-results --recursive + """, + label: 'Upload JUnits to S3', + ) + + junit 'build/pytest-results/*.xml' + } + } + } + } + } else { + Utils.markStageSkippedForConditional('unittest: CPU MINIMAL') + } +} def test() { stage('Test') { @@ -5008,6 +5115,9 @@ stage('Test') { 'test: Cortex-M 8 of 8': { shard_run_test_Cortex_M_8_of_8() }, + 'unittest: CPU MINIMAL': { + run_unittest_minimal() + }, 'unittest: CPU': { if (!skip_ci && is_docs_only_build != 1) { node('CPU-SMALL') { @@ -5056,6 +5166,7 @@ stage('Test') { ci_setup(ci_cpu) cpp_unittest(ci_cpu) + cpp_micro_unittest(ci_cpu) python_unittest(ci_cpu) fsim_test(ci_cpu) sh ( @@ -5379,6 +5490,7 @@ def deploy() { def tag = "${date_Ymd_HMS}-${upstream_revision.substring(0, 8)}" update_docker(built_ci_arm, "tlcpackstaging/ci_arm:${tag}") update_docker(built_ci_cpu, "tlcpackstaging/ci_cpu:${tag}") + update_docker(built_ci_minimal, "tlcpackstaging/ci_minimal:${tag}") update_docker(built_ci_gpu, "tlcpackstaging/ci_gpu:${tag}") update_docker(built_ci_hexagon, "tlcpackstaging/ci_hexagon:${tag}") update_docker(built_ci_i386, "tlcpackstaging/ci_i386:${tag}") diff --git a/ci/jenkins/Build.groovy.j2 b/ci/jenkins/Build.groovy.j2 index a4316a268e9a..96c38f7f883d 100644 --- a/ci/jenkins/Build.groovy.j2 +++ b/ci/jenkins/Build.groovy.j2 @@ -33,6 +33,13 @@ def cpp_unittest(image) { ) } +def cpp_micro_unittest(image) { + sh ( + script: "${docker_run} --env CI_NUM_EXECUTORS ${image} ./tests/scripts/task_cpp_unittest_micro.sh", + label: 'Build and run Micro C++ tests', + ) +} + def add_microtvm_permissions() { {% for folder in microtvm_template_projects %} @@ -123,6 +130,24 @@ stage('Build') { Utils.markStageSkippedForConditional('BUILD: CPU') } }, + 'BUILD: CPU MINIMAL': { + if (!skip_ci && is_docs_only_build != 1) { + node('CPU-SMALL') { + ws({{ m.per_exec_ws('tvm/build-cpu-minimal') }}) { + docker_init(ci_minimal) + init_git() + sh ( + script: "${docker_run} ${ci_minimal} ./tests/scripts/task_config_build_minimal.sh build", + label: 'Create CPU minimal cmake config', + ) + make(ci_minimal, 'build', '-j2') + {{ m.upload_artifacts(tag='cpu-minimal', filenames=tvm_lib) }} + } + } + } else { + Utils.markStageSkippedForConditional('BUILD: CPU MINIMAL') + } + }, 'BUILD: WASM': { if (!skip_ci && is_docs_only_build != 1) { node('CPU-SMALL') { @@ -135,6 +160,7 @@ stage('Build') { ) make(ci_wasm, 'build', '-j2') cpp_unittest(ci_wasm) + cpp_micro_unittest(ci_wasm) timeout(time: max_time, unit: 'MINUTES') { ci_setup(ci_wasm) sh ( diff --git a/ci/jenkins/Jenkinsfile.j2 b/ci/jenkins/Jenkinsfile.j2 index 63131ff7ffc2..f91cf88a40b3 100644 --- a/ci/jenkins/Jenkinsfile.j2 +++ b/ci/jenkins/Jenkinsfile.j2 @@ -54,6 +54,7 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.Utils ci_lint = 'tlcpack/ci-lint:20220715-060127-37f9d3c49' ci_gpu = 'tlcpack/ci-gpu:20220801-060139-d332eb374' ci_cpu = 'tlcpack/ci-cpu:20220715-060127-37f9d3c49' +ci_minimal = 'tlcpack/ci-minimal:20220725-133226-d3cefdaf1' ci_wasm = 'tlcpack/ci-wasm:20220715-060127-37f9d3c49' ci_i386 = 'tlcpack/ci-i386:20220715-060127-37f9d3c49' ci_cortexm = 'tlcpack/ci-cortexm:v0.01' diff --git a/ci/jenkins/Test.groovy.j2 b/ci/jenkins/Test.groovy.j2 index b2afdacad7d1..5df1a41ace7e 100644 --- a/ci/jenkins/Test.groovy.j2 +++ b/ci/jenkins/Test.groovy.j2 @@ -16,10 +16,12 @@ {% if shard_index == 1 %} {{ m.download_artifacts(tag='gpu2', filenames=tvm_multilib) }} cpp_unittest(ci_gpu) + cpp_micro_unittest(ci_gpu) {{ m.download_artifacts(tag='gpu', filenames=tvm_multilib) }} ci_setup(ci_gpu) cpp_unittest(ci_gpu) + cpp_micro_unittest(ci_gpu) {% else %} {{ m.download_artifacts(tag='gpu', filenames=tvm_multilib) }} ci_setup(ci_gpu) @@ -68,6 +70,7 @@ ci_setup(ci_i386) {% if shard_index == 1 %} cpp_unittest(ci_i386) + cpp_micro_unittest(ci_i386) {% endif %} python_unittest(ci_i386) sh ( @@ -92,6 +95,7 @@ ci_setup(ci_hexagon) {% if shard_index == 1 %} cpp_unittest(ci_hexagon) + cpp_micro_unittest(ci_hexagon) {% endif %} sh ( script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh", @@ -160,6 +164,7 @@ ci_setup(ci_arm) {% if shard_index == 1 %} cpp_unittest(ci_arm) + cpp_micro_unittest(ci_arm) {% endif %} sh ( script: "${docker_run} ${ci_arm} ./tests/scripts/task_python_arm_compute_library.sh", @@ -211,6 +216,19 @@ ) {% endcall %} +def run_unittest_minimal() { + {% call m.test_step_body( + name="unittest: CPU MINIMAL", + node="CPU-SMALL", + ws="tvm/ut-python-cpu-minimal", + platform="minimal", + docker_image="ci_minimal", + ) %} + {{ m.download_artifacts(tag='cpu-minimal', filenames=tvm_lib) }} + cpp_unittest(ci_minimal) + python_unittest(ci_minimal) + {% endcall %} +} def test() { stage('Test') { @@ -223,6 +241,9 @@ stage('Test') { {{ method_name }}() }, {% endfor %} + 'unittest: CPU MINIMAL': { + run_unittest_minimal() + }, {% call m.test_step( name="unittest: CPU", node="CPU-SMALL", @@ -233,6 +254,7 @@ stage('Test') { {{ m.download_artifacts(tag='cpu', filenames=tvm_multilib_tsim) }} ci_setup(ci_cpu) cpp_unittest(ci_cpu) + cpp_micro_unittest(ci_cpu) python_unittest(ci_cpu) fsim_test(ci_cpu) sh ( diff --git a/ci/jenkins/generate.py b/ci/jenkins/generate.py index 82bf4e5aaa1f..3d0198ba6fd9 100644 --- a/ci/jenkins/generate.py +++ b/ci/jenkins/generate.py @@ -40,6 +40,10 @@ "name": "ci_cpu", "platform": "CPU", }, + { + "name": "ci_minimal", + "platform": "CPU", + }, { "name": "ci_gpu", "platform": "CPU", diff --git a/ci/jenkins/macros.j2 b/ci/jenkins/macros.j2 index 99b7dc1bcd90..f0867150436f 100644 --- a/ci/jenkins/macros.j2 +++ b/ci/jenkins/macros.j2 @@ -84,6 +84,28 @@ def {{ method_name }}() { {% endfor %} {% endmacro %} +{% macro test_step_body(name, node, ws, docker_image, platform) %} + if (!skip_ci && is_docs_only_build != 1) { + node('{{ node }}') { + ws({{ per_exec_ws(ws) }}) { + timeout(time: max_time, unit: 'MINUTES') { + try { + docker_init({{ docker_image }}) + init_git() + withEnv(['PLATFORM={{ platform }}'], { + {{ caller() | indent(width=8) | trim }} + }) + } finally { + {{ junit_to_s3() | indent(width=0) }} + junit 'build/pytest-results/*.xml' + } + } + } + } + } else { + Utils.markStageSkippedForConditional('{{ name }}') + } +{% endmacro %} {% macro test_step(name, node, ws, docker_image, platform) %} {% set test_dir_name = name.replace(":", "").replace(" ", "-").replace("-", "_")|string %} diff --git a/tests/python/ci/test_ci.py b/tests/python/ci/test_ci.py index 5ab5e6950494..1c2ab1ffb787 100644 --- a/tests/python/ci/test_ci.py +++ b/tests/python/ci/test_ci.py @@ -914,6 +914,7 @@ def test_open_docker_update_pr( "ci_lint", "ci_gpu", "ci_cpu", + "ci_minimal", "ci_wasm", "ci_i386", "ci_cortexm", diff --git a/tests/python/unittest/test_meta_schedule_task_scheduler.py b/tests/python/unittest/test_meta_schedule_task_scheduler.py index ad4e78b68f18..4830d42fc87e 100644 --- a/tests/python/unittest/test_meta_schedule_task_scheduler.py +++ b/tests/python/unittest/test_meta_schedule_task_scheduler.py @@ -23,6 +23,7 @@ import pytest import tvm import tvm.testing +from tvm.support import libinfo from tvm import meta_schedule as ms from tvm._ffi.base import TVMError from tvm.meta_schedule.testing.dummy_object import DummyBuilder, DummyRunner @@ -337,7 +338,18 @@ def test_meta_schedule_task_scheduler_override_next_task_id_only(): # pylint: d ) -@pytest.mark.skip("Does array access OOB") +def should_skip_oob_test(): + flags = libinfo() + # TODO(gigiblender) This combination of flags should be enabled only in the ci_minimal CI configuration. + # Remove this once the OOB test is fixed. + return ( + flags["USE_RELAY_DEBUG"] == "ON" + and flags["USE_LLVM"] == "llvm-config" + and flags["USE_MICRO"] != "ON" + ) + + +@pytest.mark.skipif(should_skip_oob_test(), reason="Does array access OOB. Remove once fixed.") def test_meta_schedule_task_scheduler_multiple_gradient_based(): num_trials_per_iter = 6 max_trials_per_task = 101 diff --git a/tests/scripts/ci.py b/tests/scripts/ci.py index 4cc19462c907..9035ff2268d4 100755 --- a/tests/scripts/ci.py +++ b/tests/scripts/ci.py @@ -556,6 +556,10 @@ def add_subparser( CPP_UNITTEST = ("run c++ unitests", ["./tests/scripts/task_cpp_unittest.sh {build_dir}"]) +CPP_MICRO_UNITTEST = ( + "run micro c++ unitests", + ["./tests/scripts/task_cpp_unittest_micro.sh {build_dir}"], +) generated = [ generate_command( @@ -563,6 +567,7 @@ def add_subparser( help="Run GPU build and test(s)", options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "topi": ("run topi tests", ["./tests/scripts/task_python_topi.sh"]), "unittest": ( "run unit tests", @@ -580,6 +585,7 @@ def add_subparser( help="Run CPU build and test(s)", options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "integration": ( "run integration tests", ["./tests/scripts/task_python_integration.sh"], @@ -613,6 +619,7 @@ def add_subparser( help="Run i386 build and test(s)", options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "integration": ( "run integration tests", [ @@ -627,6 +634,7 @@ def add_subparser( help="Run WASM build and test(s)", options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "test": ("run WASM tests", ["./tests/scripts/task_web_wasm.sh"]), }, ), @@ -635,6 +643,7 @@ def add_subparser( help="Run Cortex-M build and test(s)", options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "test": ( "run microTVM tests", [ @@ -650,6 +659,7 @@ def add_subparser( post_build=["./tests/scripts/task_build_hexagon_api.sh --output build-hexagon"], options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "test": ( "run Hexagon API/Python tests", [ @@ -664,6 +674,7 @@ def add_subparser( precheck=check_arm_qemu, options={ "cpp": CPP_UNITTEST, + "micro_cpp": CPP_MICRO_UNITTEST, "python": ( "run full Python tests", [ diff --git a/tests/scripts/task_config_build_minimal.sh b/tests/scripts/task_config_build_minimal.sh index 21582cc752c2..651f54cea21b 100755 --- a/tests/scripts/task_config_build_minimal.sh +++ b/tests/scripts/task_config_build_minimal.sh @@ -26,6 +26,7 @@ cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake echo set\(USE_LLVM llvm-config\) >> config.cmake echo set\(USE_RELAY_DEBUG ON\) >> config.cmake +echo set\(CMAKE_BUILD_TYPE=Debug\) >> config.cmake echo set\(CMAKE_CXX_FLAGS \"-Werror -Wp,-D_GLIBCXX_ASSERTIONS\"\) >> config.cmake echo set\(HIDE_PRIVATE_SYMBOLS ON\) >> config.cmake echo set\(USE_LIBBACKTRACE ON\) >> config.cmake diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index ade05b9e461f..a96e6ec5e477 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -45,23 +45,7 @@ python3 tests/scripts/task_build.py \ --cmake-target cpptest \ --build-dir "${BUILD_DIR}" -# crttest requires USE_MICRO to be enabled. -if grep -Fq "set(USE_MICRO ON)" ${BUILD_DIR}/config.cmake; then - pushd "${BUILD_DIR}" - ninja crttest - popd -fi - - pushd "${BUILD_DIR}" ctest --gtest_death_test_style=threadsafe popd -# Test MISRA-C runtime. It requires USE_MICRO to be enabled. -if grep -Fq "set(USE_MICRO ON)" ${BUILD_DIR}/config.cmake; then - pushd apps/bundle_deploy - rm -rf build - make test_dynamic test_static - popd -fi - diff --git a/tests/scripts/task_cpp_unittest_micro.sh b/tests/scripts/task_cpp_unittest_micro.sh new file mode 100755 index 000000000000..53bb55ca2a3d --- /dev/null +++ b/tests/scripts/task_cpp_unittest_micro.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -euxo pipefail + +if [ $# -gt 0 ]; then + BUILD_DIR="$1" +elif [ -n "${TVM_BUILD_PATH:-}" ]; then + # TVM_BUILD_PATH may contain multiple space-separated paths. If + # so, use the first one. + BUILD_DIR=$(IFS=" "; set -- $TVM_BUILD_PATH; echo $1) +else + BUILD_DIR=build +fi + +# Python is required by apps/bundle_deploy +source tests/scripts/setup-pytest-env.sh + +export LD_LIBRARY_PATH="lib:${LD_LIBRARY_PATH:-}" +# NOTE: important to use abspath, when VTA is enabled. +export VTA_HW_PATH=`pwd`/3rdparty/vta-hw + +# to avoid CI thread throttling. +export TVM_BIND_THREADS=0 +export OMP_NUM_THREADS=1 + +# Build cpptest suite +python3 tests/scripts/task_build.py \ + --sccache-bucket tvm-sccache-prod \ + --cmake-target cpptest \ + --build-dir "${BUILD_DIR}" + +# crttest +pushd "${BUILD_DIR}" +ninja crttest +popd + +# Test MISRA-C runtime. +pushd apps/bundle_deploy +rm -rf build +make test_dynamic test_static +popd + From 7de29e5f22e23b4a16d822d9385614cb7a063c27 Mon Sep 17 00:00:00 2001 From: Florin-Gabriel Blanaru Date: Fri, 29 Jul 2022 08:11:01 -0700 Subject: [PATCH 3/4] Write TVM build options to file --- CMakeLists.txt | 2 + Jenkinsfile | 17 +----- ci/jenkins/Build.groovy.j2 | 9 --- ci/jenkins/Test.groovy.j2 | 6 -- cmake/utils/Summary.cmake | 7 +++ .../test_meta_schedule_task_scheduler.py | 12 ---- tests/scripts/ci.py | 11 ---- tests/scripts/task_cpp_unittest.sh | 15 +++++ tests/scripts/task_cpp_unittest_micro.sh | 58 ------------------- 9 files changed, 25 insertions(+), 112 deletions(-) delete mode 100755 tests/scripts/task_cpp_unittest_micro.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dc03ee0f40e..a6be494a3a53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -794,3 +794,5 @@ find_and_set_linker(${USE_ALTERNATIVE_LINKER}) if(${SUMMARIZE}) print_summary() endif() + +dump_options_to_file("${TVM_ALL_OPTIONS}") diff --git a/Jenkinsfile b/Jenkinsfile index a042d253c688..fbd61c69e73a 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -500,7 +500,7 @@ def build_docker_images() { // We're purposefully not setting the built image here since they // are not yet being uploaded to tlcpack // ci_minimal = build_image('ci_minimal') - built_ci_minimal = build_image('ci_minimal') + built_ci_minimal = build_image('ci_minimal'); } } }, @@ -650,14 +650,6 @@ def cpp_unittest(image) { ) } -def cpp_micro_unittest(image) { - sh ( - script: "${docker_run} --env CI_NUM_EXECUTORS ${image} ./tests/scripts/task_cpp_unittest_micro.sh", - label: 'Build and run Micro C++ tests', - ) -} - - def add_microtvm_permissions() { sh( script: 'find build/microtvm_template_projects -type f | grep qemu-hack | xargs chmod +x', @@ -890,7 +882,6 @@ stage('Build') { ) make(ci_wasm, 'build', '-j2') cpp_unittest(ci_wasm) - cpp_micro_unittest(ci_wasm) timeout(time: max_time, unit: 'MINUTES') { ci_setup(ci_wasm) sh ( @@ -1173,7 +1164,6 @@ def shard_run_unittest_GPU_1_of_3() { ) cpp_unittest(ci_gpu) - cpp_micro_unittest(ci_gpu) sh( script: """ @@ -1212,7 +1202,6 @@ def shard_run_unittest_GPU_1_of_3() { ci_setup(ci_gpu) cpp_unittest(ci_gpu) - cpp_micro_unittest(ci_gpu) sh ( script: "${docker_run} ${ci_gpu} ./tests/scripts/task_python_unittest_gpuonly.sh", label: 'Run Python GPU unit tests', @@ -2188,7 +2177,6 @@ def shard_run_python_i386_1_of_5() { ci_setup(ci_i386) cpp_unittest(ci_i386) - cpp_micro_unittest(ci_i386) python_unittest(ci_i386) sh ( script: "${docker_run} ${ci_i386} ./tests/scripts/task_python_integration_i386only.sh", @@ -2557,7 +2545,6 @@ def shard_run_test_Hexagon_1_of_7() { add_hexagon_permissions() ci_setup(ci_hexagon) cpp_unittest(ci_hexagon) - cpp_micro_unittest(ci_hexagon) sh ( script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh", label: 'Run Hexagon tests', @@ -4079,7 +4066,6 @@ def shard_run_topi_aarch64_1_of_2() { ci_setup(ci_arm) cpp_unittest(ci_arm) - cpp_micro_unittest(ci_arm) sh ( script: "${docker_run} ${ci_arm} ./tests/scripts/task_python_arm_compute_library.sh", label: 'Run test_arm_compute_lib test', @@ -5166,7 +5152,6 @@ stage('Test') { ci_setup(ci_cpu) cpp_unittest(ci_cpu) - cpp_micro_unittest(ci_cpu) python_unittest(ci_cpu) fsim_test(ci_cpu) sh ( diff --git a/ci/jenkins/Build.groovy.j2 b/ci/jenkins/Build.groovy.j2 index 96c38f7f883d..21b8b2c65f8b 100644 --- a/ci/jenkins/Build.groovy.j2 +++ b/ci/jenkins/Build.groovy.j2 @@ -33,14 +33,6 @@ def cpp_unittest(image) { ) } -def cpp_micro_unittest(image) { - sh ( - script: "${docker_run} --env CI_NUM_EXECUTORS ${image} ./tests/scripts/task_cpp_unittest_micro.sh", - label: 'Build and run Micro C++ tests', - ) -} - - def add_microtvm_permissions() { {% for folder in microtvm_template_projects %} sh( @@ -160,7 +152,6 @@ stage('Build') { ) make(ci_wasm, 'build', '-j2') cpp_unittest(ci_wasm) - cpp_micro_unittest(ci_wasm) timeout(time: max_time, unit: 'MINUTES') { ci_setup(ci_wasm) sh ( diff --git a/ci/jenkins/Test.groovy.j2 b/ci/jenkins/Test.groovy.j2 index 5df1a41ace7e..09550a469701 100644 --- a/ci/jenkins/Test.groovy.j2 +++ b/ci/jenkins/Test.groovy.j2 @@ -16,12 +16,10 @@ {% if shard_index == 1 %} {{ m.download_artifacts(tag='gpu2', filenames=tvm_multilib) }} cpp_unittest(ci_gpu) - cpp_micro_unittest(ci_gpu) {{ m.download_artifacts(tag='gpu', filenames=tvm_multilib) }} ci_setup(ci_gpu) cpp_unittest(ci_gpu) - cpp_micro_unittest(ci_gpu) {% else %} {{ m.download_artifacts(tag='gpu', filenames=tvm_multilib) }} ci_setup(ci_gpu) @@ -70,7 +68,6 @@ ci_setup(ci_i386) {% if shard_index == 1 %} cpp_unittest(ci_i386) - cpp_micro_unittest(ci_i386) {% endif %} python_unittest(ci_i386) sh ( @@ -95,7 +92,6 @@ ci_setup(ci_hexagon) {% if shard_index == 1 %} cpp_unittest(ci_hexagon) - cpp_micro_unittest(ci_hexagon) {% endif %} sh ( script: "${docker_run} ${ci_hexagon} ./tests/scripts/task_python_hexagon.sh", @@ -164,7 +160,6 @@ ci_setup(ci_arm) {% if shard_index == 1 %} cpp_unittest(ci_arm) - cpp_micro_unittest(ci_arm) {% endif %} sh ( script: "${docker_run} ${ci_arm} ./tests/scripts/task_python_arm_compute_library.sh", @@ -254,7 +249,6 @@ stage('Test') { {{ m.download_artifacts(tag='cpu', filenames=tvm_multilib_tsim) }} ci_setup(ci_cpu) cpp_unittest(ci_cpu) - cpp_micro_unittest(ci_cpu) python_unittest(ci_cpu) fsim_test(ci_cpu) sh ( diff --git a/cmake/utils/Summary.cmake b/cmake/utils/Summary.cmake index 7059135fb22b..1b973f253a00 100644 --- a/cmake/utils/Summary.cmake +++ b/cmake/utils/Summary.cmake @@ -67,3 +67,10 @@ macro(print_summary) message(STATUS ${OUT} " : " ${OPTION_VALUE}) endforeach() endmacro() + +function(dump_options_to_file tvm_options) + file(REMOVE ${CMAKE_BINARY_DIR}/TVMBuildOptions.txt) + foreach(option ${tvm_options}) + file(APPEND ${CMAKE_BINARY_DIR}/TVMBuildOptions.txt "${option} ${${option}} \n") + endforeach() +endfunction() diff --git a/tests/python/unittest/test_meta_schedule_task_scheduler.py b/tests/python/unittest/test_meta_schedule_task_scheduler.py index 4830d42fc87e..3edd81ee9a11 100644 --- a/tests/python/unittest/test_meta_schedule_task_scheduler.py +++ b/tests/python/unittest/test_meta_schedule_task_scheduler.py @@ -338,18 +338,6 @@ def test_meta_schedule_task_scheduler_override_next_task_id_only(): # pylint: d ) -def should_skip_oob_test(): - flags = libinfo() - # TODO(gigiblender) This combination of flags should be enabled only in the ci_minimal CI configuration. - # Remove this once the OOB test is fixed. - return ( - flags["USE_RELAY_DEBUG"] == "ON" - and flags["USE_LLVM"] == "llvm-config" - and flags["USE_MICRO"] != "ON" - ) - - -@pytest.mark.skipif(should_skip_oob_test(), reason="Does array access OOB. Remove once fixed.") def test_meta_schedule_task_scheduler_multiple_gradient_based(): num_trials_per_iter = 6 max_trials_per_task = 101 diff --git a/tests/scripts/ci.py b/tests/scripts/ci.py index 9035ff2268d4..4cc19462c907 100755 --- a/tests/scripts/ci.py +++ b/tests/scripts/ci.py @@ -556,10 +556,6 @@ def add_subparser( CPP_UNITTEST = ("run c++ unitests", ["./tests/scripts/task_cpp_unittest.sh {build_dir}"]) -CPP_MICRO_UNITTEST = ( - "run micro c++ unitests", - ["./tests/scripts/task_cpp_unittest_micro.sh {build_dir}"], -) generated = [ generate_command( @@ -567,7 +563,6 @@ def add_subparser( help="Run GPU build and test(s)", options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "topi": ("run topi tests", ["./tests/scripts/task_python_topi.sh"]), "unittest": ( "run unit tests", @@ -585,7 +580,6 @@ def add_subparser( help="Run CPU build and test(s)", options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "integration": ( "run integration tests", ["./tests/scripts/task_python_integration.sh"], @@ -619,7 +613,6 @@ def add_subparser( help="Run i386 build and test(s)", options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "integration": ( "run integration tests", [ @@ -634,7 +627,6 @@ def add_subparser( help="Run WASM build and test(s)", options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "test": ("run WASM tests", ["./tests/scripts/task_web_wasm.sh"]), }, ), @@ -643,7 +635,6 @@ def add_subparser( help="Run Cortex-M build and test(s)", options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "test": ( "run microTVM tests", [ @@ -659,7 +650,6 @@ def add_subparser( post_build=["./tests/scripts/task_build_hexagon_api.sh --output build-hexagon"], options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "test": ( "run Hexagon API/Python tests", [ @@ -674,7 +664,6 @@ def add_subparser( precheck=check_arm_qemu, options={ "cpp": CPP_UNITTEST, - "micro_cpp": CPP_MICRO_UNITTEST, "python": ( "run full Python tests", [ diff --git a/tests/scripts/task_cpp_unittest.sh b/tests/scripts/task_cpp_unittest.sh index a96e6ec5e477..27899d06d703 100755 --- a/tests/scripts/task_cpp_unittest.sh +++ b/tests/scripts/task_cpp_unittest.sh @@ -45,7 +45,22 @@ python3 tests/scripts/task_build.py \ --cmake-target cpptest \ --build-dir "${BUILD_DIR}" +# crttest requries USE_MICRO to be enabled. +if grep -Fq "USE_MICRO ON" ${BUILD_DIR}/TVMBuildOptions.txt; then + pushd "${BUILD_DIR}" + ninja crttest + popd +fi + pushd "${BUILD_DIR}" ctest --gtest_death_test_style=threadsafe popd +# Test MISRA-C runtime. It requires USE_MICRO to be enabled. +if grep -Fq "USE_MICRO ON" ${BUILD_DIR}/TVMBuildOptions.txt; then + pushd apps/bundle_deploy + rm -rf build + make test_dynamic test_static + popd +fi + diff --git a/tests/scripts/task_cpp_unittest_micro.sh b/tests/scripts/task_cpp_unittest_micro.sh deleted file mode 100755 index 53bb55ca2a3d..000000000000 --- a/tests/scripts/task_cpp_unittest_micro.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -set -euxo pipefail - -if [ $# -gt 0 ]; then - BUILD_DIR="$1" -elif [ -n "${TVM_BUILD_PATH:-}" ]; then - # TVM_BUILD_PATH may contain multiple space-separated paths. If - # so, use the first one. - BUILD_DIR=$(IFS=" "; set -- $TVM_BUILD_PATH; echo $1) -else - BUILD_DIR=build -fi - -# Python is required by apps/bundle_deploy -source tests/scripts/setup-pytest-env.sh - -export LD_LIBRARY_PATH="lib:${LD_LIBRARY_PATH:-}" -# NOTE: important to use abspath, when VTA is enabled. -export VTA_HW_PATH=`pwd`/3rdparty/vta-hw - -# to avoid CI thread throttling. -export TVM_BIND_THREADS=0 -export OMP_NUM_THREADS=1 - -# Build cpptest suite -python3 tests/scripts/task_build.py \ - --sccache-bucket tvm-sccache-prod \ - --cmake-target cpptest \ - --build-dir "${BUILD_DIR}" - -# crttest -pushd "${BUILD_DIR}" -ninja crttest -popd - -# Test MISRA-C runtime. -pushd apps/bundle_deploy -rm -rf build -make test_dynamic test_static -popd - From a63c4a6f2d9a37d1d9267650ec2fd6a7924d2916 Mon Sep 17 00:00:00 2001 From: Florin-Gabriel Blanaru Date: Sat, 6 Aug 2022 04:56:56 -0700 Subject: [PATCH 4/4] Add retry for ci_minimal --- Jenkinsfile | 54 ++++++++++++++++++++++++++++++++++++++------ ci/jenkins/macros.j2 | 3 ++- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fbd61c69e73a..0114bf755cb7 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -854,12 +854,32 @@ stage('Build') { sh( script: """ set -eux + retry() { + local retries=\$1 + shift + + local count=0 + until "\$@"; do + exit=\$? + wait=\$((2 ** \$count)) + count=\$((\$count + 1)) + if [ \$count -lt \$retries ]; then + echo "Retry \$count/\$retries exited \$exit, retrying in \$wait seconds..." + sleep \$wait + else + echo "Retry \$count/\$retries exited \$exit, no more retries left." + return \$exit + fi + done + return 0 + } + md5sum build/libtvm.so - aws s3 cp --no-progress build/libtvm.so s3://${s3_prefix}/cpu-minimal/build/libtvm.so + retry 3 aws s3 cp --no-progress build/libtvm.so s3://${s3_prefix}/cpu-minimal/build/libtvm.so md5sum build/libtvm_runtime.so - aws s3 cp --no-progress build/libtvm_runtime.so s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so + retry 3 aws s3 cp --no-progress build/libtvm_runtime.so s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so md5sum build/config.cmake - aws s3 cp --no-progress build/config.cmake s3://${s3_prefix}/cpu-minimal/build/config.cmake + retry 3 aws s3 cp --no-progress build/config.cmake s3://${s3_prefix}/cpu-minimal/build/config.cmake """, label: 'Upload artifacts to S3', ) @@ -4910,11 +4930,31 @@ def run_unittest_minimal() { sh( script: """ set -eux - aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm.so build/libtvm.so + retry() { + local retries=\$1 + shift + + local count=0 + until "\$@"; do + exit=\$? + wait=\$((2 ** \$count)) + count=\$((\$count + 1)) + if [ \$count -lt \$retries ]; then + echo "Retry \$count/\$retries exited \$exit, retrying in \$wait seconds..." + sleep \$wait + else + echo "Retry \$count/\$retries exited \$exit, no more retries left." + return \$exit + fi + done + return 0 + } + + retry 3 aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm.so build/libtvm.so md5sum build/libtvm.so - aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so build/libtvm_runtime.so + retry 3 aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/libtvm_runtime.so build/libtvm_runtime.so md5sum build/libtvm_runtime.so - aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/config.cmake build/config.cmake + retry 3 aws s3 cp --no-progress s3://${s3_prefix}/cpu-minimal/build/config.cmake build/config.cmake md5sum build/config.cmake """, label: 'Download artifacts from S3', @@ -4927,7 +4967,7 @@ def run_unittest_minimal() { sh( script: """ set -eux - aws s3 cp --no-progress build/pytest-results s3://${s3_prefix}/pytest-results --recursive + aws s3 cp --no-progress build/pytest-results s3://${s3_prefix}/pytest-results/unittest_CPU_MINIMAL --recursive """, label: 'Upload JUnits to S3', ) diff --git a/ci/jenkins/macros.j2 b/ci/jenkins/macros.j2 index f0867150436f..082446cb11b6 100644 --- a/ci/jenkins/macros.j2 +++ b/ci/jenkins/macros.j2 @@ -85,6 +85,7 @@ def {{ method_name }}() { {% endmacro %} {% macro test_step_body(name, node, ws, docker_image, platform) %} +{% set test_dir_name = name.replace(":", "").replace(" ", "-").replace("-", "_")|string %} if (!skip_ci && is_docs_only_build != 1) { node('{{ node }}') { ws({{ per_exec_ws(ws) }}) { @@ -96,7 +97,7 @@ def {{ method_name }}() { {{ caller() | indent(width=8) | trim }} }) } finally { - {{ junit_to_s3() | indent(width=0) }} + {{ junit_to_s3(test_dir_name) | indent(width=0) }} junit 'build/pytest-results/*.xml' } }