Skip to content

pnnl/soda-opt

Repository files navigation

Build and Test License

SODA-OPT - Enabling System Level Design in MLIR

This project aims to create soda-opt, a tool that leverages mlir to extract, optimize, and translate high-level code snippets into LLVM IR, so that they can be synthesized by our high-level synthesis tool of choice.

As a long term vision, the SODA-OPT project seeks to provide a set of compiler libraries to perform the target optimizations; runtime libraries to offload the compute from host to the selected targets; and to be standalone, being built on top of standard mlir tools and dialects, so that any project (e.i. TF, ONNX, etc) could use the exposed optimization passes to offload and perform HLS of selected code snippets. As a final goal, soda-opt could later be merged into the main llvm-project codebase.

Getting started

Pull our production image on dockerhub:

And follow one of our tutorials here.

How to build?

This setup assumes that you have built LLVM and MLIR in $BUILD_DIR and installed it to $PREFIX. The current version of this project was tested with llvm-project commit: 339a7687e1c036a5f91c9d5391523b93e2e76cd3. Make sure you have the correct commit checked-out.

Note: Make sure to pass -DLLVM_INSTALL_UTILS=ON when building LLVM/MLIR with CMake so that it installs FileCheck.

To build soda-opt and run the tests of this project, execute:

mkdir build && cd build
cmake -G Ninja .. \
    -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit \
    -DMLIR_DIR=$PREFIX/lib/cmake/mlir

# Run tests
cmake --build . --target check-soda

Building LLVM/MLIR with Helper Script

LLVM can be built with the helper build_tools/build_llvm.sh.

# To configure, build, and install
./build_llvm.sh <path/to/llvm/src> <llvm_build_dir> <llvm_install_dir>

Building soda-opt with Helper Script

Alternatively it is possible to use the helper script build_tools/build_soda.sh to build this project:

# To configure, build, and install
./build_tools/build_soda.sh <source_dir> <install_dir> <build_dir> <path/to/llvm/build/dir> <path/to/llvm/install/dir>

How to generate the docs?

To build the documentation from the TableGen description of the dialect operations, run:

cmake --build . --target mlir-doc

How to use this project?