[REFACTOR][TEST] Migrate tir-transform tests from TE to TVMScript#18805
Conversation
This PR migrates te.var/te.compute usage to direct tvm.tir.Var and PrimFunc construction in tir-transform test files.
Summary of ChangesHello @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 undertakes a significant refactoring effort within the Highlights
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
The pull request successfully refactors several TIR transform tests to use tvm.tir.Var and manual PrimFunc construction instead of the legacy te.var and te.compute APIs. This aligns with the goal of migrating TIR tests towards TVMScript and direct TIR construction, which improves maintainability and reduces dependency on the TE stack for TIR-level testing. However, in tests/python/tir-transform/test_tir_transform_lower_intrin.py, the removal of the te import while maintaining references to tvm.te in the test functions will cause runtime AttributeError failures. These references should be updated to tvm.tir to complete the migration.
Fix leftover tvm.te.floordiv/floormod/max calls that should use tvm.tir.
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request successfully refactors several TIR transform tests to remove dependencies on the legacy tvm.te (Tensor Expression) API, moving towards direct tvm.tir construction and TVMScript-style testing. This is a positive change for the long-term maintainability of the TIR codebase. The refactoring of the check_value helper in test_tir_transform_lower_intrin.py correctly implements the manual construction of a PrimFunc with explicit buffer loading and storing, replacing the previous te.compute logic. The changes are consistent across all modified files and follow TVM's modern TIR testing practices.
This PR migrates test files in arith/, tir-base/, tir-analysis/, and ir/ to use direct TIR construction (tvm.tir.Var, tvm.tir.floordiv, etc.) instead of TE sugar (te.var, tvm.te.floordiv, etc.).
This commit fixes black formatting errors reported by lint CI.
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request successfully refactors multiple test files to remove dependencies on the te (Tensor Expression) namespace, favoring direct tvm.tir usage and TVMScript. This aligns with the ongoing effort to modernize TVM's testing infrastructure. The changes are consistent across the arithmetic, IR, and TIR analysis/transform modules, and the logic of the tests remains intact. The refactoring of the check_value helper in test_tir_transform_lower_intrin.py is particularly noteworthy as it replaces high-level te.compute with explicit TIR constructs (nested Let bindings and manual loop construction), providing better isolation for testing TIR transformations. No significant issues or regressions were identified during the review.
…ache#18805) This PR migrates te.var/te.compute usage to direct tvm.tir.Var and PrimFunc construction in tir-transform test files.
This PR migrates te.var/te.compute usage to direct tvm.tir.Var
and PrimFunc construction in tir-transform test files.