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 db3fbde9a7 [REFACTOR] Remove obsolete APIs and compatibility wrappers
(#20451)
db3fbde9a7 is described below
commit db3fbde9a789d36408eb489a1e74613897eea7bc
Author: Tianqi Chen <[email protected]>
AuthorDate: Fri Sep 25 11:21:28 2026 -0400
[REFACTOR] Remove obsolete APIs and compatibility wrappers (#20451)
Retire deprecated TVMScript builder names,
`tvm.build`/`tvm.driver.build`, `VMBuiltinLower`, and inert Z3 context
scopes. Migrate first-party callers to their canonical replacements and
remove unused target, tensor, and tile-scheduler compatibility helpers.
Reject removed MKL and Hexagon configuration spellings with messages
identifying their replacement settings.
---
cmake/modules/Hexagon.cmake | 2 +-
cmake/modules/contrib/BLAS.cmake | 15 +++----
include/tvm/sym/analyzer.h | 16 -------
include/tvm/target/target.h | 9 ----
jvm/core/src/test/scripts/prepare_test_libs.py | 4 +-
python/tvm/__init__.py | 2 +-
python/tvm/backend/cuda/lang/tile_scheduler.py | 1 -
python/tvm/driver/__init__.py | 2 +-
python/tvm/driver/build_module.py | 33 ---------------
python/tvm/relax/script/ir_builder/__init__.py | 3 --
python/tvm/relax/script/ir_builder/ir.py | 16 -------
python/tvm/relax/transform/__init__.py | 1 -
python/tvm/relax/transform/transform.py | 15 -------
.../s_tir/meta_schedule/builder/local_builder.py | 4 +-
python/tvm/sym/__init__.py | 1 -
python/tvm/sym/analyzer.py | 15 -------
python/tvm/target/detect_target.py | 3 --
python/tvm/tirx/script/ir_builder/ir.py | 49 ----------------------
src/relax/backend/vm/lower_runtime_builtin.cc | 6 +--
src/relax/op/tensor/create.cc | 4 --
src/relax/op/tensor/create.h | 12 ------
src/relax/transform/rewrite_dataflow_reshape.cc | 2 +-
src/sym/analyzer.cc | 2 -
src/sym/z3_prover.cc | 13 ------
src/target/target.cc | 5 ---
.../codegen/test_target_codegen_static_init.py | 2 +-
tests/python/relax/test_transform.py | 4 +-
.../test_transform_legalize_ops_manipulate.py | 2 +-
tests/python/relax/test_tvmscript_ir_builder.py | 2 +-
tests/python/relax/test_vm_builtin_lower.py | 4 +-
tests/python/sym/test_sym_z3.py | 28 ++++++++-----
tests/python/te/test_te_create_primfunc.py | 2 +-
.../test_tir_transform_flatten_buffer.py | 2 +-
web/tests/python/prepare_test_libs.py | 2 +-
web/tests/python/webgpu_rpc_test.py | 2 +-
35 files changed, 45 insertions(+), 240 deletions(-)
diff --git a/cmake/modules/Hexagon.cmake b/cmake/modules/Hexagon.cmake
index 512a893c73..1ef746127d 100644
--- a/cmake/modules/Hexagon.cmake
+++ b/cmake/modules/Hexagon.cmake
@@ -54,7 +54,7 @@ set(TVMRT_SOURCE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/src/backend/hexagon/runtime")
set(TVM_CORE_RUNTIME_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/runtime")
if(DEFINED USE_HEXAGON_DEVICE)
- message(WARNING "USE_HEXAGON_DEVICE is deprecated, use USE_HEXAGON instead")
+ message(FATAL_ERROR "USE_HEXAGON_DEVICE has been removed. Use USE_HEXAGON
instead.")
endif()
# This .cmake file is included when building any part of TVM for any
diff --git a/cmake/modules/contrib/BLAS.cmake b/cmake/modules/contrib/BLAS.cmake
index 23bb44446f..710ce3ed2a 100644
--- a/cmake/modules/contrib/BLAS.cmake
+++ b/cmake/modules/contrib/BLAS.cmake
@@ -15,6 +15,10 @@
# specific language governing permissions and limitations
# under the License.
+if(DEFINED USE_MKL_PATH)
+ message(FATAL_ERROR "USE_MKL_PATH has been removed. Set USE_MKL to the MKL
installation path instead.")
+endif()
+
if(USE_BLAS STREQUAL "openblas")
find_library(BLAS_LIBRARY openblas)
add_library(tvm_blas_objs OBJECT src/runtime/extra/contrib/cblas/cblas.cc)
@@ -40,21 +44,14 @@ elseif(USE_BLAS STREQUAL "apple")
target_link_libraries(tvm_runtime_extra PRIVATE tvm_blas_objs
${BLAS_LIBRARY})
message(STATUS "Use BLAS library " ${BLAS_LIBRARY})
elseif(USE_BLAS STREQUAL "mkl")
- message(DEPRECATION "USE_BLAS=mkl is deprecated. Use USE_MKL=ON instead.")
- set(USE_MKL ON)
+ message(FATAL_ERROR "USE_BLAS=mkl has been removed. Use USE_MKL=ON instead.")
elseif(USE_BLAS STREQUAL "none")
# pass
else()
message(FATAL_ERROR "Invalid option: USE_BLAS=" ${USE_BLAS})
endif()
-if(USE_MKL OR USE_MKL_PATH)
- if(USE_MKL_PATH)
- message(DEPRECATION "USE_MKL_PATH=${USE_MKL_PATH} is deprecated. Use
USE_MKL=${USE_MKL_PATH} instead.")
- endif()
- if(NOT USE_MKL)
- set(USE_MKL ${USE_MKL_PATH})
- endif()
+if(USE_MKL)
if(NOT IS_DIRECTORY ${USE_MKL})
set(USE_MKL /opt/intel/mkl)
endif()
diff --git a/include/tvm/sym/analyzer.h b/include/tvm/sym/analyzer.h
index c1dd52f319..3c684a39b3 100644
--- a/include/tvm/sym/analyzer.h
+++ b/include/tvm/sym/analyzer.h
@@ -595,22 +595,6 @@ class IntSetAnalyzer {
Impl* impl_;
};
-/*!
- * \brief Enter a thread-local Z3 context scope.
- *
- * Deprecated no-op. Every materialized Z3 solver owns a private context,
- * which subsumes the per-compilation isolation these scopes provided; kept
- * only until the remaining downstream call sites are removed.
- */
-TVM_DLL void EnterZ3ContextScope();
-
-/*!
- * \brief Exit the current thread-local Z3 context scope.
- *
- * Deprecated no-op, see EnterZ3ContextScope.
- */
-TVM_DLL void ExitZ3ContextScope();
-
class Z3Prover {
public:
/*!
diff --git a/include/tvm/target/target.h b/include/tvm/target/target.h
index 004598d9ab..a9ab30ca01 100644
--- a/include/tvm/target/target.h
+++ b/include/tvm/target/target.h
@@ -187,14 +187,5 @@ class Target : public ffi::ObjectRef {
TVM_DLL void ExitWithScope();
};
-/*!
- * \brief Check and update host field of the given legacy target and target
host pair.
- * Note that this function is for legacy target api compatibility issue only,
not
- * recommended for other use.
- * \param target The pointer to a Target typed object with host field to be
updated
- * \param host The pointer to a Target typed object for target host to be
updated
- */
-void CheckAndUpdateHostConsistency(Target* target, Target* host);
-
} // namespace tvm
#endif // TVM_TARGET_TARGET_H_
diff --git a/jvm/core/src/test/scripts/prepare_test_libs.py
b/jvm/core/src/test/scripts/prepare_test_libs.py
index 202efe4e6b..4ee76cedb5 100644
--- a/jvm/core/src/test/scripts/prepare_test_libs.py
+++ b/jvm/core/src/test/scripts/prepare_test_libs.py
@@ -53,7 +53,7 @@ def prepare_cpu_lib(base_path):
B = te.placeholder((n,), name="B")
C = te.compute(A.shape, lambda *i: A(*i) + B(*i), name="C")
mod = tvm.IRModule.from_expr(te.create_prim_func([A, B,
C]).with_attr("global_symbol", "myadd"))
- fadd = tvm.build(mod, target)
+ fadd = tvm.tirx.build(mod, target)
lib_path = os.path.join(base_path, "add_cpu.so")
fadd.export_library(lib_path)
@@ -73,7 +73,7 @@ def prepare_gpu_lib(base_path):
i0, i1 = sch.split(i, [None, 32])
sch.bind(i0, "blockIdx.x")
sch.bind(i1, "threadIdx.x")
- fadd = tvm.build(sch.mod, "cuda")
+ fadd = tvm.tirx.build(sch.mod, "cuda")
lib_path = os.path.join(base_path, "add_cuda.so")
fadd.export_library(lib_path)
diff --git a/python/tvm/__init__.py b/python/tvm/__init__.py
index ad21df744c..77e30a9e2a 100644
--- a/python/tvm/__init__.py
+++ b/python/tvm/__init__.py
@@ -62,7 +62,7 @@ from . import target
from . import te
# tvm.driver
-from .driver import build, compile
+from .driver import compile
# others
from . import sym
diff --git a/python/tvm/backend/cuda/lang/tile_scheduler.py
b/python/tvm/backend/cuda/lang/tile_scheduler.py
index c827c30848..bd09cf1f52 100644
--- a/python/tvm/backend/cuda/lang/tile_scheduler.py
+++ b/python/tvm/backend/cuda/lang/tile_scheduler.py
@@ -223,7 +223,6 @@ class ClusterPersistentScheduler2D(BaseTileScheduler):
# Rename internal state for clarity
self.work_idx = self.linear_idx # alias: global work item index
self.tile_count = T.local_scalar("int32")
- self.tile_idx = self.tile_count # alias for backward compatibility
is_static_m = isinstance(num_m_tiles, int)
diff --git a/python/tvm/driver/__init__.py b/python/tvm/driver/__init__.py
index 37d0ad5ffc..3a569b62e5 100644
--- a/python/tvm/driver/__init__.py
+++ b/python/tvm/driver/__init__.py
@@ -19,4 +19,4 @@
"""Namespace for driver APIs"""
-from .build_module import build, compile
+from .build_module import compile
diff --git a/python/tvm/driver/build_module.py
b/python/tvm/driver/build_module.py
index a7ff16f8f8..b34031cda6 100644
--- a/python/tvm/driver/build_module.py
+++ b/python/tvm/driver/build_module.py
@@ -18,7 +18,6 @@
# pylint: disable=invalid-name
"""The build utils in python."""
-import warnings
from collections.abc import Callable
import tvm
@@ -28,38 +27,6 @@ from tvm.target import Target
from tvm.tirx import PrimFunc
-def build(
- mod: PrimFunc | IRModule,
- target: str | Target | None = None,
- pipeline: str | tvm.transform.Pass | None = "default",
-):
- """
- Build a function with a signature, generating code for devices
- coupled with target information.
-
- This function is deprecated. Use `tvm.compile` or `tvm.tirx.build` instead.
-
- Parameters
- ----------
- mod : Union[PrimFunc, IRModule]
- The input to be built.
- target : Optional[Union[str, Target]]
- The target for compilation.
- pipeline : Optional[Union[str, tvm.transform.Pass]]
- The pipeline to use for compilation.
-
- Returns
- -------
- tvm.runtime.Module
- A module combining both host and device code.
- """
- warnings.warn(
- "build is deprecated. Use `tvm.compile` or `tvm.tirx.build` instead.",
- DeprecationWarning,
- )
- return tvm.tirx.build(mod, target, pipeline)
-
-
def _contains_relax(mod: PrimFunc | IRModule) -> bool:
if isinstance(mod, PrimFunc):
return False
diff --git a/python/tvm/relax/script/ir_builder/__init__.py
b/python/tvm/relax/script/ir_builder/__init__.py
index 2ca8e53e25..58ef26b7b6 100644
--- a/python/tvm/relax/script/ir_builder/__init__.py
+++ b/python/tvm/relax/script/ir_builder/__init__.py
@@ -328,9 +328,6 @@ def type_var(name, *, dtype=None, span=None):
)
-func_ret_ty = func_ret_type
-
-
def dataflow(*, span=None):
"""Create a dataflow context with explicit finalized exports.
diff --git a/python/tvm/relax/script/ir_builder/ir.py
b/python/tvm/relax/script/ir_builder/ir.py
index 58f46e5813..cffb691ef5 100644
--- a/python/tvm/relax/script/ir_builder/ir.py
+++ b/python/tvm/relax/script/ir_builder/ir.py
@@ -389,11 +389,6 @@ def func_ret_type(ret_ty: Type) -> None:
return _ffi_api.FuncRetType(ret_ty) # type: ignore[attr-defined] #
pylint: disable=no-member
-def func_ret_ty(ret_ty: Type) -> None:
- """Backward-compatible alias for `func_ret_type`."""
- return func_ret_type(ret_ty)
-
-
def func_ret_value(value: Expr) -> None:
"""Specify the return value of the last function frame.
@@ -735,15 +730,6 @@ def emit_with_type(
return Call(builtin_call, args, attrs=None, ty_args=ty_args)
-def emit_with_ty(
- op: str,
- args: Expr,
- ty_args: Type | list[Type] | None = None,
-) -> Call:
- """Backward-compatible alias for `emit_with_type`."""
- return emit_with_type(op, args, ty_args)
-
-
############################### SeqExpr ###############################
@@ -956,7 +942,6 @@ __all__ = [
"emit_match_cast",
"emit_te",
"emit_var_binding",
- "emit_with_ty",
"emit_with_type",
"equal",
"erf",
@@ -975,7 +960,6 @@ __all__ = [
"full_like",
"func_attr",
"func_name",
- "func_ret_ty",
"func_ret_type",
"func_ret_value",
"function",
diff --git a/python/tvm/relax/transform/__init__.py
b/python/tvm/relax/transform/__init__.py
index 1ee65452e7..1670f055ef 100644
--- a/python/tvm/relax/transform/__init__.py
+++ b/python/tvm/relax/transform/__init__.py
@@ -81,7 +81,6 @@ from .transform import (
TopologicalSort,
UpdateParamType,
UpdateVDevice,
- VMBuiltinLower,
VMShapeLower,
SpecializePrimFuncBasedOnCallSite,
dataflowblock_pass,
diff --git a/python/tvm/relax/transform/transform.py
b/python/tvm/relax/transform/transform.py
index 703f6d0fc3..d18f88b8c2 100644
--- a/python/tvm/relax/transform/transform.py
+++ b/python/tvm/relax/transform/transform.py
@@ -21,7 +21,6 @@
import functools
import inspect
import types
-import warnings
from collections.abc import Callable, Mapping, Sequence
from typing import Optional, Union
@@ -601,20 +600,6 @@ def LowerRuntimeBuiltin() -> tvm.ir.transform.Pass:
return _ffi_api.LowerRuntimeBuiltin() # type: ignore
-def VMBuiltinLower() -> tvm.ir.transform.Pass:
- """Lowering generic intrinsic to VM intrinsics.
-
- Returns
- -------
- ret: tvm.ir.transform.Pass
- """
- warnings.warn(
- "tvm.relax.transform.VMBuiltinLower has been renamed to
'LowerRuntimeBuiltin'. "
- "This wrapper is for backwards compatibility, and will be removed in a
later update."
- )
- return _ffi_api.LowerRuntimeBuiltin() # type: ignore
-
-
def VMShapeLower(*, emit_err_ctx: bool = True) -> tvm.ir.transform.Pass:
"""Lower the symbolic shape and argument and match-cast structinfo
matching.
diff --git a/python/tvm/s_tir/meta_schedule/builder/local_builder.py
b/python/tvm/s_tir/meta_schedule/builder/local_builder.py
index aa563294e2..2a97a732ca 100644
--- a/python/tvm/s_tir/meta_schedule/builder/local_builder.py
+++ b/python/tvm/s_tir/meta_schedule/builder/local_builder.py
@@ -259,12 +259,12 @@ def default_build(mod: IRModule, target: Target, _params:
dict[str, Tensor] | No
"""
# pylint: disable=import-outside-toplevel
import tvm.s_tir.tensor_intrin # pylint: disable=unused-import
- from tvm.driver import build as tvm_build
from tvm.s_tir.transform import RemoveWeightLayoutRewriteBlock
+ from tvm.tirx import build as tirx_build
# pylint: enable=import-outside-toplevel
mod = RemoveWeightLayoutRewriteBlock(skip_tensor_rewrite=True)(mod)
- return tvm_build(mod, target=target)
+ return tirx_build(mod, target=target)
@register_global_func("s_tir.meta_schedule.builder.default_export")
diff --git a/python/tvm/sym/__init__.py b/python/tvm/sym/__init__.py
index dc449f9f6d..0f76bc14db 100644
--- a/python/tvm/sym/__init__.py
+++ b/python/tvm/sym/__init__.py
@@ -32,7 +32,6 @@ from .analyzer import (
ProofStrength,
Extension,
CompareResult,
- Z3ContextScope,
allow_uint_as_index,
)
from .bound import deduce_bound
diff --git a/python/tvm/sym/analyzer.py b/python/tvm/sym/analyzer.py
index 9ac1cfc85d..baa302b66d 100644
--- a/python/tvm/sym/analyzer.py
+++ b/python/tvm/sym/analyzer.py
@@ -117,21 +117,6 @@ class ConstraintScope:
self._fexit()
-class Z3ContextScope:
- """Deprecated no-op retained for compatibility.
-
- Every materialized Z3 solver now owns a private context, which provides
- per-analyzer isolation without an explicit compilation scope.
- """
-
- def __enter__(self):
- _ffi_api.EnterZ3ContextScope()
- return self
-
- def __exit__(self, ptype, value, trace):
- _ffi_api.ExitZ3ContextScope()
-
-
@tvm_ffi.register_object("sym.Analyzer")
class Analyzer(Object):
"""Integer arithmetic analyzer
diff --git a/python/tvm/target/detect_target.py
b/python/tvm/target/detect_target.py
index e7c434af61..4d32ec8d36 100644
--- a/python/tvm/target/detect_target.py
+++ b/python/tvm/target/detect_target.py
@@ -45,9 +45,6 @@ SUPPORTED_DEVICE: dict[str, Callable[[Device], Target]] = {
"cpu": _detect_cpu,
}
-# Backward-compatible alias for the previous private module-level map.
-SUPPORT_DEVICE = SUPPORTED_DEVICE
-
def register_device_target_detector(device_type: str, detector:
Callable[[Device], Target]) -> None:
"""Register target detection for a runtime device type."""
diff --git a/python/tvm/tirx/script/ir_builder/ir.py
b/python/tvm/tirx/script/ir_builder/ir.py
index 53efba58f3..7e004bcdb9 100644
--- a/python/tvm/tirx/script/ir_builder/ir.py
+++ b/python/tvm/tirx/script/ir_builder/ir.py
@@ -39,7 +39,6 @@ from tvm import DataType, ir
from tvm import tirx as tir
from tvm.ir import Call, TensorLoad, Type, is_prim_expr
from tvm.ir import register_op_attr as _register_op_attr
-from tvm.ir.base import deprecated
from tvm.ir.prim import _ffi_api as _prim_ffi_api
from tvm.runtime import convert
from tvm.script.ir_builder import meta_var
@@ -347,11 +346,6 @@ def buffer(
return result
-@deprecated("T.buffer_decl(...)", "T.Buffer(...)")
-def buffer_decl(*args, **kwargs):
- return buffer(*args, **kwargs)
-
-
def prim_func(
is_private: bool = False,
persistent: bool = False,
@@ -2319,26 +2313,6 @@ def void(expr: Expr | None = None) -> Expr:
return _ffi_api.Void(expr) # type: ignore[attr-defined] # pylint:
disable=no-member
-@deprecated("T.var", "T.{dtype}")
-def var(dtype: str, name: str = "") -> Var:
- """Construct a new tirx.Var.
-
- Parameters
- ----------
- dtype: str
- The dtype of the Var.
-
- name: str
- The name of the Var.
-
- Returns
- -------
- res : Var
- The result tirx.Var.
- """
- return Var(name, dtype) # pylint: disable=no-member
-
-
def ptr(dtype: str, storage_scope: str = "global") -> Var:
"""The pointer declaration function.
@@ -2358,26 +2332,6 @@ def ptr(dtype: str, storage_scope: str = "global") ->
Var:
return _ffi_api.Ptr(dtype, storage_scope) # type: ignore[attr-defined] #
pylint: disable=no-member
-@deprecated("T.buffer_var", "T.handle")
-def buffer_var(dtype: str, storage_scope: str = "global") -> Var:
- """The pointer declaration function.
-
- Parameters
- ----------
- dtype : str
- The data type of the pointer.
-
- storage_scope : str
- The storage scope of the pointer.
-
- Returns
- -------
- res : Var
- The pointer.
- """
- return _ffi_api.Ptr(dtype, storage_scope) # type: ignore[attr-defined] #
pylint: disable=no-member
-
-
def min(a: Expr, b: Expr) -> Expr: # pylint: disable=redefined-builtin
"""Compute the minimum value of two expressions.
@@ -2999,7 +2953,6 @@ __all__ = [
"float64x64",
"bfloat16",
"buffer",
- "buffer_decl",
"prim_func",
"arg",
"func_name",
@@ -3033,7 +2986,6 @@ __all__ = [
"boolean",
"handle",
"void",
- "var",
"ptr",
"min",
"max",
@@ -3041,7 +2993,6 @@ __all__ = [
"comm_reducer",
"index_map",
"target",
- "buffer_var",
"abs",
"fabs",
"acos",
diff --git a/src/relax/backend/vm/lower_runtime_builtin.cc
b/src/relax/backend/vm/lower_runtime_builtin.cc
index f4846a9279..1e0d7bb696 100644
--- a/src/relax/backend/vm/lower_runtime_builtin.cc
+++ b/src/relax/backend/vm/lower_runtime_builtin.cc
@@ -64,8 +64,8 @@ class LowerRuntimeBuiltinMutator : public ExprMutator {
} else if (call->op.same_as(invoke_closure_op_)) {
return InvokeClosure(call);
} else if (call->op.same_as(alloc_tensor_op_)) {
- TVM_FFI_THROW(InternalError) << "VMBuiltinLower encountered " <<
call->op << " in expression "
- << ffi::GetRef<Call>(call_node) << ". "
+ TVM_FFI_THROW(InternalError) << "LowerRuntimeBuiltin encountered " <<
call->op
+ << " in expression " <<
ffi::GetRef<Call>(call_node) << ". "
<< "This operation should have been lowered
earlier "
<< "using the
'relax.transform.LowerAllocTensor' pass.";
} else if (call->op.same_as(mem_alloc_storage_op_)) {
@@ -128,7 +128,7 @@ class LowerRuntimeBuiltinMutator : public ExprMutator {
auto arg = call_node->args[1];
TVM_FFI_CHECK(arg->ty->IsInstance<ShapeTypeNode>(), TypeError)
- << "VMBuiltinLower expects the shape arg of R.reshape "
+ << "LowerRuntimeBuiltin expects the shape arg of R.reshape "
<< "to be a ShapeExpr or VarNode bound to a ShapeExpr. "
<< "However, in expression " << call_node << ", the shape argument "
<< arg << " has type "
<< arg->ty;
diff --git a/src/relax/op/tensor/create.cc b/src/relax/op/tensor/create.cc
index d111f914ff..9776c1cdcd 100644
--- a/src/relax/op/tensor/create.cc
+++ b/src/relax/op/tensor/create.cc
@@ -462,15 +462,11 @@ Expr tril(Expr x, Expr k) {
return Call(Type::Missing(), op, {x, k});
}
-Expr tril(Expr x, int k) { return tril(x, IntImm::Int64(k)); }
-
Expr triu(Expr x, Expr k) {
static const Op& op = Op::Get("relax.triu");
return Call(Type::Missing(), op, {x, k});
}
-Expr triu(Expr x, int k) { return triu(x, IntImm::Int64(k)); }
-
TVM_FFI_STATIC_INIT_BLOCK() {
namespace refl = tvm::ffi::reflection;
refl::GlobalDef()
diff --git a/src/relax/op/tensor/create.h b/src/relax/op/tensor/create.h
index 19b7f221ed..fea1741a54 100644
--- a/src/relax/op/tensor/create.h
+++ b/src/relax/op/tensor/create.h
@@ -136,21 +136,9 @@ Expr hamming_window(PrimExpr window_size, PrimExpr
periodic, PrimExpr alpha, Pri
/*! \brief Return the lower triangular part of a matrix or a batch of
matrices. */
Expr tril(Expr x, Expr k);
-/*! \brief Return the lower triangular part of a matrix or a batch of matrices.
- *
- * Overload provided for backwards compatibility.
- */
-Expr tril(Expr x, int k);
-
/*! \brief Return the upper triangular part of a matrix or a batch of
matrices. */
Expr triu(Expr x, Expr k);
-/*! \brief Return the upper triangular part of a matrix or a batch of matrices.
- *
- * Overload provided for backwards compatibility.
- */
-Expr triu(Expr x, int k);
-
} // namespace relax
} // namespace tvm
diff --git a/src/relax/transform/rewrite_dataflow_reshape.cc
b/src/relax/transform/rewrite_dataflow_reshape.cc
index b659487bec..1c9441bee2 100644
--- a/src/relax/transform/rewrite_dataflow_reshape.cc
+++ b/src/relax/transform/rewrite_dataflow_reshape.cc
@@ -88,7 +88,7 @@ class DataflowReshapeRewriter : public ExprMutator {
// We bring the calls of reshape PrimFunc back to calls of high-level
// relax.reshape op, which will be lowered to calls of the ExternFunc
- // vm.builtin.reshape in the VMBuiltinLower pass.
+ // vm.builtin.reshape in the LowerRuntimeBuiltin pass.
auto prim_fn =
mod_->Lookup(call->args[0].as_or_throw<GlobalVar>()).as_or_throw<tirx::PrimFunc>();
diff --git a/src/sym/analyzer.cc b/src/sym/analyzer.cc
index c49bde37f2..d99043e0ea 100644
--- a/src/sym/analyzer.cc
+++ b/src/sym/analyzer.cc
@@ -289,8 +289,6 @@ TVM_FFI_STATIC_INIT_BLOCK() {
refl::GlobalDef()
.def("sym.Analyzer", []() { return Analyzer(); })
.def("sym.AnalyzerClone", [](Analyzer analyzer) { return
analyzer->Clone(); })
- .def("sym.EnterZ3ContextScope", []() { EnterZ3ContextScope(); })
- .def("sym.ExitZ3ContextScope", []() { ExitZ3ContextScope(); })
.def("sym.AnalyzerConstIntBound",
[](Analyzer analyzer, const PrimExpr& expr) { return
analyzer->const_int_bound(expr); })
.def("sym.AnalyzerConstIntBoundUpdate",
diff --git a/src/sym/z3_prover.cc b/src/sym/z3_prover.cc
index 8bf7450c6d..d613c435b9 100644
--- a/src/sym/z3_prover.cc
+++ b/src/sym/z3_prover.cc
@@ -103,16 +103,6 @@ struct Namespace {
} // namespace
-// Deprecated no-ops, kept only for callers of
-// sym.EnterZ3ContextScope / sym.ExitZ3ContextScope (Z3ContextScope in
-// Python). Shared per-compile Z3 contexts are gone: every materialized solver
-// owns a private context (see Z3Prover::Impl::Materialize), which subsumes the
-// per-compilation isolation these scopes provided. Remove together with the
-// remaining call sites.
-void EnterZ3ContextScope() {}
-
-void ExitZ3ContextScope() {}
-
class Z3Prover::Impl : tvm::ExprFunctor<z3::expr(const Expr&)> {
public:
using Base = tvm::ExprFunctor<z3::expr(const Expr&)>;
@@ -1024,9 +1014,6 @@ namespace tvm::sym {
using namespace ffi;
-void EnterZ3ContextScope() {}
-void ExitZ3ContextScope() {}
-
// Stub implementation used when Z3 support is not built. All proving queries
// conservatively report "cannot prove" while keeping the public API available.
class Z3Prover::Impl {};
diff --git a/src/target/target.cc b/src/target/target.cc
index aa982e8eb2..b36ba6efb2 100644
--- a/src/target/target.cc
+++ b/src/target/target.cc
@@ -66,11 +66,6 @@ Target Target::WithHost(const Target& target, const Target&
host) {
return TargetInternal::WithHost(target, host);
}
-void CheckAndUpdateHostConsistency(Target* target, Target* host) {
- *target = Target(*target, *host);
- *host = (*target)->GetHost().value_or(Target());
-}
-
static std::vector<ffi::String> DeduplicateKeys(const
std::vector<ffi::String>& keys) {
std::vector<ffi::String> new_keys;
for (size_t i = 0; i < keys.size(); ++i) {
diff --git a/tests/python/codegen/test_target_codegen_static_init.py
b/tests/python/codegen/test_target_codegen_static_init.py
index c7637adda9..de95205fe6 100644
--- a/tests/python/codegen/test_target_codegen_static_init.py
+++ b/tests/python/codegen/test_target_codegen_static_init.py
@@ -44,7 +44,7 @@ def test_static_init():
)
mod = Module
- f = tvm.driver.build(mod, target="llvm")
+ f = tvm.tirx.build(mod, target="llvm")
a = tvm.runtime.tensor(np.zeros(10, dtype="int64"))
f(a)
diff --git a/tests/python/relax/test_transform.py
b/tests/python/relax/test_transform.py
index daf50d62ba..6f31055e17 100644
--- a/tests/python/relax/test_transform.py
+++ b/tests/python/relax/test_transform.py
@@ -579,12 +579,12 @@ def test_call_tir_inplace_some_new():
R.Tensor((2, 3), "int32"), R.Tensor((2, 3), "int32"), R.Tensor((2,
3), dtype="int32")
):
R.func_attr({"relax.force_pure": True})
- gv0: R.Tensor((2, 3), dtype="int32") = R.emit_with_ty(
+ gv0: R.Tensor((2, 3), dtype="int32") = R.emit_with_type(
"relax.builtin.alloc_tensor",
(R.shape([2, 3]), R.dtype("int32"), R.prim_value(0),
R.str("global")),
(R.Tensor((2, 3), dtype="int32"),),
)
- gv1: R.Tensor((2, 3), dtype="int32") = R.emit_with_ty(
+ gv1: R.Tensor((2, 3), dtype="int32") = R.emit_with_type(
"relax.builtin.alloc_tensor",
(R.shape([2, 3]), R.dtype("int32"), R.prim_value(0),
R.str("global")),
(R.Tensor((2, 3), dtype="int32"),),
diff --git a/tests/python/relax/test_transform_legalize_ops_manipulate.py
b/tests/python/relax/test_transform_legalize_ops_manipulate.py
index d2a4b8f260..1fc98dd194 100644
--- a/tests/python/relax/test_transform_legalize_ops_manipulate.py
+++ b/tests/python/relax/test_transform_legalize_ops_manipulate.py
@@ -1855,7 +1855,7 @@ def test_func_ty_of_legalized_layout_transform():
):
R.func_attr({"relax.force_pure": True})
cls = Expected
- alloc: R.Tensor((4, 4), dtype="float32") = R.emit_with_ty(
+ alloc: R.Tensor((4, 4), dtype="float32") = R.emit_with_type(
"relax.builtin.alloc_tensor",
(R.shape([4, 4]), R.dtype("float32"), R.prim_value(0),
R.str("global")),
(R.Tensor((4, 4), dtype="float32"),),
diff --git a/tests/python/relax/test_tvmscript_ir_builder.py
b/tests/python/relax/test_tvmscript_ir_builder.py
index 8f06282ca0..4f7d89fb98 100644
--- a/tests/python/relax/test_tvmscript_ir_builder.py
+++ b/tests/python/relax/test_tvmscript_ir_builder.py
@@ -35,7 +35,7 @@ def test_function_simple():
R.func_name("foo")
R.func_attr({"Primitive": True})
x = R.arg("x", relax.TensorType((128, 128), "float32"))
- R.func_ret_ty(relax.TensorType(dtype="float32", ndim=2))
+ R.func_ret_type(relax.TensorType(dtype="float32", ndim=2))
y = R.emit(
R.call_dps_packed("extern_func", x, relax.TensorType((128,
128), dtype="float32"))
)
diff --git a/tests/python/relax/test_vm_builtin_lower.py
b/tests/python/relax/test_vm_builtin_lower.py
index 7084de145c..02656578d2 100644
--- a/tests/python/relax/test_vm_builtin_lower.py
+++ b/tests/python/relax/test_vm_builtin_lower.py
@@ -113,7 +113,7 @@ def test_vm_reshape_may_be_var():
)
return reshape
- After = relax.transform.VMBuiltinLower()(Before)
+ After = relax.transform.LowerRuntimeBuiltin()(Before)
tvm.ir.assert_structural_equal(Expected, After)
@@ -149,7 +149,7 @@ def test_vm_reshape_using_tensor_to_shape():
)
return reshape
- After = relax.transform.VMBuiltinLower()(Before)
+ After = relax.transform.LowerRuntimeBuiltin()(Before)
tvm.ir.assert_structural_equal(Expected, After)
diff --git a/tests/python/sym/test_sym_z3.py b/tests/python/sym/test_sym_z3.py
index 34bc23a2b1..373f647768 100644
--- a/tests/python/sym/test_sym_z3.py
+++ b/tests/python/sym/test_sym_z3.py
@@ -93,7 +93,7 @@ def test_z3_context_lifetime_outlives_worker_thread():
gc.collect()
-def test_z3_context_scope_clone_lifetime():
+def test_z3_context_clone_lifetime():
_require_z3(Analyzer())
a = tirx.Var("a", "int32")
@@ -101,20 +101,26 @@ def test_z3_context_scope_clone_lifetime():
c = tirx.Var("c", "int32")
expr = ((b - a) // c) * c + a <= b
- with tvm.sym.Z3ContextScope():
- analyzer = Analyzer()
- analyzer.bind(a, tvm.ir.Range(1, 100000))
- analyzer.bind(b, tvm.ir.Range(1, 100000))
- analyzer.bind(c, tvm.ir.Range(1, 100000))
- assert analyzer.can_prove(expr, SB)
+ analyzer = Analyzer()
+ analyzer.bind(a, tvm.ir.Range(1, 100000))
+ analyzer.bind(b, tvm.ir.Range(1, 100000))
+ analyzer.bind(c, tvm.ir.Range(1, 100000))
+ assert analyzer.can_prove(expr, SB)
- # Clone while a different scope is active. The clone must adopt the
+ # Materialize a separate context before cloning. The clone must adopt the
# source Analyzer's context before copying any Z3 handles.
- with tvm.sym.Z3ContextScope():
- cloned = analyzer.clone()
+ independent = Analyzer()
+ independent.bind(a, tvm.ir.Range(-100000, -1))
+ independent.bind(b, tvm.ir.Range(-100000, 100000))
+ independent.bind(c, tvm.ir.Range(1, 100000))
+ assert independent.can_prove(expr, SB)
+ assert independent.can_prove(a < 0, SB)
+ cloned = analyzer.clone()
- del analyzer
+ del analyzer, independent
+ gc.collect()
assert cloned.can_prove(expr, SB)
+ assert cloned.can_prove(a > 0, SB)
# ---------------------------------------------------------------------------
diff --git a/tests/python/te/test_te_create_primfunc.py
b/tests/python/te/test_te_create_primfunc.py
index c88d0dbfc6..31f05318f2 100644
--- a/tests/python/te/test_te_create_primfunc.py
+++ b/tests/python/te/test_te_create_primfunc.py
@@ -419,7 +419,7 @@ def test_topi_float_unary_accepts_float_input(op_name,
dtype):
func = te.create_prim_func([x, out]).with_attr("target",
tvm.target.Target("llvm"))
mod = tvm.IRModule({"main": func})
- compiled = tvm.build(mod, target="llvm")
+ compiled = tvm.tirx.build(mod, target="llvm")
assert compiled is not None
diff --git a/tests/python/tirx-transform/test_tir_transform_flatten_buffer.py
b/tests/python/tirx-transform/test_tir_transform_flatten_buffer.py
index aa7248724a..a7d4fbffba 100644
--- a/tests/python/tirx-transform/test_tir_transform_flatten_buffer.py
+++ b/tests/python/tirx-transform/test_tir_transform_flatten_buffer.py
@@ -374,7 +374,7 @@ def test_build_with_optional_pragma_unroll_explicit():
for ax1, ax2 in T.grid(5, 6):
B[ax0, ax1, ax2] = A[ax0, ax1, ax2]
- tvm.build(Module, target="llvm")
+ tvm.tirx.build(Module, target="llvm")
for value in [None, True, False]:
check(value)
diff --git a/web/tests/python/prepare_test_libs.py
b/web/tests/python/prepare_test_libs.py
index bbc6c1b18e..d750b00708 100644
--- a/web/tests/python/prepare_test_libs.py
+++ b/web/tests/python/prepare_test_libs.py
@@ -55,7 +55,7 @@ def prepare_tir_lib(base_path):
te.create_prim_func([A, B]).with_attr("global_symbol", "add_one")
).with_attr("system_lib_prefix", "")
- fadd = tvm.build(mod, target)
+ fadd = tvm.tirx.build(mod, target)
wasm_path = os.path.join(base_path, "test_addone.wasm")
fadd.export_library(wasm_path, fcompile=tvmjs.create_tvmjs_wasm)
diff --git a/web/tests/python/webgpu_rpc_test.py
b/web/tests/python/webgpu_rpc_test.py
index 22aa0e3a07..8fc638a53b 100644
--- a/web/tests/python/webgpu_rpc_test.py
+++ b/web/tests/python/webgpu_rpc_test.py
@@ -49,7 +49,7 @@ def test_rpc():
sch.bind(i0, "blockIdx.x")
sch.bind(i1, "threadIdx.x")
- fadd = tvm.build(sch.mod.with_attr("system_lib_prefix", ""), target=target)
+ fadd = tvm.tirx.build(sch.mod.with_attr("system_lib_prefix", ""),
target=target)
temp = utils.tempdir()
wasm_path = temp.relpath("addone_gpu.wasm")