DPC++ Runtime
Runtime libraries for oneAPI Data Parallel C++
cl::sycl::detail::queue_impl Class Reference

#include <detail/queue_impl.hpp>

Public Types

using SubmitPostProcessF = std::function< void(bool, bool, event &)>
 

Public Member Functions

 queue_impl (const DeviceImplPtr &Device, const async_handler &AsyncHandler, const property_list &PropList)
 Constructs a SYCL queue from a device using an async_handler and property_list provided. More...
 
 queue_impl (const DeviceImplPtr &Device, const ContextImplPtr &Context, const async_handler &AsyncHandler, const property_list &PropList)
 Constructs a SYCL queue with an async_handler and property_list provided form a device and a context. More...
 
 queue_impl (RT::PiQueue PiQueue, const ContextImplPtr &Context, const async_handler &AsyncHandler)
 Constructs a SYCL queue from plugin interoperability handle. More...
 
 ~queue_impl ()
 
cl_command_queue get ()
 
context get_context () const
 
const plugingetPlugin () const
 
const ContextImplPtrgetContextImplPtr () const
 
const DeviceImplPtrgetDeviceImplPtr () const
 
device get_device () const
 
bool is_host () const
 
template<info::queue Param>
info::param_traits< info::queue, Param >::return_type get_info () const
 Queries SYCL queue for information. More...
 
event submit (const std::function< void(handler &)> &CGF, const std::shared_ptr< queue_impl > &Self, const std::shared_ptr< queue_impl > &SecondQueue, const detail::code_location &Loc, const SubmitPostProcessF *PostProcess=nullptr)
 Submits a command group function object to the queue, in order to be scheduled for execution on the device. More...
 
event submit (const std::function< void(handler &)> &CGF, const std::shared_ptr< queue_impl > &Self, const detail::code_location &Loc, const SubmitPostProcessF *PostProcess=nullptr)
 Submits a command group function object to the queue, in order to be scheduled for execution on the device. More...
 
void wait (const detail::code_location &Loc={})
 Performs a blocking wait for the completion of all enqueued tasks in the queue. More...
 
exception_list getExceptionList () const
 
void wait_and_throw (const detail::code_location &Loc={})
 
void throw_asynchronous ()
 Performs a blocking wait for the completion of all enqueued tasks in the queue. More...
 
RT::PiQueue createQueue (QueueOrder Order)
 Creates PI queue. More...
 
RT::PiQueuegetExclusiveQueueHandleRef ()
 
RT::PiQueuegetHandleRef ()
 
template<typename propertyT >
bool has_property () const
 
template<typename propertyT >
propertyT get_property () const
 
event memset (const std::shared_ptr< queue_impl > &Self, void *Ptr, int Value, size_t Count, const std::vector< event > &DepEvents)
 Fills the memory pointed by a USM pointer with the value specified. More...
 
event memcpy (const std::shared_ptr< queue_impl > &Self, void *Dest, const void *Src, size_t Count, const std::vector< event > &DepEvents)
 Copies data from one memory region to another, both pointed by USM pointers. More...
 
event mem_advise (const std::shared_ptr< queue_impl > &Self, const void *Ptr, size_t Length, pi_mem_advice Advice, const std::vector< event > &DepEvents)
 Provides additional information to the underlying runtime about how different allocations are used. More...
 
void reportAsyncException (const std::exception_ptr &ExceptionPtr)
 Puts exception to the list of asynchronous ecxeptions. More...
 
ThreadPoolgetThreadPool ()
 
void stopThreadPool ()
 
pi_native_handle getNative () const
 Gets the native handle of the SYCL queue. More...
 
buffer< AssertHappened, 1 > & getAssertHappenedBuffer ()
 

Static Public Member Functions

static ContextImplPtr getDefaultOrNew (const DeviceImplPtr &Device)
 

Detailed Description

Definition at line 53 of file queue_impl.hpp.

Member Typedef Documentation

◆ SubmitPostProcessF

using cl::sycl::detail::queue_impl::SubmitPostProcessF = std::function<void(bool, bool, event &)>

Definition at line 178 of file queue_impl.hpp.

Constructor & Destructor Documentation

◆ queue_impl() [1/3]

cl::sycl::detail::queue_impl::queue_impl ( const DeviceImplPtr Device,
const async_handler AsyncHandler,
const property_list PropList 
)
inline

Constructs a SYCL queue from a device using an async_handler and property_list provided.

Parameters
Deviceis a SYCL device that is used to dispatch tasks submitted to the queue.
AsyncHandleris a SYCL asynchronous exception handler.
PropListis a list of properties to use for queue construction.

Definition at line 78 of file queue_impl.hpp.

◆ queue_impl() [2/3]

cl::sycl::detail::queue_impl::queue_impl ( const DeviceImplPtr Device,
const ContextImplPtr Context,
const async_handler AsyncHandler,
const property_list PropList 
)
inline

Constructs a SYCL queue with an async_handler and property_list provided form a device and a context.

Parameters
Deviceis a SYCL device that is used to dispatch tasks submitted to the queue.
Contextis a SYCL context to associate with the queue being constructed.
AsyncHandleris a SYCL asynchronous exception handler.
PropListis a list of properties to use for queue construction.

Definition at line 91 of file queue_impl.hpp.

◆ queue_impl() [3/3]

cl::sycl::detail::queue_impl::queue_impl ( RT::PiQueue  PiQueue,
const ContextImplPtr Context,
const async_handler AsyncHandler 
)
inline

Constructs a SYCL queue from plugin interoperability handle.

Parameters
PiQueueis a raw PI queue handle.
Contextis a SYCL context to associate with the queue being constructed.
AsyncHandleris a SYCL asynchronous exception handler.

Definition at line 117 of file queue_impl.hpp.

◆ ~queue_impl()

cl::sycl::detail::queue_impl::~queue_impl ( )
inline

Member Function Documentation

◆ createQueue()

◆ get()

cl_command_queue cl::sycl::detail::queue_impl::get ( )
inline
Returns
an OpenCL interoperability queue handle.

Definition at line 145 of file queue_impl.hpp.

References cl::sycl::detail::plugin::call(), cl::sycl::detail::pi::getPlugin(), PI_INVALID_QUEUE, and piQueueRetain().

◆ get_context()

context cl::sycl::detail::queue_impl::get_context ( ) const
inline
Returns
an associated SYCL context.

Definition at line 156 of file queue_impl.hpp.

◆ get_device()

device cl::sycl::detail::queue_impl::get_device ( ) const
inline
Returns
an associated SYCL device.

Definition at line 167 of file queue_impl.hpp.

◆ get_info()

template<info::queue Param>
info::param_traits<info::queue, Param>::return_type cl::sycl::detail::queue_impl::get_info ( ) const

Queries SYCL queue for information.

The return type depends on information being queried.

◆ get_property()

template<typename propertyT >
propertyT cl::sycl::detail::queue_impl::get_property ( ) const
inline
Returns
a copy of the property of type PropertyT that the queue was constructed with. If the queue was not constructed with the PropertyT property, an invalid_object_error SYCL exception.

Definition at line 351 of file queue_impl.hpp.

◆ getAssertHappenedBuffer()

buffer<AssertHappened, 1>& cl::sycl::detail::queue_impl::getAssertHappenedBuffer ( )
inline

Definition at line 419 of file queue_impl.hpp.

◆ getContextImplPtr()

const ContextImplPtr& cl::sycl::detail::queue_impl::getContextImplPtr ( ) const
inline

Definition at line 162 of file queue_impl.hpp.

◆ getDefaultOrNew()

static ContextImplPtr cl::sycl::detail::queue_impl::getDefaultOrNew ( const DeviceImplPtr Device)
inlinestatic

Definition at line 57 of file queue_impl.hpp.

References cl::sycl::detail::getSyclObjImpl().

◆ getDeviceImplPtr()

const DeviceImplPtr& cl::sycl::detail::queue_impl::getDeviceImplPtr ( ) const
inline

Definition at line 164 of file queue_impl.hpp.

◆ getExceptionList()

exception_list cl::sycl::detail::queue_impl::getExceptionList ( ) const
inline
Returns
list of asynchronous exceptions occurred during execution.

Definition at line 233 of file queue_impl.hpp.

◆ getExclusiveQueueHandleRef()

RT::PiQueue& cl::sycl::detail::queue_impl::getExclusiveQueueHandleRef ( )
inline
Returns
a raw PI handle for a free queue. The returned handle is not retained. It is caller responsibility to make sure queue is still alive.

Definition at line 304 of file queue_impl.hpp.

References cl::sycl::detail::plugin::call(), cl::sycl::detail::pi::getPlugin(), cl::sycl::detail::MaxNumQueues, cl::sycl::detail::Ordered, and piQueueFinish().

◆ getHandleRef()

RT::PiQueue& cl::sycl::detail::queue_impl::getHandleRef ( )
inline
Returns
a raw PI queue handle. The returned handle is not retained. It is caller responsibility to make sure queue is still alive.

Definition at line 335 of file queue_impl.hpp.

◆ getNative()

pi_native_handle cl::sycl::detail::queue_impl::getNative ( ) const

Gets the native handle of the SYCL queue.

Returns
a native handle.

Definition at line 345 of file queue_impl.cpp.

References cl::sycl::detail::plugin::call(), cl::sycl::detail::plugin::getBackend(), cl::sycl::detail::pi::getPlugin(), piextQueueGetNativeHandle(), and piQueueRetain().

◆ getPlugin()

const plugin& cl::sycl::detail::queue_impl::getPlugin ( ) const
inline

Definition at line 160 of file queue_impl.hpp.

◆ getThreadPool()

ThreadPool& cl::sycl::detail::queue_impl::getThreadPool ( )
inline

Definition at line 401 of file queue_impl.hpp.

◆ has_property()

template<typename propertyT >
bool cl::sycl::detail::queue_impl::has_property ( ) const
inline
Returns
true if the queue was constructed with property specified by PropertyT.

Definition at line 344 of file queue_impl.hpp.

◆ is_host()

bool cl::sycl::detail::queue_impl::is_host ( ) const
inline
Returns
true if this queue is a SYCL host queue.

Definition at line 170 of file queue_impl.hpp.

◆ mem_advise()

event cl::sycl::detail::queue_impl::mem_advise ( const std::shared_ptr< queue_impl > &  Self,
const void *  Ptr,
size_t  Length,
pi_mem_advice  Advice,
const std::vector< event > &  DepEvents 
)

Provides additional information to the underlying runtime about how different allocations are used.

Parameters
Selfis a shared_ptr to this queue.
Ptris a USM pointer to the allocation.
Lengthis a number of bytes in the allocation.
Adviceis a device-defined advice for the specified allocation.
DepEventsis a vector of events that specifies the kernel dependencies.
Returns
an event representing advise operation.

Definition at line 92 of file queue_impl.cpp.

References cl::sycl::detail::getOrWaitEvents(), cl::sycl::detail::pi::getPlugin(), and cl::sycl::detail::prepareUSMEvent().

◆ memcpy()

event cl::sycl::detail::queue_impl::memcpy ( const std::shared_ptr< queue_impl > &  Self,
void *  Dest,
const void *  Src,
size_t  Count,
const std::vector< event > &  DepEvents 
)

Copies data from one memory region to another, both pointed by USM pointers.

Parameters
Selfis a shared_ptr to this queue.
Destis a USM pointer to the destination memory.
Srcis a USM pointer to the source memory.
Countis a number of bytes to copy.
DepEventsis a vector of events that specifies the kernel dependencies.
Returns
an event representing copy operation.

Definition at line 73 of file queue_impl.cpp.

References cl::sycl::detail::getOrWaitEvents(), cl::sycl::detail::pi::getPlugin(), and cl::sycl::detail::prepareUSMEvent().

◆ memset()

event cl::sycl::detail::queue_impl::memset ( const std::shared_ptr< queue_impl > &  Self,
void *  Ptr,
int  Value,
size_t  Count,
const std::vector< event > &  DepEvents 
)

Fills the memory pointed by a USM pointer with the value specified.

Parameters
Selfis a shared_ptr to this queue.
Ptris a USM pointer to the memory to fill.
Valueis a value to be set. Value is cast as an unsigned char.
Countis a number of bytes to fill.
DepEventsis a vector of events that specifies the kernel dependencies.
Returns
an event representing fill operation.

Definition at line 54 of file queue_impl.cpp.

References cl::sycl::detail::getOrWaitEvents(), cl::sycl::detail::pi::getPlugin(), and cl::sycl::detail::prepareUSMEvent().

◆ reportAsyncException()

void cl::sycl::detail::queue_impl::reportAsyncException ( const std::exception_ptr &  ExceptionPtr)
inline

Puts exception to the list of asynchronous ecxeptions.

Parameters
ExceptionPtris a pointer to exception to be put.

Definition at line 396 of file queue_impl.hpp.

◆ stopThreadPool()

void cl::sycl::detail::queue_impl::stopThreadPool ( )
inline

Definition at line 408 of file queue_impl.hpp.

◆ submit() [1/2]

event cl::sycl::detail::queue_impl::submit ( const std::function< void(handler &)> &  CGF,
const std::shared_ptr< queue_impl > &  Self,
const detail::code_location Loc,
const SubmitPostProcessF PostProcess = nullptr 
)
inline

Submits a command group function object to the queue, in order to be scheduled for execution on the device.

Parameters
CGFis a function object containing command group.
Selfis a shared_ptr to this queue.
Locis the code location of the submit call (default argument)
StoreAdditionalInfomakes additional info be stored in event_impl
Returns
a SYCL event object for the submitted command group.

Definition at line 218 of file queue_impl.hpp.

◆ submit() [2/2]

event cl::sycl::detail::queue_impl::submit ( const std::function< void(handler &)> &  CGF,
const std::shared_ptr< queue_impl > &  Self,
const std::shared_ptr< queue_impl > &  SecondQueue,
const detail::code_location Loc,
const SubmitPostProcessF PostProcess = nullptr 
)
inline

Submits a command group function object to the queue, in order to be scheduled for execution on the device.

On a kernel error, this command group function object is then scheduled for execution on a secondary queue.

Parameters
CGFis a function object containing command group.
Selfis a shared_ptr to this queue.
SecondQueueis a shared_ptr to the secondary queue.
Locis the code location of the submit call (default argument)
StoreAdditionalInfomakes additional info be stored in event_impl
Returns
a SYCL event object, which corresponds to the queue the command group is being enqueued on.

Definition at line 193 of file queue_impl.hpp.

◆ throw_asynchronous()

void cl::sycl::detail::queue_impl::throw_asynchronous ( )
inline

Performs a blocking wait for the completion of all enqueued tasks in the queue.

Synchronous errors will be reported through SYCL exceptions. Asynchronous errors will be passed to the async_handler passed to the queue on construction. If no async_handler was provided then asynchronous exceptions will be lost.

Definition at line 248 of file queue_impl.hpp.

References cl::sycl::exception_list::size().

◆ wait()

void cl::sycl::detail::queue_impl::wait ( const detail::code_location Loc = {})

Performs a blocking wait for the completion of all enqueued tasks in the queue.

Synchronous errors will be reported through SYCL exceptions.

Parameters
Locis the code location of the submit call (default argument)

Definition at line 250 of file queue_impl.cpp.

References cl::sycl::detail::plugin::call(), cl::sycl::detail::plugin::getBackend(), cl::sycl::detail::pi::getPlugin(), piQueueFinish(), and cl::sycl::detail::SYCL_STREAM_NAME.

◆ wait_and_throw()

void cl::sycl::detail::queue_impl::wait_and_throw ( const detail::code_location Loc = {})
inline
Parameters
Locis the code location of the submit call (default argument)

Definition at line 236 of file queue_impl.hpp.


The documentation for this class was generated from the following files: