Build and Install TVM🔗
Official instructions for building and installing TVM can be found here.
In the sections below we provide a short version that can be used to build and install TVM C/C++ API files for use with vAccel.
Install dependencies🔗
Install the required dependencies:
sudo apt update && sudo apt install -y cmake git python3 python3-pip \
libtinfo-dev zlib1g-dev libedit-dev
# Optional, for CUDA builds
sudo apt install libllvm15 and libllvm15-dev
Build TVM C/C++ API files🔗
Clone the repo, adjusting TVM_VERSION
to the desired version:
TVM_VERSION="v0.19.0"
git clone https://github.com/apache/tvm --depth 1 --recursive \
-b "${TVM_VERSION}"
cd tvm
Build source code and install:
# Replace this with the desired installation directory
cd /opt
# Configure build
cmake -S . -B build
cp cmake/config.cmake build/
echo >> build/config.cmake
echo "set(CMAKE_BUILD_TYPE RelWithDebInfo)" >> build/config.cmake
echo "set(USE_LLVM \"llvm-config --ignore-libllvm --link-static\")" \
>> build/config.cmake
echo "set(HIDE_PRIVATE_SYMBOLS ON)" >> build/config.cmake
# Optionally, enable CUDA
echo "set(USE_CUDA ON)" >> build/config.cmake
# Build C/C++ files
cmake --build build --parallel "$(nproc)"
# Install python files
export TVM_LIBRARY_PATH=/opt/tvm/build
pip install -e /opt/tvm/python
For convenience, the TVM library path can be added to system paths: