DPC++ Runtime
Runtime libraries for oneAPI DPC++
pi_esimd_emulator.cpp File Reference

Declarations for CM Emulation Plugin. More...

#include <stdint.h>
#include <detail/accessor_impl.hpp>
#include <sycl/backend_types.hpp>
#include <sycl/detail/common.hpp>
#include <sycl/detail/export.hpp>
#include <sycl/detail/helpers.hpp>
#include <sycl/detail/host_profiling_info.hpp>
#include <sycl/detail/kernel_desc.hpp>
#include <sycl/detail/type_traits.hpp>
#include <sycl/ext/intel/esimd/common.hpp>
#include <sycl/group.hpp>
#include <sycl/id.hpp>
#include <sycl/kernel.hpp>
#include <sycl/nd_item.hpp>
#include <sycl/range.hpp>
#include <esimdemu_support.h>
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <thread>
#include <utility>
#include "pi_esimd_emulator.hpp"
#include <sycl/detail/pi.def>
Include dependency graph for pi_esimd_emulator.cpp:

Go to the source code of this file.

Classes

struct  KernelInvocationContext< NDims >
 
struct  RangeBuilder< 1 >
 
struct  RangeBuilder< 2 >
 
struct  RangeBuilder< 3 >
 
class  libCMBatch< DIMS >
 
struct  InvokeImpl< NDims >
 

Macros

#define ARG_UNUSED(x)   (void)x
 
#define ESIMDEmuPluginDataVersion   0
 
#define ESIMDEmuPluginInterfaceVersion   1
 
#define DIE_NO_IMPLEMENTATION
 
#define CONTINUE_NO_IMPLEMENTATION
 
#define CASE_PI_UNSUPPORTED(not_supported)
 
#define _PI_API(api)    (PluginInit->PiFunctionTable).api = (decltype(&::api))(&api);
 

Typedefs

using IDBuilder = sycl::detail::Builder
 
template<int NDims>
using KernelFunc = std::function< void(const sycl::nd_item< NDims > &)>
 

Functions

static void PiTrace (std::string TraceString)
 
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<int NDims>
void InvokeKernel (KernelInvocationContext< NDims > *ctx)
 
unsigned int sycl_get_cm_surface_index (void *PtrInput)
 
void sycl_get_cm_buffer_params (unsigned int IndexInput, char **BaseAddr, uint32_t *Width, std::mutex **BufMtxLock)
 
void sycl_get_cm_image_params (unsigned int IndexInput, char **BaseAddr, uint32_t *Width, uint32_t *Height, uint32_t *Bpp, std::mutex **ImgMtxLock)
 
static bool isNull (int NDims, const size_t *R)
 Implementation for Host Kernel Launch used by piEnqueueKernelLaunch. More...
 
pi_result piPlatformsGet (pi_uint32 NumEntries, pi_platform *Platforms, pi_uint32 *NumPlatforms)
 
pi_result piPlatformGetInfo (pi_platform Platform, pi_platform_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
 
pi_result piextPlatformGetNativeHandle (pi_platform, pi_native_handle *)
 Gets the native handle of a PI platform object. More...
 
pi_result piextPlatformCreateWithNativeHandle (pi_native_handle, pi_platform *)
 Creates PI platform object from a native handle. More...
 
pi_result piDevicesGet (pi_platform Platform, pi_device_type DeviceType, pi_uint32 NumEntries, pi_device *Devices, pi_uint32 *NumDevices)
 
pi_result piDeviceRetain (pi_device Device)
 
pi_result piDeviceRelease (pi_device Device)
 
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 piDevicePartition (pi_device, const pi_device_partition_property *, pi_uint32, pi_device *, pi_uint32 *)
 
pi_result piextDeviceGetNativeHandle (pi_device, pi_native_handle *)
 Gets the native handle of a PI device object. More...
 
pi_result piextDeviceCreateWithNativeHandle (pi_native_handle, pi_platform, pi_device *)
 Creates PI device object from a native handle. More...
 
pi_result piContextCreate (const pi_context_properties *Properties, pi_uint32 NumDevices, const pi_device *Devices, void(*PFnNotify)(const char *ErrInfo, const void *PrivateInfo, size_t CB, void *UserData), void *UserData, pi_context *RetContext)
 
pi_result piContextGetInfo (pi_context, pi_context_info, size_t, void *, size_t *)
 
pi_result piextContextSetExtendedDeleter (pi_context, pi_context_extended_deleter, void *)
 
pi_result piextContextGetNativeHandle (pi_context, pi_native_handle *)
 Gets the native handle of a PI context object. More...
 
pi_result piextContextCreateWithNativeHandle (pi_native_handle, pi_uint32, const pi_device *, bool, pi_context *)
 Creates PI context object from a native handle. More...
 
pi_result piContextRetain (pi_context Context)
 
pi_result piContextRelease (pi_context Context)
 
pi_result piQueueCreate (pi_context Context, pi_device Device, pi_queue_properties Properties, pi_queue *Queue)
 
pi_result piQueueGetInfo (pi_queue, pi_queue_info, size_t, void *, size_t *)
 
pi_result piQueueRetain (pi_queue Queue)
 
pi_result piQueueRelease (pi_queue Queue)
 
pi_result piQueueFinish (pi_queue)
 
pi_result piQueueFlush (pi_queue)
 
pi_result piextQueueGetNativeHandle (pi_queue, pi_native_handle *)
 Gets the native handle of a PI queue object. More...
 
pi_result piextQueueCreateWithNativeHandle (pi_native_handle, pi_context, pi_device, bool, pi_queue *)
 Creates PI queue object from a native handle. More...
 
pi_result piMemBufferCreate (pi_context Context, pi_mem_flags Flags, size_t Size, void *HostPtr, pi_mem *RetMem, const pi_mem_properties *properties)
 
pi_result piMemGetInfo (pi_mem, pi_mem_info, size_t, void *, size_t *)
 
pi_result piMemRetain (pi_mem Mem)
 
pi_result piMemRelease (pi_mem Mem)
 
cm_support::CM_SURFACE_FORMAT ConvertPiImageFormatToCmFormat (const pi_image_format *PiFormat)
 
pi_result piMemImageCreate (pi_context Context, pi_mem_flags Flags, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, void *HostPtr, pi_mem *RetImage)
 
pi_result piextMemGetNativeHandle (pi_mem, pi_native_handle *)
 Gets the native handle of a PI mem object. More...
 
pi_result piextMemCreateWithNativeHandle (pi_native_handle, pi_context, bool, pi_mem *)
 Creates PI mem object from a native handle. More...
 
pi_result piProgramCreate (pi_context, const void *, size_t, pi_program *)
 
pi_result piProgramCreateWithBinary (pi_context, pi_uint32, const pi_device *, const size_t *, const unsigned char **, size_t, const pi_device_binary_property *, pi_int32 *, pi_program *)
 Creates a PI program for a context and loads the given binary into it. More...
 
pi_result piclProgramCreateWithBinary (pi_context, pi_uint32, const pi_device *, const size_t *, const unsigned char **, pi_int32 *, pi_program *)
 
pi_result piclProgramCreateWithSource (pi_context, pi_uint32, const char **, const size_t *, pi_program *)
 
pi_result piProgramGetInfo (pi_program, pi_program_info, size_t, void *, size_t *)
 
pi_result piProgramLink (pi_context, pi_uint32, const pi_device *, const char *, pi_uint32, const pi_program *, void(*)(pi_program, void *), void *, pi_program *)
 
pi_result piProgramCompile (pi_program, pi_uint32, const pi_device *, const char *, pi_uint32, const pi_program *, const char **, void(*)(pi_program, void *), void *)
 
pi_result piProgramBuild (pi_program, pi_uint32, const pi_device *, const char *, void(*)(pi_program, void *), void *)
 
pi_result piProgramGetBuildInfo (pi_program, pi_device, pi_program_build_info, size_t, void *, size_t *)
 
pi_result piProgramRetain (pi_program)
 
pi_result piProgramRelease (pi_program)
 
pi_result piextProgramGetNativeHandle (pi_program, pi_native_handle *)
 Gets the native handle of a PI program object. More...
 
pi_result piextProgramCreateWithNativeHandle (pi_native_handle, pi_context, bool, pi_program *)
 Creates PI program object from a native handle. More...
 
pi_result piKernelCreate (pi_program, const char *, pi_kernel *)
 
pi_result piKernelSetArg (pi_kernel, pi_uint32, size_t, const void *)
 
pi_result piextKernelSetArgMemObj (pi_kernel, pi_uint32, const pi_mem *)
 
pi_result piextKernelSetArgSampler (pi_kernel, pi_uint32, const pi_sampler *)
 
pi_result piKernelGetInfo (pi_kernel, pi_kernel_info, size_t, void *, size_t *)
 
pi_result piKernelGetGroupInfo (pi_kernel, pi_device, pi_kernel_group_info, size_t, void *, size_t *)
 
pi_result piKernelGetSubGroupInfo (pi_kernel, pi_device, pi_kernel_sub_group_info, size_t, const void *, size_t, void *, size_t *)
 API to query information from the sub-group from a kernel. More...
 
pi_result piKernelRetain (pi_kernel)
 
pi_result piKernelRelease (pi_kernel)
 
pi_result piEventCreate (pi_context, pi_event *)
 Create PI event object in a signalled/completed state. More...
 
pi_result piEventGetInfo (pi_event, pi_event_info, size_t, void *, size_t *)
 
pi_result piEventGetProfilingInfo (pi_event Event, pi_profiling_info ParamName, size_t ParamValueSize, void *ParamValue, size_t *ParamValueSizeRet)
 
pi_result piEventsWait (pi_uint32 NumEvents, const pi_event *EventList)
 
pi_result piEventSetCallback (pi_event, pi_int32, void(*)(pi_event, pi_int32, void *), void *)
 
pi_result piEventSetStatus (pi_event, pi_int32)
 
pi_result piEventRetain (pi_event Event)
 
pi_result piEventRelease (pi_event Event)
 
pi_result piextEventGetNativeHandle (pi_event, pi_native_handle *)
 Gets the native handle of a PI event object. More...
 
pi_result piextEventCreateWithNativeHandle (pi_native_handle, pi_context, bool, pi_event *)
 Creates PI event object from a native handle. More...
 
pi_result piSamplerCreate (pi_context, const pi_sampler_properties *, pi_sampler *)
 
pi_result piSamplerGetInfo (pi_sampler, pi_sampler_info, size_t, void *, size_t *)
 
pi_result piSamplerRetain (pi_sampler)
 
pi_result piSamplerRelease (pi_sampler)
 
pi_result piEnqueueEventsWait (pi_queue, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueEventsWaitWithBarrier (pi_queue, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferRead (pi_queue Queue, pi_mem Src, pi_bool BlockingRead, size_t Offset, size_t Size, void *Dst, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
 
pi_result piEnqueueMemBufferReadRect (pi_queue, pi_mem, pi_bool, pi_buff_rect_offset, pi_buff_rect_offset, pi_buff_rect_region, size_t, size_t, size_t, size_t, void *, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferWrite (pi_queue, pi_mem, pi_bool, size_t, size_t, const void *, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferWriteRect (pi_queue, pi_mem, pi_bool, pi_buff_rect_offset, pi_buff_rect_offset, pi_buff_rect_region, size_t, size_t, size_t, size_t, const void *, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferCopy (pi_queue, pi_mem, pi_mem, size_t, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferCopyRect (pi_queue, pi_mem, pi_mem, pi_buff_rect_offset, pi_buff_rect_offset, pi_buff_rect_region, size_t, size_t, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferFill (pi_queue, pi_mem, const void *, size_t, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemBufferMap (pi_queue Queue, pi_mem MemObj, pi_bool BlockingMap, pi_map_flags MapFlags, size_t Offset, size_t Size, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event, void **RetMap)
 
pi_result piEnqueueMemUnmap (pi_queue Queue, pi_mem MemObj, void *MappedPtr, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
 
pi_result piMemImageGetInfo (pi_mem, pi_image_info, size_t, void *, size_t *)
 
pi_result piEnqueueMemImageRead (pi_queue CommandQueue, pi_mem Image, pi_bool BlockingRead, pi_image_offset Origin, pi_image_region Region, size_t RowPitch, size_t SlicePitch, void *Ptr, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
 
pi_result piEnqueueMemImageWrite (pi_queue, pi_mem, pi_bool, pi_image_offset, pi_image_region, size_t, size_t, const void *, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemImageCopy (pi_queue, pi_mem, pi_mem, pi_image_offset, pi_image_offset, pi_image_region, pi_uint32, const pi_event *, pi_event *)
 
pi_result piEnqueueMemImageFill (pi_queue, pi_mem, const void *, const size_t *, const size_t *, pi_uint32, const pi_event *, pi_event *)
 
pi_result piMemBufferPartition (pi_mem, pi_mem_flags, pi_buffer_create_type, void *, pi_mem *)
 
pi_result piEnqueueKernelLaunch (pi_queue Queue, pi_kernel Kernel, pi_uint32 WorkDim, const size_t *GlobalWorkOffset, const size_t *GlobalWorkSize, const size_t *LocalWorkSize, pi_uint32 NumEventsInWaitList, const pi_event *EventWaitList, pi_event *Event)
 
pi_result piextKernelCreateWithNativeHandle (pi_native_handle, pi_context, pi_program, bool, pi_kernel *)
 Creates PI kernel object from a native handle. More...
 
pi_result piextKernelGetNativeHandle (pi_kernel, pi_native_handle *)
 Gets the native handle of a PI kernel object. More...
 
pi_result piEnqueueNativeKernel (pi_queue, void(*)(void *), void *, size_t, pi_uint32, const pi_mem *, const void **, pi_uint32, const pi_event *, pi_event *)
 
pi_result piextGetDeviceFunctionPointer (pi_device, pi_program, const char *, pi_uint64 *)
 Retrieves a device function pointer to a user-defined function. More...
 
pi_result piextUSMHostAlloc (void **, pi_context, pi_usm_mem_properties *, size_t, pi_uint32)
 Allocates host memory accessible by the device. More...
 
pi_result piextUSMDeviceAlloc (void **, pi_context, pi_device, pi_usm_mem_properties *, size_t, pi_uint32)
 Allocates device memory. More...
 
pi_result piextUSMSharedAlloc (void **ResultPtr, 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)
 Indicates that the allocated USM memory is no longer needed on the runtime side. More...
 
pi_result piextKernelSetArgPointer (pi_kernel, pi_uint32, size_t, const void *)
 Sets up pointer arguments for CL kernels. More...
 
pi_result piextUSMEnqueueMemset (pi_queue, void *, pi_int32, size_t, pi_uint32, const pi_event *, pi_event *)
 USM Memset API. More...
 
pi_result piextUSMEnqueueMemcpy (pi_queue, pi_bool, void *, const void *, size_t, pi_uint32, const pi_event *, pi_event *)
 USM Memcpy API. More...
 
pi_result piextUSMEnqueueMemAdvise (pi_queue, const void *, size_t, pi_mem_advice, pi_event *)
 USM Memadvise API. More...
 
pi_result piextUSMGetMemAllocInfo (pi_context, const void *, pi_mem_alloc_info, size_t, void *, size_t *)
 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, pi_kernel_exec_info, size_t, const void *)
 API to set attributes controlling kernel execution. More...
 
pi_result piextProgramSetSpecializationConstant (pi_program, pi_uint32, size_t, const void *)
 Sets a specialization constant to a specific value. More...
 
pi_result piextDeviceSelectBinary (pi_device, pi_device_binary *, pi_uint32 RawImgSize, pi_uint32 *ImgInd)
 Selects the most appropriate device binary based on runtime information and the IR characteristics. More...
 
pi_result piextUSMEnqueuePrefetch (pi_queue, const void *, size_t, pi_usm_migration_flags, pi_uint32, const pi_event *, pi_event *)
 Hint to migrate memory to the device. More...
 
pi_result piextPluginGetOpaqueData (void *, void **OpaqueDataReturn)
 API to get Plugin internal data, opaque to SYCL RT. More...
 
pi_result piTearDown (void *)
 API to notify that the plugin should clean up its resources. More...
 
pi_result piPluginInit (pi_plugin *PluginInit)
 

Variables

static bool PrintPiTrace = false
 
static sycl::detail::ESIMDEmuPluginOpaqueData * PiESimdDeviceAccess
 
static pi_platform PiPlatformCache
 
static std::mutex * PiPlatformCacheLock = new std::mutex
 
static std::unordered_map< unsigned int, _pi_mem * > * PiESimdSurfaceMap
 
static std::mutex * PiESimdSurfaceMapLock = new std::mutex
 
static char ESimdEmuVersionString [32]
 
constexpr size_t MaxMessageSize = 256
 
thread_local pi_result ErrorMessageCode = PI_SUCCESS
 
thread_local char ErrorMessage [MaxMessageSize]
 
const char SupportedVersion [] = _PI_ESIMD_PLUGIN_VERSION_STRING
 

Detailed Description

Declarations for CM Emulation Plugin.

It is the interface between the device-agnostic SYCL runtime layer and underlying CM Emulation

Definition in file pi_esimd_emulator.cpp.

Macro Definition Documentation

◆ _PI_API

#define _PI_API (   api)     (PluginInit->PiFunctionTable).api = (decltype(&::api))(&api);

◆ ARG_UNUSED

#define ARG_UNUSED (   x)    (void)x

Definition at line 47 of file pi_esimd_emulator.cpp.

◆ CASE_PI_UNSUPPORTED

#define CASE_PI_UNSUPPORTED (   not_supported)
Value:
case not_supported: \
if (PrintPiTrace) { \
std::cerr << std::endl \
<< "Unsupported PI case : " << #not_supported << " in " \
<< __FUNCTION__ << ":" << __LINE__ << "(" << __FILE__ << ")" \
<< std::endl; \
} \
return PI_ERROR_INVALID_OPERATION;
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
static bool PrintPiTrace

Definition at line 391 of file pi_esimd_emulator.cpp.

◆ CONTINUE_NO_IMPLEMENTATION

#define CONTINUE_NO_IMPLEMENTATION
Value:
if (PrintPiTrace) { \
std::cerr << "Warning : Not Implemented : " << __FUNCTION__ \
<< " - File : " << __FILE__; \
std::cerr << " / Line : " << __LINE__ << std::endl; \
} \
return PI_SUCCESS;

Definition at line 383 of file pi_esimd_emulator.cpp.

◆ DIE_NO_IMPLEMENTATION

#define DIE_NO_IMPLEMENTATION
Value:
if (PrintPiTrace) { \
std::cerr << "Not Implemented : " << __FUNCTION__ \
<< " - File : " << __FILE__; \
std::cerr << " / Line : " << __LINE__ << std::endl; \
} \
return PI_ERROR_INVALID_OPERATION;

Definition at line 375 of file pi_esimd_emulator.cpp.

◆ ESIMDEmuPluginDataVersion

#define ESIMDEmuPluginDataVersion   0

Definition at line 142 of file pi_esimd_emulator.cpp.

◆ ESIMDEmuPluginInterfaceVersion

#define ESIMDEmuPluginInterfaceVersion   1

Definition at line 146 of file pi_esimd_emulator.cpp.

Typedef Documentation

◆ IDBuilder

using IDBuilder = sycl::detail::Builder

Definition at line 170 of file pi_esimd_emulator.cpp.

◆ KernelFunc

template<int NDims>
using KernelFunc = std::function<void(const sycl::nd_item<NDims> &)>

Definition at line 173 of file pi_esimd_emulator.cpp.

Function Documentation

◆ ConvertPiImageFormatToCmFormat()

◆ InvokeKernel()

◆ isNull()

static bool isNull ( int  NDims,
const size_t *  R 
)
static

Implementation for Host Kernel Launch used by piEnqueueKernelLaunch.

Definition at line 341 of file pi_esimd_emulator.cpp.

Referenced by piEnqueueKernelLaunch().

◆ piclProgramCreateWithBinary()

pi_result piclProgramCreateWithBinary ( pi_context  ,
pi_uint32  ,
const pi_device ,
const size_t *  ,
const unsigned char **  ,
pi_int32 ,
pi_program  
)

Definition at line 1294 of file pi_esimd_emulator.cpp.

References DIE_NO_IMPLEMENTATION.

◆ piclProgramCreateWithSource()

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

Definition at line 1300 of file pi_esimd_emulator.cpp.

◆ piContextCreate()

pi_result piContextCreate ( const pi_context_properties Properties,
pi_uint32  NumDevices,
const pi_device Devices,
void(*)(const char *ErrInfo, const void *PrivateInfo, size_t CB, void *UserData)  PFnNotify,
void *  UserData,
pi_context RetContext 
)

Single-root-device

Definition at line 830 of file pi_esimd_emulator.cpp.

References ARG_UNUSED.

◆ piContextGetInfo()

pi_result piContextGetInfo ( pi_context  context,
pi_context_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 861 of file pi_esimd_emulator.cpp.

◆ piContextRelease()

pi_result piContextRelease ( pi_context  Context)

TODO : Encapsulating accesses (add/remove) for Addr2CmBufferSVM

Definition at line 891 of file pi_esimd_emulator.cpp.

◆ piContextRetain()

pi_result piContextRetain ( pi_context  Context)

Definition at line 881 of file pi_esimd_emulator.cpp.

◆ 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 592 of file pi_esimd_emulator.cpp.

◆ piDevicePartition()

pi_result piDevicePartition ( pi_device  device,
const pi_device_partition_property properties,
pi_uint32  num_devices,
pi_device out_devices,
pi_uint32 out_num_devices 
)

Definition at line 816 of file pi_esimd_emulator.cpp.

◆ piDeviceRelease()

pi_result piDeviceRelease ( pi_device  Device)

Definition at line 582 of file pi_esimd_emulator.cpp.

◆ piDeviceRetain()

pi_result piDeviceRetain ( pi_device  Device)

Definition at line 572 of file pi_esimd_emulator.cpp.

◆ piDevicesGet()

pi_result piDevicesGet ( pi_platform  Platform,
pi_device_type  DeviceType,
pi_uint32  NumEntries,
pi_device Devices,
pi_uint32 NumDevices 
)

Runtime queries number of devices

No GPU entry to fill 'Devices' array

Definition at line 484 of file pi_esimd_emulator.cpp.

◆ piEnqueueEventsWait()

pi_result piEnqueueEventsWait ( pi_queue  command_queue,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1479 of file pi_esimd_emulator.cpp.

◆ piEnqueueEventsWaitWithBarrier()

pi_result piEnqueueEventsWaitWithBarrier ( pi_queue  command_queue,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1484 of file pi_esimd_emulator.cpp.

◆ piEnqueueKernelLaunch()

pi_result piEnqueueKernelLaunch ( pi_queue  Queue,
pi_kernel  Kernel,
pi_uint32  WorkDim,
const size_t *  GlobalWorkOffset,
const size_t *  GlobalWorkSize,
const size_t *  LocalWorkSize,
pi_uint32  NumEventsInWaitList,
const pi_event EventWaitList,
pi_event Event 
)

Definition at line 1761 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferCopy()

pi_result piEnqueueMemBufferCopy ( pi_queue  command_queue,
pi_mem  src_buffer,
pi_mem  dst_buffer,
size_t  src_offset,
size_t  dst_offset,
size_t  size,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1569 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferCopyRect()

pi_result piEnqueueMemBufferCopyRect ( pi_queue  command_queue,
pi_mem  src_buffer,
pi_mem  dst_buffer,
pi_buff_rect_offset  src_origin,
pi_buff_rect_offset  dst_origin,
pi_buff_rect_region  region,
size_t  src_row_pitch,
size_t  src_slice_pitch,
size_t  dst_row_pitch,
size_t  dst_slice_pitch,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1575 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferFill()

pi_result piEnqueueMemBufferFill ( pi_queue  command_queue,
pi_mem  buffer,
const void *  pattern,
size_t  pattern_size,
size_t  offset,
size_t  size,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1583 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferMap()

pi_result piEnqueueMemBufferMap ( pi_queue  Queue,
pi_mem  MemObj,
pi_bool  BlockingMap,
pi_map_flags  MapFlags,
size_t  Offset,
size_t  Size,
pi_uint32  NumEventsInWaitList,
const pi_event EventWaitList,
pi_event Event,
void **  RetMap 
)

Definition at line 1589 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferRead()

pi_result piEnqueueMemBufferRead ( pi_queue  Queue,
pi_mem  Src,
pi_bool  BlockingRead,
size_t  Offset,
size_t  Size,
void *  Dst,
pi_uint32  NumEventsInWaitList,
const pi_event EventWaitList,
pi_event Event 
)

TODO : Support Blocked read, 'Queue' handling

Definition at line 1489 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferReadRect()

pi_result piEnqueueMemBufferReadRect ( pi_queue  command_queue,
pi_mem  buffer,
pi_bool  blocking_read,
pi_buff_rect_offset  buffer_offset,
pi_buff_rect_offset  host_offset,
pi_buff_rect_region  region,
size_t  buffer_row_pitch,
size_t  buffer_slice_pitch,
size_t  host_row_pitch,
size_t  host_slice_pitch,
void *  ptr,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1547 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferWrite()

pi_result piEnqueueMemBufferWrite ( pi_queue  command_queue,
pi_mem  buffer,
pi_bool  blocking_write,
size_t  offset,
size_t  size,
const void *  ptr,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1555 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemBufferWriteRect()

pi_result piEnqueueMemBufferWriteRect ( pi_queue  command_queue,
pi_mem  buffer,
pi_bool  blocking_write,
pi_buff_rect_offset  buffer_offset,
pi_buff_rect_offset  host_offset,
pi_buff_rect_region  region,
size_t  buffer_row_pitch,
size_t  buffer_slice_pitch,
size_t  host_row_pitch,
size_t  host_slice_pitch,
const void *  ptr,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1561 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemImageCopy()

pi_result piEnqueueMemImageCopy ( pi_queue  command_queue,
pi_mem  src_image,
pi_mem  dst_image,
pi_image_offset  src_origin,
pi_image_offset  dst_origin,
pi_image_region  region,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1743 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemImageFill()

pi_result piEnqueueMemImageFill ( pi_queue  command_queue,
pi_mem  image,
const void *  fill_color,
const size_t *  origin,
const size_t *  region,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1749 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemImageRead()

pi_result piEnqueueMemImageRead ( pi_queue  CommandQueue,
pi_mem  Image,
pi_bool  BlockingRead,
pi_image_offset  Origin,
pi_image_region  Region,
size_t  RowPitch,
size_t  SlicePitch,
void *  Ptr,
pi_uint32  NumEventsInWaitList,
const pi_event EventWaitList,
pi_event Event 
)

TODO : Support Blocked read, 'Queue' handling

Definition at line 1672 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemImageWrite()

pi_result piEnqueueMemImageWrite ( pi_queue  command_queue,
pi_mem  image,
pi_bool  blocking_write,
pi_image_offset  origin,
pi_image_region  region,
size_t  input_row_pitch,
size_t  input_slice_pitch,
const void *  ptr,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1737 of file pi_esimd_emulator.cpp.

◆ piEnqueueMemUnmap()

pi_result piEnqueueMemUnmap ( pi_queue  Queue,
pi_mem  MemObj,
void *  MappedPtr,
pi_uint32  NumEventsInWaitList,
const pi_event EventWaitList,
pi_event Event 
)

Definition at line 1632 of file pi_esimd_emulator.cpp.

◆ piEnqueueNativeKernel()

pi_result piEnqueueNativeKernel ( pi_queue  queue,
void(*)(void *)  user_func,
void *  args,
size_t  cb_args,
pi_uint32  num_mem_objects,
const pi_mem mem_list,
const void **  args_mem_loc,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 1831 of file pi_esimd_emulator.cpp.

◆ piEventCreate()

pi_result piEventCreate ( pi_context  context,
pi_event ret_event 
)

Create PI event object in a signalled/completed state.

Parameters
contextis the PI context of the event.
ret_eventis the PI even created.

Definition at line 1382 of file pi_esimd_emulator.cpp.

◆ piEventGetInfo()

pi_result piEventGetInfo ( pi_event  event,
pi_event_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1384 of file pi_esimd_emulator.cpp.

◆ piEventGetProfilingInfo()

pi_result piEventGetProfilingInfo ( pi_event  Event,
pi_profiling_info  ParamName,
size_t  ParamValueSize,
void *  ParamValue,
size_t *  ParamValueSizeRet 
)

Definition at line 1388 of file pi_esimd_emulator.cpp.

◆ piEventRelease()

pi_result piEventRelease ( pi_event  Event)

Definition at line 1436 of file pi_esimd_emulator.cpp.

◆ piEventRetain()

pi_result piEventRetain ( pi_event  Event)

Definition at line 1426 of file pi_esimd_emulator.cpp.

◆ piEventSetCallback()

pi_result piEventSetCallback ( pi_event  ,
pi_int32  ,
void(*)(pi_event, pi_int32, void *)  ,
void *   
)

Definition at line 1419 of file pi_esimd_emulator.cpp.

References DIE_NO_IMPLEMENTATION.

◆ piEventSetStatus()

pi_result piEventSetStatus ( pi_event  event,
pi_int32  execution_status 
)

Definition at line 1424 of file pi_esimd_emulator.cpp.

◆ piEventsWait()

pi_result piEventsWait ( pi_uint32  NumEvents,
const pi_event EventList 
)

Definition at line 1401 of file pi_esimd_emulator.cpp.

◆ 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 875 of file pi_esimd_emulator.cpp.

◆ 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 871 of file pi_esimd_emulator.cpp.

◆ piextContextSetExtendedDeleter()

pi_result piextContextSetExtendedDeleter ( pi_context  context,
pi_context_extended_deleter  func,
void *  user_data 
)

Definition at line 866 of file pi_esimd_emulator.cpp.

◆ 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 825 of file pi_esimd_emulator.cpp.

◆ 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 821 of file pi_esimd_emulator.cpp.

◆ piextDeviceSelectBinary()

pi_result piextDeviceSelectBinary ( pi_device  device,
pi_device_binary binaries,
pi_uint32  RawImgSize,
pi_uint32 ImgInd 
)

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 1949 of file pi_esimd_emulator.cpp.

◆ 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 1461 of file pi_esimd_emulator.cpp.

◆ piextEventGetNativeHandle()

pi_result piextEventGetNativeHandle ( pi_event  event,
pi_native_handle nativeHandle 
)

Gets the native handle of a PI event object.

Parameters
eventis the PI event to get the native handle of.
nativeHandleis the native handle of event.

Definition at line 1457 of file pi_esimd_emulator.cpp.

◆ 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 1837 of file pi_esimd_emulator.cpp.

◆ 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 1822 of file pi_esimd_emulator.cpp.

◆ 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 1827 of file pi_esimd_emulator.cpp.

◆ piextKernelSetArgMemObj()

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

Definition at line 1354 of file pi_esimd_emulator.cpp.

◆ 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 1915 of file pi_esimd_emulator.cpp.

◆ piextKernelSetArgSampler()

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

Definition at line 1359 of file pi_esimd_emulator.cpp.

◆ 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 1278 of file pi_esimd_emulator.cpp.

◆ 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 1274 of file pi_esimd_emulator.cpp.

◆ 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 480 of file pi_esimd_emulator.cpp.

◆ 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 476 of file pi_esimd_emulator.cpp.

◆ piextPluginGetOpaqueData()

pi_result piextPluginGetOpaqueData ( void *  opaque_data_param,
void **  opaque_data_return 
)

API to get Plugin internal data, opaque to SYCL RT.

Some devices whose device code is compiled by the host compiler (e.g. CPU emulators) may use it to access some device code functionality implemented in/behind the plugin.

Parameters
opaque_data_param- unspecified argument, interpretation is specific to a plugin
opaque_data_return- placeholder for the returned opaque data.

Definition at line 1967 of file pi_esimd_emulator.cpp.

◆ 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 1341 of file pi_esimd_emulator.cpp.

◆ 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 1337 of file pi_esimd_emulator.cpp.

◆ 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 1944 of file pi_esimd_emulator.cpp.

◆ 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 998 of file pi_esimd_emulator.cpp.

◆ 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 994 of file pi_esimd_emulator.cpp.

◆ 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
propertiesare optional allocation properties
sizeis the size of the allocation
alignmentis the desired alignment of the allocation

Definition at line 1847 of file pi_esimd_emulator.cpp.

◆ 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 memory to advise
adviceis device specific advice
eventis the event that represents this operation

Definition at line 1929 of file pi_esimd_emulator.cpp.

◆ 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 1924 of file pi_esimd_emulator.cpp.

◆ 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 1919 of file pi_esimd_emulator.cpp.

◆ 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 1961 of file pi_esimd_emulator.cpp.

◆ piextUSMFree()

pi_result piextUSMFree ( pi_context  context,
void *  ptr 
)

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

The actual freeing of the memory may be done in a blocking or deferred manner, e.g. to avoid issues with indirect memory access from kernels.

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

Definition at line 1891 of file pi_esimd_emulator.cpp.

◆ 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_size_retis how many bytes were written

Definition at line 1934 of file pi_esimd_emulator.cpp.

◆ 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
propertiesare optional allocation properties
sizeis the size of the allocation
alignmentis the desired alignment of the allocation

Definition at line 1842 of file pi_esimd_emulator.cpp.

◆ 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
propertiesare optional allocation properties
sizeis the size of the allocation
alignmentis the desired alignment of the allocation

Definition at line 1852 of file pi_esimd_emulator.cpp.

◆ piKernelCreate()

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

Definition at line 1346 of file pi_esimd_emulator.cpp.

◆ 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 
)

Definition at line 1367 of file pi_esimd_emulator.cpp.

◆ piKernelGetInfo()

pi_result piKernelGetInfo ( pi_kernel  kernel,
pi_kernel_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1363 of file pi_esimd_emulator.cpp.

◆ 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 1372 of file pi_esimd_emulator.cpp.

◆ piKernelRelease()

pi_result piKernelRelease ( pi_kernel  kernel)

Definition at line 1380 of file pi_esimd_emulator.cpp.

◆ piKernelRetain()

pi_result piKernelRetain ( pi_kernel  kernel)

Definition at line 1378 of file pi_esimd_emulator.cpp.

◆ piKernelSetArg()

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

Definition at line 1350 of file pi_esimd_emulator.cpp.

◆ piKernelSetExecInfo()

pi_result piKernelSetExecInfo ( pi_kernel  kernel,
pi_kernel_exec_info  value_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 1939 of file pi_esimd_emulator.cpp.

◆ piMemBufferCreate()

pi_result piMemBufferCreate ( pi_context  Context,
pi_mem_flags  Flags,
size_t  Size,
void *  HostPtr,
pi_mem RetMem,
const pi_mem_properties properties 
)

Definition at line 1003 of file pi_esimd_emulator.cpp.

◆ 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 
)

Definition at line 1755 of file pi_esimd_emulator.cpp.

◆ piMemGetInfo()

pi_result piMemGetInfo ( pi_mem  mem,
pi_mem_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1076 of file pi_esimd_emulator.cpp.

◆ piMemImageCreate()

pi_result piMemImageCreate ( pi_context  Context,
pi_mem_flags  Flags,
const pi_image_format ImageFormat,
const pi_image_desc ImageDesc,
void *  HostPtr,
pi_mem RetImage 
)

Definition at line 1155 of file pi_esimd_emulator.cpp.

◆ piMemImageGetInfo()

pi_result piMemImageGetInfo ( pi_mem  image,
pi_image_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1668 of file pi_esimd_emulator.cpp.

◆ piMemRelease()

pi_result piMemRelease ( pi_mem  Mem)

Definition at line 1088 of file pi_esimd_emulator.cpp.

◆ piMemRetain()

pi_result piMemRetain ( pi_mem  Mem)

Definition at line 1080 of file pi_esimd_emulator.cpp.

◆ piPlatformGetInfo()

pi_result piPlatformGetInfo ( pi_platform  Platform,
pi_platform_info  ParamName,
size_t  ParamValueSize,
void *  ParamValue,
size_t *  ParamValueSizeRet 
)

Definition at line 444 of file pi_esimd_emulator.cpp.

◆ piPlatformsGet()

pi_result piPlatformsGet ( pi_uint32  NumEntries,
pi_platform Platforms,
pi_uint32 NumPlatforms 
)

Runtime queries number of Platforms

Definition at line 401 of file pi_esimd_emulator.cpp.

◆ 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 165 of file pi_esimd_emulator.cpp.

◆ piPluginInit()

◆ piProgramBuild()

pi_result piProgramBuild ( pi_program  ,
pi_uint32  ,
const pi_device ,
const char *  ,
void(*)(pi_program, void *)  ,
void *   
)

Definition at line 1323 of file pi_esimd_emulator.cpp.

References DIE_NO_IMPLEMENTATION.

◆ piProgramCompile()

pi_result piProgramCompile ( pi_program  ,
pi_uint32  ,
const pi_device ,
const char *  ,
pi_uint32  ,
const pi_program ,
const char **  ,
void(*)(pi_program, void *)  ,
void *   
)

Definition at line 1316 of file pi_esimd_emulator.cpp.

References DIE_NO_IMPLEMENTATION.

◆ piProgramCreate()

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

Definition at line 1283 of file pi_esimd_emulator.cpp.

◆ 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 1287 of file pi_esimd_emulator.cpp.

◆ piProgramGetBuildInfo()

pi_result piProgramGetBuildInfo ( pi_program  program,
pi_device  device,
pi_program_build_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1328 of file pi_esimd_emulator.cpp.

◆ piProgramGetInfo()

pi_result piProgramGetInfo ( pi_program  program,
pi_program_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1305 of file pi_esimd_emulator.cpp.

◆ piProgramLink()

pi_result piProgramLink ( pi_context  ,
pi_uint32  ,
const pi_device ,
const char *  ,
pi_uint32  ,
const pi_program ,
void(*)(pi_program, void *)  ,
void *  ,
pi_program  
)

Definition at line 1310 of file pi_esimd_emulator.cpp.

References DIE_NO_IMPLEMENTATION.

◆ piProgramRelease()

pi_result piProgramRelease ( pi_program  program)

Definition at line 1335 of file pi_esimd_emulator.cpp.

◆ piProgramRetain()

pi_result piProgramRetain ( pi_program  program)

Definition at line 1333 of file pi_esimd_emulator.cpp.

◆ piQueueCreate()

pi_result piQueueCreate ( pi_context  Context,
pi_device  Device,
pi_queue_properties  Properties,
pi_queue Queue 
)

Definition at line 926 of file pi_esimd_emulator.cpp.

◆ piQueueFinish()

pi_result piQueueFinish ( pi_queue  command_queue)

Definition at line 980 of file pi_esimd_emulator.cpp.

◆ piQueueFlush()

pi_result piQueueFlush ( pi_queue  command_queue)

Definition at line 987 of file pi_esimd_emulator.cpp.

◆ piQueueGetInfo()

pi_result piQueueGetInfo ( pi_queue  command_queue,
pi_queue_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 954 of file pi_esimd_emulator.cpp.

◆ piQueueRelease()

pi_result piQueueRelease ( pi_queue  Queue)

Definition at line 966 of file pi_esimd_emulator.cpp.

◆ piQueueRetain()

pi_result piQueueRetain ( pi_queue  Queue)

Definition at line 958 of file pi_esimd_emulator.cpp.

◆ piSamplerCreate()

pi_result piSamplerCreate ( pi_context  context,
const pi_sampler_properties sampler_properties,
pi_sampler result_sampler 
)

Definition at line 1465 of file pi_esimd_emulator.cpp.

◆ piSamplerGetInfo()

pi_result piSamplerGetInfo ( pi_sampler  sampler,
pi_sampler_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1470 of file pi_esimd_emulator.cpp.

◆ piSamplerRelease()

pi_result piSamplerRelease ( pi_sampler  sampler)

Definition at line 1477 of file pi_esimd_emulator.cpp.

◆ piSamplerRetain()

pi_result piSamplerRetain ( pi_sampler  sampler)

Definition at line 1475 of file pi_esimd_emulator.cpp.

◆ 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 1972 of file pi_esimd_emulator.cpp.

◆ PiTrace()

◆ setErrorMessage()

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

◆ sycl_get_cm_buffer_params()

void sycl_get_cm_buffer_params ( unsigned int  IndexInput,
char **  BaseAddr,
uint32_t *  Width,
std::mutex **  BufMtxLock 
)

◆ sycl_get_cm_image_params()

void sycl_get_cm_image_params ( unsigned int  IndexInput,
char **  BaseAddr,
uint32_t *  Width,
uint32_t *  Height,
uint32_t *  Bpp,
std::mutex **  ImgMtxLock 
)

◆ sycl_get_cm_surface_index()

unsigned int sycl_get_cm_surface_index ( void *  PtrInput)

Definition at line 273 of file pi_esimd_emulator.cpp.

References _pi_mem::SurfaceIndex.

Variable Documentation

◆ ErrorMessage

thread_local char ErrorMessage[MaxMessageSize]

Definition at line 154 of file pi_esimd_emulator.cpp.

Referenced by piPluginGetLastError(), and setErrorMessage().

◆ ErrorMessageCode

thread_local pi_result ErrorMessageCode = PI_SUCCESS

Definition at line 153 of file pi_esimd_emulator.cpp.

Referenced by piPluginGetLastError(), and setErrorMessage().

◆ ESimdEmuVersionString

char ESimdEmuVersionString[32]
static

Definition at line 149 of file pi_esimd_emulator.cpp.

Referenced by piDeviceGetInfo().

◆ MaxMessageSize

constexpr size_t MaxMessageSize = 256
constexpr

Definition at line 152 of file pi_esimd_emulator.cpp.

Referenced by setErrorMessage().

◆ PiESimdDeviceAccess

sycl::detail::ESIMDEmuPluginOpaqueData* PiESimdDeviceAccess
static

Definition at line 127 of file pi_esimd_emulator.cpp.

Referenced by piextPluginGetOpaqueData(), piPluginInit(), and piTearDown().

◆ PiESimdSurfaceMap

std::unordered_map<unsigned int, _pi_mem *>* PiESimdSurfaceMap
static
Initial value:
=
new std::unordered_map<unsigned int, _pi_mem *>

Definition at line 135 of file pi_esimd_emulator.cpp.

Referenced by piMemBufferCreate(), piMemImageCreate(), piMemRelease(), piTearDown(), sycl_get_cm_buffer_params(), and sycl_get_cm_image_params().

◆ PiESimdSurfaceMapLock

std::mutex* PiESimdSurfaceMapLock = new std::mutex
static

◆ PiPlatformCache

pi_platform PiPlatformCache
static

Definition at line 130 of file pi_esimd_emulator.cpp.

Referenced by piPlatformsGet().

◆ PiPlatformCacheLock

std::mutex* PiPlatformCacheLock = new std::mutex
static

Definition at line 132 of file pi_esimd_emulator.cpp.

Referenced by piPlatformsGet().

◆ PrintPiTrace

bool PrintPiTrace = false
static

Definition at line 114 of file pi_esimd_emulator.cpp.

Referenced by _pi_queue::executeCommandList(), piPlatformsGet(), and PiTrace().

◆ SupportedVersion

const char SupportedVersion[] = _PI_ESIMD_PLUGIN_VERSION_STRING

Definition at line 1987 of file pi_esimd_emulator.cpp.

Referenced by piPluginInit().