DISCLAIMER: This project is not intended for everyday use and made available without any support. However, we welcome any kind of feedback via the issue tracker or if appropriate via IREE's communication channels, e.g. via the Discord server.
The IREE C++ template demonstrates how to integrate IREE into a third-party project with CMake.
IREE runtime support is demonstrated via the simple_embedding
sample forked from IREE, where the original source can be found here.
The custom_modules
sample further demonstrates the out-of-tree usage of a custom dialect alongside with the runtime. The original custom_modules
source can be found here.
The template is developed by Marius Brehler at Fraunhofer IML.
Since this template demonstrates how to use IREE compontens out-of-tree, the prerequisites match those of IREE, documented in the Getting started guide. Make sure you have CMake >= 3.16.3 and clang installed.
git clone https://github.com/iml130/iree-template-cpp.git
cd iree-template-cpp
git submodule update --init
cd third_party/iree
git submodule update --init
cd ../../
Note:
The submodules used within IREE themself include submodules, so that we advice to avoid an recursive update.
Note:
It may happen that new submodules are added to IREE.
Thus it might not be sufficient to only pull the latest master and you may need update the submodules manually.
# export LDFLAGS=-fuse-ld=$(which ld.lld)
mkdir build
cd build
cmake -GNinja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ .. \
# -DLLVM_ENABLE_LLD=ON
ninja
Note:
Uncomment the lines above to enable linking via ldd.
Explore the samples simple_embedding
and custom_modules
within the build directory:
simple_embedding
simple_embedding_test
: Test executable.
custom_modules
extern_custom_modules_test
: Test executable.
custom_modules/dialect
custom-opt
: See the related documentation for iree-opt documentation.custom-translate
: See the related documentation for iree-translate documentation.
Of course it's also worth to explore the corresponding CMake configuration.