Skip to content

Commit

Permalink
Add Exp suffix to function names
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Aziz <michael.aziz@intel.com>
  • Loading branch information
0x12CC committed Sep 12, 2023
1 parent fbf6152 commit 8ac8d97
Show file tree
Hide file tree
Showing 14 changed files with 579 additions and 172 deletions.
78 changes: 56 additions & 22 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ class ur_function_v(IntEnum):
COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190 ## Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp
COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191## Enumerator for ::urCommandBufferAppendMemBufferReadRectExp
COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192 ## Enumerator for ::urCommandBufferAppendMemBufferFillExp
ENQUEUE_COOPERATIVE_KERNEL_LAUNCH = 193 ## Enumerator for ::urEnqueueCooperativeKernelLaunch
KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCount
ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193 ## Enumerator for ::urEnqueueCooperativeKernelLaunchExp
KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp

class ur_function_t(c_int):
def __str__(self):
Expand Down Expand Up @@ -2684,13 +2684,6 @@ class ur_program_dditable_t(Structure):
else:
_urKernelSetSpecializationConstants_t = CFUNCTYPE( ur_result_t, ur_kernel_handle_t, c_ulong, POINTER(ur_specialization_constant_info_t) )

###############################################################################
## @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCount
if __use_win_types:
_urKernelSuggestMaxCooperativeGroupCount_t = WINFUNCTYPE( ur_result_t, ur_kernel_handle_t, POINTER(c_ulong) )
else:
_urKernelSuggestMaxCooperativeGroupCount_t = CFUNCTYPE( ur_result_t, ur_kernel_handle_t, POINTER(c_ulong) )


###############################################################################
## @brief Table of Kernel functions pointers
Expand All @@ -2710,8 +2703,22 @@ class ur_kernel_dditable_t(Structure):
("pfnSetExecInfo", c_void_p), ## _urKernelSetExecInfo_t
("pfnSetArgSampler", c_void_p), ## _urKernelSetArgSampler_t
("pfnSetArgMemObj", c_void_p), ## _urKernelSetArgMemObj_t
("pfnSetSpecializationConstants", c_void_p), ## _urKernelSetSpecializationConstants_t
("pfnSuggestMaxCooperativeGroupCount", c_void_p) ## _urKernelSuggestMaxCooperativeGroupCount_t
("pfnSetSpecializationConstants", c_void_p) ## _urKernelSetSpecializationConstants_t
]

###############################################################################
## @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp
if __use_win_types:
_urKernelSuggestMaxCooperativeGroupCountExp_t = WINFUNCTYPE( ur_result_t, ur_kernel_handle_t, POINTER(c_ulong) )
else:
_urKernelSuggestMaxCooperativeGroupCountExp_t = CFUNCTYPE( ur_result_t, ur_kernel_handle_t, POINTER(c_ulong) )


###############################################################################
## @brief Table of KernelExp functions pointers
class ur_kernel_exp_dditable_t(Structure):
_fields_ = [
("pfnSuggestMaxCooperativeGroupCountExp", c_void_p) ## _urKernelSuggestMaxCooperativeGroupCountExp_t
]

###############################################################################
Expand Down Expand Up @@ -3109,13 +3116,6 @@ class ur_global_dditable_t(Structure):
else:
_urEnqueueWriteHostPipe_t = CFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_program_handle_t, c_char_p, c_bool, c_void_p, c_size_t, c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) )

###############################################################################
## @brief Function-pointer for urEnqueueCooperativeKernelLaunch
if __use_win_types:
_urEnqueueCooperativeKernelLaunch_t = WINFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) )
else:
_urEnqueueCooperativeKernelLaunch_t = CFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) )


###############################################################################
## @brief Table of Enqueue functions pointers
Expand Down Expand Up @@ -3145,8 +3145,22 @@ class ur_enqueue_dditable_t(Structure):
("pfnDeviceGlobalVariableWrite", c_void_p), ## _urEnqueueDeviceGlobalVariableWrite_t
("pfnDeviceGlobalVariableRead", c_void_p), ## _urEnqueueDeviceGlobalVariableRead_t
("pfnReadHostPipe", c_void_p), ## _urEnqueueReadHostPipe_t
("pfnWriteHostPipe", c_void_p), ## _urEnqueueWriteHostPipe_t
("pfnCooperativeKernelLaunch", c_void_p) ## _urEnqueueCooperativeKernelLaunch_t
("pfnWriteHostPipe", c_void_p) ## _urEnqueueWriteHostPipe_t
]

###############################################################################
## @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp
if __use_win_types:
_urEnqueueCooperativeKernelLaunchExp_t = WINFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) )
else:
_urEnqueueCooperativeKernelLaunchExp_t = CFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) )


###############################################################################
## @brief Table of EnqueueExp functions pointers
class ur_enqueue_exp_dditable_t(Structure):
_fields_ = [
("pfnCooperativeKernelLaunchExp", c_void_p) ## _urEnqueueCooperativeKernelLaunchExp_t
]

###############################################################################
Expand Down Expand Up @@ -3781,11 +3795,13 @@ class ur_dditable_t(Structure):
("Event", ur_event_dditable_t),
("Program", ur_program_dditable_t),
("Kernel", ur_kernel_dditable_t),
("KernelExp", ur_kernel_exp_dditable_t),
("Sampler", ur_sampler_dditable_t),
("Mem", ur_mem_dditable_t),
("PhysicalMem", ur_physical_mem_dditable_t),
("Global", ur_global_dditable_t),
("Enqueue", ur_enqueue_dditable_t),
("EnqueueExp", ur_enqueue_exp_dditable_t),
("Queue", ur_queue_dditable_t),
("BindlessImagesExp", ur_bindless_images_exp_dditable_t),
("USM", ur_usm_dditable_t),
Expand Down Expand Up @@ -3905,7 +3921,16 @@ def __init__(self, version : ur_api_version_t):
self.urKernelSetArgSampler = _urKernelSetArgSampler_t(self.__dditable.Kernel.pfnSetArgSampler)
self.urKernelSetArgMemObj = _urKernelSetArgMemObj_t(self.__dditable.Kernel.pfnSetArgMemObj)
self.urKernelSetSpecializationConstants = _urKernelSetSpecializationConstants_t(self.__dditable.Kernel.pfnSetSpecializationConstants)
self.urKernelSuggestMaxCooperativeGroupCount = _urKernelSuggestMaxCooperativeGroupCount_t(self.__dditable.Kernel.pfnSuggestMaxCooperativeGroupCount)

# call driver to get function pointers
KernelExp = ur_kernel_exp_dditable_t()
r = ur_result_v(self.__dll.urGetKernelExpProcAddrTable(version, byref(KernelExp)))
if r != ur_result_v.SUCCESS:
raise Exception(r)
self.__dditable.KernelExp = KernelExp

# attach function interface to function address
self.urKernelSuggestMaxCooperativeGroupCountExp = _urKernelSuggestMaxCooperativeGroupCountExp_t(self.__dditable.KernelExp.pfnSuggestMaxCooperativeGroupCountExp)

# call driver to get function pointers
Sampler = ur_sampler_dditable_t()
Expand Down Expand Up @@ -4000,7 +4025,16 @@ def __init__(self, version : ur_api_version_t):
self.urEnqueueDeviceGlobalVariableRead = _urEnqueueDeviceGlobalVariableRead_t(self.__dditable.Enqueue.pfnDeviceGlobalVariableRead)
self.urEnqueueReadHostPipe = _urEnqueueReadHostPipe_t(self.__dditable.Enqueue.pfnReadHostPipe)
self.urEnqueueWriteHostPipe = _urEnqueueWriteHostPipe_t(self.__dditable.Enqueue.pfnWriteHostPipe)
self.urEnqueueCooperativeKernelLaunch = _urEnqueueCooperativeKernelLaunch_t(self.__dditable.Enqueue.pfnCooperativeKernelLaunch)

# call driver to get function pointers
EnqueueExp = ur_enqueue_exp_dditable_t()
r = ur_result_v(self.__dll.urGetEnqueueExpProcAddrTable(version, byref(EnqueueExp)))
if r != ur_result_v.SUCCESS:
raise Exception(r)
self.__dditable.EnqueueExp = EnqueueExp

# attach function interface to function address
self.urEnqueueCooperativeKernelLaunchExp = _urEnqueueCooperativeKernelLaunchExp_t(self.__dditable.EnqueueExp.pfnCooperativeKernelLaunchExp)

# call driver to get function pointers
Queue = ur_queue_dditable_t()
Expand Down
20 changes: 10 additions & 10 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ typedef enum ur_function_t {
UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp
UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191, ///< Enumerator for ::urCommandBufferAppendMemBufferReadRectExp
UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp
UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH = 193, ///< Enumerator for ::urEnqueueCooperativeKernelLaunch
UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCount
UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193, ///< Enumerator for ::urEnqueueCooperativeKernelLaunchExp
UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp
/// @cond
UR_FUNCTION_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -8159,7 +8159,7 @@ urCommandBufferEnqueueExp(
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
UR_APIEXPORT ur_result_t UR_APICALL
urEnqueueCooperativeKernelLaunch(
urEnqueueCooperativeKernelLaunchExp(
ur_queue_handle_t hQueue, ///< [in] handle of the queue object
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
uint32_t workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and
Expand Down Expand Up @@ -8197,7 +8197,7 @@ urEnqueueCooperativeKernelLaunch(
/// + `NULL == pGroupCountRet`
/// - ::UR_RESULT_ERROR_INVALID_KERNEL
UR_APIEXPORT ur_result_t UR_APICALL
urKernelSuggestMaxCooperativeGroupCount(
urKernelSuggestMaxCooperativeGroupCountExp(
ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object
uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups
);
Expand Down Expand Up @@ -8971,13 +8971,13 @@ typedef struct ur_kernel_set_specialization_constants_params_t {
} ur_kernel_set_specialization_constants_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urKernelSuggestMaxCooperativeGroupCount
/// @brief Function parameters for urKernelSuggestMaxCooperativeGroupCountExp
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_kernel_suggest_max_cooperative_group_count_params_t {
typedef struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t {
ur_kernel_handle_t *phKernel;
uint32_t **ppGroupCountRet;
} ur_kernel_suggest_max_cooperative_group_count_params_t;
} ur_kernel_suggest_max_cooperative_group_count_exp_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urSamplerCreate
Expand Down Expand Up @@ -9627,10 +9627,10 @@ typedef struct ur_enqueue_write_host_pipe_params_t {
} ur_enqueue_write_host_pipe_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urEnqueueCooperativeKernelLaunch
/// @brief Function parameters for urEnqueueCooperativeKernelLaunchExp
/// @details Each entry is a pointer to the parameter passed to the function;
/// allowing the callback the ability to modify the parameter's value
typedef struct ur_enqueue_cooperative_kernel_launch_params_t {
typedef struct ur_enqueue_cooperative_kernel_launch_exp_params_t {
ur_queue_handle_t *phQueue;
ur_kernel_handle_t *phKernel;
uint32_t *pworkDim;
Expand All @@ -9640,7 +9640,7 @@ typedef struct ur_enqueue_cooperative_kernel_launch_params_t {
uint32_t *pnumEventsInWaitList;
const ur_event_handle_t **pphEventWaitList;
ur_event_handle_t **pphEvent;
} ur_enqueue_cooperative_kernel_launch_params_t;
} ur_enqueue_cooperative_kernel_launch_exp_params_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Function parameters for urQueueGetInfo
Expand Down
96 changes: 75 additions & 21 deletions include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnKernelSetSpecializationConstants_t)(
uint32_t,
const ur_specialization_constant_info_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCount
typedef ur_result_t(UR_APICALL *ur_pfnKernelSuggestMaxCooperativeGroupCount_t)(
ur_kernel_handle_t,
uint32_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of Kernel functions pointers
typedef struct ur_kernel_dditable_t {
Expand All @@ -550,7 +544,6 @@ typedef struct ur_kernel_dditable_t {
ur_pfnKernelSetArgSampler_t pfnSetArgSampler;
ur_pfnKernelSetArgMemObj_t pfnSetArgMemObj;
ur_pfnKernelSetSpecializationConstants_t pfnSetSpecializationConstants;
ur_pfnKernelSuggestMaxCooperativeGroupCount_t pfnSuggestMaxCooperativeGroupCount;
} ur_kernel_dditable_t;

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -574,6 +567,39 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetKernelProcAddrTable_t)(
ur_api_version_t,
ur_kernel_dditable_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp
typedef ur_result_t(UR_APICALL *ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t)(
ur_kernel_handle_t,
uint32_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of KernelExp functions pointers
typedef struct ur_kernel_exp_dditable_t {
ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t pfnSuggestMaxCooperativeGroupCountExp;
} ur_kernel_exp_dditable_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Exported function for filling application's KernelExp table
/// with current process' addresses
///
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_UNINITIALIZED
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION
UR_DLLEXPORT ur_result_t UR_APICALL
urGetKernelExpProcAddrTable(
ur_api_version_t version, ///< [in] API version requested
ur_kernel_exp_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urGetKernelExpProcAddrTable
typedef ur_result_t(UR_APICALL *ur_pfnGetKernelExpProcAddrTable_t)(
ur_api_version_t,
ur_kernel_exp_dditable_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urSamplerCreate
typedef ur_result_t(UR_APICALL *ur_pfnSamplerCreate_t)(
Expand Down Expand Up @@ -1202,19 +1228,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnEnqueueWriteHostPipe_t)(
const ur_event_handle_t *,
ur_event_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urEnqueueCooperativeKernelLaunch
typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCooperativeKernelLaunch_t)(
ur_queue_handle_t,
ur_kernel_handle_t,
uint32_t,
const size_t *,
const size_t *,
const size_t *,
uint32_t,
const ur_event_handle_t *,
ur_event_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of Enqueue functions pointers
typedef struct ur_enqueue_dditable_t {
Expand Down Expand Up @@ -1243,7 +1256,6 @@ typedef struct ur_enqueue_dditable_t {
ur_pfnEnqueueDeviceGlobalVariableRead_t pfnDeviceGlobalVariableRead;
ur_pfnEnqueueReadHostPipe_t pfnReadHostPipe;
ur_pfnEnqueueWriteHostPipe_t pfnWriteHostPipe;
ur_pfnEnqueueCooperativeKernelLaunch_t pfnCooperativeKernelLaunch;
} ur_enqueue_dditable_t;

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -1267,6 +1279,46 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueProcAddrTable_t)(
ur_api_version_t,
ur_enqueue_dditable_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp
typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCooperativeKernelLaunchExp_t)(
ur_queue_handle_t,
ur_kernel_handle_t,
uint32_t,
const size_t *,
const size_t *,
const size_t *,
uint32_t,
const ur_event_handle_t *,
ur_event_handle_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of EnqueueExp functions pointers
typedef struct ur_enqueue_exp_dditable_t {
ur_pfnEnqueueCooperativeKernelLaunchExp_t pfnCooperativeKernelLaunchExp;
} ur_enqueue_exp_dditable_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Exported function for filling application's EnqueueExp table
/// with current process' addresses
///
/// @returns
/// - ::UR_RESULT_SUCCESS
/// - ::UR_RESULT_ERROR_UNINITIALIZED
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION
UR_DLLEXPORT ur_result_t UR_APICALL
urGetEnqueueExpProcAddrTable(
ur_api_version_t version, ///< [in] API version requested
ur_enqueue_exp_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urGetEnqueueExpProcAddrTable
typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueExpProcAddrTable_t)(
ur_api_version_t,
ur_enqueue_exp_dditable_t *);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for urQueueGetInfo
typedef ur_result_t(UR_APICALL *ur_pfnQueueGetInfo_t)(
Expand Down Expand Up @@ -2175,11 +2227,13 @@ typedef struct ur_dditable_t {
ur_event_dditable_t Event;
ur_program_dditable_t Program;
ur_kernel_dditable_t Kernel;
ur_kernel_exp_dditable_t KernelExp;
ur_sampler_dditable_t Sampler;
ur_mem_dditable_t Mem;
ur_physical_mem_dditable_t PhysicalMem;
ur_global_dditable_t Global;
ur_enqueue_dditable_t Enqueue;
ur_enqueue_exp_dditable_t EnqueueExp;
ur_queue_dditable_t Queue;
ur_bindless_images_exp_dditable_t BindlessImagesExp;
ur_usm_dditable_t USM;
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/EXP-COOPERATIVE-KERNELS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Macros

Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ${x}EnqueueCooperativeKernelLaunch
* ${x}KernelSuggestMaxCooperativeGroupCount
* ${x}EnqueueCooperativeKernelLaunchExp
* ${x}KernelSuggestMaxCooperativeGroupCountExp

Changelog
--------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 8ac8d97

Please sign in to comment.