Skip to content

Commit

Permalink
Fixed EXP handling and removed invalid ddi table (#213)
Browse files Browse the repository at this point in the history
Signed-off-by: Neil R. Spruit <[email protected]>
  • Loading branch information
nrspruit authored Oct 8, 2024
1 parent 0bfc92d commit 38b7739
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 273 deletions.
2 changes: 1 addition & 1 deletion include/ze.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SPDX-License-Identifier: MIT
@file ze.py
@version v1.11-r1.11.0
@version v1.11-r1.11.1
"""
import platform
Expand Down
2 changes: 1 addition & 1 deletion include/ze_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*
* @file ze_api.h
* @version v1.11-r1.11.0
* @version v1.11-r1.11.1
*
*/
#ifndef _ZE_API_H
Expand Down
2 changes: 1 addition & 1 deletion include/ze_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*
* @file ze_ddi.h
* @version v1.11-r1.11.0
* @version v1.11-r1.11.1
*
*/
#ifndef _ZE_DDI_H
Expand Down
41 changes: 12 additions & 29 deletions include/zes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SPDX-License-Identifier: MIT
@file zes.py
@version v1.11-r1.11.0
@version v1.11-r1.11.1
"""
import platform
Expand Down Expand Up @@ -3833,6 +3833,13 @@ class _zes_diagnostics_dditable_t(Structure):
("pfnRunTests", c_void_p) ## _zesDiagnosticsRunTests_t
]

###############################################################################
## @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp
if __use_win_types:
_zesVFManagementGetVFCapabilitiesExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) )
else:
_zesVFManagementGetVFCapabilitiesExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) )

###############################################################################
## @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp2
if __use_win_types:
Expand All @@ -3847,22 +3854,6 @@ class _zes_diagnostics_dditable_t(Structure):
else:
_zesVFManagementGetVFEngineUtilizationExp2_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp2_t) )


###############################################################################
## @brief Table of VFManagement functions pointers
class _zes_vf_management_dditable_t(Structure):
_fields_ = [
("pfnGetVFMemoryUtilizationExp2", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp2_t
("pfnGetVFEngineUtilizationExp2", c_void_p) ## _zesVFManagementGetVFEngineUtilizationExp2_t
]

###############################################################################
## @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp
if __use_win_types:
_zesVFManagementGetVFCapabilitiesExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) )
else:
_zesVFManagementGetVFCapabilitiesExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) )

###############################################################################
## @brief Function-pointer for zesVFManagementGetVFPropertiesExp
if __use_win_types:
Expand Down Expand Up @@ -3904,6 +3895,8 @@ class _zes_vf_management_dditable_t(Structure):
class _zes_vf_management_exp_dditable_t(Structure):
_fields_ = [
("pfnGetVFCapabilitiesExp", c_void_p), ## _zesVFManagementGetVFCapabilitiesExp_t
("pfnGetVFMemoryUtilizationExp2", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp2_t
("pfnGetVFEngineUtilizationExp2", c_void_p), ## _zesVFManagementGetVFEngineUtilizationExp2_t
("pfnGetVFPropertiesExp", c_void_p), ## _zesVFManagementGetVFPropertiesExp_t
("pfnGetVFMemoryUtilizationExp", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp_t
("pfnGetVFEngineUtilizationExp", c_void_p), ## _zesVFManagementGetVFEngineUtilizationExp_t
Expand Down Expand Up @@ -3937,7 +3930,6 @@ class _zes_dditable_t(Structure):
("Ras", _zes_ras_dditable_t),
("RasExp", _zes_ras_exp_dditable_t),
("Diagnostics", _zes_diagnostics_dditable_t),
("VFManagement", _zes_vf_management_dditable_t),
("VFManagementExp", _zes_vf_management_exp_dditable_t)
]

Expand Down Expand Up @@ -4301,17 +4293,6 @@ def __init__(self, version : ze_api_version_t):
self.zesDiagnosticsGetTests = _zesDiagnosticsGetTests_t(self.__dditable.Diagnostics.pfnGetTests)
self.zesDiagnosticsRunTests = _zesDiagnosticsRunTests_t(self.__dditable.Diagnostics.pfnRunTests)

# call driver to get function pointers
_VFManagement = _zes_vf_management_dditable_t()
r = ze_result_v(self.__dll.zesGetVFManagementProcAddrTable(version, byref(_VFManagement)))
if r != ze_result_v.SUCCESS:
raise Exception(r)
self.__dditable.VFManagement = _VFManagement

# attach function interface to function address
self.zesVFManagementGetVFMemoryUtilizationExp2 = _zesVFManagementGetVFMemoryUtilizationExp2_t(self.__dditable.VFManagement.pfnGetVFMemoryUtilizationExp2)
self.zesVFManagementGetVFEngineUtilizationExp2 = _zesVFManagementGetVFEngineUtilizationExp2_t(self.__dditable.VFManagement.pfnGetVFEngineUtilizationExp2)

# call driver to get function pointers
_VFManagementExp = _zes_vf_management_exp_dditable_t()
r = ze_result_v(self.__dll.zesGetVFManagementExpProcAddrTable(version, byref(_VFManagementExp)))
Expand All @@ -4321,6 +4302,8 @@ def __init__(self, version : ze_api_version_t):

# attach function interface to function address
self.zesVFManagementGetVFCapabilitiesExp = _zesVFManagementGetVFCapabilitiesExp_t(self.__dditable.VFManagementExp.pfnGetVFCapabilitiesExp)
self.zesVFManagementGetVFMemoryUtilizationExp2 = _zesVFManagementGetVFMemoryUtilizationExp2_t(self.__dditable.VFManagementExp.pfnGetVFMemoryUtilizationExp2)
self.zesVFManagementGetVFEngineUtilizationExp2 = _zesVFManagementGetVFEngineUtilizationExp2_t(self.__dditable.VFManagementExp.pfnGetVFEngineUtilizationExp2)
self.zesVFManagementGetVFPropertiesExp = _zesVFManagementGetVFPropertiesExp_t(self.__dditable.VFManagementExp.pfnGetVFPropertiesExp)
self.zesVFManagementGetVFMemoryUtilizationExp = _zesVFManagementGetVFMemoryUtilizationExp_t(self.__dditable.VFManagementExp.pfnGetVFMemoryUtilizationExp)
self.zesVFManagementGetVFEngineUtilizationExp = _zesVFManagementGetVFEngineUtilizationExp_t(self.__dditable.VFManagementExp.pfnGetVFEngineUtilizationExp)
Expand Down
2 changes: 1 addition & 1 deletion include/zes_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*
* @file zes_api.h
* @version v1.11-r1.11.0
* @version v1.11-r1.11.1
*
*/
#ifndef _ZES_API_H
Expand Down
49 changes: 10 additions & 39 deletions include/zes_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*
* @file zes_ddi.h
* @version v1.11-r1.11.0
* @version v1.11-r1.11.1
*
*/
#ifndef _ZES_DDI_H
Expand Down Expand Up @@ -1856,6 +1856,13 @@ typedef ze_result_t (ZE_APICALL *zes_pfnGetDiagnosticsProcAddrTable_t)(
zes_diagnostics_dditable_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp
typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFCapabilitiesExp_t)(
zes_vf_handle_t,
zes_vf_exp_capabilities_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp2
typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFMemoryUtilizationExp2_t)(
Expand All @@ -1872,43 +1879,6 @@ typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFEngineUtilizationExp2_t
zes_vf_util_engine_exp2_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of VFManagement functions pointers
typedef struct _zes_vf_management_dditable_t
{
zes_pfnVFManagementGetVFMemoryUtilizationExp2_t pfnGetVFMemoryUtilizationExp2;
zes_pfnVFManagementGetVFEngineUtilizationExp2_t pfnGetVFEngineUtilizationExp2;
} zes_vf_management_dditable_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Exported function for filling application's VFManagement table
/// with current process' addresses
///
/// @returns
/// - ::ZE_RESULT_SUCCESS
/// - ::ZE_RESULT_ERROR_UNINITIALIZED
/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER
/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION
ZE_DLLEXPORT ze_result_t ZE_APICALL
zesGetVFManagementProcAddrTable(
ze_api_version_t version, ///< [in] API version requested
zes_vf_management_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zesGetVFManagementProcAddrTable
typedef ze_result_t (ZE_APICALL *zes_pfnGetVFManagementProcAddrTable_t)(
ze_api_version_t,
zes_vf_management_dditable_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp
typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFCapabilitiesExp_t)(
zes_vf_handle_t,
zes_vf_exp_capabilities_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zesVFManagementGetVFPropertiesExp
typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFPropertiesExp_t)(
Expand Down Expand Up @@ -1953,6 +1923,8 @@ typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementSetVFTelemetrySamplingInterv
typedef struct _zes_vf_management_exp_dditable_t
{
zes_pfnVFManagementGetVFCapabilitiesExp_t pfnGetVFCapabilitiesExp;
zes_pfnVFManagementGetVFMemoryUtilizationExp2_t pfnGetVFMemoryUtilizationExp2;
zes_pfnVFManagementGetVFEngineUtilizationExp2_t pfnGetVFEngineUtilizationExp2;
zes_pfnVFManagementGetVFPropertiesExp_t pfnGetVFPropertiesExp;
zes_pfnVFManagementGetVFMemoryUtilizationExp_t pfnGetVFMemoryUtilizationExp;
zes_pfnVFManagementGetVFEngineUtilizationExp_t pfnGetVFEngineUtilizationExp;
Expand Down Expand Up @@ -2009,7 +1981,6 @@ typedef struct _zes_dditable_t
zes_ras_dditable_t Ras;
zes_ras_exp_dditable_t RasExp;
zes_diagnostics_dditable_t Diagnostics;
zes_vf_management_dditable_t VFManagement;
zes_vf_management_exp_dditable_t VFManagementExp;
} zes_dditable_t;

Expand Down
22 changes: 11 additions & 11 deletions include/zet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
SPDX-License-Identifier: MIT
@file zet.py
@version v1.11-r1.11.0
@version v1.11-r1.11.1
"""
import platform
Expand Down Expand Up @@ -1220,23 +1220,22 @@ class _zet_kernel_dditable_t(Structure):
else:
_zetMetricGetProperties_t = CFUNCTYPE( ze_result_t, zet_metric_handle_t, POINTER(zet_metric_properties_t) )

###############################################################################
## @brief Function-pointer for zetMetricCreateFromProgrammableExp2
if __use_win_types:
_zetMetricCreateFromProgrammableExp2_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) )
else:
_zetMetricCreateFromProgrammableExp2_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) )


###############################################################################
## @brief Table of Metric functions pointers
class _zet_metric_dditable_t(Structure):
_fields_ = [
("pfnGet", c_void_p), ## _zetMetricGet_t
("pfnGetProperties", c_void_p), ## _zetMetricGetProperties_t
("pfnCreateFromProgrammableExp2", c_void_p) ## _zetMetricCreateFromProgrammableExp2_t
("pfnGetProperties", c_void_p) ## _zetMetricGetProperties_t
]

###############################################################################
## @brief Function-pointer for zetMetricCreateFromProgrammableExp2
if __use_win_types:
_zetMetricCreateFromProgrammableExp2_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) )
else:
_zetMetricCreateFromProgrammableExp2_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) )

###############################################################################
## @brief Function-pointer for zetMetricCreateFromProgrammableExp
if __use_win_types:
Expand All @@ -1256,6 +1255,7 @@ class _zet_metric_dditable_t(Structure):
## @brief Table of MetricExp functions pointers
class _zet_metric_exp_dditable_t(Structure):
_fields_ = [
("pfnCreateFromProgrammableExp2", c_void_p), ## _zetMetricCreateFromProgrammableExp2_t
("pfnCreateFromProgrammableExp", c_void_p), ## _zetMetricCreateFromProgrammableExp_t
("pfnDestroyExp", c_void_p) ## _zetMetricDestroyExp_t
]
Expand Down Expand Up @@ -1763,7 +1763,6 @@ def __init__(self, version : ze_api_version_t):
# attach function interface to function address
self.zetMetricGet = _zetMetricGet_t(self.__dditable.Metric.pfnGet)
self.zetMetricGetProperties = _zetMetricGetProperties_t(self.__dditable.Metric.pfnGetProperties)
self.zetMetricCreateFromProgrammableExp2 = _zetMetricCreateFromProgrammableExp2_t(self.__dditable.Metric.pfnCreateFromProgrammableExp2)

# call driver to get function pointers
_MetricExp = _zet_metric_exp_dditable_t()
Expand All @@ -1773,6 +1772,7 @@ def __init__(self, version : ze_api_version_t):
self.__dditable.MetricExp = _MetricExp

# attach function interface to function address
self.zetMetricCreateFromProgrammableExp2 = _zetMetricCreateFromProgrammableExp2_t(self.__dditable.MetricExp.pfnCreateFromProgrammableExp2)
self.zetMetricCreateFromProgrammableExp = _zetMetricCreateFromProgrammableExp_t(self.__dditable.MetricExp.pfnCreateFromProgrammableExp)
self.zetMetricDestroyExp = _zetMetricDestroyExp_t(self.__dditable.MetricExp.pfnDestroyExp)

Expand Down
2 changes: 1 addition & 1 deletion include/zet_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*
* @file zet_api.h
* @version v1.11-r1.11.0
* @version v1.11-r1.11.1
*
*/
#ifndef _ZET_API_H
Expand Down
28 changes: 14 additions & 14 deletions include/zet_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: MIT
*
* @file zet_ddi.h
* @version v1.11-r1.11.0
* @version v1.11-r1.11.1
*
*/
#ifndef _ZET_DDI_H
Expand Down Expand Up @@ -501,25 +501,12 @@ typedef ze_result_t (ZE_APICALL *zet_pfnMetricGetProperties_t)(
zet_metric_properties_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zetMetricCreateFromProgrammableExp2
typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp2_t)(
zet_metric_programmable_exp_handle_t,
uint32_t,
zet_metric_programmable_param_value_exp_t*,
const char*,
const char*,
uint32_t*,
zet_metric_handle_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Table of Metric functions pointers
typedef struct _zet_metric_dditable_t
{
zet_pfnMetricGet_t pfnGet;
zet_pfnMetricGetProperties_t pfnGetProperties;
zet_pfnMetricCreateFromProgrammableExp2_t pfnCreateFromProgrammableExp2;
} zet_metric_dditable_t;

///////////////////////////////////////////////////////////////////////////////
Expand All @@ -544,6 +531,18 @@ typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricProcAddrTable_t)(
zet_metric_dditable_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zetMetricCreateFromProgrammableExp2
typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp2_t)(
zet_metric_programmable_exp_handle_t,
uint32_t,
zet_metric_programmable_param_value_exp_t*,
const char*,
const char*,
uint32_t*,
zet_metric_handle_t*
);

///////////////////////////////////////////////////////////////////////////////
/// @brief Function-pointer for zetMetricCreateFromProgrammableExp
typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp_t)(
Expand All @@ -566,6 +565,7 @@ typedef ze_result_t (ZE_APICALL *zet_pfnMetricDestroyExp_t)(
/// @brief Table of MetricExp functions pointers
typedef struct _zet_metric_exp_dditable_t
{
zet_pfnMetricCreateFromProgrammableExp2_t pfnCreateFromProgrammableExp2;
zet_pfnMetricCreateFromProgrammableExp_t pfnCreateFromProgrammableExp;
zet_pfnMetricDestroyExp_t pfnDestroyExp;
} zet_metric_exp_dditable_t;
Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def is_class(obj):
@staticmethod
def is_experimental(obj):
try:
return True if re.search("Exp$", obj['name']) else False
return True if re.search("Exp[0-9]*$", obj['name']) else False
except:
return False

Expand Down
Loading

0 comments on commit 38b7739

Please sign in to comment.