gemini-code-assist[bot] commented on PR #18846:
URL: https://github.com/apache/tvm/pull/18846#issuecomment-3977124719

   ## Summary of Changes
   
   Hello, I'm Gemini Code Assist[^1]! 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 significantly refactors the argument conversion and type 
checking mechanisms within the Relax framework. It enhances compatibility with 
modern Python type annotation practices by correctly resolving postponed 
evaluations and replaces an implicit, decorator-based argument conversion 
system with explicit function calls. This change aims to improve the 
robustness, clarity, and maintainability of the codebase by making argument 
handling more transparent and less reliant on automatic inference.
   
   ### Highlights
   
   * **PEP 563 Compatibility for @type_checked**: The `@type_checked` decorator 
has been updated to correctly handle type annotations under PEP 563 (`from 
__future__ import annotations`) by utilizing `typing.get_type_hints()` for 
annotation resolution.
   * **Removal of @args_converter.auto**: The `@args_converter.auto` decorator 
has been entirely removed from the codebase. Argument conversion is now handled 
explicitly through direct calls to `convert_to_expr` or 
`_wrap_inline_arg_tuple` at approximately 9 call sites.
   * **Codebase Cleanup**: The `python/tvm/relax/type_converter.py` file and 
its corresponding test file (`tests/python/relax/test_expr_args_converter.py`) 
have been deleted, simplifying the project structure.
   
   🧠 **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](https://codeassist.google/code-review/login) to enable Memory in your 
admin console.**
   
   <details>
   <summary><b>Changelog</b></summary>
   
   * **python/tvm/relax/__init__.py**
       * Removed the import of `args_converter`.
   * **python/tvm/relax/op/base.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Removed `@args_converter.auto` decorators from `call_tir`, 
`call_tir_with_grad`, `call_tir_inplace`, `call_dps_packed`, `call_py_func`, 
`call_builtin_with_ctx`, `make_closure`, `invoke_closure`, 
`call_inplace_packed`, `call_pure_packed`, and `invoke_pure_closure`.
       * Added explicit `_wrap_inline_arg_tuple` or `convert_to_expr` calls for 
argument handling in affected functions.
   * **python/tvm/relax/op/builtin/builtin.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Removed `@args_converter.auto` from `alloc_tensor`.
       * Explicitly converted the `shape` argument to an `Expr` in 
`alloc_tensor`.
   * **python/tvm/relax/op/distributed/distributed.py**
       * Removed the `args_converter` import.
       * Removed `@args_converter.auto` from `call_tir_local_view`.
       * Explicitly converted `args` to `RxTuple` in `call_tir_local_view`.
   * **python/tvm/relax/op/index.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Removed `@args_converter.auto` from `strided_slice`.
       * Explicitly converted `axes`, `begin`, `end`, and `strides` arguments 
to `Expr` in `strided_slice`.
   * **python/tvm/relax/op/memory/memory.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Removed `@args_converter.auto` from `alloc_storage`, `alloc_tensor`, 
`kill_storage`, and `kill_tensor`.
       * Explicitly converted `size` and `shape` arguments to `Expr` in 
`alloc_storage` and `alloc_tensor` respectively.
   * **python/tvm/relax/op/sampling.py**
       * Removed the `args_converter` import.
       * Removed `@args_converter.auto` decorator from 
`multinomial_from_uniform`.
   * **python/tvm/relax/op/unary.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Removed `@args_converter.auto` from `clip`.
       * Explicitly converted `min` and `max` arguments to `Expr` in `clip`.
   * **python/tvm/relax/op/vm/vm.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Removed `@args_converter.auto` from `alloc_storage`, `alloc_tensor`, 
and `call_tir_dyn`.
       * Explicitly converted `shape` and `func` arguments to `Expr` in 
`alloc_storage`, `alloc_tensor`, and `call_tir_dyn` respectively.
   * **python/tvm/relax/type_converter.py**
       * Deleted the entire file.
   * **python/tvm/relax/utils.py**
       * Removed the import and re-export of `args_converter`.
   * **python/tvm/s_tir/schedule/_type_checker.py**
       * Updated the `type_checked` decorator to use `typing.get_type_hints()` 
for resolving type annotations, improving compatibility with PEP 563.
   * **python/tvm/script/ir_builder/relax/distributed/ir.py**
       * Removed the `args_converter` import.
       * Removed `@args_converter.auto` from `call_tir`.
       * Explicitly converted `args` to `RxTuple` in `call_tir`.
   * **python/tvm/script/ir_builder/relax/ir.py**
       * Replaced `args_converter` import with `convert_to_expr`.
       * Defined `_CONVERTIBLE_TYPES` for explicit conversion checks.
       * Removed `@args_converter.auto` from `call_packed` and `call_py_func`.
       * Explicitly converted `args` to `Expr` in `call_packed` and 
`call_py_func`.
   * **tests/python/relax/test_expr_args_converter.py**
       * Deleted the entire test file.
   </details>
   
   <details>
   <summary><b>Activity</b></summary>
   
   * The first commit addressed the `@type_checked` decorator's compatibility 
with PEP 563, ensuring proper resolution of type annotations, and all 632 
`s_tir/schedule` tests passed.
   * The second commit focused on removing the `@args_converter.auto` 
decorator, replacing its functionality with explicit `convert_to_expr` or 
`_wrap_inline_arg_tuple` calls across 10 files, with 4892 `relax` tests passing 
(excluding 10 pre-existing failures).
   * CI is expected to pass, indicating the changes are stable and functional.
   </details>
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation 
page](https://developers.google.com/gemini-code-assist/docs/review-github-code),
 here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   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.
   
   <b>Customization</b>
   
   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](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances 
where its feedback is incorrect or counter productive. You can react with 
:thumbsup: and :thumbsdown: 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](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   
   <b>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](https://cloud.google.com/products/gemini/code-assist).</b>
   </details>
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), 
[Generative AI Prohibited Use 
Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of 
Service](https://policies.google.com/terms), and learn how to configure Gemini 
Code Assist in GitHub 
[here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
 Gemini can make mistakes, so double check it and [use code with 
caution](https://support.google.com/legal/answer/13505487).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to