Skip to content

Phase out Relax-specific Id aliases#19959

Open
tqchen wants to merge 3 commits into
apache:mainfrom
tqchen:tvm-phase-out-relax-id
Open

Phase out Relax-specific Id aliases#19959
tqchen wants to merge 3 commits into
apache:mainfrom
tqchen:tvm-phase-out-relax-id

Conversation

@tqchen

@tqchen tqchen commented Jul 6, 2026

Copy link
Copy Markdown
Member

Remove the Relax-specific Id indirection and use Var/DataflowVar object identity directly.

Type-changing rewrites now remap definitions, uses, and binding lookups coherently while preserving reflection, serialization, and the DataflowVar subtype. Existing tests are adjusted for the API change; no new test files or test cases are added.

Validation: the compiler and C++ tests build successfully; focused C++ coverage passes 4/4; the affected existing Python matrices pass 549 tests with 2 expected xfails; source censuses, diff checks, and applicable hooks pass.

@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 simplifies variable identification in Relax by removing the Id class and instead identifying variables uniquely by their memory address. Consequently, VarNode now stores name_hint_ directly, and all mapping structures (such as var_remap_ and binding_table_) have been updated to use Var as keys instead of Id. Feedback on these changes highlights a potential performance bottleneck in the newly introduced RedirectVarRemapTargets helper, which performs a linear scan and introduces O(N^2) complexity; implementing a transitive lookup strategy is recommended to resolve this issue efficiently.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/relax/ir/expr_functor.cc Outdated
tqchen added 3 commits July 6, 2026 20:04
Use Relax variable object identity directly and make type-changing rewrites remap definitions, uses, and binding lookups coherently.
@tqchen tqchen force-pushed the tvm-phase-out-relax-id branch from dbde9ef to 900bf3c Compare July 6, 2026 20:53
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