diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 7f1cb964..d74b18af 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -2,13 +2,6 @@ name: run-tests description: 'Runs tests according to input parameters' inputs: -<<<<<<< HEAD -======= - tools-version: - description: Which toolchain to build - required: false - default: 'riscv-tools' ->>>>>>> 52c752ba... Move Chipyard CI to Github Actions group-key: description: group key required: true @@ -23,7 +16,6 @@ inputs: runs: using: "composite" steps: -<<<<<<< HEAD - name: Init submodules (since only the RTL is cached) run: ./scripts/init-submodules-no-riscv-tools.sh shell: bash @@ -37,13 +29,3 @@ runs: - name: Run RTL tests run: ./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }} shell: bash -======= - - name: run rtl build script cache of chipyard root should have been loaded by prepare-rtl - run: | - export RISCV="/__w/chipyard/chipyard/riscv-tools-install" - export LD_LIBRARY_PATH="$RISCV/lib" - export PATH="$RISCV/bin:$PATH" - ./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }} - shell: bash - ->>>>>>> 52c752ba... Move Chipyard CI to Github Actions diff --git a/.github/scripts/defaults.sh b/.github/scripts/defaults.sh index 0123fa88..cb48e932 100755 --- a/.github/scripts/defaults.sh +++ b/.github/scripts/defaults.sh @@ -1,22 +1,5 @@ #!/bin/bash -copy () { - rsync -azp -e 'ssh' --exclude '.git' $1 $2 -} - -run () { - ssh -o "ServerAliveInterval=60" -o "StrictHostKeyChecking no" -t $SERVER $@ -} - -run_script () { - ssh -o "ServerAliveInterval=60" -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2" -} - -clean () { - # remove remote work dir - run "rm -rf $REMOTE_WORK_DIR" -} - # make parallelism CI_MAKE_NPROC=4 # chosen based on a 24c system shared with 1 other project @@ -33,10 +16,10 @@ CURRENT_BRANCH=$(git branch --show-current) HOME=`pwd` REMOTE_PREFIX=$CI_DIR/${GITHUB_REPOSITORY#*/}-$CURRENT_BRANCH -REMOTE_WORK_DIR=$REMOTE_PREFIX-$GITHUB_SHA-$GITHUB_JOB -REMOTE_RISCV_DIR=$REMOTE_WORK_DIR/riscv-tools-install -REMOTE_ESP_DIR=$REMOTE_WORK_DIR/esp-tools-install -REMOTE_CHIPYARD_DIR=$REMOTE_WORK_DIR/chipyard +REMOTE_WORK_DIR=$GITHUB_WORKSPACE +REMOTE_RISCV_DIR=$GITHUB_WORKSPACE/riscv-tools-install +REMOTE_ESP_DIR=$GITHUB_WORKSPACE/esp-tools-install +REMOTE_CHIPYARD_DIR=$GITHUB_WORKSPACE REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator REMOTE_FIRESIM_DIR=$REMOTE_CHIPYARD_DIR/sims/firesim/sim REMOTE_FPGA_DIR=$REMOTE_CHIPYARD_DIR/fpga diff --git a/.github/scripts/do-rtl-build.sh b/.github/scripts/do-rtl-build.sh index bd418824..1cf06978 100755 --- a/.github/scripts/do-rtl-build.sh +++ b/.github/scripts/do-rtl-build.sh @@ -17,45 +17,22 @@ source $SCRIPT_DIR/defaults.sh # call clean on exit trap clean EXIT -cd $LOCAL_CHIPYARD_DIR +cd $REMOTE_CHIPYARD_DIR ./scripts/init-submodules-no-riscv-tools.sh ./scripts/init-fpga.sh -# replace the workspace dir with a local dir so you can copy around -sed -i -E 's/(workspace=).*(\/tools)/\1$PWD\2/g' .sbtopts - -# set stricthostkeychecking to no (must happen before rsync) -run "echo \"Ping $SERVER\"" - -clean - -# copy over riscv/esp-tools, and chipyard to remote -run "mkdir -p $REMOTE_CHIPYARD_DIR" -copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR - -run "cp -r ~/.ivy2 $REMOTE_WORK_DIR" -run "cp -r ~/.sbt $REMOTE_WORK_DIR" - TOOLS_DIR=$REMOTE_RISCV_DIR LD_LIB_DIR=$REMOTE_RISCV_DIR/lib if [ $1 = "group-accels" ]; then - export RISCV=$LOCAL_ESP_DIR - export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib + export RISCV=$REMOTE_ESP_DIR + export LD_LIBRARY_PATH=$REMOTE_ESP_DIR/lib export PATH=$RISCV/bin:$PATH - GEMMINI_SOFTWARE_DIR=$LOCAL_SIM_DIR/../../generators/gemmini/software/gemmini-rocc-tests - cd $LOCAL_SIM_DIR/../../generators/gemmini/software + GEMMINI_SOFTWARE_DIR=$REMOTE_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests + cd $GEMMINI_SOFTWARE_DIR git submodule update --init --recursive gemmini-rocc-tests cd gemmini-rocc-tests ./build.sh - - TOOLS_DIR=$REMOTE_ESP_DIR - LD_LIB_DIR=$REMOTE_ESP_DIR/lib - run "mkdir -p $REMOTE_ESP_DIR" - copy $LOCAL_ESP_DIR/ $SERVER:$REMOTE_ESP_DIR -else - run "mkdir -p $REMOTE_RISCV_DIR" - copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR fi # choose what make dir to use @@ -70,27 +47,20 @@ case $2 in esac # enter the verilator directory and build the specific config on remote server -run "export RISCV=\"$TOOLS_DIR\"; \ - make -C $REMOTE_MAKE_DIR clean;" +export RISCV=$TOOLS_DIR +make -C $REMOTE_MAKE_DIR clean read -a keys <<< ${grouping[$1]} # need to set the PATH to use the new verilator (with the new verilator root) for key in "${keys[@]}" do - run "export RISCV=\"$TOOLS_DIR\"; \ - export LD_LIBRARY_PATH=\"$LD_LIB_DIR\"; \ - export PATH=\"$REMOTE_VERILATOR_DIR/bin:\$PATH\"; \ - export VERILATOR_ROOT=\"$REMOTE_VERILATOR_DIR\"; \ - export COURSIER_CACHE=\"$REMOTE_WORK_DIR/.coursier-cache\"; \ - make -j$REMOTE_MAKE_NPROC -C $REMOTE_MAKE_DIR FIRRTL_LOGLEVEL=info JAVA_TOOL_OPTIONS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" ${mapping[$key]}" + export RISCV=$TOOLS_DIR + export LD_LIBRARY_PATH=$LD_LIB_DIR + export PATH=$REMOTE_VERILATOR_DIR/bin:$PATH + export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR + export COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache + make -j$REMOTE_MAKE_NPROC -C $REMOTE_MAKE_DIR FIRRTL_LOGLEVEL=info JAVA_OPTS=$REMOTE_JAVA_OPTS SBT_OPTS=$REMOTE_SBT_OPTS ${mapping[$key]} done -run "rm -rf $REMOTE_CHIPYARD_DIR/project" - -# choose to copy back results -if [ $2 = "sim" ]; then - # copy back the final build - mkdir -p $LOCAL_CHIPYARD_DIR - copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR -fi +rm -rf $REMOTE_CHIPYARD_DIR/project diff --git a/.github/scripts/install-verilator.sh b/.github/scripts/install-verilator.sh index f667b365..1159fc47 100755 --- a/.github/scripts/install-verilator.sh +++ b/.github/scripts/install-verilator.sh @@ -10,16 +10,14 @@ SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" source $SCRIPT_DIR/defaults.sh # clean older directories (delete prior directories related to this branch also) -run_script $LOCAL_CHIPYARD_DIR/.github/scripts/clean-old-files.sh $CI_DIR -run "rm -rf $REMOTE_PREFIX*" -# set stricthostkeychecking to no (must happen before rsync) -run "echo \"Ping $SERVER\"" +$SCRIPT_DIR/clean-old-files.sh $CI_DIR +rm -rf $REMOTE_PREFIX* -run "git clone http://git.veripool.org/git/verilator $REMOTE_VERILATOR_DIR; \ - cd $REMOTE_VERILATOR_DIR; \ - git checkout $VERILATOR_VERSION; \ - autoconf; \ - export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR; \ - ./configure; \ - make -j$REMOTE_MAKE_NPROC;" +git clone http://git.veripool.org/git/verilator $REMOTE_VERILATOR_DIR +cd $REMOTE_VERILATOR_DIR +git checkout $VERILATOR_VERSION +autoconf +export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR +./configure +make -j$REMOTE_MAKE_NPROC diff --git a/.github/scripts/run-firesim-scala-tests.sh b/.github/scripts/run-firesim-scala-tests.sh index 0a74adb8..9b329fa7 100755 --- a/.github/scripts/run-firesim-scala-tests.sh +++ b/.github/scripts/run-firesim-scala-tests.sh @@ -13,50 +13,36 @@ source $SCRIPT_DIR/defaults.sh # call clean on exit trap clean EXIT +export RISCV="$REMOTE_RISCV_DIR" +export LD_LIBRARY_PATH="$RISCV/lib" +export PATH="$RISCV/bin:$PATH" + # Directory locations for handling firesim-local installations of libelf/libdwarf # This would generally be handled by build-setup.sh/firesim-setup.sh firesim_sysroot=lib-install -local_firesim_sysroot=$LOCAL_FIRESIM_DIR/$firesim_sysroot remote_firesim_sysroot=$REMOTE_FIRESIM_DIR/$firesim_sysroot -cd $LOCAL_CHIPYARD_DIR +cd $REMOTE_CHIPYARD_DIR ./scripts/init-submodules-no-riscv-tools.sh -cd $LOCAL_CHIPYARD_DIR/sims/firesim/sim/firesim-lib/src/main/cc/lib +cd $REMOTE_CHIPYARD_DIR/sims/firesim/sim/firesim-lib/src/main/cc/lib git submodule update --init elfutils libdwarf -cd $LOCAL_CHIPYARD_DIR/sims/firesim -mkdir -p $local_firesim_sysroot -./scripts/build-libelf.sh $local_firesim_sysroot -./scripts/build-libdwarf.sh $local_firesim_sysroot -cd $LOCAL_CHIPYARD_DIR +cd $REMOTE_CHIPYARD_DIR/sims/firesim +mkdir -p $remote_firesim_sysroot +./scripts/build-libelf.sh $remote_firesim_sysroot +./scripts/build-libdwarf.sh $remote_firesim_sysroot +cd $REMOTE_CHIPYARD_DIR -# replace the workspace dir with a local dir so you can copy around -sed -i -E 's/(workspace=).*(\/tools)/\1$PWD\2/g' .sbtopts - -make -C $LOCAL_CHIPYARD_DIR/tools/dromajo/dromajo-src/src - -# set stricthostkeychecking to no (must happen before rsync) -run "echo \"Ping $SERVER\"" - -clean - -# copy over riscv/esp-tools, and chipyard to remote -run "mkdir -p $REMOTE_CHIPYARD_DIR" -run "mkdir -p $REMOTE_RISCV_DIR" -copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR -copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR - -run "cp -r ~/.ivy2 $REMOTE_WORK_DIR" -run "cp -r ~/.sbt $REMOTE_WORK_DIR" +make -C $REMOTE_CHIPYARD_DIR/tools/dromajo/dromajo-src/src TOOLS_DIR=$REMOTE_RISCV_DIR LD_LIB_DIR=$remote_firesim_sysroot/lib:$REMOTE_RISCV_DIR/lib # Run Firesim Scala Tests -run "export RISCV=\"$TOOLS_DIR\"; \ - export LD_LIBRARY_PATH=\"$LD_LIB_DIR\"; \ - export FIRESIM_ENV_SOURCED=1; \ - export PATH=\"$REMOTE_VERILATOR_DIR/bin:\$PATH\"; \ - export VERILATOR_ROOT=\"$REMOTE_VERILATOR_DIR\"; \ - export COURSIER_CACHE=\"$REMOTE_WORK_DIR/.coursier-cache\"; \ - make -C $REMOTE_FIRESIM_DIR JAVA_TOOL_OPTIONS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" testOnly ${mapping[$1]}" +export RISCV=$TOOLS_DIR +export LD_LIBRARY_PATH=$LD_LIB_DIR +export FIRESIM_ENV_SOURCED=1; +export PATH=$REMOTE_VERILATOR_DIR/bin:$PATH +export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR +export COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache +make -C $REMOTE_FIRESIM_DIR JAVA_OPTS=$REMOTE_JAVA_OPTS SBT_OPTS=$REMOTE_SBT_OPTS testOnly ${mapping[$1]} diff --git a/.github/workflows/chipyard-run-tests.yml b/.github/workflows/chipyard-run-tests.yml index c932d3e6..fc74e3c0 100644 --- a/.github/workflows/chipyard-run-tests.yml +++ b/.github/workflows/chipyard-run-tests.yml @@ -20,6 +20,7 @@ jobs: with: access_token: ${{ github.token }} +<<<<<<< HEAD commit-on-master-check: name: commit-on-master-check runs-on: ubuntu-latest @@ -137,6 +138,7 @@ jobs: run: .github/scripts/remote-install-verilator.sh - uses: ./.github/actions/job-end +<<<<<<< HEAD # Sentinel job to simplify how we specify which that basic setup is complete # # When adding new prep jobs, please add them to `needs` below