[Arith] Make Analyzer a tvm-ffi Object#19675
Conversation
e155636 to
55f38ab
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the arithmetic Analyzer in TVM to be a first-class FFI object. The stateful Analyzer class is renamed to AnalyzerObj (inheriting from ffi::Object), and Analyzer is redefined as a lightweight, reference-counted handle (ffi::ObjectRef) wrapping it. This allows Analyzer instances to be passed across the TVM FFI boundary (e.g., between Python and C++) and shared, preserving accumulated bindings and constraints. Numerous function signatures and call sites across the codebase have been updated to accept AnalyzerObj* instead of Analyzer*, and member accesses on Analyzer now use the arrow operator (->). Additionally, Python bindings and index mapping utilities have been updated to support passing an external Analyzer instance, and corresponding tests have been added. No reviewer comments were provided, so there is no additional feedback to address.
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.
9697f79 to
ef6cabb
Compare
986240b to
2eed01e
Compare
2eed01e to
66191ea
Compare
8f84480 to
f07de85
Compare
f07de85 to
3478fd9
Compare
…d tests Now that arith::Analyzer is a tvm-ffi object, expose more of its stateful surface to Python and let callers share a single analyzer across FFI calls. - Add Python bindings for additional Analyzer methods. - Accept optional analyzers in iter-map, int-set, and IndexMap helper APIs. - Keep IndexMap inverse temporary bindings out of caller-provided analyzers. - Add targeted tests for optional analyzer reuse and state isolation.
3478fd9 to
23af9ce
Compare
b58d406 to
55a6199
Compare
55a6199 to
23af9ce
Compare
guan404ming
left a comment
There was a problem hiding this comment.
Great work, thanks @tlopex
This PR makes
arith::Analyzera first-class tvm-ffi object.The implementation splits the previous concrete
Analyzerclass into:AnalyzerObj, the mutable object node that owns analyzer state, sub-analyzers, caches, and bindingsAnalyzer, a reference-countedObjectRefhandle that can be passed across the tvm-ffi boundaryThis allows Python and C++ to share the same analyzer instance, so bindings, constraints, and cached facts can persist across FFI calls.
Public APIs that accept an analyzer now use
const arith::Analyzer&, while internal helper APIs that only borrow the object continue to useAnalyzerObj*.