From e6629706479421783d7ee5fa29eb3fe862d9b981 Mon Sep 17 00:00:00 2001 From: Alan MacDonald Date: Tue, 22 Nov 2022 08:52:43 -0800 Subject: [PATCH] [microTVM] enable building microTVM components by default (#13073) * enable micro by default * apply patch for ranlib fix * exclude windows build from including cctools * remove check for USE_MICRO to build crttest * disable USE_MICRO for hexagon builds * remove USE_MICRO conditional from TVM python package init * remove USE_MICRO restrictions for hexagon build * remove USE_MICRO conditional for MISRA-C test * set USE_MICRO to ON in tvm_option, set USE_MICRO to OFF for now in CPU minimal build Co-authored-by: Mehrdad Hessar --- CMakeLists.txt | 7 ++++++- cmake/config.cmake | 3 --- conda/recipe/build.sh | 3 +++ conda/recipe/meta.yaml | 3 +++ tests/scripts/task_config_build_arm.sh | 1 - tests/scripts/task_config_build_cortexm.sh | 1 - tests/scripts/task_config_build_cpu.sh | 1 - tests/scripts/task_config_build_gpu.sh | 1 - tests/scripts/task_config_build_gpu_other.sh | 1 - tests/scripts/task_config_build_hexagon.sh | 2 -- tests/scripts/task_config_build_i386.sh | 1 - tests/scripts/task_config_build_minimal.sh | 1 + tests/scripts/task_config_build_riscv.sh | 1 - tests/scripts/task_config_build_wasm.sh | 1 - 14 files changed, 13 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 736d516fa1f6..cb0bad8a50d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ tvm_option(USE_OPENMP "Build with OpenMP thread pool implementation" OFF) tvm_option(USE_RELAY_DEBUG "Building Relay in debug mode..." OFF) tvm_option(USE_RTTI "Build with RTTI" ON) tvm_option(USE_MSVC_MT "Build with MT" OFF) -tvm_option(USE_MICRO "Build with Micro TVM support" OFF) +tvm_option(USE_MICRO "Build with Micro TVM support" ON) tvm_option(INSTALL_DEV "Install compiler infrastructure" OFF) tvm_option(HIDE_PRIVATE_SYMBOLS "Compile with -fvisibility=hidden." OFF) tvm_option(USE_TF_TVMDSOOP "Build with TensorFlow TVMDSOOp" OFF) @@ -118,6 +118,11 @@ tvm_option(USE_CLML "Build with CLML Codegen support" OFF) tvm_option(USE_CLML_GRAPH_EXECUTOR "Build with CLML graph runtime" OFF) tvm_option(USE_UMA "Build with UMA support" OFF) +# disable microTVM for iOS and hexagon builds +if(${CMAKE_SYSTEM_NAME} MATCHES "iOS" OR USE_HEXAGON) + set(USE_MICRO OFF) +endif() + # include directories include_directories(${CMAKE_INCLUDE_PATH}) include_directories("include") diff --git a/cmake/config.cmake b/cmake/config.cmake index 679f5c459e87..0c803c0b6a2e 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -96,9 +96,6 @@ set(USE_SPIRV_KHR_INTEGER_DOT_PRODUCT OFF) # Whether enable OpenGL runtime set(USE_OPENGL OFF) -# Whether enable MicroTVM runtime -set(USE_MICRO OFF) - # Whether enable RPC runtime set(USE_RPC ON) diff --git a/conda/recipe/build.sh b/conda/recipe/build.sh index 0131fd65a48e..aa2d2f3d5fb3 100755 --- a/conda/recipe/build.sh +++ b/conda/recipe/build.sh @@ -45,6 +45,9 @@ rm -rf build || true mkdir -p build cd build +export PREFIX="${PREFIX}/" +cp -f ${PREFIX}/bin/ranlib $PREFIX + cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DCMAKE_BUILD_TYPE=Release \ -DUSE_RPC=ON \ diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml index 519b84c570d7..b8463ebdd059 100644 --- a/conda/recipe/meta.yaml +++ b/conda/recipe/meta.yaml @@ -45,6 +45,7 @@ requirements: host: - zlib - llvmdev >=11 + - cctools # [not win] outputs: - name: {{ pkg_name }}-libs @@ -62,10 +63,12 @@ outputs: - llvmdev >=11 - {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda] - cudnn >=7.6.0 # [cuda] + - cctools # [not win] run: - llvmdev >=11 - {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda] - cudnn >=7.6.0 # [cuda] + - cctools # [not win] - name: {{ pkg_name }} script: install_tvm_python.sh # [not win] diff --git a/tests/scripts/task_config_build_arm.sh b/tests/scripts/task_config_build_arm.sh index 516e6ac86791..35ecde2904bb 100755 --- a/tests/scripts/task_config_build_arm.sh +++ b/tests/scripts/task_config_build_arm.sh @@ -25,7 +25,6 @@ cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake echo set\(USE_RPC ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake echo set\(USE_PROFILER ON\) >> config.cmake echo set\(USE_LLVM llvm-config-8\) >> config.cmake diff --git a/tests/scripts/task_config_build_cortexm.sh b/tests/scripts/task_config_build_cortexm.sh index f15ed81711f6..5407079c1a2c 100755 --- a/tests/scripts/task_config_build_cortexm.sh +++ b/tests/scripts/task_config_build_cortexm.sh @@ -24,7 +24,6 @@ cd "$BUILD_DIR" cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_CMSISNN ON\) >> config.cmake echo set\(USE_ETHOSU ON\) >> config.cmake echo set\(USE_UMA ON\) >> config.cmake diff --git a/tests/scripts/task_config_build_cpu.sh b/tests/scripts/task_config_build_cpu.sh index e3d8aa9a1d1b..66fc161ece96 100755 --- a/tests/scripts/task_config_build_cpu.sh +++ b/tests/scripts/task_config_build_cpu.sh @@ -24,7 +24,6 @@ cd "$BUILD_DIR" cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake echo set\(USE_PROFILER ON\) >> config.cmake echo set\(USE_DNNL ON\) >> config.cmake diff --git a/tests/scripts/task_config_build_gpu.sh b/tests/scripts/task_config_build_gpu.sh index ca5f3e935c08..0b8be8ac4cbe 100755 --- a/tests/scripts/task_config_build_gpu.sh +++ b/tests/scripts/task_config_build_gpu.sh @@ -29,7 +29,6 @@ echo set\(USE_CUDA ON\) >> config.cmake echo set\(USE_VULKAN ON\) >> config.cmake echo set\(USE_OPENGL ON\) >> config.cmake echo set\(USE_OPENCL ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake echo set\(USE_LLVM \"/usr/bin/llvm-config-9 --link-static\"\) >> config.cmake echo set\(USE_NNPACK ON\) >> config.cmake diff --git a/tests/scripts/task_config_build_gpu_other.sh b/tests/scripts/task_config_build_gpu_other.sh index 6fb10d44508a..747e1006e507 100755 --- a/tests/scripts/task_config_build_gpu_other.sh +++ b/tests/scripts/task_config_build_gpu_other.sh @@ -27,7 +27,6 @@ cp ../cmake/config.cmake . echo set\(USE_OPENCL ON\) >> config.cmake echo set\(USE_ROCM ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_PROFILER ON\) >> config.cmake echo set\(USE_LIBBACKTRACE OFF\) >> config.cmake echo set\(CMAKE_CXX_FLAGS -Werror\) >> config.cmake diff --git a/tests/scripts/task_config_build_hexagon.sh b/tests/scripts/task_config_build_hexagon.sh index 0736ed6b53b8..c8e70c00f97d 100755 --- a/tests/scripts/task_config_build_hexagon.sh +++ b/tests/scripts/task_config_build_hexagon.sh @@ -25,8 +25,6 @@ cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake echo set\(USE_RPC ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake -echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake echo set\(USE_LLVM "${CLANG_LLVM_HOME}/bin/llvm-config"\) >> config.cmake if [[ ${CI:-false} == "true" ]]; then diff --git a/tests/scripts/task_config_build_i386.sh b/tests/scripts/task_config_build_i386.sh index 369706dfd34a..18a7189e1470 100755 --- a/tests/scripts/task_config_build_i386.sh +++ b/tests/scripts/task_config_build_i386.sh @@ -25,7 +25,6 @@ cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake echo set\(USE_RPC ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake echo set\(USE_PROFILER ON\) >> config.cmake echo set\(USE_LLVM llvm-config-4.0\) >> config.cmake diff --git a/tests/scripts/task_config_build_minimal.sh b/tests/scripts/task_config_build_minimal.sh index 651f54cea21b..27dc9d77567a 100755 --- a/tests/scripts/task_config_build_minimal.sh +++ b/tests/scripts/task_config_build_minimal.sh @@ -32,3 +32,4 @@ 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 +echo set\(USE_MICRO OFF\) >> config.cmake diff --git a/tests/scripts/task_config_build_riscv.sh b/tests/scripts/task_config_build_riscv.sh index 9e11e5e255e9..b39cb4b28e3b 100755 --- a/tests/scripts/task_config_build_riscv.sh +++ b/tests/scripts/task_config_build_riscv.sh @@ -24,7 +24,6 @@ cd "$BUILD_DIR" cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_CMSISNN ON\) >> config.cmake echo set\(USE_UMA ON\) >> config.cmake echo set\(USE_PROFILER ON\) >> config.cmake diff --git a/tests/scripts/task_config_build_wasm.sh b/tests/scripts/task_config_build_wasm.sh index daa5481bea9d..e96288e36b7e 100755 --- a/tests/scripts/task_config_build_wasm.sh +++ b/tests/scripts/task_config_build_wasm.sh @@ -24,7 +24,6 @@ cd "$BUILD_DIR" cp ../cmake/config.cmake . echo set\(USE_SORT ON\) >> config.cmake -echo set\(USE_MICRO ON\) >> config.cmake echo set\(USE_MICRO_STANDALONE_RUNTIME ON\) >> config.cmake echo set\(USE_PROFILER ON\) >> config.cmake echo set\(USE_LLVM llvm-config-11\) >> config.cmake