| //===----------------------------------------------------------------------===// |
| // |
| // 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 QueueImpl class, which implements |
| /// sycl::queue functionality. |
| /// |
| //===----------------------------------------------------------------------===// |
| |
| #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 |
| /// a propList. |
| /// |
| /// \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 the provided arguments. Variadic helper. |
| /// Restricts QueueImpl creation to std::shared_ptr allocations. |
| template <typename... Ts> |
| static std::shared_ptr<QueueImpl> create(Ts &&...args) { |
| return std::make_shared<QueueImpl>(std::forward<Ts>(args)..., PrivateTag{}); |
| } |
| |
| /// \return the SYCL backend this queue is associated with. |
| backend getBackend() const noexcept; |
| |
| /// \return the context implementation object this queue is associated with. |
| ContextImpl &getContext() { return MContext; } |
| |
| /// \return the device implementation object this queue is associated with. |
| DeviceImpl &getDevice() { return MDevice; } |
| |
| /// \return true if and only if the queue is in order. |
| bool isInOrder() const { return MIsInorder; } |
| |
| private: |
| const bool MIsInorder; |
| const async_handler MAsyncHandler; |
| const property_list MPropList; |
| DeviceImpl &MDevice; |
| ContextImpl &MContext; |
| }; |
| |
| } // namespace detail |
| |
| _LIBSYCL_END_NAMESPACE_SYCL |
| |
| #endif // _LIBSYCL_QUEUE_IMPL |