Add validation for CL_IMAGE_ROW_PITCH and CL_IMAGE_SLICE_PITCH query results #4753
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Presubmit | |
| on: [push, pull_request] | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.os }} ${{ matrix.arch }}${{ matrix.extra }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build-type: [Release] | |
| gl: [0] | |
| os: [ubuntu-22.04, macos-latest, windows-latest, windows-11-arm] | |
| include: | |
| - os: ubuntu-22.04 | |
| gl: 1 | |
| extra: " gl" | |
| - os: ubuntu-22.04 | |
| arch: arm | |
| - os: ubuntu-22.04 | |
| arch: aarch64 | |
| build-type: Debug | |
| extra: " debug" | |
| - os: ubuntu-22.04 | |
| arch: android-arm | |
| android_arch_abi: armeabi-v7a | |
| - os: ubuntu-22.04 | |
| arch: android-aarch64 | |
| android_arch_abi: arm64-v8a | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Ninja | |
| uses: seanmiddleditch/gha-setup-ninja@master | |
| - name: Install Arm and AArch64 compilers | |
| if: ${{ matrix.arch == 'arm' || matrix.arch == 'aarch64' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| gcc-12-arm-linux-gnueabihf g++-12-arm-linux-gnueabihf \ | |
| gcc-12-aarch64-linux-gnu g++-12-aarch64-linux-gnu | |
| sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-12 12 | |
| sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-12 12 | |
| sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-12 12 | |
| sudo update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-12 12 | |
| - name: Setup OpenGL build dependencies | |
| if: ${{ matrix.gl }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y install libglu1-mesa-dev freeglut3-dev mesa-common-dev libglew-dev | |
| - name: Setup MSVC with Ninja | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Setup ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| variant: sccache | |
| key: ${{ matrix.os }}-${{ matrix.arch }} | |
| - name: Fetch OpenCL Headers | |
| shell: bash | |
| run: | | |
| git clone https://github.com/KhronosGroup/OpenCL-Headers.git | |
| cd OpenCL-Headers | |
| ln -s CL OpenCL # For OSX builds | |
| cd .. | |
| - name: Fetch SPIR-V Headers | |
| shell: bash | |
| run: | | |
| git clone https://github.com/KhronosGroup/SPIRV-Headers.git | |
| - name: Install Vulkan SDK | |
| uses: humbletim/install-vulkan-sdk@main | |
| with: | |
| version: 1.4.309.0 | |
| cache: true | |
| - name: Install Android NDK | |
| if: ${{ matrix.arch == 'android-arm' || matrix.arch == 'android-aarch64' }} | |
| run: | | |
| wget https://dl.google.com/android/repository/android-ndk-r28c-linux.zip -O android-ndk.zip | |
| unzip android-ndk.zip -d $HOME | |
| export ANDROID_NDK=$HOME/android-ndk-r28c | |
| echo "ANDROID_NDK=$ANDROID_NDK" >> $GITHUB_ENV | |
| export ANDROID_ARCH_ABI=${{ matrix.android_arch_abi }} | |
| echo "ANDROID_ARCH_ABI=$ANDROID_ARCH_ABI" >> $GITHUB_ENV | |
| echo "ANDROID_PLATFORM=29" >> $GITHUB_ENV | |
| - name: Prepare CMake Toolchain file | |
| shell: bash | |
| run: | | |
| if [[ '${{ matrix.arch }}' == android-* ]]; then | |
| TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake | |
| else | |
| TOOLCHAIN_FILE='${{ github.workspace }}'/toolchain.cmake | |
| touch ${TOOLCHAIN_FILE} | |
| fi | |
| TOOLCHAIN_PREFIX_arm=arm-linux-gnueabihf | |
| TOOLCHAIN_PREFIX_aarch64=aarch64-linux-gnu | |
| if [[ '${{ matrix.arch }}' != android-* ]]; then | |
| if [[ '${{ matrix.arch }}' != "" && ${RUNNER_OS} != "Windows" ]]; then | |
| TOOLCHAIN_PREFIX_VAR=TOOLCHAIN_PREFIX_${{ matrix.arch }} | |
| TOOLCHAIN_PREFIX=${!TOOLCHAIN_PREFIX_VAR} | |
| echo "SET(CMAKE_SYSTEM_NAME Linux)" >> ${TOOLCHAIN_FILE} | |
| echo "SET(CMAKE_SYSTEM_PROCESSOR ${{ matrix.arch }})" >> ${TOOLCHAIN_FILE} | |
| echo "SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)" >> ${TOOLCHAIN_FILE} | |
| echo "SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)" >> ${TOOLCHAIN_FILE} | |
| echo "SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)" >> ${TOOLCHAIN_FILE} | |
| echo "SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> ${TOOLCHAIN_FILE} | |
| echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> ${TOOLCHAIN_FILE} | |
| fi | |
| fi | |
| echo "TOOLCHAIN_FILE=${TOOLCHAIN_FILE}" >> $GITHUB_ENV | |
| - name: Prepare Android CMake arguments | |
| if: ${{ matrix.arch == 'android-arm' || matrix.arch == 'android-aarch64' }} | |
| shell: bash | |
| run: | | |
| echo "CMAKE_ADDITIONAL_CONFIG_ARGS=-DCMAKE_ANDROID_ARCH_ABI=${ANDROID_ARCH_ABI} -DANDROID_PLATFORM=${ANDROID_PLATFORM}" >> $GITHUB_ENV | |
| - name: Fetch and build OpenCL ICD Loader | |
| shell: bash | |
| run: | | |
| git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git | |
| cd OpenCL-ICD-Loader | |
| mkdir build | |
| cd build | |
| cmake .. -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ | |
| -DOPENCL_ICD_LOADER_HEADERS_DIR='${{ github.workspace }}'/OpenCL-Headers/ \ | |
| ${CMAKE_ADDITIONAL_CONFIG_ARGS} | |
| cmake --build . --parallel | |
| - name: Fetch Vulkan Headers | |
| shell: bash | |
| run: | | |
| git clone https://github.com/KhronosGroup/Vulkan-Headers.git | |
| - name: Fetch and build Vulkan Loader | |
| if: ${{ matrix.arch != 'android-arm' && matrix.arch != 'android-aarch64' }} | |
| shell: bash | |
| run: | | |
| git clone https://github.com/KhronosGroup/Vulkan-Loader.git | |
| cd Vulkan-Loader | |
| mkdir build | |
| cd build | |
| python3 ../scripts/update_deps.py | |
| cmake .. -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ | |
| -DBUILD_WSI_XLIB_SUPPORT=OFF \ | |
| -DBUILD_WSI_XCB_SUPPORT=OFF \ | |
| -DBUILD_WSI_WAYLAND_SUPPORT=OFF \ | |
| -C helper.cmake .. | |
| cmake --build . --parallel | |
| - name: Configure and build | |
| shell: bash | |
| run: | | |
| mkdir build | |
| cd build | |
| if [[ ${RUNNER_OS} == "Windows" ]]; then | |
| CMAKE_OPENCL_LIBRARIES_OPTION="OpenCL" | |
| CMAKE_ADDITIONAL_CONFIG_ARGS="-DD3D10_IS_SUPPORTED=ON -DD3D11_IS_SUPPORTED=ON" | |
| else | |
| CMAKE_OPENCL_LIBRARIES_OPTION="-lOpenCL" | |
| if [[ '${{ matrix.arch }}' != android-* ]]; then | |
| CMAKE_OPENCL_LIBRARIES_OPTION="${CMAKE_OPENCL_LIBRARIES_OPTION} -lpthread" | |
| fi | |
| fi | |
| cmake .. -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ | |
| -DCMAKE_C_COMPILER_LAUNCHER=sccache \ | |
| -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ | |
| -DCL_INCLUDE_DIR='${{ github.workspace }}'/OpenCL-Headers \ | |
| -DSPIRV_INCLUDE_DIR='${{ github.workspace }}'/SPIRV-Headers \ | |
| -DCL_LIB_DIR='${{ github.workspace }}'/OpenCL-ICD-Loader/build \ | |
| -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \ | |
| -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=./bin \ | |
| -DOPENCL_LIBRARIES="${CMAKE_OPENCL_LIBRARIES_OPTION}" \ | |
| -DUSE_CL_EXPERIMENTAL=ON \ | |
| -DGL_IS_SUPPORTED=${{ matrix.gl }} \ | |
| -DVULKAN_IS_SUPPORTED=ON \ | |
| -DVULKAN_INCLUDE_DIR='${{ github.workspace }}'/Vulkan-Headers/include/ \ | |
| -DVULKAN_LIB_DIR='${{ github.workspace }}'/Vulkan-Loader/build/loader/ \ | |
| ${CMAKE_ADDITIONAL_CONFIG_ARGS} | |
| cmake --build . --parallel | |
| tests: | |
| name: Run Tests (pocl) | |
| runs-on: ubuntu-24.04 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Parse triggers | |
| id: check_triggers | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| MESSAGES=$(gh api -X GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/commits --jq '.[].commit.message') | |
| PR_BODY=$(gh api -X GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} --jq '.body') | |
| COMMANDS=$(echo -e "$MESSAGES\n$PR_BODY" | grep -oP '^\[run-tests?:\s*\K[^\]]+' | sort -u || true) | |
| if [ -z "$COMMANDS" ]; then | |
| echo "No '[run-test: ...]' triggers found. Skipping job." | |
| echo "run_tests=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Found the following test triggers:" | |
| echo "$COMMANDS" | |
| echo "run_tests=true" >> $GITHUB_OUTPUT | |
| echo "$COMMANDS" > test_commands.txt | |
| fi | |
| - name: Environment variables | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| run: | | |
| echo "pocl=$(realpath ${{ github.workspace }}/../pocl)" >> $GITHUB_ENV | |
| echo "loader=$(realpath ${{ github.workspace }}/../loader)" >> $GITHUB_ENV | |
| echo "cl-headers=$(realpath ${{ github.workspace }}/../cl-headers)" >> $GITHUB_ENV | |
| echo "spv-headers=$(realpath ${{ github.workspace }}/../spv-headers)" >> $GITHUB_ENV | |
| - name: Clone Headers | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| run: | | |
| git clone --depth 1 https://github.com/KhronosGroup/OpenCL-Headers.git ${{ env.cl-headers }} | |
| git clone --depth 1 https://github.com/KhronosGroup/SPIRV-Headers.git ${{ env.spv-headers }} | |
| - name: Setup Ninja | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| uses: seanmiddleditch/gha-setup-ninja@master | |
| - name: Install Vulkan SDK | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| uses: humbletim/install-vulkan-sdk@main | |
| with: | |
| version: 1.4.309.0 | |
| cache: true | |
| - name: Install pocl dependencies | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| run: | | |
| sudo apt-get update | |
| export LLVM_VERSION=20 | |
| sudo apt-get install -y \ | |
| python3-dev libpython3-dev build-essential ocl-icd-libopencl1 \ | |
| cmake git pkg-config libclang-${LLVM_VERSION}-dev clang-${LLVM_VERSION} \ | |
| llvm-${LLVM_VERSION} make ninja-build ocl-icd-libopencl1 ocl-icd-dev \ | |
| ocl-icd-opencl-dev libhwloc-dev zlib1g zlib1g-dev clinfo dialog apt-utils \ | |
| libxml2-dev libclang-cpp${LLVM_VERSION}-dev libclang-cpp${LLVM_VERSION} \ | |
| llvm-${LLVM_VERSION}-dev | |
| - name: Cache pocl | |
| id: cache-pocl | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.pocl }} | |
| key: ubuntu-24.04-pocl-v7.1 | |
| - name: Build pocl | |
| if: steps.check_triggers.outputs.run_tests == 'true' && steps.cache-pocl.outputs.cache-hit != 'true' | |
| run: | | |
| git clone --depth 1 --branch v7.1 https://github.com/pocl/pocl.git | |
| cmake -B pocl/build -S pocl -G Ninja \ | |
| -DCMAKE_INSTALL_PREFIX=${{ env.pocl }} \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DDKERNELLIB_HOST_CPU_VARIANTS=distro \ | |
| -DENABLE_ICD=ON | |
| cmake --build pocl/build | |
| cmake --install pocl/build | |
| - name: Build loader | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| shell: bash | |
| run: | | |
| git clone --depth 1 https://github.com/KhronosGroup/OpenCL-ICD-Loader.git | |
| cmake -B OpenCL-ICD-Loader/build -S OpenCL-ICD-Loader -G Ninja \ | |
| -DCMAKE_INSTALL_PREFIX=${{ env.loader }} \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DOPENCL_ICD_LOADER_HEADERS_DIR='${{ env.cl-headers }}' | |
| cmake --build OpenCL-ICD-Loader/build | |
| cmake --install OpenCL-ICD-Loader/build | |
| - name: Build OpenCL CTS | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| shell: bash | |
| run: | | |
| cmake -B build -S . -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCL_INCLUDE_DIR='${{ env.cl-headers }}' \ | |
| -DCL_LIB_DIR=${{ env.loader }}/lib \ | |
| -DSPIRV_INCLUDE_DIR='${{ env.spv-headers }}' \ | |
| -DCMAKE_RUNTIME_OUTPUT_DIRECTORY='${{ github.workspace }}'/bin \ | |
| -DOPENCL_LIBRARIES="-lOpenCL -lpthread" \ | |
| -DUSE_CL_EXPERIMENTAL=ON \ | |
| -DGL_IS_SUPPORTED=OFF \ | |
| -DVULKAN_IS_SUPPORTED=OFF | |
| cmake --build build | |
| - name: Run tests | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| shell: bash | |
| run: | | |
| export OCL_ICD_ENABLE_TRACE=1 | |
| export OCL_ICD_VENDORS=${{ env.pocl }}/etc/OpenCL/vendors | |
| export LD_LIBRARY_PATH=${{ env.loader }}/lib:$LD_LIBRARY_PATH | |
| mkdir -p test_results | |
| while IFS= read -r cmd; do | |
| if [ -n "$cmd" ]; then | |
| SAFE_NAME=$(echo "$cmd" | sed -e 's/[^A-Za-z0-9._-]/_/g') | |
| RESULT_FILE="test_results/${SAFE_NAME}.json" | |
| export CL_CONFORMANCE_RESULTS_FILENAME="$RESULT_FILE" | |
| echo "==================================================" | |
| echo "Executing: ./$cmd" | |
| echo "Writing JSON result to: $RESULT_FILE" | |
| echo "==================================================" | |
| ./bin/$cmd || true | |
| cat ${RESULT_FILE} | |
| fi | |
| done < test_commands.txt | |
| - name: Check results | |
| if: steps.check_triggers.outputs.run_tests == 'true' | |
| shell: bash | |
| run: | | |
| ls test_results | |
| python3 ./ci/compare_results.py \ | |
| --golden ./ci/pocl/golden.json \ | |
| --results-dir test_results/ | |
| formatcheck: | |
| name: Check code format | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Install packages | |
| run: sudo apt install -y clang-format clang-format-14 | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check code format | |
| run: ./check-format.sh |