diff --git a/install.sh b/install.sh index 8de2b8e24..1f81a9f06 100755 --- a/install.sh +++ b/install.sh @@ -11,15 +11,6 @@ echo $PYBUDA_ROOT cd $PYBUDA_ROOT export TVM_HOME=$PYBUDA_ROOT/third_party/tvm -# Download / untar LLVM -cd $PYBUDA_ROOT/third_party -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 - cd $TVM_HOME git submodule init; git submodule update @@ -27,8 +18,27 @@ mkdir -p build cp $TVM_HOME/cmake/config.cmake $TVM_HOME/build cd $TVM_HOME/build -# Link the LLVM thats just been downloaded -LLVM_LINK=$PYBUDA_ROOT/third_party/llvm/bin/llvm-config + +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