DPC++ Runtime
Runtime libraries for oneAPI DPC++
_pi_queue Struct Reference

PI queue mapping on to CUstream objects. More...

#include <cuda/pi_cuda.hpp>

Collaboration diagram for _pi_queue:

Classes

struct  CommandBatch
 
struct  pi_queue_group_t
 

Public Types

using native_type = CUstream
 
using native_type = hipStream_t
 
using queue_type = _pi_device::queue_group_info_t::type
 
typedef struct _pi_queue::CommandBatch command_batch
 

Public Member Functions

 _pi_queue (std::vector< CUstream > &&compute_streams, std::vector< CUstream > &&transfer_streams, _pi_context *context, _pi_device *device, pi_queue_properties properties, unsigned int flags, bool backend_owns=true)
 
 ~_pi_queue ()
 
native_type get_next_compute_stream (pi_uint32 *stream_token=nullptr)
 
native_type get_next_compute_stream (pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, _pi_stream_guard &guard, pi_uint32 *stream_token=nullptr)
 
native_type get_next_transfer_stream ()
 
native_type get ()
 
bool has_been_synchronized (pi_uint32 stream_token)
 
bool can_reuse_stream (pi_uint32 stream_token)
 
template<typename T >
void for_each_stream (T &&f)
 
template<typename T >
void sync_streams (T &&f)
 
_pi_contextget_context () const
 
_pi_deviceget_device () const
 
pi_uint32 increment_reference_count () noexcept
 
pi_uint32 decrement_reference_count () noexcept
 
pi_uint32 get_reference_count () const noexcept
 
pi_uint32 get_next_event_id () noexcept
 
bool backend_has_ownership () const noexcept
 
 _pi_queue (pi_context ContextArg, cm_support::CmQueue *CmQueueArg)
 
 _pi_queue (hipStream_t stream, _pi_context *context, _pi_device *device, pi_queue_properties properties)
 
 ~_pi_queue ()
 
native_type get () const noexcept
 
_pi_contextget_context () const
 
pi_uint32 increment_reference_count () noexcept
 
pi_uint32 decrement_reference_count () noexcept
 
pi_uint32 get_reference_count () const noexcept
 
pi_uint32 get_next_event_id () noexcept
 
 _pi_queue (std::vector< ze_command_queue_handle_t > &ComputeQueues, std::vector< ze_command_queue_handle_t > &CopyQueues, pi_context Context, pi_device Device, bool OwnZeCommandQueue, pi_queue_properties Properties=0)
 
pi_result synchronize ()
 
pi_queue_group_tgetQueueGroup (bool UseCopyEngine)
 
bool useCopyEngine (bool PreferCopyEngine=true) const
 
void CaptureIndirectAccesses ()
 
bool isBatchingAllowed (bool IsCopy) const
 
bool isInOrderQueue () const
 
void adjustBatchSizeForFullBatch (bool IsCopy)
 
void adjustBatchSizeForPartialBatch (bool IsCopy)
 
pi_result resetCommandList (pi_command_list_ptr_t CommandList, bool MakeAvailable, std::vector< _pi_event * > &EventListToCleanup)
 
bool hasOpenCommandList (bool IsCopy) const
 
pi_result executeCommandList (pi_command_list_ptr_t CommandList, bool IsBlocking=false, bool OKToBatchCommand=false)
 
pi_result executeOpenCommandList (bool IsCopy)
 
pi_command_list_ptr_t eventOpenCommandList (pi_event Event)
 
pi_result executeAllOpenCommandLists ()
 

Public Attributes

std::vector< native_typecompute_streams_
 
std::vector< native_typetransfer_streams_
 
std::vector< bool > delay_compute_
 
_pi_contextcontext_
 
_pi_devicedevice_
 
pi_queue_properties properties_
 
std::atomic_uint32_t refCount_
 
std::atomic_uint32_t eventCount_
 
std::atomic_uint32_t compute_stream_idx_
 
std::atomic_uint32_t transfer_stream_idx_
 
unsigned int num_compute_streams_
 
unsigned int num_transfer_streams_
 
unsigned int last_sync_compute_streams_
 
unsigned int last_sync_transfer_streams_
 
unsigned int flags_
 
std::mutex compute_stream_sync_mutex_
 
std::mutex compute_stream_mutex_
 
std::mutex transfer_stream_mutex_
 
bool has_ownership_
 
pi_context Context = nullptr
 
cm_support::CmQueue * CmQueuePtr = nullptr
 
native_type stream_
 
pi_queue_group_t ComputeQueueGroup {this, queue_type::Compute}
 
pi_queue_group_t CopyQueueGroup {this, queue_type::MainCopy}
 
const pi_context Context
 
const pi_device Device
 
pi_event LastCommandEvent = nullptr
 
std::vector< pi_kernelKernelsToBeSubmitted
 
bool OwnZeCommandQueue
 
pi_command_list_map_t CommandListMap
 
command_batch ComputeCommandBatch
 
command_batch CopyCommandBatch
 
pi_queue_properties Properties
 
pi_uint32 RefCountExternal {1}
 
bool Healthy {true}
 

Static Public Attributes

static constexpr int default_num_compute_streams = 128
 
static constexpr int default_num_transfer_streams = 64
 

Detailed Description

PI queue mapping on to CUstream objects.

PI queue mapping on to hipStream_t objects.

Definition at line 392 of file pi_cuda.hpp.

Member Typedef Documentation

◆ command_batch

◆ native_type [1/2]

using _pi_queue::native_type = hipStream_t

Definition at line 372 of file pi_hip.hpp.

◆ native_type [2/2]

Definition at line 393 of file pi_cuda.hpp.

◆ queue_type

Constructor & Destructor Documentation

◆ _pi_queue() [1/4]

_pi_queue::_pi_queue ( std::vector< CUstream > &&  compute_streams,
std::vector< CUstream > &&  transfer_streams,
_pi_context context,
_pi_device device,
pi_queue_properties  properties,
unsigned int  flags,
bool  backend_owns = true 
)
inline

Definition at line 424 of file pi_cuda.hpp.

Referenced by piextQueueCreateWithNativeHandle(), and piQueueCreate().

◆ ~_pi_queue() [1/2]

_pi_queue::~_pi_queue ( )
inline

Definition at line 440 of file pi_cuda.hpp.

References context_, cuda_piContextRelease(), cuda_piDeviceRelease(), and device_.

◆ _pi_queue() [2/4]

_pi_queue::_pi_queue ( pi_context  ContextArg,
cm_support::CmQueue *  CmQueueArg 
)
inline

Definition at line 109 of file pi_esimd_emulator.hpp.

◆ _pi_queue() [3/4]

_pi_queue::_pi_queue ( hipStream_t  stream,
_pi_context context,
_pi_device device,
pi_queue_properties  properties 
)
inline

Definition at line 381 of file pi_hip.hpp.

◆ ~_pi_queue() [2/2]

_pi_queue::~_pi_queue ( )
inline

Definition at line 389 of file pi_hip.hpp.

References context_, device_, hip_piContextRelease(), and hip_piDeviceRelease().

◆ _pi_queue() [4/4]

_pi_queue::_pi_queue ( std::vector< ze_command_queue_handle_t > &  ComputeQueues,
std::vector< ze_command_queue_handle_t > &  CopyQueues,
pi_context  Context,
pi_device  Device,
bool  OwnZeCommandQueue,
pi_queue_properties  Properties = 0 
)

Definition at line 1055 of file pi_level_zero.cpp.

References Context.

Member Function Documentation

◆ adjustBatchSizeForFullBatch()

◆ adjustBatchSizeForPartialBatch()

◆ backend_has_ownership()

bool _pi_queue::backend_has_ownership ( ) const
inlinenoexcept

Definition at line 583 of file pi_cuda.hpp.

References has_ownership_.

Referenced by cuda_piQueueRelease().

◆ can_reuse_stream()

bool _pi_queue::can_reuse_stream ( pi_uint32  stream_token)
inline

Definition at line 466 of file pi_cuda.hpp.

References compute_stream_idx_, compute_streams_, has_been_synchronized(), and max().

Referenced by get_next_compute_stream().

◆ CaptureIndirectAccesses()

void _pi_queue::CaptureIndirectAccesses ( )

◆ decrement_reference_count() [1/2]

pi_uint32 _pi_queue::decrement_reference_count ( )
inlinenoexcept

Definition at line 400 of file pi_hip.hpp.

References refCount_.

◆ decrement_reference_count() [2/2]

pi_uint32 _pi_queue::decrement_reference_count ( )
inlinenoexcept

Definition at line 577 of file pi_cuda.hpp.

References refCount_.

Referenced by cuda_piQueueRelease(), and hip_piQueueRelease().

◆ eventOpenCommandList()

◆ executeAllOpenCommandLists()

pi_result _pi_queue::executeAllOpenCommandLists ( )
inline

◆ executeCommandList()

◆ executeOpenCommandList()

◆ for_each_stream()

template<typename T >
void _pi_queue::for_each_stream ( T &&  f)
inline

◆ get() [1/2]

◆ get() [2/2]

native_type _pi_queue::get ( ) const
inlinenoexcept

Definition at line 394 of file pi_hip.hpp.

References stream_.

◆ get_context() [1/2]

_pi_context* _pi_queue::get_context ( ) const
inline

Definition at line 396 of file pi_hip.hpp.

References context_.

◆ get_context() [2/2]

◆ get_device()

_pi_device* _pi_queue::get_device ( ) const
inline

Definition at line 573 of file pi_cuda.hpp.

References device_.

Referenced by cuda_piEnqueueKernelLaunch().

◆ get_next_compute_stream() [1/2]

◆ get_next_compute_stream() [2/2]

CUstream _pi_queue::get_next_compute_stream ( pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
_pi_stream_guard guard,
pi_uint32 stream_token = nullptr 
)

◆ get_next_event_id() [1/2]

pi_uint32 _pi_queue::get_next_event_id ( )
inlinenoexcept

Definition at line 404 of file pi_hip.hpp.

References eventCount_.

◆ get_next_event_id() [2/2]

pi_uint32 _pi_queue::get_next_event_id ( )
inlinenoexcept

Definition at line 581 of file pi_cuda.hpp.

References eventCount_.

Referenced by _pi_event::record().

◆ get_next_transfer_stream()

◆ get_reference_count() [1/2]

pi_uint32 _pi_queue::get_reference_count ( ) const
inlinenoexcept

Definition at line 402 of file pi_hip.hpp.

References refCount_.

◆ get_reference_count() [2/2]

pi_uint32 _pi_queue::get_reference_count ( ) const
inlinenoexcept

Definition at line 579 of file pi_cuda.hpp.

References refCount_.

Referenced by cuda_piQueueGetInfo(), cuda_piQueueRetain(), hip_piQueueGetInfo(), and hip_piQueueRetain().

◆ getQueueGroup()

pi_queue_group_t& _pi_queue::getQueueGroup ( bool  UseCopyEngine)
inline

Definition at line 859 of file pi_level_zero.hpp.

Referenced by _pi_context::getAvailableCommandList().

◆ has_been_synchronized()

bool _pi_queue::has_been_synchronized ( pi_uint32  stream_token)
inline

Definition at line 458 of file pi_cuda.hpp.

References last_sync_compute_streams_, and max().

Referenced by can_reuse_stream().

◆ hasOpenCommandList()

bool _pi_queue::hasOpenCommandList ( bool  IsCopy) const
inline

◆ increment_reference_count() [1/2]

pi_uint32 _pi_queue::increment_reference_count ( )
inlinenoexcept

Definition at line 398 of file pi_hip.hpp.

References refCount_.

◆ increment_reference_count() [2/2]

pi_uint32 _pi_queue::increment_reference_count ( )
inlinenoexcept

Definition at line 575 of file pi_cuda.hpp.

References refCount_.

Referenced by cuda_piQueueRetain(), and hip_piQueueRetain().

◆ isBatchingAllowed()

bool _pi_queue::isBatchingAllowed ( bool  IsCopy) const

◆ isInOrderQueue()

◆ resetCommandList()

pi_result _pi_queue::resetCommandList ( pi_command_list_ptr_t  CommandList,
bool  MakeAvailable,
std::vector< _pi_event * > &  EventListToCleanup 
)

◆ sync_streams()

◆ synchronize()

◆ useCopyEngine()

bool _pi_queue::useCopyEngine ( bool  PreferCopyEngine = true) const

Member Data Documentation

◆ CmQueuePtr

cm_support::CmQueue* _pi_queue::CmQueuePtr = nullptr

Definition at line 114 of file pi_esimd_emulator.hpp.

Referenced by piQueueRelease().

◆ CommandListMap

◆ compute_stream_idx_

std::atomic_uint32_t _pi_queue::compute_stream_idx_

Definition at line 409 of file pi_cuda.hpp.

Referenced by can_reuse_stream(), get_next_compute_stream(), and sync_streams().

◆ compute_stream_mutex_

std::mutex _pi_queue::compute_stream_mutex_

Definition at line 420 of file pi_cuda.hpp.

Referenced by for_each_stream(), get_next_compute_stream(), and sync_streams().

◆ compute_stream_sync_mutex_

std::mutex _pi_queue::compute_stream_sync_mutex_

Definition at line 419 of file pi_cuda.hpp.

Referenced by get_next_compute_stream(), and sync_streams().

◆ compute_streams_

std::vector<native_type> _pi_queue::compute_streams_

◆ ComputeCommandBatch

◆ ComputeQueueGroup

pi_queue_group_t _pi_queue::ComputeQueueGroup {this, queue_type::Compute}

◆ Context [1/2]

pi_context _pi_queue::Context = nullptr

Definition at line 113 of file pi_esimd_emulator.hpp.

Referenced by _pi_queue(), USMSharedMemoryAlloc::allocateImpl(), USMSharedReadOnlyMemoryAlloc::allocateImpl(), USMDeviceMemoryAlloc::allocateImpl(), USMHostMemoryAlloc::allocateImpl(), ContextReleaseHelper(), createEventAndAssociateQueue(), USMMemoryAllocBase::deallocate(), enqueueMemCopyHelper(), enqueueMemCopyRectHelper(), enqueueMemFillHelper(), enqueueMemImageCommandHelper(), EventCreate(), _pi_buffer::free(), _pi_context::getAvailableCommandList(), _pi_buffer::getZeHandle(), IsDevicePointer(), piclProgramCreateWithSource(), piContextGetInfo(), piContextRelease(), piContextRetain(), piEnqueueEventsWait(), piEnqueueEventsWaitWithBarrier(), piEnqueueKernelLaunch(), piEnqueueMemBufferMap(), piEnqueueMemUnmap(), piEventCreate(), piEventRelease(), piextContextGetNativeHandle(), piextContextSetExtendedDeleter(), piextEventCreateWithNativeHandle(), piextKernelCreateWithNativeHandle(), piextMemCreateWithNativeHandle(), piextProgramCreateWithNativeHandle(), piextQueueCreateWithNativeHandle(), piextUSMDeviceAlloc(), piextUSMEnqueueMemAdvise(), piextUSMEnqueueMemcpy(), piextUSMEnqueuePrefetch(), piextUSMFree(), piextUSMGetMemAllocInfo(), piextUSMHostAlloc(), piextUSMSharedAlloc(), piMemBufferCreate(), piMemImageCreate(), piProgramCreate(), piProgramCreateWithBinary(), piProgramLink(), piQueueCreate(), piQueueGetInfo(), piSamplerCreate(), resetCommandList(), synchronize(), USMDeviceAllocImpl(), USMFreeHelper(), USMFreeImpl(), USMHostAllocImpl(), USMSharedAllocImpl(), ZeDeviceMemAllocHelper(), ZeHostMemAllocHelper(), and ZeMemFreeHelper().

◆ Context [2/2]

const pi_context _pi_queue::Context

Definition at line 871 of file pi_level_zero.hpp.

◆ context_

_pi_context * _pi_queue::context_

Definition at line 404 of file pi_cuda.hpp.

Referenced by cuda_piQueueGetInfo(), get_context(), hip_piQueueGetInfo(), and ~_pi_queue().

◆ CopyCommandBatch

◆ CopyQueueGroup

pi_queue_group_t _pi_queue::CopyQueueGroup {this, queue_type::MainCopy}

◆ default_num_compute_streams

constexpr int _pi_queue::default_num_compute_streams = 128
staticconstexpr

Definition at line 394 of file pi_cuda.hpp.

Referenced by cuda_piQueueCreate().

◆ default_num_transfer_streams

constexpr int _pi_queue::default_num_transfer_streams = 64
staticconstexpr

Definition at line 395 of file pi_cuda.hpp.

Referenced by cuda_piQueueCreate().

◆ delay_compute_

std::vector<bool> _pi_queue::delay_compute_

Definition at line 403 of file pi_cuda.hpp.

Referenced by get_next_compute_stream(), and sync_streams().

◆ Device

◆ device_

◆ eventCount_

std::atomic_uint32_t _pi_queue::eventCount_

Definition at line 408 of file pi_cuda.hpp.

Referenced by get_next_event_id().

◆ flags_

unsigned int _pi_queue::flags_

Definition at line 415 of file pi_cuda.hpp.

Referenced by get_next_compute_stream(), and get_next_transfer_stream().

◆ has_ownership_

bool _pi_queue::has_ownership_

Definition at line 422 of file pi_cuda.hpp.

Referenced by backend_has_ownership().

◆ Healthy

bool _pi_queue::Healthy {true}

Definition at line 1018 of file pi_level_zero.hpp.

Referenced by executeCommandList(), piQueueRelease(), and synchronize().

◆ KernelsToBeSubmitted

std::vector<pi_kernel> _pi_queue::KernelsToBeSubmitted

Definition at line 890 of file pi_level_zero.hpp.

Referenced by CaptureIndirectAccesses(), and piEnqueueKernelLaunch().

◆ last_sync_compute_streams_

unsigned int _pi_queue::last_sync_compute_streams_

Definition at line 413 of file pi_cuda.hpp.

Referenced by has_been_synchronized(), and sync_streams().

◆ last_sync_transfer_streams_

unsigned int _pi_queue::last_sync_transfer_streams_

Definition at line 414 of file pi_cuda.hpp.

Referenced by sync_streams().

◆ LastCommandEvent

◆ num_compute_streams_

unsigned int _pi_queue::num_compute_streams_

Definition at line 411 of file pi_cuda.hpp.

Referenced by for_each_stream(), get_next_compute_stream(), and sync_streams().

◆ num_transfer_streams_

unsigned int _pi_queue::num_transfer_streams_

Definition at line 412 of file pi_cuda.hpp.

Referenced by for_each_stream(), get_next_transfer_stream(), and sync_streams().

◆ OwnZeCommandQueue

bool _pi_queue::OwnZeCommandQueue

Definition at line 897 of file pi_level_zero.hpp.

Referenced by piQueueReleaseInternal().

◆ Properties

◆ properties_

pi_queue_properties _pi_queue::properties_

◆ refCount_

std::atomic_uint32_t _pi_queue::refCount_

◆ RefCountExternal

pi_uint32 _pi_queue::RefCountExternal {1}

Definition at line 1015 of file pi_level_zero.hpp.

Referenced by piQueueRelease(), and piQueueRetain().

◆ stream_

native_type _pi_queue::stream_

Definition at line 374 of file pi_hip.hpp.

Referenced by get(), and hip_piQueueFinish().

◆ transfer_stream_idx_

std::atomic_uint32_t _pi_queue::transfer_stream_idx_

Definition at line 410 of file pi_cuda.hpp.

Referenced by get_next_transfer_stream(), and sync_streams().

◆ transfer_stream_mutex_

std::mutex _pi_queue::transfer_stream_mutex_

Definition at line 421 of file pi_cuda.hpp.

Referenced by for_each_stream(), get_next_transfer_stream(), and sync_streams().

◆ transfer_streams_

std::vector<native_type> _pi_queue::transfer_streams_

Definition at line 398 of file pi_cuda.hpp.

Referenced by for_each_stream(), get_next_transfer_stream(), and sync_streams().


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