forked from tenstorrent/tt-tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·64 lines (53 loc) · 2.04 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -e # exit if a command fails
if [ -n "$CI_PROJECT_DIR" ]; then
if [ -z $PYBUDA_ROOT ]; then export PYBUDA_ROOT=$CI_PROJECT_DIR; fi
else
if [ -z $PYBUDA_ROOT ]; then export PYBUDA_ROOT=`git rev-parse --show-toplevel`; fi
fi
echo $PYBUDA_ROOT
cd $PYBUDA_ROOT
export TVM_HOME=$PYBUDA_ROOT/third_party/tvm
cd $TVM_HOME
git submodule init; git submodule update
mkdir -p build
cp $TVM_HOME/cmake/config.cmake $TVM_HOME/build
cd $TVM_HOME/build
if [[ -n $LLVM_CONFIG_CMD && -e $LLVM_CONFIG_CMD ]]; then
# pass in through environment variable
echo Using "$LLVM_CONFIG_CMD" as LLVM_LINK
LLVM_LINK="$LLVM_CONFIG_CMD"
elif [[ -e /usr/bin/llvm-config-14 ]]; then
# should be present; llvm-14 is included in our ubuntu 22.04 images
echo Using /usr/bin/llvm-config-14 as LLVM_LINK
LLVM_LINK=/usr/bin/llvm-config-14
else
# Download / untar LLVM
echo Downloading llvm
if [ ! -d "$PYBUDA_ROOT/third_party/llvm" ]; then
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz
LLVM_TAR=$PYBUDA_ROOT/third_party/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz
LLVM_DIR=$PYBUDA_ROOT/third_party/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04
tar -xf $LLVM_TAR && mv $LLVM_DIR $PYBUDA_ROOT/third_party/llvm && rm -f $LLVM_TAR
fi
# Link the LLVM thats just been downloaded
LLVM_LINK=$PYBUDA_ROOT/third_party/llvm/bin/llvm-config
fi
sed -i "s#/usr/bin/llvm-config#$LLVM_LINK#g" $TVM_HOME/build/config.cmake
if [[ "$TVM_BUILD_CONFIG" == "debug" ]]; then
export TVM_BUILD_CONFIG="Debug"
else
export TVM_BUILD_CONFIG="Release"
fi
echo $TVM_BUILD_CONFIG
cmake -DCMAKE_BUILD_TYPE=$TVM_BUILD_CONFIG $TVM_HOME
make -j$(nproc)
echo "TVM Built Successful"
cd $PYBUDA_ROOT
pip install -e third_party/tvm/python
for dir in cutlass cutlass_fpA_intB_gemm/cutlass libflash_attn/cutlass; do
pushd $TVM_HOME/3rdparty/$dir
git restore docs media
popd
done
echo "Files removed during tvm build have been restored."