Experiments with the TOSA (Tensor Operator Set Architecture) Dialect of LLVM MLIR, including a C library for FFI integration.
- C++ Example (mlir_tosamain.cpp): Direct C++ example creating MLIR TOSA operations
- C Library (
libmlir_tosa_c.so): C wrapper exposing MLIR TOSA functionality through a pure C API - C Example (mlir_tosaexample_c_client.c): Demonstrates using the C library
The C library enables integration with languages that have C FFI support (Java, Python, Rust, etc.) without requiring C++ bindings. The header file (mlir_tosa_c_api.h) can be used with binding generators like JNA, jextract, or ctypes.
# 0. Go to library directory
cd mlir-tosa
# 1. Configure (auto-detects LLVM/MLIR)
./configure.sh
# 2. Build
cmake --build build
# 3. Compile TOSA to native code
./compile_to_native_optimized.sh
# 4. Test
./test_native_lib