Introduce common infrastructure for runtimes that determines compiler
resource path locations. These variables introduced are:
* RUNTIMES_OUTPUT_RESOURCE_DIR
* RUNTIMES_INSTALL_RESOURCE_PATH
That contain the location for the compiler resource path (typically
`lib/clang/<version>`) in the build tree and the install tree (the
latter relative to CMAKE_INSTALL_PREFIX).
Additionally, define
* RUNTIMES_OUTPUT_RESOURCE_LIB_DIR
* RUNTIMES_INSTALL_RESOURCE_LIB_PATH
as for the location of clang/flang version-locked libraries (typically
`lib${LLVM_LIBDIR_SUFFIX}/<targer-triple>`, but also depends on `APPLE`
and `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR`). This code is moved from
flang-rt and initially becomes its only user.
Refactored out of #171610 as requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2687382481).
Extracted `get_runtimes_target_libdir_common` from compiler-rt as
requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2689565634).
Added TODO comments to all runtimes as requested
[here](https://github.com/llvm/llvm-project/pull/171610#issuecomment-3789598635).
both libsycl & liboffload uses static variables.
on Linux static variable destructor is called earlier than the method
with `__attribute__((destructor(...)))`.
this fix helps to avoid crash due to liboffload static variable early
destruction.
the approach utilizes the following rule
"For each local object obj with static storage duration, obj is
destroyed as if a function calling the destructor of obj were registered
with
[std::atexit](https://en.cppreference.com/w/cpp/utility/program/atexit.html)
at the completion of the constructor of obj."
from `std::exit`.
in the first call of get_platforms we call liboffload's iterateDevices
that leads to liboffload static storage initialization. Then we
initialize our own local static var after this to be able to call our
shutdown methods earlier and before the liboffload objects are
destructed at the end of program.
Important note:
SYCL RT follows SYCL 2020 specification that doesn't declare any
init/shutdown methods that can help to avoid usage of static variables.
---------
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
After https://github.com/llvm/llvm-project/pull/181872 the function
takes an argument. Pass `nullptr` to have it do the same thing as
before.
This wasn't caught because the only builder that builds `libsycl` is not
in the production builder area at the moment.
Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
This PR brings initial version of lit configs for libsycl tests.
We plan to add more tests for libsycl integration with the compiler in
the future.
---------
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
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/74080https://discourse.llvm.org/t/rfc-sycl-runtime-upstreaming/74479
The SYCL runtime is device-agnostic and uses liboffload for offloading
to GPU. This commit adds a dependency on liboffload, implementation of
platform::get_platforms, platform::get_backend and platform::get_info
methods, initial implementation of sycl-ls tool for manual testing of
added functionality.
Plan for next PR:
device/context impl, rest of platform
test infrastructure (depends on L0 liboffload plugin CI, our effort is
joined) ABI tests
---------
Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>