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 GitBox <gi...@apache.org> on 2026/04/17 19:03:47 UTC

[GH] (tvm-ffi/junrushao/2026-04-17/ffi-compat): Workflow run "CI" is working again!

The GitHub Actions job "CI" on tvm-ffi.git/junrushao/2026-04-17/ffi-compat has succeeded.
Run started by GitHub user junrushao (triggered by junrushao).

Head commit for run:
ce6ec725f857797cbe7a0d9dc3ce96e767177d0e / Junru Shao <ju...@nvidia.com>
feat(dataclass,core): plumb C++ field traits through reflection and add CObject id_/is_ aliases

Architecture:
- Reflection bridge now completes the round-trip between the C++
  TVMFFIFieldInfo struct and the Python @c_class dataclass facade.
  TypeField (Cython-side dataclass) grew six new attributes
  (c_default, c_default_factory, c_repr, c_compare, c_hash,
  c_structural_eq) mirroring the flag bits and
  default_value_or_factory union; _attach_field_objects synthesizes
  a user-facing Field per reflected field and stashes it on
  TypeField.dataclass_field so dataclasses.fields() exposes
  everything a @py_class-authored field would carry.
- No boundary changes on the CObject side: id_ / is_ are thin
  aliases on the Cython base class; all subclasses (Object, Tensor,
  Function, etc.) pick them up via inheritance.

Public Interfaces:
- tvm_ffi.dataclasses.Field objects returned by fields() on
  @c_class-registered types now report default, default_factory,
  repr, compare, hash, structural_eq sourced from the C++
  reflection registry (previously always MISSING / defaults).
- tvm_ffi.core.TypeField (formerly internal) stub in core.pyi grew
  six new attributes matching the above.
- New CObject.id_ property (int) and CObject.is_(other) -> bool.
  No removals; no signature changes.
- No ABI change; no C++ header change.

UI/UX: none

Behavioral Changes:
- @c_class fields now surface their C++-declared defaults,
  repr/compare/hash opt-outs, and SEqHash ignore/def marks through
  the public fields() API. Callers that previously relied on these
  attributes being MISSING / all-True would see real values.
- id_ returns the raw handle address (identical to __chandle__()).
  is_ tests handle identity (identical to same_as()). No change to
  __chandle__ / same_as semantics.

Docs: Inline docstrings updated on CObject.id_ and CObject.is_.
No separate docs files required. core.pyi stubs mirror the new
surface.

Tests:
- Executed: uv run pytest tests/python -> 2148 passed, 38 skipped,
  3 xfailed.
- Executed: pre-commit run --all-files -> all 27 hooks passed.
- New coverage: test_c_class_field_defaults_missing_when_unspecified,
  test_c_class_field_default_value_from_cxx,
  test_c_class_field_default_respects_init_false,
  test_c_class_field_default_respects_kw_only,
  test_c_class_field_repr_flag_from_cxx,
  test_c_class_field_compare_flag_from_cxx,
  test_c_class_field_hash_flag_from_cxx,
  test_c_class_field_structural_eq_default_none (all in
  tests/python/test_dataclass_c_class.py),
  test_c_class_default_value_from_cxx (in
  tests/python/test_dataclass_common.py), and test_id_and_is (in
  tests/python/test_object.py).

Untested Edge Cases:
- structural_eq == "def" / "ignore" states: no C++ fixture
  currently sets SEqHashDef or SEqHashIgnore on a visible field;
  only the default pass-through (None) is covered. Adding a
  fixture is a follow-up.
- Pickling round-trip of synthesized Field objects (they originate
  from reflection, not user source).
- is_ / same_as against PyNativeObject proxies (String, Bytes):
  existing limitation of same_as preserved unchanged.

Report URL: https://github.com/apache/tvm-ffi/actions/runs/24581548871

With regards,
GitHub Actions via GitBox


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