diff --git a/.github/actions/do_build_ock_artefact/action.yml b/.github/actions/do_build_ock_artefact/action.yml index ca176df9d..2c7f128a9 100644 --- a/.github/actions/do_build_ock_artefact/action.yml +++ b/.github/actions/do_build_ock_artefact/action.yml @@ -59,8 +59,8 @@ runs: - name: prune ock artefact shell: bash run: | - # delete all but city runner and the python associated file under bin - find install/bin -maxdepth 1 -type f ! -name "*.py" -delete + # delete all but clc, city runner and the python associated file under bin + find install/bin -maxdepth 1 -type f -and ! \( -name "*.py" -o -name "*clc" \) -delete rm -rf install/share - name: upload ock artefact diff --git a/.github/actions/do_build_opencl_cts/action.yml b/.github/actions/do_build_opencl_cts/action.yml new file mode 100644 index 000000000..bae51173d --- /dev/null +++ b/.github/actions/do_build_opencl_cts/action.yml @@ -0,0 +1,81 @@ +name: build opencl cts +description: build opencl 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@a1ea791b03c8e61f53a0e66f2f73db283aa0f01e # main branch + + - name: download icd artifact + uses: actions/download-artifact@v4 + with: + name: icd_${{inputs.target}} + path: install_icd + + - name: download header artifact + uses: actions/download-artifact@v4 + with: + name: header_${{inputs.target}} + path: install_headers + + - name: checkout test suite + uses: actions/checkout@v4 + with: + repository: KhronosGroup/OpenCL-CTS + path: OpenCL-CTS + + - name: build opencl cts + shell: bash + env: + # TODO: host-x86_64-linux 'toolchain' - expand for other targets + CMAKE_TOOLCHAIN: "-DCMAKE_C_COMPILER=gcc -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_COMPILER=g++ \ + -DCMAKE_CXX_FLAGS=-m64 -DPKG_CONFIG_EXECUTABLE=pkg-config" + run: | + # get spirv-as + sudo apt-get update + sudo apt-get install -y spirv-tools + # apply patches + pushd OpenCL-CTS + git log -1 + git apply $GITHUB_WORKSPACE/.github/patches/OpenCL-CTS-0001-Patch-sub-group-testing.patch + git apply $GITHUB_WORKSPACE/.github/patches/OpenCL-CTS-0002-Permit-building-for-unknown-architectures.patch + popd + # do build + set -x + cmake -G Ninja $CMAKE_TOOLCHAIN $GITHUB_WORKSPACE/OpenCL-CTS \ + -DCMAKE_BUILD_TYPE=Release \ + -DOPENCL_LIBRARIES=OpenCL \ + -DCL_INCLUDE_DIR=$GITHUB_WORKSPACE/install_headers/include \ + -DCL_LIB_DIR=$GITHUB_WORKSPACE/install_icd/lib + ninja -v + python3 $GITHUB_WORKSPACE/OpenCL-CTS/test_conformance/spirv_new/assemble_spirv.py -v \ + --source-dir $GITHUB_WORKSPACE/OpenCL-CTS/test_conformance/spirv_new/spirv_asm \ + --output-dir $GITHUB_WORKSPACE/test_conformance/spirv_bin + + - name: upload opencl cts artifacts + uses: actions/upload-artifact@v4 + with: + name: opencl_cts_${{inputs.target}} + path: | + test_conformance + !test_conformance/**/.* + !test_conformance/**/CMakeCache.txt + !test_conformance/**/CMakeFiles + !test_conformance/**/CMakeFiles/** + !test_conformance/**/*.cmake + !test_conformance/**/*.ninja + !test_conformance/test_common + !test_conformance/test_common/** + retention-days: 1 + diff --git a/.github/actions/run_opencl_cts/action.yml b/.github/actions/run_opencl_cts/action.yml new file mode 100644 index 000000000..975a67586 --- /dev/null +++ b/.github/actions/run_opencl_cts/action.yml @@ -0,0 +1,41 @@ +name: run opencl cts +description: run opencl cts + +# This action is not standalone and assumes it has been run after the build_opencl_cts action. + +inputs: + target: + description: 'target architecture' + test_type: + description: 'quick | full' + default: "quick" + +runs: + using: "composite" + steps: + - name: Download ock artefact + uses: actions/download-artifact@v4 + with: + name: ock_${{inputs.target}} + path: install_ock + + - name: Run opencl cts + shell: bash + env: + CTS_CSV_FILE: opencl_conformance_tests_${{inputs.test_type}}.csv + # TODO: host-x86_64-linux filter - expand for other targets + CTS_FILTER: cts-3.0-online-ignore-linux-host.csv + CTS_TIMEOUT: 18:00:00 # OK for github? + run: | + cd "$GITHUB_WORKSPACE/OpenCL-CTS" + echo "Running OpenCL CTS tests with CTS file $CTS_CSV_FILE with filter $CTS_FILTER" + set -x + python -u "$GITHUB_WORKSPACE/scripts/testing/run_cities.py" -v \ + --color=always --timeout $CTS_TIMEOUT \ + -b "$GITHUB_WORKSPACE/test_conformance" \ + -L "$GITHUB_WORKSPACE/install_icd/lib" \ + -e "CLC_EXECUTABLE=$GITHUB_WORKSPACE/install_ock/bin/clc" \ + -e "OCL_ICD_FILENAMES=$GITHUB_WORKSPACE/install_ock/lib/libCL.so" \ + -e "CL_PLATFORM_INDEX=0" \ + -s "$GITHUB_WORKSPACE/test_conformance/$CTS_CSV_FILE" \ + -i "$GITHUB_WORKSPACE/source/cl/scripts/$CTS_FILTER" diff --git a/.github/patches/OpenCL-CTS-0001-Patch-sub-group-testing.patch b/.github/patches/OpenCL-CTS-0001-Patch-sub-group-testing.patch new file mode 100644 index 000000000..4c9ac9fdb --- /dev/null +++ b/.github/patches/OpenCL-CTS-0001-Patch-sub-group-testing.patch @@ -0,0 +1,34 @@ +From 3c250cfe63b7af59ce0141885596a426053fe669 Mon Sep 17 00:00:00 2001 +From: Fraser Cormack +Date: Mon, 30 Jan 2023 14:06:50 +0000 +Subject: [PATCH] Patch sub-group testing + +There's currently a bug in the CTS whereby our degenerate sub-groups +crash the test, which uses too small a fixed data structure to track all +work-items in a work-group larger than 128. + +While we wait for an official patch upstream, I've quickly patched it so +the data structure is as big as the largest local work-group size tested +by the tests. +--- + test_conformance/subgroups/subhelpers.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test_conformance/subgroups/subhelpers.h b/test_conformance/subgroups/subhelpers.h +index 8600088e..fafe35fe 100644 +--- a/test_conformance/subgroups/subhelpers.h ++++ b/test_conformance/subgroups/subhelpers.h +@@ -29,7 +29,8 @@ + #include + + extern MTdata gMTdata; +-typedef std::bitset<128> bs128; ++// See https://github.com/KhronosGroup/OpenCL-CTS/pull/1621 ++typedef std::bitset<200> bs128; + extern cl_half_rounding_mode g_rounding_mode; + + bs128 cl_uint4_to_bs128(cl_uint4 v); +-- +2.34.1 + + diff --git a/.github/patches/OpenCL-CTS-0002-Permit-building-for-unknown-architectures.patch b/.github/patches/OpenCL-CTS-0002-Permit-building-for-unknown-architectures.patch new file mode 100644 index 000000000..df37f4d16 --- /dev/null +++ b/.github/patches/OpenCL-CTS-0002-Permit-building-for-unknown-architectures.patch @@ -0,0 +1,98 @@ +From 4c1fa69fb30d94e5edb54d93364a332af0301b67 Mon Sep 17 00:00:00 2001 +From: Harald van Dijk +Date: Wed, 15 May 2024 17:57:47 +0100 +Subject: [PATCH] Permit building for unknown architectures. + +--- + CMakeLists.txt | 3 ++- + test_common/harness/fpcontrol.h | 6 +++--- + test_common/harness/rounding_mode.cpp | 5 +++-- + test_common/harness/testHarness.cpp | 3 ++- + 4 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cfef6b3..0e4dd1f2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -78,7 +78,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*") + endif() + + if(NOT DEFINED CLConform_TARGET_ARCH) +- message (FATAL_ERROR "Target architecture not recognised. Exiting.") ++ message (WARNING "Target architecture not recognised.") ++ set(CLConform_TARGET_ARCH unknown) + endif() + + macro(add_cxx_flag_if_supported flag) +diff --git a/test_common/harness/fpcontrol.h b/test_common/harness/fpcontrol.h +index 12aba0a9..c6f94140 100644 +--- a/test_common/harness/fpcontrol.h ++++ b/test_common/harness/fpcontrol.h +@@ -70,7 +70,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 + } + +@@ -98,7 +98,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 + } + +@@ -118,7 +118,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/test_common/harness/rounding_mode.cpp b/test_common/harness/rounding_mode.cpp +index 191c04d9..3100a225 100644 +--- a/test_common/harness/rounding_mode.cpp ++++ b/test_common/harness/rounding_mode.cpp +@@ -225,7 +225,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. +@@ -255,7 +256,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. +diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp +index 0e3c49e9..4c565cec 100644 +--- a/test_common/harness/testHarness.cpp ++++ b/test_common/harness/testHarness.cpp +@@ -1316,7 +1316,8 @@ void PrintArch(void) + #elif defined(__mips__) + vlog("ARCH:\tmips\n"); + #else +-#error unknown arch ++#warning unknown arch ++ vlog("ARCH:\tunknown\n"); + #endif + + #if defined(__APPLE__) +-- +2.43.0 + + diff --git a/.github/workflows/planned_testing.yml b/.github/workflows/planned_testing.yml index 2d456e44e..cc2c6737e 100644 --- a/.github/workflows/planned_testing.yml +++ b/.github/workflows/planned_testing.yml @@ -11,6 +11,10 @@ on: required: false type: boolean default: true + test_opencl_cts: + required: false + type: boolean + default: true target_list: required: false type: string @@ -65,8 +69,7 @@ jobs: llvm_version: ${{ inputs.llvm_version }} build_icd: - # Will also be required for opencl - if: inputs.test_tornado + if: inputs.test_tornado || inputs.test_opencl_cts needs: [workflow_vars] strategy: matrix: @@ -114,3 +117,35 @@ jobs: uses: ./.github/actions/run_tornado with: target: ${{ matrix.target }} + + # Currently only builds and runs (default: quick) on x86_64 linux + build_run_opencl_cts: + if: inputs.test_opencl_cts + needs: [ workflow_vars, build_icd, create_ock_artefacts ] + strategy: + matrix: + target: ${{ fromJson(inputs.target_list) }} + exclude: ${{ fromJson(needs.workflow_vars.outputs.matrix_only_linux_x86_64) }} + + # TODO: host-x86_64-linux only - expand for other targets + runs-on: ubuntu-22.04 + steps: + - name: clone ock + uses: actions/checkout@v4 + with: + # scripts: for run_cities.py + # source: for CTS filter.csv files + sparse-checkout: | + scripts + source + .github + # TODO: Consider separating out opencl_cts build and run in the future + - name : build and upload opencl_cts + uses: ./.github/actions/do_build_opencl_cts + with: + target: ${{ matrix.target }} + - name : run opencl_cts + uses: ./.github/actions/run_opencl_cts + with: + target: ${{ matrix.target }} + diff --git a/.github/workflows/planned_testing_caller.yml b/.github/workflows/planned_testing_caller.yml index 23e81af15..267b5c5fd 100644 --- a/.github/workflows/planned_testing_caller.yml +++ b/.github/workflows/planned_testing_caller.yml @@ -20,6 +20,7 @@ jobs: with: target_list: '["host_x86_64_linux", "host_aarch64_linux", "host_riscv64_linux", "host_i686_linux", "host_refsi_linux", "host_x86_64_windows" ]' test_tornado: true + test_opencl_cts: true # Have a pull request setting which can be used to test the flow as best as possible # in a reasonable time pull_request: ${{ github.event_name == 'pull_request' }}