From c7bd10509805749e85199c20428b07e620716375 Mon Sep 17 00:00:00 2001 From: Michal Czyz Date: Wed, 24 Jan 2024 15:50:52 +0100 Subject: [PATCH] Add Chipyard benchmarks to CI --- .github/workflows/ci.yml | 96 +++++++++++++++++++++++++++++++++ .github/workflows/ci_docker.yml | 31 +++++++++++ Dockerfile | 35 ++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/ci_docker.yml create mode 100644 Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..33dbef6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,96 @@ +name: Chipyard Megaboom Benchmark + +on: + workflow_dispatch: + push: + pull_request: + +jobs: + smoke-tests: + name: Smoke Test + runs-on: ubuntu-latest + container: + image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest + defaults: + run: + shell: bash + env: + DEBIAN_FRONTEND: "noninteractive" + steps: + - name: Smoke test + id: smoke_test + run: | + echo "Smoke test" + # pushd tests + # make -j`nproc` + # popd + binary-tests: + name: Binary test + runs-on: ubuntu-latest + container: + image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + CONFIG: ["RocketConfig", "MegaBoomConfig"] + BINARY: ["../../tests/hello.riscv", "../../software/coremark/riscv-coremark/coremark.bare.riscv"] + env: + DEBIAN_FRONTEND: "noninteractive" + steps: + - name: Binary test + id: binary_test + run: | + echo "Binary test" + # source tools/bin/micromamba.rc + # cd chipyard + # source env.sh + # pushd sims/verilator + # make run-binary CONFIG=${CONFIG} BINARY=${BINARY} + # popd + coremark: + name: Coremark + runs-on: ubuntu-latest + container: + image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest + defaults: + run: + shell: bash + env: + DEBIAN_FRONTEND: "noninteractive" + steps: + - name: Coremark + run: | + echo "Coremark" + # git submodule update --init --recursive software/coremark + # pushd software/coremark + # cat build.sh + # ls -hal riscv-coremark/ + # cat riscv-coremark/build-coremark.sh + # ./build.sh + # popd + verilator_configs: + name: Verilator ChipConfig + runs-on: ubuntu-latest + container: + image: ghcr.io/antmicro/megaboom-cpu-benchmarking:latest + defaults: + run: + shell: bash + env: + DEBIAN_FRONTEND: "noninteractive" + strategy: + fail-fast: false + matrix: + CONFIG: ["RocketConfig", "MegaBoomConfig"] + steps: + - name: Verilator ${{ matrix.CONFIG }} + run: | + echo "Verilator config" + # cd chipyard + # source env.sh + # pushd sims/verilator + # make CONFIG=${{ matrix.CONFIG }} -j`nproc` + # popd diff --git a/.github/workflows/ci_docker.yml b/.github/workflows/ci_docker.yml new file mode 100644 index 0000000..34dfd8c --- /dev/null +++ b/.github/workflows/ci_docker.yml @@ -0,0 +1,31 @@ +name: docker update + +on: + workflow_dispatch: + # push: + # pull_request: + + +jobs: + docker: + runs-on: ubuntu-latest + env: + IMAGE: ghcr.io/antmicro/megaboom-cpu-benchmarking + steps: + - uses: actions/checkout@v3 + - name: Build docker image + run: | + docker build -t "${{ env.IMAGE }}" . + + - name: Login to GitHub Container Registry (GHCR) + if: github.event_name != 'pull_request' && github.repository == 'antmicro/megaboom-cpu-benchmarking' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: gha + password: ${{ github.token }} + + - name: Push container image to GitHub Container Registry (GHCR) + if: github.event_name != 'pull_request' && github.repository == 'antmicro/megaboom-cpu-benchmarking' + run: docker push $IMAGE + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c3e5fc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +# Chipyard setup + +FROM ubuntu:22.04 + +SHELL ["/bin/bash", "-c"] + +# Install dependencies for ubuntu-req.sh +RUN apt -qqy update && \ + DEBIAN_FRONTEND=noninteractive apt install -qqy --no-install-recommends \ + ca-certificates build-essential gcc g++ python3 git cmake autoconf bison flex help2man wget +RUN update-ca-certificates + +WORKDIR /root +RUN apt -qqy update && \ + DEBIAN_FRONTEND=noninteractive apt install -qqy --no-install-recommends \ + ca-certificates curl build-essential git sudo pbzip2 kmod +RUN update-ca-certificates + +# Install Chipyard and run ubuntu-req.sh to install necessary dependencies +# FIXME: Using a branch, because I updated the install-conda.sh script, +# which is no longer maintained. Fix this in the future. +RUN git clone https://github.com/antmicro/chipyard.git && \ + cd chipyard && \ + git checkout mczyz/deps + +RUN ./chipyard/.github/scripts/install-conda.sh +# RUN source ~/.bashrc +# RUN bash +RUN echo "shell is "$0 +RUN ["/bin/bash", "--login", "-c", "conda activate base"] +RUN ["/bin/bash", "--login", "-c", "cd chipyard && ./build-setup.sh riscv-tools -s 6 -s 7 -s 8 -s 9"] +RUN ["/bin/bash", "--login", "-c", "cd chipyard && source ./env.sh"] + +ENTRYPOINT ["chipyard/scripts/entrypoint.sh"] +