Skip to content

Commit

Permalink
[UR][CI] Add first version of UR workflow
Browse files Browse the repository at this point in the history
Use custom runner names - UR_*
  • Loading branch information
lukaszstolarczuk committed Feb 13, 2025
1 parent f3d12f0 commit b28c442
Show file tree
Hide file tree
Showing 4 changed files with 383 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/sycl-detect-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ jobs:
- 'sycl/include/sycl/ext/oneapi/experimental/invoke_simd.hpp'
- 'sycl/include/sycl/ext/oneapi/experimental/detail/invoke_simd_types.hpp'
- 'sycl/test-e2e/(ESIMD|InvokeSimd)/**'
ur:
- 'unified-runtime/**'
- name: Set output
id: result
Expand All @@ -84,7 +86,7 @@ jobs:
return '${{ steps.changes.outputs.changes }}';
}
// Treat everything as changed for huge PRs.
return ["llvm", "llvm_spirv", "clang", "sycl_jit", "xptifw", "libclc", "sycl", "ci", "esimd"];
return ["llvm", "llvm_spirv", "clang", "sycl_jit", "xptifw", "libclc", "sycl", "ci", "esimd", "ur"];
- run: echo '${{ steps.result.outputs.result }}'

155 changes: 155 additions & 0 deletions .github/workflows/ur-build-hw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: UR - Build adapters, test on HW

on:
workflow_call:
inputs:
adapter_name:
required: true
type: string
other_adapter_name:
required: false
type: string
default: ""
runner_name:
required: true
type: string
platform:
description: "Platform string, `UR_CTS_ADAPTER_PLATFORM` will be set to this."
required: false
type: string
default: ""
static_loader:
required: false
type: string
default: OFF
static_adapter:
required: false
type: string
default: OFF
workflow_dispatch:
inputs:
adapter_name:
required: true
type: string
other_adapter_name:
required: false
type: string
default: ""
runner_name:
required: true
type: string
platform:
description: "Platform string, `UR_CTS_ADAPTER_PLATFORM` will be set to this."
required: false
type: string
default: ""
static_loader:
required: false
type: string
default: OFF
static_adapter:
required: false
type: string
default: OFF

permissions:
contents: read

env:
UR_LOG_CUDA: "level:error;flush:error"
UR_LOG_HIP: "level:error;flush:error"
UR_LOG_LEVEL_ZERO: "level:error;flush:error"
UR_LOG_NATIVE_CPU: "level:error;flush:error"
UR_LOG_OPENCL: "level:error;flush:error"

jobs:
adapter_build_hw:
name: Build & CTS
# run only on upstream; forks won't have the HW
if: github.repository == 'intel/llvm'
strategy:
matrix:
adapter: [
{
name: "${{inputs.adapter_name}}",
other_name: "${{inputs.other_adapter_name}}",
platform: "${{inputs.platform}}",
static_Loader: "${{inputs.static_loader}}",
static_adapter: "${{inputs.static_loader}}"
}
]
build_type: [Release]
compiler: [{c: gcc, cxx: g++}]

runs-on: ${{inputs.runner_name}}

steps:
# TODO: If UR is merged into llvm it will require changes:
# - checkout only llvm repo
# - configure UR project from local tree
#
# Also, the step of downloading DPC++ should be integrated somehow;
# most likely use nightly release.
#
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Checkout UR
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: 'oneapi-src/unified-runtime'
path: unified-runtime
ref: main

- name: Install pip packages
working-directory: ${{github.workspace}}/unified-runtime
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-12-12/sycl_linux.tar.gz
mkdir dpcpp_compiler
tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler
- name: Configure CMake
working-directory: ${{github.workspace}}/unified-runtime
# ">" is used to avoid adding "\" at the end of each line; this command is quite long
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_CONFORMANCE_TEST_LOADER=${{ matrix.adapter.other_name != '' && 'ON' || 'OFF' }}
${{ matrix.adapter.other_name != '' && format('-DUR_BUILD_ADAPTER_{0}=ON', matrix.adapter.other_name) || '' }}
-DUR_STATIC_LOADER=${{matrix.adapter.static_Loader}}
-DUR_STATIC_ADAPTER_${{matrix.adapter.name}}=${{matrix.adapter.static_adapter}}
-DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++
-DUR_SYCL_LIBRARY_DIR=${{github.workspace}}/dpcpp_compiler/lib
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
${{ 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: Install
# This is to check that install command does not fail
run: cmake --install ${{github.workspace}}/build

- name: Test adapter specific
run: ctest -C ${{matrix.build_type}} --test-dir ${{github.workspace}}/build --output-on-failure -L "adapter-specific" -E "memcheck" --timeout 600
# Don't run adapter specific tests when building multiple adapters
if: ${{ matrix.adapter.other_name == '' }}

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

- name: Get information about platform
if: ${{ always() }}
run: ${{github.workspace}}/unified-runtime/.github/scripts/get_system_info.sh
141 changes: 141 additions & 0 deletions .github/workflows/ur-precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Unified Runtime Pre Commit
# Note: this is the very first version of UR workflow.
# It was pretty much copy-pasted from UR repository.
# Over time it will be most likely integrated more into existing workflows.

# Note: the trigger is copy-pasted from sycl-linux-precommit.yml - probably to be fine-tuned.
on:
# We rely on "Fork pull request workflows from outside collaborators" -
# "Require approval for all outside collaborators" at
# https://github.com/intel/llvm/settings/actions for security.
pull_request:
branches:
- sycl
- sycl-rel-**
# Do not run builds if changes are only in the following locations
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.github/CODEOWNERS'
- 'sycl/doc/**'
- 'sycl/gdb/**'
- 'clang/docs/**'
- '**.md'
- '**.rst'
- '.github/workflows/sycl-windows-*.yml'
- '.github/workflows/sycl-macos-*.yml'
- '.github/workflows/sycl-nightly.yml'
- '.github/workflows/sycl-rel-nightly.yml'
- 'devops/containers/**'
- 'devops/actions/build_container/**'

concurrency:
# Cancel a currently running workflow from the same PR, branch or tag.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: read-all

jobs:
detect_changes:
uses: ./.github/workflows/sycl-detect-changes.yml

# TODO: If UR is merged into llvm it will require changes:
# - 'detect_changes' should be required for all UR jobs
# - 'if' condition should be used, for all UR jobs, to check if UR is affected
# (see example test_job's if)
# - test_job should be removed
#
test_job:
# this is a temporary test job, to show how the 'if' should be used for all UR jobs
name: UR test job
needs: [detect_changes]
if: ${{ always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur') }}
runs-on: ubuntu-latest

steps:
- name: Check if UR is affected
run: |
echo "UR affected"
echo 'Filters set: ${{needs.detect_changes.outputs.filters}}'
source_checks:
name: Source Checks
needs: [detect_changes]
uses: ./.github/workflows/ur-source-checks.yml

adapters:
name: Adapters
needs: [source_checks]
strategy:
matrix:
# Extra native CPU jobs are here to force the loader to be used.
# UR will not use the loader if there is only one target.
adapter: [
{name: L0, runner: UR_L0},
{name: L0_V2, runner: UR_L0},
{name: L0, runner: UR_L0, static: ON},
{name: OPENCL, runner: UR_OPENCL, platform: "Intel(R) OpenCL"},
{name: CUDA, runner: UR_CUDA},
{name: HIP, runner: UR_HIP},
{name: NATIVE_CPU, runner: UR_NATIVE_CPU},
{name: OPENCL, runner: UR_OPENCL, other_adapter: NATIVE_CPU, platform: "OPENCL:Intel(R) OpenCL"},
{name: L0, runner: UR_L0, other_adapter: NATIVE_CPU},
]
uses: ./.github/workflows/ur-build-hw.yml
with:
adapter_name: ${{ matrix.adapter.name }}
runner_name: ${{ matrix.adapter.runner }}
static_loader: ${{ matrix.adapter.static || 'OFF' }}
static_adapter: ${{ matrix.adapter.static || 'OFF' }}
platform: ${{ matrix.adapter.platform || '' }}
other_adapter_name: ${{ matrix.adapter.other_adapter || '' }}

macos:
name: MacOS build only
needs: [source_checks]
strategy:
matrix:
os: ['macos-13']
runs-on: ${{matrix.os}}

steps:
# TODO: If UR is merged into llvm it will require changes:
# - checkout only llvm repo
# - configure UR project from local tree
#
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Checkout UR
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: 'oneapi-src/unified-runtime'
path: unified-runtime
ref: main
fetch-depth: 1

- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: 3.9

- name: Install prerequisites
working-directory: ${{github.workspace}}/unified-runtime
run: python3 -m pip install -r third_party/requirements.txt

- name: Install hwloc
run: brew install hwloc

- name: Configure CMake
working-directory: ${{github.workspace}}/unified-runtime
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 $(sysctl -n hw.logicalcpu)
Loading

0 comments on commit b28c442

Please sign in to comment.