Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jfornt-bsc committed Feb 9, 2024
2 parents 61c539b + 3a19bdc commit 42f0a85
Show file tree
Hide file tree
Showing 7 changed files with 364 additions and 6 deletions.
62 changes: 62 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
stages:
- compile
- stim_gen
- test

variables:
GIT_SOURCES_ATTEMPTS: 4
GIT_SUBMODULE_STRATEGY: recursive
DOWNSTREAM: "false"

workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH == "ci"

.global_before_script: &global_before_script
## set enviroment
- git config --global user.name "${GITLAB_USER_NAME}"
- git config --global user.email "${GITLAB_USER_EMAIL}"

## Print Variables
- echo $UPSTREAM_BRANCH
- echo $DOWNSTREAM
- echo $PROJECT_PATH
- echo $PROJECT_NAME
- echo $PROJECT_NAMESPACE
- PR_NAMESPACE=$(echo $PROJECT_NAMESPACE | sed 's_'"epac/"'__')
- echo $PR_NAMESPACE
- echo $SUBMODULE_COMMIT_SHORT
- echo $SUBMODULE_COMMIT_SHA
- echo $SUBMODULE_COMMIT_BEFORE_SHA
- echo $CI_COMMIT_BRANCH
- echo $CI_PIPELINE_SOURCE
- git submodule status
- ls /opt/verilator

## Pull the submodule in case of downstream (triggered pipelines)
# We need to update the submodule that triggered the pipeline
# This should only be done for jobs which require the submodules
- |
if [ "$DOWNSTREAM" == "true" ] && [ "$GIT_SUBMODULE_STRATEGY" == "recursive" ]; then
cd modules/${PR_NAMESPACE}
git fetch origin +refs/heads/*:refs/remotes/origin/*
git checkout ${SUBMODULE_COMMIT_SHA}
cd ../..
fi
.simulation:
image: registry.gitlab.bsc.es/hwdesign/containerhub/verilator:latest
before_script:
- *global_before_script
- source ${CI_PROJECT_DIR}/test/ci/setup.sh

default:
before_script:
- *global_before_script

include:
- local: test/ci/verification.yml
139 changes: 139 additions & 0 deletions Python/requirements_conda.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=conda_forge
_openmp_mutex=4.5=2_gnu
blas=1.0=mkl
brotli=1.1.0=hd590300_1
brotli-bin=1.1.0=hd590300_1
brotli-python=1.1.0=py310hc6cd4ac_1
bzip2=1.0.8=hd590300_5
ca-certificates=2023.11.17=hbcca054_0
certifi=2023.11.17=pyhd8ed1ab_0
charset-normalizer=3.3.2=pyhd8ed1ab_0
contourpy=1.2.0=py310hd41b1e2_0
cpuonly=2.0=0
cycler=0.12.1=pyhd8ed1ab_0
dbus=1.13.18=hb2f20db_0
expat=2.5.0=hcb278e6_1
ffmpeg=4.3=hf484d3e_0
filelock=3.13.1=pyhd8ed1ab_0
fontconfig=2.14.2=h14ed4e7_0
fonttools=4.47.0=py310h2372a71_0
freetype=2.12.1=h267a509_2
gettext=0.21.1=h27087fc_0
giflib=5.2.1=h0b41bf4_3
glib=2.78.3=hfc55251_0
glib-tools=2.78.3=hfc55251_0
gmp=6.3.0=h59595ed_0
gmpy2=2.1.2=py310h3ec546c_1
gnutls=3.6.13=h85f3911_1
gst-plugins-base=1.14.1=h6a678d5_1
gstreamer=1.14.1=h5eee18b_1
icu=58.2=hf484d3e_1000
idna=3.6=pyhd8ed1ab_0
intel-openmp=2022.1.0=h9e868ea_3769
jinja2=3.1.2=pyhd8ed1ab_1
jpeg=9e=h166bdaf_2
keyutils=1.6.1=h166bdaf_0
kiwisolver=1.4.5=py310hd41b1e2_1
krb5=1.20.1=h81ceb04_0
lame=3.100=h166bdaf_1003
lcms2=2.15=hfd0df8a_0
ld_impl_linux-64=2.40=h41732ed_0
lerc=4.0.0=h27087fc_0
libblas=3.9.0=16_linux64_mkl
libbrotlicommon=1.1.0=hd590300_1
libbrotlidec=1.1.0=hd590300_1
libbrotlienc=1.1.0=hd590300_1
libcblas=3.9.0=16_linux64_mkl
libclang=14.0.6=default_h7634d5b_1
libclang13=14.0.6=default_h9986a30_1
libcups=2.3.3=h36d4200_3
libdeflate=1.17=h0b41bf4_0
libedit=3.1.20191231=he28a2e2_2
libexpat=2.5.0=hcb278e6_1
libffi=3.4.2=h7f98852_5
libgcc-ng=13.2.0=h807b86a_3
libgfortran-ng=13.2.0=h69a702a_3
libgfortran5=13.2.0=ha4646dd_3
libglib=2.78.3=h783c2da_0
libgomp=13.2.0=h807b86a_3
libiconv=1.17=hd590300_2
libjpeg-turbo=2.0.0=h9bf148f_0
liblapack=3.9.0=16_linux64_mkl
libllvm14=14.0.6=hcd5def8_4
libnsl=2.0.1=hd590300_0
libopenblas=0.3.25=pthreads_h413a1c8_0
libpng=1.6.39=h753d276_0
libpq=12.15=hdbd6064_1
libsqlite=3.44.2=h2797004_0
libstdcxx-ng=13.2.0=h7e041cc_3
libtiff=4.5.0=h6adf6a1_2
libuuid=2.38.1=h0b41bf4_0
libwebp=1.3.2=h11a3e52_0
libwebp-base=1.3.2=hd590300_0
libxcb=1.16=hd590300_0
libxcrypt=4.4.36=hd590300_1
libxkbcommon=1.0.3=he3ba5ed_0
libxml2=2.9.14=h74e7548_0
libzlib=1.2.13=hd590300_5
llvm-openmp=15.0.7=h0cdce71_0
markupsafe=2.1.3=py310h2372a71_1
matplotlib=3.6.2=py310hff52083_0
matplotlib-base=3.6.2=py310h8d5ebf3_0
mkl=2022.1.0=hc2b9512_224
mpc=1.3.1=hfe3b2da_0
mpfr=4.2.1=h9458935_0
mpmath=1.3.0=pyhd8ed1ab_0
munkres=1.1.4=pyh9f0ad1d_0
mysql=5.7.20=hf484d3e_1001
ncurses=6.4=h59595ed_2
nettle=3.6=he412f7d_0
networkx=3.2.1=pyhd8ed1ab_0
numpy=1.23.1=py310h53a5b5f_0
openh264=2.1.1=h780b84a_0
openjpeg=2.5.0=hfec8fc6_2
openssl=3.2.0=hd590300_1
packaging=23.2=pyhd8ed1ab_0
pcre2=10.42=hcad00b1_0
pillow=10.0.1=py310ha6cbd5a_0
pip=23.3.2=pyhd8ed1ab_0
platformdirs=4.1.0=pyhd8ed1ab_0
pooch=1.8.0=pyhd8ed1ab_0
pthread-stubs=0.4=h36c2ea0_1001
pyparsing=3.1.1=pyhd8ed1ab_0
pyqt=5.15.4=py310hd8f1fbe_0
pyqt5-sip=12.9.0=py310hd8f1fbe_0
pysocks=1.7.1=pyha2e5f31_6
python=3.10.13=hd12c33a_1_cpython
python-dateutil=2.8.2=pyhd8ed1ab_0
python_abi=3.10=4_cp310
pytorch=2.1.2=py3.10_cpu_0
pytorch-mutex=1.0=cpu
pyyaml=6.0.1=py310h2372a71_1
qt-main=5.15.2=h7358343_9
readline=8.2=h8228510_1
requests=2.31.0=pyhd8ed1ab_0
scipy=1.10.0=py310h8deb116_2
setuptools=69.0.3=pyhd8ed1ab_0
sip=6.5.1=py310h122e73d_2
six=1.16.0=pyh6c4a22f_0
sqlite=3.44.2=h2c6b66d_0
sympy=1.12=pypyh9d50eac_103
tk=8.6.13=noxft_h4845f30_101
toml=0.10.2=pyhd8ed1ab_0
torchaudio=2.1.2=py310_cpu
torchvision=0.16.2=py310_cpu
tornado=6.3.3=py310h2372a71_1
typing_extensions=4.9.0=pyha770c72_0
tzdata=2023d=h0c530f3_0
unicodedata2=15.1.0=py310h2372a71_0
urllib3=2.1.0=pyhd8ed1ab_0
wheel=0.42.0=pyhd8ed1ab_0
xorg-libxau=1.0.11=hd590300_0
xorg-libxdmcp=1.1.3=h7f98852_0
xz=5.2.6=h166bdaf_0
yaml=0.2.5=h7f98852_2
zlib=1.2.13=hd590300_5
zstd=1.5.5=hfc55251_0
43 changes: 43 additions & 0 deletions Python/requirements_pip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Brotli==1.1.0
certifi==2023.11.17
charset-normalizer==3.3.2
contourpy==1.1.0
cycler==0.12.1
filelock==3.13.1
fonttools==4.47.0
gmpy2==2.1.2
idna==3.6
Jinja2==3.1.2
kiwisolver==1.4.5
MarkupSafe==2.1.3
matplotlib==3.6.2
mpmath==1.3.0
munkres==1.1.4
networkx==3.1
numpy==1.23.1
packaging==23.2
Pillow==10.0.1
pip==23.3.2
platformdirs==4.1.0
pooch==1.8.0
pyparsing==3.1.1
PyQt5==5.15.4
PyQt5-sip==12.9.0
PySocks==1.7.1
python-dateutil==2.8.2
PyYAML==6.0.1
requests==2.31.0
scipy==1.10.0
setuptools==69.0.3
sip==6.5.1
six==1.16.0
sympy==1.12
toml==0.10.2
torch==2.1.2
torchaudio==2.1.2
torchvision==0.16.2
tornado==6.3.3
typing_extensions==4.9.0
unicodedata2==15.1.0
urllib3==2.1.0
wheel==0.42.0
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,37 @@ Check out the project's Wiki (https://gitlab.bsc.es/hwdesign/ips/accelerators/sa

## Installation

After cloning the repository and selecting the branch, run the following command to update all the submodules needed:
After cloning the repository and selecting the branch, run the following command to update all the submodules:

```bash
git submodule update --init --recursive
```

## Running Simulations

SAURIA can be emulated using Verilator v4.224. We have observed issues with older and newer versions, so we recommend using a local installation as described below. A testbench for simulation with commercial RTL simulators (e.g. Synopsys VCS or Questa) is also provided.

The first step is to install Verilator, which can be done as follows:
To install Verilator v4.224 locally, run:

```bash
source setup.sh
cd tools/
source install_verilator.sh
```

Before starting a simulation, we generate a set of random convolutions and GEMMs using Python:
To use the Python script that generates random stimuli for the simulations, install the required packages into your Python environment by using pip:

```bash
pip install -r Python/requirements_pip.txt
```

Or, alternatively, using Conda:

```bash
conda install --file Python/requirements_pip.txt
```

## Running Simulations

First, we generate a set of random convolutions and GEMMs using Python:

```bash
source setup.sh
Expand Down
5 changes: 5 additions & 0 deletions test/ci/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export RTL_DIR=$(pwd)/RTL
export PULP_DIR=$(pwd)/pulp_platform
export TEST_DIR=$(pwd)/test
export VERILATOR_ROOT=/opt/verilator/4.228/
export PATH=$PATH:$VERILATOR_ROOT/bin
96 changes: 96 additions & 0 deletions test/ci/verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
compile:hardware_emu:
stage: compile
extends: .simulation
tags:
- dv
rules:
- if: '$CI_SKIP_SIMULATION == "true"'
when: never
- when: always
script:
- cd ${CI_PROJECT_DIR}/test/verilator
- source compile_sauria.sh
artifacts:
expire_in: 1 weeks
when: on_success
paths:
- ${CI_PROJECT_DIR}/test/verilator/verilator.log
- ${CI_PROJECT_DIR}/test/verilator/Test-Sim

stim_gen:small_bmk:
stage: stim_gen
extends: .simulation
tags:
- dv
rules:
- if: '$CI_SKIP_SIMULATION == "true"'
when: never
- when: on_success
script:
- cd ${CI_PROJECT_DIR}/Python
- pip install -r requirements_pip.txt
- source generate_stimuli.sh bmk_small
artifacts:
expire_in: 1 weeks
when: on_success
paths:
- ${CI_PROJECT_DIR}/test/stimuli/bmk_small/gold_dram.txt
- ${CI_PROJECT_DIR}/test/stimuli/bmk_small/initial_dram.txt
- ${CI_PROJECT_DIR}/test/stimuli/bmk_small/GoldenStimuli.txt
- ${CI_PROJECT_DIR}/test/stimuli/bmk_small/GoldenOutputs.txt
- ${CI_PROJECT_DIR}/test/stimuli/bmk_small/tstcfg.txt

stim_gen:conv_validation:
stage: stim_gen
extends: .simulation
tags:
- dv
rules:
- if: '$CI_SKIP_SIMULATION == "true"'
when: never
- when: on_success
script:
- cd ${CI_PROJECT_DIR}/Python
- pip install -r requirements_pip.txt
- source generate_stimuli.sh conv_validation
artifacts:
expire_in: 1 weeks
when: on_success
paths:
- ${CI_PROJECT_DIR}/test/stimuli/conv_validation/gold_dram.txt
- ${CI_PROJECT_DIR}/test/stimuli/conv_validation/initial_dram.txt
- ${CI_PROJECT_DIR}/test/stimuli/conv_validation/GoldenStimuli.txt
- ${CI_PROJECT_DIR}/test/stimuli/conv_validation/GoldenOutputs.txt
- ${CI_PROJECT_DIR}/test/stimuli/conv_validation/tstcfg.txt

test:small_bmk:
stage: test
dependencies:
- compile:hardware_emu
- stim_gen:small_bmk
extends: .simulation
tags:
- dv
rules:
- if: '$CI_SKIP_SIMULATION == "true"'
when: never
- when: on_success
script:
- cd ${CI_PROJECT_DIR}/test/verilator
- source run_sauria_test.sh bmk_small

test:conv_validation:
stage: test
dependencies:
- compile:hardware_emu
- stim_gen:conv_validation
extends: .simulation
tags:
- dv
rules:
- if: '$CI_SKIP_SIMULATION == "true"'
when: never
- when: on_success
script:
- cd ${CI_PROJECT_DIR}/test/verilator
- source run_sauria_test.sh conv_validation
Loading

0 comments on commit 42f0a85

Please sign in to comment.