Skip to content

Commit

Permalink
Build llvm with clang since gcc on ppc64le doesn't support __builtin_…
Browse files Browse the repository at this point in the history
…thread_pointer (#2379)

* Build llvm with clang since gcc on ppc64le doesn't support __builtin_thread_pointer
* Install clang for ubi8
* Compile onnx-mlir with clang
* Don't remove diffutils and make on ubi8 since clang depends on them

Signed-off-by: Gong Su <[email protected]>
  • Loading branch information
gongsu832 authored Jul 19, 2023
1 parent 0d3c533 commit 63f7e41
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions docker/Dockerfile.llvm-project
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ RUN distro=$(cat /etc/os-release|grep -Po '(?<=^ID=").*(?=")|(?<=^ID=)[^"].*[^"]
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
apt-get install -qq -y --no-install-recommends \
autoconf automake ca-certificates cmake cppcheck curl \
default-jdk-headless gcc g++ git libncurses-dev \
autoconf automake ca-certificates clang cmake cppcheck \
curl default-jdk-headless gcc g++ git libncurses-dev \
libtool make maven ninja-build openjdk-11-jdk-headless \
python3 python3-dev python3-distutils python3-numpy \
python3-pip python3-pytest-xdist python3-setuptools \
Expand All @@ -44,7 +44,7 @@ RUN distro=$(cat /etc/os-release|grep -Po '(?<=^ID=").*(?=")|(?<=^ID=)[^"].*[^"]
https://dl.fedoraproject.org/pub/epel/epel-release-latest-${RHEL_VERSION}.noarch.rpm && \
yum update -q -y && \
yum install -q -y \
autoconf automake ca-certificates cmake diffutils \
autoconf automake ca-certificates clang cmake diffutils \
file java-11-openjdk-devel java-11-openjdk-headless \
gcc gcc-c++ git libtool make ncurses-devel \
python39 python39-devel python39-numpy python39-pip \
Expand Down Expand Up @@ -84,7 +84,9 @@ RUN git clone -n https://github.com/llvm/llvm-project.git \
&& cd llvm-project \
&& git checkout ${LLVM_PROJECT_SHA1} \
&& mkdir -p build && cd build \
&& cmake -G Ninja ../llvm \
# Build with clang since gcc on ppc64le doesn't support __builtin_thread_pointer
&& CC=clang CXX=clang++ \
cmake -G Ninja ../llvm \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_TARGETS_TO_BUILD="host" \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
7 changes: 4 additions & 3 deletions docker/Dockerfile.onnx-mlir
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ RUN LLVM_PROJECT_ROOT=${WORK_DIR}/llvm-project \
&& rm -rf build && mkdir -p build && cd build \
# NNPA acclerator is built on all archs to enable lit tests
# (dependent libzdnn is built on s390x only)
&& cmake -DMLIR_DIR=${LLVM_PROJECT_ROOT}/build/lib/cmake/mlir \
&& CC=clang CXX=clang++ \
cmake -DMLIR_DIR=${LLVM_PROJECT_ROOT}/build/lib/cmake/mlir \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_MESSAGE=NEVER \
-DONNX_MLIR_ACCELERATORS=${ACCEL} .. \
Expand Down Expand Up @@ -79,8 +80,8 @@ RUN LLVM_PROJECT_ROOT=${WORK_DIR}/llvm-project \
pip3 uninstall -q -y Cython pybind11 pytest pytest-forked \
pytest-xdist typing-extensions && \
yum remove -q -y \
adwaita-icon-theme autoconf automake cmake diffutils file \
git libtool make python39 && \
adwaita-icon-theme autoconf automake cmake file \
git libtool python39 && \
rm -rf /var/cache/dnf/* /usr/local/bin/ninja; \
fi \
&& rm -rf /tmp/* /usr/bin/python \
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile.onnx-mlir-dev
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ RUN LLVM_PROJECT_ROOT=${WORK_DIR}/llvm-project \
&& rm -rf build && mkdir -p build && cd build \
# NNPA acclerator is built on all archs to enable lit tests
# (dependent libzdnn is built on s390x only)
&& cmake -DMLIR_DIR=${LLVM_PROJECT_ROOT}/build/lib/cmake/mlir \
&& CC=clang CXX=clang++ \
cmake -DMLIR_DIR=${LLVM_PROJECT_ROOT}/build/lib/cmake/mlir \
-DCMAKE_BUILD_TYPE=Debug \
-DONNX_MLIR_TEST_OPTLEVEL=0 \
-DONNX_MLIR_ACCELERATORS=${ACCEL} .. \
Expand Down

0 comments on commit 63f7e41

Please sign in to comment.