Commit 2f4f4b1
authored
[REFACTOR][IR][FFI] Bump tvm-ffi (+ SEqHashDef migration) and phase out tvm/ir/repr.h (#19627)
## Summary
Two-commit PR:
1. Bump `3rdparty/tvm-ffi` from `3c35034` to `98d0029` and migrate all
21 in-tree `SEqHashDef()` call sites to `SEqHashDefRecursive()` (the
conservative variant matching the prior default behavior). Six let-style
sites carry `TODO(tqchen)` comments indicating they should flip to
`SEqHashDefNonRecursive` after the new tvm-ffi ships on pypi.
2. Phase out `include/tvm/ir/repr.h`. The bumped tvm-ffi now provides
ostream `operator<<` for `Any`/`ObjectRef`/`Variant`/`Optional` directly
in `tvm/ffi/extra/dataclass.h`, making the in-tree thin wrapper
redundant. Rewrite 8 includers, rename `src/ir/repr.cc` →
`src/ir/access_path_repr.cc` (preserves `node.AsRepr` +
AccessPath/AccessStep `__ffi_repr__` registrations; drops zero-caller
`tvm::Dump()`), delete the header. Also fixes a Python-level import
regression in `python/tvm/ir/attrs.py` caused by the bump: tvm_ffi
0.1.12.dev changes the field-registration guard from `not hasattr(cls,
name)` to `name not in cls.__dict__`, which breaks `DictAttrs` because
`DictAttrsNode` registers a reflection field named `"__dict__"` — Python
forbids installing a class descriptor with that name via `setattr`. Fix:
define `__dict__` as an explicit Python property on `DictAttrs` so the
auto-installation is skipped.
## TODO follow-ups
After the new tvm-ffi releases on pypi, flip the 6
`SEqHashDefRecursive()` sites that carry `TODO(tqchen)` comments to
`SEqHashDefNonRecursive()`. Locations are enumerated in the commit body
of commit 1.
## Test plan
- [x] Full ninja build clean (638/638).
- [x] 118/118 cpptest pass.
- [x] `import tvm; tvm.cuda(0).exist` returns True.
- [x] `tests/python/all-platform-minimal-test`: 37 passed, 105 skipped.
- [x] `tests/python/relax/test_struct_info.py`: 9 passed.
- [x] `git grep -nE 'SEqHashDef\(|"tvm/ir/repr\.h"'` is empty.
- [x] `pre-commit run --all-files` clean.1 parent ffea531 commit 2f4f4b1
22 files changed
Lines changed: 57 additions & 113 deletions
File tree
- 3rdparty
- include/tvm
- ir
- relax
- tirx
- python/tvm/ir
- src
- ir
- relax/ir
- script/printer
- tirx/ir
- CMakeLists.txt+1
- README.md+1-1
- addons/torch_c_dlpack_ext/torch_c_dlpack_ext/core.py+13-2
- addons/tvm_ffi_orcjit/CMakeLists.txt+24-16
- addons/tvm_ffi_orcjit/python/tvm_ffi_orcjit/session.py+45-9
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/README.md+70
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/gotpcrelx_fix.cc+162
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/gotpcrelx_fix.h+92
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/init_fini_plugin.cc+258
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/init_fini_plugin.h+123
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/macho_cxa_atexit_shim.cc+91
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/macho_cxa_atexit_shim.h+119
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_coff_pdata_strip.cc+131
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_coff_pdata_strip.h+83
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_dll_import_generator.cc+154
- addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_dll_import_generator.h+93
- addons/tvm_ffi_orcjit/src/ffi/orcjit_dylib.cc+58-34
- addons/tvm_ffi_orcjit/src/ffi/orcjit_dylib.h+13
- addons/tvm_ffi_orcjit/src/ffi/orcjit_memory_manager.cc+107-631
- addons/tvm_ffi_orcjit/src/ffi/orcjit_memory_manager.h+79-170
- addons/tvm_ffi_orcjit/src/ffi/orcjit_session.cc+106-650
- addons/tvm_ffi_orcjit/src/ffi/orcjit_session.h+29-5
- addons/tvm_ffi_orcjit/src/ffi/orcjit_slab.cc+769
- addons/tvm_ffi_orcjit/src/ffi/orcjit_slab.h+324
- addons/tvm_ffi_orcjit/tests/test_basic.py+397
- addons/tvm_ffi_orcjit/tests/test_memory_manager.py+119-108
- docs/concepts/structural_eq_hash.rst+57-15
- docs/conf.py+4-1
- include/tvm/ffi/base_details.h+38
- include/tvm/ffi/c_api.h+67-3
- include/tvm/ffi/error.h+17-3
- include/tvm/ffi/extra/dataclass.h+28
- include/tvm/ffi/extra/visit_error_context.h+255
- include/tvm/ffi/function.h+1-1
- include/tvm/ffi/reflection/registry.h+135-3
- python/tvm_ffi/_optional_torch_c_dlpack.py+14-14
- python/tvm_ffi/cpp/extension.py+10-1
- python/tvm_ffi/cython/base.pxi+7-1
- python/tvm_ffi/cython/error.pxi+17
- python/tvm_ffi/cython/object.pxi+5-3
- python/tvm_ffi/cython/tvm_ffi_python_helpers.h+45-20
- python/tvm_ffi/cython/type_info.pxi+8-2
- python/tvm_ffi/dataclasses/field.py+24-6
- python/tvm_ffi/dataclasses/py_class.py+58-24
- python/tvm_ffi/registry.py+1-1
- rust/tvm-ffi/src/macros.rs+19-3
- src/ffi/backtrace.cc+2
- src/ffi/error.cc+1
- src/ffi/extra/structural_equal.cc+70-47
- src/ffi/extra/structural_hash.cc+84-48
- src/ffi/extra/visit_error_context.cc+331
- src/ffi/function.cc+2-2
- tests/cpp/extra/test_dataclass.cc+193
- tests/cpp/extra/test_structural_equal_hash.cc+64
- tests/cpp/extra/test_visit_error_context.cc+652
- tests/cpp/test_reflection.cc+110
- tests/cpp/testing_object.h+76-1
- tests/python/test_dataclass_py_class.py+129-1
- tests/python/test_dlpack_exchange_api.py+22
- tests/python/test_optional_torch_c_dlpack.py+79-2
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
| 578 | + | |
578 | 579 | | |
579 | 580 | | |
580 | 581 | | |
| |||
616 | 617 | | |
617 | 618 | | |
618 | 619 | | |
619 | | - | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
620 | 623 | | |
621 | 624 | | |
622 | 625 | | |
| |||
822 | 825 | | |
823 | 826 | | |
824 | 827 | | |
825 | | - | |
| 828 | + | |
826 | 829 | | |
827 | 830 | | |
828 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
130 | 131 | | |
131 | | - | |
132 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | | - | |
135 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
136 | 141 | | |
137 | 142 | | |
138 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
701 | | - | |
| 701 | + | |
| 702 | + | |
702 | 703 | | |
703 | 704 | | |
704 | 705 | | |
| |||
823 | 824 | | |
824 | 825 | | |
825 | 826 | | |
826 | | - | |
827 | | - | |
| 827 | + | |
| 828 | + | |
828 | 829 | | |
829 | 830 | | |
830 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| |||
0 commit comments