f0ac8d62ef
## Summary
`tvm::runtime::regex_match` was a thin C++ wrapper that bounced through
a
global `ffi::Function` back into Python's `re.match`. It was introduced
solely to avoid pulling `<regex>` into TVM (libstdc++ dual-ABI conflict
with
pre-cxx11 pytorch wheels). The only C++ caller is the DNNL JSON runtime,
where
every pattern reduces to substring containment — `re.match` anchors at
the
start only, so `.*X.*` is equivalent to `s.find(X) != npos`.
- Remove `src/runtime/regex.{h,cc}` and the Python
`tvm.runtime.regex_match`
global registration.
- Add file-local `contains` / `contains_any` helpers in
`dnnl_json_runtime.cc`
and inline `std::string::find` at the 15 call sites.
- Drop the dead `regex.h` include from
`src/relax/transform/update_param_struct_info.cc`.
No CMakeLists.txt change needed — `src/runtime/*.cc` is picked up by
glob.
`USE_DNNL` is OFF in the ci_gpu container, so DNNL-specific runtime
tests
are not exercised locally. The DNNL translation unit compiles cleanly
with
the inlined helpers, and the full TVM build (636 targets) passes.
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
# isort: skip_file
|
|
# 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.
|
|
"""TVM runtime namespace."""
|
|
|
|
from tvm_ffi import convert, Object
|
|
from tvm_ffi._dtype import dtype as DataType, DataTypeCode
|
|
|
|
# Import _ffi_node_api for its side effect of installing AsRepr as
|
|
# tvm_ffi.core.__object_repr__ so TVM IR objects use the rich C++ ReprPrinter.
|
|
from . import _ffi_node_api
|
|
|
|
# class exposures
|
|
from .script_printer import Scriptable
|
|
from .object_generic import ObjectConvertible
|
|
from .device import Device
|
|
from ._tensor import Tensor, tensor, empty
|
|
from .module import Module
|
|
from .executable import Executable
|
|
|
|
# function exposures
|
|
from ._tensor import device, cpu, cuda, opencl, vulkan, metal
|
|
from ._tensor import vpi, rocm, ext_dev, from_dlpack
|
|
from .module import load_module, enabled, system_lib, load_static_library, num_threads
|
|
from .object_generic import const
|
|
from .params import (
|
|
save_param_dict,
|
|
load_param_dict,
|
|
save_param_dict_to_file,
|
|
load_param_dict_from_file,
|
|
)
|
|
|
|
try:
|
|
from . import disco
|
|
except (ImportError, ValueError):
|
|
# disco C++ runtime is in libtvm_runtime_extra which may not be present.
|
|
# Make the disco module optional.
|
|
disco = None # type: ignore[assignment]
|
|
|
|
from tvm_ffi import Shape as ShapeTuple
|