Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 44 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: vrtlmod CI - build, test, and benchmark

on:
push:
Expand Down Expand Up @@ -45,7 +45,16 @@ jobs:
with:
path: vrtlmod_src
submodules: true

- name: Load env vars from docker/.env
run: |
while IFS='=' read -r key value || [ -n "$key" ]; do
[[ -z "$key" || "$key" == \#* ]] && continue
key="$(echo "$key" | xargs)"
value="$(echo "$value" | xargs)"
value="${value%\"}"
value="${value#\"}"
echo "$key=$value" >> $GITHUB_ENV
done < vrtlmod_src/docker/.env
- if: ${{ matrix.llvm.src == 'true' }}
name: Cache LLVM
id: cache-llvm
Expand All @@ -54,23 +63,20 @@ jobs:
path: /llvm_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}

- name: Cache Verilator
id: cache-verilator
uses: actions/cache@v4
with:
path: /verilator_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}

- name: Cache SystemC
id: cache-systemc
uses: actions/cache@v4
with:
path: /systemc_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_systemc-${{ matrix.systemc_version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_systemc-${{ matrix.systemc_version }}

- name: Requirements (Linux)
if: runner.os == 'Linux'
continue-on-error: false
Expand All @@ -79,38 +85,33 @@ jobs:
run: |
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_env

- if: ${{ steps.cache-systemc.outputs.cache-hit != 'true' }}
name: Requirements SystemC
working-directory: ${{runner.workspace}}
shell: bash
run: |
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_systemc "${{runner.workspace}}/systemc_src" "${{runner.workspace}}/systemc_build" "/systemc_install" "${{ matrix.systemc_version }}"

- if: ${{ steps.cache-verilator.outputs.cache-hit != 'true' }}
name: Requirements Verilator
working-directory: ${{runner.workspace}}
shell: bash
run: |
. "./vrtlmod/vrtlmod_src/docker/setup_debian.sh"
setup_verilator "${{runner.workspace}}/verilator_src" "${{runner.workspace}}/verilator_src" "/verilator_install" "${{ matrix.verilator_version }}"

- name: Check (cached) Verilator
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: /verilator_install/bin/verilator --version

- if: ${{ (matrix.llvm.src == 'true') && (steps.cache-llvm.outputs.cache-hit != 'true') }}
name: Requirements LLVM+Clang
working-directory: ${{runner.workspace}}
shell: bash
run: |
export LLVM_FROM_SOURCE="ON"
export ENV_LLVM_FROM_SOURCE="ON"
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_llvm "${{runner.workspace}}/llvm_src" "${{runner.workspace}}/llvm_build" "/llvm_install" "${{ matrix.llvm.version }}" "$PWD/vrtlmod/vrtlmod_src/deps/llvm/patches"

- if: ${{ matrix.llvm.src == 'true' }}
name: Check (cached) LLVM
continue-on-error: false
Expand Down Expand Up @@ -142,22 +143,30 @@ jobs:
run: |
apt update
apt install -y git

- name: Checkout
uses: actions/checkout@v4
with:
path: vrtlmod_src
submodules: recursive

- name: Load env vars from docker/.env
run: |
while IFS='=' read -r key value || [ -n "$key" ]; do
[[ -z "$key" || "$key" == \#* ]] && continue
key="$(echo "$key" | xargs)"
value="$(echo "$value" | xargs)"
value="${value%\"}"
value="${value#\"}"
echo "$key=$value" >> $GITHUB_ENV
done < vrtlmod_src/docker/.env
- name: Requirements (Linux)
if: runner.os == 'Linux'
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: |
. ./vrtlmod/vrtlmod_src/docker/.env
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_env

- if: ${{ matrix.llvm.src == 'true' }}
name: Cache LLVM
id: cache-llvm
Expand All @@ -166,43 +175,37 @@ jobs:
path: /llvm_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}

- if: ${{ matrix.llvm.src != 'true' }}
name: Install LLVM build dependencies (system)
run: |
apt update
apt remove -y llvm* clang* libllvm* libclang*
apt install -y libzstd-dev llvm-${{ matrix.llvm.version }}-dev libclang-${{ matrix.llvm.version }}-dev clang-${{ matrix.llvm.version }}

- name: Cache Verilator
id: cache-verilator
uses: actions/cache@v4
with:
path: /verilator_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}

- name: Cache SystemC
id: cache-systemc
uses: actions/cache@v4
with:
path: /systemc_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_systemc-${{ matrix.systemc_version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_systemc-${{ matrix.systemc_version }}

- name: Check (cached) Verilator
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: /verilator_install/bin/verilator --version

- if: ${{ matrix.llvm.src == 'true' }}
name: Check (cached) Clang
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: /llvm_install/bin/clang --version

- if: ${{ matrix.llvm.src == 'true' }}
name: Build vRTLmod (LLVM from source)
shell: bash
Expand All @@ -211,19 +214,26 @@ jobs:
export VERILATOR_ROOT=/verilator_install
export LLVM_DIR=/llvm_install
export SYSTEMC_HOME=/systemc_install
. ./vrtlmod/vrtlmod_src/docker/.env
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_vrtlmod "${GITHUB_WORKSPACE}/vrtlmod_src" "/vrtlmod_build" "/vrtlmod_install"

- if: ${{ matrix.llvm.src != 'true' }}
name: Build vRTLmod (LLVM system)
shell: bash
working-directory: ${{runner.workspace}}
run: |
export VERILATOR_ROOT=/verilator_install
export SYSTEMC_HOME=/systemc_install
. ./vrtlmod/vrtlmod_src/docker/.env
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_vrtlmod "${GITHUB_WORKSPACE}/vrtlmod_src" "/vrtlmod_build" "/vrtlmod_install"

setup_vrtlmod "${GITHUB_WORKSPACE}/vrtlmod_src" "/vrtlmod_build" "/vrtlmod_install"
- name: Run Tests
shell: bash
working-directory: ${{runner.workspace}}
run: |
. ./vrtlmod/vrtlmod_src/docker/.env
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
test_vrtlmod "${GITHUB_WORKSPACE}/vrtlmod_src" "/vrtlmod_build" "/vrtlmod_install"
- name: (CTest) Upload Artifacts on Failure
uses: actions/upload-artifact@v5
if: ${{ failure() }}
Expand All @@ -232,7 +242,6 @@ jobs:
path: /vrtlmod_build/Testing/
if-no-files-found: error
retention-days: 15

- name: Upload Compiled System
if: runner.os == 'Linux'
uses: actions/upload-artifact@v5
Expand Down Expand Up @@ -268,37 +277,43 @@ jobs:
run: |
apt update
apt install -y git

- name: Checkout vrtlmod
uses: actions/checkout@v4
with:
path: vrtlmod_src

- name: Load env vars from docker/.env
run: |
while IFS='=' read -r key value || [ -n "$key" ]; do
[[ -z "$key" || "$key" == \#* ]] && continue
key="$(echo "$key" | xargs)"
value="$(echo "$value" | xargs)"
value="${value%\"}"
value="${value#\"}"
echo "$key=$value" >> $GITHUB_ENV
done < vrtlmod_src/docker/.env
- name: Checkout vrtlmod-test
uses: actions/checkout@v4
with:
path: vrtlmod-test_src
repository: tum-ei-eda/vrtlmod-test
ref: master
submodules: recursive

- name: Requirements (Linux)
if: runner.os == 'Linux'
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: |
. ./vrtlmod/vrtlmod_src/docker/.env
. ./vrtlmod/vrtlmod_src/docker/setup_debian.sh
setup_env

- name: Cache Verilator
id: cache-verilator
uses: actions/cache@v4
with:
path: /verilator_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}

- if: ${{ matrix.llvm.src == 'true' }}
name: Cache LLVM
id: cache-llvm
Expand All @@ -307,41 +322,35 @@ jobs:
path: /llvm_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}

- if: ${{ matrix.llvm.src != 'true' }}
name: Install LLVM build dependencies (system)
run: |
apt update
apt remove -y llvm* clang* libllvm* libclang*
apt install -y libzstd-dev llvm-${{ matrix.llvm.version }}-dev libclang-${{ matrix.llvm.version }}-dev clang-${{ matrix.llvm.version }}

- name: Cache SystemC
id: cache-systemc
uses: actions/cache@v4
with:
path: /systemc_install
key: ${{ matrix.os.name }}-${{ matrix.os.version }}_systemc-${{ matrix.systemc_version }}
restore-keys: ${{ matrix.os.name }}-${{ matrix.os.version }}_systemc-${{ matrix.systemc_version }}

- name: Check (cached) Verilator
continue-on-error: false
shell: bash
working-directory: ${{runner.workspace}}
run: /verilator_install/bin/verilator --version

- name: Fetch Compiled System
uses: actions/download-artifact@v5
with:
name: vrtlmod_${{ matrix.os.name }}-${{ matrix.os.version }}_verilator-${{ matrix.verilator_version }}_llvm-${{ matrix.llvm.name }}-${{ matrix.llvm.version }}
path: /vrtlmod_install/

- name: Check pre-compiled vrtlmod
shell: bash
run: |
chmod +x /vrtlmod_install/bin/vrtlmod
chmod +x /vrtlmod_install/cmake/vrtlmod-config.cmake
/vrtlmod_install/bin/vrtlmod --version

- name: Patch Submodule
shell: bash
run: |
Expand All @@ -352,7 +361,6 @@ jobs:
ls -la .
git apply "../../../patches/scc-gcc_gt_13.patch"
git apply "../../../patches/scc-byteenabletransactions.patch"

- if: ${{ matrix.llvm.src == 'true' }}
name: Configure Benchmarks (LLVM source)
shell: bash
Expand All @@ -362,7 +370,6 @@ jobs:
export LLVM_DIR=/llvm_install
export SYSTEMC_HOME=/systemc_install
cmake -S ${GITHUB_WORKSPACE}/vrtlmod-test_src -B build -D VRTL_NAMES="${{matrix.duts}}" -D CMAKE_BUILD_TYPE=${{ matrix.cmakegen }} -D VRTLMOD_ROOT=/vrtlmod_install

- if: ${{ matrix.llvm.src != 'true' }}
name: Configure Benchmarks (LLVM system)
shell: bash
Expand All @@ -371,20 +378,17 @@ jobs:
export VERILATOR_ROOT=/verilator_install
export SYSTEMC_HOME=/systemc_install
cmake -S ${GITHUB_WORKSPACE}/vrtlmod-test_src -B build -D VRTL_NAMES="${{matrix.duts}}" -D CMAKE_BUILD_TYPE=${{ matrix.cmakegen }} -D VRTLMOD_ROOT=/vrtlmod_install

- name: Compile Benchmarks
shell: bash
working-directory: ${{runner.workspace}}
run: |
cmake --build build --parallel $(nproc)

- name: Run Benchmarks
shell: bash
working-directory: ${{runner.workspace}}
run: |
build/benchmark/V${{ matrix.duts }}-SC_TEST_VRTLMOD ${GITHUB_WORKSPACE}/vrtlmod-test_src/benchmark/${{matrix.duts}}/dhry.elf 5 10 > ${{matrix.duts}}-log.txt
cat ${{matrix.duts}}-log.txt

- name: Save Benchmark Results
uses: actions/upload-artifact@v5
with:
Expand Down
Loading
Loading