[llvm] [libsycl] Add sycl::queue stub (PR #184110)

Kseniya Tikhomirova via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 05:37:16 PST 2026


================
@@ -0,0 +1,83 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBSYCL_QUEUE_IMPL
+#define _LIBSYCL_QUEUE_IMPL
+
+#include <sycl/__impl/detail/config.hpp>
+#include <sycl/__impl/queue.hpp>
+
+#include <OffloadAPI.h>
+
+#include <memory>
+
+_LIBSYCL_BEGIN_NAMESPACE_SYCL
+namespace detail {
+
+class ContextImpl;
+class DeviceImpl;
+
+class QueueImpl : public std::enable_shared_from_this<QueueImpl> {
+  struct PrivateTag {
+    explicit PrivateTag() = default;
+  };
+
+public:
+  ~QueueImpl() = default;
+
+  /// Constructs a SYCL queue from a device using an asyncHandler and
+  /// propList provided.
+  ///
+  /// \param deviceImpl is a SYCL device that is used to dispatch tasks
+  /// submitted to the queue.
+  /// \param asyncHandler is a SYCL asynchronous exception handler.
+  /// \param propList is a list of properties to use for queue construction.
+  explicit QueueImpl(DeviceImpl &deviceImpl, const async_handler &asyncHandler,
+                     const property_list &propList, PrivateTag);
+
+  /// Constructs a QueueImpl with a provided arguments. Variadic helper.
+  /// Restrics ways of QueueImpl creation.
+  template <typename... Ts>
+  static std::shared_ptr<QueueImpl> create(Ts &&...args) {
+    return std::make_shared<QueueImpl>(std::forward<Ts>(args)..., PrivateTag{});
+  }
+
+  /// Returns backend this queue is associated with.
+  ///
+  /// \return SYCL backend.
+  backend getBackend() const noexcept;
+
+  /// Returns context this queue is associated with.
+  ///
+  /// \return context implementation object.
+  ContextImpl &getContext() { return MContext; }
+
+  /// Returns device this queue is associated with.
+  ///
+  /// \return device implementation object.
----------------
KseniyaTikhomirova wrote:

https://github.com/llvm/llvm-project/pull/184110/commits/d41b7ffc453281f191977166b31ba6681e8eca72

https://github.com/llvm/llvm-project/pull/184110


More information about the llvm-commits mailing list