The GitHub Actions job "CI" on tvm-ffi.git/junrushao/2026-03-18/cython-type-converter has failed. Run started by GitHub user junrushao (triggered by junrushao).
Head commit for run: 5c14870cf8b74efdb44d6f55589752062bbdd06d / Junru Shao <[email protected]> feat(cython): add TypeSchema type conversion with function-pointer dispatch (#504) Add a Cython-native type conversion engine that validates and coerces Python values according to TypeSchema descriptors, mirroring the C++ TryCastFromAnyView rules. The system compiles each TypeSchema into a _TypeConverter with a C function pointer, enabling single-indirect-call dispatch with zero Python attribute lookup overhead. Architecture: - CAny (object.pxi): Owned TVMFFIAny value wrapper with ref-counted lifecycle and SmallStr/SmallBytes promotion. - _to_py_class_value() (object.pxi): Standalone cpdef function that converts CAny -> Python object. Extracted from the former CAny.to_py() method to allow direct C-level dispatch from other .pxi files without virtual-method overhead. - _TypeConverter (pyclass_type_converter.pxi): cdef class with C function pointer dispatch (ctypedef CAny (*_dispatch_fn_t)(...) except *). 20+ leaf/composite converters for POD, Object, Optional, Union, Array, List, Map, Dict, tuple, Callable, Any. Supports __ffi_convert__ type attribute delegation, iterative __tvm_ffi_value__ protocol with depth limit (64), copy-on-first- change container fast path, and _ConvertError exception signaling. - TypeSchema enhancements (type_info.pxi): origin_type_index field, from_annotation() for Python type hints (int, list[int], Optional[str], Union, Callable, CObject subclasses), from_type_index(), to_json(), check_value(), convert(). Adds STL type converters and bidirectional origin<->type_index maps. Small string/bytes optimization: - _tc_convert_str and _tc_convert_bytes now pass raw Python str/bytes directly to CAny() instead of wrapping in String()/Bytes() first. This lets the C packer use SmallStr/SmallBytes for short values, avoiding a heap allocation and object creation for the common case. Public Interfaces: - TypeSchema.convert(value) -> CAny: coerce value per schema - TypeSchema.check_value(value) -> None: validate without coercion - TypeSchema.from_annotation(annotation): Python typing -> TypeSchema - TypeSchema.from_type_index(idx, args): type_index -> TypeSchema - TypeSchema.to_json(): JSON round-trip of type descriptors - CAny, _to_py_class_value exported from tvm_ffi.__init__ Behavioral Changes: - TypeSchema.args is now tuple[...] | None (None for bare tuples) - TypeInfo.fields is now Optional[list[TypeField]] - TypeSchema.__post_init__ raises ValueError (not AssertionError) - _lookup_type_attr copies AnyView to owned Any (use-after-free fix) - TypeField gains optional .ty: TypeSchema attribute Tests: - tests/python/test_type_converter.py: 4540+ lines, 60+ test classes covering POD exact match, implicit conversions, object hierarchy, Optional/Union/nested containers, all marshal protocols (__tvm_ffi_value__, __tvm_ffi_object__, ObjectConvertible, __tvm_ffi_int/float__, __dlpack_device__, __cuda_stream__), cycle detection, __ffi_convert__ dispatch, CAny operations, from_annotation for all Python type annotations, zero-copy paths, cross-type Array<->List / Map<->Dict, error message quality, int64 boundary validation, schema arity checks, and dtype parsing. All tests use _to_py_class_value() for CAny -> Python conversion. Report URL: https://github.com/apache/tvm-ffi/actions/runs/23327816760 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
