From b42795fd726ecb0ee60cc795c676dcaf5a6d3326 Mon Sep 17 00:00:00 2001 From: Florin-Gabriel Blanaru Date: Fri, 29 Jul 2022 08:11:01 -0700 Subject: [PATCH] Write TVM build options to file --- CMakeLists.txt | 2 + Jenkinsfile | 16 ----- ci/jenkins/Build.groovy.j2 | 9 --- ci/jenkins/Test.groovy.j2 | 7 --- cmake/utils/Summary.cmake | 7 +++ .../test_meta_schedule_task_scheduler.py | 7 ++- tests/scripts/ci.py | 11 ---- tests/scripts/task_cpp_unittest.sh | 15 +++++ tests/scripts/task_cpp_unittest_micro.sh | 58 ------------------- 9 files changed, 30 insertions(+), 102 deletions(-) delete mode 100755 tests/scripts/task_cpp_unittest_micro.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dc03ee0f40e1..a6be494a3a537 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 a072fa71e107e..c59d69e8fcc93 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -614,14 +614,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', @@ -794,7 +786,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 ( @@ -977,7 +968,6 @@ def shard_run_unittest_GPU_1_of_3() { ) cpp_unittest(ci_gpu) - cpp_micro_unittest(ci_gpu) sh( script: """ @@ -996,7 +986,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', @@ -1496,7 +1485,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", @@ -1765,7 +1753,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', @@ -2867,7 +2854,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', @@ -3256,7 +3242,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 ( @@ -3308,7 +3293,6 @@ stage('Test') { add_microtvm_permissions() ci_setup(ci_qemu) cpp_unittest(ci_qemu) - cpp_micro_unittest(ci_qemu) sh ( script: "${docker_run} ${ci_qemu} ./tests/scripts/task_python_microtvm.sh", label: 'Run microTVM tests', diff --git a/ci/jenkins/Build.groovy.j2 b/ci/jenkins/Build.groovy.j2 index 2694dd299a846..b00c723c716cc 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 e5a14439d8786..5f218ad26ef67 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", @@ -230,7 +225,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 ( @@ -249,7 +243,6 @@ stage('Test') { add_microtvm_permissions() ci_setup(ci_qemu) cpp_unittest(ci_qemu) - cpp_micro_unittest(ci_qemu) sh ( script: "${docker_run} ${ci_qemu} ./tests/scripts/task_python_microtvm.sh", label: 'Run microTVM tests', diff --git a/cmake/utils/Summary.cmake b/cmake/utils/Summary.cmake index 7059135fb22bd..1b973f253a00d 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 4830d42fc87e7..bbbd3c98eea65 100644 --- a/tests/python/unittest/test_meta_schedule_task_scheduler.py +++ b/tests/python/unittest/test_meta_schedule_task_scheduler.py @@ -349,7 +349,12 @@ def should_skip_oob_test(): ) -@pytest.mark.skipif(should_skip_oob_test(), reason="Does array access OOB. Remove once fixed.") +@pytest.mark.skipif( + should_skip_oob_test(), + reason="Does array access OOB. Do not skip this test " + "once https://github.com/apache/tvm/issues/12199 " + "is 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 1e55b5bae3bbb..60f5cf9ab626a 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 QEMU 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 a96e6ec5e4776..27899d06d7034 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 53bb55ca2a3da..0000000000000 --- 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 -