DPC++ Runtime
Runtime libraries for oneAPI DPC++
pi_level_zero.hpp File Reference
#include <atomic>
#include <cassert>
#include <cstring>
#include <functional>
#include <list>
#include <map>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <string>
#include <sycl/detail/pi.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <level_zero/ze_api.h>
#include <level_zero/zes_api.h>
#include <sycl/detail/iostream_proxy.hpp>
#include "usm_allocator.hpp"
Include dependency graph for pi_level_zero.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ZeStruct< T >
 
struct  ZesStruct< T >
 
class  pi_shared_mutex
 
class  pi_mutex
 
struct  ZeCache< T >
 
struct  ReferenceCounter
 
struct  _pi_object
 
struct  MemAllocRecord
 
struct  _pi_platform
 A PI platform stores all known PI devices, in the CUDA plugin this is just a vector of available devices since initialization is done when devices are used. More...
 
class  USMMemoryAllocBase
 
class  USMSharedMemoryAlloc
 
class  USMSharedReadOnlyMemoryAlloc
 
class  USMDeviceMemoryAlloc
 
class  USMHostMemoryAlloc
 
struct  _pi_device
 PI device mapping to a CUdevice. More...
 
struct  _pi_device::queue_group_info_t
 
struct  pi_command_list_info_t
 
struct  _pi_context
 PI context mapping to a CUDA context object. More...
 
struct  _pi_queue
 PI queue mapping on to CUstream objects. More...
 
struct  _pi_queue::pi_queue_group_t
 
struct  _pi_queue::CommandBatch
 
struct  _pi_mem
 PI Mem mapping to CUDA memory allocations, both data and texture/surface. More...
 
struct  _pi_buffer
 
struct  _pi_buffer::allocation_t
 
struct  _pi_buffer::Mapping
 
struct  _pi_image
 
struct  _pi_ze_event_list_t
 
struct  _pi_event
 PI Event mapping to CUevent. More...
 
struct  _pi_program
 Implementation of PI Program on CUDA Module object. More...
 
class  _pi_program::SpecConstantShim
 
struct  _pi_kernel
 Implementation of a PI Kernel for CUDA. More...
 
struct  _pi_kernel::Hash
 
struct  _pi_kernel::ArgumentInfo
 
struct  _pi_sampler
 Implementation of samplers for CUDA. More...
 

Macros

#define _PI_LEVEL_ZERO_PLUGIN_VERSION   1
 
#define _PI_LEVEL_ZERO_PLUGIN_VERSION_STRING   _PI_PLUGIN_VERSION_STRING(_PI_LEVEL_ZERO_PLUGIN_VERSION)
 

Typedefs

typedef std::unordered_map< ze_command_list_handle_t, pi_command_list_info_tpi_command_list_map_t
 
typedef pi_command_list_map_t::iterator pi_command_list_ptr_t
 
using pi_buffer = _pi_buffer *
 

Enumerations

enum  EventsScope { AllHostVisible, OnDemandHostVisibleProxy, LastCommandInBatchHostVisible }
 

Functions

template<class To , class From >
To pi_cast (From Value)
 
template<>
uint32_t pi_cast (uint64_t Value)
 
void die (const char *Message)
 
template<class T >
ze_structure_type_t getZeStructureType ()
 
template<class T >
zes_structure_type_t getZesStructureType ()
 
template<>
ze_structure_type_t getZeStructureType< ze_event_pool_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_fence_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_command_list_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_context_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_relaxed_allocation_limits_exp_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_host_mem_alloc_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_mem_alloc_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_command_queue_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_image_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_module_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_module_program_exp_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_kernel_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_event_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_sampler_desc_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_driver_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_compute_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_command_queue_group_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_image_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_module_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_cache_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_memory_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_device_memory_access_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_module_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_kernel_properties_t > ()
 
template<>
ze_structure_type_t getZeStructureType< ze_memory_allocation_properties_t > ()
 
template<>
zes_structure_type_t getZesStructureType< zes_pci_properties_t > ()
 
template<>
zes_structure_type_t getZesStructureType< zes_mem_state_t > ()
 
template<>
zes_structure_type_t getZesStructureType< zes_mem_properties_t > ()
 

Variables

static const bool SingleThreadMode
 

Detailed Description

Declarations for Level Zero Plugin. It is the interface between the device-agnostic SYCL runtime layer and underlying Level Zero runtime.

Definition in file pi_level_zero.hpp.

Macro Definition Documentation

◆ _PI_LEVEL_ZERO_PLUGIN_VERSION

#define _PI_LEVEL_ZERO_PLUGIN_VERSION   1

Definition at line 23 of file pi_level_zero.hpp.

◆ _PI_LEVEL_ZERO_PLUGIN_VERSION_STRING

#define _PI_LEVEL_ZERO_PLUGIN_VERSION_STRING   _PI_PLUGIN_VERSION_STRING(_PI_LEVEL_ZERO_PLUGIN_VERSION)

Definition at line 25 of file pi_level_zero.hpp.

Typedef Documentation

◆ pi_buffer

using pi_buffer = _pi_buffer *

Definition at line 1108 of file pi_level_zero.hpp.

◆ pi_command_list_map_t

typedef std::unordered_map<ze_command_list_handle_t, pi_command_list_info_t> pi_command_list_map_t

Definition at line 621 of file pi_level_zero.hpp.

◆ pi_command_list_ptr_t

typedef pi_command_list_map_t::iterator pi_command_list_ptr_t

Definition at line 623 of file pi_level_zero.hpp.

Enumeration Type Documentation

◆ EventsScope

Enumerator
AllHostVisible 
OnDemandHostVisibleProxy 
LastCommandInBatchHostVisible 

Definition at line 467 of file pi_level_zero.hpp.

Function Documentation

◆ die()

void die ( const char Message)

Definition at line 64 of file pi_level_zero.hpp.

References std::cerr.

◆ getZesStructureType()

template<class T >
zes_structure_type_t getZesStructureType ( )

◆ getZesStructureType< zes_mem_properties_t >()

template<>
zes_structure_type_t getZesStructureType< zes_mem_properties_t > ( )

Definition at line 173 of file pi_level_zero.hpp.

◆ getZesStructureType< zes_mem_state_t >()

template<>
zes_structure_type_t getZesStructureType< zes_mem_state_t > ( )

Definition at line 169 of file pi_level_zero.hpp.

◆ getZesStructureType< zes_pci_properties_t >()

template<>
zes_structure_type_t getZesStructureType< zes_pci_properties_t > ( )

Definition at line 165 of file pi_level_zero.hpp.

◆ getZeStructureType()

template<class T >
ze_structure_type_t getZeStructureType ( )

◆ getZeStructureType< ze_command_list_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_command_list_desc_t > ( )

Definition at line 80 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_command_queue_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_command_queue_desc_t > ( )

Definition at line 98 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_command_queue_group_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_command_queue_group_properties_t > ( )

Definition at line 131 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_context_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_context_desc_t > ( )

Definition at line 83 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_cache_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_cache_properties_t > ( )

Definition at line 143 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_compute_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_compute_properties_t > ( )

Definition at line 127 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_image_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_image_properties_t > ( )

Definition at line 135 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_mem_alloc_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_mem_alloc_desc_t > ( )

Definition at line 95 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_memory_access_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_memory_access_properties_t > ( )

Definition at line 151 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_memory_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_memory_properties_t > ( )

Definition at line 147 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_module_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_module_properties_t > ( )

Definition at line 139 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_device_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_device_properties_t > ( )

Definition at line 123 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_driver_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_driver_properties_t > ( )

Definition at line 120 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_event_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_event_desc_t > ( )

Definition at line 114 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_event_pool_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_event_pool_desc_t > ( )

Definition at line 74 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_fence_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_fence_desc_t > ( )

Definition at line 77 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_host_mem_alloc_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_host_mem_alloc_desc_t > ( )

Definition at line 91 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_image_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_image_desc_t > ( )

Definition at line 101 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_kernel_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_kernel_desc_t > ( )

Definition at line 111 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_kernel_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_kernel_properties_t > ( )

Definition at line 157 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_memory_allocation_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_memory_allocation_properties_t > ( )

Definition at line 161 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_module_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_module_desc_t > ( )

Definition at line 104 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_module_program_exp_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_module_program_exp_desc_t > ( )

Definition at line 108 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_module_properties_t >()

template<>
ze_structure_type_t getZeStructureType< ze_module_properties_t > ( )

Definition at line 154 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_relaxed_allocation_limits_exp_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_relaxed_allocation_limits_exp_desc_t > ( )

Definition at line 88 of file pi_level_zero.hpp.

◆ getZeStructureType< ze_sampler_desc_t >()

template<>
ze_structure_type_t getZeStructureType< ze_sampler_desc_t > ( )

Definition at line 117 of file pi_level_zero.hpp.

◆ pi_cast() [1/2]

template<class To , class From >
To pi_cast ( From  Value)

Definition at line 49 of file pi_level_zero.hpp.

◆ pi_cast() [2/2]

template<>
uint32_t pi_cast ( uint64_t  Value)

Definition at line 55 of file pi_level_zero.hpp.

Variable Documentation

◆ SingleThreadMode

const bool SingleThreadMode
static
Initial value:
= [] {
const char *Ret = std::getenv("SYCL_PI_LEVEL_ZERO_SINGLE_THREAD_MODE");
const bool RetVal = Ret ? std::stoi(Ret) : 0;
return RetVal;
}()

Definition at line 195 of file pi_level_zero.hpp.

Referenced by pi_shared_mutex::lock(), pi_mutex::lock(), pi_shared_mutex::lock_shared(), pi_shared_mutex::try_lock(), pi_mutex::try_lock(), pi_shared_mutex::try_lock_shared(), pi_shared_mutex::unlock(), pi_mutex::unlock(), and pi_shared_mutex::unlock_shared().