Skip to content

Commit

Permalink
Merge branch 'oneapi-src:main' into lbushi/flushQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
lbushi25 authored May 1, 2024
2 parents 9b9b3b5 + 633ec40 commit 2139109
Show file tree
Hide file tree
Showing 79 changed files with 1,951 additions and 599 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[*]
indent_style = space
indent_size = 4

[.github/workflows/*.yml]
indent_size = 2
78 changes: 78 additions & 0 deletions .github/workflows/build-hw-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: Build - Adapters on HW - Reusable

on:
workflow_call:
inputs:
name:
required: true
type: string
platform:
required: false
type: string
default: ""

permissions:
contents: read

jobs:
adapter-build-hw:
name: Build & Test HW
if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
strategy:
matrix:
adapter: [
{name: "${{inputs.name}}", platform: "${{inputs.platform}}"},
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
# TODO: The latest L0 loader segfaults when built with clang.
exclude:
- adapter: {name: L0, platform: ""}
compiler: {c: clang, cxx: clang++}

runs-on: ${{matrix.adapter.name}}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Download DPC++
run: |
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-01-29/sycl_linux.tar.gz
mkdir dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
- name: Configure CMake
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_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
${{ matrix.adapter.name == 'HIP' && '-DUR_CONFORMANCE_AMD_ARCH=gfx1030' || '' }}
${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }}
- name: Build
# This is so that device binaries can find the sycl runtime library
run: cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Test adapter specific
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180

- name: Test adapters
working-directory: ${{github.workspace}}/build
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180

- name: Get information about platform
if: ${{ always() }}
run: .github/scripts/get_system_info.sh
158 changes: 36 additions & 122 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- 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

Expand Down Expand Up @@ -160,127 +160,41 @@ jobs:
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-short" --verbose

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: HIP, platform: ""},
{name: L0, platform: ""},
{name: OPENCL, platform: "Intel(R) OpenCL"},
{name: NATIVE_CPU, platform: ""}
]
build_type: [Debug, Release]
compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}]
# TODO: The latest L0 loader segfaults when built with clang.
exclude:
- adapter: {name: L0, platform: ""}
compiler: {c: clang, cxx: clang++}

runs-on: ${{matrix.adapter.name}}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Download DPC++
run: |
wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2024-01-29/sycl_linux.tar.gz
mkdir dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
- name: Configure CMake
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_ENABLE_TRACING=ON
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
${{ matrix.adapter.name == 'HIP' && '-DUR_CONFORMANCE_AMD_ARCH=gfx1030' || '' }}
${{ matrix.adapter.name == 'HIP' && '-DUR_HIP_PLATFORM=AMD' || '' }}
- name: Build
# This is so that device binaries can find the sycl runtime library
run: cmake --build ${{github.workspace}}/build -j $(nproc)

- name: Test adapter specific
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "adapter-specific" --timeout 180

- name: Test adapters
working-directory: ${{github.workspace}}/build
run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180

- 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
if: false # temporaily disabled due to conda env setup issues
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Init conda env
uses: conda-incubator/setup-miniconda@9f54435e0e72c53962ee863144e47a4b094bfd35 # v2.3.0
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
level-zero:
if: github.repository == 'oneapi-src/unified-runtime'
name: Level Zero
uses: ./.github/workflows/build-hw-reusable.yml
with:
name: L0

opencl:
if: github.repository == 'oneapi-src/unified-runtime'
name: OpenCL
uses: ./.github/workflows/build-hw-reusable.yml
with:
name: OPENCL
platform: "Intel(R) OpenCL"

cuda:
if: github.repository == 'oneapi-src/unified-runtime'
name: CUDA
uses: ./.github/workflows/build-hw-reusable.yml
with:
name: CUDA

hip:
if: github.repository == 'oneapi-src/unified-runtime'
name: HIP
uses: ./.github/workflows/build-hw-reusable.yml
with:
name: HIP

native-cpu:
if: github.repository == 'oneapi-src/unified-runtime'
name: Native CPU
uses: ./.github/workflows/build-hw-reusable.yml
with:
name: NATIVE_CPU

windows-build:
name: Build - Windows
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
# Remove after fixing SYCL test :: abi/layout_handler.cpp
# This issue does not affect further execution of e2e with UR.
continue-on-error: true
run: cmake --build ${{github.workspace}}/sycl_build --target check-sycl
run: cmake --build ${{github.workspace}}/sycl_build --target check-sycl -j6

- name: Set additional env. vars
run: |
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/examples-hw-level-zero.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Examples - Adapters on Level Zero HW

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
examples:
name: Examples on HW
# if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW
if: false # temporaily disabled due to conda env setup issues
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install pip packages
run: pip install -r third_party/requirements.txt

- name: Init conda env
uses: conda-incubator/setup-miniconda@9f54435e0e72c53962ee863144e47a4b094bfd35 # v2.3.0
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
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ option(UR_BUILD_TESTS "Build unit tests." ON)
option(UR_BUILD_TOOLS "build ur tools" ON)
option(UR_FORMAT_CPP_STYLE "format code style of C++ sources" OFF)
option(UR_DEVELOPER_MODE "enable developer checks, treats warnings as errors" OFF)
option(UR_ENABLE_FAST_SPEC_MODE "enable fast specification generation mode" OFF)
option(UR_USE_ASAN "enable AddressSanitizer" OFF)
option(UR_USE_UBSAN "enable UndefinedBehaviorSanitizer" OFF)
option(UR_USE_MSAN "enable MemorySanitizer" OFF)
Expand Down Expand Up @@ -292,7 +293,10 @@ if(UR_FORMAT_CPP_STYLE)
# Generate source from the specification
add_custom_target(generate-code USES_TERMINAL
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/scripts
COMMAND ${Python3_EXECUTABLE} run.py --api-json ${API_JSON_FILE} --clang-format=${CLANG_FORMAT}
COMMAND ${Python3_EXECUTABLE} run.py
--api-json ${API_JSON_FILE}
--clang-format=${CLANG_FORMAT}
$<$<BOOL:${UR_ENABLE_FAST_SPEC_MODE}>:--fast-mode>
COMMAND ${Python3_EXECUTABLE} json2src.py --api-json ${API_JSON_FILE} ${PROJECT_SOURCE_DIR}
)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build and test](https://github.com/oneapi-src/unified-runtime/actions/workflows/cmake.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/cmake.yml)
[![E2E Cuda](https://github.com/oneapi-src/unified-runtime/actions/workflows/e2e_cuda.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/e2e_cuda.yml)
[![E2E OpenCL](https://github.com/oneapi-src/unified-runtime/actions/workflows/e2e_opencl.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/e2e_opencl.yml)
[![CodeQL](https://github.com/oneapi-src/unified-runtime/actions/workflows/codeql.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/codeql.yml)
[![Bandit](https://github.com/oneapi-src/unified-runtime/actions/workflows/bandit.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/bandit.yml)
[![Coverity](https://scan.coverity.com/projects/28213/badge.svg)](https://scan.coverity.com/projects/oneapi-src-unified-runtime)
Expand Down Expand Up @@ -121,6 +122,7 @@ List of options provided by CMake:
| UR_BUILD_TOOLS | Build tools | ON/OFF | ON |
| UR_FORMAT_CPP_STYLE | Format code style | ON/OFF | OFF |
| UR_DEVELOPER_MODE | Treat warnings as errors and enables additional checks | ON/OFF | OFF |
| UR_ENABLE_FAST_SPEC_MODE | Enable fast specification generation mode | ON/OFF | OFF |
| UR_USE_ASAN | Enable AddressSanitizer | ON/OFF | OFF |
| UR_USE_TSAN | Enable ThreadSanitizer | ON/OFF | OFF |
| UR_USE_UBSAN | Enable UndefinedBehavior Sanitizer | ON/OFF | OFF |
Expand Down
Loading

0 comments on commit 2139109

Please sign in to comment.