Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake flag for enabling tests #21

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/mlbridge_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ cmake \
-DCMAKE_BUILD_TYPE="$BUILD" \
-DCMAKE_INSTALL_PREFIX=$REPO_DIR/install \
-DPROTOS_DIRECTORY=$REPO_DIR/test/protos \
-DPYTHON_UTILITIES_DIRECTORY=$REPO_DIR/test
-DPYTHON_UTILITIES_DIRECTORY=$REPO_DIR/test \
-DMLBRIDGE_ENABLE_TEST=ON

make -j -C $REPO_DIR/build_${BUILD,,} install
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ endif()

add_subdirectory(MLModelRunner)
add_subdirectory(SerDes)
add_subdirectory(test)
if(MLBRIDGE_ENABLE_TEST)
add_subdirectory(test)
endif()

if(LLVM_MLBRIDGE)
include(AddLLVM)
Expand Down Expand Up @@ -78,12 +80,12 @@ else()
set_property(TARGET MLCompilerBridgeC PROPERTY POSITION_INDEPENDENT_CODE 1)
set_target_properties(MLCompilerBridgeC PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
install(TARGETS MLCompilerBridgeC DESTINATION lib)

add_executable(MLCompilerBridgeTest $<TARGET_OBJECTS:MLBridgeCPPTest>)
target_link_libraries(MLCompilerBridgeTest PUBLIC MLCompilerBridge)
set_target_properties(MLCompilerBridgeTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
install(TARGETS MLCompilerBridgeTest DESTINATION bin)

if(MLBRIDGE_ENABLE_TEST)
add_executable(MLCompilerBridgeTest $<TARGET_OBJECTS:MLBridgeCPPTest>)
target_link_libraries(MLCompilerBridgeTest PUBLIC MLCompilerBridge)
set_target_properties(MLCompilerBridgeTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
install(TARGETS MLCompilerBridgeTest DESTINATION bin)
endif()
endif(LLVM_MLBRIDGE)

install(DIRECTORY include/ DESTINATION include)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ Please see [here](https://iith-compilers.github.io/ML-Compiler-Bridge/) for docu
## Setup
`ML-Compiler-Bridge` can be built as a stand-alone library to generate `.a` files that can in turn be linked with any compiler.
1. `mkdir build && cd build`
2. `cmake [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_INSTALL_PREFIX=<Install_path>] -DONNXRUNTIME_ROOTDIR=<Path to ONNX install dir> -DPROTOS_DIRECTORY=<Path to protobuf files> -DTENSORFLOW_AOT_PATH=<Path to TensorFlow pip install dir> ../`
2. `cmake [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_INSTALL_PREFIX=<Install_path>] [-DMLBRIDGE_ENABLE_TEST=ON|OFF] -DONNXRUNTIME_ROOTDIR=<Path to ONNX install dir> -DPROTOS_DIRECTORY=<Path to protobuf files> -DTENSORFLOW_AOT_PATH=<Path to TensorFlow pip install dir> ../`
3. `make -j [&& make install]`

This process would generate `libMLCompilerBridge.a` and `libMLCompilerBridgeC.a` libraries under `build/lib` directory, required headers under `build/include` directory. `libMLCompilerBridgeC.a` exposes C APIs for using with C-based compilers like Pluto, where as `libMLCompilerBridge.a` exposes C++ APIs that can be used with any compiler written in C++.

Python end points are available under [`CompilerInterface`](./CompilerInterface/).

To ensure the correctness, run `make verify-all`
To ensure the correctness, run `make verify-all`. This would need enabling tests in cmake (`-DMLBRIDGE_ENABLE_TEST=ON`) and `PROTOS_DIRECTORY` should point to `test/protos`.

### Using ML-Compiler-Bridge with LLVM and MLIR

Expand Down
Loading