forked from llvm/llvm-project
-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cbd4127
Add UR dependency
KseniyaTikhomirova b047308
build only sycl lib
KseniyaTikhomirova 8866561
remove extra cmake handling for ur
KseniyaTikhomirova fe6b582
fix comments
KseniyaTikhomirova 918ba92
remove extra actions (cleanup)
KseniyaTikhomirova 9daa5a7
introduce usage of FETCHCONTENT_SOURCE_DIR_<name> for UR
KseniyaTikhomirova 142c224
fix nits
KseniyaTikhomirova 085f778
update UR tag
KseniyaTikhomirova c54afad
update UR again
KseniyaTikhomirova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # 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: 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| #=============================================================================== | ||
| # 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. | ||
| # | ||
| #=============================================================================== | ||
|
|
||
| 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) | ||
|
|
||
| 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 the original flags before doing that. | ||
| set(CMAKE_CXX_FLAGS_BAK "${CMAKE_CXX_FLAGS}") | ||
| if(WIN32) | ||
| append("/WX-" CMAKE_CXX_FLAGS) | ||
| append("/WX-" CMAKE_C_FLAGS) | ||
| # Unified runtime build fails with /DUNICODE | ||
| append("/UUNICODE" CMAKE_CXX_FLAGS) | ||
| append("/UUNICODE" CMAKE_C_FLAGS) | ||
| else() | ||
| append("-Wno-error" CMAKE_CXX_FLAGS) | ||
| append("-Wno-error" CMAKE_C_FLAGS) | ||
| endif() | ||
|
|
||
| if(NOT FETCHCONTENT_SOURCE_DIR_UNIFIED-RUNTIME) | ||
| find_package(unified-runtime) | ||
| if(unified-runtime_FOUND) | ||
| message (STATUS "Found system install of unified-runtime") | ||
| return() | ||
| endif() | ||
| endif() | ||
|
|
||
| include(FetchContent) | ||
|
|
||
| set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git") | ||
| set(UNIFIED_RUNTIME_TAG 8ee4da175c197d4dc5c9ec939e7e4d87d4edfa99) | ||
|
|
||
| FetchContent_Declare(unified-runtime | ||
| GIT_REPOSITORY ${UNIFIED_RUNTIME_REPO} | ||
| GIT_TAG ${UNIFIED_RUNTIME_TAG} | ||
| ) | ||
|
|
||
| FetchContent_GetProperties(unified-runtime) | ||
| if(FETCHCONTENT_SOURCE_DIR_UNIFIED-RUNTIME) | ||
| message(STATUS "Using specified Unified Runtime repo location at ${FETCHCONTENT_SOURCE_DIR_UNIFIED-RUNTIME}") | ||
| else() | ||
| message(STATUS "Cloning Unified Runtime from ${UNIFIED_RUNTIME_REPO}") | ||
| endif() | ||
| FetchContent_MakeAvailable(unified-runtime) | ||
|
|
||
| set(UNIFIED_RUNTIME_SOURCE_DIR | ||
| "${unified-runtime_SOURCE_DIR}" CACHE PATH | ||
| "Path to Unified Runtime Headers" FORCE) | ||
|
|
||
| set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "UMF EXAMPLES") | ||
| # Due to the use of dependentloadflag and no installer for UMF and hwloc we need | ||
| # to link statically on windows | ||
| if(WIN32) | ||
| set(UMF_BUILD_SHARED_LIBRARY OFF CACHE INTERNAL "Build UMF shared library") | ||
| set(UMF_LINK_HWLOC_STATICALLY ON CACHE INTERNAL "static HWLOC") | ||
| endif() | ||
|
|
||
| # Restore original flags | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK}") | ||
|
|
||
| message(STATUS | ||
| "Using Unified Runtime source directory: ${UNIFIED_RUNTIME_SOURCE_DIR}") | ||
|
|
||
| set(UNIFIED_RUNTIME_INCLUDE_DIR "${UNIFIED_RUNTIME_SOURCE_DIR}/include") | ||
| set(UNIFIED_RUNTIME_SRC_INCLUDE_DIR "${UNIFIED_RUNTIME_SOURCE_DIR}/source") | ||
| set(UNIFIED_RUNTIME_COMMON_INCLUDE_DIR "${UNIFIED_RUNTIME_SOURCE_DIR}/source/common") | ||
|
|
||
| add_library(UnifiedRuntimeLoader ALIAS ur_loader) | ||
| add_library(UnifiedRuntime-Headers INTERFACE) | ||
|
|
||
| target_include_directories(UnifiedRuntime-Headers | ||
| INTERFACE | ||
| "${UNIFIED_RUNTIME_INCLUDE_DIR}" | ||
| ) | ||
|
|
||
| add_custom_target(UnifiedRuntimeAdapters) | ||
|
|
||
| function(add_sycl_ur_adapter NAME) | ||
| add_dependencies(UnifiedRuntimeAdapters ur_adapter_${NAME}) | ||
| endfunction() | ||
|
|
||
| if("level_zero" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||
| add_sycl_ur_adapter(level_zero) | ||
| endif() | ||
|
|
||
| if("cuda" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||
| add_sycl_ur_adapter(cuda) | ||
| endif() | ||
|
|
||
| if("hip" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||
| add_sycl_ur_adapter(hip) | ||
| endif() | ||
|
|
||
| if("opencl" IN_LIST LIBSYCL_ENABLE_BACKENDS) | ||
| add_sycl_ur_adapter(opencl) | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ===================== | ||
| Unified Runtime | ||
| ===================== | ||
|
|
||
| .. contents:: | ||
| :local: | ||
|
|
||
| .. _unified runtime: | ||
|
|
||
| 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>`__. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.