Skip to content

[FFI][REFACTOR] Direct structural APIs to tvm-ffi#19661

Merged
tlopex merged 2 commits into
mainfrom
tvm-direct-tvm-ffi-structural-apis
Jun 3, 2026
Merged

[FFI][REFACTOR] Direct structural APIs to tvm-ffi#19661
tlopex merged 2 commits into
mainfrom
tvm-direct-tvm-ffi-structural-apis

Conversation

@tqchen

@tqchen tqchen commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

Python callers should reach the canonical tvm-ffi structural helpers directly instead of going through a TVM-side redirect layer. This makes the public tvm.ir bindings exact aliases of the tvm_ffi APIs and exposes get_first_structural_mismatch from tvm.ir.

Main changes:

  • Import structural_equal, get_first_structural_mismatch, and structural_hash directly from tvm_ffi
  • Remove the pure wrappers from tvm.ir.base while keeping assert_structural_equal's TVM-specific formatting
  • Update mismatch tests and add identity coverage for the direct bindings

@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 refactors the structural equality and hashing APIs in TVM's IR module. It removes the redundant Python wrapper functions structural_equal, get_first_structural_mismatch, and structural_hash from python/tvm/ir/base.py and instead exposes the direct FFI implementations from tvm_ffi via python/tvm/ir/__init__.py. Test files and internal references have been updated to use the new import paths, and a new test has been added to verify that these APIs correctly redirect to their FFI counterparts. There are no review comments, and I have no feedback to provide.

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.

The structural helper functions now live directly in tvm-ffi, so TVM Python code should call the canonical tvm_ffi APIs instead of keeping a tvm.ir forwarding surface.

This removes the tvm.ir helper re-exports, keeps the TVM-specific assert_structural_equal reporting helper, and updates TVM-side structural equality/hash usages to call tvm_ffi directly.
@tqchen tqchen force-pushed the tvm-direct-tvm-ffi-structural-apis branch from 3c42a3e to 670a5a3 Compare June 3, 2026 15:52
@tlopex tlopex merged commit 1240649 into main Jun 3, 2026
10 checks passed
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