Skip to content

Conversation

@guan404ming
Copy link
Member

@guan404ming guan404ming commented Feb 12, 2026

Why

It is only used in one place and relax specific

How

  • Remove TODO comment for moving code in fuse_tir.cc

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @guan404ming, 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 SymbolicMatcher class by extracting its definition from an existing source file into a new, standalone header. This change improves code organization and promotes better reusability of the symbolic matching logic across the codebase, aligning with best practices for modular design.

Highlights

  • Code Reorganization: The SymbolicMatcher class has been extracted from an inline definition within src/relax/transform/fuse_tir.cc and moved to its own dedicated header file at src/tir/analysis/symbolic_matcher.h.
  • Improved Reusability: This refactoring enhances the reusability of the SymbolicMatcher class by placing it in a more appropriate and accessible location within the TIR analysis module, allowing other components to easily utilize its functionality.

🧠 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
  • src/relax/transform/fuse_tir.cc
    • Removed the inline definition of the SymbolicMatcher class.
    • Added an include statement for the newly created symbolic_matcher.h header.
  • src/tir/analysis/symbolic_matcher.h
    • Added a new header file containing the complete definition of the SymbolicMatcher class, previously defined inline.
Activity
  • The pull request author guan404ming initiated this change to improve the reusability and organization of the SymbolicMatcher class.
  • The core activity involves moving a class definition from one C++ file to a new header file and updating the original file to reference the new header.
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.

Copy link
Contributor

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

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 nice refactoring that moves the SymbolicMatcher class to its own header file under tir/analysis, improving code organization and reusability. The changes look good.

I've also taken the opportunity to review the SymbolicMatcher implementation and found a few potential issues that could be addressed:

  • The SelectNode visitor seems to be missing a recursive call for its condition field.
  • The data type comparisons are only checking the type code, which might not be strict enough for all cases (e.g., different bit widths or vector lanes).

I've added specific comments with suggestions for these points. Addressing them would make the SymbolicMatcher more robust.

@tqchen
Copy link
Member

tqchen commented Feb 12, 2026

sorry we seems to have previous comment on this that this file is better kept under relax given it is only used in one place and relax specific. Maybe we should update the comment instead so we don't have to pick it up again

@guan404ming guan404ming force-pushed the move-symbolic-matcher-to-tir branch from 9cbc839 to e7c4c3b Compare February 12, 2026 02:21
Signed-off-by: Guan-Ming Chiu <guanmingchiu@gmail.com>
@guan404ming guan404ming force-pushed the move-symbolic-matcher-to-tir branch from e7c4c3b to 057b99f Compare February 12, 2026 02:25
@guan404ming
Copy link
Member Author

Sure, that makes sense. Just updated!

@tqchen
Copy link
Member

tqchen commented Feb 12, 2026

#18650

@guan404ming guan404ming changed the title [TIR] Move SymbolicMatcher to tir/analysis [Relax] Remove TODO comment for moving code in fuse_tir.cc Feb 12, 2026
@guan404ming
Copy link
Member Author

guan404ming commented Feb 12, 2026

Oops, I forget that. We should remove that stale todo at that time. Thanks!

@guan404ming guan404ming merged commit 1f65047 into apache:main Feb 12, 2026
13 checks passed
@guan404ming guan404ming deleted the move-symbolic-matcher-to-tir branch February 12, 2026 04:30
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.

3 participants