From 30e50323c8d78605b65ea19ea124e7e735544d50 Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Wed, 11 Dec 2024 14:51:17 +0000 Subject: [PATCH] Add test unitcl using ock artefact --- .../actions/do_build_ock_artefact/action.yml | 24 ++++++++--- .github/workflows/codeql.yml | 6 +-- .github/workflows/planned_testing.yml | 42 +++++++++++++++++++ .github/workflows/planned_testing_caller.yml | 11 +++-- 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/.github/actions/do_build_ock_artefact/action.yml b/.github/actions/do_build_ock_artefact/action.yml index 2c7f128a9..f92771d85 100644 --- a/.github/actions/do_build_ock_artefact/action.yml +++ b/.github/actions/do_build_ock_artefact/action.yml @@ -9,6 +9,9 @@ inputs: default: '19' target: description: 'target architecture' + create_ock_artefact_method: + description: 'method of creating ock artefact - build,' + default: "build" # TODO: This has not been tested yet on windows so would likely need some updating. runs: @@ -29,21 +32,23 @@ runs: # installs tools, ninja, installs llvm and sets up sccache - name: setup uses: ./.github/actions/setup_build + if: inputs.create_ock_artefact_method == 'build' with: llvm_version: ${{ inputs.llvm_version }} llvm_build_type: RelAssert cross_arch: ${{ steps.calc_vars.outputs.arch == 'x86_64' && 'none' || steps.calc_vars.outputs.arch }} - name: build ock x86 - if: steps.calc_vars.outputs.arch == 'x86_64' + if: steps.calc_vars.outputs.arch == 'x86_64' && inputs.create_ock_artefact_method == 'build' uses: ./.github/actions/do_build_ock with: build_targets: install offline_kernel_tests: OFF - extra_flags: -DCA_ENABLE_TESTS=OFF -DCA_ENABLE_EXAMPLES=OFF -DCA_ENABLE_DOCUMENTATION=OFF + # Todo: allow tests or no tests via a flag. + extra_flags: -DCA_ENABLE_EXAMPLES=OFF -DCA_ENABLE_DOCUMENTATION=OFF - name: build ock other ${{ matrix.target }} - if: steps.calc_vars.outputs.arch != 'x86_64' + if: steps.calc_vars.outputs.arch != 'x86_64' && inputs.create_ock_artefact_method == 'build' uses: ./.github/actions/do_build_ock with: build_targets: install @@ -53,6 +58,13 @@ runs: offline_kernel_tests: OFF host_fp16: ON + - name: download previous ock if needed ${{ matrix.target }} ${{ matrix.create_ock_artefact_method}} + shell: bash + if: inputs.create_ock_artefact_method != 'build' + run: | + gh run download ${{ inputs.create_ock_artefact_method }} -n ock_${{ inputs.target }} -D install + ls install + # Prune it as there is too much things in there we don't want to use # Todo: move this logic to cmake settings so that we build only what we # want to install. As time goes on we may want to install more. @@ -60,12 +72,12 @@ runs: shell: bash run: | # 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 + find install/bin -maxdepth 1 -type f -and ! \( -name "*.py" -o -name "*clc" -o -name "*UnitCL*" \) -delete + # rm -rf install/share - name: upload ock artefact uses: actions/upload-artifact@v4 with: name: ock_${{ inputs.target }} path: install - retention-days: 1 + retention-days: 3 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 969248aa1..fc2c9ed54 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,9 +4,9 @@ on: push: branches: - main - pull_request: - branches: - - main + # pull_request: + # branches: + # - main paths: - 'source/**' - 'clik/**' diff --git a/.github/workflows/planned_testing.yml b/.github/workflows/planned_testing.yml index cc2c6737e..dc1be7865 100644 --- a/.github/workflows/planned_testing.yml +++ b/.github/workflows/planned_testing.yml @@ -26,6 +26,16 @@ on: required: false type: boolean default: false + test_ock_artefact_unitcl: + # UnitCL testing via an ock artefact (i.e. not standalone) + required: false + type: boolean + default: true + create_ock_artefact_method: + # How to create the ock artefact + required: false + type: string + default: "build" jobs: @@ -35,6 +45,7 @@ jobs: runs-on: ubuntu-22.04 outputs: matrix_only_linux_x86_64_aarch64: ${{ steps.vars.outputs.matrix_only_linux_x86_64_aarch64 }} + matrix_only_linux_aarch64: ${{ steps.vars.outputs.matrix_only_linux_aarch64 }} matrix_only_linux_x86_64: ${{ steps.vars.outputs.matrix_only_linux_x86_64 }} steps: - id: vars @@ -42,6 +53,7 @@ jobs: # These variables are for excluding certain targets from the total list, which is why just including # two targets is a long list of excludes run: | + echo matrix_only_linux_aarch64="[ {\"target\": \"host_x86_64_linux\"}, {\"target\": \"host_arm_linux\"}, {\"target\": \"host_riscv64_linux\"}, {\"target\": \"host_refsi_linux\"}, {\"target\": \"host_i686_linux\"}, {\"target\": \"host_x86_64_windows\"}]" >> $GITHUB_OUTPUT echo matrix_only_linux_x86_64_aarch64="[ {\"target\": \"host_arm_linux\"}, {\"target\": \"host_riscv64_linux\"}, {\"target\": \"host_refsi_linux\"}, {\"target\": \"host_i686_linux\"}, {\"target\": \"host_x86_64_windows\"}]" >> $GITHUB_OUTPUT echo matrix_only_linux_x86_64="[ {\"target\": \"host_aarch64_linux\"}, {\"target\": \"host_riscv64_linux\"}, {\"target\": \"host_arm_linux\"}, {\"target\": \"host_refsi_linux\"}, {\"target\": \"host_i686_linux\"}, {\"target\": \"host_x86_64_windows\"}]" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT @@ -62,11 +74,21 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 + - name: set up secret ubuntu + if: !startsWith(runner.os, 'Windows') + run: + echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV + - name: set up secret windows + if: startsWith(runner.os, 'Windows') + run: + echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $env:GITHUB_ENV + - name: build ock artefact uses: ./.github/actions/do_build_ock_artefact with: target: ${{ matrix.target }} llvm_version: ${{ inputs.llvm_version }} + create_ock_artefact_method: ${{ inputs.create_ock_artefact_method }} build_icd: if: inputs.test_tornado || inputs.test_opencl_cts @@ -149,3 +171,23 @@ jobs: with: target: ${{ matrix.target }} + test_unitcl_ock_artefact: + if: inputs.test_ock_artefact_unitcl + needs: [workflow_vars, create_ock_artefacts ] + strategy: + matrix: + target: ${{ fromJson(inputs.target_list) }} + exclude: ${{ fromJson(needs.workflow_vars.outputs.matrix_only_linux_x86_64) }} + runs-on: ubuntu-22.04 + # TODO: Look into running on aarch64/riscv64 (and aarch64 hardware) + steps: + - name: Download ock artefact + uses: actions/download-artifact@v4 + with: + name: ock_${{matrix.target}} + path: install_ock + - name: run unitcl + # chmod +x here since archiving removes execute permissions + run: + chmod +x ./install_ock/bin/UnitCL; + LD_LIBRARY_PATH=$PWD/install_ock/lib OCL_ICD_FILENAMES=$PWD/install_ock/lib/libCL.so ./install_ock/bin/UnitCL --gtest_filter=Exec*Task_01_02* diff --git a/.github/workflows/planned_testing_caller.yml b/.github/workflows/planned_testing_caller.yml index 267b5c5fd..86d0cb069 100644 --- a/.github/workflows/planned_testing_caller.yml +++ b/.github/workflows/planned_testing_caller.yml @@ -18,9 +18,14 @@ jobs: if: github.repository == 'uxlfoundation/oneapi-construction-kit' || github.event_name != 'schedule' uses: ./.github/workflows/planned_testing.yml 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 + # target_list: '["host_x86_64_linux", "host_aarch64_linux", "host_riscv64_linux", "host_i686_linux", "host_refsi_linux", "host_x86_64_windows" ]' + target_list: '["host_x86_64_linux" ]' + # test_tornado: true + # test_opencl_cts: true + test_opencl_cts: false + test_tornado: false + test_ock_artefact_unitcl: 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' }} + create_ock_artefact_method: 12282430965