[FFI][REFACTOR] Direct structural APIs to tvm-ffi#19661
Conversation
There was a problem hiding this comment.
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.
3c42a3e to
670a5a3
Compare
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: