18 #ifdef ALPAKA_ACC_SYCL_ENABLED
20 # include <sycl/sycl.hpp>
25 template<concepts::Tag TTag>
26 class EventGenericSycl final
29 explicit EventGenericSycl(DevGenericSycl<TTag>
const& dev) : m_dev{dev}
33 friend auto operator==(EventGenericSycl
const& lhs, EventGenericSycl
const& rhs) ->
bool
35 return (lhs.m_event == rhs.m_event);
38 friend auto operator!=(EventGenericSycl
const& lhs, EventGenericSycl
const& rhs) ->
bool
48 void setEvent(sycl::event
const& event)
53 DevGenericSycl<TTag> m_dev;
56 sycl::event m_event{};
63 template<concepts::Tag TTag>
64 struct GetDev<EventGenericSycl<TTag>>
66 static auto getDev(EventGenericSycl<TTag>
const& event) -> DevGenericSycl<TTag>
73 template<concepts::Tag TTag>
74 struct IsComplete<EventGenericSycl<TTag>>
76 static auto isComplete(EventGenericSycl<TTag>
const& event)
79 =
event.getNativeHandle().template get_info<sycl::info::event::command_execution_status>();
80 return (status == sycl::info::event_command_status::complete);
85 template<concepts::Tag TTag>
86 struct Enqueue<QueueGenericSyclNonBlocking<TTag>, EventGenericSycl<TTag>>
88 static auto enqueue(QueueGenericSyclNonBlocking<TTag>& queue, EventGenericSycl<TTag>& event)
90 event.setEvent(queue.m_spQueueImpl->get_last_event());
95 template<concepts::Tag TTag>
96 struct Enqueue<QueueGenericSyclBlocking<TTag>, EventGenericSycl<TTag>>
98 static auto enqueue(QueueGenericSyclBlocking<TTag>& queue, EventGenericSycl<TTag>& event)
100 event.setEvent(queue.m_spQueueImpl->get_last_event());
108 template<concepts::Tag TTag>
109 struct CurrentThreadWaitFor<EventGenericSycl<TTag>>
111 static auto currentThreadWaitFor(EventGenericSycl<TTag>
const& event)
113 event.getNativeHandle().wait_and_throw();
118 template<concepts::Tag TTag>
119 struct WaiterWaitFor<QueueGenericSyclNonBlocking<TTag>, EventGenericSycl<TTag>>
121 static auto waiterWaitFor(QueueGenericSyclNonBlocking<TTag>& queue, EventGenericSycl<TTag>
const& event)
123 queue.m_spQueueImpl->register_dependency(event.getNativeHandle());
128 template<concepts::Tag TTag>
129 struct WaiterWaitFor<QueueGenericSyclBlocking<TTag>, EventGenericSycl<TTag>>
131 static auto waiterWaitFor(QueueGenericSyclBlocking<TTag>& queue, EventGenericSycl<TTag>
const& event)
133 queue.m_spQueueImpl->register_dependency(event.getNativeHandle());
141 template<concepts::Tag TTag>
142 struct WaiterWaitFor<DevGenericSycl<TTag>, EventGenericSycl<TTag>>
144 static auto waiterWaitFor(DevGenericSycl<TTag>& dev, EventGenericSycl<TTag>
const& event)
146 dev.m_impl->register_dependency(event.getNativeHandle());
151 template<concepts::Tag TTag>
154 [[nodiscard]]
static auto getNativeHandle(EventGenericSycl<TTag>
const& event)
156 return event.getNativeHandle();
constexpr ALPAKA_FN_HOST_ACC bool operator==(Complex< T > const &lhs, Complex< T > const &rhs)
Equality of two complex numbers.
constexpr ALPAKA_FN_HOST_ACC bool operator!=(Complex< T > const &lhs, Complex< T > const &rhs)
Inequality of two complex numbers.
The alpaka accelerator library.
ALPAKA_FN_HOST auto isComplete(TEvent const &event) -> bool
Tests if the given event has already been completed.
decltype(getNativeHandle(std::declval< TImpl >())) NativeHandle
Alias to the type of the native handle.
ALPAKA_FN_HOST auto getDev(T const &t)
ALPAKA_FN_HOST auto getNativeHandle(TImpl const &impl)
Get the native handle of the alpaka object. It will return the alpaka object handle if there is any,...
ALPAKA_FN_HOST auto enqueue(TQueue &queue, TTask &&task) -> void
Queues the given task in the given queue.
static auto getNativeHandle(TImpl const &)