-
Notifications
You must be signed in to change notification settings - Fork 0
[SYCL] Add RT dependency on interface layer for offloading #4
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
Changes from 4 commits
cbd4127
b047308
8866561
fe6b582
918ba92
9daa5a7
142c224
085f778
c54afad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # This file defines pre-commit CI for libsycl++. | ||
| name: Build libsycl | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'libsycl/**' | ||
| - '.github/workflows/libsycl-build-and-test.yaml' | ||
|
|
||
| permissions: | ||
| contents: read # Default everything to read-only | ||
|
|
||
| concurrency: | ||
| # Cancel a currently running workflow from the same PR | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build_ubuntu2204: | ||
| # sergey-semenov repo is set is for test purposes | ||
| if: github.repository_owner == 'sergey-semenov' | ||
| # github runner | ||
| runs-on: ubuntu-22.04 | ||
| # reuse libcxx container for now | ||
| container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254 | ||
| continue-on-error: false | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Register cleanup after job is finished | ||
| uses: ./libsycl/utils/ci/actions/cleanup | ||
|
||
| - name: Compile | ||
| env: | ||
| CC: 'clang-21' | ||
| CXX: 'clang++-21' | ||
| run: | | ||
| mkdir -p $GITHUB_WORKSPACE/build | ||
| mkdir -p $GITHUB_WORKSPACE/install | ||
| cmake -G Ninja -S $GITHUB_WORKSPACE/runtimes -B $GITHUB_WORKSPACE/build \ | ||
| -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install \ | ||
| -DLLVM_ENABLE_RUNTIMES="libsycl" \ | ||
| -DCMAKE_BUILD_TYPE=Release | ||
| ninja -C $GITHUB_WORKSPACE/build install --verbose | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,212 @@ | ||||||
| #=============================================================================== | ||||||
| # Fetches Unified Runtime used by SYCL language runtime to abstract SYCL open | ||||||
| # standard and vendor heterogeneous offload interfaces. | ||||||
| # | ||||||
| # This will in time be replaced by the new LLVM Offload interface. | ||||||
| # | ||||||
| # Unified Runtime is Apache 2.0 license with LLVM exceptions. | ||||||
| # | ||||||
| #=============================================================================== | ||||||
|
|
||||||
| # Options to override the default behaviour of the FetchContent to include UR | ||||||
| # source code. | ||||||
| set(LIBSYCL_UR_OVERRIDE_FETCH_CONTENT_REPO | ||||||
|
||||||
| "" CACHE STRING "Override the Unified Runtime FetchContent repository") | ||||||
| set(LIBSYCL_UR_OVERRIDE_FETCH_CONTENT_TAG | ||||||
| "" CACHE STRING "Override the Unified Runtime FetchContent tag") | ||||||
|
|
||||||
| # Options to disable use of FetchContent to include Unified Runtime source code | ||||||
| # to improve developer workflow. | ||||||
| option(LIBSYCL_UR_USE_FETCH_CONTENT | ||||||
| "Use FetchContent to acquire the Unified Runtime source code" ON) | ||||||
| set(LIBSYCL_UR_SOURCE_DIR | ||||||
| "" CACHE PATH "Path to root of Unified Runtime repository") | ||||||
|
||||||
|
|
||||||
| option(LIBSYCL_UR_BUILD_TESTS "Build tests for UR" OFF) | ||||||
| set(UR_BUILD_TESTS "${LIBSYCL_UR_BUILD_TESTS}" CACHE BOOL "" FORCE) | ||||||
| # UR tests require the examples to be built | ||||||
| set(UR_BUILD_EXAMPLES "${LIBSYCL_UR_BUILD_TESTS}" CACHE BOOL "" FORCE) | ||||||
|
|
||||||
| set(UR_EXTERNAL_DEPENDENCIES "sycl-headers" CACHE STRING | ||||||
| "List of external CMake targets for executables/libraries to depend on" FORCE) | ||||||
|
|
||||||
| if("level_zero" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||||||
| set(UR_BUILD_ADAPTER_L0 ON) | ||||||
| endif() | ||||||
| if("cuda" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||||||
| set(UR_BUILD_ADAPTER_CUDA ON) | ||||||
| endif() | ||||||
| if("hip" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||||||
| set(UR_BUILD_ADAPTER_HIP ON) | ||||||
| endif() | ||||||
| if("opencl" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||||||
| set(UR_BUILD_ADAPTER_OPENCL ON) | ||||||
| endif() | ||||||
|
|
||||||
| # Disable errors from warnings while building the UR. | ||||||
| # And remember origin flags before doing that. | ||||||
|
||||||
| # And remember origin flags before doing that. | |
| # And remember the original flags before doing that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to backup/restore CFLAGS as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libsycl will be warning free while UR build fails with Werror enabled. So yes, we can't use LLVM top level warning strategy for this dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry i mean right now we are only backing up and restoring CMAKE_CXX_FLAGS, do we need to do CMAKE_C_FLAGS as well?
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ===================== | ||
| Unified Runtime | ||
| ===================== | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| .. _unified runtime: | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was highlighted in the discussion of #2 that UR is a temporary solution. Can this be described here in this document noting what the permanent solution will be and how to try it out (and work on it) instead? |
||
| The Unified Runtime (UR) project serves as an interface layer between the SYCL | ||
| runtime and the device-specific runtime layers which control execution on | ||
| devices. SYCL RT utilizes its C API, loader library, and the adapter libraries | ||
| that implement the API for various backends. | ||
|
|
||
| The SYCL runtime accesses the UR API via the Adapter object. Each Adapter | ||
| object owns a ``ur_adapter_handle_t``, which represents a UR backend (e.g. OpenCL, | ||
| Level Zero, etc). | ||
|
|
||
| For detailed information about the UR project including | ||
| the API specification see the `Unified Runtime Documentation | ||
| <https://oneapi-src.github.io/unified-runtime/core/INTRO.html>`__. You | ||
| can find the Unified Runtime repo `here | ||
| <https://github.com/oneapi-src/unified-runtime>`__. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| name: 'Cleanup' | ||
|
||
| description: 'Cleanup work directory upon job finish' | ||
|
|
||
| runs: | ||
| using: 'node16' | ||
| main: 'dummy.js' | ||
| post: 'cleanup.js' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| const path = process.env.GITHUB_WORKSPACE + '/*'; | ||
| console.log('Cleaning ' + path) | ||
| require('child_process').execSync('rm -rf ' + path); | ||
| require('child_process').execSync('rm -rf ' + process.env.GITHUB_WORKSPACE + '/.git'); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| console.log('setup cleanup'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen this explicitly stated anywhere. https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idcontinue-on-error
it sounds like it should be the default but nothing bad will happen if I explicitly specify my intention here.