Skip to content

Commit

Permalink
Initial commit for fine-grained instruction tracking in Gemmini
Browse files Browse the repository at this point in the history
  • Loading branch information
kris-dong committed Feb 11, 2025
0 parents commit aee1a5c
Show file tree
Hide file tree
Showing 137 changed files with 29,518 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/scripts/defaults.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

#############
# SHARED VARS
#############

# make parallelism
CI_MAKE_NPROC=4
LOCAL_MAKE_NPROC=$CI_MAKE_NPROC

# local variables
LOCAL_CHECKOUT_DIR=$GITHUB_WORKSPACE

LOCAL_CHIPYARD_DIR=$REMOTE_WORK_DIR
LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verilator

CICONFIG=chipyard.config.WithNoDebug_GemminiRocketConfig
17 changes: 17 additions & 0 deletions .github/scripts/do-rtl-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# turn echo on and error on earliest command
set -ex

# get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

eval "$(conda shell.bash hook)"

cd $LOCAL_CHIPYARD_DIR
source env.sh

cd $LOCAL_SIM_DIR
make -C $LOCAL_SIM_DIR clean
make -j$LOCAL_MAKE_NPROC -C $LOCAL_SIM_DIR CONFIG=$CICONFIG
33 changes: 33 additions & 0 deletions .github/scripts/install-gemmini.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# turn echo on and error on earliest command
set -ex

# get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

eval "$(conda shell.bash hook)"

mkdir -p $JAVA_TMP_DIR

git clone --progress --verbose https://github.com/ucb-bar/chipyard.git $LOCAL_CHIPYARD_DIR
cd $LOCAL_CHIPYARD_DIR

git fetch
git checkout $(cat $LOCAL_CHECKOUT_DIR/CHIPYARD.hash)

export MAKEFLAGS="-j32"
./build-setup.sh riscv-tools -f -s 6 -s 7 -s 8 -s 9 -v

source env.sh

cd $LOCAL_CHECKOUT_DIR
chown -R $(whoami) .
git config --global --add safe.directory $LOCAL_CHECKOUT_DIR
git config --global --add safe.directory '*'

cd $LOCAL_CHECKOUT_DIR
git submodule update --init --recursive software/gemmini-rocc-tests
rm -rf $LOCAL_CHIPYARD_DIR/generators/gemmini/* $LOCAL_CHIPYARD_DIR/generators/gemmini/.git*
mv -f $LOCAL_CHECKOUT_DIR/* $LOCAL_CHECKOUT_DIR/.git* $LOCAL_CHIPYARD_DIR/generators/gemmini/
19 changes: 19 additions & 0 deletions .github/scripts/run-tests-rtl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# turn echo on and error on earliest command
set -ex

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

eval "$(conda shell.bash hook)"

cd $LOCAL_CHIPYARD_DIR
source env.sh

cd $LOCAL_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests
CFLAGS=-DFAST ./build.sh

cd build
make test-baremetal-bareMetalC RUNNER="'make -C $LOCAL_SIM_DIR CONFIG=$CICONFIG run-binary-hex BINARY='"
#make -j$LOCAL_MAKE_NPROC test-baremetal-bareMetalC RUNNER="'make -C $LOCAL_SIM_DIR CONFIG=$CICONFIG run-binary-hex BINARY='"
29 changes: 29 additions & 0 deletions .github/scripts/run-tests-spike.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# turn echo on and error on earliest command
set -ex

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

eval "$(conda shell.bash hook)"

cd $LOCAL_CHIPYARD_DIR
source env.sh

cd $LOCAL_CHECKOUT_DIR
chown -R $(whoami) .
git config --global --add safe.directory $LOCAL_CHECKOUT_DIR
git config --global --add safe.directory '*'

cd $LOCAL_CHECKOUT_DIR
# Delete the stale libgemmini first installed by chipyard, switch to the one submoduled here
rm -rf $RISCV/lib/libgemmini.so
git submodule update --init software/libgemmini
make -C software/libgemmini install

cd $LOCAL_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests
./build.sh

cd build
make -j$LOCAL_MAKE_NPROC test-baremetal
74 changes: 74 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Gemmini CI

on: [push]

defaults:
run:
shell: bash -leo pipefail {0}

env:
REMOTE_WORK_DIR: /scratch/buildbot/gemmini-ci-shared/gemmini-${{ github.sha }}
JAVA_TMP_DIR: /tmp/gemmini-${{ github.sha }}-full

jobs:
install-gemmini:
runs-on: jktqos
steps:
- name: Delete old checkout
run: |
rm -rf ${{ github.workspace }}/* || true
rm -rf ${{ github.workspace }}/.* || true
- uses: actions/checkout@v3
- name: Setup repository
run: |
.github/scripts/install-gemmini.sh
spike-run-tests:
runs-on: jktqos
needs: install-gemmini
steps:
- name: Delete old checkout
run: |
rm -rf ${{ github.workspace }}/* || true
rm -rf ${{ github.workspace }}/.* || true
- uses: actions/checkout@v3
- name: Run Gemmini Spike tests
run: |
.github/scripts/run-tests-spike.sh
build-gemmini-config:
runs-on: jktqos
needs: install-gemmini
steps:
- name: Delete old checkout
run: |
rm -rf ${{ github.workspace }}/* || true
rm -rf ${{ github.workspace }}/.* || true
- uses: actions/checkout@v3
- name: Building Gemmini Config using Verilator
run: |
.github/scripts/do-rtl-build.sh
rtl-run-tests:
runs-on: jktqos
needs: build-gemmini-config
steps:
- name: Delete old checkout
run: |
rm -rf ${{ github.workspace }}/* || true
rm -rf ${{ github.workspace }}/.* || true
- uses: actions/checkout@v3
- name: Run Gemmini Config tests using Verilator
run: |
.github/scripts/run-tests-rtl.sh
cleanup:
name: cleanup
needs: [spike-run-tests, rtl-run-tests]
runs-on: jktqos
if: ${{ always() }}
steps:
- name: Delete repo copy
run: |
rm -rf ${{ env.REMOTE_WORK_DIR }}
rm -rf ${{ env.JAVA_TMP_DIR }}
Loading

0 comments on commit aee1a5c

Please sign in to comment.