Skip to content

Commit

Permalink
Add SYCL-CTS (x86_64/linux) to planned testing (#603)
Browse files Browse the repository at this point in the history
Add SYCL-CTS (x86_64/linux) to planned testing
  • Loading branch information
alan-forbes-cp authored Dec 16, 2024
1 parent cba00e2 commit 2b65cba
Show file tree
Hide file tree
Showing 8 changed files with 1,091 additions and 9 deletions.
122 changes: 122 additions & 0 deletions .github/actions/do_build_dpcpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: build dpc++
description: build dpc++

inputs:
target:
description: 'target architecture'
create_dpcpp_artefact_method:
description: 'build | download_release' # TODO: add support for 'previous workflow' download
type: string
default: "build"

runs:
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: Install spirv tools
shell: bash
run:
sudo apt-get install spirv-tools

- name: clone dpc++
if: inputs.create_dpcpp_artefact_method == 'build'
uses: actions/checkout@v4
with:
repository: intel/llvm
path: llvm

- name: dpcpp configure
if: inputs.create_dpcpp_artefact_method == 'build'
shell: bash
run:
cd llvm; python buildbot/configure.py
-o build
--host-target="X86;AArch64;RISCV"
--native_cpu
--llvm-external-projects=lld
--cmake-opt=-DNATIVECPU_USE_OCK=ON
--cmake-opt=-DLLVM_ENABLE_ZLIB=OFF
--cmake-opt=-DLLVM_ENABLE_ZSTD=OFF

- name: build sycl-headers
if: inputs.create_dpcpp_artefact_method == 'build'
shell: bash
run:
cmake --build llvm/build -- sycl-headers

- name: build dpc plus plus
if: inputs.create_dpcpp_artefact_method == 'build'
shell: bash
run:
python llvm/buildbot/compile.py -o llvm/build -v -j 8

- name: build extra utilties
if: inputs.create_dpcpp_artefact_method == 'build'
# Build various utilities, since those aren't proper dependencies.
# FileCheck and not are needed for tests. The rest are needed for
# cross builds. They are enabled on all targets for consistency.
shell: bash
run:
cmake --build llvm/build -- FileCheck clang-tblgen
libclc-remangler llvm-as llvm-min-tblgen llvm-tblgen not
opt prepare_builtins -j8

- name: copy utilities
if: inputs.create_dpcpp_artefact_method == 'build'
shell: bash
run:
cd llvm/build/bin;
cp FileCheck clang-tblgen libclc-remangler llvm-as llvm-min-tblgen
llvm-tblgen not opt prepare_builtins ../install/bin

# TODO: For now just linux x86_64
# Review for location of components (paths) and any archive package/unpackage reqs.
#- name: install config files to pick up libraries for cross compilation.
# if: inputs.create_dpcpp_artefact_method == 'build'
# shell: bash
# run: |
# echo Installing configuration files
# cd llvm/build/bin
# # Install configuration files to pick up libraries for cross compilation.
# for arch in x86_64 aarch64 riscv64; do
# echo "
# -L<CFGDIR>/../../../$arch-linux/install/lib
# -fsycl-libdevice-path=<CFGDIR>/../../../$arch-linux/install/lib
# -fsycl-libspirv-path=<CFGDIR>/../../../$arch-linux/install/lib/clc/remangled-l64-signed_char.libspirv-$arch-unknown-linux-gnu.bc
# " >../install/bin/$arch-unknown-linux-gnu.cfg;
# done

- name: download dpc plus plus
if: inputs.create_dpcpp_artefact_method == 'download_release'
shell: bash
run: |
mkdir -p llvm/build/install
cd llvm/build/install
# Get latest build - go back 2 weeks max else fail
for COUNTER in {0..13}; do
DATESTAMP=$(date -d "-$COUNTER day" '+%Y-%m-%d')
wget -q https://github.com/intel/llvm/releases/download/nightly-$DATESTAMP/sycl_linux.tar.gz && echo Using DPC++ release build: $DATESTAMP && break
done
tar xf sycl_linux.tar.gz
rm sycl_linux.tar.gz
- name: package artefacts # package/unpackage avoids known 'permissions loss' issue
shell: bash
run: |
cd llvm/build/install
tar cf dpcpp.tar *
- name: upload dpcpp artifact
uses: actions/upload-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: llvm/build/install/dpcpp.tar
retention-days: 1
101 changes: 101 additions & 0 deletions .github/actions/do_build_sycl_cts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: build sycl cts
description: build sycl cts

inputs:
target:
description: 'target architecture'

runs:
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: download icd artifact
uses: actions/download-artifact@v4
with:
name: icd_${{inputs.target}}
path: install_icd

- name: download headers artifact
uses: actions/download-artifact@v4
with:
name: header_${{inputs.target}}
path: install_headers

- name: download dpc++ artifact
uses: actions/download-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: install_dpcpp

- name: unpackage dpc++ artifacts # package/unpackage avoids known 'permissions loss' issue
shell: bash
run: |
cd install_dpcpp
tar xf dpcpp.tar
rm dpcpp.tar
- name: checkout sycl cts
uses: actions/checkout@v4
with:
repository: KhronosGroup/SYCL-CTS
path: SYCL-CTS.src
submodules: true

- name: expand runner swap
# Needed to allow building - else current default memory restrictions lead to the runner being killed
shell: bash
run: |
set -x
df -h
sudo swapon --show
sudo swapoff -a
sudo fallocate -l 8G /mnt/swapfilenew
sudo chmod 600 /mnt/swapfilenew
sudo mkswap /mnt/swapfilenew
sudo swapon /mnt/swapfilenew
sudo swapon --show
df -h
set +x
- name: build SYCL CTS
shell: bash
run: |
echo calling cmake and ninja on SYCL CTS
# Todo: as we extend into cross etc, we may want to expand on the cxx flags
# We build SYCL-CTS without installing it, so build directly in the top level.
git -C SYCL-CTS.src log -1
git -C SYCL-CTS.src apply $GITHUB_WORKSPACE/.github/patches/SYCL-CTS-0002-Permit-building-for-unknown-architectures.patch
cmake -S SYCL-CTS.src \
-GNinja \
-B SYCL-CTS \
-DSYCL_IMPLEMENTATION=DPCPP \
-DDPCPP_INSTALL_DIR=$GITHUB_WORKSPACE/install_dpcpp \
-DOpenCL_LIBRARY=$GITHUB_WORKSPACE/install_icd/lib/libOpenCL.so \
-DOpenCL_INCLUDE_DIR=$GITHUB_WORKSPACE/install_headers/include \
-DCMAKE_CXX_COMPILER="$GITHUB_WORKSPACE/install_dpcpp/bin/clang++" \
-DCMAKE_CXX_FLAGS="--target=${{steps.calc_vars.outputs.arch}}-linux-gnu" \
-DCMAKE_CXX_LINK_FLAGS="-fuse-ld=lld"
ninja -C SYCL-CTS -v -j4 -k 0 || :
- name: package artefacts # package/unpackage avoids known 'permissions loss' issue
shell: bash
run: |
cd SYCL-CTS
# only bin
tar cf sycl-cts.tar bin
- name: upload artefact
uses: actions/upload-artifact@v4
with:
name: sycl_cts_${{inputs.target}}
path: SYCL-CTS/sycl-cts.tar
retention-days: 1

87 changes: 87 additions & 0 deletions .github/actions/run_sycl_cts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: run sycl cts
description: run sycl cts

inputs:
target:
description: 'target architecture'

runs:
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: download ock artifact
uses: actions/download-artifact@v4
with:
name: ock_${{inputs.target}}
path: install_ock

- name: download header artifact
uses: actions/download-artifact@v4
with:
name: header_${{inputs.target}}
path: install_headers

- name: download SYCL-CTS artifact
uses: actions/download-artifact@v4
with:
name: sycl_cts_${{inputs.target}}
path: SYCL-CTS

- name: unpackage SYCL-CTS artifacts # package/unpackage avoids known 'permissions loss' issue
shell: bash
run: |
cd SYCL-CTS
tar xf sycl-cts.tar
rm sycl-cts.tar
- name: download dpc++ artifact
uses: actions/download-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: install_dpcpp

- name: unpackage dpc++ artifacts # package/unpackage avoids known 'permissions loss' issue
shell: bash
run: |
cd install_dpcpp
tar xf dpcpp.tar
rm dpcpp.tar
- name: run sycl cts
shell: bash
env:
PREPEND_PATH: '' # TODO: have qemu as input and set up this
SYCL_CTS_TIMEOUT: '02:00:00'
SYCL_CTS_FILTER: ''
run: |
echo running sycl cts
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install_dpcpp/lib:$GITHUB_WORKSPACE/install_ock/lib
export ONEAPI_DEVICE_SELECTOR=opencl:0
export CTS_CSV_FILE=$GITHUB_WORKSPACE/.github/scripts/sycl-cts.csv
set -x
python $GITHUB_WORKSPACE/scripts/testing/run_cities.py \
--color=always \
--timeout $SYCL_CTS_TIMEOUT \
$PREPEND_PATH \
-p sycl_cts \
-b SYCL-CTS/bin \
-L SYCL-CTS/lib \
-e OCL_ICD_FILENAMES=$GITHUB_WORKSPACE/install_ock/lib/libCL.so \
-s $CTS_CSV_FILE \
-l SYCL-CTS/cts.log -f SYCL-CTS/cts.fail \
-r SYCL-CTS/cts.xml \
-v \
$SYCL_CTS_FILTER || exitcode=$?
export OCL_ICD_FILENAMES=$GITHUB_WORKSPACE/install_ock/lib/libCL.so
$GITHUB_WORKSPACE/.github/scripts/create_sycl_cts_test_lists.sh $PREPEND_PATH SYCL-CTS $CTS_CSV_FILE csv.txt cts_all.txt
# output a diff of the generated list csv.txt and cts_all.txt
diff csv.txt cts_all.txt || echo "WARNING - Missing some tests from sycl cts file based on test_all --list-tests - see > above"
exit $exitcode
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From: Harald van Dijk <[email protected]>
Date: Wed, 15 May 2024 17:57:47 +0100
Subject: [PATCH] Permit building for unknown architectures.

---
oclmath/fpcontrol.h | 6 +++---
oclmath/rounding_mode.cpp | 5 +++--
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/oclmath/fpcontrol.h b/oclmath/fpcontrol.h
index cf9e9569..19a07655 100644
--- a/oclmath/fpcontrol.h
+++ b/oclmath/fpcontrol.h
@@ -69,7 +69,7 @@ inline void ForceFTZ(FPU_mode_type* mode) {
#elif defined(__mips__)
fpa_bissr(FPA_CSR_FS);
#else
-#error ForceFTZ needs an implentation
+#warning ForceFTZ needs an implentation
#endif
}

@@ -96,7 +96,7 @@ inline void DisableFTZ(FPU_mode_type* mode) {
#elif defined(__mips__)
fpa_bicsr(FPA_CSR_FS);
#else
-#error DisableFTZ needs an implentation
+#warning DisableFTZ needs an implentation
#endif
}

@@ -115,7 +115,7 @@ inline void RestoreFPState(FPU_mode_type* mode) {
#elif defined(__mips__)
// Mips runs by default with DAZ=1 FTZ=1
#else
-#error RestoreFPState needs an implementation
+#warning RestoreFPState needs an implementation
#endif
}
#else
diff --git a/oclmath/rounding_mode.cpp b/oclmath/rounding_mode.cpp
index 24e8ea99..bbac296b 100644
--- a/oclmath/rounding_mode.cpp
+++ b/oclmath/rounding_mode.cpp
@@ -217,7 +217,8 @@ void* FlushToZero(void) {
fpa_bissr(FPA_CSR_FS);
return NULL;
#else
-#error Unknown arch
+#warning Unknown arch
+ return NULL;
#endif
#else
#error Please configure FlushToZero and UnFlushToZero to behave properly on this operating system.
@@ -246,7 +247,7 @@ void UnFlushToZero(void* p) {
#elif defined(__mips__)
fpa_bicsr(FPA_CSR_FS);
#else
-#error Unknown arch
+#warning Unknown arch
#endif
#else
#error Please configure FlushToZero and UnFlushToZero to behave properly on this operating system.
--
2.43.0

Loading

0 comments on commit 2b65cba

Please sign in to comment.