Skip to content

[UR][CI] Add first version of UR workflow #16827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}'

159 changes: 159 additions & 0 deletions .github/workflows/ur-build-hw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
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:
fail-fast: false
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
# - investigate if DUR_CONFORMANCE_AMD_ARCH could be removed
# - find better way to handle platform param (e.g. "Intel(R) OpenCL" -> "opencl")
# - switch to Ninja generator in CMake
#
# 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' || '' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure i understand why we need to set DUR_CONFORMANCE_AMD_ARCH here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a hang over, I think we autodetect the AMD GPU arch for compiling test programs for the device now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this for now and investigate if we can remove it post merge, can you add this to the TODO list @lukaszstolarczuk ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to TODO.

${{ 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)
Copy link
Contributor

@sarnex sarnex Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use ninja instead of make as the cmake generator at the configure step (-GNinja) you shouldnt need this, and i think ninja is just better anyway

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree Ninja generator is better, we have had issues with Unix Makefiles becomeing broken due to not being tested so the CI is ensuring that didn't make its way downstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

soo... I'm not sure, should we leave it as-is and add extra Ninja job...?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the idea is to replace the Unix Makefiles jobs with Ninja jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODO.


- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we instead say Detect UR changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, this is a test_job which is here just to show how the if should be used. As stated in the TODO comment above - after moving UR here it should be removed. Added comment.

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"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setting the platform name with a string seems error prone, if the spacing or anything is wrong it will fail right? maybe we could use a single word like opencl that, if required, gets updated to the required value for the actual build by the ur-build workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added TODO.

{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
Loading