DPC++ Runtime
Runtime libraries for oneAPI DPC++
|
|
Go to the documentation of this file.
28 #ifdef XPTI_ENABLE_INSTRUMENTATION
31 struct trace_event_data_t;
43 #define _PI_API(api) api,
44 #include <sycl/detail/pi.def>
48 template <sycl::backend BE>
64 #ifdef __SYCL_RT_OS_WINDOWS
68 #define __SYCL_OPENCL_PLUGIN_NAME "pi_opencl.dll"
69 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "pi_level_zero.dll"
70 #define __SYCL_CUDA_PLUGIN_NAME "pi_cuda.dll"
71 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "pi_esimd_emulator.dll"
72 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dll"
73 #define __SYCL_UNIFIED_RUNTIME_PLUGIN_NAME "pi_unified_runtime.dll"
75 #define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.dll"
76 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.dll"
77 #define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.dll"
78 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.dll"
79 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dll"
80 #define __SYCL_UNIFIED_RUNTIME_PLUGIN_NAME "libpi_unified_runtime.dll"
82 #elif defined(__SYCL_RT_OS_LINUX)
83 #define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.so"
84 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.so"
85 #define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.so"
86 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.so"
87 #define __SYCL_UNIFIED_RUNTIME_PLUGIN_NAME "libpi_unified_runtime.so"
88 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.so"
89 #elif defined(__SYCL_RT_OS_DARWIN)
90 #define __SYCL_OPENCL_PLUGIN_NAME "libpi_opencl.dylib"
91 #define __SYCL_LEVEL_ZERO_PLUGIN_NAME "libpi_level_zero.dylib"
92 #define __SYCL_CUDA_PLUGIN_NAME "libpi_cuda.dylib"
93 #define __SYCL_ESIMD_EMULATOR_PLUGIN_NAME "libpi_esimd_emulator.dylib"
94 #define __SYCL_HIP_PLUGIN_NAME "libpi_hip.dylib"
95 #define __SYCL_UNIFIED_RUNTIME_PLUGIN_NAME "libpi_unified_runtime.dylib"
97 #error "Unsupported OS"
101 [[noreturn]] __SYCL_EXPORT
void die(
const char *Message);
103 __SYCL_EXPORT
void assertion(
bool Condition,
const char *Message =
nullptr);
105 template <
typename T>
107 std::stringstream stream;
108 stream <<
"Unknown parameter " << parameter <<
" passed to " << functionName
110 auto str = stream.str();
111 auto msg = str.c_str();
118 #define __SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME(parameter) \
119 { sycl::detail::pi::handleUnknownParamName(__func__, parameter); }
173 template <
class To,
class From> To
cast(From value);
190 #define _PI_API(api) \
191 template <> struct PiFuncInfo<PiApiKind::api> { \
192 using FuncPtrT = decltype(&::api); \
193 inline const char *getFuncName() { return #api; } \
194 inline FuncPtrT getFuncPtr(PiPlugin MPlugin) { \
195 return MPlugin.PiFunctionTable.api; \
198 #include <sycl/detail/pi.def>
219 unsigned char *ArgsData,
232 const char *FName,
unsigned char *ArgsData,
242 namespace RT = sycl::detail::pi;
252 template <
class To,
class From>
inline To
cast(From value) {
254 RT::assertion((
sizeof(From) ==
sizeof(To)),
"assert: cast failed size check");
264 template <
class To,
class FromE> To
cast(std::vector<FromE> Values) {
267 ResultVec.reserve(Values.size());
268 for (FromE &Val : Values)
269 ResultVec.push_back(cast<typename To::value_type>(Val));
277 namespace RT = sycl::detail::pi;
PI Mem mapping to CUDA memory allocations, both data and texture/surface.
::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
_pi_image_desc pi_image_desc
#define __SYCL_INLINE_VER_NAMESPACE(X)
void handleUnknownParamName(const char *functionName, T parameter)
_pi_image_info pi_image_info
_pi_kernel_cache_config pi_kernel_cache_config
int unloadOsPluginLibrary(void *Library)
---— Error handling, matching OpenCL plugin semantics.
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
Implementation of a PI Kernel for CUDA.
int unloadPlugin(void *Library)
const plugin & getPlugin()
_pi_image_channel_order pi_image_channel_order
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 queue mapping on to CUstream objects.
The plugin class provides a unified interface to the underlying low-level runtimes for the device-agn...
_pi_image_format pi_image_format
PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData, size_t ImgSize)
Tries to determine the device binary image foramat.
_pi_platform * pi_platform
void(* pi_context_extended_deleter)(void *user_data)
std::string platformInfoToString(pi_platform_info info)
::pi_mem_flags PiMemFlags
_pi_sampler_info pi_sampler_info
Implementation of PI Program on CUDA Module object.
Implementation of samplers for CUDA.
pi_bitfield pi_sampler_properties
std::vector< plugin > & initialize()
void die(const char *Message)
void * loadOsPluginLibrary(const std::string &Library)
pi_bitfield pi_queue_properties
void * getOsLibraryFuncAddress(void *Library, const std::string &FunctionName)
PI Event mapping to CUevent.
std::shared_ptr< plugin > GlobalPlugin
_pi_sampler_addressing_mode pi_sampler_addressing_mode
void assertion(bool Condition, const char *Message=nullptr)
_pi_device_type pi_device_type
_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.
void * getPluginOpaqueData(void *opaquedata_arg)
bool trace(TraceLevel level)
_pi_image_channel_type pi_image_channel_type
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.
PI context mapping to a CUDA context object.
PI device mapping to a CUdevice.