[VENTUS][test] Add the regression tests

In order to prevent new errors from being introduced when modifying the code,
we add regression tests in the project build script and workflow. The
regression tests mainly includes some cases that come with gpu-rodinia and
pocl.
This commit is contained in:
Jules-Kong 2023-08-01 10:11:47 +08:00 committed by zhoujingya
parent 9b14cdb6b2
commit 78b9e9c855
2 changed files with 56 additions and 2 deletions

View File

@ -5,11 +5,15 @@ env:
ISA_SIMULATOR: ventus-gpgpu-isa-simulator
BUILD_TYPE: Release
VENTUS_DRIVER: ventus-driver
RODINIA: gpu-rodinia
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 2 * * *' # Runs at 2am everyday
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
@ -40,10 +44,16 @@ jobs:
git clone https://github.com/THU-DSP-LAB/pocl.git ${{github.workspace}}/../$POCL
git clone https://github.com/OCL-dev/ocl-icd.git ${{github.workspace}}/../$OCL_ICD
git clone https://github.com/THU-DSP-LAB/ventus-gpgpu-isa-simulator.git ${{github.workspace}}/../$ISA_SIMULATOR
git clone https://github.com/yangzexia/ventus-driver.git ${{github.workspace}}/../$VENTUS_DRIVER
git clone https://github.com/THU-DSP-LAB/ventus-driver.git ${{github.workspace}}/../$VENTUS_DRIVER
git clone https://github.com/Jules-Kong/gpu-rodinia.git ${{github.workspace}}/../$RODINIA
export DRIVER_DIR=${{github.workspace}}/../$VENTUS_DRIVER
export DRIVER_BUILD_DIR=${DRIVER_DIR}/build
export VENTUS_INSTALL_PREFIX=${{github.workspace}}/install
wget -P ${{github.workspace}}/../$RODINIA -c https://www.dropbox.com/s/cc6cozpboht3mtu/rodinia-3.1-data.tar.gz
tar -zxvf ${{github.workspace}}/../$RODINIA/rodinia-3.1-data.tar.gz -C ${{github.workspace}}/../$RODINIA
mv ${{github.workspace}}/../$RODINIA/rodinia-data/* ${{github.workspace}}/../$RODINIA/data/
rm ${{github.workspace}}/../$RODINIA/rodinia-3.1-data.tar.gz
rm ${{github.workspace}}/../$RODINIA/rodinia-data -rf
- name: Start building llvm-ventus
shell: bash
@ -75,6 +85,16 @@ jobs:
run: |
bash build-ventus.sh --build ${POCL}
- name: Start testing gpu-rodinia
shell: bash
run: |
bash build-ventus.sh --build rodinia
- name: Start testing pocl
shell: bash
run: |
bash build-ventus.sh --build test-pocl
- name: Start ISA simulation test
run: |
# Later need to add test files and test script for testing

View File

@ -4,7 +4,7 @@ DIR=$(cd "$(dirname "${0}")" &> /dev/null && (pwd -W 2> /dev/null || pwd))
VENTUS_BUILD_DIR=${DIR}/build
LIBCLC_BUILD_DIR=${DIR}/build-libclc
VENTUS_INSTALL_PREFIX=${DIR}/install
PROGRAMS_TOBUILD=(llvm ocl-icd libclc spike driver pocl)
PROGRAMS_TOBUILD=(llvm ocl-icd libclc spike driver pocl rodinia test-pocl)
# Helper function
help() {
@ -102,6 +102,13 @@ fi
check_if_program_exits ${OCL_ICD_DIR} "ocl icd"
OCL_ICD_BUILD_DIR=${OCL_ICD_DIR}/build
# Need to get the gpu-rodinia folder from enviroment variables
if [ -z "${RODINIA_DIR}" ]; then
RODINIA_DIR=${DIR}/../gpu-rodinia
fi
check_if_program_exits ${RODINIA_DIR} "gpu-rodinia"
# Build llvm
build_llvm() {
if [ ! -d "${VENTUS_BUILD_DIR}" ]; then
@ -204,12 +211,29 @@ build_icd_loader() {
make && make install
}
# Test the rodinia test suit
test_rodinia() {
cd ${RODINIA_DIR}
make OCL_clean
make OPENCL
}
# TODO : More test cases of the pocl will be added
test_pocl() {
cd ${POCL_BUILD_DIR}/examples
./vecadd/vecadd
./matadd/matadd
}
# Export needed path and enviroment variables
export_elements() {
export PATH=${VENTUS_INSTALL_PREFIX}/bin:$PATH
export LD_LIBRARY_PATH=${VENTUS_INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH
export SPIKE_SRC_DIR=${SPIKE_DIR}
export SPIKE_TARGET_DIR=${VENTUS_INSTALL_PREFIX}
export VENTUS_INSTALL_PREFIX=${VENTUS_INSTALL_PREFIX}
export POCL_DEVICES="ventus"
export OCL_ICD_VENDORS=${VENTUS_INSTALL_PREFIX}/lib/libpocl.so
}
# When no need to build llvm, export needed elements
@ -266,6 +290,16 @@ do
check_if_ventus_built
check_if_ocl_icd_built
build_pocl
elif [ "${program}" == "rodinia" ]; then
check_if_ventus_built
check_if_ocl_icd_built
check_if_spike_built
test_rodinia
elif [ "${program}" == "test-pocl" ]; then
check_if_ventus_built
check_if_ocl_icd_built
check_if_spike_built
test_pocl
else
echo "Invalid build options: \"${program}\" , try $0 --help for help"
exit 1