DPC++ Runtime
Runtime libraries for oneAPI DPC++
pi_hip.cpp File Reference
#include <pi_hip.hpp>
#include <sycl/detail/defines.hpp>
#include <sycl/detail/hip_definitions.hpp>
#include <sycl/detail/pi.hpp>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <hip/hip_runtime.h>
#include <limits>
#include <memory>
#include <mutex>
#include <regex>
#include <string.h>
#include <string_view>
Include dependency graph for pi_hip.cpp:

Go to the source code of this file.

Classes

class  ReleaseGuard< T >
 RAII object that calls the reference count release function on the held PI object on destruction. More...
 

Namespaces

 sycl
 ---— Error handling, matching OpenCL plugin semantics.
 
 sycl::_V1
 
 sycl::_V1::detail
 
 sycl::_V1::detail::pi
 

Macros

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

Functions

void sycl::_V1::detail::pi::die (const char *Message)
 
void sycl::_V1::detail::pi::hipPrint (const char *Message)
 
void sycl::_V1::detail::pi::assertion (bool Condition, const char *Message=nullptr)
 
pi_result hip_piEnqueueEventsWait (pi_queue command_queue, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 Enqueues a wait on the given queue for all events. More...
 
pi_result hip_piEnqueueEventsWaitWithBarrier (pi_queue command_queue, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 Enqueues a wait on the given queue for all specified events. More...
 
pi_result hip_piEventRelease (pi_event event)
 
pi_result hip_piEventRetain (pi_event event)
 
pi_result enqueueEventWait (pi_queue queue, pi_event event)
 
std::string getKernelNames (pi_program program)
 Finds kernel names by searching for entry points in the PTX source, as the HIP driver API doesn't expose an operation for this. More...
 
pi_result hip_piPlatformsGet (pi_uint32 num_entries, pi_platform *platforms, pi_uint32 *num_platforms)
 Obtains the HIP platform. More...
 
pi_result hip_piPlatformGetInfo ([[maybe_unused]] pi_platform platform, pi_platform_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_piDevicesGet (pi_platform platform, pi_device_type device_type, pi_uint32 num_entries, pi_device *devices, pi_uint32 *num_devices)
 
pi_result hip_piDeviceRetain (pi_device device)
 
pi_result hip_piContextGetInfo (pi_context context, pi_context_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_piContextRetain (pi_context context)
 
pi_result hip_piextContextSetExtendedDeleter (pi_context context, pi_context_extended_deleter function, void *user_data)
 
pi_result hip_piDevicePartition (pi_device device, const pi_device_partition_property *properties, pi_uint32 num_devices, pi_device *out_devices, pi_uint32 *out_num_devices)
 Not applicable to HIP, devices cannot be partitioned. More...
 
pi_result hip_piextDeviceSelectBinary (pi_device device, pi_device_binary *binaries, pi_uint32 num_binaries, pi_uint32 *selected_binary)
 
pi_result hip_piextGetDeviceFunctionPointer ([[maybe_unused]] pi_device device, pi_program program, const char *func_name, pi_uint64 *func_pointer_ret)
 
pi_result hip_piDeviceRelease (pi_device device)
 
pi_result hip_piDeviceGetInfo (pi_device device, pi_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_piextDeviceGetNativeHandle (pi_device device, pi_native_handle *nativeHandle)
 Gets the native HIP handle of a PI device object. More...
 
pi_result hip_piextDeviceCreateWithNativeHandle (pi_native_handle nativeHandle, pi_platform platform, pi_device *device)
 Created a PI device object from a HIP device handle. More...
 
pi_result hip_piContextCreate (const pi_context_properties *properties, [[maybe_unused]] pi_uint32 num_devices, const pi_device *devices, [[maybe_unused]] void(*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, [[maybe_unused]] void *user_data), [[maybe_unused]] void *user_data, pi_context *retcontext)
 Create a PI HIP context. More...
 
pi_result hip_piContextRelease (pi_context ctxt)
 
pi_result hip_piextContextGetNativeHandle (pi_context context, pi_native_handle *nativeHandle)
 Gets the native HIP handle of a PI context object. More...
 
pi_result hip_piextContextCreateWithNativeHandle (pi_native_handle nativeHandle, pi_uint32 num_devices, const pi_device *devices, bool ownNativeHandle, pi_context *context)
 Created a PI context object from a HIP context handle. More...
 
pi_result hip_piMemBufferCreate (pi_context context, pi_mem_flags flags, size_t size, void *host_ptr, pi_mem *ret_mem, [[maybe_unused]] const pi_mem_properties *properties)
 Creates a PI Memory object using a HIP memory allocation. More...
 
pi_result hip_piMemRelease (pi_mem memObj)
 Decreases the reference count of the Mem object. More...
 
pi_result hip_piMemBufferPartition (pi_mem parent_buffer, pi_mem_flags flags, [[maybe_unused]] pi_buffer_create_type buffer_create_type, void *buffer_create_info, pi_mem *memObj)
 Implements a buffer partition in the HIP backend. More...
 
pi_result hip_piMemGetInfo (pi_mem memObj, pi_mem_info queriedInfo, size_t expectedQuerySize, void *queryOutput, size_t *writtenQuerySize)
 
pi_result hip_piextMemGetNativeHandle (pi_mem mem, pi_native_handle *nativeHandle)
 Gets the native HIP handle of a PI mem object. More...
 
pi_result hip_piextMemCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle, pi_mem *mem)
 Created a PI mem object from a HIP mem handle. More...
 
pi_result hip_piextMemImageCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle, const pi_image_format *ImageFormat, const pi_image_desc *ImageDesc, pi_mem *mem)
 Created a PI image mem object from a HIP image mem handle. More...
 
pi_result hip_piQueueCreate (pi_context context, pi_device device, pi_queue_properties properties, pi_queue *queue)
 Creates a pi_queue object on the HIP backend. More...
 
pi_result hip_piextQueueCreate (pi_context Context, pi_device Device, pi_queue_properties *Properties, pi_queue *Queue)
 
pi_result hip_piQueueGetInfo (pi_queue command_queue, pi_queue_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_piQueueRetain (pi_queue command_queue)
 
pi_result hip_piQueueRelease (pi_queue command_queue)
 
pi_result hip_piQueueFinish (pi_queue command_queue)
 
pi_result hip_piQueueFlush (pi_queue command_queue)
 
pi_result hip_piextQueueGetNativeHandle (pi_queue queue, pi_native_handle *nativeHandle, int32_t *NativeHandleDesc)
 Gets the native HIP handle of a PI queue object. More...
 
pi_result hip_piextQueueCreateWithNativeHandle (pi_native_handle nativeHandle, int32_t NativeHandleDesc, pi_context context, pi_device device, bool ownNativeHandle, pi_queue_properties *Properties, pi_queue *queue)
 Created a PI queue object from a HIP queue handle. More...
 
pi_result hip_piEnqueueMemBufferWrite (pi_queue command_queue, pi_mem buffer, pi_bool blocking_write, size_t offset, size_t size, void *ptr, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_piEnqueueMemBufferRead (pi_queue command_queue, pi_mem buffer, pi_bool blocking_read, size_t offset, size_t size, void *ptr, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_piEventsWait (pi_uint32 num_events, const pi_event *event_list)
 
pi_result hip_piKernelCreate (pi_program program, const char *kernel_name, pi_kernel *kernel)
 
pi_result hip_piKernelSetArg (pi_kernel kernel, pi_uint32 arg_index, size_t arg_size, const void *arg_value)
 
pi_result hip_piextKernelSetArgMemObj (pi_kernel kernel, pi_uint32 arg_index, const pi_mem *arg_value)
 
pi_result hip_piextKernelSetArgSampler (pi_kernel kernel, pi_uint32 arg_index, const pi_sampler *arg_value)
 
pi_result hip_piEnqueueKernelLaunch (pi_queue command_queue, pi_kernel kernel, pi_uint32 work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_piEnqueueNativeKernel (pi_queue queue, void(*user_func)(void *), 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)
 \TODO Not implemented More...
 
pi_result hip_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)
 \TODO Not implemented More...
 
pi_result hip_piMemImageGetInfo (pi_mem image, pi_image_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 \TODO Not implemented More...
 
pi_result hip_piMemRetain (pi_mem mem)
 
pi_result hip_piclProgramCreateWithSource (pi_context context, pi_uint32 count, const char **strings, const size_t *lengths, pi_program *program)
 Not used as HIP backend only creates programs from binary. More...
 
pi_result hip_piProgramBuild (pi_program program, [[maybe_unused]] pi_uint32 num_devices, [[maybe_unused]] const pi_device *device_list, const char *options, [[maybe_unused]] void(*pfn_notify)(pi_program program, void *user_data), [[maybe_unused]] void *user_data)
 Loads the images from a PI program into a HIPmodule that can be used later on to extract functions (kernels). More...
 
pi_result hip_piProgramCreate (pi_context context, const void *il, size_t length, pi_program *res_program)
 \TODO Not implemented More...
 
pi_result hip_piProgramCreateWithBinary (pi_context context, [[maybe_unused]] pi_uint32 num_devices, [[maybe_unused]] 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 *program)
 Loads images from a list of PTX or HIPBIN binaries. More...
 
pi_result hip_piProgramGetInfo (pi_program program, pi_program_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_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 hip_piProgramCompile (pi_program program, [[maybe_unused]] pi_uint32 num_devices, [[maybe_unused]] const pi_device *device_list, const char *options, [[maybe_unused]] pi_uint32 num_input_headers, const pi_program *input_headers, const char **header_include_names, [[maybe_unused]] void(*pfn_notify)(pi_program program, void *user_data), [[maybe_unused]] void *user_data)
 Creates a new program that is the outcome of the compilation of the headers and the program. More...
 
pi_result hip_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)
 
pi_result hip_piProgramRetain (pi_program program)
 
pi_result hip_piProgramRelease (pi_program program)
 Decreases the reference count of a pi_program object. More...
 
pi_result hip_piextProgramGetNativeHandle (pi_program program, pi_native_handle *nativeHandle)
 Gets the native HIP handle of a PI program object. More...
 
pi_result hip_piextProgramCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle, pi_program *program)
 Created a PI program object from a HIP program handle. More...
 
pi_result hip_piKernelGetInfo (pi_kernel kernel, pi_kernel_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_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 hip_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)
 
pi_result hip_piKernelRetain (pi_kernel kernel)
 
pi_result hip_piKernelRelease (pi_kernel kernel)
 
pi_result hip_piKernelSetExecInfo (pi_kernel kernel, pi_kernel_exec_info param_name, size_t param_value_size, const void *param_value)
 
pi_result hip_piextProgramSetSpecializationConstant (pi_program, pi_uint32, size_t, const void *)
 
pi_result hip_piextKernelSetArgPointer (pi_kernel kernel, pi_uint32 arg_index, size_t arg_size, const void *arg_value)
 
pi_result hip_piEventCreate (pi_context context, pi_event *event)
 
pi_result hip_piEventGetInfo (pi_event event, pi_event_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 
pi_result hip_piEventGetProfilingInfo (pi_event event, pi_profiling_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 Obtain profiling information from PI HIP events Timings from HIP are only elapsed time. More...
 
pi_result hip_piEventSetCallback (pi_event event, pi_int32 command_exec_callback_type, pfn_notify notify, void *user_data)
 
pi_result hip_piEventSetStatus (pi_event event, pi_int32 execution_status)
 
pi_result hip_piextEventGetNativeHandle (pi_event event, pi_native_handle *nativeHandle)
 Gets the native HIP handle of a PI event object. More...
 
pi_result hip_piextEventCreateWithNativeHandle (pi_native_handle nativeHandle, pi_context context, bool ownNativeHandle, pi_event *event)
 Created a PI event object from a HIP event handle. More...
 
pi_result hip_piSamplerCreate (pi_context context, const pi_sampler_properties *sampler_properties, pi_sampler *result_sampler)
 Creates a PI sampler object. More...
 
pi_result hip_piSamplerGetInfo (pi_sampler sampler, pi_sampler_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
 Gets information from a PI sampler object. More...
 
pi_result hip_piSamplerRetain (pi_sampler sampler)
 Retains a PI sampler object, incrementing its reference count. More...
 
pi_result hip_piSamplerRelease (pi_sampler sampler)
 Releases a PI sampler object, decrementing its reference count. More...
 
static pi_result commonEnqueueMemBufferCopyRect (hipStream_t hip_stream, pi_buff_rect_region region, const void *src_ptr, const hipMemoryType src_type, pi_buff_rect_offset src_offset, size_t src_row_pitch, size_t src_slice_pitch, void *dst_ptr, const hipMemoryType dst_type, pi_buff_rect_offset dst_offset, size_t dst_row_pitch, size_t dst_slice_pitch)
 General 3D memory copy operation. More...
 
pi_result hip_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)
 
pi_result hip_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)
 
pi_result hip_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)
 
pi_result hip_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)
 
pi_result hip_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)
 
static size_t imageElementByteSize (hipArray_Format array_format)
 
static pi_result commonEnqueueMemImageNDCopy (hipStream_t hip_stream, pi_mem_type img_type, const size_t *region, const void *src_ptr, const hipMemoryType src_type, const size_t *src_offset, void *dst_ptr, const hipMemoryType dst_type, const size_t *dst_offset)
 General ND memory copy operation for images (where N > 1). More...
 
pi_result hip_piEnqueueMemImageRead (pi_queue command_queue, pi_mem image, pi_bool blocking_read, const size_t *origin, const size_t *region, size_t row_pitch, size_t slice_pitch, void *ptr, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_piEnqueueMemImageWrite (pi_queue command_queue, pi_mem image, pi_bool blocking_write, const size_t *origin, const size_t *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)
 
pi_result hip_piEnqueueMemImageCopy (pi_queue command_queue, pi_mem src_image, pi_mem dst_image, const size_t *src_origin, const size_t *dst_origin, const size_t *region, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_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)
 \TODO Not implemented in HIP. More...
 
pi_result hip_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)
 Implements mapping on the host using a BufferRead operation. More...
 
pi_result hip_piEnqueueMemUnmap (pi_queue command_queue, pi_mem memobj, void *mapped_ptr, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 Implements the unmap from the host, using a BufferWrite operation. More...
 
pi_result hip_piextUSMHostAlloc (void **result_ptr, pi_context context, [[maybe_unused]] pi_usm_mem_properties *properties, size_t size, [[maybe_unused]] pi_uint32 alignment)
 USM: Implements USM Host allocations using HIP Pinned Memory. More...
 
pi_result hip_piextUSMDeviceAlloc (void **result_ptr, pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_usm_mem_properties *properties, size_t size, [[maybe_unused]] pi_uint32 alignment)
 USM: Implements USM device allocations using a normal HIP device pointer. More...
 
pi_result hip_piextUSMSharedAlloc (void **result_ptr, pi_context context, [[maybe_unused]] pi_device device, [[maybe_unused]] pi_usm_mem_properties *properties, size_t size, [[maybe_unused]] pi_uint32 alignment)
 USM: Implements USM Shared allocations using HIP Managed Memory. More...
 
pi_result hip_piextUSMFree (pi_context context, void *ptr)
 USM: Frees the given USM pointer associated with the context. More...
 
pi_result hip_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)
 
pi_result hip_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)
 
pi_result hip_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)
 
pi_result hip_piextUSMEnqueueMemAdvise (pi_queue queue, [[maybe_unused]] const void *ptr, size_t length, pi_mem_advice advice, pi_event *event)
 USM: memadvise API to govern behavior of automatic migration mechanisms. More...
 
pi_result hip_piextUSMEnqueueFill2D (pi_queue, void *, size_t, size_t, const void *, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
 
pi_result hip_piextUSMEnqueueMemset2D (pi_queue, void *, size_t, int, size_t, size_t, pi_uint32, const pi_event *, pi_event *)
 
pi_result hip_piextUSMEnqueueMemcpy2D (pi_queue queue, pi_bool blocking, void *dst_ptr, size_t dst_pitch, const void *src_ptr, size_t src_pitch, size_t width, size_t height, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 2D Memcpy API More...
 
pi_result hip_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 hip_piextEnqueueDeviceGlobalVariableWrite (pi_queue queue, pi_program program, const char *name, pi_bool blocking_write, size_t count, size_t offset, const void *src, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_piextEnqueueDeviceGlobalVariableRead (pi_queue queue, pi_program program, const char *name, pi_bool blocking_read, size_t count, size_t offset, void *dst, pi_uint32 num_events_in_wait_list, const pi_event *event_wait_list, pi_event *event)
 
pi_result hip_piextEnqueueReadHostPipe (pi_queue queue, pi_program program, const char *pipe_symbol, pi_bool blocking, void *ptr, size_t size, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
 Host Pipes. More...
 
pi_result hip_piextEnqueueWriteHostPipe (pi_queue queue, pi_program program, const char *pipe_symbol, pi_bool blocking, void *ptr, size_t size, pi_uint32 num_events_in_waitlist, const pi_event *events_waitlist, pi_event *event)
 
pi_result hip_piTearDown (void *PluginParameter)
 
pi_result hip_piGetDeviceAndHostTimer (pi_device Device, uint64_t *DeviceTime, uint64_t *HostTime)
 
pi_result piPluginInit (pi_plugin *PluginInit)
 

Variables

const char SupportedVersion [] = _PI_HIP_PLUGIN_VERSION_STRING
 

Detailed Description

Implementation of HIP Plugin.

Definition in file pi_hip.cpp.

Macro Definition Documentation

◆ _PI_CL

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

Function Documentation

◆ commonEnqueueMemBufferCopyRect()

static pi_result commonEnqueueMemBufferCopyRect ( hipStream_t  hip_stream,
pi_buff_rect_region  region,
const void *  src_ptr,
const hipMemoryType  src_type,
pi_buff_rect_offset  src_offset,
size_t  src_row_pitch,
size_t  src_slice_pitch,
void *  dst_ptr,
const hipMemoryType  dst_type,
pi_buff_rect_offset  dst_offset,
size_t  dst_row_pitch,
size_t  dst_slice_pitch 
)
static

General 3D memory copy operation.

This function requires the corresponding HIP context to be at the top of the context stack If the source and/or destination is on the device, src_ptr and/or dst_ptr must be a pointer to a hipDevPtr

Definition at line 4303 of file pi_hip.cpp.

References pi_buff_rect_region_struct::depth_scalar, pi_buff_rect_region_struct::height_scalar, pi_buff_rect_region_struct::width_bytes, pi_buff_rect_offset_struct::x_bytes, pi_buff_rect_offset_struct::y_scalar, and pi_buff_rect_offset_struct::z_scalar.

Referenced by hip_piEnqueueMemBufferCopyRect(), hip_piEnqueueMemBufferReadRect(), and hip_piEnqueueMemBufferWriteRect().

◆ commonEnqueueMemImageNDCopy()

static pi_result commonEnqueueMemImageNDCopy ( hipStream_t  hip_stream,
pi_mem_type  img_type,
const size_t *  region,
const void *  src_ptr,
const hipMemoryType  src_type,
const size_t *  src_offset,
void *  dst_ptr,
const hipMemoryType  dst_type,
const size_t *  dst_offset 
)
static

General ND memory copy operation for images (where N > 1).

This function requires the corresponding HIP context to be at the top of the context stack If the source and/or destination is an array, src_ptr and/or dst_ptr must be a pointer to a hipArray

Definition at line 4687 of file pi_hip.cpp.

References PI_MEM_TYPE_IMAGE2D, and PI_MEM_TYPE_IMAGE3D.

Referenced by hip_piEnqueueMemImageCopy(), hip_piEnqueueMemImageRead(), and hip_piEnqueueMemImageWrite().

◆ enqueueEventWait()

pi_result enqueueEventWait ( pi_queue  queue,
pi_event  event 
)

Definition at line 696 of file pi_hip.cpp.

References _pi_queue::for_each_stream().

◆ getKernelNames()

std::string getKernelNames ( pi_program  program)

Finds kernel names by searching for entry points in the PTX source, as the HIP driver API doesn't expose an operation for this.

Note: This is currently only being used by the SYCL program class for the has_kernel method, so an alternative would be to move the has_kernel query to PI and use hipModuleGetFunction to check for a kernel.

Definition at line 762 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by hip_piProgramGetInfo().

◆ hip_piclProgramCreateWithSource()

pi_result hip_piclProgramCreateWithSource ( pi_context  context,
pi_uint32  count,
const char **  strings,
const size_t *  lengths,
pi_program program 
)

Not used as HIP backend only creates programs from binary.

See hip_piclProgramCreateWithBinary.

Definition at line 3364 of file pi_hip.cpp.

References sycl::_V1::detail::pi::hipPrint().

Referenced by piPluginInit().

◆ hip_piContextCreate()

pi_result hip_piContextCreate ( const pi_context_properties properties,
[[maybe_unused] ] pi_uint32  num_devices,
const pi_device devices,
[[maybe_unused] ] void(*)(const char *errinfo, const void *private_info, size_t cb, [[maybe_unused]] void *user_data)  pfn_notify,
[[maybe_unused] ] void *  user_data,
pi_context retcontext 
)

Create a PI HIP context.

By default creates a scoped context and keeps the last active HIP context on top of the HIP context stack. With the __SYCL_PI_CONTEXT_PROPERTIES_HIP_PRIMARY key/id and a value of PI_TRUE creates a primary HIP context and activates it on the HIP context stack.

Parameters
[in]properties0 terminated array of key/id-value combinations. Can be nullptr. Only accepts property key/id __SYCL_PI_CONTEXT_PROPERTIES_HIP_PRIMARY with a pi_bool value.
[in]num_devicesNumber of devices to create the context for.
[in]devicesDevices to create the context for.
[in]pfn_notifyCallback, currently unused.
[in]user_dataUser data for callback.
[out]retcontextSet to created context on success.
Returns
PI_SUCCESS on success, otherwise an error return code.

Definition at line 2077 of file pi_hip.cpp.

References __SYCL_PI_CONTEXT_PROPERTIES_HIP_PRIMARY, sycl::_V1::detail::pi::die(), _pi_platform::evBase_, std::get(), PI_FALSE, PI_TRUE, _pi_context::primary, and _pi_context::user_defined.

Referenced by piPluginInit().

◆ hip_piContextGetInfo()

◆ hip_piContextRelease()

◆ hip_piContextRetain()

pi_result hip_piContextRetain ( pi_context  context)

◆ hip_piDeviceGetInfo()

pi_result hip_piDeviceGetInfo ( pi_device  device,
pi_device_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

Definition at line 1145 of file pi_hip.cpp.

References __SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME, sycl::_V1::detail::pi::assertion(), sycl::_V1::detail::pi::die(), getInfo(), getInfoArray(), min(), PI_DEVICE_EXEC_CAPABILITIES_KERNEL, PI_DEVICE_INFO_ADDRESS_BITS, PI_DEVICE_INFO_ATOMIC_64, PI_DEVICE_INFO_AVAILABLE, PI_DEVICE_INFO_BACKEND_VERSION, PI_DEVICE_INFO_BUILD_ON_SUBDEVICE, PI_DEVICE_INFO_BUILT_IN_KERNELS, PI_DEVICE_INFO_COMPILER_AVAILABLE, PI_DEVICE_INFO_DEVICE_ID, PI_DEVICE_INFO_DOUBLE_FP_CONFIG, PI_DEVICE_INFO_DRIVER_VERSION, PI_DEVICE_INFO_ENDIAN_LITTLE, PI_DEVICE_INFO_ERROR_CORRECTION_SUPPORT, PI_DEVICE_INFO_EXECUTION_CAPABILITIES, PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT, PI_DEVICE_INFO_EXTENSIONS, PI_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE, PI_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE, PI_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE, PI_DEVICE_INFO_GLOBAL_MEM_SIZE, 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_HALF_FP_CONFIG, PI_DEVICE_INFO_HOST_UNIFIED_MEMORY, PI_DEVICE_INFO_IMAGE2D_MAX_HEIGHT, PI_DEVICE_INFO_IMAGE2D_MAX_WIDTH, PI_DEVICE_INFO_IMAGE3D_MAX_DEPTH, PI_DEVICE_INFO_IMAGE3D_MAX_HEIGHT, PI_DEVICE_INFO_IMAGE3D_MAX_WIDTH, PI_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE, PI_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE, PI_DEVICE_INFO_IMAGE_SRGB, PI_DEVICE_INFO_IMAGE_SUPPORT, PI_DEVICE_INFO_LINKER_AVAILABLE, PI_DEVICE_INFO_LOCAL_MEM_SIZE, PI_DEVICE_INFO_LOCAL_MEM_TYPE, PI_DEVICE_INFO_MAX_CLOCK_FREQUENCY, PI_DEVICE_INFO_MAX_COMPUTE_UNITS, PI_DEVICE_INFO_MAX_CONSTANT_ARGS, PI_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE, PI_DEVICE_INFO_MAX_MEM_ALLOC_SIZE, PI_DEVICE_INFO_MAX_MEM_BANDWIDTH, PI_DEVICE_INFO_MAX_NUM_SUB_GROUPS, PI_DEVICE_INFO_MAX_PARAMETER_SIZE, PI_DEVICE_INFO_MAX_READ_IMAGE_ARGS, PI_DEVICE_INFO_MAX_SAMPLERS, PI_DEVICE_INFO_MAX_WORK_GROUP_SIZE, PI_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS, PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, PI_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS, PI_DEVICE_INFO_MEM_BASE_ADDR_ALIGN, PI_DEVICE_INFO_NAME, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG, PI_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT, PI_DEVICE_INFO_OPENCL_C_VERSION, PI_DEVICE_INFO_PARENT_DEVICE, PI_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN, PI_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES, PI_DEVICE_INFO_PARTITION_PROPERTIES, PI_DEVICE_INFO_PARTITION_TYPE, PI_DEVICE_INFO_PCI_ADDRESS, PI_DEVICE_INFO_PLATFORM, PI_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG, PI_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT, PI_DEVICE_INFO_PRINTF_BUFFER_SIZE, PI_DEVICE_INFO_PROFILE, PI_DEVICE_INFO_PROFILING_TIMER_RESOLUTION, PI_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES, PI_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES, PI_DEVICE_INFO_REFERENCE_COUNT, PI_DEVICE_INFO_SINGLE_FP_CONFIG, PI_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS, PI_DEVICE_INFO_SUB_GROUP_SIZES_INTEL, PI_DEVICE_INFO_TYPE, PI_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT, PI_DEVICE_INFO_USM_DEVICE_SUPPORT, PI_DEVICE_INFO_USM_HOST_SUPPORT, PI_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT, PI_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT, PI_DEVICE_INFO_UUID, PI_DEVICE_INFO_VENDOR, PI_DEVICE_INFO_VENDOR_ID, PI_DEVICE_INFO_VERSION, PI_DEVICE_LOCAL_MEM_TYPE_LOCAL, PI_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE, PI_DEVICE_TYPE_GPU, PI_EXT_CODEPLAY_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP, PI_EXT_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES, PI_EXT_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES, PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES, PI_EXT_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES, PI_EXT_INTEL_DEVICE_INFO_FREE_MEMORY, PI_EXT_INTEL_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES, PI_EXT_INTEL_DEVICE_INFO_MEM_CHANNEL_SUPPORT, PI_EXT_INTEL_DEVICE_INFO_MEMORY_BUS_WIDTH, PI_EXT_INTEL_DEVICE_INFO_MEMORY_CLOCK_RATE, PI_EXT_ONEAPI_DEVICE_INFO_BFLOAT16_MATH_FUNCTIONS, PI_EXT_ONEAPI_DEVICE_INFO_CUDA_ASYNC_BARRIER, PI_EXT_ONEAPI_DEVICE_INFO_MAX_WORK_GROUPS_3D, PI_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT, PI_FP_DENORM, PI_FP_FMA, PI_FP_INF_NAN, PI_FP_ROUND_TO_INF, PI_FP_ROUND_TO_NEAREST, PI_FP_ROUND_TO_ZERO, PI_MEMORY_ORDER_ACQ_REL, PI_MEMORY_ORDER_ACQUIRE, PI_MEMORY_ORDER_RELAXED, PI_MEMORY_ORDER_RELEASE, PI_MEMORY_SCOPE_SUB_GROUP, PI_MEMORY_SCOPE_WORK_GROUP, PI_MEMORY_SCOPE_WORK_ITEM, PI_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE, PI_QUEUE_FLAG_PROFILING_ENABLE, PI_TRUE, PI_USM_ACCESS, PI_USM_ATOMIC_ACCESS, PI_USM_CONCURRENT_ACCESS, PI_USM_CONCURRENT_ATOMIC_ACCESS, and setErrorMessage().

Referenced by hip_piEnqueueKernelLaunch(), and piPluginInit().

◆ hip_piDevicePartition()

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

Not applicable to HIP, devices cannot be partitioned.

Definition at line 1067 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piDeviceRelease()

pi_result hip_piDeviceRelease ( pi_device  device)
Returns
PI_SUCCESS always since HIP devices are always root devices.

Definition at line 1140 of file pi_hip.cpp.

Referenced by piPluginInit(), _pi_context::~_pi_context(), and _pi_queue::~_pi_queue().

◆ hip_piDeviceRetain()

pi_result hip_piDeviceRetain ( pi_device  device)
Returns
PI_SUCCESS if the function is exehipted successfully HIP devices are always root devices so retain always returns success.

Definition at line 1008 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piDevicesGet()

pi_result hip_piDevicesGet ( pi_platform  platform,
pi_device_type  device_type,
pi_uint32  num_entries,
pi_device devices,
pi_uint32 num_devices 
)
Parameters
devicesList of devices available on the system
num_devicesNumber of elements in the list of devices Requesting a non-GPU device triggers an error, all PI HIP devices are GPUs.

Definition at line 976 of file pi_hip.cpp.

References PI_DEVICE_TYPE_DEFAULT, and PI_DEVICE_TYPE_GPU.

Referenced by piPluginInit().

◆ hip_piEnqueueEventsWait()

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

Enqueues a wait on the given queue for all events.

See enqueueEventWait

Currently queues are represented by a single in-order stream, therefore every command is an implicit barrier and so hip_piEnqueueEventsWait has the same behavior as hip_piEnqueueEventsWaitWithBarrier. So hip_piEnqueueEventsWait can just call hip_piEnqueueEventsWaitWithBarrier.

Definition at line 4037 of file pi_hip.cpp.

References hip_piEnqueueEventsWaitWithBarrier().

Referenced by hip_piEnqueueMemBufferMap(), hip_piEnqueueMemUnmap(), hip_piextUSMEnqueueMemAdvise(), and piPluginInit().

◆ hip_piEnqueueEventsWaitWithBarrier()

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

Enqueues a wait on the given queue for all specified events.

See enqueueEventWaitWithBarrier

If the events list is empty, the enqueued wait will wait on all previous events in the queue.

Definition at line 4050 of file pi_hip.cpp.

References _pi_queue::barrier_event_, _pi_queue::barrier_mutex_, _pi_queue::barrier_tmp_event_, _pi_queue::compute_applied_barrier_, _pi_queue::get_context(), _pi_queue::get_next_compute_stream(), _pi_event::make_native(), PI_COMMAND_TYPE_MARKER, _pi_queue::sync_streams(), and _pi_queue::transfer_applied_barrier_.

Referenced by hip_piEnqueueEventsWait(), hip_piEnqueueKernelLaunch(), and piPluginInit().

◆ hip_piEnqueueKernelLaunch()

pi_result hip_piEnqueueKernelLaunch ( pi_queue  command_queue,
pi_kernel  kernel,
pi_uint32  work_dim,
const size_t *  global_work_offset,
const size_t *  global_work_size,
const size_t *  local_work_size,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

◆ hip_piEnqueueMemBufferCopy()

pi_result hip_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 
)

◆ hip_piEnqueueMemBufferCopyRect()

pi_result hip_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 
)

◆ hip_piEnqueueMemBufferFill()

pi_result hip_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 
)

◆ hip_piEnqueueMemBufferMap()

pi_result hip_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 
)

Implements mapping on the host using a BufferRead operation.

Mapped pointers are stored in the pi_mem object. If the buffer uses pinned host memory a pointer to that memory is returned and no read operation is done.

Definition at line 4987 of file pi_hip.cpp.

References _pi_mem::mem_::buffer_mem_::alloc_host_ptr, _pi_mem::mem_::buffer_mem_::allocMode_, _pi_mem::buffer, _pi_mem::mem_::buffer_mem_, _pi_queue::get_context(), _pi_mem::mem_::buffer_mem_::get_map_ptr(), _pi_queue::get_next_transfer_stream(), hip_piEnqueueEventsWait(), hip_piEnqueueMemBufferRead(), _pi_event::make_native(), _pi_mem::mem_::buffer_mem_::map_to_ptr(), _pi_mem::mem_, _pi_mem::mem_type_, PI_COMMAND_TYPE_MEM_BUFFER_MAP, PI_MAP_READ, and PI_MAP_WRITE.

Referenced by piPluginInit().

◆ hip_piEnqueueMemBufferRead()

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

◆ hip_piEnqueueMemBufferReadRect()

pi_result hip_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 
)

◆ hip_piEnqueueMemBufferWrite()

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

◆ hip_piEnqueueMemBufferWriteRect()

pi_result hip_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 
)

◆ hip_piEnqueueMemImageCopy()

pi_result hip_piEnqueueMemImageCopy ( pi_queue  command_queue,
pi_mem  src_image,
pi_mem  dst_image,
const size_t *  src_origin,
const size_t *  dst_origin,
const size_t *  region,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

◆ hip_piEnqueueMemImageFill()

pi_result hip_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 
)

\TODO Not implemented in HIP.

Definition at line 4963 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piEnqueueMemImageRead()

pi_result hip_piEnqueueMemImageRead ( pi_queue  command_queue,
pi_mem  image,
pi_bool  blocking_read,
const size_t *  origin,
const size_t *  region,
size_t  row_pitch,
size_t  slice_pitch,
void *  ptr,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

◆ hip_piEnqueueMemImageWrite()

pi_result hip_piEnqueueMemImageWrite ( pi_queue  command_queue,
pi_mem  image,
pi_bool  blocking_write,
const size_t *  origin,
const size_t *  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 
)

◆ hip_piEnqueueMemUnmap()

pi_result hip_piEnqueueMemUnmap ( pi_queue  command_queue,
pi_mem  memobj,
void *  mapped_ptr,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

◆ hip_piEnqueueNativeKernel()

pi_result hip_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 
)

\TODO Not implemented

Definition at line 3165 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piEventCreate()

pi_result hip_piEventCreate ( pi_context  context,
pi_event event 
)

Definition at line 3903 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piEventGetInfo()

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

◆ hip_piEventGetProfilingInfo()

pi_result hip_piEventGetProfilingInfo ( pi_event  event,
pi_profiling_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

◆ hip_piEventRelease()

pi_result hip_piEventRelease ( pi_event  event)

Definition at line 4005 of file pi_hip.cpp.

References sycl::_V1::detail::pi::assertion().

Referenced by piPluginInit().

◆ hip_piEventRetain()

pi_result hip_piEventRetain ( pi_event  event)

Definition at line 3994 of file pi_hip.cpp.

References sycl::_V1::detail::pi::assertion().

Referenced by piPluginInit().

◆ hip_piEventSetCallback()

pi_result hip_piEventSetCallback ( pi_event  event,
pi_int32  command_exec_callback_type,
pfn_notify  notify,
void *  user_data 
)

Definition at line 3974 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piEventSetStatus()

pi_result hip_piEventSetStatus ( pi_event  event,
pi_int32  execution_status 
)

Definition at line 3986 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piEventsWait()

pi_result hip_piEventsWait ( pi_uint32  num_events,
const pi_event event_list 
)

Definition at line 2856 of file pi_hip.cpp.

References _pi_event::get_context().

Referenced by piPluginInit().

◆ hip_piextContextCreateWithNativeHandle()

pi_result hip_piextContextCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_uint32  num_devices,
const pi_device devices,
bool  ownNativeHandle,
pi_context context 
)

Created a PI context object from a HIP context handle.

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

Parameters
[in]nativeHandleThe native handle to create PI context object from.
[out]contextSet to the PI context object created from native handle.
Returns
TBD

Definition at line 2227 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextContextGetNativeHandle()

pi_result hip_piextContextGetNativeHandle ( pi_context  context,
pi_native_handle nativeHandle 
)

Gets the native HIP handle of a PI context object.

Parameters
[in]contextThe PI context to get the native HIP object of.
[out]nativeHandleSet to the native handle of the PI context object.
Returns
PI_SUCCESS

Definition at line 2213 of file pi_hip.cpp.

References _pi_context::get().

Referenced by piPluginInit().

◆ hip_piextContextSetExtendedDeleter()

pi_result hip_piextContextSetExtendedDeleter ( pi_context  context,
pi_context_extended_deleter  function,
void *  user_data 
)

Definition at line 1059 of file pi_hip.cpp.

References _pi_context::set_extended_deleter().

Referenced by piPluginInit().

◆ hip_piextDeviceCreateWithNativeHandle()

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

Created a PI device object from a HIP device handle.

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

Parameters
[in]nativeHandleThe native handle to create PI device object from.
[in]platformis the PI platform of the device.
[out]deviceSet to the PI device object created from native handle.
Returns
TBD

Definition at line 2046 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextDeviceGetNativeHandle()

pi_result hip_piextDeviceGetNativeHandle ( pi_device  device,
pi_native_handle nativeHandle 
)

Gets the native HIP handle of a PI device object.

Parameters
[in]deviceThe PI device to get the native HIP object of.
[out]nativeHandleSet to the native handle of the PI device object.
Returns
PI_SUCCESS

Definition at line 2031 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piextDeviceSelectBinary()

pi_result hip_piextDeviceSelectBinary ( pi_device  device,
pi_device_binary binaries,
pi_uint32  num_binaries,
pi_uint32 selected_binary 
)
Returns
If available, the first binary that is PTX

Definition at line 1082 of file pi_hip.cpp.

References __SYCL_PI_DEVICE_BINARY_TARGET_AMDGCN, __SYCL_PI_DEVICE_BINARY_TARGET_NVPTX64, and sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextEnqueueDeviceGlobalVariableRead()

pi_result hip_piextEnqueueDeviceGlobalVariableRead ( pi_queue  queue,
pi_program  program,
const char *  name,
pi_bool  blocking_read,
size_t  count,
size_t  offset,
void *  dst,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 5521 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextEnqueueDeviceGlobalVariableWrite()

pi_result hip_piextEnqueueDeviceGlobalVariableWrite ( pi_queue  queue,
pi_program  program,
const char *  name,
pi_bool  blocking_write,
size_t  count,
size_t  offset,
const void *  src,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

Definition at line 5500 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextEnqueueReadHostPipe()

pi_result hip_piextEnqueueReadHostPipe ( pi_queue  queue,
pi_program  program,
const char *  pipe_symbol,
pi_bool  blocking,
void *  ptr,
size_t  size,
pi_uint32  num_events_in_waitlist,
const pi_event events_waitlist,
pi_event event 
)

Host Pipes.

Definition at line 5541 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextEnqueueWriteHostPipe()

pi_result hip_piextEnqueueWriteHostPipe ( pi_queue  queue,
pi_program  program,
const char *  pipe_symbol,
pi_bool  blocking,
void *  ptr,
size_t  size,
pi_uint32  num_events_in_waitlist,
const pi_event events_waitlist,
pi_event event 
)

Definition at line 5561 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextEventCreateWithNativeHandle()

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

Created a PI event object from a HIP event handle.

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

Parameters
[in]nativeHandleThe native handle to create PI event object from.
[out]eventSet to the PI event object created from native handle.
Returns
TBD

Definition at line 4146 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextEventGetNativeHandle()

pi_result hip_piextEventGetNativeHandle ( pi_event  event,
pi_native_handle nativeHandle 
)

Gets the native HIP handle of a PI event object.

Parameters
[in]eventThe PI event to get the native HIP object of.
[out]nativeHandleSet to the native handle of the PI event object.
Returns
PI_SUCCESS on success. PI_ERROR_INVALID_EVENT if given a user event.

Definition at line 4132 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piextGetDeviceFunctionPointer()

pi_result hip_piextGetDeviceFunctionPointer ( [[maybe_unused] ] pi_device  device,
pi_program  program,
const char *  func_name,
pi_uint64 func_pointer_ret 
)

Definition at line 1115 of file pi_hip.cpp.

References _pi_program::get(), _pi_program::get_context(), and _pi_context::get_device().

Referenced by piPluginInit().

◆ hip_piextKernelSetArgMemObj()

◆ hip_piextKernelSetArgPointer()

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

Definition at line 3894 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piextKernelSetArgSampler()

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

Definition at line 2991 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piextMemCreateWithNativeHandle()

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

Created a PI mem object from a HIP mem handle.

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

Parameters
[in]nativeHandleThe native handle to create PI mem object from.
[in]contextThe PI context of the memory allocation.
[in]ownNativeHandleIndicates if we own the native memory handle or it came from interop that asked to not transfer the ownership to SYCL RT.
[out]memSet to the PI mem object created from native handle.
Returns
TBD

Definition at line 2512 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextMemGetNativeHandle()

pi_result hip_piextMemGetNativeHandle ( pi_mem  mem,
pi_native_handle nativeHandle 
)

Gets the native HIP handle of a PI mem object.

Parameters
[in]memThe PI mem to get the native HIP object of.
[out]nativeHandleSet to the native handle of the PI mem object.
Returns
PI_SUCCESS

Definition at line 2475 of file pi_hip.cpp.

References _pi_mem::mem_::buffer_mem_, _pi_mem::mem_::buffer_mem_::get(), and _pi_mem::mem_.

Referenced by piPluginInit().

◆ hip_piextMemImageCreateWithNativeHandle()

pi_result hip_piextMemImageCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
bool  ownNativeHandle,
const pi_image_format ImageFormat,
const pi_image_desc ImageDesc,
pi_mem mem 
)

Created a PI image mem object from a HIP image mem handle.

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

Parameters
[in]nativeHandleThe native handle to create PI mem object from.
[in]contextThe PI context of the memory allocation.
[in]ownNativeHandleIndicates if we own the native memory handle or it came from interop that asked to not transfer the ownership to SYCL RT.
[in]ImageFormatThe format of the image.
[in]ImageDescThe description information for the image.
[out]memSet to the PI mem object created from native handle.
Returns
TBD

Definition at line 2539 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

◆ hip_piextProgramCreateWithNativeHandle()

pi_result hip_piextProgramCreateWithNativeHandle ( pi_native_handle  nativeHandle,
pi_context  context,
bool  ownNativeHandle,
pi_program program 
)

Created a PI program object from a HIP program handle.

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

Parameters
[in]nativeHandleThe native handle to create PI program object from.
[in]contextThe PI context of the program.
[in]ownNativeHandletells if should assume the ownership of the native handle.
[out]programSet to the PI program object created from native handle.
Returns
TBD

Definition at line 3643 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextProgramGetNativeHandle()

pi_result hip_piextProgramGetNativeHandle ( pi_program  program,
pi_native_handle nativeHandle 
)

Gets the native HIP handle of a PI program object.

Parameters
[in]programThe PI program to get the native HIP object of.
[out]nativeHandleSet to the native handle of the PI program object.
Returns
TBD

Definition at line 3626 of file pi_hip.cpp.

References _pi_program::get().

Referenced by piPluginInit().

◆ hip_piextProgramSetSpecializationConstant()

pi_result hip_piextProgramSetSpecializationConstant ( pi_program  ,
pi_uint32  ,
size_t  ,
const void *   
)

Definition at line 3886 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextQueueCreate()

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

Definition at line 2597 of file pi_hip.cpp.

References hip_piQueueCreate(), and PI_QUEUE_FLAGS.

Referenced by piPluginInit().

◆ hip_piextQueueCreateWithNativeHandle()

pi_result hip_piextQueueCreateWithNativeHandle ( pi_native_handle  nativeHandle,
int32_t  NativeHandleDesc,
pi_context  context,
pi_device  device,
bool  ownNativeHandle,
pi_queue_properties Properties,
pi_queue queue 
)

Created a PI queue object from a HIP queue handle.

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

Parameters
[in]nativeHandleThe native handle to create PI queue object from.
[in]contextis the PI context of the queue.
[out]queueSet to the PI queue object created from native handle.
ownNativeHandletells if SYCL RT should assume the ownership of the native handle, if it can.
Returns
TBD

Definition at line 2749 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextQueueGetNativeHandle()

pi_result hip_piextQueueGetNativeHandle ( pi_queue  queue,
pi_native_handle nativeHandle,
int32_t *  NativeHandleDesc 
)

Gets the native HIP handle of a PI queue object.

Parameters
[in]queueThe PI queue to get the native HIP object of.
[out]nativeHandleSet to the native handle of the PI queue object.
Returns
PI_SUCCESS

Definition at line 2727 of file pi_hip.cpp.

References _pi_queue::get_context(), and _pi_queue::get_next_compute_stream().

Referenced by piPluginInit().

◆ hip_piextUSMDeviceAlloc()

pi_result hip_piextUSMDeviceAlloc ( void **  result_ptr,
pi_context  context,
[[maybe_unused] ] pi_device  device,
[[maybe_unused] ] pi_usm_mem_properties properties,
size_t  size,
[[maybe_unused] ] pi_uint32  alignment 
)

USM: Implements USM device allocations using a normal HIP device pointer.

Definition at line 5126 of file pi_hip.cpp.

References sycl::_V1::ext::oneapi::experimental::alignment.

Referenced by piPluginInit().

◆ hip_piextUSMEnqueueFill2D()

pi_result hip_piextUSMEnqueueFill2D ( pi_queue  ,
void *  ,
size_t  ,
size_t  ,
const void *  ,
size_t  ,
size_t  ,
pi_uint32  ,
const pi_event ,
pi_event  
)

Definition at line 5334 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextUSMEnqueueMemAdvise()

pi_result hip_piextUSMEnqueueMemAdvise ( pi_queue  queue,
[[maybe_unused] ] const void *  ptr,
size_t  length,
pi_mem_advice  advice,
pi_event event 
)

USM: memadvise API to govern behavior of automatic migration mechanisms.

Definition at line 5316 of file pi_hip.cpp.

References hip_piEnqueueEventsWait().

Referenced by piPluginInit().

◆ hip_piextUSMEnqueueMemcpy()

pi_result hip_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 
)

◆ hip_piextUSMEnqueueMemcpy2D()

pi_result hip_piextUSMEnqueueMemcpy2D ( pi_queue  queue,
pi_bool  blocking,
void *  dst_ptr,
size_t  dst_pitch,
const void *  src_ptr,
size_t  src_pitch,
size_t  width,
size_t  height,
pi_uint32  num_events_in_wait_list,
const pi_event event_wait_list,
pi_event event 
)

2D Memcpy API

Parameters
queueis the queue to submit to
blockingis whether this operation should block the host
dst_ptris the location the data will be copied
dst_pitchis the total width of the destination memory including padding
src_ptris the data to be copied
dst_pitchis the total width of the source memory including padding
widthis width in bytes of each row to be copied
heightis height the columns to be copied
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 5364 of file pi_hip.cpp.

References _pi_queue::get_context(), _pi_queue::get_next_transfer_stream(), _pi_event::make_native(), and PI_COMMAND_TYPE_MEM_BUFFER_COPY_RECT.

Referenced by piPluginInit().

◆ hip_piextUSMEnqueueMemset()

pi_result hip_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 
)

◆ hip_piextUSMEnqueueMemset2D()

pi_result hip_piextUSMEnqueueMemset2D ( pi_queue  ,
void *  ,
size_t  ,
int  ,
size_t  ,
size_t  ,
pi_uint32  ,
const pi_event ,
pi_event  
)

Definition at line 5343 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piextUSMEnqueuePrefetch()

pi_result hip_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 
)

◆ hip_piextUSMFree()

pi_result hip_piextUSMFree ( pi_context  context,
void *  ptr 
)

USM: Frees the given USM pointer associated with the context.

Definition at line 5176 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piextUSMGetMemAllocInfo()

pi_result hip_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 5419 of file pi_hip.cpp.

References getInfo(), hip_piPlatformsGet(), PI_MEM_ALLOC_BASE_PTR, PI_MEM_ALLOC_DEVICE, PI_MEM_ALLOC_SIZE, PI_MEM_ALLOC_TYPE, PI_MEM_TYPE_DEVICE, PI_MEM_TYPE_HOST, PI_MEM_TYPE_SHARED, and PI_MEM_TYPE_UNKNOWN.

Referenced by piPluginInit().

◆ hip_piextUSMHostAlloc()

pi_result hip_piextUSMHostAlloc ( void **  result_ptr,
pi_context  context,
[[maybe_unused] ] pi_usm_mem_properties properties,
size_t  size,
[[maybe_unused] ] pi_uint32  alignment 
)

USM: Implements USM Host allocations using HIP Pinned Memory.

Definition at line 5103 of file pi_hip.cpp.

References sycl::_V1::ext::oneapi::experimental::alignment.

Referenced by piPluginInit().

◆ hip_piextUSMSharedAlloc()

pi_result hip_piextUSMSharedAlloc ( void **  result_ptr,
pi_context  context,
[[maybe_unused] ] pi_device  device,
[[maybe_unused] ] pi_usm_mem_properties properties,
size_t  size,
[[maybe_unused] ] pi_uint32  alignment 
)

USM: Implements USM Shared allocations using HIP Managed Memory.

Definition at line 5151 of file pi_hip.cpp.

References sycl::_V1::ext::oneapi::experimental::alignment.

Referenced by piPluginInit().

◆ hip_piGetDeviceAndHostTimer()

pi_result hip_piGetDeviceAndHostTimer ( pi_device  Device,
uint64_t *  DeviceTime,
uint64_t *  HostTime 
)

Definition at line 5591 of file pi_hip.cpp.

References _pi_platform::evBase_.

Referenced by piPluginInit().

◆ hip_piKernelCreate()

pi_result hip_piKernelCreate ( pi_program  program,
const char *  kernel_name,
pi_kernel kernel 
)

Definition at line 2891 of file pi_hip.cpp.

References _pi_program::get(), and _pi_program::get_context().

Referenced by piPluginInit().

◆ hip_piKernelGetGroupInfo()

◆ hip_piKernelGetInfo()

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

◆ hip_piKernelGetSubGroupInfo()

pi_result hip_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 
)

◆ hip_piKernelRelease()

pi_result hip_piKernelRelease ( pi_kernel  kernel)

Definition at line 3855 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piKernelRetain()

pi_result hip_piKernelRetain ( pi_kernel  kernel)

Definition at line 3847 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piKernelSetArg()

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

Definition at line 2931 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piKernelSetExecInfo()

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

Definition at line 3874 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piMemBufferCreate()

pi_result hip_piMemBufferCreate ( pi_context  context,
pi_mem_flags  flags,
size_t  size,
void *  host_ptr,
pi_mem ret_mem,
[[maybe_unused] ] const pi_mem_properties properties 
)

Creates a PI Memory object using a HIP memory allocation.

Can trigger a manual copy depending on the mode. \TODO Implement USE_HOST_PTR using cuHostRegister

Definition at line 2247 of file pi_hip.cpp.

References _pi_mem::mem_::buffer_mem_::alloc_host_ptr, _pi_mem::mem_::buffer_mem_::classic, _pi_mem::mem_::buffer_mem_::copy_in, PI_MEM_FLAGS_HOST_PTR_ALLOC, PI_MEM_FLAGS_HOST_PTR_COPY, PI_MEM_FLAGS_HOST_PTR_USE, and _pi_mem::mem_::buffer_mem_::use_host_ptr.

Referenced by piPluginInit().

◆ hip_piMemBufferPartition()

pi_result hip_piMemBufferPartition ( pi_mem  parent_buffer,
pi_mem_flags  flags,
[[maybe_unused] ] pi_buffer_create_type  buffer_create_type,
void *  buffer_create_info,
pi_mem memObj 
)

◆ hip_piMemGetInfo()

pi_result hip_piMemGetInfo ( pi_mem  memObj,
pi_mem_info  queriedInfo,
size_t  expectedQuerySize,
void *  queryOutput,
size_t *  writtenQuerySize 
)

Definition at line 2457 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piMemImageCreate()

◆ hip_piMemImageGetInfo()

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

\TODO Not implemented

Definition at line 3341 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piMemRelease()

pi_result hip_piMemRelease ( pi_mem  memObj)

Decreases the reference count of the Mem object.

If this is zero, calls the relevant HIP Free function

Returns
PI_SUCCESS unless deallocation error

Definition at line 2325 of file pi_hip.cpp.

References _pi_mem::mem_::buffer_mem_::alloc_host_ptr, _pi_mem::buffer, _pi_mem::mem_::buffer_mem_::classic, _pi_mem::mem_::buffer_mem_::copy_in, _pi_mem::decrement_reference_count(), sycl::_V1::detail::pi::die(), _pi_mem::is_sub_buffer(), _pi_mem::mem_type_, _pi_mem::surface, and _pi_mem::mem_::buffer_mem_::use_host_ptr.

Referenced by piPluginInit(), and _pi_mem::~_pi_mem().

◆ hip_piMemRetain()

pi_result hip_piMemRetain ( pi_mem  mem)

Definition at line 3354 of file pi_hip.cpp.

References _pi_mem::get_reference_count(), and _pi_mem::increment_reference_count().

Referenced by piPluginInit().

◆ hip_piPlatformGetInfo()

pi_result hip_piPlatformGetInfo ( [[maybe_unused] ] pi_platform  platform,
pi_platform_info  param_name,
size_t  param_value_size,
void *  param_value,
size_t *  param_value_size_ret 
)

◆ hip_piPlatformsGet()

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

Obtains the HIP platform.

There is only one HIP platform, and contains all devices on the system. Triggers the HIP Driver initialization (hipInit) the first time, so this must be the first PI API called.

However because multiple devices in a context is not currently supported, place each device in a separate platform.

Definition at line 854 of file pi_hip.cpp.

Referenced by hip_piextUSMGetMemAllocInfo(), and piPluginInit().

◆ hip_piProgramBuild()

pi_result hip_piProgramBuild ( pi_program  program,
[[maybe_unused] ] pi_uint32  num_devices,
[[maybe_unused] ] const pi_device device_list,
const char *  options,
[[maybe_unused] ] void(*)(pi_program program, void *user_data)  pfn_notify,
[[maybe_unused] ] void *  user_data 
)

Loads the images from a PI program into a HIPmodule that can be used later on to extract functions (kernels).

See _pi_program for implementation details.

Definition at line 3382 of file pi_hip.cpp.

References _pi_program::build_program(), and _pi_program::get_context().

Referenced by piPluginInit().

◆ hip_piProgramCompile()

pi_result hip_piProgramCompile ( pi_program  program,
[[maybe_unused] ] pi_uint32  num_devices,
[[maybe_unused] ] const pi_device device_list,
const char *  options,
[[maybe_unused] ] pi_uint32  num_input_headers,
const pi_program input_headers,
const char **  header_include_names,
[[maybe_unused] ] void(*)(pi_program program, void *user_data)  pfn_notify,
[[maybe_unused] ] void *  user_data 
)

Creates a new program that is the outcome of the compilation of the headers and the program.

\TODO Implement asynchronous compilation

Definition at line 3526 of file pi_hip.cpp.

References _pi_program::build_program(), and _pi_program::get_context().

Referenced by piPluginInit().

◆ hip_piProgramCreate()

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

\TODO Not implemented

Definition at line 3407 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piProgramCreateWithBinary()

pi_result hip_piProgramCreateWithBinary ( pi_context  context,
[[maybe_unused] ] pi_uint32  num_devices,
[[maybe_unused] ] 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 program 
)

Loads images from a list of PTX or HIPBIN binaries.

Note: No calls to HIP driver API in this function, only store binaries for later.

Note: Only supports one device

Definition at line 3424 of file pi_hip.cpp.

References _pi_device::get(), and _pi_context::get_device().

Referenced by piPluginInit().

◆ hip_piProgramGetBuildInfo()

pi_result hip_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 
)

◆ hip_piProgramGetInfo()

◆ hip_piProgramLink()

pi_result hip_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 
)

Definition at line 3501 of file pi_hip.cpp.

References sycl::_V1::detail::pi::die().

Referenced by piPluginInit().

◆ hip_piProgramRelease()

pi_result hip_piProgramRelease ( pi_program  program)

Decreases the reference count of a pi_program object.

When the reference count reaches 0, it unloads the module from the context.

Definition at line 3591 of file pi_hip.cpp.

References _pi_program::decrement_reference_count(), _pi_program::get(), _pi_program::get_context(), and _pi_program::get_reference_count().

Referenced by piPluginInit(), and _pi_kernel::~_pi_kernel().

◆ hip_piProgramRetain()

pi_result hip_piProgramRetain ( pi_program  program)

◆ hip_piQueueCreate()

pi_result hip_piQueueCreate ( pi_context  context,
pi_device  device,
pi_queue_properties  properties,
pi_queue queue 
)

Creates a pi_queue object on the HIP backend.

Valid properties

  • __SYCL_PI_HIP_USE_DEFAULT_STREAM -> hipStreamDefault
  • __SYCL_PI_HIP_SYNC_WITH_DEFAULT -> hipStreamNonBlocking
    Returns
    Pi queue object mapping to a HIPStream

Definition at line 2561 of file pi_hip.cpp.

References _pi_queue::default_num_compute_streams, _pi_queue::default_num_transfer_streams, _pi_context::get_device(), and PI_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE.

Referenced by hip_piextQueueCreate(), and piPluginInit().

◆ hip_piQueueFinish()

pi_result hip_piQueueFinish ( pi_queue  command_queue)

Definition at line 2686 of file pi_hip.cpp.

References _pi_queue::get_context(), and _pi_queue::sync_streams().

Referenced by piPluginInit().

◆ hip_piQueueFlush()

pi_result hip_piQueueFlush ( pi_queue  command_queue)

Definition at line 2716 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ hip_piQueueGetInfo()

◆ hip_piQueueRelease()

pi_result hip_piQueueRelease ( pi_queue  command_queue)

◆ hip_piQueueRetain()

pi_result hip_piQueueRetain ( pi_queue  command_queue)

Definition at line 2653 of file pi_hip.cpp.

References _pi_queue::get_reference_count(), and _pi_queue::increment_reference_count().

Referenced by piPluginInit().

◆ hip_piSamplerCreate()

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

Creates a PI sampler object.

Parameters
[in]contextThe context the sampler is created for.
[in]sampler_propertiesThe properties for the sampler.
[out]result_samplerSet to the resulting sampler object.
Returns
PI_SUCCESS on success. PI_ERROR_INVALID_VALUE if given an invalid property or if there is multiple of properties from the same category.

Definition at line 4169 of file pi_hip.cpp.

References PI_SAMPLER_ADDRESSING_MODE_CLAMP, PI_SAMPLER_ADDRESSING_MODE_NONE, PI_SAMPLER_FILTER_MODE_NEAREST, PI_SAMPLER_PROPERTIES_ADDRESSING_MODE, PI_SAMPLER_PROPERTIES_FILTER_MODE, PI_SAMPLER_PROPERTIES_NORMALIZED_COORDS, and PI_TRUE.

Referenced by piPluginInit().

◆ hip_piSamplerGetInfo()

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

Gets information from a PI sampler object.

Parameters
[in]samplerThe sampler to get the information from.
[in]param_nameThe name of the information to get.
[in]param_value_sizeThe size of the param_value.
[out]param_valueSet to information value.
[out]param_value_size_retSet to the size of the information value.
Returns
PI_SUCCESS on success.

Definition at line 4228 of file pi_hip.cpp.

References __SYCL_PI_HANDLE_UNKNOWN_PARAM_NAME, _pi_sampler::context_, _pi_sampler::get_reference_count(), getInfo(), PI_SAMPLER_ADDRESSING_MODE_NONE, PI_SAMPLER_FILTER_MODE_NEAREST, PI_SAMPLER_INFO_ADDRESSING_MODE, PI_SAMPLER_INFO_CONTEXT, PI_SAMPLER_INFO_FILTER_MODE, PI_SAMPLER_INFO_NORMALIZED_COORDS, PI_SAMPLER_INFO_REFERENCE_COUNT, and _pi_sampler::props_.

Referenced by piPluginInit().

◆ hip_piSamplerRelease()

pi_result hip_piSamplerRelease ( pi_sampler  sampler)

Releases a PI sampler object, decrementing its reference count.

If the reference count reaches zero, the sampler object is destroyed.

Parameters
[in]samplerThe sampler to decrement the reference count of.
Returns
PI_SUCCESS.

Definition at line 4281 of file pi_hip.cpp.

References sycl::_V1::detail::pi::assertion(), _pi_sampler::decrement_reference_count(), and _pi_sampler::get_reference_count().

Referenced by piPluginInit().

◆ hip_piSamplerRetain()

pi_result hip_piSamplerRetain ( pi_sampler  sampler)

Retains a PI sampler object, incrementing its reference count.

Parameters
[in]samplerThe sampler to increment the reference count of.
Returns
PI_SUCCESS.

Definition at line 4269 of file pi_hip.cpp.

References _pi_sampler::increment_reference_count().

Referenced by piPluginInit().

◆ hip_piTearDown()

pi_result hip_piTearDown ( void *  PluginParameter)

Definition at line 5586 of file pi_hip.cpp.

Referenced by piPluginInit().

◆ imageElementByteSize()

static size_t imageElementByteSize ( hipArray_Format  array_format)
static

◆ piPluginInit()

pi_result piPluginInit ( pi_plugin PluginInit)

Definition at line 5624 of file pi_hip.cpp.

References _PI_CL, _PI_PLUGIN_VERSION_CHECK, hip_piclProgramCreateWithSource(), hip_piContextCreate(), hip_piContextGetInfo(), hip_piContextRelease(), hip_piContextRetain(), hip_piDeviceGetInfo(), hip_piDevicePartition(), hip_piDeviceRelease(), hip_piDeviceRetain(), hip_piDevicesGet(), hip_piEnqueueEventsWait(), hip_piEnqueueEventsWaitWithBarrier(), hip_piEnqueueKernelLaunch(), hip_piEnqueueMemBufferCopy(), hip_piEnqueueMemBufferCopyRect(), hip_piEnqueueMemBufferFill(), hip_piEnqueueMemBufferMap(), hip_piEnqueueMemBufferRead(), hip_piEnqueueMemBufferReadRect(), hip_piEnqueueMemBufferWrite(), hip_piEnqueueMemBufferWriteRect(), hip_piEnqueueMemImageCopy(), hip_piEnqueueMemImageFill(), hip_piEnqueueMemImageRead(), hip_piEnqueueMemImageWrite(), hip_piEnqueueMemUnmap(), hip_piEnqueueNativeKernel(), hip_piEventCreate(), hip_piEventGetInfo(), hip_piEventGetProfilingInfo(), hip_piEventRelease(), hip_piEventRetain(), hip_piEventSetCallback(), hip_piEventSetStatus(), hip_piEventsWait(), hip_piextContextCreateWithNativeHandle(), hip_piextContextGetNativeHandle(), hip_piextContextSetExtendedDeleter(), hip_piextDeviceCreateWithNativeHandle(), hip_piextDeviceGetNativeHandle(), hip_piextDeviceSelectBinary(), hip_piextEnqueueDeviceGlobalVariableRead(), hip_piextEnqueueDeviceGlobalVariableWrite(), hip_piextEnqueueReadHostPipe(), hip_piextEnqueueWriteHostPipe(), hip_piextEventCreateWithNativeHandle(), hip_piextEventGetNativeHandle(), hip_piextGetDeviceFunctionPointer(), hip_piextKernelSetArgMemObj(), hip_piextKernelSetArgPointer(), hip_piextKernelSetArgSampler(), hip_piextMemCreateWithNativeHandle(), hip_piextMemGetNativeHandle(), hip_piextProgramCreateWithNativeHandle(), hip_piextProgramGetNativeHandle(), hip_piextProgramSetSpecializationConstant(), hip_piextQueueCreate(), hip_piextQueueCreateWithNativeHandle(), hip_piextQueueGetNativeHandle(), hip_piextUSMDeviceAlloc(), hip_piextUSMEnqueueFill2D(), hip_piextUSMEnqueueMemAdvise(), hip_piextUSMEnqueueMemcpy(), hip_piextUSMEnqueueMemcpy2D(), hip_piextUSMEnqueueMemset(), hip_piextUSMEnqueueMemset2D(), hip_piextUSMEnqueuePrefetch(), hip_piextUSMFree(), hip_piextUSMGetMemAllocInfo(), hip_piextUSMHostAlloc(), hip_piextUSMSharedAlloc(), hip_piGetDeviceAndHostTimer(), hip_piKernelCreate(), hip_piKernelGetGroupInfo(), hip_piKernelGetInfo(), hip_piKernelGetSubGroupInfo(), hip_piKernelRelease(), hip_piKernelRetain(), hip_piKernelSetArg(), hip_piKernelSetExecInfo(), hip_piMemBufferCreate(), hip_piMemBufferPartition(), hip_piMemGetInfo(), hip_piMemImageCreate(), hip_piMemImageGetInfo(), hip_piMemRelease(), hip_piMemRetain(), hip_piPlatformGetInfo(), hip_piPlatformsGet(), hip_piProgramBuild(), hip_piProgramCompile(), hip_piProgramCreate(), hip_piProgramCreateWithBinary(), hip_piProgramGetBuildInfo(), hip_piProgramGetInfo(), hip_piProgramLink(), hip_piProgramRelease(), hip_piProgramRetain(), hip_piQueueCreate(), hip_piQueueFinish(), hip_piQueueFlush(), hip_piQueueGetInfo(), hip_piQueueRelease(), hip_piQueueRetain(), hip_piSamplerCreate(), hip_piSamplerGetInfo(), hip_piSamplerRelease(), hip_piSamplerRetain(), hip_piTearDown(), 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(), piextContextSetExtendedDeleter(), piextDeviceCreateWithNativeHandle(), piextDeviceGetNativeHandle(), piextDeviceSelectBinary(), piextEnqueueDeviceGlobalVariableRead(), piextEnqueueDeviceGlobalVariableWrite(), piextEnqueueReadHostPipe(), piextEnqueueWriteHostPipe(), piextEventCreateWithNativeHandle(), piextEventGetNativeHandle(), piextGetDeviceFunctionPointer(), piextKernelSetArgMemObj(), piextKernelSetArgPointer(), piextKernelSetArgSampler(), piextMemCreateWithNativeHandle(), piextMemGetNativeHandle(), piextProgramCreateWithNativeHandle(), piextProgramGetNativeHandle(), piextProgramSetSpecializationConstant(), piextQueueCreate(), piextQueueCreateWithNativeHandle(), piextQueueGetNativeHandle(), piextUSMDeviceAlloc(), piextUSMEnqueueFill2D(), piextUSMEnqueueMemAdvise(), piextUSMEnqueueMemcpy(), piextUSMEnqueueMemcpy2D(), piextUSMEnqueueMemset(), piextUSMEnqueueMemset2D(), piextUSMEnqueuePrefetch(), piextUSMFree(), piextUSMGetMemAllocInfo(), piextUSMHostAlloc(), piextUSMSharedAlloc(), _pi_plugin::PiFunctionTable, piGetDeviceAndHostTimer(), piKernelCreate(), piKernelGetGroupInfo(), piKernelGetInfo(), piKernelGetSubGroupInfo(), piKernelRelease(), piKernelRetain(), piKernelSetArg(), piKernelSetExecInfo(), piMemBufferCreate(), piMemBufferPartition(), piMemGetInfo(), piMemImageCreate(), piMemImageGetInfo(), piMemRelease(), piMemRetain(), piPlatformGetInfo(), piPlatformsGet(), piPluginGetBackendOption(), 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.

Variable Documentation

◆ SupportedVersion

const char SupportedVersion[] = _PI_HIP_PLUGIN_VERSION_STRING

Definition at line 5622 of file pi_hip.cpp.

Referenced by piPluginInit().