Skip to content

[REFACTOR][TEST] Remove unused te imports from test files#18804

Merged
tqchen merged 1 commit into
apache:mainfrom
tqchen:cleanup-unused-te-imports
Feb 21, 2026
Merged

[REFACTOR][TEST] Remove unused te imports from test files#18804
tqchen merged 1 commit into
apache:mainfrom
tqchen:cleanup-unused-te-imports

Conversation

@tqchen

@tqchen tqchen commented Feb 21, 2026

Copy link
Copy Markdown
Member

This PR removes unused from tvm import te imports from 25 test files across the codebase, continuing the ongoing TE → TVMScript migration cleanup.

Changes:

  • Remove unused from tvm import te from 24 test files in tir-transform/, s_tir/transform/, codegen/, arith/, all-platform-minimal-test/, and testing/
  • Replace te.var("x") with tvm.tir.Var("x", "int32") in test_s_tir_transform_decorate_device_scope.py (the only file where te was actually used)
  • Clean up stale tvm.tir.ir_builder comment references in test_tir_transform_convert_ssa.py

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.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @tqchen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request continues the effort to migrate away from the te (Tensor Expression) module towards TVMScript. The primary goal is to streamline the codebase by removing unused imports and updating deprecated API calls in test files. This cleanup improves code clarity and reduces potential confusion by ensuring that only necessary modules are imported and current API standards are followed.

Highlights

  • Unused Import Removal: Removed from tvm import te imports from 24 test files across various directories (tir-transform/, s_tir/transform/, codegen/, arith/, all-platform-minimal-test/, and testing/) as part of the ongoing TE → TVMScript migration cleanup.
  • API Migration: Replaced the deprecated te.var("x") with tvm.tir.Var("x", "int32") in test_s_tir_transform_decorate_device_scope.py, addressing the only instance where te was actively used in the affected files.
  • Comment Cleanup: Cleaned up stale tvm.tir.ir_builder comment references in test_tir_transform_convert_ssa.py to reflect current practices.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tests/python/all-platform-minimal-test/test_runtime_ndarray.py
    • Removed unused from tvm import te import.
  • tests/python/all-platform-minimal-test/test_runtime_packed_func.py
    • Removed unused from tvm import te import.
  • tests/python/arith/test_arith_domain_touched.py
    • Removed unused from tvm import te import.
  • tests/python/codegen/test_target_codegen_llvm_vla.py
    • Removed unused from tvm import te import.
  • tests/python/codegen/test_target_codegen_static_init.py
    • Removed unused from tvm import te import.
  • tests/python/s_tir/transform/test_s_tir_transform_compact_buffer_region.py
    • Removed unused from tvm import te import.
  • tests/python/s_tir/transform/test_s_tir_transform_decorate_device_scope.py
    • Removed unused from tvm import te import.
    • Replaced te.var("x") with tvm.tir.Var("x", "int32").
  • tests/python/s_tir/transform/test_s_tir_transform_hoist_if.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_loop_partition.py
    • Removed unused from tvm import te import.
  • tests/python/s_tir/transform/test_s_tir_transform_lower_cross_thread_reduction.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_lower_init_block.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_lower_opaque_block.py
    • Removed unused from tvm import te import.
  • tests/python/s_tir/transform/test_s_tir_transform_memhammer_lower_auto_copy.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_merge_dynamic_shared_memory_allocations.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_plan_update_buffer_allocation_location.py
    • Removed unused from tvm import te import.
  • tests/python/s_tir/transform/test_s_tir_transform_profiling_instr.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/s_tir/transform/test_s_tir_transform_unify_thread_binding.py
    • Modified from tvm import te, s_tir to from tvm import s_tir.
  • tests/python/testing/test_testing.py
    • Removed unused from tvm import te import.
  • tests/python/tir-transform/test_tir_transform_convert_ssa.py
    • Updated comments to remove references to tvm.tir.ir_builder.
  • tests/python/tir-transform/test_tir_transform_flatten_buffer.py
    • Removed unused from tvm import te import.
  • tests/python/tir-transform/test_tir_transform_make_packed_api.py
    • Modified from tvm import te, tir to from tvm import tir.
  • tests/python/tir-transform/test_tir_transform_narrow_datatype.py
    • Removed unused from tvm import te import.
  • tests/python/tir-transform/test_tir_transform_split_host_device.py
    • Removed unused from tvm import te import.
  • tests/python/tir-transform/test_tir_transform_storage_rewrite.py
    • Removed unused from tvm import te import.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a refactoring that removes unused from tvm import te imports from 25 test files, as part of the ongoing migration from Tensor Expressions (TE) to TVMScript. The changes primarily involve deleting unused import statements. Additionally, a call to te.var has been correctly replaced with its tvm.tir.Var equivalent, and a stale comment has been updated. The changes are straightforward, correct, and contribute to improving the codebase's cleanliness. I have reviewed the pull request and found no issues.

@Ubospica Ubospica left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tqchen tqchen merged commit 7e2ebc9 into apache:main Feb 21, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants