[IR][Relax] Include expression types in structural identity#19933
[IR][Relax] Include expression types in structural identity#19933tqchen wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates TVM's structural equality and hashing behavior to include the expression type (ty) by default, while defining custom equality and hashing overrides for specific nodes like GlobalVarNode and SeqExprNode. It also updates Python operator helpers to handle integer device indices, refactors PrimFunc construction in the distributed lowering pass, and updates corresponding tests to reflect the new structural equality traversal paths. I have no feedback to provide as there are no review comments.
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.
99c4c27 to
b04e58c
Compare
After unifying PrimExpr and Expr, expression types are part of semantic identity while source spans remain diagnostic metadata. Include types in generic equality and hashing, preserve symbol-specific identity and definition-safe traversal, and exclude tirx.PrimFunc's derived type cache until transformation paths maintain it eagerly. Narrow Relax construction and expected fixtures now preserve the types exposed by stricter identity. Nested symbolic-shape rendering uses an independent configuration so outer diagnostics cannot alter script tokens.
4447d68 to
21828f8
Compare
|
rerun ci |
|
@tvm-bot rerun ci |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/28692271196 Detailswith response |
|
@tvm-bot rerun ci |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/28692313409 Detailswith response |
|
@tvm-bot rerun ci |
Rationale
After
PrimExprandExprshare one typed expression hierarchy, expression types are part of semantic identity. Structurally identical syntax with different types compare and hash differently, while source spans remain diagnostic metadata.Invariant
ExprNode::typarticipates in structural equality and hashing by default.GlobalVarand Relax variables retain their symbol identity rules.tirx.PrimFunccompares and hashes authoritative source fields while excluding its derived type cache until all transformation paths maintain that cache eagerly. Nested symbolic-shape rendering is isolated from outer diagnostic configuration so diagnostic context cannot become script-token content.Changes