The GitHub Actions job "CI" on tvm-ffi.git/junrushao/2026-07-15/generate-layout-compatible-cpp-object-declarations has succeeded. Run started by GitHub user junrushao (triggered by junrushao).
Head commit for run: 02d4f312b9b5b2b8b10c35d61c948031de74d7a9 / Junru Shao <[email protected]> feat(abi): generate layout-compatible C++ object declarations Architecture: - Add a reflection-to-C++ pipeline that expands exact or globbed type keys through their dynamic object ancestry, lowers reflected fields to layout-compatible C++ carriers, and emits deterministic namespace-grouped declarations. - Emit lookup-only object views with compile-time size, alignment, and offset assertions so generated classes read existing registered objects without registering types, allocating objects, or changing the C ABI. - Add TVM_FFI_DECLARE_OBJECT_INFO_LOOKUP for cached runtime type-index lookup and make public tvm::ffi::is_object_subclass_v the explicit specialization point for forward-declared recursive ObjectPtr fields. - Have generated headers emit direct inline variable-template specializations after forward declarations, avoiding a dedicated declaration macro while keeping TypeTraits<ObjectPtr<T>> gated on the same trait. - Enrich Python reflection with field alignment, static type indices, total size, native-metadata availability, and schema subtype queries required to prove carrier and inheritance compatibility. - Match derived-field placement to Microsoft and Itanium-family tail-padding rules while preserving existing ObjectPtr and container ownership semantics. Public Interfaces: - Export tvm_ffi.dataclasses.gen_abi_cpp, accepting exact type keys, shell-style patterns, or sequences of selectors and returning a self-contained C++17 header. - Add TVM_FFI_DECLARE_OBJECT_INFO_LOOKUP to the public C++ headers for lookup-only generated object declarations. - Expose tvm::ffi::is_object_subclass_v as the public object-subclass query and specialization point for intentionally declared incomplete Object types. - Expose TypeSchema.is_subtype_of, TypeField.alignment, TypeField.field_static_type_index, and TypeInfo.total_size in the Python reflection surface. - Add the optional frozen parameter to c_class so C++-reflected fields can be presented as read-only Python dataclass fields. - This change is additive and does not alter the C ABI, registered object layout, or established ObjectPtr upcast behavior. UI/UX: - none Behavioral Changes: - Generate inheritance-preserving object declarations, including recursive and mutually recursive ObjectPtr container fields, escaped non-C++ identifiers, opaque dependencies, and deterministic namespace ordering. - Emit inline explicit is_object_subclass_v specializations for generated forward declarations; handwritten compile tests specialize only incomplete recursive types and let complete types use std::is_base_of. - Validate native raw schemas and reject aliases, ambiguous Optional or Union carriers, unsupported static objects, and types without fixed size metadata instead of emitting unsafe layouts. - Use erased ObjectPtr<Object> carriers for schema-less custom object fields and typed ObjectPtr carriers when reflection proves the concrete object type. - Place Python-defined subclass fields at ABI-correct tail-padding offsets on Windows and Itanium-family platforms. - Support reflection-based subtype checks and frozen presentation of reflected C++ fields while retaining an explicit descriptor-level mutation escape hatch. - Preserve backing-object identity across tested ObjectPtr container covariance and erased-value round trips. - Keep runtime-resolved generator test schemas collectable on Python 3.9 by spelling unions with typing.Optional and typing.Union. Docs: - Document c_class(..., frozen=True), read-only reflected fields, inheritance behavior, and the controlled descriptor set escape hatch in the dataclass reflection guide. - Document gen_abi_cpp selector and return semantics in the exported function docstring; no separate generator walkthrough is included. - Document the public is_object_subclass_v query and lookup-only object metadata macro inline in the C++ headers. Tests: - Executed: compiler probes with and without an incomplete-type specialization - Result: unspecialized std::is_base_of fails for the incomplete type as expected; explicit is_object_subclass_v specialization compiles. - Executed: C++ build and full CTest suite - Result: build passed; all 451 enabled tests passed and 2 remained disabled. - Executed: tests/python/test_dataclass_gen_abi_cpp.py under the normal development Python - Result: 14 passed. - Executed: tests/python/test_dataclass_gen_abi_cpp.py under isolated Python 3.9 - Result: 14 passed. - Executed: full Python unit suite before the review-driven specialization update - Result: 2393 passed, 18 skipped, 3 xfailed. - Executed: pre-commit on all files - Result: passed all hooks. - Executed: pinned clang-tidy 21.1.1 on tests/cpp/test_abi_object.cc, tests/cpp/test_object_ptr.cc, and tests/cpp/test_any.cc - Result: passed all three translation units. - Executed: git diff --check - Result: passed. Untested Edge Cases: - The complete Python suite was not rerun after the review-driven C++ specialization/output update; both development and Python 3.9 generator suites cover the changed generated text and compilation path. - Rust tests were not executed because cargo and rustup are unavailable locally; no Rust source or binding is modified. - Linux and Windows compiler matrices remain CI-only; local generated-header compilation and platform-conditional layout tests cover the code paths available on macOS. Refs: https://github.com/apache/tvm-ffi/pull/670 Report URL: https://github.com/apache/tvm-ffi/actions/runs/29471314050 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
