(Experimental) Rust support for the tvm-ffi ABI. Currently, the rust support is in an experimental stage. This workspace contains three crates:
tvm-ffi: Safe, ergonomic Rust bindings over the ABI.tvm-ffi-sys: Low-level exposure of raw C ABIs.tvm-ffi-macros: Procedural macros used by tvm-ffi (derive/object helpers and exported function helpers).The overall project focuses on low-level, direct access to the ABI when possible for maximum efficiency while maintaining interoperability.
The Rust support depends on libtvm_ffi. Please install the tvm-ffi pip package by running:
pip install -v ..
Confirm that tvm-ffi-config is available with:
tvm-ffi-config --libdir
Then build the workspace with:
cargo build
The build will:
tvm-ffi-config --libdir to add the appropriate link search path.tvm_ffi.cargo run and cargo test.For running downstream applications, you need to set the LD_LIBRARY_PATH so libtvm_ffi is available in the path.
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`tvm-ffi-config --libdir`
You can run an optional library-loading example similar to the quick_start examples in examples/quick_start.
cargo run --example load_library --features example
Check out the load_library.rs for details.