Skip to content

Commit

Permalink
Install upstream LLVM, use generic toolchain/runtime and change commi…
Browse files Browse the repository at this point in the history
…ts and shas
  • Loading branch information
JosseVanDelm committed Dec 21, 2023
1 parent 118075f commit e335786
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions container/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Courtesy of Federico Ficarelli
FROM rgantonio/snax-chisel-test:latest@sha256:f3d6207ab764a081866886e18f5249891f861061bdf6106d2cf23b6a0342bf96 as deps
FROM ghcr.io/kuleuven-micas/snax:latest as deps

RUN git clone https://github.com/kuleuven-micas/snitch_cluster.git /src \
&& cd /src \
&& git reset --hard a276279a6d2d9ca3fa92df050f04bbb21c1b3773 \
&& git reset --hard d87720fdf66b15325b37391494b990ac606503ab \
&& git submodule update --init

# clang+llvm+lld
RUN mkdir -p /opt/snitch-llvm \
&& wget -qO- https://github.com/pulp-platform/llvm-project/releases/download/0.12.0/riscv32-pulp-llvm-ubuntu1804-0.12.0.tar.gz | \
tar xz --strip-components=1 -C /opt/snitch-llvm
# python 3.11
RUN apt update -y \
# mlir and clang
RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && ./llvm.sh 17 && rm llvm.sh \
&& apt-get -y install mlir-17-tools
# python 3.11
RUN apt update -y \
&& apt install -y \
build-essential \
zlib1g-dev \
Expand All @@ -36,7 +35,11 @@ RUN mkdir -p /opt/snitch-llvm \

FROM deps as snax-mac
# verilator model
RUN cd /src && make CFG_OVERRIDE=cfg/snax-mac.hjson -C target/snitch_cluster bin/snitch_cluster.vlt -j$(nproc)
RUN cd /src && \
make -C target/snitch_cluster bin/snitch_cluster.vlt -j$(nproc) \
CFG_OVERRIDE=cfg/snax-mac.hjson \
SELECT_TOOLCHAIN=llvm-generic \
SELECT_RUNTIME=rtl-generic
# spike-dasm
RUN cd /src/target/snitch_cluster/work-vlt/riscv-isa-sim \
&& ./configure --prefix=/opt/snitch-spike \
Expand All @@ -47,14 +50,17 @@ RUN cd /src/target/snitch_cluster \

FROM deps as snax-gemm
# verilator model
RUN cd /src && make CFG_OVERRIDE=cfg/snax-gemm.hjson -C target/snitch_cluster bin/snitch_cluster.vlt -j$(nproc)
RUN cd /src && \
make -C target/snitch_cluster bin/snitch_cluster.vlt -j$(nproc) \
CFG_OVERRIDE=cfg/snax-gemm.hjson \
SELECT_TOOLCHAIN=llvm-generic \
SELECT_RUNTIME=rtl-generic
# snitch runtime
RUN cd /src/target/snitch_cluster \
&& make DEBUG=ON sw -j$(nproc)

FROM ubuntu:18.04 as toolchain
# shared dependencies
COPY --from=deps /opt/snitch-llvm /opt/snitch-llvm
COPY --from=deps /opt/python3.11 /opt/python3.11
COPY --from=deps /src/util/trace /opt/snitch_cluster/util/trace
COPY --from=snax-mac /opt/snitch-spike /opt/snitch-spike
Expand All @@ -64,6 +70,7 @@ COPY --from=snax-mac /src/target/snitch_cluster/bin/snitch_cluster.vlt /opt/snax
# Compile and link time dependencies
COPY --from=snax-mac /src/sw/snRuntime /opt/snax-mac/sw/snRuntime
COPY --from=snax-mac /src/target/snitch_cluster/sw/runtime/rtl /opt/snax-mac/target/snitch_cluster/sw/runtime/rtl
COPY --from=snax-mac /src/target/snitch_cluster/sw/runtime/rtl-generic /opt/snax-mac/target/snitch_cluster/sw/runtime/rtl-generic
COPY --from=snax-mac /src/target/snitch_cluster/sw/runtime/common /opt/snax-mac/target/snitch_cluster/sw/runtime/common
COPY --from=snax-mac /src/target/snitch_cluster/sw/snax/ /opt/snax-mac/target/snitch_cluster/sw/snax
COPY --from=snax-mac /src/sw/math/ /opt/snax-mac/sw/math/
Expand All @@ -76,6 +83,7 @@ COPY --from=snax-gemm /src/target/snitch_cluster/bin/snitch_cluster.vlt /opt/sna
# Compile and link time dependencies
COPY --from=snax-gemm /src/sw/snRuntime /opt/snax-gemm/sw/snRuntime
COPY --from=snax-gemm /src/target/snitch_cluster/sw/runtime/rtl /opt/snax-gemm/target/snitch_cluster/sw/runtime/rtl
COPY --from=snax-gemm /src/target/snitch_cluster/sw/runtime/rtl-generic /opt/snax-gemm/target/snitch_cluster/sw/runtime/rtl-generic
COPY --from=snax-gemm /src/target/snitch_cluster/sw/runtime/common /opt/snax-gemm/target/snitch_cluster/sw/runtime/common
COPY --from=snax-gemm /src/target/snitch_cluster/sw/snax/ /opt/snax-gemm/target/snitch_cluster/sw/snax
COPY --from=snax-gemm /src/sw/math/ /opt/snax-gemm/sw/math/
Expand All @@ -98,24 +106,7 @@ RUN apt-get -y update \
libsqlite3-0 \
bzip2 \
# make pip able to install via git
&& apt-get -y install git \
# mlir
&& apt-get -y install wget lsb-release software-properties-common gnupg \
&& wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
&& echo "\
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main \n\
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic main \n\
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-16 main \n\
deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-16 main\n" >> /etc/apt/sources.list \
&& add-apt-repository -y ppa:ubuntu-toolchain-r/test \
&& apt-get -y update \
&& apt-get -y upgrade \
&& apt-get -y install mlir-16-tools \
# misc stuff
&& apt-get -y install make \
#
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*

&& apt-get -y install git
# add python3.11 to path in bashrc
RUN echo "export PATH=/opt/python3.11/bin:$PATH" >> ~/.bashrc

Expand Down

0 comments on commit e335786

Please sign in to comment.