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 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>
49 lines
1.5 KiB
C++
49 lines
1.5 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <sycl/__impl/detail/config.hpp>
|
|
#include <sycl/__impl/exception.hpp>
|
|
|
|
_LIBSYCL_BEGIN_NAMESPACE_SYCL
|
|
|
|
namespace detail {
|
|
class SYCLCategory : public std::error_category {
|
|
public:
|
|
const char *name() const noexcept override { return "sycl"; }
|
|
std::string message(int) const override { return "SYCL Error"; }
|
|
};
|
|
} // namespace detail
|
|
|
|
// Free functions
|
|
const std::error_category &sycl_category() noexcept {
|
|
static const detail::SYCLCategory SYCLCategoryObj;
|
|
return SYCLCategoryObj;
|
|
}
|
|
|
|
std::error_code make_error_code(sycl::errc Err) noexcept {
|
|
return std::error_code(static_cast<int>(Err), sycl_category());
|
|
}
|
|
|
|
// Exception methods implementation
|
|
exception::exception(std::error_code EC, const char *Msg)
|
|
: MMessage(std::make_shared<std::string>(Msg)), MErrC(EC) {}
|
|
|
|
exception::~exception() {}
|
|
|
|
const std::error_code &exception::code() const noexcept { return MErrC; }
|
|
|
|
const std::error_category &exception::category() const noexcept {
|
|
return code().category();
|
|
}
|
|
|
|
const char *exception::what() const noexcept { return MMessage->c_str(); }
|
|
|
|
bool exception::has_context() const noexcept { return false; }
|
|
|
|
_LIBSYCL_END_NAMESPACE_SYCL
|