diff --git a/cmake/modules/LibInfo.cmake b/cmake/modules/LibInfo.cmake index bf548b232512c..b9da94aed4128 100644 --- a/cmake/modules/LibInfo.cmake +++ b/cmake/modules/LibInfo.cmake @@ -34,57 +34,84 @@ function(add_lib_info src_file) SOURCE ${src_file} APPEND PROPERTY COMPILE_DEFINITIONS + TVM_CXX_COMPILER_PATH="${CMAKE_CXX_COMPILER}" + TVM_INFO_BUILD_STATIC_RUNTIME="${BUILD_STATIC_RUNTIME}" + TVM_INFO_COMPILER_RT_PATH="${COMPILER_RT_PATH}" + TVM_INFO_CUDA_VERSION="${TVM_INFO_CUDA_VERSION}" + TVM_INFO_DLPACK_PATH="${DLPACK_PATH}" + TVM_INFO_DMLC_PATH="${DMLC_PATH}" TVM_INFO_GIT_COMMIT_HASH="${TVM_GIT_COMMIT_HASH}" TVM_INFO_GIT_COMMIT_TIME="${TVM_GIT_COMMIT_TIME}" - TVM_INFO_USE_CUDA="${USE_CUDA}" - TVM_INFO_USE_OPENCL="${USE_OPENCL}" - TVM_INFO_USE_VULKAN="${USE_VULKAN}" - TVM_INFO_USE_METAL="${USE_METAL}" - TVM_INFO_USE_ROCM="${USE_ROCM}" + TVM_INFO_HIDE_PRIVATE_SYMBOLS="${HIDE_PRIVATE_SYMBOLS}" + TVM_INFO_INDEX_DEFAULT_I64="${INDEX_DEFAULT_I64}" + TVM_INFO_INSTALL_DEV="${INSTALL_DEV}" + TVM_INFO_LLVM_VERSION="${TVM_INFO_LLVM_VERSION}" + TVM_INFO_PICOJSON_PATH="${PICOJSON_PATH}" + TVM_INFO_RANG_PATH="${RANG_PATH}" TVM_INFO_ROCM_PATH="${ROCM_PATH}" + TVM_INFO_SUMMARIZE="${SUMMARIZE}" + TVM_INFO_USE_ALTERNATIVE_LINKER="${USE_ALTERNATIVE_LINKER}" + TVM_INFO_USE_AOT_EXECUTOR="${USE_AOT_EXECUTOR}" + TVM_INFO_USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR="${USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR}" + TVM_INFO_USE_ARM_COMPUTE_LIB="${USE_ARM_COMPUTE_LIB}" + TVM_INFO_USE_BLAS="${USE_BLAS}" + TVM_INFO_USE_BNNS="${USE_BNNS}" + TVM_INFO_USE_BYODT_POSIT="${USE_BYODT_POSIT}" + TVM_INFO_USE_CMSISNN="${USE_CMSISNN}" + TVM_INFO_USE_COREML="${USE_COREML}" + TVM_INFO_USE_CPP_RPC="${USE_CPP_RPC}" + TVM_INFO_USE_CUBLAS="${USE_CUBLAS}" + TVM_INFO_USE_CUDA="${USE_CUDA}" + TVM_INFO_USE_CUDNN="${USE_CUDNN}" + TVM_INFO_USE_CUSTOM_LOGGING="${USE_CUSTOM_LOGGING}" + TVM_INFO_USE_CUTLASS="${USE_CUTLASS}" + TVM_INFO_USE_DNNL_CODEGEN="${USE_DNNL_CODEGEN}" + TVM_INFO_USE_ETHOSN="${USE_ETHOSN}" + TVM_INFO_USE_FALLBACK_STL_MAP="${USE_FALLBACK_STL_MAP}" + TVM_INFO_USE_GRAPH_EXECUTOR_CUDA_GRAPH="${USE_GRAPH_EXECUTOR_CUDA_GRAPH}" + TVM_INFO_USE_GRAPH_EXECUTOR="${USE_GRAPH_EXECUTOR}" + TVM_INFO_USE_GTEST="${USE_GTEST}" TVM_INFO_USE_HEXAGON_DEVICE="${USE_HEXAGON_DEVICE}" + TVM_INFO_USE_HEXAGON_RPC="${USE_HEXAGON_RPC}" TVM_INFO_USE_HEXAGON_SDK="${USE_HEXAGON_SDK}" - TVM_INFO_USE_RPC="${USE_RPC}" - TVM_INFO_USE_THREADS="${USE_THREADS}" + TVM_INFO_USE_IOS_RPC="${USE_IOS_RPC}" + TVM_INFO_USE_KHRONOS_SPIRV="${USE_KHRONOS_SPIRV}" + TVM_INFO_USE_LIBBACKTRACE="${USE_LIBBACKTRACE}" + TVM_INFO_USE_LIBTORCH="${USE_LIBTORCH}" TVM_INFO_USE_LLVM="${USE_LLVM}" - TVM_INFO_LLVM_VERSION="${TVM_INFO_LLVM_VERSION}" - TVM_INFO_CUDA_VERSION="${TVM_INFO_CUDA_VERSION}" - TVM_INFO_USE_STACKVM_RUNTIME="${USE_STACKVM_RUNTIME}" - TVM_INFO_USE_GRAPH_EXECUTOR="${USE_GRAPH_EXECUTOR}" - TVM_INFO_USE_PROFILER="${USE_PROFILER}" - TVM_INFO_USE_OPENMP="${USE_OPENMP}" - TVM_INFO_USE_RELAY_DEBUG="${USE_RELAY_DEBUG}" - TVM_INFO_USE_RTTI="${USE_RTTI}" - TVM_INFO_USE_MSVC_MT="${USE_MSVC_MT}" + TVM_INFO_USE_METAL="${USE_METAL}" + TVM_INFO_USE_MICRO_STANDALONE_RUNTIME="${USE_MICRO_STANDALONE_RUNTIME}" TVM_INFO_USE_MICRO="${USE_MICRO}" - TVM_INFO_INSTALL_DEV="${INSTALL_DEV}" - TVM_INFO_HIDE_PRIVATE_SYMBOLS="${HIDE_PRIVATE_SYMBOLS}" - TVM_INFO_USE_TF_TVMDSOOP="${USE_TF_TVMDSOOP}" - TVM_INFO_USE_PT_TVMDSOOP="${USE_PT_TVMDSOOP}" - TVM_INFO_USE_FALLBACK_STL_MAP="${USE_FALLBACK_STL_MAP}" - TVM_INFO_USE_BYODT_POSIT="${USE_BYODT_POSIT}" - TVM_INFO_USE_BLAS="${USE_BLAS}" + TVM_INFO_USE_MIOPEN="${USE_MIOPEN}" TVM_INFO_USE_MKL="${USE_MKL}" TVM_INFO_USE_MKLDNN="${USE_MKLDNN}" - TVM_INFO_USE_DNNL_CODEGEN="${USE_DNNL_CODEGEN}" - TVM_INFO_USE_CUDNN="${USE_CUDNN}" - TVM_INFO_USE_CUBLAS="${USE_CUBLAS}" - TVM_INFO_USE_THRUST="${USE_THRUST}" - TVM_INFO_USE_MIOPEN="${USE_MIOPEN}" - TVM_INFO_USE_ROCBLAS="${USE_ROCBLAS}" - TVM_INFO_USE_SORT="${USE_SORT}" + TVM_INFO_USE_MSVC_MT="${USE_MSVC_MT}" TVM_INFO_USE_NNPACK="${USE_NNPACK}" + TVM_INFO_USE_OPENCL="${USE_OPENCL}" + TVM_INFO_USE_OPENMP="${USE_OPENMP}" + TVM_INFO_USE_PAPI="${USE_PAPI}" + TVM_INFO_USE_PROFILER="${USE_PROFILER}" + TVM_INFO_USE_PT_TVMDSOOP="${USE_PT_TVMDSOOP}" TVM_INFO_USE_RANDOM="${USE_RANDOM}" - TVM_INFO_USE_MICRO_STANDALONE_RUNTIME="${USE_MICRO_STANDALONE_RUNTIME}" - TVM_INFO_USE_CPP_RPC="${USE_CPP_RPC}" - TVM_INFO_USE_TFLITE="${USE_TFLITE}" - TVM_INFO_USE_TENSORFLOW_PATH="${USE_TENSORFLOW_PATH}" - TVM_INFO_USE_COREML="${USE_COREML}" + TVM_INFO_USE_RELAY_DEBUG="${USE_RELAY_DEBUG}" + TVM_INFO_USE_ROCBLAS="${USE_ROCBLAS}" + TVM_INFO_USE_ROCM="${USE_ROCM}" + TVM_INFO_USE_RPC="${USE_RPC}" + TVM_INFO_USE_RTTI="${USE_RTTI}" + TVM_INFO_USE_RUST_EXT="${USE_RUST_EXT}" + TVM_INFO_USE_SORT="${USE_SORT}" + TVM_INFO_USE_SPIRV_KHR_INTEGER_DOT_PRODUCT="${USE_SPIRV_KHR_INTEGER_DOT_PRODUCT}" + TVM_INFO_USE_STACKVM_RUNTIME="${USE_STACKVM_RUNTIME}" TVM_INFO_USE_TARGET_ONNX="${USE_TARGET_ONNX}" - TVM_INFO_USE_ARM_COMPUTE_LIB="${USE_ARM_COMPUTE_LIB}" - TVM_INFO_USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR="${USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR}" - TVM_INFO_INDEX_DEFAULT_I64="${INDEX_DEFAULT_I64}" - TVM_CXX_COMPILER_PATH="${CMAKE_CXX_COMPILER}" + TVM_INFO_USE_TENSORFLOW_PATH="${USE_TENSORFLOW_PATH}" + TVM_INFO_USE_TENSORRT_CODEGEN="${USE_TENSORRT_CODEGEN}" + TVM_INFO_USE_TENSORRT_RUNTIME="${USE_TENSORRT_RUNTIME}" + TVM_INFO_USE_TF_TVMDSOOP="${USE_TF_TVMDSOOP}" + TVM_INFO_USE_TFLITE="${USE_TFLITE}" + TVM_INFO_USE_THREADS="${USE_THREADS}" + TVM_INFO_USE_THRUST="${USE_THRUST}" + TVM_INFO_USE_VITIS_AI="${USE_VITIS_AI}" + TVM_INFO_USE_VULKAN="${USE_VULKAN}" ) endfunction() diff --git a/python/tvm/support.py b/python/tvm/support.py index 1adbee09c52c0..2306aacfa3212 100644 --- a/python/tvm/support.py +++ b/python/tvm/support.py @@ -15,7 +15,12 @@ # specific language governing permissions and limitations # under the License. """Support infra of TVM.""" +import json +import textwrap import ctypes +import os +import tvm +import sys import tvm._ffi from .runtime.module import Module from . import get_global_func @@ -39,6 +44,23 @@ def libinfo(): return dict(lib_info.items()) +def describe(): + info = [(k, v) for k, v in libinfo().items()] + info = {k: v for k, v in sorted(info, key=lambda x: x[0])} + print("Python Environment") + sys_version = sys.version.replace("\n", " ") + uname = os.uname() + uname = f"{uname.sysname} {uname.release} {uname.version} {uname.machine}" + lines = [ + f"TVM version = {tvm.__version__}", + f"Python version = {sys_version} ({sys.maxsize.bit_length() + 1} bit)", + f"os.uname() = {uname}", + ] + print(textwrap.indent("\n".join(lines), prefix=" ")) + print("CMake Options:") + print(textwrap.indent(json.dumps(info, indent=2), prefix=" ")) + + class FrontendTestModule(Module): """A tvm.runtime.Module whose member functions are PackedFunc.""" diff --git a/src/support/libinfo.cc b/src/support/libinfo.cc index 7317cab665cfd..097271374925e 100644 --- a/src/support/libinfo.cc +++ b/src/support/libinfo.cc @@ -227,56 +227,85 @@ namespace tvm { */ TVM_DLL Map GetLibInfo() { Map result = { + {"BUILD_STATIC_RUNTIME", TVM_INFO_BUILD_STATIC_RUNTIME}, + {"COMPILER_RT_PATH", TVM_INFO_COMPILER_RT_PATH}, + {"CUDA_VERSION", TVM_INFO_CUDA_VERSION}, + {"DLPACK_PATH", TVM_INFO_DLPACK_PATH}, + {"DMLC_PATH", TVM_INFO_DMLC_PATH}, {"GIT_COMMIT_HASH", TVM_INFO_GIT_COMMIT_HASH}, {"GIT_COMMIT_TIME", TVM_INFO_GIT_COMMIT_TIME}, - {"USE_CUDA", TVM_INFO_USE_CUDA}, - {"USE_OPENCL", TVM_INFO_USE_OPENCL}, - {"USE_VULKAN", TVM_INFO_USE_VULKAN}, - {"USE_METAL", TVM_INFO_USE_METAL}, - {"USE_ROCM", TVM_INFO_USE_ROCM}, + {"HIDE_PRIVATE_SYMBOLS", TVM_INFO_HIDE_PRIVATE_SYMBOLS}, + {"INDEX_DEFAULT_I64", TVM_INFO_INDEX_DEFAULT_I64}, + {"INSTALL_DEV", TVM_INFO_INSTALL_DEV}, + {"LLVM_VERSION", TVM_INFO_LLVM_VERSION}, + {"PICOJSON_PATH", TVM_INFO_PICOJSON_PATH}, + {"RANG_PATH", TVM_INFO_RANG_PATH}, {"ROCM_PATH", TVM_INFO_ROCM_PATH}, + {"SUMMARIZE", TVM_INFO_SUMMARIZE}, + {"TVM_CXX_COMPILER_PATH", TVM_CXX_COMPILER_PATH}, + {"USE_ALTERNATIVE_LINKER", TVM_INFO_USE_ALTERNATIVE_LINKER}, + {"USE_AOT_EXECUTOR", TVM_INFO_USE_AOT_EXECUTOR}, + {"USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR", TVM_INFO_USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR}, + {"USE_ARM_COMPUTE_LIB", TVM_INFO_USE_ARM_COMPUTE_LIB}, + {"USE_BLAS", TVM_INFO_USE_BLAS}, + {"USE_BNNS", TVM_INFO_USE_BNNS}, + {"USE_BYODT_POSIT", TVM_INFO_USE_BYODT_POSIT}, + {"USE_CMSISNN", TVM_INFO_USE_CMSISNN}, + {"USE_COREML", TVM_INFO_USE_COREML}, + {"USE_CPP_RPC", TVM_INFO_USE_CPP_RPC}, + {"USE_CUBLAS", TVM_INFO_USE_CUBLAS}, + {"USE_CUDA", TVM_INFO_USE_CUDA}, + {"USE_CUDNN", TVM_INFO_USE_CUDNN}, + {"USE_CUSTOM_LOGGING", TVM_INFO_USE_CUSTOM_LOGGING}, + {"USE_CUTLASS", TVM_INFO_USE_CUTLASS}, + {"USE_DNNL_CODEGEN", TVM_INFO_USE_DNNL_CODEGEN}, + {"USE_ETHOSN", TVM_INFO_USE_ETHOSN}, + {"USE_FALLBACK_STL_MAP", TVM_INFO_USE_FALLBACK_STL_MAP}, + {"USE_GRAPH_EXECUTOR_CUDA_GRAPH", TVM_INFO_USE_GRAPH_EXECUTOR_CUDA_GRAPH}, + {"USE_GRAPH_EXECUTOR", TVM_INFO_USE_GRAPH_EXECUTOR}, + {"USE_GTEST", TVM_INFO_USE_GTEST}, {"USE_HEXAGON_DEVICE", TVM_INFO_USE_HEXAGON_DEVICE}, + {"USE_HEXAGON_RPC", TVM_INFO_USE_HEXAGON_RPC}, {"USE_HEXAGON_SDK", TVM_INFO_USE_HEXAGON_SDK}, - {"USE_RPC", TVM_INFO_USE_RPC}, - {"USE_THREADS", TVM_INFO_USE_THREADS}, + {"USE_IOS_RPC", TVM_INFO_USE_IOS_RPC}, + {"USE_KHRONOS_SPIRV", TVM_INFO_USE_KHRONOS_SPIRV}, + {"USE_LIBBACKTRACE", TVM_INFO_USE_LIBBACKTRACE}, + {"USE_LIBTORCH", TVM_INFO_USE_LIBTORCH}, {"USE_LLVM", TVM_INFO_USE_LLVM}, - {"LLVM_VERSION", TVM_INFO_LLVM_VERSION}, - {"CUDA_VERSION", TVM_INFO_CUDA_VERSION}, - {"USE_STACKVM_RUNTIME", TVM_INFO_USE_STACKVM_RUNTIME}, - {"USE_GRAPH_EXECUTOR", TVM_INFO_USE_GRAPH_EXECUTOR}, - {"USE_PROFILER", TVM_INFO_USE_PROFILER}, - {"USE_OPENMP", TVM_INFO_USE_OPENMP}, - {"USE_RELAY_DEBUG", TVM_INFO_USE_RELAY_DEBUG}, - {"USE_RTTI", TVM_INFO_USE_RTTI}, - {"USE_MSVC_MT", TVM_INFO_USE_MSVC_MT}, + {"USE_METAL", TVM_INFO_USE_METAL}, + {"USE_MICRO_STANDALONE_RUNTIME", TVM_INFO_USE_MICRO_STANDALONE_RUNTIME}, {"USE_MICRO", TVM_INFO_USE_MICRO}, - {"INSTALL_DEV", TVM_INFO_INSTALL_DEV}, - {"HIDE_PRIVATE_SYMBOLS", TVM_INFO_HIDE_PRIVATE_SYMBOLS}, - {"USE_TF_TVMDSOOP", TVM_INFO_USE_TF_TVMDSOOP}, - {"USE_FALLBACK_STL_MAP", TVM_INFO_USE_FALLBACK_STL_MAP}, - {"USE_BYODT_POSIT", TVM_INFO_USE_BYODT_POSIT}, - {"USE_BLAS", TVM_INFO_USE_BLAS}, + {"USE_MIOPEN", TVM_INFO_USE_MIOPEN}, {"USE_MKL", TVM_INFO_USE_MKL}, {"USE_MKLDNN", TVM_INFO_USE_MKLDNN}, - {"USE_DNNL_CODEGEN", TVM_INFO_USE_DNNL_CODEGEN}, - {"USE_CUDNN", TVM_INFO_USE_CUDNN}, - {"USE_CUBLAS", TVM_INFO_USE_CUBLAS}, - {"USE_THRUST", TVM_INFO_USE_THRUST}, - {"USE_MIOPEN", TVM_INFO_USE_MIOPEN}, - {"USE_ROCBLAS", TVM_INFO_USE_ROCBLAS}, - {"USE_SORT", TVM_INFO_USE_SORT}, + {"USE_MSVC_MT", TVM_INFO_USE_MSVC_MT}, {"USE_NNPACK", TVM_INFO_USE_NNPACK}, + {"USE_OPENCL", TVM_INFO_USE_OPENCL}, + {"USE_OPENMP", TVM_INFO_USE_OPENMP}, + {"USE_PAPI", TVM_INFO_USE_PAPI}, + {"USE_PROFILER", TVM_INFO_USE_PROFILER}, + {"USE_PT_TVMDSOOP", TVM_INFO_USE_PT_TVMDSOOP}, {"USE_RANDOM", TVM_INFO_USE_RANDOM}, - {"USE_MICRO_STANDALONE_RUNTIME", TVM_INFO_USE_MICRO_STANDALONE_RUNTIME}, - {"USE_CPP_RPC", TVM_INFO_USE_CPP_RPC}, - {"USE_TFLITE", TVM_INFO_USE_TFLITE}, - {"USE_TENSORFLOW_PATH", TVM_INFO_USE_TENSORFLOW_PATH}, - {"USE_COREML", TVM_INFO_USE_COREML}, + {"USE_RELAY_DEBUG", TVM_INFO_USE_RELAY_DEBUG}, + {"USE_ROCBLAS", TVM_INFO_USE_ROCBLAS}, + {"USE_ROCM", TVM_INFO_USE_ROCM}, + {"USE_RPC", TVM_INFO_USE_RPC}, + {"USE_RTTI", TVM_INFO_USE_RTTI}, + {"USE_RUST_EXT", TVM_INFO_USE_RUST_EXT}, + {"USE_SORT", TVM_INFO_USE_SORT}, + {"USE_SPIRV_KHR_INTEGER_DOT_PRODUCT", TVM_INFO_USE_SPIRV_KHR_INTEGER_DOT_PRODUCT}, + {"USE_STACKVM_RUNTIME", TVM_INFO_USE_STACKVM_RUNTIME}, {"USE_TARGET_ONNX", TVM_INFO_USE_TARGET_ONNX}, - {"USE_ARM_COMPUTE_LIB", TVM_INFO_USE_ARM_COMPUTE_LIB}, - {"USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR", TVM_INFO_USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR}, - {"INDEX_DEFAULT_I64", TVM_INFO_INDEX_DEFAULT_I64}, - {"TVM_CXX_COMPILER_PATH", TVM_CXX_COMPILER_PATH}}; + {"USE_TENSORFLOW_PATH", TVM_INFO_USE_TENSORFLOW_PATH}, + {"USE_TENSORRT_CODEGEN", TVM_INFO_USE_TENSORRT_CODEGEN}, + {"USE_TENSORRT_RUNTIME", TVM_INFO_USE_TENSORRT_RUNTIME}, + {"USE_TF_TVMDSOOP", TVM_INFO_USE_TF_TVMDSOOP}, + {"USE_TFLITE", TVM_INFO_USE_TFLITE}, + {"USE_THREADS", TVM_INFO_USE_THREADS}, + {"USE_THRUST", TVM_INFO_USE_THRUST}, + {"USE_VITIS_AI", TVM_INFO_USE_VITIS_AI}, + {"USE_VULKAN", TVM_INFO_USE_VULKAN}, + }; return result; } diff --git a/tests/lint/check_cmake_options.py b/tests/lint/check_cmake_options.py new file mode 100644 index 0000000000000..d276c6118e371 --- /dev/null +++ b/tests/lint/check_cmake_options.py @@ -0,0 +1,80 @@ +# 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. + +import argparse +import re +from pathlib import Path + + +REPO_ROOT = Path(__file__).resolve().parent.parent.parent + +LIBINFO_CC = REPO_ROOT / "src" / "support" / "libinfo.cc" +LIBINFO_CMAKE = REPO_ROOT / "cmake" / "modules" / "LibInfo.cmake" +CMAKELISTS = REPO_ROOT / "CMakeLists.txt" + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Check that CMake options are mirrored to libinfo.cc" + ) + + with open(CMAKELISTS) as f: + cmake = f.readlines() + + with open(LIBINFO_CC) as f: + libinfo = f.read() + + with open(LIBINFO_CMAKE) as f: + libinfo_cmake = f.read() + + # Read tvm_options from CMakeLists.txt + options = [] + for line in cmake: + m = re.search(r"tvm_option\((.*?) ", line) + if m is not None: + options.append(m.groups()[0]) + + # Check that each option is present in libinfo.cc + missing_lines = [] + for option in options: + expected_line = f' {{"{option}", TVM_INFO_{option}}},' + if expected_line not in libinfo: + missing_lines.append(expected_line) + + error = False + if len(missing_lines) > 0: + missing_lines = "\n".join(missing_lines) + print( + f"Missing these lines from {LIBINFO_CC.relative_to(REPO_ROOT)}, please update it\n{missing_lines}" + ) + error = True + + # Check that each option has a compile defintion in LibInfo.cmake + missing_cmake_lines = [] + for option in options: + expected_line = f' TVM_INFO_{option}="${{{option}}}"' + if expected_line not in libinfo_cmake: + missing_cmake_lines.append(expected_line) + + if len(missing_cmake_lines) > 0: + missing_cmake_lines = "\n".join(missing_cmake_lines) + print( + f"Missing these lines from {LIBINFO_CMAKE.relative_to(REPO_ROOT)}, please update it\n{missing_cmake_lines}" + ) + error = True + + if error: + exit(1) diff --git a/tests/scripts/task_lint.sh b/tests/scripts/task_lint.sh index a6021e60b65df..3708a9332ad84 100755 --- a/tests/scripts/task_lint.sh +++ b/tests/scripts/task_lint.sh @@ -31,6 +31,9 @@ tests/scripts/task_convert_scripts_to_python.sh echo "Checking file types..." python3 tests/lint/check_file_type.py +echo "Checking CMake <-> LibInfo options mirroring" +python3 tests/lint/check_cmake_options.py + echo "Checking ASF license headers..." tests/lint/check_asf_header.sh --local