Allow Including sky130A in the OpenLane Docker Image (#846)

+ Add a dependency system for tools, so some tools can be built first in local installs or have other repos and commits included in docker image builds
+ Add fully working `open_pdks` image that does NOT use Conda
+ Add options to list containerized tools in `dependencies/tool.py`, with a `--no-pdks` flag to exclude open_pdks
+ Add libraries/sky130_fd_pr/latest to the full PDK build (was missing)
~ Isolated PDK building stuff into `./dependencies/pdk.mk`
~ Final merge no longer uses a tarball, just uses a good 'ol copy

---
Caveat is this will not be enabled by default or used by the CI for now. The reason is the PDK adds another 3 gigabytes to the final image and takes positively forever to build.

To use an internally built PDK, you need to export two variables:

export EXTERNAL_PDK_INSTALLATION=0
export NO_PDKS=0

Then you'd `make openlane` as normal.

To finally enable this, we'd need to rewrite make_timing to not take forever (probably in Rust/Swift/Go/whatever) and Open_PDKs would need to be updated so it gzips the liberty files. We'd also need to ensure that all tools can load .lib.gz files.

Co-authored-by: Olof Kindgren <olof.kindgren@gmail.com>
This commit is contained in:
Donn
2022-01-05 16:14:14 +02:00
committed by GitHub
parent 6fd977042e
commit bd8ce27550
11 changed files with 384 additions and 259 deletions

View File

@@ -10,7 +10,13 @@ DOCKER_BUILD_OPTS ?= --rm
DOCKER_BUILD_INVOCATION ?= docker build # docker buildx build --platform linux/amd64 --load
BUILD_COMMAND = $(DOCKER_BUILD_INVOCATION) $(DOCKER_BUILD_OPTS)
TOOLS = cugr drcu yosys magic openroad_app padring netgen vlogtoverilog cvc git
NO_PDKS_ARGS =
NO_PDKS ?= 1
ifeq ($(NO_PDKS), 1)
NO_PDKS_ARGS = --no-pdks
endif
TOOLS = $(shell python3 ../dependencies/tool.py --containerized $(NO_PDKS_ARGS) .)
TOOL_BUILD_TARGETS = $(foreach tool,$(TOOLS),build-$(tool))
TOOL_EXPORT_TARGETS = $(foreach tool,$(TOOLS),tar/$(tool).tar.gz)
@@ -59,22 +65,28 @@ $(TOOL_EXPORT_TARGETS): tar/%.tar.gz : FORCE
${ROOT} docker cp $$id:/build.tar.gz tar/$*.tar.gz ; \
${ROOT} docker rm -v $$id
tar/openroad_tools.tar.gz: $(TOOL_EXPORT_TARGETS)
for tarFile in $(foreach tool,$(TOOLS),tar/$(tool).tar.gz); do \
tar -xzf $$tarFile ; \
./tar/build: $(TOOL_EXPORT_TARGETS)
rm -rf ./tar/build
cd tar && \
for tarFile in $(foreach tool,$(TOOLS),$(tool).tar.gz); do \
tar -xzf $$tarFile ; \
chmod -R +x ./build/bin ; \
find ./build/ -name "*.tcl" -exec chmod +x {} \; ;\
done
chmod -R +x ./build/bin
find ./build/ -name "*.tcl" -exec chmod +x {} \;
cd tar && tar -czf openroad_tools.tar.gz ../build
tar/openlane.tar.gz: FORCE
cd tar && tar --exclude='../../.git' --exclude='../../docker' --exclude="../../designs" --exclude="../../pdks" --exclude="../../logs/*" -czf openlane.tar.gz ../../
OPENLANE_SKELETON=configuration dependencies designs regression_results scripts AUTHORS.md env.py flow.tcl LICENSE run_designs.py
./tar/openlane: FORCE
rm -rf ./tar/openlane
mkdir -p ./tar/openlane
for file in $(OPENLANE_SKELETON); do \
cp -r ../$$file ./tar/openlane/$$file ; \
done
FORCE:
.PHONY: merge openlane
openlane: merge
merge: run_base_image tar/openroad_tools.tar.gz tar/openlane.tar.gz ../dependencies/tool_metadata.yml
merge: run_base_image ./tar/build ./tar/openlane ../dependencies/tool_metadata.yml
cat ../dependencies/tool_metadata.yml > ./tar/tool_metadata.yml
printf "$(shell git rev-parse --short=7 HEAD)" > ./tar/git_version
mkdir -p logs/tar
@@ -86,12 +98,8 @@ merge: run_base_image tar/openroad_tools.tar.gz tar/openlane.tar.gz ../dependenc
.PHONY: clean_merge
clean_merge:
ifneq (,$(wildcard ./tar/openroad_tools.tar.gz))
ifneq (,$(wildcard ./tar/openlane.tar.gz))
rm ./tar/openlane.tar.gz
rm ./tar/openroad_tools.tar.gz
endif
endif
rm -rf ./tar/openlane
rm -rf ./tar/build
clean_export:
rm -rf export/*.tar.gz

View File

@@ -26,16 +26,8 @@ make # or make openlane # or make merge
```
## Updating a Tool Binary
You can update a tool binary as follows:
You can build a tool runnable using the following command: `make build-<tool_name>`.
```
make build-<tool_name>
```
To list the available tools, `python3 ../dependencies/tool.py --containerized`.
The following are the available tools:
```bash
cugr drcu yosys magic openroad_app padring netgen vlogtoverilog cvc git
```
Be sure to make openlane after.
Be sure to `make openlane` after building any tool.

102
docker/open_pdks/Dockerfile Normal file
View File

@@ -0,0 +1,102 @@
# Copyright 2022 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WIP, probably will never make it to the image because it's taking forever to build
FROM openlane-build-base AS builder
ARG SKY130_REPO
ARG SKY130_COMMIT
ENV PDK_ROOT /build/pdk
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
WORKDIR ${PDK_ROOT}
RUN git clone ${SKY130_REPO}
WORKDIR ${PDK_ROOT}/skywater-pdk
RUN git checkout main &&\
git submodule init &&\
git pull --no-recurse-submodules &&\
git checkout -qf ${SKY130_COMMIT}
RUN git submodule update --init libraries/sky130_fd_sc_hd/latest &&\
git submodule update --init libraries/sky130_fd_sc_hs/latest &&\
git submodule update --init libraries/sky130_fd_sc_hdll/latest &&\
git submodule update --init libraries/sky130_fd_sc_ms/latest &&\
git submodule update --init libraries/sky130_fd_sc_ls/latest &&\
git submodule update --init libraries/sky130_fd_sc_hvl/latest &&\
git submodule update --init libraries/sky130_fd_io/latest &&\
git submodule update --init libraries/sky130_fd_pr/latest
RUN python3 -m pip install -e scripts/python-skywater-pdk
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hd/latest
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hd/latest all
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hd/latest all --ccsnoise
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hdll/latest
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hdll/latest all
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hdll/latest all --ccsnoise
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hs/latest
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hs/latest all
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hs/latest all --ccsnoise
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hvl/latest
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hvl/latest all
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_hvl/latest all --ccsnoise
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ls/latest
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ls/latest all
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ls/latest all --ccsnoise
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ms/latest all --leakage
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ms/latest
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ms/latest all
RUN python3 -m skywater_pdk.liberty libraries/sky130_fd_sc_ms/latest all --ccsnoise
ARG MAGIC_REPO
ARG MAGIC_COMMIT
WORKDIR /magic
RUN curl -L ${MAGIC_REPO}/tarball/${MAGIC_COMMIT} | tar -xzC . --strip-components=1 && \
./configure --prefix=/usr && \
make -j$(nproc) && \
make install
ARG OPEN_PDKS_REPO
ARG OPEN_PDKS_COMMIT
WORKDIR ${PDK_ROOT}
RUN git clone ${OPEN_PDKS_REPO}
WORKDIR ${PDK_ROOT}/open_pdks
RUN git checkout master &&\
git checkout -qf ${OPEN_PDKS_COMMIT}
RUN ./configure --enable-sky130-pdk=${PDK_ROOT}/skywater-pdk/libraries --enable-sram-sky130
WORKDIR ${PDK_ROOT}/open_pdks/sky130
RUN make alpha-repo xschem-repo sram-repo 2>&1 | tee /build/pdk_prereq.log
RUN make 2>&1 | tee /build/pdk.log
RUN make SHARED_PDKS_PATH=${PDK_ROOT} install
RUN printf "skywater-pdk ${SKY130_COMMIT}" > ${PDK_ROOT}/sky130A/SOURCES
RUN printf "magic ${MAGIC_COMMIT}" >> ${PDK_ROOT}/sky130A/SOURCES
RUN printf "open_pdks ${OPEN_PDKS_COMMIT}" >> ${PDK_ROOT}/sky130A/SOURCES
RUN rm -rf ${PDK_ROOT}/skywater-pdk
RUN rm -rf ${PDK_ROOT}/open_pdks
RUN tar -c /build | gzip -1 > /build.tar.gz
# ---
# pdk can't really be runnable, might as well shed a few layers
FROM centos:centos7 as runnable
COPY --from=builder /build.tar.gz /build.tar.gz

View File

@@ -25,6 +25,7 @@ ENV MANPATH=$OPENROAD/share/man:$MANPATH
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV PDK_ROOT /build/pdk
# Tools
ARG CACHE_INVALIDATOR=1
@@ -39,9 +40,9 @@ ADD ./tool_metadata.yml /tool_metadata.yml
## Copy Version
ADD ./git_version /git_version
## Tarballs
ADD ./openroad_tools.tar.gz /
ADD ./openlane.tar.gz $OPENLANE_ROOT
## Artifacts
COPY ./build /build
COPY ./openlane /openlane
## Tclsh RC
COPY ./.tclshrc /.tclshrc

View File

@@ -1,74 +0,0 @@
# Copyright 2020-2021 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WIP, probably will never make it to the image because it's taking forever to build
FROM openlane-build-base AS builder
ARG SKY130_REPO
ARG SKY130_COMMIT
ENV PDK_ROOT /build/pdk
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
WORKDIR ${PDK_ROOT}
RUN git clone ${SKY130_REPO}
WORKDIR ${PDK_ROOT}/skywater-pdk
RUN git checkout main &&\
git submodule init &&\
git pull --no-recurse-submodules &&\
git checkout -qf ${SKY130_COMMIT}
RUN git submodule update --init libraries/sky130_fd_sc_hd/latest &&\
git submodule update --init libraries/sky130_fd_sc_hs/latest &&\
git submodule update --init libraries/sky130_fd_sc_hdll/latest &&\
git submodule update --init libraries/sky130_fd_sc_ms/latest &&\
git submodule update --init libraries/sky130_fd_sc_ls/latest &&\
git submodule update --init libraries/sky130_fd_sc_hvl/latest &&\
git submodule update --init libraries/sky130_fd_io/latest
RUN make -j$(nproc) timing > /build/pdk_timing.log 2>&1
ARG MAGIC_REPO
ARG MAGIC_COMMIT
WORKDIR /magic
RUN curl -L ${MAGIC_REPO}/tarball/${MAGIC_COMMIT} | tar -xzC . --strip-components=1 && \
./configure --prefix=/usr && \
make -j$(nproc) && \
make install
ARG OPEN_PDKS_REPO
ARG OPEN_PDKS_COMMIT
WORKDIR ${PDK_ROOT}
RUN git clone ${OPEN_PDKS_REPO}
WORKDIR ${PDK_ROOT}/open_pdks
RUN git checkout master &&\
git checkout -qf ${OPEN_PDKS_COMMIT}
RUN ./configure --enable-sky130-pdk=${PDK_ROOT}/skywater-pdk/libraries --enable-sram-sky130
WORKDIR ${PDK_ROOT}/open_pdks/sky130
RUN make alpha-repo xschem-repo sram-repo > /build/pdk_prereq.log 2>&1
RUN make > ./build/pdk.log 2>&1
RUN make SHARED_PDKS_PATH=${PDK_ROOT} install
# ---
FROM openlane-run-base AS runnable
COPY --from=builder /build/pdk/pdk.log /build/pdk/pdk.log
COPY --from=builder /build/pdk/sky130A /build/pdk/sky130A

View File

@@ -1,4 +1,6 @@
/*.tar.gz
/*.yml
/*.txt
/git_version
/git_version
/build
/openlane