-
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
Conversation
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
|
This PR:
FYI @tahonermann, @dvrogozh, @asudarsa, @aelovikov-intel, @sergey-semenov |
dvrogozh
left a comment
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 still strongly believe that adding external dependency on UR even as a temporary solution to later switch to liboffload is a wrong step to do. This will tight effort to the external project (UR) which potentially supports much more cases than initially will be implemented in liboffload. That might lead to problems switching to libofffload and might artifically delay the switch. I still suggest that final solutions needs to be worked on instead. This seems more pragmatic from my perspective.
In case you want to proceed with UR approach I suggest to add a description to the readme on UR in this PR to highlight liboffload considerations and temporal status of UR solution with the instructions on how developers can work on liboffload for sycl.
| 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, |
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.
| object owns a ur_adapter_handle_t, which represents a UR backend (e.g. OpenCL, | |
| object owns a ``ur_adapter_handle_t``, which represents a UR backend (e.g. OpenCL, |
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.
done in fe6b582
|
|
||
| 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. The parts of it primarily utilized by SYCL RT are its C API, loader |
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.
"The parts of it primarily utilized by SYCL RT are its C API, loader
library, and the adapter libraries that implement the API for various backends."
This one reads too heavy. Can we reformulate this simpler? Maybe starting with "SYCL RT utilizes its C API, ...."?
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.
done in fe6b582
| :local: | ||
|
|
||
| .. _unified runtime: | ||
|
|
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.
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?
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
00d5ea4 to
fe6b582
Compare
I don't agree that I should document UR & liboffload replacements in UR related documentation. I will add notes into index.rst that now contains some details about current status of upstreaming & plans. Anyway I am not hiding that UR is a temporal solution - this data is present in PR description. But I can't provide any instructions about how people can work on liboffload for sycl while that project is under discussion and AFAIK doesn't even have stable architecture and API. @stdale-intel please correct me if I misunderstood smth. |
|
Hi @tahonermann, @dvrogozh, @asudarsa, @aelovikov-intel, @sergey-semenov, |
| runs-on: ubuntu-22.04 | ||
| # reuse libcxx container for now | ||
| container: ghcr.io/llvm/libcxx-linux-builder:2b57ebb50b6d418e70382e655feaa619b558e254 | ||
| continue-on-error: false |
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.
| 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") |
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.
@sarnex, I think you're our CMake expert, can you take a look at the CMake part in this PR, please?
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 think you're our CMake expert
Oh god please no
| - name: Register cleanup after job is finished | ||
| uses: ./libsycl/utils/ci/actions/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.
I don't think we need any of that here. AFAIK, cleanup is necessary in our syclos CI because we use self-hosted runners and the working directory isn't cleaned up between tasks. With GH-provided runner that isn't an issue.
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 requested system for self-hosted runner. So I do expect us to need this in future. Although you are right about current state, I will remove it then.
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.
done in 918ba92
| @@ -0,0 +1,7 @@ | |||
| name: '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.
All three files here can be dropped, IMO, see my earlier comment.
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.
done in 918ba92
|
|
||
| # Options to override the default behaviour of the FetchContent to include UR | ||
| # source code. | ||
| set(LIBSYCL_UR_OVERRIDE_FETCH_CONTENT_REPO |
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.
In the current pattern we aren't having any variables for repo override, tag override, or to use FetchContent. The only way a user can specify anything is by overriding the FetchContent automatically generated variable which is FETCHCONTENT_SOURCE_DIR_<uppercaseName> which will tell CMake to use that directory instead of downloading anything, we don't need to do anything to handle it.
So right now I've been doing:
- if(NOT FETCHCONTENT_SOURCE_DIR_(converttouppsersomehow(${fetch-name}))
Ideallyfind_package, if notfind_path
else()
FetchContent_Declare
...
...
endif()
Basically, assuming the user didn't explicitly specify a custom directory to use, search the system and if it's found use that, otherwise fall back to FetchContent which will either actually git clone or will use the user specified directory.
Example PR here
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.
@sarnex what do you mean under "we don't have any variables for repo override... The only way a user can specify anything is by overriding..."?
we can easily override all present variables with:
for example -DLIBSYCL_UR_OVERRIDE_FETCH_CONTENT_REPO=something in the build command line.
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 'the standard way it is being done for other dependencies is ...', so I was trying to say all other dependenices don't have user-settable variables for the repo url/tag but this one does, so I recommend removing them to simplify and align with how we handle other deps. Thanks
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.
done in 9daa5a7
I also removed fetch_adapter_source since it brings extra detalization (comes from intel/llvm) which is unlikely to be used.
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 also used find_package since UR has proper configs to use it.
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.
music to my ears!
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
aelovikov-intel
left a comment
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'm still throwing @sarnex under the bus carrying CMake expert status :D
sarnex
left a comment
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.
cmake lgtm minus nits! thanks!
| if(NOT FETCHCONTENT_SOURCE_DIR_UNIFIED-RUNTIME) | ||
| find_package(unified-runtime) | ||
| if(unified-runtime_FOUND) | ||
| message ("STATUS: unified-runtime is found") |
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.
nit
| message ("STATUS: unified-runtime is found") | |
| message (STATUS "Found system install of unified-runtime") |
or something like 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.
| endif() | ||
|
|
||
| # Disable errors from warnings while building the UR. | ||
| # And remember origin 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.
nit
| # 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.
|
|
||
| # Disable errors from warnings while building the UR. | ||
| # And remember origin flags before doing that. | ||
| set(CMAKE_CXX_FLAGS_BAK "${CMAKE_CXX_FLAGS}") |
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?
| "${unified-runtime_SOURCE_DIR}" CACHE PATH | ||
| "Path to Unified Runtime Headers" FORCE) | ||
|
|
||
| set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") |
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.
nit
| set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES") | |
| set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "UMF EXAMPLES") |
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've brought this fate on myself |
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
|
I believe I've got feedback from RT side (Andrey), CMAKE expert (Nick), some comments from Arvind (in the former PR) and Dmitriy. |
😬 |
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
Signed-off-by: Tikhomirova, Kseniya <[email protected]>
67ec169 to
c54afad
Compare
This is part of the SYCL support upstreaming effort. The relevant RFCs can
be found here:
https://discourse.llvm.org/t/rfc-add-full-support-for-the-sycl-programming-model/74080
https://discourse.llvm.org/t/rfc-sycl-runtime-upstreaming/74479
The SYCL runtime is device-agnostic and uses Unified Runtime (GitHub -
oneapi-src/unified-runtime) as an external dependency. This Unified Runtime
serves as an interface layer between the SYCL runtime and device-specific
backends. Unified Runtime has several adapters that bind to various backends.
NOTE: UR is considered as temporal solution until llvm-project/offload is
fully functional and is able to replace UR.
This commit adds:
fetching UR, UR build as dependency, document with a short overview of UR
with links to repos and documentation.