junrushao opened a new pull request, #455:
URL: https://github.com/apache/tvm-ffi/pull/455

   ## Summary
   
   - Add `TypeSchema` struct: runtime data class describing FFI types via 
recursive `{origin, args}` structure, with `FromJSON`/`FromJSONStr` parsing and 
`Repr()` for human-readable output
   - Add `TypeChecker` class: pre-compiled type converter built from a 
`TypeSchema` that resolves origin strings to an efficient `Kind` enum and 
pre-resolves Object type indices at construction time
   - Supports all FFI types: POD (int/float/bool/None), String, Bytes, 
DataType, Device, Object hierarchy, Optional, Array, List, Map, Variant, Tuple, 
and Callable
   - Container conversion uses fast-path (zero-copy when elements already 
match) and slow-path (element-by-element conversion), following the same 
pattern as compile-time `TypeTraits`
   - Handles small string/bytes optimization transparently in Object type checks
   
   ## Files
   
   - `include/tvm/ffi/extra/type_checker.h` — Header
   - `src/ffi/extra/type_checker.cc` — Implementation
   - `tests/cpp/extra/test_type_checker.cc` — 40 test cases
   - `CMakeLists.txt` — Build integration
   
   ## Test plan
   
   - [x] All 319 existing tests pass
   - [x] 40 new TypeChecker/TypeSchema tests pass covering: POD types, String, 
Optional, Array (strict/fast-path/conversion/fail/untyped), Map, Variant, 
Object hierarchy, Callable, Tuple, nested types, Cast throwing, Any, List, 
Array<->List conversion
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to