[llvm] [SYCL] Add sycl::device initial implementation (PR #176972)
Dmitry Rogozhkin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 21 09:00:48 PST 2026
================
@@ -0,0 +1,182 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// This file contains the declaration of the SYCL 2020 device class, which
+/// represents a single SYCL device on which kernels can be executed.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBSYCL___IMPL_DEVICE_HPP
+#define _LIBSYCL___IMPL_DEVICE_HPP
+
+#include <sycl/__impl/aspect.hpp>
+#include <sycl/__impl/backend.hpp>
+#include <sycl/__impl/device_selector.hpp>
+#include <sycl/__impl/info/device.hpp>
+
+#include <sycl/__impl/detail/config.hpp>
+#include <sycl/__impl/detail/obj_utils.hpp>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+
+class platform;
+
+namespace detail {
+class DeviceImpl;
+} // namespace detail
+
+// SYCL 2020 4.6.4. Device class.
+class _LIBSYCL_EXPORT device {
+public:
+ device(const device &rhs) = default;
+
+ device(device &&rhs) = default;
+
+ device &operator=(const device &rhs) = default;
+
+ device &operator=(device &&rhs) = default;
+
+ friend bool operator==(const device &lhs, const device &rhs) {
----------------
dvrogozh wrote:
Ok, that's a concept of "hidden friend classes".... I was not aware of it.
https://github.com/llvm/llvm-project/pull/176972
More information about the llvm-commits
mailing list