-
Notifications
You must be signed in to change notification settings - Fork 50
/
Dockerfile
109 lines (92 loc) · 4.15 KB
/
Dockerfile
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Use the official rust image as a parent image.
FROM rust:1.76
# Connect to the Calux repository.
LABEL org.opencontainers.image.source https://github.com/calyxir/calyx
# Install apt dependencies
RUN echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list && \
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list && \
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add && \
apt-get update -y && \
apt-get install -y jq python3.10 python3-pip python3-venv sbt make autoconf g++ flex bison libfl2 libfl-dev default-jdk ninja-build build-essential cmake autoconf gperf
# Setup python venv to install python dependencies. Python no longer supports installing packages globally into your system
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install python dependencies cocotb==1.6.2 seems to be for Xilinx cocotb tests
# Need to pin the numpy version since there are TVM issues with versions 2 and above
RUN python3 -m pip install numpy==1.26.4 flit prettytable wheel hypothesis pytest simplejson cocotb==1.6.2
# Current cocotb-bus has a bug that is fixed in more up to date repo
RUN python3 -m pip install git+https://github.com/cocotb/cocotb-bus.git cocotbext-axi
# Vcdvcd for profiling
RUN python3 -m pip install vcdvcd
# Install clang
RUN apt-get install -y clang
# Install Verilator
WORKDIR /home
## TODO(rachit): Don't hardcode the version here
RUN git clone --depth 1 --branch v5.002 https://github.com/verilator/verilator
WORKDIR /home/verilator
RUN autoconf && ./configure && make && make install
# Install Icarus verilog
WORKDIR /home
RUN git clone --depth 1 --branch v12_0 https://github.com/steveicarus/iverilog
WORKDIR /home/iverilog
RUN sh autoconf.sh && ./configure && make && make install
# Install TVM
WORKDIR /home
## TODO(rachit): Do not hardcode here
## NOTE(rachit): Not ideal. We have to clone the entire history of the main branch instead of just a tag.
RUN git clone --single-branch https://github.com/apache/tvm.git tvm
WORKDIR /home/tvm
RUN git checkout v0.10.dev0 && \
git submodule init && git submodule update
RUN mkdir build
WORKDIR /home/tvm/build
RUN cp ../cmake/config.cmake . && \
cmake -G Ninja .. && ninja && \
python3 -m pip install -Iv antlr4-python3-runtime==4.7.2
WORKDIR /home/tvm/python
RUN python3 setup.py bdist_wheel && python3 -m pip install dist/tvm-*.whl
# Install Dahlia
WORKDIR /home
RUN git clone https://github.com/cucapra/dahlia.git
WORKDIR /home/dahlia
## Checkout specific version. Fetch before checkout because clone might be cached.
RUN git fetch --all && git checkout 9ec9a58
RUN sbt "; getHeaders; assembly"
# Add the Calyx source code from the build context
WORKDIR /home
ADD . calyx
# Build the compiler
WORKDIR /home/calyx
RUN cargo build --workspace && \
cargo install vcdump && \
cargo install runt --version 0.4.1
# Install fud
WORKDIR /home/calyx/fud
RUN FLIT_ROOT_INSTALL=1 flit install --symlink --deps production
RUN mkdir -p /root/.config
ENV PATH=$PATH:/root/.local/bin
ENV PYTHONPATH=/root/.local/lib/python3.9/site-packages:$PYTHONPATH
# Link fud2
WORKDIR /home/calyx
run mkdir -p ~/.local/bin
RUN ln -s /home/calyx/target/debug/fud2 ~/.local/bin/
RUN printf "dahlia = \"/home/dahlia/fuse\"\n" >> ~/.config/fud2.toml
RUN printf "[calyx]\nbase = \"/home/calyx\"\n" >> ~/.config/fud2.toml
# Install calyx-py
WORKDIR /home/calyx/calyx-py
RUN FLIT_ROOT_INSTALL=1 flit install --symlink
# Setup fud
RUN fud config --create global.root /home/calyx && \
fud config stages.dahlia.exec '/home/dahlia/fuse' && \
fud config stages.calyx.exec '/home/calyx/target/debug/calyx' && \
fud config stages.interpreter.exec '/home/calyx/target/debug/cider' && \
fud register ntt -p '/home/calyx/frontends/ntt-pipeline/fud/ntt.py' && \
fud register mrxl -p '/home/calyx/frontends/mrxl/fud/mrxl.py' && \
fud register icarus-verilog -p '/home/calyx/fud/icarus/icarus.py'
# Install MrXL
WORKDIR /home/calyx/frontends/mrxl
RUN FLIT_ROOT_INSTALL=1 flit install --symlink
WORKDIR /home/calyx
# Used to make runt cocotb tests happy
ENV LANG=C.UTF-8