Skip to content

Commit

Permalink
Merge pull request #1159 from oneapi-src/adapters
Browse files Browse the repository at this point in the history
Merge adapters branch into main
  • Loading branch information
kbenzie authored Dec 5, 2023
2 parents 26e98b5 + 9e3bb2f commit 6175cee
Show file tree
Hide file tree
Showing 305 changed files with 50,612 additions and 471 deletions.
24 changes: 24 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
* @oneapi-src/unified-runtime-maintain

# Level Zero adapter
source/adapters/level_zero @oneapi-src/unified-runtime-level-zero-write

# CUDA and HIP adapters
source/adapters/cuda @oneapi-src/unified-runtime-cuda-write
source/adapters/hip @oneapi-src/unified-runtime-hip-write

# OpenCL adapter
source/adapters/opencl @oneapi-src/unified-runtime-opencl-write

# Native CPU adapter
source/adapters/native_cpu @oneapi-src/unified-runtime-native-cpu-write

# Command-buffer experimental feature
source/adapters/**/command_buffer.* @oneapi-src/unified-runtime-command-buffer-write
scripts/core/EXP-COMMAND-BUFFER.rst @oneapi-src/unified-runtime-command-buffer-write
scripts/core/exp-command-buffer.yml @oneapi-src/unified-runtime-command-buffer-write

# Bindless Images experimental feature
scripts/core/EXP-BINDLESS-IMAGES.rst @oneapi-src/unified-runtime-bindless-images-write
scripts/core/exp-bindless-images.yml @oneapi-src/unified-runtime-bindless-images-write
source/adapters/**/image.* @oneapi-src/unified-runtime-bindless-images-write
87 changes: 87 additions & 0 deletions .github/scripts/get_system_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash

# 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

# get_system_info.sh - Script for printing system info

function check_L0_version {
if command -v dpkg &> /dev/null; then
dpkg -l | grep level-zero && return
fi

if command -v rpm &> /dev/null; then
rpm -qa | grep level-zero && return
fi

if command -v zypper &> /dev/null; then
zypper se level-zero && return
fi

echo "level-zero not installed"
}

function system_info {
echo "**********system_info**********"
cat /etc/os-release | grep -oP "PRETTY_NAME=\K.*"
cat /proc/version
echo "**********SYCL-LS**********"
source /opt/intel/oneapi/setvars.sh
sycl-ls
echo "**********VGA**********"
lspci | grep VGA
echo "**********CUDA Version**********"
if command -v nvidia-smi &> /dev/null; then
nvidia-smi
else
echo "CUDA not installed"
fi
echo "**********L0 Version**********"
check_L0_version
echo "**********ROCm Version**********"
if command -v rocminfo &> /dev/null; then
rocminfo
else
echo "ROCm not installed"
fi
echo "**********/proc/cmdline**********"
cat /proc/cmdline
echo "**********CPU info**********"
lscpu
echo "**********/proc/meminfo**********"
cat /proc/meminfo
echo "**********build/bin/urinfo**********"
$(dirname "$(readlink -f "$0")")/../../build/bin/urinfo || true
echo "******OpenCL*******"
# The driver version of OpenCL Graphics is the compute-runtime version
clinfo || echo "OpenCL not installed"
echo "**********list-environment**********"
echo "PATH=$PATH"
echo
echo "CPATH=$CPATH"
echo
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo
echo "LIBRARY_PATH=$LIBRARY_PATH"
echo
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH"
echo
echo "******list-build-system-versions*******"
gcc --version 2>/dev/null || true
echo
clang --version 2>/dev/null || true
echo
make --version 2>/dev/null || true
echo "**********/proc/modules**********"
cat /proc/modules
echo "***************installed-packages***************"
# Instructions below will return some minor errors, as they are dependent on the Linux distribution.
zypper se --installed-only 2>/dev/null || true
apt list --installed 2>/dev/null || true
yum list installed 2>/dev/null || true
}

# Call the function above to print system info.
system_info
4 changes: 4 additions & 0 deletions .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ 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
Expand Down
215 changes: 209 additions & 6 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Build and test

on: [push, pull_request]

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

jobs:
ubuntu-build:
name: Build - Ubuntu
Expand Down Expand Up @@ -58,26 +62,42 @@ jobs:
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/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz
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
-DUR_DEVELOPER_MODE=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
Expand All @@ -92,11 +112,192 @@ jobs:
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, platform: ""},
{name: HIP, triplet: amdgcn-amd-amdhsa, platform: ""},
{name: L0, triplet: spir64, platform: ""},
{name: OPENCL, triplet: spir64, platform: "Intel(R) OpenCL"}
]
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: 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
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
-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
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

# Temporarily disabling platform test for L0, because of hang
# See issue: #824
- name: Test L0 adapter
if: matrix.adapter.name == 'L0'
working-directory: ${{github.workspace}}/build
run: ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" -E "platform-adapter_level_zero" --timeout 180

- name: Test adapters
if: matrix.adapter.name != 'L0'
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
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:
Expand Down Expand Up @@ -133,10 +334,12 @@ jobs:
-DUR_DEVELOPER_MODE=ON
-DUR_BUILD_TESTS=ON
-DUR_FORMAT_CPP_STYLE=ON
${{matrix.adapter.var}}
- 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}}
# 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
Expand Down
Loading

0 comments on commit 6175cee

Please sign in to comment.