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/02/14 23:26:16 UTC
[GH] (tvm-ffi/2026-02-14/add-default-factory): Workflow run "CI" is working again!
The GitHub Actions job "CI" on tvm-ffi.git/2026-02-14/add-default-factory has succeeded.
Run started by GitHub user junrushao (triggered by junrushao).
Head commit for run:
7c96df8f8769444012ae2bc2ba24c44f2766aa6b / Junru Shao <ju...@nvidia.com>
feat: add `DefaultFactory` support to field reflection
`DefaultValue` stores a single static default shared across all
instances created via reflection. For mutable defaults (Array, Map,
etc.) this causes aliasing: every object receives the same underlying
container. `DefaultFactory` fixes this by storing a callable
`() -> Any` that is invoked each time a default is needed, producing a
fresh value per instance—mirroring Python dataclass `default_factory`.
Concrete changes:
- Rename `TVMFFIFieldInfo::default_value` → `default_value_or_factory`
to reflect that the slot now holds either a value or a factory.
- Add `kTVMFFIFieldFlagBitMaskDefaultIsFactory` (1 << 5) to
`TVMFFIFieldFlagBitMask`.
- Add `reflection::DefaultFactory` trait (registry.h), symmetric to
`DefaultValue`.
- Add `reflection::SetFieldToDefault` helper (accessor.h) that
resolves the default—calling the factory when the flag is set—so the
three consumption sites (creator.h, reflection_extra.cc,
serialization.cc) share one implementation.
- Propagate the rename through Rust (`c_api.rs`) and Cython
(`base.pxi`) bindings.
- Add `TestObjWithFactory` + three tests exercising flag inspection,
per-instance freshness, and explicit-value bypass.
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
Report URL: https://github.com/apache/tvm-ffi/actions/runs/22025931466
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