diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml index e356e0bdb4..9cf5c655b8 100644 --- a/.github/workflows/bandit.yml +++ b/.github/workflows/bandit.yml @@ -1,25 +1,25 @@ -# Runs bandit security checker for code written in Python. -name: Bandit - -on: [push, pull_request, workflow_dispatch] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - linux: - name: Bandit - runs-on: ubuntu-latest - - steps: - - name: Clone the git repo - uses: actions/checkout@v3 - - - name: Install pip packages - run: pip install -r third_party/requirements.txt - - # Scan is run only for the 'tools' folder. - - name: Run Bandit - run: | - bandit -r tools +## Runs bandit security checker for code written in Python. +#name: Bandit +# +#on: [push, pull_request, workflow_dispatch] +# +#concurrency: +# group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} +# cancel-in-progress: true +# +#jobs: +# linux: +# name: Bandit +# runs-on: ubuntu-latest +# +# steps: +# - name: Clone the git repo +# uses: actions/checkout@v3 +# +# - name: Install pip packages +# run: pip install -r third_party/requirements.txt +# +# # Scan is run only for the 'tools' folder. +# - name: Run Bandit +# run: | +# bandit -r tools diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 780f142f33..cf5af54747 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -7,170 +7,18 @@ concurrency: cancel-in-progress: true jobs: - ubuntu-build: - name: Build - Ubuntu - strategy: - matrix: - os: ['ubuntu-20.04', 'ubuntu-22.04'] - build_type: [Debug, Release] - compiler: [{c: gcc, cxx: g++}] - libbacktrace: ['-DVAL_USE_LIBBACKTRACE_BACKTRACE=OFF'] - pool_tracking: ['-DUMF_ENABLE_POOL_TRACKING=ON', '-DUMF_ENABLE_POOL_TRACKING=OFF'] - include: - - os: 'ubuntu-22.04' - build_type: Release - compiler: {c: clang, cxx: clang++} - libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=OFF' - - os: 'ubuntu-22.04' - build_type: Release - compiler: {c: gcc, cxx: g++} - libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON' - - os: 'ubuntu-22.04' - build_type: Release - compiler: {c: clang, cxx: clang++} - libbacktrace: '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON' - - os: 'ubuntu-20.04' - build_type: Release - compiler: {c: gcc-7, cxx: g++-7} - - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v3 - - - name: Install apt packages - run: | - sudo apt-get update - sudo apt-get install -y doxygen ${{matrix.compiler.c}} - - - name: Install g++-7 - if: matrix.compiler.cxx == 'g++-7' - run: | - sudo apt-get install -y ${{matrix.compiler.cxx}} - - - name: Install pip packages - run: pip install -r third_party/requirements.txt - - - name: Install libbacktrace - if: matrix.libbacktrace == '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON' - run: | - git clone https://github.com/ianlancetaylor/libbacktrace.git - cd libbacktrace - ./configure - make - sudo make install - cd .. - - - name: Download DPC++ - if: matrix.os == 'ubuntu-22.04' - run: | - sudo apt install libncurses5 - wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz - mkdir -p ${{github.workspace}}/dpcpp_compiler - tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C ${{github.workspace}}/dpcpp_compiler - - - name: Configure CMake - if: matrix.os == 'ubuntu-22.04' - run: > - cmake - -B${{github.workspace}}/build - -DCMAKE_C_COMPILER=${{matrix.compiler.c}} - -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} - -DUR_ENABLE_TRACING=ON - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DUR_BUILD_TESTS=ON - -DUR_FORMAT_CPP_STYLE=ON - -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ - ${{matrix.libbacktrace}} - ${{matrix.pool_tracking}} - - - name: Configure CMake - if: matrix.os == 'ubuntu-20.04' - run: > - cmake - -B${{github.workspace}}/build - -DCMAKE_C_COMPILER=${{matrix.compiler.c}} - -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} - -DUR_ENABLE_TRACING=ON - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DUR_BUILD_TESTS=ON - -DUR_FORMAT_CPP_STYLE=ON - ${{matrix.libbacktrace}} - ${{matrix.pool_tracking}} - - - name: Generate source from spec, check for uncommitted diff - if: matrix.os == 'ubuntu-22.04' - run: cmake --build ${{github.workspace}}/build --target check-generated - - - name: Verify that each source file contains a license - run: cmake --build ${{github.workspace}}/build --target verify-licenses - - - name: Build - run: cmake --build ${{github.workspace}}/build -j $(nproc) - - - name: Test - working-directory: ${{github.workspace}}/build - run: ctest -C ${{matrix.build_type}} --output-on-failure -L "python|umf|loader|validation|tracing|unit|urtrace" - - fuzztest-build: - name: Build and run quick fuzztest scenarios - strategy: - matrix: - build_type: [Debug, Release] - compiler: [{c: clang, cxx: clang++}] - - runs-on: 'ubuntu-22.04' - - steps: - - uses: actions/checkout@v3 - - - name: Install pip packages - run: pip install -r third_party/requirements.txt - - - name: Download DPC++ - run: | - sudo apt install libncurses5 - wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz - tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz - - - name: Setup DPC++ - run: | - source ${{github.workspace}}/dpcpp_compiler/startup.sh - - - name: Configure CMake - run: > - cmake - -B${{github.workspace}}/build - -DCMAKE_C_COMPILER=${{matrix.compiler.c}} - -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} - -DUR_ENABLE_TRACING=ON - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DUR_BUILD_TESTS=ON - -DUR_USE_ASAN=ON - -DUR_USE_UBSAN=ON - -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ - - - name: Build - run: cmake --build ${{github.workspace}}/build -j $(nproc) - - - name: Fuzz test - working-directory: ${{github.workspace}}/build - run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-short" - adapter-build-hw: name: Build - Adapters on HW if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW strategy: matrix: adapter: [ - {name: CUDA, triplet: nvptx64-nvidia-cuda}, - {name: HIP, triplet: amdgcn-amd-amdhsa}, - {name: L0, triplet: spir64} + {name: OPENCL, runner: OPENCL, platform: "Intel(R) OpenCL", triplet: spir64} ] - build_type: [Debug, Release] - compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}] + build_type: [Release] + compiler: [{c: clang, cxx: clang++}] - runs-on: ${{matrix.adapter.name}} + runs-on: ${{matrix.adapter.runner}} steps: - uses: actions/checkout@v3 @@ -178,6 +26,25 @@ jobs: - name: Install pip packages run: pip install -r third_party/requirements.txt +# mkdir intel-ocl-packages +# cd intel-ocl-packages +# wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.14828.8/intel-igc-core_1.0.14828.8_amd64.deb +# wget https://github.com/intel/intel-graphics-compiler/releases/download/igc-1.0.14828.8/intel-igc-opencl_1.0.14828.8_amd64.deb +# wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-level-zero-gpu-dbgsym_1.3.26918.9_amd64.ddeb +# wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-level-zero-gpu_1.3.26918.9_amd64.deb +# wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-opencl-icd-dbgsym_23.30.26918.9_amd64.ddeb +# wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/intel-opencl-icd_23.30.26918.9_amd64.deb +# wget https://github.com/intel/compute-runtime/releases/download/23.30.26918.9/libigdgmm12_22.3.0_amd64.deb + #cat /etc/OpenCL/vendors/intel.icd + #ls /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so +# sudo dpkg -i *.deb + - name: Install OpenCL + if: matrix.adapter.name == 'OPENCL' + run: | + lscpu + echo "CLINFO:" + clinfo + - name: Download DPC++ run: | wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz @@ -198,8 +65,6 @@ jobs: -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ -DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib -DUR_CONFORMANCE_TARGET_TRIPLES=${{matrix.adapter.triplet}} - ${{ matrix.adapter.name == 'HIP' && '-DAMD_ARCH=gfx1030' || '' }} - ${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }} - name: Build # This is so that device binaries can find the sycl runtime library @@ -219,139 +84,5 @@ jobs: - name: Test adapters if: matrix.adapter.name != 'L0' working-directory: ${{github.workspace}}/build - run: ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180 - - examples-build-hw: - name: Build - examples on HW - if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW - strategy: - matrix: - adapter: [ - {name: L0} - ] - build_type: [Debug, Release] - compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}] - - runs-on: ${{matrix.adapter.name}} - - steps: - - uses: actions/checkout@v3 + run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180 - - name: Install pip packages - run: pip install -r third_party/requirements.txt - - - name: Init conda env - uses: conda-incubator/setup-miniconda@v2 - with: - miniconda-version: "latest" - activate-environment: examples - environment-file: third_party/deps.yml - auto-activate-base: false - - - name: Configure CMake - shell: bash -el {0} - run: > - cmake - -B${{github.workspace}}/build - -DCMAKE_C_COMPILER=${{matrix.compiler.c}} - -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} - -DCMAKE_BUILD_TYPE=${{matrix.build_type}} - -DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON - -DUR_BUILD_EXAMPLE_CODEGEN=ON - -DUR_DEVELOPER_MODE=ON - - - name: Build - run: cmake --build ${{github.workspace}}/build -j $(nproc) - - - name: Test codegen example - working-directory: ${{github.workspace}}/build - run: bin/codegen - - # conda init adds content to user's profile making it failing (if conda is gone) - - name: Cleanup after conda init - run: | - cat ${HOME}/.profile || true - rm ${HOME}/.profile || true - - windows-build: - name: Build - Windows - strategy: - matrix: - os: ['windows-2019', 'windows-2022'] - adapter: [ - {name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} - ] - - # TODO: building level zero loader on windows-2019 is currently broken - exclude: - - os: 'windows-2019' - adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} - build_type: [Debug, Release] - compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}] - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install prerequisites - run: python3 -m pip install -r third_party/requirements.txt - - - name: Configure CMake - run: > - cmake - -B${{github.workspace}}/build - -DCMAKE_C_COMPILER=${{matrix.compiler.c}} - -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} - -DCMAKE_POLICY_DEFAULT_CMP0094=NEW - -DUR_ENABLE_TRACING=ON - -DUR_DEVELOPER_MODE=ON - -DUR_BUILD_TESTS=ON - -DUR_FORMAT_CPP_STYLE=ON - ${{matrix.adapter.var}} - - # TODO: re-enable when check-generated is fixed for windows runners see #888 - # - name: Generate source from spec, check for uncommitted diff - # if: matrix.os == 'windows-2022' - # run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}} - - - name: Build all - run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j 2 - - - name: Test - working-directory: ${{github.workspace}}/build - run: ctest -C ${{matrix.build_type}} --output-on-failure -L "python|umf|loader|validation|tracing|unit|urtrace" - - - macos-build: - name: Build - MacOS - strategy: - matrix: - os: ['macos-12', 'macos-13'] - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install prerequisites - run: python3 -m pip install -r third_party/requirements.txt - - - name: Configure CMake - run: > - cmake - -B${{github.workspace}}/build - -DUR_ENABLE_TRACING=ON - -DUR_DEVELOPER_MODE=ON - -DCMAKE_BUILD_TYPE=Release - -DUR_BUILD_TESTS=ON - -DUR_FORMAT_CPP_STYLE=ON - -DUMF_ENABLE_POOL_TRACKING=ON - - name: Build - run: cmake --build ${{github.workspace}}/build -j $(nproc) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bf312be396..eacd520520 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,68 +1,68 @@ -name: "CodeQL" - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - analyze-ubuntu: - name: Analyze on Ubuntu - runs-on: ubuntu-latest - permissions: - security-events: write - - strategy: - fail-fast: false - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: cpp, python - - - name: Install pip packages - run: pip install -r third_party/requirements.txt - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON - - - name: Build - run: cmake --build ${{github.workspace}}/build -j $(nproc) - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - - analyze-windows: - name: Analyze on Windows - runs-on: windows-latest - permissions: - security-events: write - - strategy: - fail-fast: false - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: cpp, python - - - name: Install pip packages - run: python3 -m pip install -r third_party/requirements.txt - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON - - - name: Build - run: cmake --build ${{github.workspace}}/build -j $(nproc) --config Release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 +#name: "CodeQL" +# +#on: [push, pull_request] +# +#concurrency: +# group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} +# cancel-in-progress: true +# +#jobs: +# analyze-ubuntu: +# name: Analyze on Ubuntu +# runs-on: ubuntu-latest +# permissions: +# security-events: write +# +# strategy: +# fail-fast: false +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Initialize CodeQL +# uses: github/codeql-action/init@v2 +# with: +# languages: cpp, python +# +# - name: Install pip packages +# run: pip install -r third_party/requirements.txt +# +# - name: Configure CMake +# run: cmake -B ${{github.workspace}}/build -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON +# +# - name: Build +# run: cmake --build ${{github.workspace}}/build -j $(nproc) +# +# - name: Perform CodeQL Analysis +# uses: github/codeql-action/analyze@v2 +# +# analyze-windows: +# name: Analyze on Windows +# runs-on: windows-latest +# permissions: +# security-events: write +# +# strategy: +# fail-fast: false +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v3 +# +# - name: Initialize CodeQL +# uses: github/codeql-action/init@v2 +# with: +# languages: cpp, python +# +# - name: Install pip packages +# run: python3 -m pip install -r third_party/requirements.txt +# +# - name: Configure CMake +# run: cmake -B ${{github.workspace}}/build -DCMAKE_POLICY_DEFAULT_CMP0094=NEW -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_ENABLE_TRACING=ON -DUR_BUILD_TOOLS=ON -DUMF_ENABLE_POOL_TRACKING=ON +# +# - name: Build +# run: cmake --build ${{github.workspace}}/build -j $(nproc) --config Release +# +# - name: Perform CodeQL Analysis +# uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index de327f92c7..135e4a61b1 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -1,45 +1,45 @@ +## +## Copyright (C) 2023 Intel Corporation +## +## Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +## See LICENSE.TXT +## SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +## +#name: coverity-unified-runtime +## It runs static analysis build - Coverity. It requires special token (set in CI's secret). # -# Copyright (C) 2023 Intel Corporation +#on: +# push: +# branches: ["main"] +# workflow_dispatch: # -# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. -# See LICENSE.TXT -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#env: +# WORKDIR: ${{ github.workspace }} +# COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }} +# COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} +# COVERITY_SCAN_PROJECT_NAME: ${{ github.repository }} +# COVERITY_SCAN_BUILD_COMMAND: "cmake --build ${{github.workspace}}/build" +# COVERITY_SCAN_BRANCH_PATTERN: "main" +# TRAVIS_BRANCH: ${{ github.ref_name }} # -name: coverity-unified-runtime -# It runs static analysis build - Coverity. It requires special token (set in CI's secret). - -on: - push: - branches: ["main"] - workflow_dispatch: - -env: - WORKDIR: ${{ github.workspace }} - COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }} - COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} - COVERITY_SCAN_PROJECT_NAME: ${{ github.repository }} - COVERITY_SCAN_BUILD_COMMAND: "cmake --build ${{github.workspace}}/build" - COVERITY_SCAN_BRANCH_PATTERN: "main" - TRAVIS_BRANCH: ${{ github.ref_name }} - -jobs: - linux: - name: Coverity - runs-on: ubuntu-latest - - steps: - - name: Clone the git repo - uses: actions/checkout@v3 - - - name: Install pip packages - run: pip install -r third_party/requirements.txt - - - name: Configure CMake - run: cmake -B $WORKDIR/build -DUR_ENABLE_TRACING=ON -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUMF_ENABLE_POOL_TRACKING=ON - - - name: Run Coverity - run: | - cd $WORKDIR/build - wget https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh - patch < "../.github/scripts/0001-travis-fix-travisci_build_coverity_scan.sh.patch" - bash ./travisci_build_coverity_scan.sh +#jobs: +# linux: +# name: Coverity +# runs-on: ubuntu-latest +# +# steps: +# - name: Clone the git repo +# uses: actions/checkout@v3 +# +# - name: Install pip packages +# run: pip install -r third_party/requirements.txt +# +# - name: Configure CMake +# run: cmake -B $WORKDIR/build -DUR_ENABLE_TRACING=ON -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUMF_ENABLE_POOL_TRACKING=ON +# +# - name: Run Coverity +# run: | +# cd $WORKDIR/build +# wget https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh +# patch < "../.github/scripts/0001-travis-fix-travisci_build_coverity_scan.sh.patch" +# bash ./travisci_build_coverity_scan.sh diff --git a/source/adapters/opencl/CMakeLists.txt b/source/adapters/opencl/CMakeLists.txt index dc43a68ffa..c610d1de20 100644 --- a/source/adapters/opencl/CMakeLists.txt +++ b/source/adapters/opencl/CMakeLists.txt @@ -43,6 +43,34 @@ set_target_properties(${TARGET_NAME} PROPERTIES find_package(Threads REQUIRED) +if(NOT OpenCL_INCLUDE_DIR) + set(OPENCL_HEADERS_REPO "https://github.com/KhronosGroup/OpenCL-Headers.git") + set(OPENCL_HEADERS_HASH 9ddb236e6eb3cf844f9e2f81677e1045f9bf838e) + + FetchContent_Declare(ocl-headers + GIT_REPOSITORY ${OPENCL_HEADERS_REPO} + GIT_TAG ${OPENCL_HEADERS_HASH} + ) + FetchContent_MakeAvailable(ocl-headers) + FetchContent_GetProperties(ocl-headers) + + set(OpenCL_INCLUDE_DIR ${ocl-headers_SOURCE_DIR} CACHE PATH "Path to OpenCL Headers") +endif() + +if(NOT OpenCL_LIBRARY) + set(OPENCL_ICD_LOADER_REPO "https://github.com/KhronosGroup/OpenCL-ICD-Loader.git") + set(OPENCL_ICD_LOADER_HASH 9a3e962f16f5097d2054233ad8b6dad51b6f41b7) + + FetchContent_Declare(ocl-icd-loader + GIT_REPOSITORY ${OPENCL_ICD_LOADER_REPO} + GIT_TAG ${OPENCL_ICD_LOADER_HASH} + ) + FetchContent_MakeAvailable(ocl-icd-loader) + FetchContent_GetProperties(ocl-icd-loader) + + set(OpenCL_LIBRARY ${PROJECT_BINARY_DIR}/lib/libOpenCL.so CACHE PATH "Path to OpenCL ICD Loader") +endif() + # The OpenCL target can be set manually on upstream cmake to avoid using find_package(). if (NOT UR_OPENCL_ICD_LOADER_LIBRARY) find_package(OpenCL REQUIRED) diff --git a/test/conformance/CMakeLists.txt b/test/conformance/CMakeLists.txt index 5a898846ec..64b934305b 100644 --- a/test/conformance/CMakeLists.txt +++ b/test/conformance/CMakeLists.txt @@ -9,6 +9,9 @@ function(add_test_adapter name adapter) set(TEST_TARGET_NAME test-${name}) set(TEST_NAME ${name}-${adapter}) +# add_test(NAME ${TEST_NAME} +# COMMAND ${TEST_TARGET_NAME} +# WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_test(NAME ${TEST_NAME} COMMAND ${CMAKE_COMMAND} -D TEST_FILE=${Python3_EXECUTABLE} diff --git a/test/conformance/context/context_adapter_opencl.match b/test/conformance/context/context_adapter_opencl.match new file mode 100644 index 0000000000..0f0e82d7d9 --- /dev/null +++ b/test/conformance/context/context_adapter_opencl.match @@ -0,0 +1 @@ +urContextCreateWithNativeHandleTest.Success/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/device/device_adapter_opencl.match b/test/conformance/device/device_adapter_opencl.match new file mode 100644 index 0000000000..b46c34d6ca --- /dev/null +++ b/test/conformance/device/device_adapter_opencl.match @@ -0,0 +1,3 @@ +urDeviceGetTest.InvalidValueNumEntries +urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HALF_FP_CONFIG +urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE diff --git a/test/conformance/enqueue/enqueue_adapter_opencl.match b/test/conformance/enqueue/enqueue_adapter_opencl.match new file mode 100644 index 0000000000..58bfd87643 --- /dev/null +++ b/test/conformance/enqueue/enqueue_adapter_opencl.match @@ -0,0 +1,5 @@ +{{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueMemBufferCopyRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueMemBufferReadRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueMemBufferWriteRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}Segmentation fault diff --git a/test/conformance/event/event_adapter_opencl.match b/test/conformance/event/event_adapter_opencl.match new file mode 100644 index 0000000000..43bd5fe2ed --- /dev/null +++ b/test/conformance/event/event_adapter_opencl.match @@ -0,0 +1,2 @@ +urEventSetCallbackTest.AllStates/Intel_R__OpenCL___{{.*}}_ +urEventSetCallbackNegativeTest.InvalidNullHandle/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/kernel/kernel_adapter_opencl.match b/test/conformance/kernel/kernel_adapter_opencl.match new file mode 100644 index 0000000000..7a1c0d5b8e --- /dev/null +++ b/test/conformance/kernel/kernel_adapter_opencl.match @@ -0,0 +1 @@ +Segmentation fault diff --git a/test/conformance/memory/memory_adapter_opencl.match b/test/conformance/memory/memory_adapter_opencl.match new file mode 100644 index 0000000000..f6df605fa6 --- /dev/null +++ b/test/conformance/memory/memory_adapter_opencl.match @@ -0,0 +1,5 @@ +urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_SIZE +urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_CONTEXT +urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_SIZE +urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_CONTEXT +urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/platform/platform_adapter_opencl.match b/test/conformance/platform/platform_adapter_opencl.match new file mode 100644 index 0000000000..df63fbef05 --- /dev/null +++ b/test/conformance/platform/platform_adapter_opencl.match @@ -0,0 +1 @@ +urPlatformGetTest.InvalidNumEntries diff --git a/test/conformance/program/program_adapter_opencl.match b/test/conformance/program/program_adapter_opencl.match new file mode 100644 index 0000000000..1354f1f211 --- /dev/null +++ b/test/conformance/program/program_adapter_opencl.match @@ -0,0 +1,30 @@ +urProgramCreateWithBinaryTest.Success/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullPointerBinary/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullPointerProgram/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullPointerMetadata/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidSizePropertyCount/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/Intel_R__OpenCL___{{.*}}_ +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_OPTIONS +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_LOG +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_OPTIONS +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_LOG +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE +urProgramGetFunctionPointerTest.InvalidFunctionName/Intel_R__OpenCL___{{.*}}_ +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_REFERENCE_COUNT +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_CONTEXT +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_DEVICES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_DEVICES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARY_SIZES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARIES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES diff --git a/test/conformance/queue/queue_adapter_opencl.match b/test/conformance/queue/queue_adapter_opencl.match new file mode 100644 index 0000000000..59c11b7c86 --- /dev/null +++ b/test/conformance/queue/queue_adapter_opencl.match @@ -0,0 +1,4 @@ +urQueueCreateTest.InvalidQueueProperties/Intel_R__OpenCL___{{.*}}_ +urQueueCreateWithNativeHandleTest.Success/Intel_R__OpenCL___{{.*}}_ +urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_SIZE +urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_EMPTY diff --git a/test/conformance/runtime/runtime_adapter_opencl.match b/test/conformance/runtime/runtime_adapter_opencl.match new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/conformance/sampler/sampler_adapter_opencl.match b/test/conformance/sampler/sampler_adapter_opencl.match new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 875ceb63ef..8e99983c9b 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -179,6 +179,16 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) { std::string(&arg[std::strlen("--platform=")]); } } + + /* If a platform was not provided using the --platform command line option, + * check if environment variable is set to use as a fallback. */ + if (options.platform_name.empty()) { + const char *env_platform = std::getenv("UR_CTS_ADAPTER_PLATFORM"); + if (env_platform) { + options.platform_name = env_platform; + } + } + return options; } diff --git a/test/conformance/usm/usm_adapter_opencl.match b/test/conformance/usm/usm_adapter_opencl.match new file mode 100644 index 0000000000..b9aa3f3bdf --- /dev/null +++ b/test/conformance/usm/usm_adapter_opencl.match @@ -0,0 +1,42 @@ +urUSMDeviceAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolDisabled +urUSMDeviceAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidNullPtrResult/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMAllocInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_USM_ALLOC_INFO_POOL +urUSMHostAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolDisabled +urUSMHostAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.InvalidNullPtrMem/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMPoolCreateTest.Success/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.SuccessWithFlag/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidNullPointerPoolDesc/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidNullPointerPool/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidEnumerationFlags/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_USM_POOL_INFO_CONTEXT +urUSMPoolGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_USM_POOL_INFO_REFERENCE_COUNT +urUSMPoolGetInfoTest.InvalidNullHandlePool/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidEnumerationProperty/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidSizeZero/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidSizeTooSmall/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidNullPointerPropValue/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}_ +urUSMPoolDestroyTest.Success/Intel_R__OpenCL___{{.*}}_ +urUSMPoolDestroyTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urUSMPoolRetainTest.Success/Intel_R__OpenCL___{{.*}}_ +urUSMPoolRetainTest.InvalidNullHandlePool/Intel_R__OpenCL___{{.*}}_ +urUSMSharedAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.SuccessWithMultipleAdvices/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidNullPtrMem/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UsePoolEnabled diff --git a/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match b/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match new file mode 100644 index 0000000000..bf82e6fb92 --- /dev/null +++ b/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match @@ -0,0 +1,15 @@ +urVirtualMemGetInfoTestWithParam.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_INFO_ACCESS_MODE +urVirtualMemGetInfoTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGetInfoTest.InvalidNullPointerStart/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGetInfoTest.InvalidEnumerationInfo/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM +urVirtualMemGranularityGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED +urVirtualMemGranularityGetInfoNegativeTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidEnumeration/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidNullPointerPropValue/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidPropSizeZero/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidSizePropSizeSmall/Intel_R__OpenCL___{{.*}}_ +urVirtualMemSetAccessTest.Success/Intel_R__OpenCL___{{.*}}_ +urVirtualMemSetAccessTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urVirtualMemSetAccessTest.InvalidNullPointerStart/Intel_R__OpenCL___{{.*}}_