Skip to content

Commit

Permalink
chore(OOTB): out-of-the-box and workflow of OpenLLC (#31)
Browse files Browse the repository at this point in the history
* chore(OOTB): out-of-the-box and workflow of OpenLLC

* chore(workflow): remove clang setup in run stage
  • Loading branch information
Kumonda221-CrO3 authored Oct 16, 2024
1 parent 9353dec commit 350362d
Show file tree
Hide file tree
Showing 8 changed files with 473 additions and 22 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/scenario-CoupledL2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ jobs:
- name: Build TL-Test-New for CoupledL2
run: |
make THREADS_BUILD=4 tltest-build-all
make THREADS_BUILD=4 tltest-build-all-coupledL2
- name: Tar up repository
working-directory: ${{ github.workspace }}
Expand Down Expand Up @@ -285,14 +285,6 @@ jobs:
RUN_ARCHIVE: tl-test-new-run-${{ matrix.case.id }}-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

- name: Setup Clang 16
if: matrix.compiler.cc == 'clang-16'
working-directory: ${{ github.workspace }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 16
- name: Download artifact
uses: actions/download-artifact@v4
with:
Expand Down
328 changes: 328 additions & 0 deletions .github/workflows/scenario-OpenLLC.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
name: scenario-OpenLLC

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
schedule:
- cron: '0 0 * * 0'

env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
INSTALL_DIR: ${{ github.workspace }}/install

defaults:
run:
shell: bash
working-directory: repo

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_reqeust' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:

prebuild-ootb-openLLC:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
case:
- { id: l2l3, name: L2-L3 }
- { id: l2l3l2, name: L2-L3-L2 }

runs-on: ${{ matrix.os }}
name: Pre-Build | ${{ matrix.case.name }} | OOTB OpenLLC
env:
OPENLLC_ARCHIVE: openLLC-${{ matrix.case.id }}-${{ github.sha }}.tar.gz

steps:

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

- name: Checkout OpenLLC
run: git submodule update --init dut/OpenLLC

- name: Extract submodule SHA
id: get_sha_OpenLLC
run: |
cd dut/OpenLLC
CURRENT_HASH=$(git rev-parse HEAD)
echo "${CURRENT_HASH}"
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_ENV
cd ../..
- name: Cache OpenLLC Build
id: cache
uses: actions/cache@v4
env:
cache-name: openLLC-cache-${{ env.CURRENT_HASH }}
with:
path: ${{ github.workspace }}/${{ env.OPENLLC_ARCHIVE }}
key: openLLC-cache-${{ env.CURRENT_HASH }}

- name: Checkout submodules
if: steps.cache.outputs.cache-hit != 'true'
run: git submodule update --init --recursive

- name: Setup Scala
if: steps.cache.outputs.cache-hit != 'true'
uses: olafurpg/setup-scala@v10

- name: Setup Mill
if: steps.cache.outputs.cache-hit != 'true'
run: |
sh -c "curl -L https://github.com/com-lihaoyi/mill/releases/download/0.11.1/0.11.1 > /usr/local/bin/mill && chmod +x /usr/local/bin/mill"
- name: Compile
if: steps.cache.outputs.cache-hit != 'true'
run: |
make openLLC-compile
- name: Build verilog
if: steps.cache.outputs.cache-hit != 'true'
run: |
make openLLC-verilog-test-top-${{ matrix.case.id }}
- name: Tar up repository
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: tar -zcf ${{ env.OPENLLC_ARCHIVE }} repo/dut/OpenLLC/build

setup-verilator:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
compiler:
- { cc: clang-16, cxx: clang++-16 }
- { cc: gcc, cxx: g++ }
exclude:
- { os: ubuntu-20.04, compiler: { cc: gcc, cxx: g++ } }
runs-on: ${{ matrix.os }}
name: Verilator | ${{ matrix.os }} | ${{ matrix.compiler.cc }}
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ${{ matrix.os }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
VERILATOR_ARCHIVE: verilator-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

- name: Cache Verilator
id: cache
uses: actions/cache@v4
env:
cache-name: verilator-cache-${{ matrix.os }}-${{ matrix.compiler.cc }}
with:
path: ${{ github.workspace }}/${{ env.VERILATOR_ARCHIVE }}
key: verilator-cache-${{ matrix.os }}-${{ matrix.compiler.cc }}

- name: Setup Clang 16
if: steps.cache.outputs.cache-hit != 'true' && matrix.compiler.cc == 'clang-16'
working-directory: ${{ github.workspace }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 16
- name: Build Verilator
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
sudo apt-get install -y git help2man perl python3 make autoconf g++ flex bison clang
sudo apt-get install -y libfl2 # Ubuntu only (ignore if gives error)
sudo apt-get install -y libfl-dev # Ubuntu only (ignore if gives error)
sudo apt-get install -y zlib1g zlib1g-dev # Ubuntu only (ignore if gives error)
git clone https://github.com/verilator/verilator
unset VERILATOR_ROOT
cd verilator
git checkout v5.020
autoconf
./configure CC=${{ matrix.compiler.cc }} CXX=${{ matrix.compiler.cxx }} LINK=${{ matrix.compiler.cxx }}
make -j4
- name: Tar-up Verilator
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: tar -zcf ${{ env.VERILATOR_ARCHIVE }} verilator

build:
needs:
- prebuild-ootb-openLLC
- setup-verilator
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
case:
- { id: l2l3, name: L2-L3 }
- { id: l2l3l2, name: L2-L3-L2 }
compiler:
- { cc: clang-16, cxx: clang++-16 }
- { cc: gcc, cxx: g++ }
exclude:
- { os: ubuntu-20.04, compiler: { cc: gcc, cxx: g++ } }
runs-on: ${{ matrix.os }}
name: Build | ${{ matrix.case.name }} | ${{ matrix.os }} | ${{ matrix.compiler.cc }}
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ${{ matrix.os }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
OPENLLC_ARCHIVE: openLLC-${{ matrix.case.id }}-${{ github.sha }}.tar.gz
TLTEST_ARCHIVE: tl-test-new-${{ matrix.case.id }}-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
VERILATOR_ARCHIVE: verilator-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

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

- name: Checkout OpenLLC
run: git submodule update --init dut/OpenLLC

- name: Setup Clang 16
if: matrix.compiler.cc == 'clang-16'
working-directory: ${{ github.workspace }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
sudo ./llvm.sh 16
- name: Fetch cached Verilator
uses: actions/cache/restore@v4
env:
cache-name: verilator-cache-${{ matrix.os }}-${{ matrix.compiler.cc }}
with:
path: ${{ github.workspace }}/${{ env.VERILATOR_ARCHIVE }}
key: verilator-cache-${{ matrix.os }}-${{ matrix.compiler.cc }}
fail-on-cache-miss: true

- name: Install Verilator
working-directory: ${{ github.workspace }}
run: |
tar -zxf ${{ env.VERILATOR_ARCHIVE }}
cd verilator
sudo make install
verilator --version
- name: Extract submodule SHA
id: get_sha_OpenLLC
working-directory: ${{ github.workspace }}
run: |
cd repo/dut/OpenLLC
CURRENT_HASH=$(git rev-parse HEAD)
echo "${CURRENT_HASH}"
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_ENV
- name: Fetch cached OpenLLC
id: cache
uses: actions/cache/restore@v4
env:
cache-name: openLLC-cache-${{ env.CURRENT_HASH }}
with:
path: ${{ github.workspace }}/${{ env.OPENLLC_ARCHIVE }}
key: openLLC-cache-${{ env.CURRENT_HASH }}
fail-on-cache-miss: true

- name: Unpack OpenLLC artifact
working-directory: ${{ github.workspace }}
run: tar -zxf ${{ env.OPENLLC_ARCHIVE }}

- name: Verilate OpenLLC
run: |
make THREADS_BUILD=4 openLLC-verilate
- name: Configurate TL-Test-New for OpenLLC
run: |
make THREADS_BUILD=4 tltest-config-openLLC-test-${{ matrix.case.id }}
- name: Build TL-Test-New for OpenLLC
run: |
make THREADS_BUILD=4 tltest-build-all-openLLC
- name: Tar up repository
working-directory: ${{ github.workspace }}
run: tar -zcf ${{ env.TLTEST_ARCHIVE }} repo/main/build repo/configs repo/scripts repo/Makefile

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/${{ env.TLTEST_ARCHIVE }}
name: ${{ env.TLTEST_ARCHIVE }}

run:
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
case:
- { id: l2l3, name: L2-L3 , mode: FUZZ_ARI }
- { id: l2l3l2, name: L2-L3-L2, mode: FUZZ_ARI }
- { id: l2l3, name: L2-L3 , mode: FUZZ_STREAM }
- { id: l2l3l2, name: L2-L3-L2, mode: FUZZ_STREAM }
compiler:
- { cc: clang-16, cxx: clang++-16 }
- { cc: gcc, cxx: g++ }
exclude:
- { os: ubuntu-20.04, compiler: { cc: gcc, cxx: g++ } }
runs-on: ${{ matrix.os }}
name: Run | ${{ matrix.case.name }} | ${{ matrix.case.mode }} | ${{ matrix.os }} | ${{ matrix.compiler.cc }}
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ${{ matrix.os }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
TLTEST_ARCHIVE: tl-test-new-${{ matrix.case.id }}-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
RUN_ARCHIVE: tl-test-new-run-${{ matrix.case.id }}-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz
steps:

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.TLTEST_ARCHIVE }}
path: ${{ github.workspace }}

- name: Unpack artifact
working-directory: ${{ github.workspace }}
run: tar -zxvf ${{ env.TLTEST_ARCHIVE }}

- name: Setup mode configuration FUZZ_ARI
if: matrix.case.mode == 'FUZZ_ARI'
run: |
pwd
ls
sed -i 's/mode.0.*/mode.0 = FUZZ_ARI/g' ./configs/user.tltest.ini
sed -i 's/mode.1.*/mode.1 = FUZZ_ARI/g' ./configs/user.tltest.ini
cat ./configs/user.tltest.ini
- name: Setup mode configuration FUZZ_STREAM
if: matrix.case.mode == 'FUZZ_STREAM'
run: |
pwd
ls
sed -i 's/mode.0.*/mode.0 = FUZZ_STREAM/g' ./configs/user.tltest.ini
sed -i 's/mode.1.*/mode.1 = FUZZ_STREAM/g' ./configs/user.tltest.ini
cat ./configs/user.tltest.ini
- name: Run TL-Test-New for OpenLLC
run: |
make run
# - name: Tar up repository
# working-directory: ${{ github.workspace }}
# run: tar -zcf ${{ env.RUN_ARCHIVE }} repo

# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# path: ${{ github.workspace }}/${{ env.RUN_ARCHIVE }}
# name: ${{ env.RUN_ARCHIVE }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "dut/CoupledL2"]
path = dut/CoupledL2
url = https://github.com/OpenXiangShan/CoupledL2.git
[submodule "dut/OpenLLC"]
path = dut/OpenLLC
url = https://github.com/OpenXiangShan/OpenLLC.git
Loading

0 comments on commit 350362d

Please sign in to comment.