Skip to content

[TVMScript] Normalize T.Bind to T.bind for statement builder convention#18889

Merged
tlopex merged 1 commit into
apache:mainfrom
tqchen:normalize-bind-lowercase
Mar 8, 2026
Merged

[TVMScript] Normalize T.Bind to T.bind for statement builder convention#18889
tlopex merged 1 commit into
apache:mainfrom
tqchen:normalize-bind-lowercase

Conversation

@tqchen

@tqchen tqchen commented Mar 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Rename T.Bind (capitalized) to T.bind (lowercase) to match TVMScript naming convention: statement builders use lowercase (T.evaluate, T.buffer_store, T.bind), expression constructors use capitalized (T.Cast, T.Select, T.Let)
  • Keep Bind = bind backward-compat alias
  • Update parser, printer references, and all test files

Test plan

  • tvmscript tests (771 passed)
  • tir-transform tests (346 passed)
  • tir-base tests (224 passed)
  • pre-commit lint passes

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 refactors the naming of a core TVMScript function to standardize its API. By transitioning T.Bind to T.bind, the change clarifies the function's role as a statement builder within the TVMScript ecosystem, improving consistency and readability for developers. The inclusion of a backward-compatibility alias ensures a smooth transition for existing codebases.

Highlights

  • Naming Convention Enforcement: The T.Bind function has been renamed to T.bind to align with the TVMScript naming convention, where statement builders use lowercase names (e.g., T.evaluate, T.buffer_store) and expression constructors use capitalized names (e.g., T.Cast, T.Select).
  • Backward Compatibility: A backward-compatibility alias Bind = bind was introduced to ensure existing code using T.Bind continues to function without immediate changes.
  • Codebase Updates: All internal references to T.Bind in the IR builder, parser, and various test files have been updated to use the new T.bind convention.

🧠 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
  • python/tvm/script/ir_builder/tir/ir.py
    • Renamed the Bind function to bind.
    • Added Bind = bind as a backward-compatibility alias.
    • Updated references within the let_stmt function and deprecated decorator to use bind.
  • python/tvm/script/parser/tir/parser.py
    • Updated calls to T.Bind to T.bind in bind_assign_value and visit_ann_assign.
    • Modified a comment in visit_expr_stmt to reflect the T.bind naming.
  • tests/python/s_tir/transform/test_s_tir_transform_thread_sync.py
    • Updated all instances of T.Bind to T.bind within test functions.
  • tests/python/tir-analysis/test_tir_analysis_verify_well_formed.py
    • Replaced T.Bind with T.bind in various test cases for well-formedness verification.
  • tests/python/tir-transform/test_tir_inline_private_functions.py
    • Changed T.Bind to T.bind in the expected output of the test_inline_private_functions test.
  • tests/python/tir-transform/test_tir_transform_convert_ssa.py
    • Updated T.Bind calls to T.bind in test cases for SSA conversion.
  • tests/python/tvmscript/test_tvmscript_ir_builder_tir.py
    • Updated the test function name and its internal T.Bind call to T.bind.
  • tests/python/tvmscript/test_tvmscript_printer_tir.py
    • Modified the T.Bind call to T.bind within the test_bind function.
  • tests/python/tvmscript/test_tvmscript_roundtrip.py
    • Changed T.Bind to T.bind in the bind_var test function.
  • tests/python/tvmscript/test_tvmscript_syntax_sugar.py
    • Updated T.Bind to T.bind in test cases related to syntax sugar for let bindings.
Activity
  • The author executed tvmscript tests, with 771 tests passing.
  • The author executed tir-transform tests, with 346 tests passing.
  • The author executed tir-base tests, with 224 tests passing.
  • The author confirmed that pre-commit lint checks passed.
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 refactors T.Bind to T.bind to align with TVMScript's naming convention for statement builders, where statement builders are lowercase. The change correctly introduces a backward-compatibility alias Bind = bind. The renaming has been consistently applied across the function definition, parser logic, and all relevant test files. The changes are correct and fulfill the purpose of the pull request.

@tlopex tlopex merged commit f83cebb into apache:main Mar 8, 2026
11 checks passed
tqchen added a commit that referenced this pull request Mar 9, 2026
## Summary
- Remove `Bind = bind` backward-compat alias from `ir.py`
- Remove `"Bind"` from `__all__` exports
- Follows #18889 which renamed `T.Bind` → `T.bind`

## Test plan
- [x] tvmscript roundtrip/printer/ir_builder tests pass (232 passed)
- [x] pre-commit lint passes
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.

2 participants