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

   This pull request introduces a new Rust crate, `tvm-ffi-stubgen`, to the 
workspace. The crate is a command-line tool for generating Rust stubs from 
`tvm-ffi` metadata. The implementation includes argument parsing, FFI helpers, 
metadata schema parsing, code generation logic, and the main entry point. The 
workspace is updated to include this new crate.
   
   **Relation with existing Python stubgen:**
   
   This Rust stubgen only supports a Rust equivalent to the ["`STUB_INIT` is 
on" mode](https://tvm.apache.org/ffi/packaging/stubgen.html#stub-init-is-on) in 
the existing Python stubgen, which yields a compilable Rust crate that wraps a 
TVM-FFI DLL.
   
   **Addition of the `tvm-ffi-stubgen` crate:**
   
   * Added `tvm-ffi-stubgen` to the workspace members in `Cargo.toml`, ensuring 
it is built as part of the Rust workspace.
   * Created `tvm-ffi-stubgen/Cargo.toml` with dependencies, package metadata, 
and bin target for the new stub generator.
   
   **Core implementation of the stub generator:**
   
   * Implemented command-line interface parsing in `cli.rs` using `clap`, 
supporting options for output directory, DLLs, prefix, and other configuration.
   * Developed FFI utilities in `ffi.rs` for loading DLLs, querying global 
function/type names, and extracting type information from the loaded libraries.
   * Defined internal data models for Rust type and function representations in 
`model.rs`, supporting code generation from metadata.
   * Added schema parsing in `schema.rs` to interpret type schemas from JSON 
metadata.
   * Provided the main library logic in `lib.rs`, orchestrating argument 
parsing, FFI calls, filtering, module construction, and writing generated files.
   * Implemented the binary entry point in `main.rs` to parse arguments and 
invoke the main logic.
   
   **Integration test:**
   
   It tests the functionality through loading, compiling and running a crate 
that invokes `add_one` from `libtvm_ffi_testing.so`. The testing is yet to be 
fully automated; it now relies on human to supply the correct paths.
   
   This PR is vibed with GPT-5.2-CodeX through Copilot and then reviewed by 
human.


-- 
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