Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only download llvm when necessary #9

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,34 @@ 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

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
Expand Down