22 inline namespace _V1 {
25 const async_handler &AsyncHandler,
const property_list &PropList) {
26 const std::vector<device> Devs = SyclContext.get_devices();
32 const device &SyclDevice = *std::max_element(Devs.begin(), Devs.end(), Comp);
34 impl = std::make_shared<detail::queue_impl>(
41 impl = std::make_shared<detail::queue_impl>(
48 impl = std::make_shared<detail::queue_impl>(
54 :
queue(SyclContext, deviceSelector,
60 :
queue(SyclContext, SyclDevice,
67 impl = std::make_shared<detail::queue_impl>(
69 reinterpret_cast<ur_queue_handle_t
>(clQueue),
73 cl_command_queue
queue::get()
const {
return impl->get(); }
80 return impl->getCommandGraph()
81 ? ext::oneapi::experimental::queue_state::recording
82 : ext::oneapi::experimental::queue_state::executing;
88 auto Graph = impl->getCommandGraph();
92 "ext_oneapi_get_graph() can only be called on recording queues.");
104 return impl->memset(impl, Ptr, Value, Count, {},
true);
110 return impl->memset(impl, Ptr, Value, Count, {DepEvent},
115 const std::vector<event> &DepEvents,
118 return impl->memset(impl, Ptr, Value, Count, DepEvents,
125 return impl->memcpy(impl, Dest, Src, Count, {},
true,
132 return impl->memcpy(impl, Dest, Src, Count, {DepEvent},
137 const std::vector<event> &DepEvents,
140 return impl->memcpy(impl, Dest, Src, Count, DepEvents,
147 return impl->mem_advise(impl, Ptr, Length, ur_usm_advice_flags_t(Advice), {},
154 return impl->mem_advise(impl, Ptr, Length, ur_usm_advice_flags_t(Advice),
160 const std::vector<event> &DepEvents,
163 return impl->mem_advise(impl, Ptr, Length, ur_usm_advice_flags_t(Advice),
168 event queue::submit_impl(std::function<
void(
handler &)> CGH,
170 return impl->submit(CGH, impl, CodeLoc);
173 event queue::submit_impl(std::function<
void(
handler &)> CGH,
queue SecondQueue,
174 const detail::code_location &CodeLoc) {
175 return impl->submit(CGH, impl, SecondQueue.impl, CodeLoc);
178 void queue::submit_without_event_impl(std::function<
void(handler &)> CGH,
179 const detail::code_location &CodeLoc) {
180 return impl->submit_without_event(CGH, impl, CodeLoc);
183 event queue::submit_impl_and_postprocess(
184 std::function<
void(handler &)> CGH,
const detail::code_location &CodeLoc,
185 const SubmitPostProcessF &PostProcess) {
186 return impl->submit(CGH, impl, CodeLoc, &PostProcess);
189 event queue::submit_impl_and_postprocess(
190 std::function<
void(handler &)> CGH, queue SecondQueue,
191 const detail::code_location &CodeLoc,
192 const SubmitPostProcessF &PostProcess) {
193 return impl->submit(CGH, impl, SecondQueue.impl, CodeLoc, &PostProcess);
201 impl->wait_and_throw(CodeLoc);
210 assert(!QueueImpl->getCommandGraph() &&
211 "Should not be called in on graph recording.");
213 return QueueImpl->getLastEvent();
224 if (
is_in_order() && !impl->getCommandGraph() && !impl->MDiscardEvents &&
225 !impl->MIsProfilingEnabled) {
229 return InOrderLastEvent;
247 begin(WaitList), end(WaitList), [&](
const event &Event) ->
bool {
249 return EventImpl->isDefaultConstructed() || EventImpl->isNOP();
251 if (
is_in_order() && !impl->getCommandGraph() && !impl->MDiscardEvents &&
252 !impl->MIsProfilingEnabled && AllEventsEmptyOrNop) {
256 return InOrderLastEvent;
263 template <
typename Param>
266 return impl->get_info<Param>();
269 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, Picode) \
270 template __SYCL_EXPORT ReturnT queue::get_info<info::queue::Desc>() const;
272 #include <sycl/info/queue_traits.def>
274 #undef __SYCL_PARAM_TRAITS_SPEC
276 template <
typename Param>
279 return impl->get_backend_info<Param>();
282 #define __SYCL_PARAM_TRAITS_SPEC(DescType, Desc, ReturnT, Picode) \
283 template __SYCL_EXPORT ReturnT \
284 queue::get_backend_info<info::DescType::Desc>() const;
286 #include <sycl/info/sycl_backend_traits.def>
288 #undef __SYCL_PARAM_TRAITS_SPEC
291 return has_property<property::queue::in_order>();
301 return impl->getNative(NativeHandleDesc);
304 event queue::memcpyToDeviceGlobal(
void *DeviceGlobalPtr,
const void *Src,
305 bool IsDeviceImageScope,
size_t NumBytes,
307 const std::vector<event> &DepEvents) {
308 return impl->memcpyToDeviceGlobal(impl, DeviceGlobalPtr, Src,
309 IsDeviceImageScope, NumBytes, Offset,
313 event queue::memcpyFromDeviceGlobal(
void *Dest,
const void *DeviceGlobalPtr,
314 bool IsDeviceImageScope,
size_t NumBytes,
316 const std::vector<event> &DepEvents) {
317 return impl->memcpyFromDeviceGlobal(impl, Dest, DeviceGlobalPtr,
318 IsDeviceImageScope, NumBytes, Offset,
322 bool queue::device_has(aspect Aspect)
const {
324 return impl->getDeviceImplPtr()->has(Aspect);
336 "ext_oneapi_get_last_event() can only be called on in-order queues.");
337 if (impl->MDiscardEvents)
340 "ext_oneapi_get_last_event() cannot be called on queues with the "
341 "ext::oneapi::property::queue::discard_events property.");
342 return impl->getLastEvent();
348 "ext_oneapi_set_external_event() can only be called "
349 "on in-order queues.");
350 if (impl->MDiscardEvents)
353 "ext_oneapi_set_external_event() cannot be called on queues with the "
354 "ext::oneapi::property::queue::discard_events property.");
355 return impl->setExternalEvent(external_event);
358 const property_list &queue::getPropList()
const {
return impl->getPropList(); }
366 return std::hash<unsigned long long>()(
The context class represents a SYCL context on which kernel functions may be executed.
Data type that manages the code_location information in TLS.
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
An event object can be used to synchronize memory transfers, enqueues of kernels and signaling barrie...
Graph in the modifiable state.
Command group handler class.
void ext_oneapi_barrier()
Prevents any commands submitted afterward to this queue from executing until all commands previously ...
Objects of the property_list class are containers for the SYCL properties.
Encapsulates a single SYCL queue which schedules kernels on a SYCL device.
bool ext_oneapi_empty() const
Allows to check status of the queue (completed vs noncompleted).
const property_list & PropList
event memcpy(void *Dest, const void *Src, size_t Count, const detail::code_location &CodeLoc=detail::code_location::current())
Copies data from one memory region to another, each is either a host pointer or a pointer within USM ...
queue(const property_list &PropList={})
Constructs a SYCL queue instance using the device returned by an instance of default_selector.
bool is_in_order() const
Returns whether the queue is in order or OoO.
event memset(void *Ptr, int Value, size_t Count, const detail::code_location &CodeLoc=detail::code_location::current())
Fills the memory pointed by a USM pointer with the value specified.
const device_selector const async_handler & AsyncHandler
event mem_advise(const void *Ptr, size_t Length, int Advice, const detail::code_location &CodeLoc=detail::code_location::current())
Provides additional information to the underlying runtime about how different allocations are used.
device get_device() const
backend get_backend() const noexcept
Returns the backend associated with this queue.
void ext_oneapi_set_external_event(const event &external_event)
bool ext_codeplay_supports_fusion() const
Returns true if the queue was created with the ext::codeplay::experimental::property::queue::enable_f...
void wait_and_throw_proxy(const detail::code_location &CodeLoc)
Proxy method for wait_and_throw to forward the code location information to the implementation.
event ext_oneapi_get_last_event() const
ur_native_handle_t getNative(int32_t &NativeHandleDesc) const
event ext_oneapi_submit_barrier(const detail::code_location &CodeLoc=detail::code_location::current())
Prevents any commands submitted afterward to this queue from executing until all commands previously ...
ext::oneapi::experimental::queue_state ext_oneapi_get_state() const
context get_context() const
bool has_property() const noexcept
detail::is_queue_info_desc< Param >::return_type get_info() const
Queries SYCL queue for information.
detail::is_backend_info_desc< Param >::return_type get_backend_info() const
Queries SYCL queue for SYCL backend-specific information.
const device_selector & DeviceSelector
ext::oneapi::experimental::command_graph< ext::oneapi::experimental::graph_state::modifiable > ext_oneapi_get_graph() const
void ext_oneapi_prod()
Provides a hint to the runtime that previously issued commands to this queue should begin executing o...
std::enable_if_t< std::is_invocable_r_v< void, T, handler & >, event > submit(T CGF, const detail::code_location &CodeLoc=detail::code_location::current())
Submits a command group function object to the queue, in order to be scheduled for execution on the d...
void wait_proxy(const detail::code_location &CodeLoc)
Proxy method for wait to forward the code location information to the implementation.
void throw_asynchronous()
Checks if any asynchronous errors have been produced by the queue and if so reports them to the async...
constexpr tuple_element< I, tuple< Types... > >::type & get(sycl::detail::tuple< Types... > &Arg) noexcept
decltype(Obj::impl) const & getSyclObjImpl(const Obj &SyclObject)
backend getImplBackend(const T &Impl)
T createSyclObjFromImpl(decltype(T::impl) ImplObj)
std::shared_ptr< sycl::detail::queue_impl > QueueImplPtr
@ modifiable
In modifiable state, commands can be added to graph.
static event getBarrierEventForInorderQueueHelper(const detail::QueueImplPtr QueueImpl)
std::function< void(sycl::exception_list)> async_handler
std::error_code make_error_code(sycl::errc E) noexcept
Constructs an error code using e and sycl_category()
bool all_of(const simd_mask< _Tp, _Abi > &) noexcept
_Abi const simd< _Tp, _Abi > & noexcept
size_t operator()(const sycl::queue &Q) const