gemini-code-assist[bot] commented on PR #18862: URL: https://github.com/apache/tvm/pull/18862#issuecomment-3984858073
## 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 focuses on refactoring and cleaning up the attribute system within the TIR (Tensor Intermediate Representation) and S-TIR (Staged Tensor Intermediate Representation). It removes unused attributes, migrates attributes to their appropriate namespace (S-TIR), and reorganizes the remaining attributes for better clarity. This improves code maintainability and reduces potential confusion regarding attribute ownership and usage. ### Highlights * **Unused Attributes**: Phased out 12 unused `tir::attr` constants, including `scan_*`, `channel_*`, `pipeline_*`, `buffer_bind_scope`, `coproc_*`, and `loop_scope`, and removed their associated dead code paths. * **Attribute Migration**: Moved 11 S-TIR-owned attributes, such as `async_*`, `double_buffer_*`, `fragment_*`, `pragma_loop_partition_hint`, `reduce_scope`, and `virtual_thread`, from `tir::attr` to `s_tir::attr`. * **Code Organization**: Alphabetized the remaining 15 `tir::attr` constants for better code readability and maintainability. 🧠**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> * **include/tvm/s_tir/stmt.h** * Added S-TIR specific attributes related to asynchronous operations, double buffering, TensorCore fragments, loop partitioning, reduce scope, and virtual threads. * **include/tvm/tir/stmt.h** * Removed unused attributes and alphabetized the remaining attributes in the tir::attr namespace. * **src/arith/ir_mutator_with_analyzer.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/arith/ir_visitor_with_analyzer.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/s_tir/analysis/verify_gpu_code.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/s_tir/meta_schedule/postproc/disallow_async_strided_mem_copy.cc** * Adjusted attribute access for `async_commit_queue_scope` to use `s_tir::attr`. * **src/s_tir/meta_schedule/schedule_rule/multi_level_tiling_tensor_core.cc** * Adjusted attribute access for `double_buffer_scope` to use `s_tir::attr`. * **src/s_tir/transform/annotate_irregular_loop.cc** * Adjusted attribute access for `pragma_loop_partition_hint` to use `s_tir::attr`. * **src/s_tir/transform/compact_buffer_region.cc** * Adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/s_tir/transform/inject_double_buffer.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `double_buffer_scope` and `double_buffer_write` to use `s_tir::attr`. * **src/s_tir/transform/inject_ptx_async_copy.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `async_scope` to use `s_tir::attr`. * **src/s_tir/transform/inject_software_pipeline.cc** * Adjusted attribute access for `async_wait_queue_scope`, `async_wait_inflight_count`, `async_commit_queue_scope`, `async_scope`, and `double_buffer_scope` to use `s_tir::attr`. * **src/s_tir/transform/inject_virtual_thread.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/s_tir/transform/loop_partition.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `pragma_loop_partition_hint` to use `s_tir::attr`. * **src/s_tir/transform/lower_async_dma.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `async_wait_queue_scope`, `async_wait_inflight_count`, and `async_commit_queue_scope` to use `s_tir::attr`. * **src/s_tir/transform/lower_cross_thread_reduction.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `reduce_scope` to use `s_tir::attr`. * **src/s_tir/transform/lower_opaque_block.cc** * Adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/s_tir/transform/lower_thread_allreduce.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `reduce_scope` to use `s_tir::attr`. * **src/s_tir/transform/merge_shared_memory_allocations.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/s_tir/transform/storage_access.cc** * Adjusted attribute access for `double_buffer_write` to use `s_tir::attr`. * **src/s_tir/transform/tensorcore_infer_fragment.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `fragment_shape` and `fragment_layout` to use `s_tir::attr`. * **src/s_tir/transform/thread_storage_sync.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `async_wait_queue_scope` and `async_wait_inflight_count` to use `s_tir::attr`. * **src/s_tir/transform/unify_thread_binding.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/target/llvm/codegen_cpu.cc** * Removed handling of `tir::attr::coproc_uop_scope`. * **src/target/source/codegen_cuda.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `fragment_shape`, `fragment_layout`, `async_commit_queue_scope`, and `async_wait_queue_scope` to use `s_tir::attr`. * **src/target/spirv/codegen_spirv.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `fragment_shape` to use `s_tir::attr`. * **src/tir/analysis/verify_memory.cc** * Removed `attr::pipeline_exec_scope` from the condition for entering a thread environment. * **src/tir/analysis/verify_well_formed.cc** * Removed mention of `AttrStmt` with key `buffer_bind_scope` as a source of definition for buffer objects and symbolic variables. * **src/tir/ir/data_type_rewriter.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/tir/ir/tir_visitor_with_path.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. Removed handling of `attr::buffer_bind_scope`. * **src/tir/transform/annotate_device_regions.cc** * Removed `attr::pipeline_exec_scope` from the list of attributes allowed only in device-side code. * **src/tir/transform/bind_target.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/tir/transform/ir_utils.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `async_wait_queue_scope` and `async_wait_inflight_count` to use `s_tir::attr`. * **src/tir/transform/ir_utils.h** * Updated to include `tvm/s_tir/stmt.h` and adjusted comment to refer to `s_tir::attr::async_wait_queue_scope`. * **src/tir/transform/lower_warp_memory.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/tir/transform/narrow_datatype.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **src/tir/transform/remove_no_op.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `async_wait_queue_scope` to use `s_tir::attr`. * **src/tir/transform/storage_rewrite.cc** * Updated to include `tvm/s_tir/stmt.h` and adjusted attribute access for `virtual_thread` to use `s_tir::attr`. * **tests/python/codegen/test_target_codegen_static_init.py** * Removed test case `test_static_callback`. * **tests/python/tir-analysis/test_tir_analysis_verify_well_formed.py** * Removed test cases `test_buffer_bind_scope_defines_buffer_obj` and `test_buffer_bind_scope_defines_symbolic_variables`. </details> <details> <summary><b>Activity</b></summary> * The pull request involves refactoring attribute handling in TIR and S-TIR. * It includes removing unused attributes, migrating attributes to the correct namespace, and alphabetizing the remaining attributes. * The changes touch multiple files across the codebase, including headers, source files, and test files. </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]
