From fa82bce34183b56d35fb4215f75c9b89fd90f9e5 Mon Sep 17 00:00:00 2001 From: tqchen Date: Sat, 21 Feb 2026 17:12:35 +0000 Subject: [PATCH] [REFACTOR][TEST] Remove unused te imports from test files Remove unused `from tvm import te` imports from 24 test files across tir-transform, s_tir/transform, arith, testing, codegen and all-platform-minimal-test directories. Also replace the sole `te.var()` usage in test_s_tir_transform_decorate_device_scope.py with `tvm.tir.Var()`, and clean up stale `tvm.tir.ir_builder` references in test_tir_transform_convert_ssa.py comments. --- .../all-platform-minimal-test/test_runtime_ndarray.py | 1 - .../test_runtime_packed_func.py | 1 - tests/python/arith/test_arith_domain_touched.py | 1 - tests/python/codegen/test_target_codegen_llvm_vla.py | 1 - .../python/codegen/test_target_codegen_static_init.py | 1 - .../test_s_tir_transform_compact_buffer_region.py | 1 - .../test_s_tir_transform_decorate_device_scope.py | 3 +-- .../s_tir/transform/test_s_tir_transform_hoist_if.py | 2 +- .../transform/test_s_tir_transform_loop_partition.py | 1 - ...st_s_tir_transform_lower_cross_thread_reduction.py | 2 +- .../test_s_tir_transform_lower_init_block.py | 2 +- .../test_s_tir_transform_lower_opaque_block.py | 1 - .../test_s_tir_transform_memhammer_lower_auto_copy.py | 2 +- ...ansform_merge_dynamic_shared_memory_allocations.py | 2 +- ...ransform_plan_update_buffer_allocation_location.py | 1 - .../transform/test_s_tir_transform_profiling_instr.py | 2 +- .../transform/test_s_tir_transform_thread_sync.py | 2 +- .../test_s_tir_transform_unify_thread_binding.py | 2 +- tests/python/testing/test_testing.py | 1 - .../tir-transform/test_tir_transform_convert_ssa.py | 11 +++++------ .../test_tir_transform_flatten_buffer.py | 1 - .../test_tir_transform_make_packed_api.py | 2 +- .../test_tir_transform_narrow_datatype.py | 1 - .../test_tir_transform_split_host_device.py | 1 - .../test_tir_transform_storage_rewrite.py | 1 - 25 files changed, 15 insertions(+), 31 deletions(-) diff --git a/tests/python/all-platform-minimal-test/test_runtime_ndarray.py b/tests/python/all-platform-minimal-test/test_runtime_ndarray.py index 7e00ba64fac4..cc31d5e65912 100644 --- a/tests/python/all-platform-minimal-test/test_runtime_ndarray.py +++ b/tests/python/all-platform-minimal-test/test_runtime_ndarray.py @@ -23,7 +23,6 @@ import tvm import tvm.testing -from tvm import te dtype = tvm.testing.parameter("uint8", "int8", "uint16", "int16", "uint32", "int32", "float32") diff --git a/tests/python/all-platform-minimal-test/test_runtime_packed_func.py b/tests/python/all-platform-minimal-test/test_runtime_packed_func.py index 7b868007a6b0..00ffe81f14bd 100644 --- a/tests/python/all-platform-minimal-test/test_runtime_packed_func.py +++ b/tests/python/all-platform-minimal-test/test_runtime_packed_func.py @@ -20,7 +20,6 @@ import numpy as np import tvm -from tvm import te import tvm.testing from tvm.script import tir as T diff --git a/tests/python/arith/test_arith_domain_touched.py b/tests/python/arith/test_arith_domain_touched.py index e8d49316bdd6..284a715bb2c1 100644 --- a/tests/python/arith/test_arith_domain_touched.py +++ b/tests/python/arith/test_arith_domain_touched.py @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. import tvm -from tvm import te from tvm.script import tir as T diff --git a/tests/python/codegen/test_target_codegen_llvm_vla.py b/tests/python/codegen/test_target_codegen_llvm_vla.py index 4e03596b1f12..0b8fd64160a5 100644 --- a/tests/python/codegen/test_target_codegen_llvm_vla.py +++ b/tests/python/codegen/test_target_codegen_llvm_vla.py @@ -23,7 +23,6 @@ import pytest import tvm -from tvm import te from tvm.script import tir as T from tvm.target.codegen import llvm_version_major diff --git a/tests/python/codegen/test_target_codegen_static_init.py b/tests/python/codegen/test_target_codegen_static_init.py index bfa5db0f644c..35cf8bf3683e 100644 --- a/tests/python/codegen/test_target_codegen_static_init.py +++ b/tests/python/codegen/test_target_codegen_static_init.py @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. import tvm -from tvm import te from tvm.script import ir as I, tir as T import ctypes import numpy as np diff --git a/tests/python/s_tir/transform/test_s_tir_transform_compact_buffer_region.py b/tests/python/s_tir/transform/test_s_tir_transform_compact_buffer_region.py index 05ddfa4b67f0..a4a4e07db107 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_compact_buffer_region.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_compact_buffer_region.py @@ -16,7 +16,6 @@ # under the License. import tvm import tvm.testing -from tvm import te from tvm import tir, s_tir from tvm.script import tir as T diff --git a/tests/python/s_tir/transform/test_s_tir_transform_decorate_device_scope.py b/tests/python/s_tir/transform/test_s_tir_transform_decorate_device_scope.py index 8de14edabb47..bd75cc7b467c 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_decorate_device_scope.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_decorate_device_scope.py @@ -15,11 +15,10 @@ # specific language governing permissions and limitations # under the License. import tvm -from tvm import te def test_decorate_device(): - x = te.var("x") + x = tvm.tir.Var("x", "int32") mod = tvm.IRModule.from_expr(tvm.tir.PrimFunc([x], tvm.tir.Evaluate(x))) stmt = tvm.s_tir.transform.DecorateDeviceScope()(mod)["main"].body diff --git a/tests/python/s_tir/transform/test_s_tir_transform_hoist_if.py b/tests/python/s_tir/transform/test_s_tir_transform_hoist_if.py index 5d0f48df4dab..f0e9b14c8c7c 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_hoist_if.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_hoist_if.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. import tvm -from tvm import te, s_tir +from tvm import s_tir from tvm.script import tir as T, ir as I import numpy as np import pytest diff --git a/tests/python/s_tir/transform/test_s_tir_transform_loop_partition.py b/tests/python/s_tir/transform/test_s_tir_transform_loop_partition.py index 9691f94f13dd..d83bf9a8dd79 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_loop_partition.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_loop_partition.py @@ -17,7 +17,6 @@ import pytest import tvm import tvm.testing -from tvm import te from tvm.ir.module import IRModule from tvm.script import tir as T import numpy diff --git a/tests/python/s_tir/transform/test_s_tir_transform_lower_cross_thread_reduction.py b/tests/python/s_tir/transform/test_s_tir_transform_lower_cross_thread_reduction.py index 692952b84a48..baa53bf73e38 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_lower_cross_thread_reduction.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_lower_cross_thread_reduction.py @@ -20,7 +20,7 @@ import pytest import tvm import tvm.testing -from tvm import te, s_tir +from tvm import s_tir from tvm.script import tir as T # pylint: disable=no-member,invalid-name,unused-variable,unexpected-keyword-arg diff --git a/tests/python/s_tir/transform/test_s_tir_transform_lower_init_block.py b/tests/python/s_tir/transform/test_s_tir_transform_lower_init_block.py index 147ca6dcc8ca..00cfed38ab6e 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_lower_init_block.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_lower_init_block.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. import tvm -from tvm import te, s_tir +from tvm import s_tir from tvm.script import tir as T # pylint: disable=no-self-argument diff --git a/tests/python/s_tir/transform/test_s_tir_transform_lower_opaque_block.py b/tests/python/s_tir/transform/test_s_tir_transform_lower_opaque_block.py index 94cf5542005e..667809d580e2 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_lower_opaque_block.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_lower_opaque_block.py @@ -17,7 +17,6 @@ import tvm import tvm.testing import tvm.s_tir -from tvm import te from tvm.script import tir as T diff --git a/tests/python/s_tir/transform/test_s_tir_transform_memhammer_lower_auto_copy.py b/tests/python/s_tir/transform/test_s_tir_transform_memhammer_lower_auto_copy.py index d624677d37e4..dfd55da4c9ef 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_memhammer_lower_auto_copy.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_memhammer_lower_auto_copy.py @@ -16,7 +16,7 @@ # under the License. import tvm -from tvm import te, s_tir +from tvm import s_tir from tvm.script import tir as T import sys import pytest diff --git a/tests/python/s_tir/transform/test_s_tir_transform_merge_dynamic_shared_memory_allocations.py b/tests/python/s_tir/transform/test_s_tir_transform_merge_dynamic_shared_memory_allocations.py index 26e8a6f2bbf3..34e3cf20a64d 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_merge_dynamic_shared_memory_allocations.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_merge_dynamic_shared_memory_allocations.py @@ -18,7 +18,7 @@ import tvm import tvm.testing -from tvm import te, s_tir +from tvm import s_tir from tvm.topi.math import cast from tvm.script import ir as I, tir as T diff --git a/tests/python/s_tir/transform/test_s_tir_transform_plan_update_buffer_allocation_location.py b/tests/python/s_tir/transform/test_s_tir_transform_plan_update_buffer_allocation_location.py index 3cd6b5841037..b250950f8b53 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_plan_update_buffer_allocation_location.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_plan_update_buffer_allocation_location.py @@ -18,7 +18,6 @@ import tvm import tvm.testing -from tvm import te from tvm.script import tir as T from tvm import tir, s_tir from tvm.s_tir.tensor_intrin.hexagon import VRMPY_u8u8i32_INTRIN diff --git a/tests/python/s_tir/transform/test_s_tir_transform_profiling_instr.py b/tests/python/s_tir/transform/test_s_tir_transform_profiling_instr.py index f6c409aa8eed..6ba98b9ad5eb 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_profiling_instr.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_profiling_instr.py @@ -17,7 +17,7 @@ import tvm import tvm.testing -from tvm import te, s_tir +from tvm import s_tir from tvm.ir.module import IRModule from tvm.script import tir as T import numpy diff --git a/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py b/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py index 7d5720ea3f52..59b3c6cb30d7 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py @@ -16,7 +16,7 @@ # under the License. import tvm import tvm.testing -from tvm import te, s_tir +from tvm import s_tir from tvm.script import tir as T diff --git a/tests/python/s_tir/transform/test_s_tir_transform_unify_thread_binding.py b/tests/python/s_tir/transform/test_s_tir_transform_unify_thread_binding.py index 1e2b08244362..aad1cfedc294 100644 --- a/tests/python/s_tir/transform/test_s_tir_transform_unify_thread_binding.py +++ b/tests/python/s_tir/transform/test_s_tir_transform_unify_thread_binding.py @@ -19,7 +19,7 @@ import tvm import tvm.testing -from tvm import te, s_tir +from tvm import s_tir from tvm.script import tir as T diff --git a/tests/python/testing/test_testing.py b/tests/python/testing/test_testing.py index 10e391469b82..12377bb68554 100644 --- a/tests/python/testing/test_testing.py +++ b/tests/python/testing/test_testing.py @@ -16,7 +16,6 @@ # under the License. import numpy as np import tvm -from tvm import te import tvm.testing diff --git a/tests/python/tir-transform/test_tir_transform_convert_ssa.py b/tests/python/tir-transform/test_tir_transform_convert_ssa.py index b5e815b02a8b..1dff7854a53d 100644 --- a/tests/python/tir-transform/test_tir_transform_convert_ssa.py +++ b/tests/python/tir-transform/test_tir_transform_convert_ssa.py @@ -435,12 +435,11 @@ def test_track_forward_declarations_in_attr_stmt(): # Generate the PrimFunc, which is already SSA # - # This is constructed directly, rather than using TVMScript or - # the `tvm.tir.ir_builder`. This test case requires a - # `tir.AttrStmt` that references a variable, followed by the - # `tir.For` defining that variable. This is not expressible in - # either TVMScript or `tvm.tir.ir_builder`, as they only provide - # the loop iterator within the body of the loop. + # This is constructed directly, rather than using TVMScript. + # This test case requires a `tir.AttrStmt` that references a + # variable, followed by the `tir.For` defining that variable. + # This is not expressible in TVMScript, as it only provides the + # loop iterator within the body of the loop. i0_outer_outer = tir.Var("i0_outer_outer", "int32") i0_outer_inner = tir.Var("i0_outer_inner", "int32") i0_inner = tir.Var("i0_inner", "int32") diff --git a/tests/python/tir-transform/test_tir_transform_flatten_buffer.py b/tests/python/tir-transform/test_tir_transform_flatten_buffer.py index a65b6c1f712d..2d7aba7e3235 100644 --- a/tests/python/tir-transform/test_tir_transform_flatten_buffer.py +++ b/tests/python/tir-transform/test_tir_transform_flatten_buffer.py @@ -16,7 +16,6 @@ # under the License. import tvm import tvm.testing -from tvm import te from tvm.script import ir as I, tir as T diff --git a/tests/python/tir-transform/test_tir_transform_make_packed_api.py b/tests/python/tir-transform/test_tir_transform_make_packed_api.py index 723584ff5576..f92ee702c558 100644 --- a/tests/python/tir-transform/test_tir_transform_make_packed_api.py +++ b/tests/python/tir-transform/test_tir_transform_make_packed_api.py @@ -19,7 +19,7 @@ import numpy as np import tvm import tvm.testing -from tvm import te, tir +from tvm import tir from tvm.script import tir as T, ir as I diff --git a/tests/python/tir-transform/test_tir_transform_narrow_datatype.py b/tests/python/tir-transform/test_tir_transform_narrow_datatype.py index 594f8a0d5ba8..001a7452c8f3 100644 --- a/tests/python/tir-transform/test_tir_transform_narrow_datatype.py +++ b/tests/python/tir-transform/test_tir_transform_narrow_datatype.py @@ -15,7 +15,6 @@ # specific language governing permissions and limitations # under the License. import tvm -from tvm import te from tvm.script import tir as T from tvm.tir import const import tvm.testing diff --git a/tests/python/tir-transform/test_tir_transform_split_host_device.py b/tests/python/tir-transform/test_tir_transform_split_host_device.py index e5bc6c31b986..532f963647f6 100644 --- a/tests/python/tir-transform/test_tir_transform_split_host_device.py +++ b/tests/python/tir-transform/test_tir_transform_split_host_device.py @@ -16,7 +16,6 @@ # under the License. import tvm import tvm.testing -from tvm import te from tvm.script import ir as I from tvm.script import tir as T diff --git a/tests/python/tir-transform/test_tir_transform_storage_rewrite.py b/tests/python/tir-transform/test_tir_transform_storage_rewrite.py index d3530914709e..e5580f7f775e 100644 --- a/tests/python/tir-transform/test_tir_transform_storage_rewrite.py +++ b/tests/python/tir-transform/test_tir_transform_storage_rewrite.py @@ -20,7 +20,6 @@ import tvm import tvm.testing -from tvm import te from tvm.script import tir as T, ir as I