This is an automated email from the ASF dual-hosted git repository. tqchen pushed a commit to branch fix-tvm-ffi-bump-relax-slots in repository https://gitbox.apache.org/repos/asf/tvm.git
commit f3a8c901c889b52e18020d1e44a3d4501fdd2632 Author: tqchen <[email protected]> AuthorDate: Fri Jul 17 10:29:30 2026 +0000 [IR] Register Type before reflected Expr wrappers --- python/tvm/ir/__init__.py | 4 +++- tests/python/ir/test_ir_type.py | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/python/tvm/ir/__init__.py b/python/tvm/ir/__init__.py index ff05d229f5..eec6a5a7a8 100644 --- a/python/tvm/ir/__init__.py +++ b/python/tvm/ir/__init__.py @@ -30,11 +30,13 @@ from .base import ( load_json, save_json, ) +# Register Type before Expr. Expr's reflected ``ty`` field otherwise creates +# an auto-generated Type wrapper before the concrete Python class is available. +from .type import FuncType, PointerType, PrimType, TupleType, Type from .expr import Call, Expr, GlobalVar, Range, Var, is_prim_expr, is_prim_var from .function import BaseFunc, CallingConv from .global_info import GlobalInfo, DummyGlobalInfo, VDevice from .module import IRModule from .op import Op, register_intrin_lowering, register_op_attr -from .type import FuncType, PointerType, PrimType, TupleType, Type from tvm_ffi import Array, Map diff --git a/tests/python/ir/test_ir_type.py b/tests/python/ir/test_ir_type.py index e24ed5d78e..bda4e5e04e 100644 --- a/tests/python/ir/test_ir_type.py +++ b/tests/python/ir/test_ir_type.py @@ -29,6 +29,13 @@ def check_json_roundtrip(node): tvm.ir.assert_structural_equal(back, node, map_free_vars=True) +def test_missing_type(): + missing = tvm.ir.Type.missing() + + assert isinstance(missing, tvm.ir.Type) + assert missing.is_missing() + + def test_prim_type(): x = tvm.ir.PrimType("int32") assert isinstance(x, tvm.ir.PrimType)
