| //===----------------------------------------------------------------------===// | |
| // | |
| // 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/context.hpp> | |
| #include <sycl/__impl/queue.hpp> | |
| #include <detail/context_impl.hpp> | |
| #include <detail/device_impl.hpp> | |
| #include <detail/queue_impl.hpp> | |
| _LIBSYCL_BEGIN_NAMESPACE_SYCL | |
| queue::queue(const context &syclContext, const device &syclDevice, | |
| const async_handler &asyncHandler, const property_list &propList) { | |
| impl = detail::QueueImpl::create(detail::getSyclObjImpl(syclContext), | |
| *detail::getSyclObjImpl(syclDevice), | |
| asyncHandler, propList); | |
| } | |
| queue::queue(const context &syclContext, const device &syclDevice, | |
| const property_list &propList) | |
| : queue(syclContext, syclDevice, | |
| detail::getSyclObjImpl(syclContext)->get_async_handler(), | |
| propList) {} | |
| backend queue::get_backend() const noexcept { return impl->getBackend(); } | |
| context queue::get_context() const { | |
| return detail::createSyclObjFromImpl<context>(impl->getContext()); | |
| } | |
| device queue::get_device() const { | |
| return detail::createSyclObjFromImpl<device>(impl->getDevice()); | |
| } | |
| bool queue::is_in_order() const { return impl->isInOrder(); } | |
| void queue::wait() { impl->wait(); } | |
| void queue::wait_and_throw() { impl->waitAndThrow(); } | |
| void queue::throw_asynchronous() { impl->throwAsynchronous(); } | |
| event queue::memcpy(void *dest, const void *src, std::size_t numBytes, | |
| const std::vector<event> &depEvents) { | |
| std::shared_ptr<detail::EventImpl> EventImplPtr = | |
| impl->memcpy(dest, src, numBytes, detail::getSyclObjImpls(depEvents)); | |
| assert(EventImplPtr); | |
| return detail::createSyclObjFromImpl<event>(EventImplPtr); | |
| } | |
| event queue::prefetch(void *ptr, std::size_t numBytes, | |
| const std::vector<event> &depEvents) { | |
| std::shared_ptr<detail::EventImpl> EventImplPtr = | |
| impl->prefetch(ptr, numBytes, detail::getSyclObjImpls(depEvents)); | |
| assert(EventImplPtr); | |
| return detail::createSyclObjFromImpl<event>(EventImplPtr); | |
| } | |
| event queue::getLastEvent() { | |
| return detail::createSyclObjFromImpl<event>(impl->getLastEvent()); | |
| } | |
| void queue::setKernelLaunchParams(const std::vector<event> &Events, | |
| const detail::UnifiedRangeView &Range) { | |
| return impl->setKernelLaunchParams(detail::getSyclObjImpls(Events), Range); | |
| } | |
| void queue::submitKernelImpl(detail::DeviceKernelInfo &KernelInfo, | |
| void *ArgData, size_t ArgSize) { | |
| impl->submitKernelImpl(KernelInfo, ArgData, ArgSize); | |
| } | |
| event queue::fillImpl(void *Ptr, const void *Pattern, std::size_t PatternSize, | |
| std::size_t Count, const std::vector<event> &DepEvents) { | |
| std::shared_ptr<detail::EventImpl> EventImplPtr = impl->fill( | |
| Ptr, Pattern, PatternSize, Count, detail::getSyclObjImpls(DepEvents)); | |
| assert(EventImplPtr); | |
| return detail::createSyclObjFromImpl<event>(EventImplPtr); | |
| } | |
| event queue::submitWithHandler(const TypelessCGF &CGF) { | |
| return detail::createSyclObjFromImpl<event>(impl->submitWithHandler(CGF)); | |
| } | |
| _LIBSYCL_END_NAMESPACE_SYCL |