This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 58fc749f27 [REFACTOR] Delete src/support/libinfo.cc; replace with
runtime FFI-registry env query (#19477)
58fc749f27 is described below
commit 58fc749f273ed4b05de61aad8bed27902d4d51c5
Author: Tianqi Chen <[email protected]>
AuthorDate: Thu Apr 30 07:24:35 2026 -0400
[REFACTOR] Delete src/support/libinfo.cc; replace with runtime FFI-registry
env query (#19477)
## Summary
`support.GetLibInfo` exposed ~30 build-time `TVM_INFO_*` strings (git
hash, LLVM/MLIR versions, every `USE_*` flag). Real callers reduce to
"is this feature enabled?" — better answered at runtime. `USE_CUDA=ON`
does not mean a CUDA device is loadable; runtime discovery is the actual
signal. Git versioning is already tracked via `tvm.__version__`.
Changes:
- Delete `src/support/libinfo.cc`, `cmake/modules/LibInfo.cmake`,
`tests/lint/check_cmake_options.py`, and the `check-cmake-options`
pre-commit hook.
- Delete `tvm.support.libinfo()` (no shim — callers migrate to runtime
discovery).
- Add `tvm.support.detect_active_modules()` which queries the FFI global
function registry for `ffi.Module.create.<kind>` registrations (cuda,
vulkan, opencl). `describe()` now prints active runtimes instead of
CMake build flags.
- Migrate 5 in-tree callers: `_get_targets()` uses `cudnn.exists()` /
`tvm.runtime.enabled()` for CUDNN and Hexagon; `_cmake_flag_enabled()`
is rewritten as a static map from cmake flag names to
`tvm.runtime.enabled()` or FFI-registry probes; `clml_sdk_version()`
uses the existing `relax.get_openclml_version` FFI global;
`test_clml_ops.py` uses the new helper.
After this PR: `src/support/` is header-only.
---
.pre-commit-config.yaml | 8 -
CMakeLists.txt | 16 +-
cmake/modules/LibInfo.cmake | 116 --------
cmake/utils/FindLLVM.cmake | 3 -
python/tvm/contrib/hexagon/_ci_env_check.py | 5 +-
python/tvm/relax/backend/adreno/clml.py | 13 +-
python/tvm/support.py | 33 ++-
python/tvm/testing/utils.py | 129 +++++---
src/support/libinfo.cc | 323 ---------------------
tests/lint/check_cmake_options.py | 80 -----
tests/python/relax/backend/adreno/test_clml_ops.py | 2 +-
tests/python/relax/backend/adreno/utils.py | 14 +-
12 files changed, 122 insertions(+), 620 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 815d48118f..1b701aee57 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -35,14 +35,6 @@ repos:
language_version: python3
pass_filenames: false
verbose: false
- - id: check-cmake-options
- name: check CMake options mirroring
- entry: python tests/lint/check_cmake_options.py
- language: python
- language_version: python3
- pass_filenames: false
- verbose: false
-
# ---------- General file checks ----------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af86e3d846..e4065075cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -470,18 +470,11 @@ include(cmake/modules/contrib/NNAPI.cmake)
include(cmake/modules/contrib/ExampleNPU.cmake)
include(cmake/modules/contrib/vllm.cmake)
include(cmake/modules/Git.cmake)
-include(cmake/modules/LibInfo.cmake)
-
-set(LIBINFO_FILE ${CMAKE_CURRENT_LIST_DIR}/src/support/libinfo.cc)
-add_lib_info(${LIBINFO_FILE})
-list(REMOVE_ITEM COMPILER_SRCS ${LIBINFO_FILE})
add_library(tvm_objs OBJECT ${COMPILER_SRCS})
add_library(tvm_runtime_objs OBJECT ${RUNTIME_SRCS})
-add_library(tvm_libinfo_objs OBJECT ${LIBINFO_FILE})
target_link_libraries(tvm_objs PUBLIC tvm_ffi_header)
target_link_libraries(tvm_runtime_objs PUBLIC tvm_ffi_header)
-target_link_libraries(tvm_libinfo_objs PUBLIC tvm_ffi_header)
include(GNUInstallDirs)
@@ -520,15 +513,13 @@ set_property(TARGET tvm_runtime APPEND PROPERTY
LINK_OPTIONS "${TVM_VISIBILITY_F
if(TVM_VISIBILITY_FLAG)
target_compile_options(tvm_runtime_objs PRIVATE "${TVM_VISIBILITY_FLAG}")
target_compile_options(tvm_objs PRIVATE "${TVM_VISIBILITY_FLAG}")
- target_compile_options(tvm_libinfo_objs PRIVATE "${TVM_VISIBILITY_FLAG}")
endif()
-# Compiler library: built from compiler-only sources plus the libinfo TU.
+# Compiler library: built from compiler-only sources.
# Links against tvm_runtime (and tvm_ffi_shared transitively). Loaded with
# RTLD_LOCAL so compiler-internal symbols don't leak into the global namespace.
add_library(tvm_compiler SHARED
$<TARGET_OBJECTS:tvm_objs>
- $<TARGET_OBJECTS:tvm_libinfo_objs>
)
target_link_libraries(tvm_compiler PUBLIC tvm_runtime tvm_ffi_shared)
target_include_directories(tvm_compiler PUBLIC
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
@@ -585,7 +576,6 @@ if(TVM_DEBUG_WITH_ABI_CHANGE)
message(STATUS "Building with debug code that may cause ABI changes...")
target_compile_definitions(tvm_objs PRIVATE "TVM_DEBUG_WITH_ABI_CHANGE")
target_compile_definitions(tvm_runtime_objs PRIVATE
"TVM_DEBUG_WITH_ABI_CHANGE")
- target_compile_definitions(tvm_libinfo_objs PRIVATE
"TVM_DEBUG_WITH_ABI_CHANGE")
endif(TVM_DEBUG_WITH_ABI_CHANGE)
if(USE_THREADS AND NOT BUILD_FOR_HEXAGON)
@@ -715,10 +705,9 @@ install(
# More target definitions
if(MSVC)
- # tvm_objs / tvm_libinfo_objs build libtvm_compiler.dll → TVM_DLL=dllexport,
+ # tvm_objs builds libtvm_compiler.dll → TVM_DLL=dllexport,
# but TVM_RUNTIME_DLL=dllimport (runtime symbols come from
libtvm_runtime.dll).
target_compile_definitions(tvm_objs PRIVATE -DTVM_EXPORTS -DTVM_FFI_EXPORTS)
- target_compile_definitions(tvm_libinfo_objs PRIVATE -DTVM_EXPORTS
-DTVM_FFI_EXPORTS)
# tvm_runtime_objs builds libtvm_runtime.dll → TVM_RUNTIME_DLL=dllexport.
# No TVM_EXPORTS here: the runtime side never defines compiler-exported
# symbols, so leaving TVM_DLL as dllimport correctly fails any accidental
@@ -739,7 +728,6 @@ if(TVM_IS_DEBUG_BUILD)
if(FILE_PREFIX_MAP_SUPPORTED)
target_compile_options(tvm_compiler PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${FILE_PREFIX_MAP_FLAG}>)
target_compile_options(tvm_objs PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${FILE_PREFIX_MAP_FLAG}>)
- target_compile_options(tvm_libinfo_objs PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${FILE_PREFIX_MAP_FLAG}>)
target_compile_options(tvm_runtime PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${FILE_PREFIX_MAP_FLAG}>)
target_compile_options(tvm_runtime_objs PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:${FILE_PREFIX_MAP_FLAG}>)
endif()
diff --git a/cmake/modules/LibInfo.cmake b/cmake/modules/LibInfo.cmake
deleted file mode 100644
index 5c1286e0b5..0000000000
--- a/cmake/modules/LibInfo.cmake
+++ /dev/null
@@ -1,116 +0,0 @@
-# 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.
-
-# This script provides
-# - add_lib_info - A function to add definition flags to a specific file
-
-function(add_lib_info src_file)
- if (NOT DEFINED TVM_INFO_LLVM_VERSION)
- set(TVM_INFO_LLVM_VERSION "NOT-FOUND")
- else()
- string(STRIP ${TVM_INFO_LLVM_VERSION} TVM_INFO_LLVM_VERSION)
- endif()
- if (NOT DEFINED TVM_INFO_MLIR_VERSION)
- set(TVM_INFO_MLIR_VERSION "NOT-FOUND")
- else()
- string(STRIP ${TVM_INFO_MLIR_VERSION} TVM_INFO_MLIR_VERSION)
- endif()
- if (NOT DEFINED CUDA_VERSION)
- set(TVM_INFO_CUDA_VERSION "NOT-FOUND")
- else()
- string(STRIP ${CUDA_VERSION} TVM_INFO_CUDA_VERSION)
- endif()
-
- set_property(
- 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_GIT_COMMIT_HASH="${TVM_GIT_COMMIT_HASH}"
- TVM_INFO_GIT_COMMIT_TIME="${TVM_GIT_COMMIT_TIME}"
- 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_MLIR_VERSION="${TVM_INFO_MLIR_VERSION}"
- 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_BLAS="${USE_BLAS}"
- TVM_INFO_USE_BYODT_POSIT="${USE_BYODT_POSIT}"
- TVM_INFO_USE_COREML="${USE_COREML}"
- TVM_INFO_USE_CPP_RPC="${USE_CPP_RPC}"
- TVM_INFO_USE_CPP_RTVM="${USE_CPP_RTVM}"
- TVM_INFO_USE_CUBLAS="${USE_CUBLAS}"
- TVM_INFO_USE_CUDA="${USE_CUDA}"
- TVM_INFO_USE_NVTX="${USE_NVTX}"
- TVM_INFO_USE_NCCL="${USE_NCCL}"
- TVM_INFO_USE_CUDNN="${USE_CUDNN}"
- TVM_INFO_USE_CUSTOM_LOGGING="${USE_CUSTOM_LOGGING}"
- TVM_INFO_USE_CUTLASS="${USE_CUTLASS}"
- TVM_INFO_USE_AMX="${USE_AMX}"
- TVM_INFO_USE_DNNL="${USE_DNNL}"
- TVM_INFO_USE_GTEST="${USE_GTEST}"
- TVM_INFO_USE_HEXAGON="${USE_HEXAGON}"
- TVM_INFO_USE_HEXAGON_RPC="${USE_HEXAGON_RPC}"
- TVM_INFO_USE_HEXAGON_SDK="${USE_HEXAGON_SDK}"
- TVM_INFO_USE_HEXAGON_GTEST="${USE_HEXAGON_GTEST}"
- TVM_INFO_USE_HEXAGON_EXTERNAL_LIBS="${USE_HEXAGON_EXTERNAL_LIBS}"
- TVM_INFO_USE_IOS_RPC="${USE_IOS_RPC}"
- TVM_INFO_USE_KHRONOS_SPIRV="${USE_KHRONOS_SPIRV}"
- TVM_INFO_USE_LLVM="${USE_LLVM}"
- TVM_INFO_USE_MLIR="${USE_MLIR}"
- TVM_INFO_USE_METAL="${USE_METAL}"
- TVM_INFO_USE_MKL="${USE_MKL}"
- TVM_INFO_USE_MSVC_MT="${USE_MSVC_MT}"
- TVM_INFO_USE_OPENCL="${USE_OPENCL}"
- TVM_INFO_USE_OPENCL_ENABLE_HOST_PTR="${USE_OPENCL_ENABLE_HOST_PTR}"
- TVM_INFO_USE_OPENCL_GTEST="${USE_OPENCL_GTEST}"
- TVM_INFO_USE_OPENMP="${USE_OPENMP}"
- TVM_INFO_USE_RANDOM="${USE_RANDOM}"
- TVM_INFO_TVM_DEBUG_WITH_ABI_CHANGE="${TVM_DEBUG_WITH_ABI_CHANGE}"
- TVM_INFO_TVM_LOG_BEFORE_THROW="${TVM_LOG_BEFORE_THROW}"
- TVM_INFO_USE_HIPBLAS="${USE_HIPBLAS}"
- TVM_INFO_USE_ROCM="${USE_ROCM}"
- TVM_INFO_USE_RCCL="${USE_RCCL}"
- TVM_INFO_USE_RPC="${USE_RPC}"
- TVM_INFO_TVM_BUILD_PYTHON_MODULE="${TVM_BUILD_PYTHON_MODULE}"
- TVM_INFO_USE_RTTI="${USE_RTTI}"
- TVM_INFO_USE_SORT="${USE_SORT}"
-
TVM_INFO_USE_SPIRV_KHR_INTEGER_DOT_PRODUCT="${USE_SPIRV_KHR_INTEGER_DOT_PRODUCT}"
- TVM_INFO_USE_TENSORRT_CODEGEN="${USE_TENSORRT_CODEGEN}"
- TVM_INFO_USE_TENSORRT_RUNTIME="${USE_TENSORRT_RUNTIME}"
- TVM_INFO_USE_THREADS="${USE_THREADS}"
- TVM_INFO_USE_THRUST="${USE_THRUST}"
- TVM_INFO_USE_CURAND="${USE_CURAND}"
- TVM_INFO_USE_VULKAN="${USE_VULKAN}"
- TVM_INFO_USE_CLML="${USE_CLML}"
- TVM_INFO_USE_CLML_GRAPH_EXECUTOR="${USE_CLML_GRAPH_EXECUTOR}"
- TVM_INFO_USE_TVM_CLML_VERSION="${CLML_VERSION_MAJOR}"
- TVM_INFO_USE_CCACHE="${USE_CCACHE}"
- TVM_INFO_USE_NVSHMEM="${USE_NVSHMEM}"
- TVM_INFO_USE_NNAPI_CODEGEN="${USE_NNAPI_CODEGEN}"
- TVM_INFO_USE_NNAPI_RUNTIME="${USE_NNAPI_RUNTIME}"
- TVM_INFO_USE_EXAMPLE_NPU_CODEGEN="${USE_EXAMPLE_NPU_CODEGEN}"
- TVM_INFO_USE_EXAMPLE_NPU_RUNTIME="${USE_EXAMPLE_NPU_RUNTIME}"
- )
-
-endfunction()
diff --git a/cmake/utils/FindLLVM.cmake b/cmake/utils/FindLLVM.cmake
index 851e2acf54..8aa9c8b1b9 100644
--- a/cmake/utils/FindLLVM.cmake
+++ b/cmake/utils/FindLLVM.cmake
@@ -32,7 +32,6 @@
# - LLVM_LIBS
# - LLVM_DEFINITIONS
# - TVM_LLVM_VERSION
-# - TVM_INFO_LLVM_VERSION
#
macro(find_llvm use_llvm)
if(${use_llvm} MATCHES ${IS_FALSE_PATTERN})
@@ -72,7 +71,6 @@ macro(find_llvm use_llvm)
message(STATUS "Link with static LLVM libraries")
endif()
set(TVM_LLVM_VERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR})
- set(TVM_INFO_LLVM_VERSION
"${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
set(TVM_LLVM_HAS_AARCH64_TARGET 0)
if(DEFINED LLVM_TARGETS_TO_BUILD AND "AArch64" IN_LIST
LLVM_TARGETS_TO_BUILD)
set(TVM_LLVM_HAS_AARCH64_TARGET 1)
@@ -145,7 +143,6 @@ macro(find_llvm use_llvm)
string(REPLACE ${__llvm_prefix} "$" __llvm_cxxflags
${__llvm_cxxflags_space})
string(REPLACE ${__llvm_prefix} "$" __llvm_libfiles
${__llvm_libfiles_space})
# llvm version
- set(TVM_INFO_LLVM_VERSION ${__llvm_version})
string(REGEX REPLACE "^([^.]+)\.([^.])+\.[^.]+.*$" "\\1\\2"
TVM_LLVM_VERSION ${__llvm_version})
string(STRIP ${TVM_LLVM_VERSION} TVM_LLVM_VERSION)
# definitions
diff --git a/python/tvm/contrib/hexagon/_ci_env_check.py
b/python/tvm/contrib/hexagon/_ci_env_check.py
index c1c70750e8..e36dde5d21 100644
--- a/python/tvm/contrib/hexagon/_ci_env_check.py
+++ b/python/tvm/contrib/hexagon/_ci_env_check.py
@@ -37,10 +37,7 @@ def _compile_time_check():
Designed for use as a the ``compile_time_check`` argument to
`tvm.testing.Feature`.
"""
- if (
- tvm.testing.utils._cmake_flag_enabled("USE_LLVM")
- and tvm.target.codegen.llvm_version_major() < 7
- ):
+ if tvm.runtime.enabled("llvm") and tvm.target.codegen.llvm_version_major()
< 7:
return "Hexagon requires LLVM 7 or later"
if "HEXAGON_TOOLCHAIN" not in os.environ:
diff --git a/python/tvm/relax/backend/adreno/clml.py
b/python/tvm/relax/backend/adreno/clml.py
index 02baae58b1..2b3c78d6a6 100644
--- a/python/tvm/relax/backend/adreno/clml.py
+++ b/python/tvm/relax/backend/adreno/clml.py
@@ -86,9 +86,18 @@ class AppendReshapeToBNRewriterPass:
def clml_sdk_version():
- """Utility function to get clml version"""
+ """Utility function to get clml version.
- return int(tvm.support.libinfo().get("TVM_CLML_VERSION", 2))
+ Probes the FFI registry for the OpenCLML version registered by the
+ CLML backend at build time. Returns 2 when CLML is not present.
+ """
+ # Registry: "relax.get_openclml_version" — returns the CLML SDK version
+ # that TVM was built against; registered unconditionally in codegen.cc.
+ # Grep hint: grep -rn 'relax.get_openclml_version' src/
+ get_version = tvm.get_global_func("relax.get_openclml_version",
allow_missing=True)
+ if get_version is None:
+ return 2
+ return int(get_version())
def is_clml_runtime_enabled():
diff --git a/python/tvm/support.py b/python/tvm/support.py
index 7943abf7be..b5bb04ee25 100644
--- a/python/tvm/support.py
+++ b/python/tvm/support.py
@@ -30,30 +30,31 @@ from . import get_global_func
tvm_ffi.init_ffi_api("support", __name__)
-def libinfo():
- """Returns a dictionary containing compile-time info, including cmake
flags and git commit hash
+def detect_active_modules() -> dict:
+ """Detect device-runtime modules linked into the current libtvm
+ by querying the FFI global function registry for
+ ``ffi.Module.create.<kind>`` registrations.
+
+ Probes a minimal set of key device runtimes (cuda, vulkan, opencl);
+ expand the list when a new caller needs it.
Returns
-------
- info: Dict[str, str]
- The dictionary of compile-time info.
+ active : dict[str, bool]
+ Mapping from runtime kind to whether it is registered in this build.
"""
- get_lib_info_func = get_global_func("support.GetLibInfo",
allow_missing=True)
- if get_lib_info_func is not None:
- lib_info = get_lib_info_func()
- if lib_info is None:
- return {}
- else:
- return {}
- return dict(lib_info.items())
+ # Registry: "ffi.Module.create.<kind>" — per-backend device-module factory.
+ # Grep hint: grep -rn 'ffi.Module.create.' src/ python/
+ keys = ["cuda", "vulkan", "opencl"]
+ return {
+ k: get_global_func(f"ffi.Module.create.{k}", allow_missing=True) is
not None for k in keys
+ }
def describe():
"""
Print out information about TVM and the current Python environment
"""
- info = list((k, v) for k, v in libinfo().items())
- info = dict(sorted(info, key=lambda x: x[0]))
print("Python Environment")
sys_version = sys.version.replace("\n", " ")
uname = os.uname()
@@ -64,5 +65,5 @@ def describe():
f"os.uname() = {uname}",
]
print(textwrap.indent("\n".join(lines), prefix=" "))
- print("CMake Options:")
- print(textwrap.indent(json.dumps(info, indent=2), prefix=" "))
+ print("Active Device Runtimes:")
+ print(textwrap.indent(json.dumps(detect_active_modules(), indent=2),
prefix=" "))
diff --git a/python/tvm/testing/utils.py b/python/tvm/testing/utils.py
index f15768858b..fa741f1d5c 100644
--- a/python/tvm/testing/utils.py
+++ b/python/tvm/testing/utils.py
@@ -402,10 +402,10 @@ def _get_targets(target_names=None):
target_kind = target.split()[0]
if target_kind == "cuda" and "cudnn" in
tvm.target.Target(target).attrs.get("libs", []):
- is_enabled = tvm.support.libinfo()["USE_CUDNN"].lower() in ["on",
"true", "1"]
- is_runnable = is_enabled and cudnn.exists()
+ is_enabled = cudnn.exists()
+ is_runnable = is_enabled
elif target_kind == "hexagon":
- is_enabled = tvm.support.libinfo()["USE_HEXAGON"].lower() in
["on", "true", "1"]
+ is_enabled = tvm.runtime.enabled("hexagon")
# If Hexagon has compile-time support, we can always fall back
is_runnable = is_enabled and "ANDROID_SERIAL_NUMBER" in os.environ
else:
@@ -535,13 +535,6 @@ class Feature:
If None, defaults to the short name.
- cmake_flag: Optional[str]
-
- The flag that must be enabled in the config.cmake in order to
- use this feature.
-
- If None, no flag is required to use this feature.
-
target_kind_enabled: Optional[str]
The target kind that must be enabled to run tests using this
@@ -605,7 +598,6 @@ class Feature:
self,
name: str,
long_name: str | None = None,
- cmake_flag: str | None = None,
target_kind_enabled: str | None = None,
compile_time_check: Callable[[], bool | str] | None = None,
target_kind_hardware: str | None = None,
@@ -614,7 +606,6 @@ class Feature:
):
self.name = name
self.long_name = long_name or name
- self.cmake_flag = cmake_flag
self.target_kind_enabled = target_kind_enabled
self.compile_time_check = compile_time_check
self.target_kind_hardware = target_kind_hardware
@@ -665,15 +656,6 @@ class Feature:
),
)
- if self.cmake_flag is not None:
- yield pytest.mark.skipif(
- not _cmake_flag_enabled(self.cmake_flag),
- reason=(
- f"{self.long_name} support not enabled. "
- f"Set {self.cmake_flag} in config.cmake to enable."
- ),
- )
-
def _run_only_marks(self):
for parent in self.parent_features:
yield from self._all_features[parent]._run_only_marks()
@@ -838,7 +820,12 @@ def _multi_gpu_exists():
# Mark a test as requiring llvm to run
requires_llvm = Feature(
- "llvm", "LLVM", cmake_flag="USE_LLVM", target_kind_enabled="llvm",
target_kind_hardware="llvm"
+ "llvm",
+ "LLVM",
+ compile_time_check=lambda: tvm.runtime.enabled("llvm"),
+ run_time_check=lambda: tvm.runtime.enabled("llvm"),
+ target_kind_enabled="llvm",
+ target_kind_hardware="llvm",
)
# Mark a test as requiring a GPU to run.
@@ -875,7 +862,8 @@ requires_aarch64 = Feature(
requires_cuda = Feature(
"cuda",
"CUDA",
- cmake_flag="USE_CUDA",
+ compile_time_check=lambda: tvm.runtime.enabled("cuda"),
+ run_time_check=lambda: tvm.runtime.enabled("cuda"),
target_kind_enabled="cuda",
target_kind_hardware="cuda",
parent_features="gpu",
@@ -890,13 +878,39 @@ requires_tensorcore = Feature(
)
# Mark a test as requiring the cuDNN library.
-requires_cudnn = Feature("cudnn", "cuDNN", cmake_flag="USE_CUDNN",
parent_features="cuda")
+requires_cudnn = Feature(
+ "cudnn",
+ "cuDNN",
+ compile_time_check=lambda: tvm.get_global_func("tvm.contrib.cudnn.exists",
allow_missing=True)
+ is not None,
+ run_time_check=lambda: tvm.get_global_func("tvm.contrib.cudnn.exists",
allow_missing=True)
+ is not None,
+ parent_features="cuda",
+)
# Mark a test as requiring the cuBLAS library.
-requires_cublas = Feature("cublas", "cuBLAS", cmake_flag="USE_CUBLAS",
parent_features="cuda")
+requires_cublas = Feature(
+ "cublas",
+ "cuBLAS",
+ compile_time_check=lambda:
tvm.get_global_func("tvm.contrib.cublas.matmul", allow_missing=True)
+ is not None,
+ run_time_check=lambda: tvm.get_global_func("tvm.contrib.cublas.matmul",
allow_missing=True)
+ is not None,
+ parent_features="cuda",
+)
# Mark a test as requiring NCCL support
-requires_nccl = Feature("nccl", "NCCL", cmake_flag="USE_NCCL",
parent_features="cuda")
+requires_nccl = Feature(
+ "nccl",
+ "NCCL",
+ compile_time_check=lambda: tvm.get_global_func(
+ "tvm.contrib.nccl.init_nccl_uid", allow_missing=True
+ )
+ is not None,
+ run_time_check=lambda:
tvm.get_global_func("tvm.contrib.nccl.init_nccl_uid", allow_missing=True)
+ is not None,
+ parent_features="cuda",
+)
# Mark a test as requiring the NVPTX compilation on the CUDA runtime
requires_nvptx = Feature(
@@ -920,18 +934,19 @@ requires_cudagraph = Feature(
requires_adreno_opencl = Feature(
"opencl",
long_name="Remote Adreno OpenCL",
- cmake_flag="USE_OPENCL",
+ compile_time_check=lambda: tvm.runtime.enabled("opencl"),
+ run_time_check=lambda: tvm.runtime.enabled("opencl") and
os.getenv("RPC_TARGET") is not None,
target_kind_enabled="opencl",
target_kind_hardware=None,
parent_features="gpu",
- run_time_check=lambda: os.getenv("RPC_TARGET") is not None,
)
# Mark a test as requiring the OpenCL runtime
requires_opencl = Feature(
"opencl",
"OpenCL",
- cmake_flag="USE_OPENCL",
+ compile_time_check=lambda: tvm.runtime.enabled("opencl"),
+ run_time_check=lambda: tvm.runtime.enabled("opencl"),
target_kind_enabled="opencl",
target_kind_hardware="opencl" if "RPC_TARGET" not in os.environ else None,
parent_features="gpu" if "RPC_TARGET" not in os.environ else None,
@@ -941,7 +956,8 @@ requires_opencl = Feature(
requires_rocm = Feature(
"rocm",
"ROCm",
- cmake_flag="USE_ROCM",
+ compile_time_check=lambda: tvm.runtime.enabled("rocm"),
+ run_time_check=lambda: tvm.runtime.enabled("rocm"),
target_kind_enabled="rocm",
target_kind_hardware="rocm",
parent_features="gpu",
@@ -956,13 +972,22 @@ requires_matrixcore = Feature(
)
# Mark a test as requiring the hipBLAS library.
-requires_hipblas = Feature("hipblas", "hipBLAS", cmake_flag="USE_HIPBLAS",
parent_features="rocm")
+requires_hipblas = Feature(
+ "hipblas",
+ "hipBLAS",
+ compile_time_check=lambda:
tvm.get_global_func("tvm.contrib.hipblas.matmul", allow_missing=True)
+ is not None,
+ run_time_check=lambda: tvm.get_global_func("tvm.contrib.hipblas.matmul",
allow_missing=True)
+ is not None,
+ parent_features="rocm",
+)
# Mark a test as requiring the metal runtime
requires_metal = Feature(
"metal",
"Metal",
- cmake_flag="USE_METAL",
+ compile_time_check=lambda: tvm.runtime.enabled("metal"),
+ run_time_check=lambda: tvm.runtime.enabled("metal"),
target_kind_enabled="metal",
target_kind_hardware="metal",
parent_features="gpu",
@@ -972,7 +997,8 @@ requires_metal = Feature(
requires_vulkan = Feature(
"vulkan",
"Vulkan",
- cmake_flag="USE_VULKAN",
+ compile_time_check=lambda: tvm.runtime.enabled("vulkan"),
+ run_time_check=lambda: tvm.runtime.enabled("vulkan"),
target_kind_enabled="vulkan",
target_kind_hardware="vulkan",
parent_features="gpu",
@@ -982,7 +1008,14 @@ requires_vulkan = Feature(
requires_openclml = Feature(
"OpenCLML",
"CLML",
- cmake_flag="USE_CLML",
+ compile_time_check=lambda: tvm.get_global_func(
+ "relax.is_openclml_runtime_enabled", allow_missing=True
+ )
+ is not None,
+ run_time_check=lambda: tvm.get_global_func(
+ "relax.is_openclml_runtime_enabled", allow_missing=True
+ )
+ is not None,
target_kind_enabled="opencl",
)
@@ -990,20 +1023,32 @@ requires_openclml = Feature(
requires_nnapi = Feature(
"NNAPI",
"NNAPI",
- cmake_flag="USE_NNAPI_CODEGEN",
+ compile_time_check=lambda: tvm.get_global_func("relax.ext.nnapi",
allow_missing=True)
+ is not None,
+ run_time_check=lambda: tvm.get_global_func("relax.ext.nnapi",
allow_missing=True) is not None,
)
# Mark a test as requiring CUTLASS to run
-requires_cutlass = Feature("cutlass", "CUTLASS", cmake_flag="USE_CUTLASS")
+requires_cutlass = Feature(
+ "cutlass",
+ "CUTLASS",
+ compile_time_check=lambda: tvm.get_global_func("relax.ext.cutlass",
allow_missing=True)
+ is not None,
+ run_time_check=lambda: tvm.get_global_func("relax.ext.cutlass",
allow_missing=True) is not None,
+)
# Mark a test as requiring rpc to run
-requires_rpc = Feature("rpc", "RPC", cmake_flag="USE_RPC")
+requires_rpc = Feature(
+ "rpc",
+ "RPC",
+ compile_time_check=lambda: tvm.runtime.enabled("rpc"),
+ run_time_check=lambda: tvm.runtime.enabled("rpc"),
+)
# Mark a test as requiring Hexagon to run
requires_hexagon = Feature(
"hexagon",
"Hexagon",
- cmake_flag="USE_HEXAGON",
target_kind_enabled="hexagon",
compile_time_check=hexagon._compile_time_check,
run_time_check=hexagon._run_time_check,
@@ -1085,14 +1130,6 @@ requires_x86_amx = Feature(
)
-def _cmake_flag_enabled(flag):
- flag = tvm.support.libinfo()[flag]
-
- # Because many of the flags can be library flags, we check if the
- # flag is not disabled, rather than checking if it is enabled.
- return flag.lower() not in ["off", "false", "0"]
-
-
def _parse_target_entry(entry):
"""Parse a target entry from TVM_TEST_TARGETS env var.
diff --git a/src/support/libinfo.cc b/src/support/libinfo.cc
deleted file mode 100644
index e5b2ea8861..0000000000
--- a/src/support/libinfo.cc
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * 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.
- */
-#include <tvm/ffi/container/map.h>
-#include <tvm/ffi/function.h>
-#include <tvm/ffi/reflection/registry.h>
-#include <tvm/ffi/string.h>
-#include <tvm/runtime/base.h>
-
-#ifndef TVM_INFO_GIT_COMMIT_HASH
-#define TVM_INFO_GIT_COMMIT_HASH "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_GIT_COMMIT_TIME
-#define TVM_INFO_GIT_COMMIT_TIME "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_LLVM_VERSION
-#define TVM_INFO_LLVM_VERSION "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_MLIR_VERSION
-#define TVM_INFO_MLIR_VERSION "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_CUDA
-#define TVM_INFO_USE_CUDA "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_NVTX
-#define TVM_INFO_USE_NVTX "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_NCCL
-#define TVM_INFO_USE_NCCL "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_CUDA_VERSION
-#define TVM_INFO_CUDA_VERSION "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_OPENCL
-#define TVM_INFO_USE_OPENCL "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_OPENCL_ENABLE_HOST_PTR
-#define TVM_INFO_USE_OPENCL_ENABLE_HOST_PTR "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_OPENCL_EXTN_QCOM
-#define TVM_INFO_USE_OPENCL_EXTN_QCOM "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_OPENCL_GTEST
-#define TVM_INFO_USE_OPENCL_GTEST "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_VULKAN
-#define TVM_INFO_USE_VULKAN "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_METAL
-#define TVM_INFO_USE_METAL "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_ROCM
-#define TVM_INFO_USE_ROCM "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_ROCM_PATH
-#define TVM_INFO_ROCM_PATH "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_RCCL
-#define TVM_INFO_USE_RCCL "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_HEXAGON
-#define TVM_INFO_USE_HEXAGON "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_HEXAGON_SDK
-#define TVM_INFO_USE_HEXAGON_SDK "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_HEXAGON_GTEST
-#define TVM_INFO_USE_HEXAGON_GTEST "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_RPC
-#define TVM_INFO_USE_RPC "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_THREADS
-#define TVM_INFO_USE_THREADS "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_LLVM
-#define TVM_INFO_USE_LLVM "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_OPENMP
-#define TVM_INFO_USE_OPENMP "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_DEBUG_WITH_ABI_CHANGE
-#define TVM_INFO_DEBUG_WITH_ABI_CHANGE "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_LOG_BEFORE_THROW
-#define TVM_INFO_LOG_BEFORE_THROW "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_RTTI
-#define TVM_INFO_USE_RTTI "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_MSVC_MT
-#define TVM_INFO_USE_MSVC_MT "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_INSTALL_DEV
-#define TVM_INFO_INSTALL_DEV "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_HIDE_PRIVATE_SYMBOLS
-#define TVM_INFO_HIDE_PRIVATE_SYMBOLS "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_BYODT_POSIT
-#define TVM_INFO_USE_BYODT_POSIT "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_BLAS
-#define TVM_INFO_USE_BLAS "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_MKL
-#define TVM_INFO_USE_MKL "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_AMX
-#define TVM_INFO_USE_AMX "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_DNNL
-#define TVM_INFO_USE_DNNL "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_CUDNN
-#define TVM_INFO_USE_CUDNN "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_CUBLAS
-#define TVM_INFO_USE_CUBLAS "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_THRUST
-#define TVM_INFO_USE_THRUST "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_CURAND
-#define TVM_INFO_USE_CURAND "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_SORT
-#define TVM_INFO_USE_SORT "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_RANDOM
-#define TVM_INFO_USE_RANDOM "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_CPP_RPC
-#define TVM_INFO_USE_CPP_RPC "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_CPP_RTVM
-#define TVM_INFO_USE_CPP_RTVM "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_COREML
-#define TVM_INFO_USE_COREML "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_INDEX_DEFAULT_I64
-#define TVM_INFO_INDEX_DEFAULT_I64 "NOT-FOUND"
-#endif
-
-#ifndef TVM_CXX_COMPILER_PATH
-#define TVM_CXX_COMPILER_PATH ""
-#endif
-
-#ifndef TVM_INFO_USE_CCACHE
-#define TVM_INFO_USE_CCACHE "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_NVSHMEM
-#define TVM_INFO_USE_NVSHMEM "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_NNAPI_CODEGEN
-#define TVM_INFO_USE_NNAPI_CODEGEN "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_NNAPI_RUNTIME
-#define TVM_INFO_USE_NNAPI_RUNTIME "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_EXAMPLE_NPU_CODEGEN
-#define TVM_INFO_USE_EXAMPLE_NPU_CODEGEN "NOT-FOUND"
-#endif
-
-#ifndef TVM_INFO_USE_EXAMPLE_NPU_RUNTIME
-#define TVM_INFO_USE_EXAMPLE_NPU_RUNTIME "NOT-FOUND"
-#endif
-
-namespace tvm {
-
-/*!
- * \brief Get a dictionary containing compile-time info, including CMake flags
and git commit hash
- * \return The compile-time info
- */
-TVM_DLL ffi::Map<ffi::String, ffi::String> GetLibInfo() {
- ffi::Map<ffi::String, ffi::String> result = {
- {"BUILD_STATIC_RUNTIME", TVM_INFO_BUILD_STATIC_RUNTIME},
- {"COMPILER_RT_PATH", TVM_INFO_COMPILER_RT_PATH},
- {"CUDA_VERSION", TVM_INFO_CUDA_VERSION},
- {"GIT_COMMIT_HASH", TVM_INFO_GIT_COMMIT_HASH},
- {"GIT_COMMIT_TIME", TVM_INFO_GIT_COMMIT_TIME},
- {"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},
- {"MLIR_VERSION", TVM_INFO_MLIR_VERSION},
- {"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_BLAS", TVM_INFO_USE_BLAS},
- {"USE_BYODT_POSIT", TVM_INFO_USE_BYODT_POSIT},
- {"USE_COREML", TVM_INFO_USE_COREML},
- {"USE_CPP_RPC", TVM_INFO_USE_CPP_RPC},
- {"USE_CPP_RTVM", TVM_INFO_USE_CPP_RTVM},
- {"USE_CUBLAS", TVM_INFO_USE_CUBLAS},
- {"USE_CUDA", TVM_INFO_USE_CUDA},
- {"USE_NVTX", TVM_INFO_USE_NVTX},
- {"USE_NCCL", TVM_INFO_USE_NCCL},
- {"USE_CUDNN", TVM_INFO_USE_CUDNN},
- {"USE_CUSTOM_LOGGING", TVM_INFO_USE_CUSTOM_LOGGING},
- {"USE_CUTLASS", TVM_INFO_USE_CUTLASS},
- {"USE_AMX", TVM_INFO_USE_AMX},
- {"USE_DNNL", TVM_INFO_USE_DNNL},
- {"USE_GTEST", TVM_INFO_USE_GTEST},
- {"USE_HEXAGON", TVM_INFO_USE_HEXAGON},
- {"USE_HEXAGON_RPC", TVM_INFO_USE_HEXAGON_RPC},
- {"USE_HEXAGON_SDK", TVM_INFO_USE_HEXAGON_SDK},
- {"USE_HEXAGON_GTEST", TVM_INFO_USE_HEXAGON_GTEST},
- {"USE_HEXAGON_EXTERNAL_LIBS", TVM_INFO_USE_HEXAGON_EXTERNAL_LIBS},
- {"USE_IOS_RPC", TVM_INFO_USE_IOS_RPC},
- {"USE_KHRONOS_SPIRV", TVM_INFO_USE_KHRONOS_SPIRV},
- {"USE_LLVM", TVM_INFO_USE_LLVM},
- {"USE_MLIR", TVM_INFO_USE_MLIR},
- {"USE_METAL", TVM_INFO_USE_METAL},
- {"USE_MKL", TVM_INFO_USE_MKL},
- {"USE_MSVC_MT", TVM_INFO_USE_MSVC_MT},
- {"USE_OPENCL", TVM_INFO_USE_OPENCL},
- {"USE_OPENCL_ENABLE_HOST_PTR", TVM_INFO_USE_OPENCL_ENABLE_HOST_PTR},
- {"USE_OPENCL_EXTN_QCOM", TVM_INFO_USE_OPENCL_EXTN_QCOM},
- {"USE_OPENCL_GTEST", TVM_INFO_USE_OPENCL_GTEST},
- {"USE_OPENMP", TVM_INFO_USE_OPENMP},
- {"USE_RANDOM", TVM_INFO_USE_RANDOM},
- {"TVM_DEBUG_WITH_ABI_CHANGE", TVM_INFO_TVM_DEBUG_WITH_ABI_CHANGE},
- {"TVM_LOG_BEFORE_THROW", TVM_INFO_TVM_LOG_BEFORE_THROW},
- {"USE_HIPBLAS", TVM_INFO_USE_HIPBLAS},
- {"USE_ROCM", TVM_INFO_USE_ROCM},
- {"USE_RCCL", TVM_INFO_USE_RCCL},
- {"USE_RPC", TVM_INFO_USE_RPC},
- {"TVM_BUILD_PYTHON_MODULE", TVM_INFO_TVM_BUILD_PYTHON_MODULE},
- {"USE_RTTI", TVM_INFO_USE_RTTI},
- {"USE_SORT", TVM_INFO_USE_SORT},
- {"USE_SPIRV_KHR_INTEGER_DOT_PRODUCT",
TVM_INFO_USE_SPIRV_KHR_INTEGER_DOT_PRODUCT},
- {"USE_TENSORRT_CODEGEN", TVM_INFO_USE_TENSORRT_CODEGEN},
- {"USE_TENSORRT_RUNTIME", TVM_INFO_USE_TENSORRT_RUNTIME},
- {"USE_THREADS", TVM_INFO_USE_THREADS},
- {"USE_THRUST", TVM_INFO_USE_THRUST},
- {"USE_CURAND", TVM_INFO_USE_CURAND},
- {"USE_VULKAN", TVM_INFO_USE_VULKAN},
- {"USE_CLML", TVM_INFO_USE_CLML},
- {"TVM_CLML_VERSION", TVM_INFO_USE_TVM_CLML_VERSION},
- {"USE_CLML_GRAPH_EXECUTOR", TVM_INFO_USE_CLML_GRAPH_EXECUTOR},
- {"USE_CCACHE", TVM_INFO_USE_CCACHE},
- {"USE_NVSHMEM", TVM_INFO_USE_NVSHMEM},
- {"USE_NNAPI_CODEGEN", TVM_INFO_USE_NNAPI_CODEGEN},
- {"USE_NNAPI_RUNTIME", TVM_INFO_USE_NNAPI_RUNTIME},
- {"USE_EXAMPLE_NPU_CODEGEN", TVM_INFO_USE_EXAMPLE_NPU_CODEGEN},
- {"USE_EXAMPLE_NPU_RUNTIME", TVM_INFO_USE_EXAMPLE_NPU_RUNTIME},
- };
- return result;
-}
-
-TVM_FFI_STATIC_INIT_BLOCK() {
- namespace refl = tvm::ffi::reflection;
- refl::GlobalDef().def("support.GetLibInfo", GetLibInfo);
-}
-
-} // namespace tvm
diff --git a/tests/lint/check_cmake_options.py
b/tests/lint/check_cmake_options.py
deleted file mode 100644
index ab0ebc0b86..0000000000
--- a/tests/lint/check_cmake_options.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# 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.
-# ruff: noqa: E501
-
-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/python/relax/backend/adreno/test_clml_ops.py
b/tests/python/relax/backend/adreno/test_clml_ops.py
index 9c0e1808e0..69b437bd0d 100644
--- a/tests/python/relax/backend/adreno/test_clml_ops.py
+++ b/tests/python/relax/backend/adreno/test_clml_ops.py
@@ -57,7 +57,7 @@ from tvm.script import tirx as T
from tvm.script.ir_builder import IRBuilder
from tvm.script.ir_builder import relax as relax_builder
-CLML_VERSION = int(tvm.support.libinfo().get("TVM_CLML_VERSION", 4))
+CLML_VERSION = clml.clml_sdk_version()
TARGET_CLML_VERSION = int(os.environ.get("ADRENO_TARGET_CLML_VERSION", 4))
clml_target = tvm.target.Target("qcom/adreno-opencl-clml")
ref_target = tvm.target.Target("opencl")
diff --git a/tests/python/relax/backend/adreno/utils.py
b/tests/python/relax/backend/adreno/utils.py
index da52ffd1d2..243b315a2e 100644
--- a/tests/python/relax/backend/adreno/utils.py
+++ b/tests/python/relax/backend/adreno/utils.py
@@ -67,9 +67,8 @@ requires_adreno_opencl_vulkan = tvm.testing.Feature(
requires_adreno_vulkan = tvm.testing.Feature(
"adreno_vulkan",
"Adreno Vulkan",
- cmake_flag="USE_VULKAN",
target_kind_enabled="vulkan",
- run_time_check=run_time_check("vulkan")(),
+ run_time_check=lambda: tvm.runtime.enabled("vulkan") and
run_time_check("vulkan").check(),
parent_features="gpu" if "ADRENO_TARGET" not in os.environ else "rpc",
)
@@ -77,9 +76,8 @@ requires_adreno_vulkan = tvm.testing.Feature(
requires_adreno_opencl = tvm.testing.Feature(
"adreno_opencl",
"Adreno OpenCL",
- cmake_flag="USE_OPENCL",
target_kind_enabled="opencl",
- run_time_check=run_time_check("opencl")(),
+ run_time_check=lambda: tvm.runtime.enabled("opencl") and
run_time_check("opencl").check(),
parent_features="gpu" if "ADRENO_TARGET" not in os.environ else "rpc",
)
@@ -87,9 +85,8 @@ requires_adreno_opencl = tvm.testing.Feature(
requires_adreno_opencl_real = tvm.testing.Feature(
"adreno_opencl_real",
"Adreno OpenCL Real",
- cmake_flag="USE_OPENCL",
target_kind_enabled="opencl",
- run_time_check=run_time_check("real")(),
+ run_time_check=lambda: tvm.runtime.enabled("opencl") and
run_time_check("real").check(),
parent_features="rpc",
)
@@ -97,7 +94,10 @@ requires_adreno_opencl_real = tvm.testing.Feature(
requires_adreno_clml = tvm.testing.Feature(
"adreno_clml",
"Adreno OpenCLML",
- cmake_flag="USE_CLML",
+ run_time_check=lambda: tvm.get_global_func(
+ "relax.is_openclml_runtime_enabled", allow_missing=True
+ )
+ is not None,
target_kind_enabled="opencl",
parent_features="opencl" if "ADRENO_TARGET" not in os.environ else "rpc",
)