DPC++ Runtime
Runtime libraries for oneAPI DPC++
|
|
Go to the documentation of this file.
26 #include <type_traits>
29 #ifdef XPTI_ENABLE_INSTRUMENTATION
32 struct trace_event_data_t;
37 inline namespace _V1 {
44 #define _PI_API(api) api,
45 #include <sycl/detail/pi.def>
50 template <sycl::backend BE>
66 #ifdef __SYCL_RT_OS_WINDOWS
70 #define __SYCL_OPENCL_PLUGIN_NAME "pi_opencl.dll"
71 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "pi_level_zero.dll"
72 #define __SYCL_CUDA_PLUGIN_NAME "pi_cuda.dll"
73 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "pi_esimd_emulator.dll"
74 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dll"
75 #define __SYCL_UR_PLUGIN_NAME "pi_unified_runtime.dll"
76 #define __SYCL_NATIVE_CPU_PLUGIN_NAME "pi_native_cpu.dll"
78 #define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.dll"
79 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.dll"
80 #define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.dll"
81 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.dll"
82 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dll"
83 #define __SYCL_UR_PLUGIN_NAME "libpi_unified_runtime.dll"
84 #define __SYCL_NATIVE_CPU_PLUGIN_NAME "libpi_native_cpu.dll"
86 #elif defined(__SYCL_RT_OS_LINUX)
87 #define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.so"
88 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.so"
89 #define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.so"
90 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.so"
91 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.so"
92 #define __SYCL_UR_PLUGIN_NAME "libpi_unified_runtime.so"
93 #define __SYCL_NATIVE_CPU_PLUGIN_NAME "libpi_native_cpu.so"
94 #elif defined(__SYCL_RT_OS_DARWIN)
95 #define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.dylib"
96 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.dylib"
97 #define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.dylib"
98 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.dylib"
99 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dylib"
100 #define __SYCL_UR_PLUGIN_NAME "libpi_unified_runtime.dylib"
101 #define __SYCL_NATIVE_CPU_PLUGIN_NAME "libpi_native_cpu.dylib"
103 #error "Unsupported OS"
107 [[noreturn]] __SYCL_EXPORT
void die(
const char *Message);
109 __SYCL_EXPORT
void assertion(
bool Condition,
const char *Message =
nullptr);
111 template <
typename T>
113 std::stringstream stream;
114 stream <<
"Unknown parameter " << parameter <<
" passed to " << functionName
116 auto str = stream.str();
117 auto msg = str.c_str();
124 #define __SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME(parameter) \
125 { sycl::detail::pi::handleUnknownParamName(__func__, parameter); }
200 template <
class To,
class From> To
cast(From value);
217 #define _PI_API(api) \
218 template <> struct PiFuncInfo<PiApiKind::api> { \
219 using FuncPtrT = decltype(&::api); \
220 inline const char *getFuncName() { return #api; } \
221 inline FuncPtrT getFuncPtr(PiPlugin MPlugin) { \
222 return MPlugin.PiFunctionTable.api; \
225 #include <sycl/detail/pi.def>
246 unsigned char *ArgsData,
259 const char *FName,
unsigned char *ArgsData,
277 template <
class To,
class From>
inline To
cast(From value) {
280 "assert: cast failed size check");
290 template <
class To,
class FromE> To
cast(std::vector<FromE> Values) {
293 ResultVec.reserve(Values.size());
294 for (FromE &Val : Values)
295 ResultVec.push_back(cast<typename To::value_type>(Val));
::pi_sampler_properties PiSamplerProperties
::pi_queue_properties PiQueueProperties
void contextSetExtendedDeleter(const sycl::context &constext, pi_context_extended_deleter func, void *user_data)
::pi_device_binary_type PiDeviceBinaryType
_pi_device_info pi_device_info
const PluginPtr & getPlugin()
_pi_image_desc pi_image_desc
void * loadOsLibrary(const std::string &Library)
std::vector< PluginPtr > & initialize()
void handleUnknownParamName(const char *functionName, T parameter)
::pi_image_handle PiImageHandle
_pi_image_info pi_image_info
::pi_interop_semaphore_handle PiInteropSemaphoreHandle
_pi_image_copy_flags pi_image_copy_flags
_pi_kernel_cache_config pi_kernel_cache_config
---— Error handling, matching OpenCL plugin semantics.
int unloadOsPluginLibrary(void *Library)
uint64_t emitFunctionWithArgsBeginTrace(uint32_t FuncID, const char *FName, unsigned char *ArgsData, pi_plugin Plugin)
Notifies XPTI subscribers about PI function calls and packs call arguments.
_pi_context_info pi_context_info
_pi_sampler_addressing_mode
int unloadPlugin(void *Library)
_pi_peer_attr pi_peer_attr
_pi_image_channel_order pi_image_channel_order
int unloadOsLibrary(void *Library)
uint64_t emitFunctionBeginTrace(const char *FName)
Emits an XPTI trace before a PI API call is made.
uint8_t pi_device_binary_type
Types of device binary.
_pi_image_format pi_image_format
pi_uint64 pi_interop_mem_handle
_pi_platform_backend pi_platform_backend
_pi_platform * pi_platform
void(* pi_context_extended_deleter)(void *user_data)
std::string platformInfoToString(pi_platform_info info)
::pi_ext_sync_point PiExtSyncPoint
::pi_mem_flags PiMemFlags
pi_uint32 pi_ext_sync_point
_pi_sampler_info pi_sampler_info
PiProgram cast(cl_program)=delete
pi_bitfield pi_sampler_properties
void die(const char *Message)
void * pi_image_mem_handle
pi_uint64 pi_image_handle
void * loadOsPluginLibrary(const std::string &Library)
PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData, size_t ImgSize)
Tries to determine the device binary image foramat.
pi_bitfield pi_queue_properties
void * getOsLibraryFuncAddress(void *Library, const std::string &FunctionName)
std::shared_ptr< plugin > GlobalPlugin
_pi_sampler_addressing_mode pi_sampler_addressing_mode
::pi_interop_mem_handle PiInteropMemHandle
void assertion(bool Condition, const char *Message=nullptr)
_pi_device_type pi_device_type
::pi_image_mem_handle PiImageMemHandle
_pi_sampler_filter_mode pi_sampler_filter_mode
void emitFunctionEndTrace(uint64_t CorrelationID, const char *FName)
Emits an XPTI trace after the PI API call has been made.
pi_uint64 pi_interop_semaphore_handle
void * getPluginOpaqueData(void *opaquedata_arg)
bool trace(TraceLevel level)
_pi_image_channel_type pi_image_channel_type
_pi_ext_command_buffer * pi_ext_command_buffer
void emitFunctionWithArgsEndTrace(uint64_t CorrelationID, uint32_t FuncID, const char *FName, unsigned char *ArgsData, pi_result Result, pi_plugin Plugin)
Notifies XPTI subscribers about PI function call result.
The context class represents a SYCL context on which kernel functions may be executed.
std::shared_ptr< plugin > PluginPtr