[CI] Bump tvm-ffi with compatible Python wrappers - #20032
Conversation
tvm-ffi object tying can make BaseFuncCopy return the canonical Python wrapper for self. Moving that wrapper invalidates the caller instead of creating the promised copy. Pass the initial self alias as an lvalue so native copy-on-write creates a private result. For dictionary updates, only move a later result when it is not self; that result was created inside this method and has not escaped, so the exclusive-move precondition holds.
There was a problem hiding this comment.
Code Review
This pull request updates the tvm-ffi subproject commit and introduces several FFI-related fixes, including header inclusions, import reordering to ensure correct registration order, and copy-on-write safety improvements in BaseFunc.with_attr. It also adds slots to the Tensor class to maintain instance layout compatibility. The feedback suggests asserting that func.attrs is None directly in the test file to prevent a potential TypeError when checking for membership.
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.
Summary
DLDevicetraits are instantiatedir.Typebefore reflectedExprfields can materialize a fallback wrapperBaseFunc.with_attrcallers by moving only method-private results, never the canonicalselfwrapperRationale
The tvm-ffi lifetime update requires a replacement wrapper to fit the layout already registered for the same type index.
runtime.Tensorreplaces the coreffi.Tensorwrapper, so it must use empty slots. The ordinary TVM mixins are first-registered with their concrete descendants and may safely retain normal Python dictionaries; the additional mixin and explicit-dictionary slot changes are not required.Object tying also means
BaseFuncCopy(self)may returnself. Passing that wrapper through_move()invalidates the caller. The first update now passes the alias as an lvalue, forcing native copy-on-write to create a private result. Only later dictionary updates move a result that is notselfand has not escaped the method.Validation
21e30c3b1dand rebuilt TVM against itrelax.Function,relax.ExternFunc, andtirx.PrimFunc: original wrappers preserved; single- and multi-attribute results distinct and valid