diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index b670083581..bc8358dda2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -7,166 +7,16 @@ 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, platform: ""}, + # {name: CUDA, platform: ""}, {name: HIP, platform: ""}, - {name: L0, platform: ""}, - {name: OPENCL, platform: "Intel(R) OpenCL"} + # {name: L0, platform: ""}, + # {name: OPENCL, platform: "Intel(R) OpenCL"} ] build_type: [Debug, Release] compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}] @@ -223,156 +73,3 @@ jobs: - name: Get information about platform if: ${{ always() }} run: .github/scripts/get_system_info.sh - - 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 - - - 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 - - - name: Get information about platform - if: ${{ always() }} - run: .github/scripts/get_system_info.sh - - 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 and clang-cl is currently broken - exclude: - - os: 'windows-2019' - adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} - - adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} - compiler: {c: clang-cl, cxx: clang-cl} - - build_type: [Debug, Release] - compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}] - include: - - compiler: {c: clang-cl, cxx: clang-cl} - toolset: "-T ClangCL" - 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: Install doxygen - run: | - $WorkingDir = $PWD.Path - Invoke-WebRequest -Uri https://github.com/doxygen/doxygen/releases/download/Release_1_9_8/doxygen-1.9.8.windows.x64.bin.zip -OutFile "$WorkingDir\doxygen.zip" - Expand-Archive -Path "$WorkingDir\doxygen.zip" - Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen" - - - name: Configure CMake - run: > - cmake - -B${{github.workspace}}/build - ${{matrix.toolset}} - -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 $Env:NUMBER_OF_PROCESSORS - - - 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/CMakeLists.txt b/CMakeLists.txt index 7bad7a6ca5..5049b0c1b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,9 @@ option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable") set(UR_SYCL_LIBRARY_DIR "" CACHE PATH "Path of the SYCL runtime library directory") +set(UR_CONFORMANCE_TARGET_TRIPLES "" CACHE STRING + "List of sycl targets to build CTS device binaries for") +set(UR_AMD_ARCH "" CACHE STRING "") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) diff --git a/test/conformance/CMakeLists.txt b/test/conformance/CMakeLists.txt index e04faac666..3ebd8a1a03 100644 --- a/test/conformance/CMakeLists.txt +++ b/test/conformance/CMakeLists.txt @@ -93,33 +93,6 @@ add_subdirectory(queue) add_subdirectory(sampler) add_subdirectory(virtual_memory) -function(detect_amd_arch) - find_package(RocmAgentEnumerator) - if(NOT ROCM_AGENT_ENUMERATOR_FOUND) - message(FATAL_ERROR - "rocm_agent_enumerator could not be found so detecting target " - "HIP device has failed. Set target device with AMD_ARCH or " - "ensure rocm_agent_enumerator is available on the PATH.") - endif() - execute_process(COMMAND ${ROCM_AGENT_ENUMERATOR} OUTPUT_VARIABLE ROCM_AGENTS) - string(REGEX MATCHALL "[A-Za-z0-9]+" ROCM_AGENT_LIST "${ROCM_AGENTS}") - list(GET ROCM_AGENT_LIST 0 FIRST_ROCM_AGENT) - if("${FIRST_ROCM_AGENT}" STREQUAL "gfx000") - list(POP_FRONT ROCM_AGENT_LIST) - endif() - list(LENGTH ROCM_AGENT_LIST NUM_ROCM_AGENTS) - if(${NUM_ROCM_AGENTS} EQUAL 0) - message(FATAL_ERROR - "No target HIP devices detected with rocm_agent_enumerator, " - "specify a target with the AMD_ARCH variable.") - elseif(${NUM_ROCM_AGENTS} GREATER 1) - message(FATAL_ERROR - "Multiple possible target HIP devices found: ${ROCM_AGENT_LIST} " - "please specify which target to use by setting AMD_ARCH.") - endif() - list(GET ROCM_AGENT_LIST 0 AMD_ARCH) -endfunction() - if(UR_DPCXX) add_custom_target(generate_device_binaries) @@ -138,9 +111,6 @@ if(UR_DPCXX) endif() if(UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_ALL) list(APPEND TARGET_TRIPLES "amdgcn-amd-amdhsa") - if("${AMD_ARCH}" STREQUAL "" AND "${UR_HIP_PLATFORM}" STREQUAL "AMD") - detect_amd_arch() - endif() endif() endif() diff --git a/test/conformance/device_code/CMakeLists.txt b/test/conformance/device_code/CMakeLists.txt index 9d19a34b93..f64baf876f 100644 --- a/test/conformance/device_code/CMakeLists.txt +++ b/test/conformance/device_code/CMakeLists.txt @@ -3,6 +3,41 @@ # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +function(detect_amd_arch AMD_ARCH) + find_package(RocmAgentEnumerator) + if(NOT ROCM_AGENT_ENUMERATOR_FOUND) + message(FATAL_ERROR + "rocm_agent_enumerator could not be found so detecting target " + "HIP device has failed. Set target device with UR_AMD_ARCH or " + "ensure rocm_agent_enumerator is available on the PATH.") + endif() + execute_process(COMMAND ${ROCM_AGENT_ENUMERATOR} OUTPUT_VARIABLE ROCM_AGENTS) + string(REGEX MATCHALL "[A-Za-z0-9]+" ROCM_AGENT_LIST "${ROCM_AGENTS}") + list(GET ROCM_AGENT_LIST 0 FIRST_ROCM_AGENT) + if("${FIRST_ROCM_AGENT}" STREQUAL "gfx000") + list(POP_FRONT ROCM_AGENT_LIST) + endif() + list(LENGTH ROCM_AGENT_LIST NUM_ROCM_AGENTS) + if(${NUM_ROCM_AGENTS} EQUAL 0) + message(FATAL_ERROR + "No target HIP devices detected with rocm_agent_enumerator, " + "specify a target with the UR_AMD_ARCH variable.") + elseif(${NUM_ROCM_AGENTS} GREATER 1) + message(FATAL_ERROR + "Multiple possible target HIP devices found: ${ROCM_AGENT_LIST} " + "please specify which target to use by setting UR_AMD_ARCH.") + endif() + list(GET ROCM_AGENT_LIST 0 AMD_ARCH) + return(${AMD_ARCH}) +endfunction() + +set(AMD_ARCH "${UR_AMD_ARCH}") + +if("${AMD_ARCH}" STREQUAL "" AND "${TARGET_TRIPLES}" MATCHES "amd") + detect_amd_arch(AMD_ARCH) + message(STATUS "AMD_ARCH: ${AMD_ARCH}") +endif() + macro(add_device_binary SOURCE_FILE) get_filename_component(KERNEL_NAME ${SOURCE_FILE} NAME_WE) set(DEVICE_BINARY_DIR "${UR_CONFORMANCE_DEVICE_BINARIES_DIR}/${KERNEL_NAME}")