Skip to content

Commit 3575f4a

Browse files
authored
Fix to add missing zeKernelGetExp API and header updates (#233)
Signed-off-by: Neil R. Spruit <[email protected]>
1 parent 0a681d7 commit 3575f4a

23 files changed

+390
-34
lines changed

include/layers/zel_tracing_register_cb.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,33 @@ typedef void (ZE_APICALL *ze_pfnKernelSetGlobalOffsetExpCb_t)(
14101410
void** ppTracerInstanceUserData
14111411
);
14121412

1413+
///////////////////////////////////////////////////////////////////////////////
1414+
/// @brief Callback function parameters for zeKernelGetBinaryExp
1415+
/// @details Each entry is a pointer to the parameter passed to the function;
1416+
/// allowing the callback the ability to modify the parameter's value
1417+
1418+
typedef struct _ze_kernel_get_binary_exp_params_t
1419+
{
1420+
ze_kernel_handle_t* phKernel;
1421+
size_t** ppSize;
1422+
uint8_t** ppKernelBinary;
1423+
} ze_kernel_get_binary_exp_params_t;
1424+
1425+
1426+
///////////////////////////////////////////////////////////////////////////////
1427+
/// @brief Callback function-pointer for zeKernelGetBinaryExp
1428+
/// @param[in] params Parameters passed to this instance
1429+
/// @param[in] result Return value
1430+
/// @param[in] pTracerUserData Per-Tracer user data
1431+
/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data
1432+
1433+
typedef void (ZE_APICALL *ze_pfnKernelGetBinaryExpCb_t)(
1434+
ze_kernel_get_binary_exp_params_t* params,
1435+
ze_result_t result,
1436+
void* pTracerUserData,
1437+
void** ppTracerInstanceUserData
1438+
);
1439+
14131440
///////////////////////////////////////////////////////////////////////////////
14141441
/// @brief Callback function parameters for zeKernelSchedulingHintExp
14151442
/// @details Each entry is a pointer to the parameter passed to the function;
@@ -3023,6 +3050,14 @@ zelTracerKernelSetGlobalOffsetExpRegisterCallback(
30233050
);
30243051

30253052

3053+
ZE_APIEXPORT ze_result_t ZE_APICALL
3054+
zelTracerKernelGetBinaryExpRegisterCallback(
3055+
zel_tracer_handle_t hTracer,
3056+
zel_tracer_reg_t callback_type,
3057+
ze_pfnKernelGetBinaryExpCb_t pfnGetBinaryExpCb
3058+
);
3059+
3060+
30263061
ZE_APIEXPORT ze_result_t ZE_APICALL
30273062
zelTracerDeviceReserveCacheExtRegisterCallback(
30283063
zel_tracer_handle_t hTracer,

include/ze.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
SPDX-License-Identifier: MIT
55
66
@file ze.py
7-
@version v1.11-r1.11.5
7+
@version v1.11-r1.11.8
88
99
"""
1010
import platform
@@ -5520,13 +5520,21 @@ class _ze_kernel_dditable_t(Structure):
55205520
else:
55215521
_zeKernelSchedulingHintExp_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_scheduling_hint_exp_desc_t) )
55225522

5523+
###############################################################################
5524+
## @brief Function-pointer for zeKernelGetBinaryExp
5525+
if __use_win_types:
5526+
_zeKernelGetBinaryExp_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_size_t), POINTER(c_ubyte) )
5527+
else:
5528+
_zeKernelGetBinaryExp_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_size_t), POINTER(c_ubyte) )
5529+
55235530

55245531
###############################################################################
55255532
## @brief Table of KernelExp functions pointers
55265533
class _ze_kernel_exp_dditable_t(Structure):
55275534
_fields_ = [
55285535
("pfnSetGlobalOffsetExp", c_void_p), ## _zeKernelSetGlobalOffsetExp_t
5529-
("pfnSchedulingHintExp", c_void_p) ## _zeKernelSchedulingHintExp_t
5536+
("pfnSchedulingHintExp", c_void_p), ## _zeKernelSchedulingHintExp_t
5537+
("pfnGetBinaryExp", c_void_p) ## _zeKernelGetBinaryExp_t
55305538
]
55315539

55325540
###############################################################################
@@ -6129,6 +6137,7 @@ def __init__(self, version : ze_api_version_t):
61296137
# attach function interface to function address
61306138
self.zeKernelSetGlobalOffsetExp = _zeKernelSetGlobalOffsetExp_t(self.__dditable.KernelExp.pfnSetGlobalOffsetExp)
61316139
self.zeKernelSchedulingHintExp = _zeKernelSchedulingHintExp_t(self.__dditable.KernelExp.pfnSchedulingHintExp)
6140+
self.zeKernelGetBinaryExp = _zeKernelGetBinaryExp_t(self.__dditable.KernelExp.pfnGetBinaryExp)
61326141

61336142
# call driver to get function pointers
61346143
_Sampler = _ze_sampler_dditable_t()

include/ze_api.h

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: MIT
66
*
77
* @file ze_api.h
8-
* @version v1.11-r1.11.5
8+
* @version v1.11-r1.11.8
99
*
1010
*/
1111
#ifndef _ZE_API_H
@@ -968,8 +968,9 @@ typedef enum _ze_init_flag_t
968968
/// @brief Initialize the 'oneAPI' driver(s)
969969
///
970970
/// @details
971-
/// - The application must call this function before calling any other
972-
/// function.
971+
/// - @deprecated since 1.10. Please use zeInitDrivers()
972+
/// - The application must call this function or zeInitDrivers before
973+
/// calling any other function.
973974
/// - If this function is not called then all other functions will return
974975
/// ::ZE_RESULT_ERROR_UNINITIALIZED.
975976
/// - Only one instance of each driver will be initialized per process.
@@ -999,6 +1000,10 @@ zeInit(
9991000
/// @brief Retrieves driver instances
10001001
///
10011002
/// @details
1003+
/// - @deprecated since 1.10. Please use zeInitDrivers()
1004+
/// - Usage of zeInitDrivers and zeDriverGet is mutually exclusive and
1005+
/// should not be used together. Usage of them together will result in
1006+
/// undefined behavior.
10021007
/// - A driver represents a collection of physical devices.
10031008
/// - Multiple calls to this function will return identical driver handles,
10041009
/// in the same order.
@@ -1075,20 +1080,20 @@ typedef struct _ze_init_driver_type_desc_t
10751080
///
10761081
/// @details
10771082
/// - The application must call this function or zeInit before calling any
1078-
/// other function.
1079-
/// - The application can call InitDrivers or zeInit to init the drivers on
1080-
/// the system.
1081-
/// - Calls to zeInit or InitDrivers will not alter the drivers retrieved
1082-
/// thru either api.
1083-
/// - Drivers init thru zeInit or InitDrivers will not be reInitialized once
1084-
/// init in an application. The Loader will determine if the already init
1085-
/// driver needs to be delivered to the user thru the init type flags.
1083+
/// other function. (zeInit is [Deprecated] and is replaced by
1084+
/// zeInitDrivers)
1085+
/// - Calls to zeInit[Deprecated] or InitDrivers will not alter the drivers
1086+
/// retrieved thru either api.
1087+
/// - Drivers init thru zeInit[Deprecated] or InitDrivers will not be
1088+
/// reInitialized once init in an application. The Loader will determine
1089+
/// if the already init driver needs to be delivered to the user thru the
1090+
/// init type flags.
10861091
/// - Already init Drivers will not be uninitialized if the call to
10871092
/// InitDrivers does not include that driver's type. Those init drivers
10881093
/// which don't match the init flags will not have their driver handles
10891094
/// returned to the user in that InitDrivers call.
1090-
/// - If this function or zeInit is not called, then all other functions
1091-
/// will return ::ZE_RESULT_ERROR_UNINITIALIZED.
1095+
/// - If this function or zeInit[Deprecated] is not called, then all other
1096+
/// functions will return ::ZE_RESULT_ERROR_UNINITIALIZED.
10921097
/// - Only one instance of each driver will be initialized per process.
10931098
/// - A driver represents a collection of physical devices.
10941099
/// - Multiple calls to this function will return identical driver handles,
@@ -7659,6 +7664,34 @@ typedef struct _ze_relaxed_allocation_limits_exp_desc_t
76597664
#define ZE_GET_KERNEL_BINARY_EXP_NAME "ZE_extension_kernel_binary_exp"
76607665
#endif // ZE_GET_KERNEL_BINARY_EXP_NAME
76617666

7667+
///////////////////////////////////////////////////////////////////////////////
7668+
/// @brief Retrieves kernel binary program data (ISA GEN format).
7669+
///
7670+
/// @details
7671+
/// - A valid kernel handle must be created with ::zeKernelCreate.
7672+
/// - Returns Intel Graphics Assembly (GEN ISA) format binary program data
7673+
/// for kernel handle.
7674+
/// - The application may call this function from simultaneous threads.
7675+
/// - The implementation of this function must be thread-safe.
7676+
///
7677+
/// @returns
7678+
/// - ::ZE_RESULT_SUCCESS
7679+
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
7680+
/// - ::ZE_RESULT_ERROR_DEVICE_LOST
7681+
/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY
7682+
/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY
7683+
/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE
7684+
/// + `nullptr == hKernel`
7685+
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
7686+
/// + `nullptr == pSize`
7687+
/// + `nullptr == pKernelBinary`
7688+
ZE_APIEXPORT ze_result_t ZE_APICALL
7689+
zeKernelGetBinaryExp(
7690+
ze_kernel_handle_t hKernel, ///< [in] Kernel handle.
7691+
size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary.
7692+
uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function.
7693+
);
7694+
76627695
#if !defined(__GNUC__)
76637696
#pragma endregion
76647697
#endif

include/ze_ddi.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: MIT
66
*
77
* @file ze_ddi.h
8-
* @version v1.11-r1.11.5
8+
* @version v1.11-r1.11.8
99
*
1010
*/
1111
#ifndef _ZE_DDI_H
@@ -2196,12 +2196,21 @@ typedef ze_result_t (ZE_APICALL *ze_pfnKernelSchedulingHintExp_t)(
21962196
ze_scheduling_hint_exp_desc_t*
21972197
);
21982198

2199+
///////////////////////////////////////////////////////////////////////////////
2200+
/// @brief Function-pointer for zeKernelGetBinaryExp
2201+
typedef ze_result_t (ZE_APICALL *ze_pfnKernelGetBinaryExp_t)(
2202+
ze_kernel_handle_t,
2203+
size_t*,
2204+
uint8_t*
2205+
);
2206+
21992207
///////////////////////////////////////////////////////////////////////////////
22002208
/// @brief Table of KernelExp functions pointers
22012209
typedef struct _ze_kernel_exp_dditable_t
22022210
{
22032211
ze_pfnKernelSetGlobalOffsetExp_t pfnSetGlobalOffsetExp;
22042212
ze_pfnKernelSchedulingHintExp_t pfnSchedulingHintExp;
2213+
ze_pfnKernelGetBinaryExp_t pfnGetBinaryExp;
22052214
} ze_kernel_exp_dditable_t;
22062215

22072216
///////////////////////////////////////////////////////////////////////////////

include/zes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
SPDX-License-Identifier: MIT
55
66
@file zes.py
7-
@version v1.11-r1.11.5
7+
@version v1.11-r1.11.8
88
99
"""
1010
import platform

include/zes_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: MIT
66
*
77
* @file zes_api.h
8-
* @version v1.11-r1.11.5
8+
* @version v1.11-r1.11.8
99
*
1010
*/
1111
#ifndef _ZES_API_H

include/zes_ddi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: MIT
66
*
77
* @file zes_ddi.h
8-
* @version v1.11-r1.11.5
8+
* @version v1.11-r1.11.8
99
*
1010
*/
1111
#ifndef _ZES_DDI_H

include/zet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
SPDX-License-Identifier: MIT
55
66
@file zet.py
7-
@version v1.11-r1.11.5
7+
@version v1.11-r1.11.8
88
99
"""
1010
import platform

include/zet_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: MIT
66
*
77
* @file zet_api.h
8-
* @version v1.11-r1.11.5
8+
* @version v1.11-r1.11.8
99
*
1010
*/
1111
#ifndef _ZET_API_H

include/zet_ddi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* SPDX-License-Identifier: MIT
66
*
77
* @file zet_ddi.h
8-
* @version v1.11-r1.11.5
8+
* @version v1.11-r1.11.8
99
*
1010
*/
1111
#ifndef _ZET_DDI_H

0 commit comments

Comments
 (0)