DPC++ Runtime
Runtime libraries for oneAPI DPC++
pi_opencl.cpp File Reference
#include <pi_opencl.hpp>
#include <sycl/detail/cl.h>
#include <sycl/detail/iostream_proxy.hpp>
#include <sycl/detail/pi.h>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <limits>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
Include dependency graph for pi_opencl.cpp:

Go to the source code of this file.

Macros

#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
 
#define CHECK_ERR_SET_NULL_RET(err, ptr, reterr)
 
#define CONSTFIX   const
 
#define _PI_CL(pi_api, ocl_api)   (PluginInit->PiFunctionTable).pi_api = (decltype(&::pi_api))(&ocl_api);
 

Typedefs

typedef CL_API_ENTRY cl_int(CL_API_CALL * clGetDeviceFunctionPointer_fn) (cl_device_id device, cl_program program, const char *FuncName, cl_ulong *ret_ptr)
 
typedef CL_API_ENTRY cl_int(CL_API_CALL * clSetProgramSpecializationConstant_fn) (cl_program program, cl_uint spec_id, size_t spec_size, const void *spec_value)
 

Functions

template<class To , class From >
To cast (From value)
 
static void setErrorMessage (const char *message, pi_result error_code)
 
pi_result piPluginGetLastError (char **message)
 API to get Plugin specific warning and error messages. More...
 
template<const char * FuncName, typename T >
static pi_result getExtFuncFromContext (pi_context context, T *fptr)
 
static pi_result USMSetIndirectAccess (pi_kernel kernel)
 Enables indirect access of pointers in kernels. More...
 
pi_result piDeviceGetInfo (pi_device device, pi_device_info paramName, size_t paramValueSize, void *paramValue, size_t *paramValueSizeRet)
 Returns requested info for provided native device Return PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT for PI_DEVICE_INFO_EXTENSIONS query when the device supports native asserts. More...
 
pi_result piPlatformsGet (pi_uint32 num_entries, pi_platform *platforms, pi_uint32 *num_platforms)
 
pi_result piextPlatformCreateWithNativeHandle (pi_native_handle nativeHandle, pi_platform *platform)
 Creates PI platform object from a native handle. More...
 
pi_result piDevicesGet (pi_platform platform, pi_device_type device_type, pi_uint32 num_entries, pi_device *devices, pi_uint32 *num_devices)
 
pi_result piextDeviceSelectBinary (pi_device device, pi_device_binary *images, pi_uint32 num_images, pi_uint32 *selected_image_ind)
 Selects the most appropriate device binary based on runtime information and the IR characteristics. More...
 
pi_result piextDeviceCreateWithNativeHandle (pi_native_handle nativeHandle, pi_platform, pi_device *piDevice)
 Creates PI device object from a native handle. More...
 
pi_result piQueueCreate (pi_context context, pi_device device, pi_queue_properties properties, pi_queue *queue)
 
pi_result piextQueueCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context, pi_device, bool ownNativeHandle, pi_queue *piQueue)
 Creates PI queue object from a native handle. More...
 
pi_result piProgramCreate (pi_context context, const void *il, size_t length, pi_program *res_program)
 
pi_result piextProgramCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context, bool, pi_program *piProgram)
 Creates PI program object from a native handle. More...
 
pi_result piSamplerCreate (pi_context context, const pi_sampler_properties *sampler_properties, pi_sampler *result_sampler)
 
pi_result piextKernelSetArgMemObj (pi_kernel kernel, pi_uint32 arg_index, const pi_mem *arg_value)
 
pi_result piextKernelSetArgSampler (pi_kernel kernel, pi_uint32 arg_index, const pi_sampler *arg_value)
 
pi_result piextKernelCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context, pi_program, bool, pi_kernel *piKernel)
 Creates PI kernel object from a native handle. More...
 
static bool is_in_separated_string (const std::string &str, char delimiter, const std::string &sub_str)
 
pi_result piextGetDeviceFunctionPointer (pi_device device, pi_program program, const char *func_name, pi_uint64 *function_pointer_ret)
 Retrieves a device function pointer to a user-defined function. More...
 
pi_result piContextCreate (const pi_context_properties *properties, pi_uint32 num_devices, const pi_device *devices, void(*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data1), void *user_data, pi_context *retcontext)
 
pi_result piextContextCreateWithNativeHandle (pi_native_handle nativeHandle, pi_uint32 num_devices, const pi_device *devices, bool ownNativeHandle, pi_context *piContext)
 Creates PI context object from a native handle. More...
 
pi_result piMemBufferCreate (pi_context context, pi_mem_flags flags, size_t size, void *host_ptr, pi_mem *ret_mem, const pi_mem_properties *properties)
 
pi_result piMemImageCreate (pi_context context, pi_mem_flags flags, const pi_image_format *image_format, const pi_image_desc *image_desc, void *host_ptr, pi_mem *ret_mem)
 
pi_result piMemBufferPartition (pi_mem buffer, pi_mem_flags flags, pi_buffer_create_type buffer_create_type, void *buffer_create_info, pi_mem *ret_mem)
 
pi_result piextMemCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle, pi_mem *piMem)
 Creates PI mem object from a native handle. More...
 
pi_result piclProgramCreateWithSource (pi_context context, pi_uint32 count, const char **strings, const size_t *lengths, pi_program *ret_program)
 
pi_result piProgramCreateWithBinary (pi_context context, pi_uint32 num_devices, const pi_device *device_list, const size_t *lengths, const unsigned char **binaries, size_t num_metadata_entries, const pi_device_binary_property *metadata, pi_int32 *binary_status, pi_program *ret_program)
 Creates a PI program for a context and loads the given binary into it. More...
 
pi_result piProgramLink (pi_context context, pi_uint32 num_devices, const pi_device *device_list, const char *options, pi_uint32 num_input_programs, const pi_program *input_programs, void(*pfn_notify)(pi_program program, void *user_data), void *user_data, pi_program *ret_program)
 
pi_result piKernelCreate (pi_program program, const char *kernel_name, pi_kernel *ret_kernel)
 
pi_result piKernelGetGroupInfo (pi_kernel kernel, pi_device device, pi_kernel_group_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result piKernelGetSubGroupInfo (pi_kernel kernel, pi_device device, pi_kernel_sub_group_info param_name, size_t input_value_size, const void *input_value, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 API to query information from the sub-group from a kernel. More...
 
pi_result piEventCreate (pi_context context, pi_event *ret_event)
 
pi_result piextEventCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle, pi_event *piEvent)
 Creates PI event object from a native handle. More...
 
pi_result piEnqueueMemBufferMap (pi_queue command_queue, pi_mem buffer, pi_bool blocking_map, pi_map_flags map_flags, size_t offset, size_t size, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event, void **ret_map)
 
pi_result piextUSMHostAlloc (void **result_ptr, pi_context context, pi_usm_mem_properties *properties, size_t size, pi_uint32 alignment)
 Allocates host memory accessible by the device. More...
 
pi_result piextUSMDeviceAlloc (void **result_ptr, pi_context context, pi_device device, pi_usm_mem_properties *properties, size_t size, pi_uint32 alignment)
 Allocates device memory. More...
 
pi_result piextUSMSharedAlloc (void **result_ptr, pi_context context, pi_device device, pi_usm_mem_properties *properties, size_t size, pi_uint32 alignment)
 Allocates memory accessible on both host and device. More...
 
pi_result piextUSMFree (pi_context context, void *ptr)
 Frees allocated USM memory in a blocking manner. More...
 
pi_result piextKernelSetArgPointer (pi_kernel kernel, pi_uint32 arg_index, size_t arg_size, const void *arg_value)
 Sets up pointer arguments for CL kernels. More...
 
pi_result piextUSMEnqueueMemset (pi_queue queue, void *ptr, pi_int32 value, size_t count, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
 USM Memset API. More...
 
pi_result piextUSMEnqueueMemcpy (pi_queue queue, pi_bool blocking, void *dst_ptr, const void *src_ptr, size_t size, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
 USM Memcpy API. More...
 
pi_result piextUSMEnqueuePrefetch (pi_queue queue, const void *ptr, size_t size, pi_usm_migration_flags flags, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
 Hint to migrate memory to the device. More...
 
pi_result piextUSMEnqueueMemAdvise (pi_queue queue, const void *ptr, size_t length, pi_mem_advice advice, pi_event *event)
 USM Memadvise API. More...
 
pi_result piextUSMGetMemAllocInfo (pi_context context, const void *ptr, pi_mem_alloc_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 API to query information about USM allocated pointers Valid Queries: PI_MEM_ALLOC_TYPE returns host/device/shared pi_host_usm value PI_MEM_ALLOC_BASE_PTR returns the base ptr of an allocation if the queried pointer fell inside an allocation. More...
 
pi_result piKernelSetExecInfo (pi_kernel kernel, pi_kernel_exec_info param_name, size_t param_value_size, const void *param_value)
 API to set attributes controlling kernel execution. More...
 
pi_result piextProgramSetSpecializationConstant (pi_program prog, pi_uint32 spec_id, size_t spec_size, const void *spec_value)
 Sets a specialization constant to a specific value. More...
 
static pi_result piextGetNativeHandle (void *piObj, pi_native_handle *nativeHandle)
 Common API for getting the native handle of a PI object. More...
 
pi_result piextPlatformGetNativeHandle (pi_platform platform, pi_native_handle *nativeHandle)
 Gets the native handle of a PI platform object. More...
 
pi_result piextDeviceGetNativeHandle (pi_device device, pi_native_handle *nativeHandle)
 Gets the native handle of a PI device object. More...
 
pi_result piextContextGetNativeHandle (pi_context context, pi_native_handle *nativeHandle)
 Gets the native handle of a PI context object. More...
 
pi_result piextQueueGetNativeHandle (pi_queue queue, pi_native_handle *nativeHandle)
 Gets the native handle of a PI queue object. More...
 
pi_result piextMemGetNativeHandle (pi_mem mem, pi_native_handle *nativeHandle)
 Gets the native handle of a PI mem object. More...
 
pi_result piextProgramGetNativeHandle (pi_program program, pi_native_handle *nativeHandle)
 Gets the native handle of a PI program object. More...
 
pi_result piextKernelGetNativeHandle (pi_kernel kernel, pi_native_handle *nativeHandle)
 Gets the native handle of a PI kernel object. More...
 
pi_result piTearDown (void *PluginParameter)
 API to notify that the plugin should clean up its resources. More...
 
pi_result piPluginInit (pi_plugin *PluginInit)
 

Variables

CONSTFIX char clHostMemAllocName [] = "clHostMemAllocINTEL"
 
CONSTFIX char clDeviceMemAllocName [] = "clDeviceMemAllocINTEL"
 
CONSTFIX char clSharedMemAllocName [] = "clSharedMemAllocINTEL"
 
CONSTFIX char clMemBlockingFreeName [] = "clMemBlockingFreeINTEL"
 
CONSTFIX char clCreateBufferWithPropertiesName []
 
CONSTFIX char clSetKernelArgMemPointerName [] = "clSetKernelArgMemPointerINTEL"
 
CONSTFIX char clEnqueueMemsetName [] = "clEnqueueMemsetINTEL"
 
CONSTFIX char clEnqueueMemcpyName [] = "clEnqueueMemcpyINTEL"
 
CONSTFIX char clGetMemAllocInfoName [] = "clGetMemAllocInfoINTEL"
 
CONSTFIX char clSetProgramSpecializationConstantName []
 
CONSTFIX char clGetDeviceFunctionPointerName []
 
constexpr size_t MaxMessageSize = 256
 
thread_local pi_result ErrorMessageCode = PI_SUCCESS
 
thread_local char ErrorMessage [MaxMessageSize]
 
const char SupportedVersion [] = _PI_OPENCL_PLUGIN_VERSION_STRING
 

Detailed Description

Implementation of OpenCL Plugin. It is the interface between device-agnostic SYCL runtime layer and underlying OpenCL runtime.

Definition in file pi_opencl.cpp.

Macro Definition Documentation

◆ _PI_CL

#define _PI_CL (   pi_api,
  ocl_api 
)    (PluginInit->PiFunctionTable).pi_api = (decltype(&::pi_api))(&ocl_api);

◆ CHECK_ERR_SET_NULL_RET

#define CHECK_ERR_SET_NULL_RET (   err,
  ptr,
  reterr 
)
Value:
if (err != CL_SUCCESS) { \
if (ptr != nullptr) \
*ptr = nullptr; \
return cast<pi_result>(reterr); \
}

Definition at line 34 of file pi_opencl.cpp.

◆ CL_USE_DEPRECATED_OPENCL_1_2_APIS

#define CL_USE_DEPRECATED_OPENCL_1_2_APIS

Definition at line 17 of file pi_opencl.cpp.

◆ CONSTFIX

#define CONSTFIX   const

Definition at line 52 of file pi_opencl.cpp.

Typedef Documentation

◆ clGetDeviceFunctionPointer_fn

typedef CL_API_ENTRY cl_int(CL_API_CALL * clGetDeviceFunctionPointer_fn) (cl_device_id device, cl_program program, const char *FuncName, cl_ulong *ret_ptr)

Definition at line 622 of file pi_opencl.cpp.

◆ clSetProgramSpecializationConstant_fn

typedef CL_API_ENTRY cl_int(CL_API_CALL * clSetProgramSpecializationConstant_fn) (cl_program program, cl_uint spec_id, size_t spec_size, const void *spec_value)

Definition at line 1351 of file pi_opencl.cpp.

Function Documentation

◆ cast()

template<class To , class From >
To cast ( From  value)

◆ getExtFuncFromContext()

template<const char * FuncName, typename T >
static pi_result getExtFuncFromContext ( pi_context  context,
T fptr 
)
static

◆ is_in_separated_string()

static bool is_in_separated_string ( const std::string &  str,
char  delimiter,
const std::string &  sub_str 
)
static

Definition at line 600 of file pi_opencl.cpp.

References sycl::_V1::length().

Referenced by piextGetDeviceFunctionPointer().

◆ piclProgramCreateWithSource()

pi_result piclProgramCreateWithSource ( pi_context  context,
pi_uint32  count,
const char **  strings,
const size_t *  lengths,
pi_program ret_program 
)

Definition at line 780 of file pi_opencl.cpp.

Referenced by piPluginInit().

◆ piContextCreate()

pi_result piContextCreate ( const pi_context_properties properties,
pi_uint32  num_devices,
const pi_device devices,
void(*)(const char *errinfo, const void *private_info, size_t cb, void *user_data1)  pfn_notify,
void *  user_data,
pi_context retcontext 
)

Definition at line 689 of file pi_opencl.cpp.

Referenced by piPluginInit().

◆ piDeviceGetInfo()

pi_result piDeviceGetInfo ( pi_device  device,
pi_device_info  paramName,
size_t  paramValueSize,
void *  paramValue,
size_t *  paramValueSizeRet 
)

Returns requested info for provided native device Return PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT for PI_DEVICE_INFO_EXTENSIONS query when the device supports native asserts.

Combination of ESIMDEmuPluginDataVersion and ESIMDEmuPluginInterfaceVersion : 0.a.b a : ESIMDEmuPluginInterfaceVersion b : ESIMDEmuPluginDataVersion

TODO : Check

TODO : Check. CM_MAX_1D_SURF_WIDTH from CM_EMU

TODO : Check

TODO : Check. CM_MAX_SAMPLERS_PER_KERNEL from CM_EMU

TODO : Check

TODO : Check. half_type.hpp from CM_EMU

Definition at line 194 of file pi_opencl.cpp.

References max(), sycl::_V1::detail::memcpy(), PI_DEVICE_INFO_ATOMIC_64, PI_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES, PI_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES, PI_DEVICE_INFO_BUILD_ON_SUBDEVICE, PI_DEVICE_INFO_GPU_EU_COUNT, PI_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, PI_DEVICE_INFO_GPU_EU_SIMD_WIDTH, PI_DEVICE_INFO_GPU_HW_THREADS_PER_EU, PI_DEVICE_INFO_GPU_SLICES, PI_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, PI_DEVICE_INFO_IMAGE_SRGB, PI_DEVICE_INFO_MAX_MEM_BANDWIDTH, PI_DEVICE_INFO_PCI_ADDRESS, PI_DEVICE_INFO_UUID, PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16, and PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D.

Referenced by sycl::_V1::detail::applyAllowList(), sycl::_V1::detail::filterDeviceFilter(), sycl::_V1::detail::get_device_info_impl< ReturnT, Param >::get(), sycl::_V1::detail::get_device_info_impl< platform, Param >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< info::fp_config >, Param >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< info::fp_config >, info::device::single_fp_config >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::queue_profiling >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< memory_order >, info::device::atomic_memory_order_capabilities >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< memory_scope >, info::device::atomic_memory_scope_capabilities >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::ext_oneapi_bfloat16 >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< info::execution_capability >, info::device::execution_capabilities >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< info::partition_property >, info::device::partition_properties >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< info::partition_affinity_domain >, info::device::partition_affinity_domains >::get(), sycl::_V1::detail::get_device_info_impl< info::partition_affinity_domain, info::device::partition_type_affinity_domain >::get(), sycl::_V1::detail::get_device_info_impl< info::partition_property, info::device::partition_type_property >::get(), sycl::_V1::detail::get_device_info_impl< std::vector< size_t >, info::device::sub_group_sizes >::get(), sycl::_V1::detail::get_device_info_impl< id< Dimensions >, info::device::max_work_item_sizes< Dimensions > >::get(), sycl::_V1::detail::get_device_info_impl< id< 1 >, ext::oneapi::experimental::info::device::max_work_groups< 1 > >::get(), sycl::_V1::detail::get_device_info_impl< id< 2 >, ext::oneapi::experimental::info::device::max_work_groups< 2 > >::get(), sycl::_V1::detail::get_device_info_impl< id< 3 >, ext::oneapi::experimental::info::device::max_work_groups< 3 > >::get(), sycl::_V1::detail::get_device_info_impl< device, info::device::parent_device >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::usm_device_allocations >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::usm_host_allocations >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::usm_shared_allocations >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::usm_restricted_shared_allocations >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::usm_system_allocations >::get(), sycl::_V1::detail::get_device_info_impl< bool, info::device::ext_intel_mem_channel >::get(), sycl::_V1::detail::get_device_info_string(), sycl::_V1::detail::ProgramManager::getBuiltPIProgram(), sycl::_V1::detail::platform_impl::getPlatformFromPiDevice(), sycl::_V1::detail::ProgramManager::getProgramBuildLog(), sycl::_V1::detail::enqueue_kernel_launch::handleInvalidValue(), sycl::_V1::detail::enqueue_kernel_launch::handleInvalidWorkGroupSize(), sycl::_V1::detail::enqueue_kernel_launch::handleInvalidWorkItemSize(), sycl::_V1::detail::device_impl::has(), piKernelGetSubGroupInfo(), and piPluginInit().

◆ piDevicesGet()

pi_result piDevicesGet ( pi_platform  platform,
pi_device_type  device_type,
pi_uint32  num_entries,
pi_device devices,
pi_uint32 num_devices 
)

Runtime queries number of devices

No GPU entry to fill 'Devices' array

Definition at line 299 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::platform_impl::get_devices(), and piPluginInit().

◆ piEnqueueMemBufferMap()

pi_result piEnqueueMemBufferMap ( pi_queue  command_queue,
pi_mem  buffer,
pi_bool  blocking_map,
pi_map_flags  map_flags,
size_t  offset,
size_t  size,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event,
void **  ret_map 
)

Definition at line 927 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::memBufferMapHelper(), and piPluginInit().

◆ piEventCreate()

pi_result piEventCreate ( pi_context  context,
pi_event ret_event 
)

Definition at line 903 of file pi_opencl.cpp.

Referenced by piPluginInit().

◆ piextContextCreateWithNativeHandle()

pi_result piextContextCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_uint32  numDevices,
const pi_device devices,
bool  pluginOwnsNativeHandle,
pi_context context 
)

Creates PI context object from a native handle.

NOTE: The created PI object takes ownership of the native handle. NOTE: The number of devices and the list of devices is needed for Level Zero backend because there is no possilibity to query this information from context handle for Level Zero. If backend has API to query a list of devices from the context native handle then these parameters are ignored.

Parameters
nativeHandleis the native handle to create PI context from.
numDevicesis the number of devices in the context. Parameter is ignored if number of devices can be queried from the context native handle for a backend.
devicesis the list of devices in the context. Parameter is ignored if devices can be queried from the context native handle for a backend.
pluginOwnsNativeHandleIndicates whether the created PI object should take ownership of the native handle.
contextis the PI context created from the native handle.
Returns
PI_SUCCESS if successfully created pi_context from the handle. PI_ERROR_OUT_OF_HOST_MEMORY if can't allocate memory for the pi_context object. PI_ERROR_INVALID_VALUE if numDevices == 0 or devices is NULL but backend doesn't have API to query a list of devices from the context native handle. PI_UNKNOWN_ERROR in case of another error.

Definition at line 704 of file pi_opencl.cpp.

Referenced by sycl::_V1::ext::oneapi::level_zero::make_context(), sycl::_V1::detail::make_context(), and piPluginInit().

◆ piextContextGetNativeHandle()

pi_result piextContextGetNativeHandle ( pi_context  context,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI context object.

Parameters
contextis the PI context to get the native handle of.
nativeHandleis the native handle of context.

Definition at line 1401 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::context_impl::getNative(), and piPluginInit().

◆ piextDeviceCreateWithNativeHandle()

pi_result piextDeviceCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_platform  platform,
pi_device device 
)

Creates PI device object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI device from.
platformis the platform of the device (optional).
deviceis the PI device created from the native handle.

Definition at line 387 of file pi_opencl.cpp.

Referenced by sycl::_V1::ext::oneapi::level_zero::make_device(), sycl::_V1::detail::make_device(), and piPluginInit().

◆ piextDeviceGetNativeHandle()

pi_result piextDeviceGetNativeHandle ( pi_device  device,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI device object.

Parameters
deviceis the PI device to get the native handle of.
nativeHandleis the native handle of device.

Definition at line 1396 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::device_impl::getNative(), and piPluginInit().

◆ piextDeviceSelectBinary()

pi_result piextDeviceSelectBinary ( pi_device  device,
pi_device_binary images,
pi_uint32  num_images,
pi_uint32 selected_image_ind 
)

Selects the most appropriate device binary based on runtime information and the IR characteristics.

TODO : Support multiple images and enable selection algorithm for the images

Definition at line 316 of file pi_opencl.cpp.

References __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64, __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_FPGA, __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_GEN, __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64, and max().

Referenced by sycl::_V1::detail::compatibleWithDevice(), and piPluginInit().

◆ piextEventCreateWithNativeHandle()

pi_result piextEventCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
bool  ownNativeHandle,
pi_event event 
)

Creates PI event object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI event from.
contextis the corresponding PI context
pluginOwnsNativeHandleIndicates whether the created PI object should take ownership of the native handle.
eventis the PI event created from the native handle.

Definition at line 911 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::make_event(), and piPluginInit().

◆ piextGetDeviceFunctionPointer()

pi_result piextGetDeviceFunctionPointer ( pi_device  device,
pi_program  program,
const char function_name,
pi_uint64 function_pointer_ret 
)

Retrieves a device function pointer to a user-defined function.

  • function_name.
  • function_pointer_ret is set to 0 if query failed.
  • program must be built before calling this API.
  • device must present in the list of devices returned by get_device method for
  • program.

If a fallback method determines the function exists but the address is not available PI_ERROR_FUNCTION_ADDRESS_IS_NOT_AVAILABLE is returned. If the address does not exist PI_ERROR_INVALID_KERNEL_NAME is returned.

Definition at line 625 of file pi_opencl.cpp.

References clGetDeviceFunctionPointerName, getExtFuncFromContext(), is_in_separated_string(), and PI_PROGRAM_INFO_KERNEL_NAMES.

Referenced by sycl::_V1::detail::program_impl::has_kernel(), and piPluginInit().

◆ piextGetNativeHandle()

static pi_result piextGetNativeHandle ( void *  piObj,
pi_native_handle nativeHandle 
)
static

Common API for getting the native handle of a PI object.

Parameters
piObjis the pi object to get the native handle of
nativeHandleis a pointer to be set to the native handle

PI_SUCCESS

Definition at line 1384 of file pi_opencl.cpp.

Referenced by piextContextGetNativeHandle(), piextDeviceGetNativeHandle(), piextKernelGetNativeHandle(), piextMemGetNativeHandle(), piextPlatformGetNativeHandle(), piextProgramGetNativeHandle(), piextQueueGetNativeHandle(), and piPluginInit().

◆ piextKernelCreateWithNativeHandle()

pi_result piextKernelCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
pi_program  program,
bool  pluginOwnsNativeHandle,
pi_kernel kernel 
)

Creates PI kernel object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI kernel from.
contextis the PI context of the kernel.
programis the PI program of the kernel.
pluginOwnsNativeHandleIndicates whether the created PI object should take ownership of the native handle.
kernelis the PI kernel created from the native handle.

Definition at line 588 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::make_kernel(), and piPluginInit().

◆ piextKernelGetNativeHandle()

pi_result piextKernelGetNativeHandle ( pi_kernel  kernel,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI kernel object.

Parameters
kernelis the PI kernel to get the native handle of.
nativeHandleis the native handle of kernel.

Definition at line 1420 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::kernel_impl::getNative(), and piPluginInit().

◆ piextKernelSetArgMemObj()

pi_result piextKernelSetArgMemObj ( pi_kernel  kernel,
pi_uint32  arg_index,
const pi_mem arg_value 
)

Definition at line 574 of file pi_opencl.cpp.

Referenced by piPluginInit(), and sycl::_V1::detail::SetKernelParamsAndLaunch().

◆ piextKernelSetArgPointer()

pi_result piextKernelSetArgPointer ( pi_kernel  kernel,
pi_uint32  arg_index,
size_t  arg_size,
const void *  arg_value 
)

Sets up pointer arguments for CL kernels.

An extra indirection is required due to CL argument conventions.

Parameters
kernelis the kernel to be launched
arg_indexis the index of the kernel argument
arg_sizeis the size in bytes of the argument (ignored in CL)
arg_valueis the pointer argument

Definition at line 1085 of file pi_opencl.cpp.

References clSetKernelArgMemPointerName, and getExtFuncFromContext().

Referenced by piPluginInit(), and sycl::_V1::detail::SetKernelParamsAndLaunch().

◆ piextKernelSetArgSampler()

pi_result piextKernelSetArgSampler ( pi_kernel  kernel,
pi_uint32  arg_index,
const pi_sampler arg_value 
)

Definition at line 581 of file pi_opencl.cpp.

Referenced by piPluginInit(), and sycl::_V1::detail::SetKernelParamsAndLaunch().

◆ piextMemCreateWithNativeHandle()

pi_result piextMemCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
bool  ownNativeHandle,
pi_mem mem 
)

Creates PI mem object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI mem from.
contextThe PI context of the memory allocation.
ownNativeHandleIndicates if we own the native memory handle or it came from interop that asked to not transfer the ownership to SYCL RT.
memis the PI mem created from the native handle.

Definition at line 770 of file pi_opencl.cpp.

Referenced by piPluginInit(), and sycl::_V1::detail::SYCLMemObjT::SYCLMemObjT().

◆ piextMemGetNativeHandle()

pi_result piextMemGetNativeHandle ( pi_mem  mem,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI mem object.

Parameters
memis the PI mem to get the native handle of.
nativeHandleis the native handle of mem.

Definition at line 1411 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::buffer_impl::getNativeVector(), sycl::_V1::detail::memBufferCreateHelper(), sycl::_V1::detail::memReleaseHelper(), and piPluginInit().

◆ piextPlatformCreateWithNativeHandle()

pi_result piextPlatformCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_platform platform 
)

Creates PI platform object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI device from.
platformis the PI platform created from the native handle.

Definition at line 291 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::make_platform(), and piPluginInit().

◆ piextPlatformGetNativeHandle()

pi_result piextPlatformGetNativeHandle ( pi_platform  platform,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI platform object.

Parameters
platformis the PI platform to get the native handle of.
nativeHandleis the native handle of platform.

Definition at line 1391 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::platform_impl::getNative(), and piPluginInit().

◆ piextProgramCreateWithNativeHandle()

pi_result piextProgramCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
bool  pluginOwnsNativeHandle,
pi_program program 
)

Creates PI program object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI program from.
contextis the PI context of the program.
pluginOwnsNativeHandleIndicates whether the created PI object should take ownership of the native handle.
programis the PI program created from the native handle.

Definition at line 535 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::make_kernel_bundle(), and piPluginInit().

◆ piextProgramGetNativeHandle()

pi_result piextProgramGetNativeHandle ( pi_program  program,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI program object.

Parameters
programis the PI program to get the native handle of.
nativeHandleis the native handle of program.

Definition at line 1415 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::device_image_impl::getNative(), sycl::_V1::detail::program_impl::getNative(), and piPluginInit().

◆ piextProgramSetSpecializationConstant()

pi_result piextProgramSetSpecializationConstant ( pi_program  prog,
pi_uint32  spec_id,
size_t  spec_size,
const void *  spec_value 
)

Sets a specialization constant to a specific value.

Note: Only used when specialization constants are natively supported (SPIR-V binaries), and not when they are emulated (AOT binaries).

Parameters
progthe program object which will use the value
spec_idinteger ID of the constant
spec_sizesize of the value
spec_valuebytes of the value

Definition at line 1355 of file pi_opencl.cpp.

References clSetProgramSpecializationConstantName, and getExtFuncFromContext().

Referenced by sycl::_V1::detail::ProgramManager::build(), sycl::_V1::detail::enableITTAnnotationsIfNeeded(), sycl::_V1::detail::program_impl::flush_spec_constants(), and piPluginInit().

◆ piextQueueCreateWithNativeHandle()

pi_result piextQueueCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
pi_device  device,
bool  pluginOwnsNativeHandle,
pi_queue queue 
)

Creates PI queue object from a native handle.

NOTE: The created PI object takes ownership of the native handle.

Parameters
nativeHandleis the native handle to create PI queue from.
contextis the PI context of the queue.
deviceis the PI device associated with the native device used when creating the native queue. This parameter is optional but some backends may fail to create the right PI queue if omitted.
pluginOwnsNativeHandleIndicates whether the created PI object should take ownership of the native handle.
queueis the PI queue created from the native handle.

Definition at line 447 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::make_queue_impl(), and piPluginInit().

◆ piextQueueGetNativeHandle()

pi_result piextQueueGetNativeHandle ( pi_queue  queue,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI queue object.

Parameters
queueis the PI queue to get the native handle of.
nativeHandleis the native handle of queue.

Definition at line 1406 of file pi_opencl.cpp.

References piextGetNativeHandle().

Referenced by sycl::_V1::detail::queue_impl::getNative(), and piPluginInit().

◆ piextUSMDeviceAlloc()

pi_result piextUSMDeviceAlloc ( void **  result_ptr,
pi_context  context,
pi_device  device,
pi_usm_mem_properties properties,
size_t  size,
pi_uint32  alignment 
)

Allocates device memory.

Parameters
result_ptrcontains the allocated memory
contextis the pi_context
deviceis the device the memory will be allocated on
pi_usm_mem_propertiesare optional allocation properties
size_tis the size of the allocation
alignmentis the desired alignment of the allocation

Definition at line 991 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::usm::alignedAlloc(), and piPluginInit().

◆ piextUSMEnqueueMemAdvise()

pi_result piextUSMEnqueueMemAdvise ( pi_queue  queue,
const void *  ptr,
size_t  length,
pi_mem_advice  advice,
pi_event event 
)

USM Memadvise API.

Parameters
queueis the queue to submit to
ptris the data to be advised
lengthis the size in bytes of the meory to advise
adviceis device specific advice
eventis the event that represents this operation

Definition at line 1254 of file pi_opencl.cpp.

References sycl::_V1::length().

Referenced by sycl::_V1::detail::MemoryManager::advise_usm(), and piPluginInit().

◆ piextUSMEnqueueMemcpy()

pi_result piextUSMEnqueueMemcpy ( pi_queue  queue,
pi_bool  blocking,
void *  dst_ptr,
const void *  src_ptr,
size_t  size,
pi_uint32  num_events_in_waitlist,
const pi_event events_waitlist,
pi_event event 
)

USM Memcpy API.

Parameters
queueis the queue to submit to
blockingis whether this operation should block the host
src_ptris the data to be copied
dst_ptris the location the data will be copied
sizeis number of bytes to copy
num_events_in_waitlistis the number of events to wait on
events_waitlistis an array of events to wait on
eventis the event that represents this operation

Definition at line 1165 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::MemoryManager::copy_usm(), and piPluginInit().

◆ piextUSMEnqueueMemset()

pi_result piextUSMEnqueueMemset ( pi_queue  queue,
void *  ptr,
pi_int32  value,
size_t  count,
pi_uint32  num_events_in_waitlist,
const pi_event events_waitlist,
pi_event event 
)

USM Memset API.

Parameters
queueis the queue to submit to
ptris the ptr to memset
valueis value to set. It is interpreted as an 8-bit value and the upper 24 bits are ignored
countis the size in bytes to memset
num_events_in_waitlistis the number of events to wait on
events_waitlistis an array of events to wait on
eventis the event that represents this operation

Definition at line 1126 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::MemoryManager::fill_usm(), and piPluginInit().

◆ piextUSMEnqueuePrefetch()

pi_result piextUSMEnqueuePrefetch ( pi_queue  queue,
const void *  ptr,
size_t  size,
pi_usm_migration_flags  flags,
pi_uint32  num_events_in_waitlist,
const pi_event events_waitlist,
pi_event event 
)

Hint to migrate memory to the device.

Parameters
queueis the queue to submit to
ptrpoints to the memory to migrate
sizeis the number of bytes to migrate
flagsis a bitfield used to specify memory migration options
num_events_in_waitlistis the number of events to wait on
events_waitlistis an array of events to wait on
eventis the event that represents this operation

Definition at line 1204 of file pi_opencl.cpp.

Referenced by piPluginInit(), and sycl::_V1::detail::MemoryManager::prefetch_usm().

◆ piextUSMFree()

pi_result piextUSMFree ( pi_context  context,
void *  ptr 
)

Frees allocated USM memory in a blocking manner.

Indicates that the allocated USM memory is no longer needed on the runtime side.

Parameters
contextis the pi_context of the allocation
ptris the memory to be freed

Definition at line 1061 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::usm::free(), and piPluginInit().

◆ piextUSMGetMemAllocInfo()

pi_result piextUSMGetMemAllocInfo ( pi_context  context,
const void *  ptr,
pi_mem_alloc_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

API to query information about USM allocated pointers Valid Queries: PI_MEM_ALLOC_TYPE returns host/device/shared pi_host_usm value PI_MEM_ALLOC_BASE_PTR returns the base ptr of an allocation if the queried pointer fell inside an allocation.

Result must fit in void * PI_MEM_ALLOC_SIZE returns how big the queried pointer's allocation is in bytes. Result is a size_t. PI_MEM_ALLOC_DEVICE returns the pi_device this was allocated against

Parameters
contextis the pi_context
ptris the pointer to query
param_nameis the type of query to perform
param_value_sizeis the size of the result in bytes
param_valueis the result
param_value_retis how many bytes were written

Definition at line 1309 of file pi_opencl.cpp.

Referenced by sycl::_V1::get_pointer_device(), sycl::_V1::get_pointer_type(), and piPluginInit().

◆ piextUSMHostAlloc()

pi_result piextUSMHostAlloc ( void **  result_ptr,
pi_context  context,
pi_usm_mem_properties properties,
size_t  size,
pi_uint32  alignment 
)

Allocates host memory accessible by the device.

Parameters
result_ptrcontains the allocated memory
contextis the pi_context
pi_usm_mem_propertiesare optional allocation properties
size_tis the size of the allocation
alignmentis the desired alignment of the allocation

Definition at line 955 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::usm::alignedAllocHost(), and piPluginInit().

◆ piextUSMSharedAlloc()

pi_result piextUSMSharedAlloc ( void **  result_ptr,
pi_context  context,
pi_device  device,
pi_usm_mem_properties properties,
size_t  size,
pi_uint32  alignment 
)

Allocates memory accessible on both host and device.

Parameters
result_ptrcontains the allocated memory
contextis the pi_context
deviceis the device the memory will be allocated on
pi_usm_mem_propertiesare optional allocation properties
size_tis the size of the allocation
alignmentis the desired alignment of the allocation

Definition at line 1029 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::usm::alignedAlloc(), and piPluginInit().

◆ piKernelCreate()

pi_result piKernelCreate ( pi_program  program,
const char kernel_name,
pi_kernel ret_kernel 
)

◆ piKernelGetGroupInfo()

pi_result piKernelGetGroupInfo ( pi_kernel  kernel,
pi_device  device,
pi_kernel_group_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

◆ piKernelGetSubGroupInfo()

pi_result piKernelGetSubGroupInfo ( pi_kernel  kernel,
pi_device  device,
pi_kernel_sub_group_info  param_name,
size_t  input_value_size,
const void *  input_value,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

API to query information from the sub-group from a kernel.

Parameters
kernelis the pi_kernel to query
deviceis the device the kernel is executed on
param_nameis a pi_kernel_sub_group_info enum value that specifies the informtation queried for.
input_value_sizeis the size of input value passed in ptr input_value param
input_valueis the ptr to the input value passed.
param_value_sizeis the size of the value in bytes.
param_valueis a pointer to the value to set.
param_value_size_retis a pointer to return the size of data in param_value ptr.

All queries expect a return of 4 bytes in param_value_size, param_value_size_ret, and a uint32_t value should to be written in param_value ptr. Note: This behaviour differs from OpenCL. OpenCL returns size_t.

Definition at line 855 of file pi_opencl.cpp.

References PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS, PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, PI_KERNEL_MAX_SUB_GROUP_SIZE, and piDeviceGetInfo().

Referenced by sycl::_V1::detail::get_kernel_device_specific_info_helper(), sycl::_V1::detail::get_kernel_device_specific_info_with_input(), and piPluginInit().

◆ piKernelSetExecInfo()

pi_result piKernelSetExecInfo ( pi_kernel  kernel,
pi_kernel_exec_info  param_name,
size_t  param_value_size,
const void *  param_value 
)

API to set attributes controlling kernel execution.

Parameters
kernelis the pi kernel to execute
param_nameis a pi_kernel_exec_info value that specifies the info passed to the kernel
param_value_sizeis the size of the value in bytes
param_valueis a pointer to the value to set for the kernel

If param_name is PI_USM_INDIRECT_ACCESS, the value will be a ptr to the pi_bool value PI_TRUE If param_name is PI_USM_PTRS, the value will be an array of ptrs

Definition at line 1339 of file pi_opencl.cpp.

References PI_TRUE, PI_USM_INDIRECT_ACCESS, and USMSetIndirectAccess().

Referenced by sycl::_V1::detail::ProgramManager::getOrCreateKernel(), sycl::_V1::detail::kernel_impl::kernel_impl(), and piPluginInit().

◆ piMemBufferCreate()

pi_result piMemBufferCreate ( pi_context  context,
pi_mem_flags  flags,
size_t  size,
void *  host_ptr,
pi_mem ret_mem,
const pi_mem_properties properties 
)

◆ piMemBufferPartition()

pi_result piMemBufferPartition ( pi_mem  buffer,
pi_mem_flags  flags,
pi_buffer_create_type  buffer_create_type,
void *  buffer_create_info,
pi_mem ret_mem 
)

◆ piMemImageCreate()

pi_result piMemImageCreate ( pi_context  context,
pi_mem_flags  flags,
const pi_image_format image_format,
const pi_image_desc image_desc,
void *  host_ptr,
pi_mem ret_mem 
)

◆ piPlatformsGet()

pi_result piPlatformsGet ( pi_uint32  num_entries,
pi_platform platforms,
pi_uint32 num_platforms 
)

Runtime queries number of Platforms

Definition at line 276 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::platform_impl::get_platforms(), and piPluginInit().

◆ piPluginGetLastError()

pi_result piPluginGetLastError ( char **  message)

API to get Plugin specific warning and error messages.

Parameters
messageis a returned address to the first element in the message the plugin owns the error message string. The string is thread-local. As a result, different threads may return different errors. A message is overwritten by the following error or warning that is produced within the given thread. The memory is cleaned up at the end of the thread's lifetime.
Returns
PI_SUCCESS if plugin is indicating non-fatal warning. Any other error code indicates that plugin considers this to be a fatal error and the runtime must handle it or end the application.

Definition at line 87 of file pi_opencl.cpp.

References ErrorMessage, and ErrorMessageCode.

Referenced by piPluginInit().

◆ piPluginInit()

pi_result piPluginInit ( pi_plugin PluginInit)

Definition at line 1435 of file pi_opencl.cpp.

References _PI_CL, _PI_PLUGIN_VERSION_CHECK, piclProgramCreateWithSource(), piContextCreate(), piContextGetInfo(), piContextRelease(), piContextRetain(), piDeviceGetInfo(), piDevicePartition(), piDeviceRelease(), piDeviceRetain(), piDevicesGet(), piEnqueueEventsWait(), piEnqueueEventsWaitWithBarrier(), piEnqueueKernelLaunch(), piEnqueueMemBufferCopy(), piEnqueueMemBufferCopyRect(), piEnqueueMemBufferFill(), piEnqueueMemBufferMap(), piEnqueueMemBufferRead(), piEnqueueMemBufferReadRect(), piEnqueueMemBufferWrite(), piEnqueueMemBufferWriteRect(), piEnqueueMemImageCopy(), piEnqueueMemImageFill(), piEnqueueMemImageRead(), piEnqueueMemImageWrite(), piEnqueueMemUnmap(), piEnqueueNativeKernel(), piEventCreate(), piEventGetInfo(), piEventGetProfilingInfo(), piEventRelease(), piEventRetain(), piEventSetCallback(), piEventSetStatus(), piEventsWait(), piextContextCreateWithNativeHandle(), piextContextGetNativeHandle(), piextDeviceCreateWithNativeHandle(), piextDeviceGetNativeHandle(), piextDeviceSelectBinary(), piextEventCreateWithNativeHandle(), piextEventGetNativeHandle(), piextGetDeviceFunctionPointer(), piextGetNativeHandle(), piextKernelCreateWithNativeHandle(), piextKernelGetNativeHandle(), piextKernelSetArgMemObj(), piextKernelSetArgPointer(), piextKernelSetArgSampler(), piextMemCreateWithNativeHandle(), piextMemGetNativeHandle(), piextPlatformCreateWithNativeHandle(), piextPlatformGetNativeHandle(), piextProgramCreateWithNativeHandle(), piextProgramGetNativeHandle(), piextProgramSetSpecializationConstant(), piextQueueCreateWithNativeHandle(), piextQueueGetNativeHandle(), piextUSMDeviceAlloc(), piextUSMEnqueueMemAdvise(), piextUSMEnqueueMemcpy(), piextUSMEnqueueMemset(), piextUSMEnqueuePrefetch(), piextUSMFree(), piextUSMGetMemAllocInfo(), piextUSMHostAlloc(), piextUSMSharedAlloc(), piKernelCreate(), piKernelGetGroupInfo(), piKernelGetInfo(), piKernelGetSubGroupInfo(), piKernelRelease(), piKernelRetain(), piKernelSetArg(), piKernelSetExecInfo(), piMemBufferCreate(), piMemBufferPartition(), piMemGetInfo(), piMemImageCreate(), piMemImageGetInfo(), piMemRelease(), piMemRetain(), piPlatformGetInfo(), piPlatformsGet(), piPluginGetLastError(), piProgramBuild(), piProgramCompile(), piProgramCreate(), piProgramCreateWithBinary(), piProgramGetBuildInfo(), piProgramGetInfo(), piProgramLink(), piProgramRelease(), piProgramRetain(), piQueueCreate(), piQueueFinish(), piQueueFlush(), piQueueGetInfo(), piQueueRelease(), piQueueRetain(), piSamplerCreate(), piSamplerGetInfo(), piSamplerRelease(), piSamplerRetain(), piTearDown(), _pi_plugin::PiVersion, _pi_plugin::PluginVersion, and SupportedVersion.

Referenced by sycl::_V1::detail::pi::bindPlugin().

◆ piProgramCreate()

pi_result piProgramCreate ( pi_context  context,
const void *  il,
size_t  length,
pi_program res_program 
)

◆ piProgramCreateWithBinary()

pi_result piProgramCreateWithBinary ( pi_context  context,
pi_uint32  num_devices,
const pi_device device_list,
const size_t *  lengths,
const unsigned char **  binaries,
size_t  num_metadata_entries,
const pi_device_binary_property metadata,
pi_int32 binary_status,
pi_program ret_program 
)

Creates a PI program for a context and loads the given binary into it.

Parameters
contextis the PI context to associate the program with.
num_devicesis the number of devices in device_list.
device_listis a pointer to a list of devices. These devices must all be in context.
lengthsis an array of sizes in bytes of the binary in binaries.
binariesis a pointer to a list of program binaries.
num_metadata_entriesis the number of metadata entries in metadata.
metadatais a pointer to a list of program metadata entries. The use of metadata entries is backend-defined.
binary_statusreturns whether the program binary was loaded succesfully or not, for each device in device_list. binary_status is ignored if it is null and otherwise it must be an array of num_devices elements.
ret_programis the PI program created from the program binaries.

Definition at line 792 of file pi_opencl.cpp.

Referenced by sycl::_V1::detail::createBinaryProgram(), and piPluginInit().

◆ piProgramLink()

pi_result piProgramLink ( pi_context  context,
pi_uint32  num_devices,
const pi_device device_list,
const char options,
pi_uint32  num_input_programs,
const pi_program input_programs,
void(*)(pi_program program, void *user_data)  pfn_notify,
void *  user_data,
pi_program ret_program 
)

◆ piQueueCreate()

◆ piSamplerCreate()

◆ piTearDown()

pi_result piTearDown ( void *  PluginParameter)

API to notify that the plugin should clean up its resources.

No PI calls should be made until the next piPluginInit call.

Parameters
PluginParameterplaceholder for future use, currenly not used.

Definition at line 1428 of file pi_opencl.cpp.

Referenced by piPluginInit(), and sycl::_V1::detail::GlobalHandler::unloadPlugins().

◆ setErrorMessage()

static void setErrorMessage ( const char message,
pi_result  error_code 
)
static

Definition at line 79 of file pi_opencl.cpp.

References ErrorMessage, ErrorMessageCode, and MaxMessageSize.

◆ USMSetIndirectAccess()

static pi_result USMSetIndirectAccess ( pi_kernel  kernel)
static

Enables indirect access of pointers in kernels.

Necessary to avoid telling CL about every pointer that might be used.

Parameters
kernelis the kernel to be launched

Definition at line 152 of file pi_opencl.cpp.

Referenced by piKernelSetExecInfo().

Variable Documentation

◆ clCreateBufferWithPropertiesName

CONSTFIX char clCreateBufferWithPropertiesName[]
Initial value:
=
"clCreateBufferWithPropertiesINTEL"

Definition at line 60 of file pi_opencl.cpp.

Referenced by piMemBufferCreate().

◆ clDeviceMemAllocName

CONSTFIX char clDeviceMemAllocName[] = "clDeviceMemAllocINTEL"

Definition at line 57 of file pi_opencl.cpp.

◆ clEnqueueMemcpyName

CONSTFIX char clEnqueueMemcpyName[] = "clEnqueueMemcpyINTEL"

Definition at line 64 of file pi_opencl.cpp.

◆ clEnqueueMemsetName

CONSTFIX char clEnqueueMemsetName[] = "clEnqueueMemsetINTEL"

Definition at line 63 of file pi_opencl.cpp.

◆ clGetDeviceFunctionPointerName

CONSTFIX char clGetDeviceFunctionPointerName[]
Initial value:
=
"clGetDeviceFunctionPointerINTEL"

Definition at line 68 of file pi_opencl.cpp.

Referenced by piextGetDeviceFunctionPointer().

◆ clGetMemAllocInfoName

CONSTFIX char clGetMemAllocInfoName[] = "clGetMemAllocInfoINTEL"

Definition at line 65 of file pi_opencl.cpp.

◆ clHostMemAllocName

CONSTFIX char clHostMemAllocName[] = "clHostMemAllocINTEL"

Definition at line 56 of file pi_opencl.cpp.

◆ clMemBlockingFreeName

CONSTFIX char clMemBlockingFreeName[] = "clMemBlockingFreeINTEL"

Definition at line 59 of file pi_opencl.cpp.

◆ clSetKernelArgMemPointerName

CONSTFIX char clSetKernelArgMemPointerName[] = "clSetKernelArgMemPointerINTEL"

Definition at line 62 of file pi_opencl.cpp.

Referenced by piextKernelSetArgPointer().

◆ clSetProgramSpecializationConstantName

CONSTFIX char clSetProgramSpecializationConstantName[]
Initial value:
=
"clSetProgramSpecializationConstant"

Definition at line 66 of file pi_opencl.cpp.

Referenced by piextProgramSetSpecializationConstant().

◆ clSharedMemAllocName

CONSTFIX char clSharedMemAllocName[] = "clSharedMemAllocINTEL"

Definition at line 58 of file pi_opencl.cpp.

◆ ErrorMessage

thread_local char ErrorMessage[MaxMessageSize]

Definition at line 76 of file pi_opencl.cpp.

Referenced by piPluginGetLastError(), and setErrorMessage().

◆ ErrorMessageCode

thread_local pi_result ErrorMessageCode = PI_SUCCESS

Definition at line 75 of file pi_opencl.cpp.

Referenced by piPluginGetLastError(), and setErrorMessage().

◆ MaxMessageSize

constexpr size_t MaxMessageSize = 256
constexpr

Definition at line 74 of file pi_opencl.cpp.

Referenced by setErrorMessage().

◆ SupportedVersion

const char SupportedVersion[] = _PI_OPENCL_PLUGIN_VERSION_STRING

Definition at line 1433 of file pi_opencl.cpp.

Referenced by piPluginInit().