From 9843d6a5e793725b160b363badf063d897eba195 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Wed, 28 May 2025 13:49:05 +0100 Subject: [PATCH 1/7] [CI][UR][Offload] Add Offload build-only job Add a new job that verifies that the offload adapter can be built. It does not attempt to run any tests or detect any hardware. --- .github/workflows/ur-build-offload.yml | 58 ++++++++++++++++++++++++++ .github/workflows/ur-precommit.yml | 6 +++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/ur-build-offload.yml diff --git a/.github/workflows/ur-build-offload.yml b/.github/workflows/ur-build-offload.yml new file mode 100644 index 0000000000000..45b48c1217578 --- /dev/null +++ b/.github/workflows/ur-build-offload.yml @@ -0,0 +1,58 @@ +name: UR - Build offload adapter + +permissions: read-all + +on: [ workflow_call, workflow_dispatch ] + +jobs: + offload_build: + name: Build + strategy: + fail-fast: false + matrix: + build_type: [Release] + compiler: [{c: gcc, cxx: g++}] + + runs-on: "ubuntu-24.04" + container: + image: 'ghcr.io/intel/llvm/ubuntu2404_base' + + steps: + - name: Checkout LLVM + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install liboffload + run: | + sudo curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key -o /etc/apt/trusted.gpg.d/apt.llvm.org.asc + echo 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble main' | sudo tee /etc/apt/sources.list.d/llvm.list + sudo apt-get update + sudo apt-get -y install liboffload-21 liboffload-21-dev + + - name: Configure Unified Runtime project + # ">" is used to avoid adding "\" at the end of each line; this command is quite long + run: > + cmake + -S unified-runtime + -B 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=OFF + -DUR_BUILD_ADAPTER_OFFLOAD=ON + -DUR_OFFLOAD_INSTALL_DIR="/usr/lib/llvm-21" + -DUR_OFFLOAD_INCLUDE_DIR="/usr/lib/llvm-21/include" + -DCMAKE_INSTALL_PREFIX=./install + + - name: Build + # This is so that device binaries can find the sycl runtime library + run: cmake --build build -j $(nproc) + + - name: Install + # This is to check that install command does not fail + run: cmake --install build + + - name: Get information about platform + if: ${{ always() }} + run: ./unified-runtime/.github/scripts/get_system_info.sh diff --git a/.github/workflows/ur-precommit.yml b/.github/workflows/ur-precommit.yml index ad99b49d70532..07e4685e7a1e4 100644 --- a/.github/workflows/ur-precommit.yml +++ b/.github/workflows/ur-precommit.yml @@ -99,6 +99,12 @@ jobs: docker_image: ${{ matrix.docker_image || 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps'}} image_options: ${{ matrix.image_options || '' }} + offload_build: + name: Offload Build + needs: [detect_changes, source_checks] + if: ${{ always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur') }} + uses: ./.github/workflows/ur-build-offload.yml + macos: name: MacOS build only needs: [detect_changes, source_checks] From 850325696388eaf8d15aef20bfe0877bc756d2d2 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Wed, 28 May 2025 15:42:04 +0100 Subject: [PATCH 2/7] Rename job Co-authored-by: Kenneth Benzie (Benie) --- .github/workflows/ur-precommit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ur-precommit.yml b/.github/workflows/ur-precommit.yml index 07e4685e7a1e4..26381323b5d09 100644 --- a/.github/workflows/ur-precommit.yml +++ b/.github/workflows/ur-precommit.yml @@ -100,7 +100,7 @@ jobs: image_options: ${{ matrix.image_options || '' }} offload_build: - name: Offload Build + name: Adapters (Offload) needs: [detect_changes, source_checks] if: ${{ always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur') }} uses: ./.github/workflows/ur-build-offload.yml From d588ed764944349d501dfa530965e5d37cb97559 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Wed, 4 Jun 2025 11:11:25 +0100 Subject: [PATCH 3/7] Don't install llvm during job --- .github/workflows/ur-build-offload.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ur-build-offload.yml b/.github/workflows/ur-build-offload.yml index 45b48c1217578..8cb59747b547d 100644 --- a/.github/workflows/ur-build-offload.yml +++ b/.github/workflows/ur-build-offload.yml @@ -22,11 +22,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: Install liboffload - run: | - sudo curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key -o /etc/apt/trusted.gpg.d/apt.llvm.org.asc - echo 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble main' | sudo tee /etc/apt/sources.list.d/llvm.list - sudo apt-get update - sudo apt-get -y install liboffload-21 liboffload-21-dev + run: sudo apt-get update -qq && sudo apt-get install --no-install-recommends -yqq liboffload-21 liboffload-21-dev - name: Configure Unified Runtime project # ">" is used to avoid adding "\" at the end of each line; this command is quite long From bb4213982e18d8de3b26893457a8e8800dbecf90 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Fri, 6 Jun 2025 10:59:55 +0100 Subject: [PATCH 4/7] Use selfhosted runners --- .github/workflows/ur-build-offload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ur-build-offload.yml b/.github/workflows/ur-build-offload.yml index 8cb59747b547d..85e62cc9fb57f 100644 --- a/.github/workflows/ur-build-offload.yml +++ b/.github/workflows/ur-build-offload.yml @@ -13,7 +13,7 @@ jobs: build_type: [Release] compiler: [{c: gcc, cxx: g++}] - runs-on: "ubuntu-24.04" + runs-on: [ "self-hosted", "Linux", "build" ] container: image: 'ghcr.io/intel/llvm/ubuntu2404_base' From 45e413814dc76f1238da1209b9fcf33fc55a6bdd Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Fri, 6 Jun 2025 11:35:08 +0100 Subject: [PATCH 5/7] Only trigger job if offload has changed --- .github/workflows/sycl-detect-changes.yml | 6 +++++- .github/workflows/ur-precommit.yml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index 00891018cc319..f4b17052ccfdc 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -84,6 +84,10 @@ jobs: - .github/workflows/ur-* ur_cuda_adapter: - 'unified-runtime/source/adapters/cuda/**' + ur_offload_adapter: + - 'unified-runtime/include/**' + - 'unified-runtime/source/adapters/offload/**' + - '.github/workflows/ur-build-offload.yml' - name: Set output id: result @@ -94,7 +98,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", "ur", "ur_cuda_adapter"]; + return ["llvm", "llvm_spirv", "clang", "sycl_jit", "xptifw", "libclc", "sycl", "ci", "esimd", "ur", "ur_cuda_adapter", "ur_offload_adapter"]; - run: echo '${{ steps.result.outputs.result }}' diff --git a/.github/workflows/ur-precommit.yml b/.github/workflows/ur-precommit.yml index 26381323b5d09..daa45353e6833 100644 --- a/.github/workflows/ur-precommit.yml +++ b/.github/workflows/ur-precommit.yml @@ -102,7 +102,7 @@ jobs: offload_build: name: Adapters (Offload) needs: [detect_changes, source_checks] - if: ${{ always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur') }} + if: ${{ always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_offload_adapter') }} uses: ./.github/workflows/ur-build-offload.yml macos: From c708abcec31361a7255d99c933c9c61048b55017 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Fri, 4 Jul 2025 10:06:45 +0100 Subject: [PATCH 6/7] Remove self-hosted from runs-on specifier --- .github/workflows/ur-build-offload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ur-build-offload.yml b/.github/workflows/ur-build-offload.yml index 85e62cc9fb57f..fdef41c5b491d 100644 --- a/.github/workflows/ur-build-offload.yml +++ b/.github/workflows/ur-build-offload.yml @@ -13,7 +13,7 @@ jobs: build_type: [Release] compiler: [{c: gcc, cxx: g++}] - runs-on: [ "self-hosted", "Linux", "build" ] + runs-on: [ "Linux", "build" ] container: image: 'ghcr.io/intel/llvm/ubuntu2404_base' From 7344d6341637f4348b10ca54be7b44bf0c6509f3 Mon Sep 17 00:00:00 2001 From: Ross Brunton Date: Fri, 4 Jul 2025 10:08:02 +0100 Subject: [PATCH 7/7] Use $GITHUB_WORKSPACE --- .github/workflows/ur-build-offload.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ur-build-offload.yml b/.github/workflows/ur-build-offload.yml index fdef41c5b491d..c8be0c7384472 100644 --- a/.github/workflows/ur-build-offload.yml +++ b/.github/workflows/ur-build-offload.yml @@ -29,7 +29,7 @@ jobs: run: > cmake -S unified-runtime - -B build + -B $GITHUB_WORKSPACE/build -DCMAKE_C_COMPILER=${{matrix.compiler.c}} -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} @@ -39,15 +39,15 @@ jobs: -DUR_BUILD_ADAPTER_OFFLOAD=ON -DUR_OFFLOAD_INSTALL_DIR="/usr/lib/llvm-21" -DUR_OFFLOAD_INCLUDE_DIR="/usr/lib/llvm-21/include" - -DCMAKE_INSTALL_PREFIX=./install + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install - name: Build # This is so that device binaries can find the sycl runtime library - run: cmake --build build -j $(nproc) + run: cmake --build $GITHUB_WORKSPACE/build -j $(nproc) - name: Install # This is to check that install command does not fail - run: cmake --install build + run: cmake --install $GITHUB_WORKSPACE/build - name: Get information about platform if: ${{ always() }}