You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "tqchen (via GitHub)" <gi...@apache.org> on 2026/04/25 12:10:51 UTC

[PR] [REFACTOR] Remove runtime/object.py shim and route Object via tvm_ffi [tvm]

tqchen opened a new pull request, #19440:
URL: https://github.com/apache/tvm/pull/19440

   ## Summary
   
   TVM-side cleanup that drops the `python/tvm/runtime/object.py` shim and
   routes `tvm.runtime.Object` directly to `tvm_ffi.Object`. The
   `tvm.runtime.Object` re-export is preserved (now a re-export of
   `tvm_ffi.Object`) so external callers keep working.
   
   The load-bearing `__object_repr__` install — which wires TVM IR objects
   up to the rich C++ `ReprPrinter` registered through
   `init_ffi_api("node", ...)` — moves into `python/tvm/runtime/_ffi_node_api.py`.
   That module is already imported as a side-effect-only module from
   `python/tvm/runtime/__init__.py`, so the override fires at the right
   time (after `init_ffi_api` registers the C++ printer).
   
   `_ffi_node_api.AsRepr` itself is **kept**: `tvm_ffi`'s default repr is
   primitive (`ClassName(ptr)`); TVM IR objects need the rich printer
   registered via `init_ffi_api("node", ...)`. `AsRepr` is what bridges
   that printer back into Python `repr(obj)` and is also the runtime-only
   fallback when `libtvm.so` is unavailable.
   
   The 7 in-tree importers of the deleted shim (plus one straggler in
   `runtime/disco/session.py`) are switched to either
   `from tvm.runtime import Object` or `from tvm_ffi import Object`,
   depending on which pattern the file already uses.
   
   ## Test plan
   
   - [x] `python -c "import tvm; print(repr(tvm.IRModule({})))"` produces
     TVMScript-style output (rich repr preserved).
   - [x] `pytest tests/python/all-platform-minimal-test/ -x` — 75 passed,
     77 skipped (matches baseline).
   - [x] `pytest tests/python/tirx-base/ -x` — 273 passed, 2 skipped.
   - [x] `pre-commit run --files <changed files>` — all hooks pass.
   - [ ] CI green.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [PR] [REFACTOR] Remove runtime/object.py shim and route Object via tvm_ffi [tvm]

Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen merged PR #19440:
URL: https://github.com/apache/tvm/pull/19440


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org