From 95fa3cea23a090659ab85cffe21ec08e8bb39cc3 Mon Sep 17 00:00:00 2001 From: Ansh Date: Sun, 5 Oct 2025 11:05:39 -0700 Subject: [PATCH 1/6] Add build script --- .devcontainer/Dockerfile | 2 ++ flow.sh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 flow.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 95b38be..a12580b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -41,6 +41,8 @@ RUN conda config --set auto_activate_base true # Install conda-lock <1.5 RUN conda install -c conda-forge 'conda-lock<1.5' -y +RUN conda install -c conda-forge 'libstdcxx-ng>=12' -y + # Install firtool RUN conda config --add channels ucb-bar && \ conda config --set channel_priority strict && \ diff --git a/flow.sh b/flow.sh new file mode 100644 index 0000000..b4e584e --- /dev/null +++ b/flow.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Define image and tags +IMAGE_NAME="eyeamansh/chipyard-dev" +GIT_SHA=$(git rev-parse --short HEAD) + +echo "[info] Building Docker image for chipyard-dev..." +docker build --network=host -t chipyard-dev -f .devcontainer/Dockerfile . + +echo "[info] Tagging image with commit SHA and latest..." +docker tag chipyard-dev "${IMAGE_NAME}:${GIT_SHA}" +docker tag chipyard-dev "${IMAGE_NAME}:latest" + +echo "[info] Pushing image to Docker Hub..." +docker push "${IMAGE_NAME}:${GIT_SHA}" +docker push "${IMAGE_NAME}:latest" + +echo "[success] Pushed:" +echo " - ${IMAGE_NAME}:${GIT_SHA}" +echo " - ${IMAGE_NAME}:latest" From 74643d851957e033ec86690ce81dea6732e92cc1 Mon Sep 17 00:00:00 2001 From: Ansh Date: Sun, 5 Oct 2025 18:10:25 +0000 Subject: [PATCH 2/6] Add Chipyard GitHub actions flow --- .github/workflows/chipyard-tests.yml | 67 ++++++++++++++++++++++++++++ docs/chipyard.md | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/chipyard-tests.yml diff --git a/.github/workflows/chipyard-tests.yml b/.github/workflows/chipyard-tests.yml new file mode 100644 index 0000000..ad35ed7 --- /dev/null +++ b/.github/workflows/chipyard-tests.yml @@ -0,0 +1,67 @@ +name: Chipyard Integration Tests + +on: + workflow_dispatch: + pull_request: + branches: [ main ] + +jobs: + run-chipyard-benchmarks: + runs-on: ubuntu-latest + timeout-minutes: 180 # adjust if needed + container: + image: eyeamansh/chipyard-dev:latest + options: --user root --network host + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Verify Chipyard Directory Exists + run: | + if [ ! -d "/workspace/chipyard" ]; then + echo "Error: /workspace/chipyard directory not found." + exit 1 + fi + + - name: Activate Environment + working-directory: /workspace/chipyard + shell: bash + run: | + set -e + source env.sh + echo "Environment activated." + + - name: Run DRAMSim2 Baseline Benchmark + working-directory: /workspace/chipyard/sims/verilator + shell: bash + run: | + set -e + echo "Running DRAMSim2 baseline benchmark..." + make run-binary \ + CONFIG=RocketConfig \ + BINARY=/workspace/chipyard/.conda-env/riscv-tools/riscv64-unknown-elf/share/riscv-tests/benchmarks/memcpy.riscv \ + -B | tee run_baseline.log + + echo "Checking for success pattern in run_baseline.log..." + grep -q "PASS" run_baseline.log && echo "✅ DRAMSim2 benchmark passed!" || (echo "❌ DRAMSim2 benchmark failed." && exit 1) + + - name: Clean Build Directory + working-directory: /workspace/chipyard/sims/verilator + run: | + echo "Cleaning build directory..." + make clean + + - name: Run MemorySim Benchmark + working-directory: /workspace/chipyard/sims/verilator + shell: bash + run: | + set -e + echo "Running MemorySim benchmark..." + make run-binary \ + CONFIG=MemorySimRocketConfig \ + BINARY=/workspace/chipyard/.conda-env/riscv-tools/riscv64-unknown-elf/share/riscv-tests/benchmarks/memcpy.riscv \ + -B | tee run_memorysim.log + + echo "Checking for success pattern in run_memorysim.log..." + grep -q "PASS" run_memorysim.log && echo "✅ MemorySim benchmark passed!" || (echo "❌ MemorySim benchmark failed." && exit 1) diff --git a/docs/chipyard.md b/docs/chipyard.md index 8d46de7..0f9674d 100644 --- a/docs/chipyard.md +++ b/docs/chipyard.md @@ -1,6 +1,6 @@ # Running Chipyard Benchmarks -## DRAMSim Comparison +## DRAMSim 2 Comparison To compare output with DRAMSim, go ahead and run the following benchmark to establish a baseline - From 7fe96f76627b7c02998a7925ba5a3e094e9818f1 Mon Sep 17 00:00:00 2001 From: Ansh Date: Sun, 2 Nov 2025 09:38:12 -0800 Subject: [PATCH 3/6] Tweak docker --- .devcontainer/Dockerfile | 41 ++++++++++++++++++++-------------------- docs/chipyard.md | 6 ++++++ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a12580b..9821907 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,7 +1,6 @@ # Base image with Miniconda FROM continuumio/miniconda3:latest ENV DEBIAN_FRONTEND=noninteractive - # ------------------------------ # Install system packages # ------------------------------ @@ -10,83 +9,83 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ wget \ + openssh-server \ openssh-client \ + rsync \ less \ vim \ nano \ locales \ build-essential \ ca-certificates \ + kmod \ tmux \ unzip \ && rm -rf /var/lib/apt/lists/* +# Install CPIO to get firemarshal running +RUN sudo apt update +RUN sudo apt install cpio + # Fix locale setup - ensure it's in locale.gen first RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \ locale-gen en_US.UTF-8 - # Set locale environment variables ENV LANG=en_US.UTF-8 ENV LANGUAGE=en_US:en ENV LC_ALL=en_US.UTF-8 - # Set JVM encoding options to handle Unicode (fixes Shapeless error) ENV SBT_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding.pkg=UTF-8" ENV _JAVA_OPTIONS="-Dfile.encoding=UTF-8" ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8" - # Auto-activate base RUN conda config --set auto_activate_base true - # Install conda-lock <1.5 RUN conda install -c conda-forge 'conda-lock<1.5' -y - RUN conda install -c conda-forge 'libstdcxx-ng>=12' -y - # Install firtool RUN conda config --add channels ucb-bar && \ conda config --set channel_priority strict && \ conda install -y firtool - +# ------------------------------ +# SSH setup +# ------------------------------ +RUN mkdir -p /run/sshd && \ + ssh-keygen -A && \ + echo "Port 22" >> /etc/ssh/sshd_config && \ + echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config && \ + echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config && \ + echo "PermitRootLogin no" >> /etc/ssh/sshd_config # ------------------------------ # Create a non-root user for VSCode # ------------------------------ ARG USERNAME=vscode ARG USER_UID=1000 ARG USER_GID=$USER_UID - RUN groupadd --gid $USER_GID $USERNAME \ && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME - -# Make /workspace writable -RUN mkdir -p /workspace && chown -R $USERNAME:$USERNAME /workspace - +# Make /workspace writable and set up SSH directory +RUN mkdir -p /workspace && chown -R $USERNAME:$USERNAME /workspace && \ + mkdir -p /home/$USERNAME/.ssh && chmod 700 /home/$USERNAME/.ssh && \ + chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh USER $USERNAME WORKDIR /workspace - # ------------------------------ # Clone and build Chipyard (cached) # ------------------------------ ARG CHIPYARD_REPO=https://github.com/AnshKetchum/chipyard.git ARG CHIPYARD_BRANCH=main - RUN git clone --branch $CHIPYARD_BRANCH $CHIPYARD_REPO chipyard WORKDIR /workspace/chipyard - # Hack: for all directories to be trusted RUN git config --global --add safe.directory '*' - # Ensure encoding environment is set for the build user too ENV SBT_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding.pkg=UTF-8" ENV _JAVA_OPTIONS="-Dfile.encoding=UTF-8" - - RUN chmod +x ./build-setup.sh && ./build-setup.sh -s 9 -s 10 - - # ------------------------------ # Default command # ------------------------------ diff --git a/docs/chipyard.md b/docs/chipyard.md index 8d46de7..a3a2678 100644 --- a/docs/chipyard.md +++ b/docs/chipyard.md @@ -14,4 +14,10 @@ To run MemorySim, go ahead and run the following benchmark ```bash make run-binary CONFIG=MemorySimRocketConfig BINARY=/workspace/chipyard/.conda-env/riscv-tools/riscv64-unknown-elf/share/riscv-tests/benchmarks/memcpy.riscv -B | tee run.log +``` + + +### Running the dev container +```bash +docker run -d --privileged --network=host -it --rm --user root eyeamansh/chipyard-dev:latest ``` \ No newline at end of file From c4d551bad33bdcd98ad78a852f227e1ba8b8a463 Mon Sep 17 00:00:00 2001 From: Ansh Date: Tue, 4 Nov 2025 09:38:35 -0800 Subject: [PATCH 4/6] Add memory limits and a name for the devcontainer --- docs/chipyard.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/chipyard.md b/docs/chipyard.md index 0469a09..9d6a8ab 100644 --- a/docs/chipyard.md +++ b/docs/chipyard.md @@ -19,5 +19,8 @@ make run-binary CONFIG=MemorySimRocketConfig BINARY=/workspace/chipyard/.conda-e ### Running the dev container ```bash -docker run -d --privileged --network=host -it --rm --user root eyeamansh/chipyard-dev:latest +docker run -d --privileged --network=host -it --rm --user root \ + --memory=32g --memory-swap=64g \ + --name chipyard-development-environment \ + eyeamansh/chipyard-dev:latest ``` \ No newline at end of file From 23757161a9d498e25689cdc4f46dbaa9963f8629 Mon Sep 17 00:00:00 2001 From: Ansh Date: Thu, 6 Nov 2025 22:19:05 -0800 Subject: [PATCH 5/6] Add x11 forwarding --- docs/chipyard.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/chipyard.md b/docs/chipyard.md index 9d6a8ab..84c913c 100644 --- a/docs/chipyard.md +++ b/docs/chipyard.md @@ -22,5 +22,6 @@ make run-binary CONFIG=MemorySimRocketConfig BINARY=/workspace/chipyard/.conda-e docker run -d --privileged --network=host -it --rm --user root \ --memory=32g --memory-swap=64g \ --name chipyard-development-environment \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ eyeamansh/chipyard-dev:latest ``` \ No newline at end of file From af38136cce6b88fa00c96b60fdbf7f14d16e3a0a Mon Sep 17 00:00:00 2001 From: Ansh Date: Sat, 3 Jan 2026 22:36:52 -0800 Subject: [PATCH 6/6] Add LibGL setup --- .devcontainer/Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9821907..bd63c80 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -23,6 +23,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ unzip \ && rm -rf /var/lib/apt/lists/* +# Install LibGL +RUN apt-get update && apt-get install -y \ + libgl1-mesa-glx \ + libgl1-mesa-dri \ + libglu1-mesa \ + libx11-6 \ + libxext6 \ + libxrender1 \ + libxi6 \ + libxrandr2 \ + libxcursor1 \ + libxinerama1 \ + libxft2 \ + && rm -rf /var/lib/apt/lists/* + + # Install CPIO to get firemarshal running RUN sudo apt update RUN sudo apt install cpio @@ -85,7 +101,16 @@ RUN git config --global --add safe.directory '*' # Ensure encoding environment is set for the build user too ENV SBT_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding.pkg=UTF-8" ENV _JAVA_OPTIONS="-Dfile.encoding=UTF-8" + +# Install chipyard deps RUN chmod +x ./build-setup.sh && ./build-setup.sh -s 9 -s 10 + +# Install Sky130 vlsi deps +RUN chmod +x ./scripts/init-sky130.sh && source env.sh && ./scripts/init-sky130.sh + +# Clone Hammer for any local development if need be +RUN git clone https://github.com/AnshKetchum/hammer /workspace/hammer + # ------------------------------ # Default command # ------------------------------