Out-of-Tree Interpreter for executing MLIR code. Based on work originally published by @lchien
mkdir build && cd build
cmake -G Ninja -DLLVM_DIR=/opt/homebrew/opt/llvm@19/lib/cmake/llvm -DMLIR_DIR=/opt/homebrew/opt/llvm@19/lib/cmake/mlir -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCMAKE_BUILD_TYPE=RelWDebInfo ../ -DCMAKE_INSTALL_PREFIX=/opt/homebrew/opt/llvm@19If you plan on contributing to this repository, we suggest you run git config core.hooksPath .githooks after cloning the repository. This sets up the precommit hooks that automatically enforce coding standards.
We provide support for Polygeist, a C/C++ frontend that can emit MLIR source. This is optional for building mli, but is helpful if the user wants to work from C++ source files. Polygeist can be built by:
cd scripts
./polygeist.shNote that this involves a clone and build of the full LLVM project, which takes a significant amount of time. See the script for more details about setting the install prefix directory and the commit used for LLVM
brew install cmake ninja llvm@19
cmake -G Ninja -DLLVM_DIR=/opt/homebrew/opt/llvm@19/lib/cmake/llvm -DMLIR_DIR=/opt/homebrew/opt/llvm@19/lib/cmake/mlir -DCMAKE_EXPORT_COMPILE_COMMANDS=On ../mliexecutable takes in a.mlirfile and runs the interpreter on it.
Example: build/src/mli <path-to-mlir-file> --args=5,10