diff --git a/CHANGELOG.md b/CHANGELOG.md index 94cbaa5d..69d70e3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Level zero loader changelog +## v1.29.0 +* Update to L0 Zero Spec v1.16.24: https://oneapi-src.github.io/level-zero-spec/releases/index.html#level-zero-v1-16-24 +* fix: CONTRIBUTING.md to correct command line for updating spec +* Add to_string support support for callbacks (#463) ## v1.28.6 * Remove level-zero* (non-Canonical) package names when building DEBs with CPack * Allow pkgconfig file isntallation with Window MSI Installer diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bb46549..aedc3345 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ if(MSVC AND (MSVC_VERSION LESS 1900)) endif() # This project follows semantic versioning (https://semver.org/) -project(level-zero VERSION 1.28.6) +project(level-zero VERSION 1.29.0) include(GNUInstallDirs) find_package(Git) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 343717f8..0e126b9e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,11 +39,11 @@ To generate the code from the scripts, run the following commands: * `git checkout v1.12.15` * Generate the specification JSON file and Headers: * `cd level-zero-spec/scripts` - * `python3 ./run.py --debug '--!html' '--!rst' '--!build' --ver 1.12` + * `python3 ./run.py --debug '--!html' '--!rst' '--!build' --ver 1.16` * Copy the Headers From Spec to Loader repo * `cp level-zero-spec/include/* level-zero/include/` -* Execute the json2src script in the level-zero repo with the input.json in the specification repo with the corresponding spec version, for example: - * `./level-zero/scripts/json2src.py --ver 1.12 --api-json level-zero-spec/scripts/input.json .` +* Execute the json2src script in the level-zero repo with the input.json in the specification repo with the corresponding spec version, for example (be sure you're inside the level-zero repository folder) + * `./scripts/json2src.py --ver 1.16 --api-json ../level-zero-spec/scripts/input.json .` These scripts update the code with what would be generated in the next specification update. @@ -56,7 +56,7 @@ When releasing a new version of the Level Zero Loader, the following steps must The loader version is defined in the root [CMakeLists.txt](CMakeLists.txt) file using semantic versioning (https://semver.org/): ```cmake -project(level-zero VERSION 1.28.3) +project(level-zero VERSION 1.29.0) ``` Update the version number according to the type of changes: diff --git a/PRODUCT_GUID.txt b/PRODUCT_GUID.txt index 3449c95a..b29c23b7 100644 --- a/PRODUCT_GUID.txt +++ b/PRODUCT_GUID.txt @@ -1,2 +1,2 @@ -1.28.6 -a106cfaa-e584-4194-9651-9da17307f50b \ No newline at end of file +1.29.0 +22be7d28-d853-4d43-95c8-074d8b96fc0e \ No newline at end of file diff --git a/include/layers/zel_tracing_register_cb.h b/include/layers/zel_tracing_register_cb.h index b9b975c2..2b452e9e 100644 --- a/include/layers/zel_tracing_register_cb.h +++ b/include/layers/zel_tracing_register_cb.h @@ -808,6 +808,87 @@ typedef void (ZE_APICALL *ze_pfnDeviceGetAggregatedCopyOffloadIncrementValueCb_t void** ppTracerInstanceUserData ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeDeviceGetRuntimeRequirements +/// @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 _ze_device_get_runtime_requirements_params_t +{ + ze_device_handle_t* phDevice; + const void** ppObjDesc; + size_t** ppSize; + char** ppRequirements; +} ze_device_get_runtime_requirements_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeDeviceGetRuntimeRequirements +/// @param[in] params Parameters passed to this instance +/// @param[in] result Return value +/// @param[in] pTracerUserData Per-Tracer user data +/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data + +typedef void (ZE_APICALL *ze_pfnDeviceGetRuntimeRequirementsCb_t)( + ze_device_get_runtime_requirements_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeDeviceGetRuntimeRequirementsKey +/// @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 _ze_device_get_runtime_requirements_key_params_t +{ + ze_device_handle_t* phDevice; + const char*** ppKey; +} ze_device_get_runtime_requirements_key_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeDeviceGetRuntimeRequirementsKey +/// @param[in] params Parameters passed to this instance +/// @param[in] result Return value +/// @param[in] pTracerUserData Per-Tracer user data +/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data + +typedef void (ZE_APICALL *ze_pfnDeviceGetRuntimeRequirementsKeyCb_t)( + ze_device_get_runtime_requirements_key_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeDeviceValidateRuntimeRequirements +/// @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 _ze_device_validate_runtime_requirements_params_t +{ + ze_device_handle_t* phDevice; + const char** ppRequirements; + ze_validate_runtime_requirements_output_t** ppOut; +} ze_device_validate_runtime_requirements_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeDeviceValidateRuntimeRequirements +/// @param[in] params Parameters passed to this instance +/// @param[in] result Return value +/// @param[in] pTracerUserData Per-Tracer user data +/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data + +typedef void (ZE_APICALL *ze_pfnDeviceValidateRuntimeRequirementsCb_t)( + ze_device_validate_runtime_requirements_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceReserveCacheExt /// @details Each entry is a pointer to the parameter passed to the function; @@ -1205,6 +1286,102 @@ typedef void (ZE_APICALL *ze_pfnCommandListAppendLaunchKernelWithArgumentsCb_t)( void** ppTracerInstanceUserData ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeCommandListAppendMemoryCopyWithParameters +/// @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 _ze_command_list_append_memory_copy_with_parameters_params_t +{ + ze_command_list_handle_t* phCommandList; + void** pdstptr; + const void** psrcptr; + size_t* psize; + const void** ppNext; + ze_event_handle_t* phSignalEvent; + uint32_t* pnumWaitEvents; + ze_event_handle_t** pphWaitEvents; +} ze_command_list_append_memory_copy_with_parameters_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeCommandListAppendMemoryCopyWithParameters +/// @param[in] params Parameters passed to this instance +/// @param[in] result Return value +/// @param[in] pTracerUserData Per-Tracer user data +/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data + +typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyWithParametersCb_t)( + ze_command_list_append_memory_copy_with_parameters_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeCommandListAppendMemoryFillWithParameters +/// @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 _ze_command_list_append_memory_fill_with_parameters_params_t +{ + ze_command_list_handle_t* phCommandList; + void** pptr; + const void** ppattern; + size_t* ppattern_size; + size_t* psize; + const void** ppNext; + ze_event_handle_t* phSignalEvent; + uint32_t* pnumWaitEvents; + ze_event_handle_t** pphWaitEvents; +} ze_command_list_append_memory_fill_with_parameters_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeCommandListAppendMemoryFillWithParameters +/// @param[in] params Parameters passed to this instance +/// @param[in] result Return value +/// @param[in] pTracerUserData Per-Tracer user data +/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data + +typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryFillWithParametersCb_t)( + ze_command_list_append_memory_fill_with_parameters_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeCommandListImmediateAppendCommandListsWithParameters +/// @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 _ze_command_list_immediate_append_command_lists_with_parameters_params_t +{ + ze_command_list_handle_t* phCommandListImmediate; + uint32_t* pnumCommandLists; + ze_command_list_handle_t** pphCommandLists; + const void** ppNext; + ze_event_handle_t* phSignalEvent; + uint32_t* pnumWaitEvents; + ze_event_handle_t** pphWaitEvents; +} ze_command_list_immediate_append_command_lists_with_parameters_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeCommandListImmediateAppendCommandListsWithParameters +/// @param[in] params Parameters passed to this instance +/// @param[in] result Return value +/// @param[in] pTracerUserData Per-Tracer user data +/// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data + +typedef void (ZE_APICALL *ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t)( + ze_command_list_immediate_append_command_lists_with_parameters_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopyToMemoryExt /// @details Each entry is a pointer to the parameter passed to the function; @@ -2992,6 +3169,30 @@ zelTracerDeviceGetAggregatedCopyOffloadIncrementValueRegisterCallback( ); +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetRuntimeRequirementsRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsCb_t pfnGetRuntimeRequirementsCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetRuntimeRequirementsKeyRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsKeyCb_t pfnGetRuntimeRequirementsKeyCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceValidateRuntimeRequirementsRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceValidateRuntimeRequirementsCb_t pfnValidateRuntimeRequirementsCb + ); + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextCreateRegisterCallback( zel_tracer_handle_t hTracer, @@ -3200,6 +3401,14 @@ zelTracerCommandListAppendMemoryCopyRegisterCallback( ); +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerCommandListAppendMemoryCopyWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryCopyWithParametersCb_t pfnAppendMemoryCopyWithParametersCb + ); + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryFillRegisterCallback( zel_tracer_handle_t hTracer, @@ -3208,6 +3417,14 @@ zelTracerCommandListAppendMemoryFillRegisterCallback( ); +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerCommandListAppendMemoryFillWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryFillWithParametersCb_t pfnAppendMemoryFillWithParametersCb + ); + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, @@ -4448,6 +4665,14 @@ zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback( ); +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerCommandListImmediateAppendCommandListsWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t pfnImmediateAppendCommandListsWithParametersCb + ); + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdExpRegisterCallback( zel_tracer_handle_t hTracer, diff --git a/include/ze.py b/include/ze.py index 5e66db21..1261b8dc 100644 --- a/include/ze.py +++ b/include/ze.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file ze.py - @version v1.15-r1.15.31 + @version v1.16-r1.16.24 """ import platform @@ -104,6 +104,11 @@ class ze_image_handle_t(c_void_p): class ze_module_handle_t(c_void_p): pass +############################################################################### +## @brief Handle of driver's graph object +class ze_graph_handle_t(c_void_p): + pass + ############################################################################### ## @brief Handle of module's build log object class ze_module_build_log_handle_t(c_void_p): @@ -352,6 +357,10 @@ class ze_structure_type_v(IntEnum): PHYSICAL_MEM_PROPERTIES = 0x00020040 ## ::ze_physical_mem_properties_t DEVICE_USABLEMEM_SIZE_EXT_PROPERTIES = 0x00020041 ## ::ze_device_usablemem_size_ext_properties_t CUSTOM_PITCH_EXP_DESC = 0x00020042 ## ::ze_custom_pitch_exp_desc_t + DEVICE_COMPUTE_DOTPRODUCT_EXT_PROPERTIES = 0x00020043 ## ::ze_device_compute_dotproduct_ext_properties_t + RUNTIME_REQUIREMENTS_MODULE_DESC = 0x00020044 ## ::ze_runtime_requirements_module_desc_t + RUNTIME_REQUIREMENTS_GRAPH_DESC = 0x00020045 ## ::ze_runtime_requirements_graph_desc_t + RUNTIME_REQUIREMENTS_OUTPUT = 0x00020046 ## ::ze_validate_runtime_requirements_output_t class ze_structure_type_t(c_int): def __str__(self): @@ -535,7 +544,8 @@ class ze_api_version_v(IntEnum): _1_13 = ZE_MAKE_VERSION( 1, 13 ) ## version 1.13 _1_14 = ZE_MAKE_VERSION( 1, 14 ) ## version 1.14 _1_15 = ZE_MAKE_VERSION( 1, 15 ) ## version 1.15 - CURRENT = ZE_MAKE_VERSION( 1, 15 ) ## latest known version + _1_16 = ZE_MAKE_VERSION( 1, 16 ) ## version 1.16 + CURRENT = ZE_MAKE_VERSION( 1, 16 ) ## latest known version class ze_api_version_t(c_int): def __str__(self): @@ -544,7 +554,7 @@ def __str__(self): ############################################################################### ## @brief Current API version as a macro -ZE_API_VERSION_CURRENT_M = ZE_MAKE_VERSION( 1, 15 ) +ZE_API_VERSION_CURRENT_M = ZE_MAKE_VERSION( 1, 16 ) ############################################################################### ## @brief Maximum driver universal unique id (UUID) size in bytes @@ -577,6 +587,9 @@ class ze_ipc_property_flags_v(IntEnum): ## ::zeMemGetIpcHandle. EVENT_POOL = ZE_BIT(1) ## Supports passing event pools between processes. See ## ::zeEventPoolGetIpcHandle. + FABRIC_ACCESSIBLE = ZE_BIT(2) ## Supports creating a handle type for memory allocations and event pools + ## between processes on different physical devices connected through a + ## fabric interconnect. See ::ze_ipc_mem_handle_type_ext_desc_t. class ze_ipc_property_flags_t(c_int): def __str__(self): @@ -725,6 +738,100 @@ class ze_device_compute_properties_t(Structure): ("subGroupSizes", c_ulong * ZE_SUBGROUPSIZE_COUNT) ## [out] Size group sizes supported. ] +############################################################################### +## @brief Supported device compute dot product(dp) capability flags +class ze_device_dp_capability_flags_v(IntEnum): + DEVICE_NON_SYSTOLIC_DPA4_SIMD_ALL = ZE_BIT(0) ## Supports vector dot product instruction. + DEVICE_SYSTOLIC_DPAS_SIMD8 = ZE_BIT(1) ## Supports sytolic dot product with 8 SIMD lanes. + DEVICE_SYSTOLIC_DPAS_SIMD16 = ZE_BIT(2) ## Supports sytolic dot product with 16 SIMD lanes. + DEVICE_SYSTOLIC_BDPAS_SIMD16 = ZE_BIT(3) ## Supports sytolic dot product with block scaling support with 16 SIMD + ## lanes. + DEVICE_SYSTOLIC_DPAS_DEPTH4 = ZE_BIT(4) ## Supports 4 deep systolic for DPAS dot product + DEVICE_SYSTOLIC_DPAS_DEPTH8 = ZE_BIT(5) ## Supports 8 deep systolic for DPAS dot product + DEVICE_SYSTOLIC_BDPAS_DEPTH8 = ZE_BIT(6) ## Supports 8 deep systolic for BDPAS dot product + DEVICE_SYSTOLIC_OUTPUT_MATRIX_ROWCOUNT_UPTO8 = ZE_BIT(7) ## Supports output matrix row count upto 8 + DEVICE_SYSTOLIC_OUTPUT_MATRIX_ROWCOUNT_FIXED8 = ZE_BIT(8) ## Restricts output matrix row count to 8 + +class ze_device_dp_capability_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Supported device dot product(dp) input data types flags +class ze_device_input_data_type_flags_v(IntEnum): + DEVICE_INPUT_DATA_TYPE_NONE = ZE_BIT(0) ## No data types available for the supported dot product operation + ZE_DEVICE_INPUT_DATA_INT8_PACK4_PER_SIMD_LANE = ZE_BIT(1) ## Supports int8 data type with 4 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_INT4_PACK8_PER_SIMD_LANE = ZE_BIT(2) ## Supports int4 data type with 8 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_INT2_PACK8_PER_SIMD_LANE = ZE_BIT(3) ## Supports int2 data type with 8 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_TF32_PACK1_PER_SIMD_LANE = ZE_BIT(4) ## Supports tf32 data type with 1 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_FP16_PACK2_PER_SIMD_LANE = ZE_BIT(5) ## Supports fp16 data type with 2 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_BF16_PACK2_PER_SIMD_LANE = ZE_BIT(6) ## Supports bf16 data type with 2 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_FP8_PACK4_PER_SIMD_LANE = ZE_BIT(7) ## Supports fp8 data type with 4 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_BF8_PACK4_PER_SIMD_LANE = ZE_BIT(8) ## Supports bf8 data type with 4 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_E2M1_PACK8_PER_SIMD_LANE = ZE_BIT(9) ## Supports e2m1 data type with 8 packed data elements per SIMD lane. + DEVICE_INPUT_DATA_INT8_PACK4_PER_SIMD_LANE = ZE_BIT(10) ## Supports 8bit integer data type with 4 packed data elements per SIMD + ## lane.This is exclusively for DP4V dot product support + DEVICE_INPUT_DATA_SCALING_UINT8 = ZE_BIT(11) ## Supports uint8 data type support for scaling, exclusive to BDPAS dot + ## product support. + +class ze_device_input_data_type_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Supported device dot product(dp) output data types or accumulator +## data types flags +class ze_device_output_data_type_flags_v(IntEnum): + DEVICE_OUTPUT_DATA_INT32 = ZE_BIT(0) ## Supports signed and unsigned 32bit integer data type for output + DEVICE_OUTPUT_DATA_FP32 = ZE_BIT(1) ## Supports fp32 data type for output. + DEVICE_OUTPUT_DATA_FP16 = ZE_BIT(2) ## Supports fp16 data type for output. + DEVICE_OUTPUT_DATA_BF16 = ZE_BIT(3) ## Supports bf16 data type for output. + +class ze_device_output_data_type_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Device Compute DotProduct Property Extension Name +ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_NAME = "ZE_extension_device_compute_dotproduct_ext_properties" + +############################################################################### +## @brief Device Compute Dot product Property Extension Version(s) +class ze_device_compute_dotproduct_properties_ext_version_v(IntEnum): + _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 + CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version + +class ze_device_compute_dotproduct_properties_ext_version_t(c_int): + def __str__(self): + return str(ze_device_compute_dotproduct_properties_ext_version_v(self.value)) + + +############################################################################### +## @brief Device compute dot product capability queried using +## ::zeDeviceGetComputeProperties +class ze_device_compute_dotproduct_ext_properties_t(Structure): + _fields_ = [ + ("stype", ze_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("dp_caps", ze_device_dp_capability_flags_t), ## [out] indicates dot product capability of the device + ("dpv4_input_types", ze_device_input_data_type_flags_t), ## [out] Supported input data types when dp4v dot product capability is + ## supported. + ("dpv4_output_types", ze_device_output_data_type_flags_t), ## [out] Supported output data types when dp4v dot product capability is + ## supported. + ("dpas_input_types", ze_device_input_data_type_flags_t), ## [out] Supported input data types when dpas dot product capability is + ## supported. + ("dpas_output_types", ze_device_output_data_type_flags_t), ## [out] Supported output data types when dpas dot product capability is + ## supported. + ("bdpas_input_types", ze_device_input_data_type_flags_t), ## [out] Supported input data types when bdpas dot product capability is + ## supported. + ("bdpas_output_types", ze_device_output_data_type_flags_t) ## [out] Supported output data types when bdpas dot product capability is + ## supported. + ] + ############################################################################### ## @brief Maximum native kernel universal unique id (UUID) size in bytes ZE_MAX_NATIVE_KERNEL_UUID_SIZE = 16 @@ -999,6 +1106,55 @@ class ze_device_event_properties_t(Structure): ## ::ze_device_event_properties_flag_t. ] +############################################################################### +## @brief Describes the module for which runtime requirements are being +## gathered. This structure is accepted as pObjDesc to +## ::zeDeviceGetRuntimeRequirements. This structure requires +## ZE_extension_driver_ddi_handles to be supported by the driver. +class ze_runtime_requirements_module_desc_t(Structure): + _fields_ = [ + ("stype", ze_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("requirementsSrc", ze_module_handle_t) ## [in] Module for which the requirements are being gathered + ] + +############################################################################### +## @brief Describes the graph for which runtime requirements are being gathered. +## This structure is accepted as pObjDesc to +## ::zeDeviceGetRuntimeRequirements. This structure requires +## ZE_extension_driver_ddi_handles to be supported by the driver. +class ze_runtime_requirements_graph_desc_t(Structure): + _fields_ = [ + ("stype", ze_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("requirementsSrc", ze_graph_handle_t) ## [in] Graph for which the requirements are being gathered + ] + +############################################################################### +## @brief Result of runtime requirements validation +class ze_validate_runtime_requirements_result_v(IntEnum): + NOT_APPLICABLE = 0 ## Provided requirements are not applicable to underlying device + REQUIREMENTS_MET = 1 ## Provided requirements are met and optimal + REQUIREMENTS_MET_RECOMPILATION_ADVISABLE = 2 ## Provided requirements are met, but recompilation is advisable + REQUIREMENTS_NOT_MET = 3 ## Requirements are not met + +class ze_validate_runtime_requirements_result_t(c_int): + def __str__(self): + return str(ze_validate_runtime_requirements_result_v(self.value)) + + +############################################################################### +## @brief Output of ::zeDeviceValidateRuntimeRequirements +class ze_validate_runtime_requirements_output_t(Structure): + _fields_ = [ + ("stype", ze_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("result", ze_validate_runtime_requirements_result_t) ## [out] Result of the validation call. + ] + ############################################################################### ## @brief Supported context creation flags class ze_context_flags_v(IntEnum): @@ -1622,6 +1778,8 @@ class ze_host_mem_alloc_flags_v(IntEnum): BIAS_UNCACHED = ZE_BIT(1) ## host should not cache allocation (UC) BIAS_WRITE_COMBINED = ZE_BIT(2) ## host memory should be allocated write-combined (WC) BIAS_INITIAL_PLACEMENT = ZE_BIT(3) ## optimize shared allocation for first access on the host + MEM_READ_ONLY = ZE_BIT(4) ## device access will be read-only, mutually exclusive with + ## ::ZE_HOST_MEM_ALLOC_FLAG_BIAS_WRITE_COMBINED class ze_host_mem_alloc_flags_t(c_int): def __str__(self): @@ -3277,9 +3435,11 @@ def __str__(self): ############################################################################### ## @brief Supported IPC memory handle type flags class ze_ipc_mem_handle_type_flags_v(IntEnum): - DEFAULT = ZE_BIT(0) ## Local IPC memory handle type for use within the same machine. - FABRIC_ACCESSIBLE = ZE_BIT(1) ## Fabric accessible IPC memory handle type for use across machines via a - ## supported fabric. + DEFAULT = ZE_BIT(0) ## Local IPC memory handle type for use within the same device. This is + ## the default if no flags are specified and does not indicate if the + ## handle is shareable across devices or machines. + FABRIC_ACCESSIBLE = ZE_BIT(1) ## Fabric accessible IPC memory handle type for use across devices or + ## machines via a supported fabric. class ze_ipc_mem_handle_type_flags_t(c_int): def __str__(self): @@ -5719,6 +5879,27 @@ class _ze_driver_exp_dditable_t(Structure): else: _zeDeviceGetAggregatedCopyOffloadIncrementValue_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong) ) +############################################################################### +## @brief Function-pointer for zeDeviceGetRuntimeRequirements +if __use_win_types: + _zeDeviceGetRuntimeRequirements_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, c_void_p, POINTER(c_size_t), c_char_p ) +else: + _zeDeviceGetRuntimeRequirements_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, c_void_p, POINTER(c_size_t), c_char_p ) + +############################################################################### +## @brief Function-pointer for zeDeviceGetRuntimeRequirementsKey +if __use_win_types: + _zeDeviceGetRuntimeRequirementsKey_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_char_p) ) +else: + _zeDeviceGetRuntimeRequirementsKey_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_char_p) ) + +############################################################################### +## @brief Function-pointer for zeDeviceValidateRuntimeRequirements +if __use_win_types: + _zeDeviceValidateRuntimeRequirements_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, c_char_p, POINTER(ze_validate_runtime_requirements_output_t) ) +else: + _zeDeviceValidateRuntimeRequirements_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, c_char_p, POINTER(ze_validate_runtime_requirements_output_t) ) + ############################################################################### ## @brief Table of Device functions pointers @@ -5747,7 +5928,10 @@ class _ze_device_dditable_t(Structure): ("pfnReleaseExternalSemaphoreExt", c_void_p), ## _zeDeviceReleaseExternalSemaphoreExt_t ("pfnGetVectorWidthPropertiesExt", c_void_p), ## _zeDeviceGetVectorWidthPropertiesExt_t ("pfnSynchronize", c_void_p), ## _zeDeviceSynchronize_t - ("pfnGetAggregatedCopyOffloadIncrementValue", c_void_p) ## _zeDeviceGetAggregatedCopyOffloadIncrementValue_t + ("pfnGetAggregatedCopyOffloadIncrementValue", c_void_p), ## _zeDeviceGetAggregatedCopyOffloadIncrementValue_t + ("pfnGetRuntimeRequirements", c_void_p), ## _zeDeviceGetRuntimeRequirements_t + ("pfnGetRuntimeRequirementsKey", c_void_p), ## _zeDeviceGetRuntimeRequirementsKey_t + ("pfnValidateRuntimeRequirements", c_void_p) ## _zeDeviceValidateRuntimeRequirements_t ] ############################################################################### @@ -6165,6 +6349,27 @@ class _ze_command_queue_dditable_t(Structure): else: _zeCommandListAppendLaunchKernelWithArguments_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, ze_group_count_t, ze_group_c_size_t, **, *, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) +############################################################################### +## @brief Function-pointer for zeCommandListAppendMemoryCopyWithParameters +if __use_win_types: + _zeCommandListAppendMemoryCopyWithParameters_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, c_void_p, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) +else: + _zeCommandListAppendMemoryCopyWithParameters_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, c_void_p, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) + +############################################################################### +## @brief Function-pointer for zeCommandListAppendMemoryFillWithParameters +if __use_win_types: + _zeCommandListAppendMemoryFillWithParameters_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, c_void_p, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) +else: + _zeCommandListAppendMemoryFillWithParameters_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, c_void_p, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) + +############################################################################### +## @brief Function-pointer for zeCommandListImmediateAppendCommandListsWithParameters +if __use_win_types: + _zeCommandListImmediateAppendCommandListsWithParameters_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_command_list_handle_t), c_void_p, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) +else: + _zeCommandListImmediateAppendCommandListsWithParameters_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_command_list_handle_t), c_void_p, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) + ############################################################################### ## @brief Table of CommandList functions pointers @@ -6207,7 +6412,10 @@ class _ze_command_list_dditable_t(Structure): ("pfnAppendSignalExternalSemaphoreExt", c_void_p), ## _zeCommandListAppendSignalExternalSemaphoreExt_t ("pfnAppendWaitExternalSemaphoreExt", c_void_p), ## _zeCommandListAppendWaitExternalSemaphoreExt_t ("pfnAppendLaunchKernelWithParameters", c_void_p), ## _zeCommandListAppendLaunchKernelWithParameters_t - ("pfnAppendLaunchKernelWithArguments", c_void_p) ## _zeCommandListAppendLaunchKernelWithArguments_t + ("pfnAppendLaunchKernelWithArguments", c_void_p), ## _zeCommandListAppendLaunchKernelWithArguments_t + ("pfnAppendMemoryCopyWithParameters", c_void_p), ## _zeCommandListAppendMemoryCopyWithParameters_t + ("pfnAppendMemoryFillWithParameters", c_void_p), ## _zeCommandListAppendMemoryFillWithParameters_t + ("pfnImmediateAppendCommandListsWithParameters", c_void_p) ## _zeCommandListImmediateAppendCommandListsWithParameters_t ] ############################################################################### @@ -7380,6 +7588,9 @@ def __init__(self, version : ze_api_version_t): self.zeDeviceGetVectorWidthPropertiesExt = _zeDeviceGetVectorWidthPropertiesExt_t(self.__dditable.Device.pfnGetVectorWidthPropertiesExt) self.zeDeviceSynchronize = _zeDeviceSynchronize_t(self.__dditable.Device.pfnSynchronize) self.zeDeviceGetAggregatedCopyOffloadIncrementValue = _zeDeviceGetAggregatedCopyOffloadIncrementValue_t(self.__dditable.Device.pfnGetAggregatedCopyOffloadIncrementValue) + self.zeDeviceGetRuntimeRequirements = _zeDeviceGetRuntimeRequirements_t(self.__dditable.Device.pfnGetRuntimeRequirements) + self.zeDeviceGetRuntimeRequirementsKey = _zeDeviceGetRuntimeRequirementsKey_t(self.__dditable.Device.pfnGetRuntimeRequirementsKey) + self.zeDeviceValidateRuntimeRequirements = _zeDeviceValidateRuntimeRequirements_t(self.__dditable.Device.pfnValidateRuntimeRequirements) # call driver to get function pointers _DeviceExp = _ze_device_exp_dditable_t() @@ -7470,6 +7681,9 @@ def __init__(self, version : ze_api_version_t): self.zeCommandListAppendWaitExternalSemaphoreExt = _zeCommandListAppendWaitExternalSemaphoreExt_t(self.__dditable.CommandList.pfnAppendWaitExternalSemaphoreExt) self.zeCommandListAppendLaunchKernelWithParameters = _zeCommandListAppendLaunchKernelWithParameters_t(self.__dditable.CommandList.pfnAppendLaunchKernelWithParameters) self.zeCommandListAppendLaunchKernelWithArguments = _zeCommandListAppendLaunchKernelWithArguments_t(self.__dditable.CommandList.pfnAppendLaunchKernelWithArguments) + self.zeCommandListAppendMemoryCopyWithParameters = _zeCommandListAppendMemoryCopyWithParameters_t(self.__dditable.CommandList.pfnAppendMemoryCopyWithParameters) + self.zeCommandListAppendMemoryFillWithParameters = _zeCommandListAppendMemoryFillWithParameters_t(self.__dditable.CommandList.pfnAppendMemoryFillWithParameters) + self.zeCommandListImmediateAppendCommandListsWithParameters = _zeCommandListImmediateAppendCommandListsWithParameters_t(self.__dditable.CommandList.pfnImmediateAppendCommandListsWithParameters) # call driver to get function pointers _CommandListExp = _ze_command_list_exp_dditable_t() diff --git a/include/ze_api.h b/include/ze_api.h index 8e099801..563680ca 100644 --- a/include/ze_api.h +++ b/include/ze_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file ze_api.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZE_API_H @@ -134,6 +134,10 @@ typedef struct _ze_image_handle_t *ze_image_handle_t; /// @brief Handle of driver's module object typedef struct _ze_module_handle_t *ze_module_handle_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of driver's graph object +typedef struct _ze_graph_handle_t *ze_graph_handle_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of module's build log object typedef struct _ze_module_build_log_handle_t *ze_module_build_log_handle_t; @@ -381,6 +385,10 @@ typedef enum _ze_structure_type_t ZE_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 0x00020040, ///< ::ze_physical_mem_properties_t ZE_STRUCTURE_TYPE_DEVICE_USABLEMEM_SIZE_EXT_PROPERTIES = 0x00020041, ///< ::ze_device_usablemem_size_ext_properties_t ZE_STRUCTURE_TYPE_CUSTOM_PITCH_EXP_DESC = 0x00020042, ///< ::ze_custom_pitch_exp_desc_t + ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_DOTPRODUCT_EXT_PROPERTIES = 0x00020043,///< ::ze_device_compute_dotproduct_ext_properties_t + ZE_STRUCTURE_TYPE_RUNTIME_REQUIREMENTS_MODULE_DESC = 0x00020044, ///< ::ze_runtime_requirements_module_desc_t + ZE_STRUCTURE_TYPE_RUNTIME_REQUIREMENTS_GRAPH_DESC = 0x00020045, ///< ::ze_runtime_requirements_graph_desc_t + ZE_STRUCTURE_TYPE_RUNTIME_REQUIREMENTS_OUTPUT = 0x00020046, ///< ::ze_validate_runtime_requirements_output_t ZE_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_STRUCTURE_TYPE_* ENUMs } ze_structure_type_t; @@ -560,6 +568,10 @@ typedef struct _ze_device_thread_t ze_device_thread_t; /// @brief Forward-declare ze_device_compute_properties_t typedef struct _ze_device_compute_properties_t ze_device_compute_properties_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_device_compute_dotproduct_ext_properties_t +typedef struct _ze_device_compute_dotproduct_ext_properties_t ze_device_compute_dotproduct_ext_properties_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_native_kernel_uuid_t typedef struct _ze_native_kernel_uuid_t ze_native_kernel_uuid_t; @@ -600,6 +612,18 @@ typedef struct _ze_device_p2p_properties_t ze_device_p2p_properties_t; /// @brief Forward-declare ze_device_event_properties_t typedef struct _ze_device_event_properties_t ze_device_event_properties_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_runtime_requirements_module_desc_t +typedef struct _ze_runtime_requirements_module_desc_t ze_runtime_requirements_module_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_runtime_requirements_graph_desc_t +typedef struct _ze_runtime_requirements_graph_desc_t ze_runtime_requirements_graph_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_validate_runtime_requirements_output_t +typedef struct _ze_validate_runtime_requirements_output_t ze_validate_runtime_requirements_output_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_context_desc_t typedef struct _ze_context_desc_t ze_context_desc_t; @@ -1400,7 +1424,8 @@ typedef enum _ze_api_version_t ZE_API_VERSION_1_13 = ZE_MAKE_VERSION( 1, 13 ), ///< version 1.13 ZE_API_VERSION_1_14 = ZE_MAKE_VERSION( 1, 14 ), ///< version 1.14 ZE_API_VERSION_1_15 = ZE_MAKE_VERSION( 1, 15 ), ///< version 1.15 - ZE_API_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 15 ), ///< latest known version + ZE_API_VERSION_1_16 = ZE_MAKE_VERSION( 1, 16 ), ///< version 1.16 + ZE_API_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 16 ), ///< latest known version ZE_API_VERSION_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_API_VERSION_* ENUMs } ze_api_version_t; @@ -1408,7 +1433,7 @@ typedef enum _ze_api_version_t /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_API_VERSION_CURRENT_M /// @brief Current API version as a macro -#define ZE_API_VERSION_CURRENT_M ZE_MAKE_VERSION( 1, 15 ) +#define ZE_API_VERSION_CURRENT_M ZE_MAKE_VERSION( 1, 16 ) #endif // ZE_API_VERSION_CURRENT_M /////////////////////////////////////////////////////////////////////////////// @@ -1514,6 +1539,9 @@ typedef enum _ze_ipc_property_flag_t ///< ::zeMemGetIpcHandle. ZE_IPC_PROPERTY_FLAG_EVENT_POOL = ZE_BIT(1), ///< Supports passing event pools between processes. See ///< ::zeEventPoolGetIpcHandle. + ZE_IPC_PROPERTY_FLAG_FABRIC_ACCESSIBLE = ZE_BIT(2), ///< Supports creating a handle type for memory allocations and event pools + ///< between processes on different physical devices connected through a + ///< fabric interconnect. See ::ze_ipc_mem_handle_type_ext_desc_t. ZE_IPC_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_IPC_PROPERTY_FLAG_* ENUMs } ze_ipc_property_flag_t; @@ -2013,6 +2041,102 @@ typedef struct _ze_device_compute_properties_t } ze_device_compute_properties_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported device compute dot product(dp) capability flags +typedef uint32_t ze_device_dp_capability_flags_t; +typedef enum _ze_device_dp_capability_flag_t +{ + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_NON_SYSTOLIC_DPA4_SIMD_ALL = ZE_BIT(0), ///< Supports vector dot product instruction. + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_DPAS_SIMD8 = ZE_BIT(1), ///< Supports sytolic dot product with 8 SIMD lanes. + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_DPAS_SIMD16 = ZE_BIT(2), ///< Supports sytolic dot product with 16 SIMD lanes. + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_BDPAS_SIMD16 = ZE_BIT(3), ///< Supports sytolic dot product with block scaling support with 16 SIMD + ///< lanes. + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_DPAS_DEPTH4 = ZE_BIT(4), ///< Supports 4 deep systolic for DPAS dot product + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_DPAS_DEPTH8 = ZE_BIT(5), ///< Supports 8 deep systolic for DPAS dot product + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_BDPAS_DEPTH8 = ZE_BIT(6), ///< Supports 8 deep systolic for BDPAS dot product + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_OUTPUT_MATRIX_ROWCOUNT_UPTO8 = ZE_BIT(7), ///< Supports output matrix row count upto 8 + ZE_DEVICE_DP_CAPABILITY_FLAG_DEVICE_SYSTOLIC_OUTPUT_MATRIX_ROWCOUNT_FIXED8 = ZE_BIT(8), ///< Restricts output matrix row count to 8 + ZE_DEVICE_DP_CAPABILITY_FLAG_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_DEVICE_DP_CAPABILITY_FLAG_* ENUMs + +} ze_device_dp_capability_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported device dot product(dp) input data types flags +typedef uint32_t ze_device_input_data_type_flags_t; +typedef enum _ze_device_input_data_type_flag_t +{ + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_TYPE_NONE = ZE_BIT(0), ///< No data types available for the supported dot product operation + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_ZE_DEVICE_INPUT_DATA_INT8_PACK4_PER_SIMD_LANE = ZE_BIT(1), ///< Supports int8 data type with 4 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_INT4_PACK8_PER_SIMD_LANE = ZE_BIT(2), ///< Supports int4 data type with 8 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_INT2_PACK8_PER_SIMD_LANE = ZE_BIT(3), ///< Supports int2 data type with 8 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_TF32_PACK1_PER_SIMD_LANE = ZE_BIT(4), ///< Supports tf32 data type with 1 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_FP16_PACK2_PER_SIMD_LANE = ZE_BIT(5), ///< Supports fp16 data type with 2 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_BF16_PACK2_PER_SIMD_LANE = ZE_BIT(6), ///< Supports bf16 data type with 2 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_FP8_PACK4_PER_SIMD_LANE = ZE_BIT(7), ///< Supports fp8 data type with 4 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_BF8_PACK4_PER_SIMD_LANE = ZE_BIT(8), ///< Supports bf8 data type with 4 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_E2M1_PACK8_PER_SIMD_LANE = ZE_BIT(9), ///< Supports e2m1 data type with 8 packed data elements per SIMD lane. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_INT8_PACK4_PER_SIMD_LANE = ZE_BIT(10), ///< Supports 8bit integer data type with 4 packed data elements per SIMD + ///< lane.This is exclusively for DP4V dot product support + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_DEVICE_INPUT_DATA_SCALING_UINT8 = ZE_BIT(11),///< Supports uint8 data type support for scaling, exclusive to BDPAS dot + ///< product support. + ZE_DEVICE_INPUT_DATA_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_DEVICE_INPUT_DATA_TYPE_FLAG_* ENUMs + +} ze_device_input_data_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported device dot product(dp) output data types or accumulator +/// data types flags +typedef uint32_t ze_device_output_data_type_flags_t; +typedef enum _ze_device_output_data_type_flag_t +{ + ZE_DEVICE_OUTPUT_DATA_TYPE_FLAG_DEVICE_OUTPUT_DATA_INT32 = ZE_BIT(0), ///< Supports signed and unsigned 32bit integer data type for output + ZE_DEVICE_OUTPUT_DATA_TYPE_FLAG_DEVICE_OUTPUT_DATA_FP32 = ZE_BIT(1), ///< Supports fp32 data type for output. + ZE_DEVICE_OUTPUT_DATA_TYPE_FLAG_DEVICE_OUTPUT_DATA_FP16 = ZE_BIT(2), ///< Supports fp16 data type for output. + ZE_DEVICE_OUTPUT_DATA_TYPE_FLAG_DEVICE_OUTPUT_DATA_BF16 = ZE_BIT(3), ///< Supports bf16 data type for output. + ZE_DEVICE_OUTPUT_DATA_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_DEVICE_OUTPUT_DATA_TYPE_FLAG_* ENUMs + +} ze_device_output_data_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_NAME +/// @brief Device Compute DotProduct Property Extension Name +#define ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_NAME "ZE_extension_device_compute_dotproduct_ext_properties" +#endif // ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device Compute Dot product Property Extension Version(s) +typedef enum _ze_device_compute_dotproduct_properties_ext_version_t +{ + ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_DEVICE_COMPUTE_DOTPRODUCT_PROPERTIES_EXT_VERSION_* ENUMs + +} ze_device_compute_dotproduct_properties_ext_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device compute dot product capability queried using +/// ::zeDeviceGetComputeProperties +typedef struct _ze_device_compute_dotproduct_ext_properties_t +{ + ze_structure_type_t stype; ///< [in] type of this structure + void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + ze_device_dp_capability_flags_t dp_caps; ///< [out] indicates dot product capability of the device + ze_device_input_data_type_flags_t dpv4_input_types; ///< [out] Supported input data types when dp4v dot product capability is + ///< supported. + ze_device_output_data_type_flags_t dpv4_output_types; ///< [out] Supported output data types when dp4v dot product capability is + ///< supported. + ze_device_input_data_type_flags_t dpas_input_types; ///< [out] Supported input data types when dpas dot product capability is + ///< supported. + ze_device_output_data_type_flags_t dpas_output_types; ///< [out] Supported output data types when dpas dot product capability is + ///< supported. + ze_device_input_data_type_flags_t bdpas_input_types; ///< [out] Supported input data types when bdpas dot product capability is + ///< supported. + ze_device_output_data_type_flags_t bdpas_output_types; ///< [out] Supported output data types when bdpas dot product capability is + ///< supported. + +} ze_device_compute_dotproduct_ext_properties_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves compute properties of the device. /// @@ -2831,6 +2955,180 @@ zeDeviceGetAggregatedCopyOffloadIncrementValue( uint32_t* incrementValue ///< [out] increment value that can be used for Event creation ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes the module for which runtime requirements are being +/// gathered. This structure is accepted as pObjDesc to +/// ::zeDeviceGetRuntimeRequirements. This structure requires +/// ZE_extension_driver_ddi_handles to be supported by the driver. +typedef struct _ze_runtime_requirements_module_desc_t +{ + ze_structure_type_t stype; ///< [in] type of this structure + const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + ze_module_handle_t requirementsSrc; ///< [in] Module for which the requirements are being gathered + +} ze_runtime_requirements_module_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes the graph for which runtime requirements are being gathered. +/// This structure is accepted as pObjDesc to +/// ::zeDeviceGetRuntimeRequirements. This structure requires +/// ZE_extension_driver_ddi_handles to be supported by the driver. +typedef struct _ze_runtime_requirements_graph_desc_t +{ + ze_structure_type_t stype; ///< [in] type of this structure + const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + ze_graph_handle_t requirementsSrc; ///< [in] Graph for which the requirements are being gathered + +} ze_runtime_requirements_graph_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Gathers null-terminated plain text representation of runtime +/// requirements for provided object. +/// +/// @details +/// - To gather requirements for a given object (e.g. an L0 module or +/// graph), pObjDesc must point to a structure (e.g. +/// ::ze_runtime_requirements_module_desc_t or +/// ::ze_runtime_requirements_graph_desc_t) describing object for which +/// the requirements are being retrieved. +/// - Requirements are copied to user-provided memory pointed to by +/// pRequirements and pSize is set to represent the actual written length +/// of the requirements string in bytes. +/// - The caller can pass nullptr for pRequirements when querying only for +/// size. +/// - The application may call this function from simultaneous threads. +/// +/// @returns +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pObjDesc` +/// + `nullptr == pSize` +/// + (nullptr != pRequirements) && (nullptr == pSize). +/// + (nullptr != pRequirements) && (*pSize < requiredSize). +/// - ::ZE_RESULT_SUCCESS +/// + Successfully gathered requirements for provided source (e.g. module). +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + Provided hDevice handle is invalid +/// + pObjDesc doesn't point to a structure that describes a supported object for which the requirements can be gathered. +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves requirements producer key. +/// +/// @details +/// - Retrieves null-terminated plain text that represents the producer of +/// requirements (Example string: 'INTEL.L0.GPU'). +/// - Useful for bookkeeping of the requirements on user side. +/// +/// @returns +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pKey` +/// + (nullptr == pKey). +/// - ::ZE_RESULT_SUCCESS +/// + Successfully retrieved the key. +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Result of runtime requirements validation +typedef enum _ze_validate_runtime_requirements_result_t +{ + ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_NOT_APPLICABLE = 0, ///< Provided requirements are not applicable to underlying device + ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_REQUIREMENTS_MET = 1, ///< Provided requirements are met and optimal + ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_REQUIREMENTS_MET_RECOMPILATION_ADVISABLE = 2, ///< Provided requirements are met, but recompilation is advisable + ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_REQUIREMENTS_NOT_MET = 3, ///< Requirements are not met + ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_VALIDATE_RUNTIME_REQUIREMENTS_RESULT_* ENUMs + +} ze_validate_runtime_requirements_result_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Output of ::zeDeviceValidateRuntimeRequirements +typedef struct _ze_validate_runtime_requirements_output_t +{ + ze_structure_type_t stype; ///< [in] type of this structure + void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + ze_validate_runtime_requirements_result_t result; ///< [out] Result of the validation call. + +} ze_validate_runtime_requirements_output_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Validates runtime requirements. +/// +/// @details +/// - To validate existing requirements (e.g. cached from previous runs), +/// requirements string should be passed as pRequirements. +/// +/// @returns +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pRequirements` +/// + `nullptr == pOut` +/// + (nullptr == pRequirements). +/// + (nullptr == pOut). +/// - ::ZE_RESULT_SUCCESS +/// + Validation call succeeded and result of the validation is available in pOut. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + Provided hDevice handle is invalid +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ); + #if !defined(__GNUC__) #pragma endregion #endif @@ -4060,6 +4358,67 @@ zeCommandListAppendMemoryCopy( ///< on before launching ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Copies host, device, or shared memory with additional parameters. +/// +/// @details +/// - The application must ensure the memory pointed to by dstptr and srcptr +/// is accessible by the device on which the command list was created. +/// - The implementation must not access the memory pointed to by dstptr and +/// srcptr as they are free to be modified by either the Host or device up +/// until execution. +/// - The application must ensure the events are accessible by the device on +/// which the command list was created. +/// - The application must ensure the command list and events were created, +/// and the memory was allocated, on the same context. +/// - The application must **not** call this function from simultaneous +/// threads with the same command list handle. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueCopyBuffer** +/// - **clEnqueueReadBuffer** +/// - **clEnqueueWriteBuffer** +/// - **clEnqueueSVMMemcpy** +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hCommandList` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == dstptr` +/// + `nullptr == srcptr` +/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT +/// - ::ZE_RESULT_ERROR_INVALID_SIZE +/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + an extension passed via pNext is not supported +ZE_APIEXPORT ze_result_t ZE_APICALL +zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Initializes host, device, or shared memory. /// @@ -4125,6 +4484,73 @@ zeCommandListAppendMemoryFill( ///< on before launching ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Initializes host, device, or shared memory with additional parameters. +/// +/// @details +/// - The application must ensure the memory pointed to by ptr is accessible +/// by the device on which the command list was created. +/// - The implementation must not access the memory pointed to by ptr as it +/// is free to be modified by either the Host or device up until +/// execution. +/// - The ptr must be aligned to pattern_size. +/// - The value to initialize memory to is described by the pattern and the +/// pattern size. +/// - The pattern size must be a power-of-two and less than or equal to the +/// `maxMemoryFillPatternSize` member of +/// ::ze_command_queue_group_properties_t. +/// - The application must ensure the events are accessible by the device on +/// which the command list was created. +/// - The application must ensure the command list and events were created, +/// and the memory was allocated, on the same context. +/// - The application must **not** call this function from simultaneous +/// threads with the same command list handle. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueFillBuffer** +/// - **clEnqueueSVMMemFill** +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hCommandList` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == ptr` +/// + `nullptr == pattern` +/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT +/// - ::ZE_RESULT_ERROR_INVALID_SIZE +/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + an extension passed via pNext is not supported +ZE_APIEXPORT ze_result_t ZE_APICALL +zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Copy region descriptor typedef struct _ze_copy_region_t @@ -6400,6 +6826,8 @@ typedef enum _ze_host_mem_alloc_flag_t ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< host should not cache allocation (UC) ZE_HOST_MEM_ALLOC_FLAG_BIAS_WRITE_COMBINED = ZE_BIT(2), ///< host memory should be allocated write-combined (WC) ZE_HOST_MEM_ALLOC_FLAG_BIAS_INITIAL_PLACEMENT = ZE_BIT(3), ///< optimize shared allocation for first access on the host + ZE_HOST_MEM_ALLOC_FLAG_MEM_READ_ONLY = ZE_BIT(4), ///< device access will be read-only, mutually exclusive with + ///< ::ZE_HOST_MEM_ALLOC_FLAG_BIAS_WRITE_COMBINED ZE_HOST_MEM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_HOST_MEM_ALLOC_FLAG_* ENUMs } ze_host_mem_alloc_flag_t; @@ -6461,7 +6889,7 @@ typedef struct _ze_host_mem_alloc_desc_t /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < device_desc->flags` -/// + `0xf < host_desc->flags` +/// + `0x1f < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` @@ -6567,7 +6995,7 @@ zeMemAllocDevice( /// + `nullptr == host_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0xf < host_desc->flags` +/// + `0x1f < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` @@ -7537,10 +7965,10 @@ zeModuleGetNativeBinary( /// @brief Retrieve global variable pointer from Module. /// /// @details -/// - The application may query global pointer from any module that either -/// exports or imports it. -/// - The application must dynamically link a module that imports a global -/// before the global pointer can be queried from it. +/// - For modules created from SPIR-V the interpretation of `pGlobalName` is +/// described in the SPIR-V programming guide. +/// - For native modules not created from SPIR-V the interpretation of +/// `pGlobalName` is implementation defined. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// @@ -11231,7 +11659,7 @@ typedef struct _ze_external_memmap_sysmem_ext_desc_t ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). - const void* pSystemMemory; ///< [in] system memory pointer to map; must be page-aligned. + void* pSystemMemory; ///< [in] system memory pointer to map; must be page-aligned. uint64_t size; ///< [in] size of the system memory to map; must be page-aligned. } ze_external_memmap_sysmem_ext_desc_t; @@ -11432,9 +11860,11 @@ typedef enum _ze_ipc_mem_handle_type_ext_version_t typedef uint32_t ze_ipc_mem_handle_type_flags_t; typedef enum _ze_ipc_mem_handle_type_flag_t { - ZE_IPC_MEM_HANDLE_TYPE_FLAG_DEFAULT = ZE_BIT(0), ///< Local IPC memory handle type for use within the same machine. - ZE_IPC_MEM_HANDLE_TYPE_FLAG_FABRIC_ACCESSIBLE = ZE_BIT(1), ///< Fabric accessible IPC memory handle type for use across machines via a - ///< supported fabric. + ZE_IPC_MEM_HANDLE_TYPE_FLAG_DEFAULT = ZE_BIT(0), ///< Local IPC memory handle type for use within the same device. This is + ///< the default if no flags are specified and does not indicate if the + ///< handle is shareable across devices or machines. + ZE_IPC_MEM_HANDLE_TYPE_FLAG_FABRIC_ACCESSIBLE = ZE_BIT(1), ///< Fabric accessible IPC memory handle type for use across devices or + ///< machines via a supported fabric. ZE_IPC_MEM_HANDLE_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZE_IPC_MEM_HANDLE_TYPE_FLAG_* ENUMs } ze_ipc_mem_handle_type_flag_t; @@ -12824,7 +13254,7 @@ typedef struct _ze_memory_free_ext_desc_t /// /// @details /// - Similar to zeMemFree, with added parameter to choose the free policy. -/// - Does not guarantee memory is freed upon return. See free policy +/// - Does not gaurantee memory is freed upon return. See free policy /// descriptions for details. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. @@ -15068,6 +15498,8 @@ typedef enum _ze_immediate_command_list_append_exp_version_t /// @brief Appends command lists to dispatch from an immediate command list. /// /// @details +/// - @deprecated since 1.16. Please use +/// ::zeCommandListImmediateAppendCommandListsWithParameters. /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - The command lists passed to this function in the `phCommandLists` @@ -15110,6 +15542,55 @@ zeCommandListImmediateAppendCommandListsExp( ///< of any appended command list(s) ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Appends command lists to dispatch from an immediate command list with +/// additional parameters. +/// +/// @details +/// - The application must call this function only with command lists +/// created with ::zeCommandListCreateImmediate. +/// - The command lists passed to this function in the `phCommandLists` +/// argument must be regular command lists (i.e. not immediate command +/// lists). +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hCommandListImmediate` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phCommandLists` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + an extension passed via pNext is not supported +ZE_APIEXPORT ze_result_t ZE_APICALL +zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ); + #if !defined(__GNUC__) #pragma endregion #endif diff --git a/include/ze_ddi.h b/include/ze_ddi.h index 9d279007..f971a97d 100644 --- a/include/ze_ddi.h +++ b/include/ze_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file ze_ddi.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZE_DDI_H @@ -647,6 +647,30 @@ typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetAggregatedCopyOffloadIncrementVa uint32_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeDeviceGetRuntimeRequirements +typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetRuntimeRequirements_t)( + ze_device_handle_t, + const void*, + size_t*, + char* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeDeviceGetRuntimeRequirementsKey +typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetRuntimeRequirementsKey_t)( + ze_device_handle_t, + const char** + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeDeviceValidateRuntimeRequirements +typedef ze_result_t (ZE_APICALL *ze_pfnDeviceValidateRuntimeRequirements_t)( + ze_device_handle_t, + const char*, + ze_validate_runtime_requirements_output_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device functions pointers typedef struct _ze_device_dditable_t @@ -675,6 +699,9 @@ typedef struct _ze_device_dditable_t ze_pfnDeviceGetVectorWidthPropertiesExt_t pfnGetVectorWidthPropertiesExt; ze_pfnDeviceSynchronize_t pfnSynchronize; ze_pfnDeviceGetAggregatedCopyOffloadIncrementValue_t pfnGetAggregatedCopyOffloadIncrementValue; + ze_pfnDeviceGetRuntimeRequirements_t pfnGetRuntimeRequirements; + ze_pfnDeviceGetRuntimeRequirementsKey_t pfnGetRuntimeRequirementsKey; + ze_pfnDeviceValidateRuntimeRequirements_t pfnValidateRuntimeRequirements; } ze_device_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -1311,6 +1338,45 @@ typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendLaunchKernelWithArgument ze_event_handle_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeCommandListAppendMemoryCopyWithParameters +typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyWithParameters_t)( + ze_command_list_handle_t, + void*, + const void*, + size_t, + const void*, + ze_event_handle_t, + uint32_t, + ze_event_handle_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeCommandListAppendMemoryFillWithParameters +typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryFillWithParameters_t)( + ze_command_list_handle_t, + void*, + const void*, + size_t, + size_t, + const void*, + ze_event_handle_t, + uint32_t, + ze_event_handle_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeCommandListImmediateAppendCommandListsWithParameters +typedef ze_result_t (ZE_APICALL *ze_pfnCommandListImmediateAppendCommandListsWithParameters_t)( + ze_command_list_handle_t, + uint32_t, + ze_command_list_handle_t*, + const void*, + ze_event_handle_t, + uint32_t, + ze_event_handle_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandList functions pointers typedef struct _ze_command_list_dditable_t @@ -1353,6 +1419,9 @@ typedef struct _ze_command_list_dditable_t ze_pfnCommandListAppendWaitExternalSemaphoreExt_t pfnAppendWaitExternalSemaphoreExt; ze_pfnCommandListAppendLaunchKernelWithParameters_t pfnAppendLaunchKernelWithParameters; ze_pfnCommandListAppendLaunchKernelWithArguments_t pfnAppendLaunchKernelWithArguments; + ze_pfnCommandListAppendMemoryCopyWithParameters_t pfnAppendMemoryCopyWithParameters; + ze_pfnCommandListAppendMemoryFillWithParameters_t pfnAppendMemoryFillWithParameters; + ze_pfnCommandListImmediateAppendCommandListsWithParameters_t pfnImmediateAppendCommandListsWithParameters; } ze_command_list_dditable_t; /////////////////////////////////////////////////////////////////////////////// diff --git a/include/ze_ddi_common.h b/include/ze_ddi_common.h index 33a3db20..9ad89691 100644 --- a/include/ze_ddi_common.h +++ b/include/ze_ddi_common.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file ze_ddi_common.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZE_DDI_COMMON_H diff --git a/include/zer.py b/include/zer.py index 5d34a18a..3ac7396a 100644 --- a/include/zer.py +++ b/include/zer.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zer.py - @version v1.15-r1.15.31 + @version v1.16-r1.16.24 """ import platform diff --git a/include/zer_api.h b/include/zer_api.h index 87c7ffcc..2db3de35 100644 --- a/include/zer_api.h +++ b/include/zer_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zer_api.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZER_API_H diff --git a/include/zer_ddi.h b/include/zer_ddi.h index bdb1dfbc..094bdb5f 100644 --- a/include/zer_ddi.h +++ b/include/zer_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zer_ddi.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZER_DDI_H diff --git a/include/zes.py b/include/zes.py index a8a4e841..d46221da 100644 --- a/include/zes.py +++ b/include/zes.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zes.py - @version v1.15-r1.15.31 + @version v1.16-r1.16.24 """ import platform @@ -172,6 +172,8 @@ class zes_structure_type_v(IntEnum): DEVICE_ECC_DEFAULT_PROPERTIES_EXT = 0x00020012 ## ::zes_device_ecc_default_properties_ext_t PCI_LINK_SPEED_DOWNGRADE_EXT_STATE = 0x00020013 ## ::zes_pci_link_speed_downgrade_ext_state_t PCI_LINK_SPEED_DOWNGRADE_EXT_PROPERTIES = 0x00020014 ## ::zes_pci_link_speed_downgrade_ext_properties_t + RAS_STATE_EXP2 = 0x00020015 ## ::zes_ras_state_exp2_t + RAS_CONFIG_EXP = 0x00020016 ## ::zes_ras_config_exp_t class zes_structure_type_t(c_int): def __str__(self): @@ -1550,6 +1552,7 @@ class zes_mem_type_v(IntEnum): GDDR6 = 17 ## GDDR6 memory GDDR6X = 18 ## GDDR6X memory GDDR7 = 19 ## GDDR7 memory + LPDDR5X = 20 ## LPDDR5X memory class zes_mem_type_t(c_int): def __str__(self): @@ -1620,9 +1623,8 @@ class zes_mem_state_t(Structure): ## `physicalSize` member of ::zes_mem_properties_t). *DEPRECATED* ## This member can no longer track the allocatable memory reliably. ## Clients depending on this information can use the - ## zeDeviceGetMemoryProperties with - ## ze_device_usablemem_size_ext_properties_t extention to get information - ## of the available usable memory. + ## zeDeviceGetProperties with ze_device_usablemem_size_ext_properties_t + ## extention to get information of the available usable memory. ] ############################################################################### @@ -2332,7 +2334,8 @@ class zes_engine_ext_properties_t(Structure): ## @brief RAS Get State Extension Version(s) class zes_ras_state_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 - CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version + _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 + CURRENT = ZE_MAKE_VERSION( 1, 1 ) ## latest known version class zes_ras_state_exp_version_t(c_int): def __str__(self): @@ -2342,20 +2345,24 @@ def __str__(self): ############################################################################### ## @brief RAS error categories class zes_ras_error_category_exp_v(IntEnum): - RESET = 0 ## The number of accelerator engine resets attempted by the driver + RESET = 0 ## The number of accelerator engine resets attempted by the driver. PROGRAMMING_ERRORS = 1 ## The number of hardware exceptions generated by the way workloads have - ## programmed the hardware - DRIVER_ERRORS = 2 ## The number of low level driver communication errors have occurred + ## programmed the hardware. + DRIVER_ERRORS = 2 ## The number of low level driver communication errors have occurred. COMPUTE_ERRORS = 3 ## The number of errors that have occurred in the compute accelerator ## hardware NON_COMPUTE_ERRORS = 4 ## The number of errors that have occurred in the fixed-function - ## accelerator hardware + ## accelerator hardware. CACHE_ERRORS = 5 ## The number of errors that have occurred in caches (L1/L3/register - ## file/shared local memory/sampler) - DISPLAY_ERRORS = 6 ## The number of errors that have occurred in the display - MEMORY_ERRORS = 7 ## The number of errors that have occurred in Memory - SCALE_ERRORS = 8 ## The number of errors that have occurred in Scale Fabric - L3FABRIC_ERRORS = 9 ## The number of errors that have occurred in L3 Fabric + ## file/shared local memory/sampler). + DISPLAY_ERRORS = 6 ## The number of errors that have occurred in the display. + MEMORY_ERRORS = 7 ## The number of errors that have occurred in Memory Subsystem. + SCALE_ERRORS = 8 ## The number of errors that have occurred in Scale Fabric. + L3FABRIC_ERRORS = 9 ## The number of errors that have occurred in L3 Fabric. + PCIE_ERRORS = 10 ## The number of errors that have occurred in the PCIe subsystem + FABRIC_ERRORS = 11 ## The number of errors that have occurred in the Fabric interconnect in + ## the SOC + SOC_INTERNAL_ERRORS = 12 ## The number of errors that have occurred in the SOC internal components class zes_ras_error_category_exp_t(c_int): def __str__(self): @@ -2371,6 +2378,29 @@ class zes_ras_state_exp_t(Structure): ("errorCounter", c_ulonglong) ## [out] Current value of RAS counter for specific error category. ] +############################################################################### +## @brief Extension structure for providing RAS error counters +class zes_ras_state_exp2_t(Structure): + _fields_ = [ + ("stype", zes_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("errorCounter", c_ulonglong) ## [out] Current value of RAS counter for the corresponding error + ## category. + ] + +############################################################################### +## @brief RAS error configuration for per-category threshold management +class zes_ras_config_exp_t(Structure): + _fields_ = [ + ("stype", zes_structure_type_t), ## [in] type of this structure + ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific + ## structure (i.e. contains stype and pNext). + ("category", zes_ras_error_category_exp_t), ## [in] RAS error category for which threshold is being configured. + ("threshold", c_ulonglong) ## [in,out] Error count threshold to trigger RAS events. A value of 0 + ## disables event triggering for this category. + ] + ############################################################################### ## @brief Memory State Extension Name ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME = "ZES_extension_mem_state" @@ -3300,6 +3330,27 @@ class _zes_performance_factor_dditable_t(Structure): else: _zesPowerSetLimitsExt_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(zes_power_limit_ext_desc_t) ) +############################################################################### +## @brief Function-pointer for zesPowerGetUsage +if __use_win_types: + _zesPowerGetUsage_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(c_ulong) ) +else: + _zesPowerGetUsage_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(c_ulong) ) + +############################################################################### +## @brief Function-pointer for zesPowerGetLimitsExt2 +if __use_win_types: + _zesPowerGetLimitsExt2_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong) ) +else: + _zesPowerGetLimitsExt2_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong) ) + +############################################################################### +## @brief Function-pointer for zesPowerSetLimitsExt2 +if __use_win_types: + _zesPowerSetLimitsExt2_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, c_ulong ) +else: + _zesPowerSetLimitsExt2_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, c_ulong ) + ############################################################################### ## @brief Table of Power functions pointers @@ -3312,7 +3363,10 @@ class _zes_power_dditable_t(Structure): ("pfnGetEnergyThreshold", c_void_p), ## _zesPowerGetEnergyThreshold_t ("pfnSetEnergyThreshold", c_void_p), ## _zesPowerSetEnergyThreshold_t ("pfnGetLimitsExt", c_void_p), ## _zesPowerGetLimitsExt_t - ("pfnSetLimitsExt", c_void_p) ## _zesPowerSetLimitsExt_t + ("pfnSetLimitsExt", c_void_p), ## _zesPowerSetLimitsExt_t + ("pfnGetUsage", c_void_p), ## _zesPowerGetUsage_t + ("pfnGetLimitsExt2", c_void_p), ## _zesPowerGetLimitsExt2_t + ("pfnSetLimitsExt2", c_void_p) ## _zesPowerSetLimitsExt2_t ] ############################################################################### @@ -3893,13 +3947,45 @@ class _zes_ras_dditable_t(Structure): else: _zesRasClearStateExp_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, zes_ras_error_category_exp_t ) +############################################################################### +## @brief Function-pointer for zesRasGetSupportedCategoriesExp +if __use_win_types: + _zesRasGetSupportedCategoriesExp_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(c_ulong), POINTER(zes_ras_error_category_exp_t) ) +else: + _zesRasGetSupportedCategoriesExp_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(c_ulong), POINTER(zes_ras_error_category_exp_t) ) + +############################################################################### +## @brief Function-pointer for zesRasGetStateExp2 +if __use_win_types: + _zesRasGetStateExp2_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, c_ulong, POINTER(zes_ras_error_category_exp_t), POINTER(zes_ras_state_exp2_t) ) +else: + _zesRasGetStateExp2_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, c_ulong, POINTER(zes_ras_error_category_exp_t), POINTER(zes_ras_state_exp2_t) ) + +############################################################################### +## @brief Function-pointer for zesRasGetConfigExp +if __use_win_types: + _zesRasGetConfigExp_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, c_ulong, POINTER(zes_ras_config_exp_t) ) +else: + _zesRasGetConfigExp_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, c_ulong, POINTER(zes_ras_config_exp_t) ) + +############################################################################### +## @brief Function-pointer for zesRasSetConfigExp +if __use_win_types: + _zesRasSetConfigExp_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, c_ulong, POINTER(zes_ras_config_exp_t) ) +else: + _zesRasSetConfigExp_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, c_ulong, POINTER(zes_ras_config_exp_t) ) + ############################################################################### ## @brief Table of RasExp functions pointers class _zes_ras_exp_dditable_t(Structure): _fields_ = [ ("pfnGetStateExp", c_void_p), ## _zesRasGetStateExp_t - ("pfnClearStateExp", c_void_p) ## _zesRasClearStateExp_t + ("pfnClearStateExp", c_void_p), ## _zesRasClearStateExp_t + ("pfnGetSupportedCategoriesExp", c_void_p), ## _zesRasGetSupportedCategoriesExp_t + ("pfnGetStateExp2", c_void_p), ## _zesRasGetStateExp2_t + ("pfnGetConfigExp", c_void_p), ## _zesRasGetConfigExp_t + ("pfnSetConfigExp", c_void_p) ## _zesRasSetConfigExp_t ] ############################################################################### @@ -4210,6 +4296,9 @@ def __init__(self, version : ze_api_version_t): self.zesPowerSetEnergyThreshold = _zesPowerSetEnergyThreshold_t(self.__dditable.Power.pfnSetEnergyThreshold) self.zesPowerGetLimitsExt = _zesPowerGetLimitsExt_t(self.__dditable.Power.pfnGetLimitsExt) self.zesPowerSetLimitsExt = _zesPowerSetLimitsExt_t(self.__dditable.Power.pfnSetLimitsExt) + self.zesPowerGetUsage = _zesPowerGetUsage_t(self.__dditable.Power.pfnGetUsage) + self.zesPowerGetLimitsExt2 = _zesPowerGetLimitsExt2_t(self.__dditable.Power.pfnGetLimitsExt2) + self.zesPowerSetLimitsExt2 = _zesPowerSetLimitsExt2_t(self.__dditable.Power.pfnSetLimitsExt2) # call driver to get function pointers _Frequency = _zes_frequency_dditable_t() @@ -4389,6 +4478,10 @@ def __init__(self, version : ze_api_version_t): # attach function interface to function address self.zesRasGetStateExp = _zesRasGetStateExp_t(self.__dditable.RasExp.pfnGetStateExp) self.zesRasClearStateExp = _zesRasClearStateExp_t(self.__dditable.RasExp.pfnClearStateExp) + self.zesRasGetSupportedCategoriesExp = _zesRasGetSupportedCategoriesExp_t(self.__dditable.RasExp.pfnGetSupportedCategoriesExp) + self.zesRasGetStateExp2 = _zesRasGetStateExp2_t(self.__dditable.RasExp.pfnGetStateExp2) + self.zesRasGetConfigExp = _zesRasGetConfigExp_t(self.__dditable.RasExp.pfnGetConfigExp) + self.zesRasSetConfigExp = _zesRasSetConfigExp_t(self.__dditable.RasExp.pfnSetConfigExp) # call driver to get function pointers _Diagnostics = _zes_diagnostics_dditable_t() diff --git a/include/zes_api.h b/include/zes_api.h index d65d3e54..414e37cb 100644 --- a/include/zes_api.h +++ b/include/zes_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zes_api.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZES_API_H @@ -165,6 +165,8 @@ typedef enum _zes_structure_type_t ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT = 0x00020012, ///< ::zes_device_ecc_default_properties_ext_t ZES_STRUCTURE_TYPE_PCI_LINK_SPEED_DOWNGRADE_EXT_STATE = 0x00020013, ///< ::zes_pci_link_speed_downgrade_ext_state_t ZES_STRUCTURE_TYPE_PCI_LINK_SPEED_DOWNGRADE_EXT_PROPERTIES = 0x00020014,///< ::zes_pci_link_speed_downgrade_ext_properties_t + ZES_STRUCTURE_TYPE_RAS_STATE_EXP2 = 0x00020015, ///< ::zes_ras_state_exp2_t + ZES_STRUCTURE_TYPE_RAS_CONFIG_EXP = 0x00020016, ///< ::zes_ras_config_exp_t ZES_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZES_STRUCTURE_TYPE_* ENUMs } zes_structure_type_t; @@ -539,6 +541,14 @@ typedef struct _zes_engine_ext_properties_t zes_engine_ext_properties_t; /// @brief Forward-declare zes_ras_state_exp_t typedef struct _zes_ras_state_exp_t zes_ras_state_exp_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zes_ras_state_exp2_t +typedef struct _zes_ras_state_exp2_t zes_ras_state_exp2_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zes_ras_config_exp_t +typedef struct _zes_ras_config_exp_t zes_ras_config_exp_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_page_offline_state_exp_t typedef struct _zes_mem_page_offline_state_exp_t zes_mem_page_offline_state_exp_t; @@ -605,9 +615,10 @@ typedef enum _zes_init_flag_t /// @brief Initialize 'oneAPI' System Resource Management (sysman) /// /// @details -/// - The application must call this function or ::zeInit with the -/// `ZES_ENABLE_SYSMAN` environment variable set before calling any other -/// sysman function. +/// - The application must call zesInit() before calling any other sysman +/// function. +/// - The `ZES_ENABLE_SYSMAN` environment variable method of initialization +/// is deprecated. Applications should use zesInit() instead. /// - If this function is not called then all other sysman functions will /// return ::ZE_RESULT_ERROR_UNINITIALIZED. /// - This function will only initialize sysman. To initialize other @@ -5191,6 +5202,7 @@ typedef enum _zes_mem_type_t ZES_MEM_TYPE_GDDR6 = 17, ///< GDDR6 memory ZES_MEM_TYPE_GDDR6X = 18, ///< GDDR6X memory ZES_MEM_TYPE_GDDR7 = 19, ///< GDDR7 memory + ZES_MEM_TYPE_LPDDR5X = 20, ///< LPDDR5X memory ZES_MEM_TYPE_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZES_MEM_TYPE_* ENUMs } zes_mem_type_t; @@ -5258,9 +5270,8 @@ typedef struct _zes_mem_state_t ///< `physicalSize` member of ::zes_mem_properties_t). *DEPRECATED* ///< This member can no longer track the allocatable memory reliably. ///< Clients depending on this information can use the - ///< zeDeviceGetMemoryProperties with - ///< ze_device_usablemem_size_ext_properties_t extention to get information - ///< of the available usable memory. + ///< zeDeviceGetProperties with ze_device_usablemem_size_ext_properties_t + ///< extention to get information of the available usable memory. } zes_mem_state_t; @@ -5607,7 +5618,7 @@ zesPerformanceFactorSetConfig( #if !defined(__GNUC__) #pragma endregion #endif -// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Scheduler management +// Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Power management #if !defined(__GNUC__) #pragma region power #endif @@ -6071,6 +6082,41 @@ zesPowerSetEnergyThreshold( double threshold ///< [in] The energy threshold to be set in joules. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get power usage +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function returns the different power usage values associated with +/// the power domain. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pInstantPower` +/// + `nullptr == pAveragePower` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ); + #if !defined(__GNUC__) #pragma endregion #endif @@ -6411,6 +6457,8 @@ zesRasGetProperties( /// @brief Get RAS error thresholds that control when RAS events are generated /// /// @details +/// - @deprecated since 1.16: This function is deprecated. Please use +/// ::zesRasGetConfigExp() instead. /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. @@ -6452,6 +6500,8 @@ zesRasGetConfig( /// @brief Set RAS error thresholds that control when RAS events are generated /// /// @details +/// - @deprecated since 1.16: This function is deprecated. Please use +/// ::zesRasSetConfigExp() instead. /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. @@ -7672,6 +7722,71 @@ zesPowerSetLimitsExt( zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function returns the power limit associated with the power domain +/// of the handle. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLimit` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function sets the power limit associated with the power domain of +/// the handle. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +ZE_APIEXPORT ze_result_t ZE_APICALL +zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ); + #if !defined(__GNUC__) #pragma endregion #endif @@ -7782,7 +7897,8 @@ zesEngineGetActivityExt( typedef enum _zes_ras_state_exp_version_t { ZES_RAS_STATE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 - ZES_RAS_STATE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZES_RAS_STATE_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 + ZES_RAS_STATE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 1 ), ///< latest known version ZES_RAS_STATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZES_RAS_STATE_EXP_VERSION_* ENUMs } zes_ras_state_exp_version_t; @@ -7791,20 +7907,24 @@ typedef enum _zes_ras_state_exp_version_t /// @brief RAS error categories typedef enum _zes_ras_error_category_exp_t { - ZES_RAS_ERROR_CATEGORY_EXP_RESET = 0, ///< The number of accelerator engine resets attempted by the driver + ZES_RAS_ERROR_CATEGORY_EXP_RESET = 0, ///< The number of accelerator engine resets attempted by the driver. ZES_RAS_ERROR_CATEGORY_EXP_PROGRAMMING_ERRORS = 1, ///< The number of hardware exceptions generated by the way workloads have - ///< programmed the hardware - ZES_RAS_ERROR_CATEGORY_EXP_DRIVER_ERRORS = 2, ///< The number of low level driver communication errors have occurred + ///< programmed the hardware. + ZES_RAS_ERROR_CATEGORY_EXP_DRIVER_ERRORS = 2, ///< The number of low level driver communication errors have occurred. ZES_RAS_ERROR_CATEGORY_EXP_COMPUTE_ERRORS = 3, ///< The number of errors that have occurred in the compute accelerator ///< hardware ZES_RAS_ERROR_CATEGORY_EXP_NON_COMPUTE_ERRORS = 4, ///< The number of errors that have occurred in the fixed-function - ///< accelerator hardware + ///< accelerator hardware. ZES_RAS_ERROR_CATEGORY_EXP_CACHE_ERRORS = 5, ///< The number of errors that have occurred in caches (L1/L3/register - ///< file/shared local memory/sampler) - ZES_RAS_ERROR_CATEGORY_EXP_DISPLAY_ERRORS = 6, ///< The number of errors that have occurred in the display - ZES_RAS_ERROR_CATEGORY_EXP_MEMORY_ERRORS = 7, ///< The number of errors that have occurred in Memory - ZES_RAS_ERROR_CATEGORY_EXP_SCALE_ERRORS = 8, ///< The number of errors that have occurred in Scale Fabric - ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS = 9, ///< The number of errors that have occurred in L3 Fabric + ///< file/shared local memory/sampler). + ZES_RAS_ERROR_CATEGORY_EXP_DISPLAY_ERRORS = 6, ///< The number of errors that have occurred in the display. + ZES_RAS_ERROR_CATEGORY_EXP_MEMORY_ERRORS = 7, ///< The number of errors that have occurred in Memory Subsystem. + ZES_RAS_ERROR_CATEGORY_EXP_SCALE_ERRORS = 8, ///< The number of errors that have occurred in Scale Fabric. + ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS = 9, ///< The number of errors that have occurred in L3 Fabric. + ZES_RAS_ERROR_CATEGORY_EXP_PCIE_ERRORS = 10, ///< The number of errors that have occurred in the PCIe subsystem + ZES_RAS_ERROR_CATEGORY_EXP_FABRIC_ERRORS = 11, ///< The number of errors that have occurred in the Fabric interconnect in + ///< the SOC + ZES_RAS_ERROR_CATEGORY_EXP_SOC_INTERNAL_ERRORS = 12, ///< The number of errors that have occurred in the SOC internal components ZES_RAS_ERROR_CATEGORY_EXP_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZES_RAS_ERROR_CATEGORY_EXP_* ENUMs } zes_ras_error_category_exp_t; @@ -7819,6 +7939,31 @@ typedef struct _zes_ras_state_exp_t } zes_ras_state_exp_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Extension structure for providing RAS error counters +typedef struct _zes_ras_state_exp2_t +{ + zes_structure_type_t stype; ///< [in] type of this structure + const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + uint64_t errorCounter; ///< [out] Current value of RAS counter for the corresponding error + ///< category. + +} zes_ras_state_exp2_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief RAS error configuration for per-category threshold management +typedef struct _zes_ras_config_exp_t +{ + zes_structure_type_t stype; ///< [in] type of this structure + const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific + ///< structure (i.e. contains stype and pNext). + zes_ras_error_category_exp_t category; ///< [in] RAS error category for which threshold is being configured. + uint64_t threshold; ///< [in,out] Error count threshold to trigger RAS events. A value of 0 + ///< disables event triggering for this category. + +} zes_ras_config_exp_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Ras Get State /// @@ -7888,7 +8033,7 @@ zesRasGetStateExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category` +/// + `::ZES_RAS_ERROR_CATEGORY_EXP_SOC_INTERNAL_ERRORS < category` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to clear error counters. @@ -7898,6 +8043,168 @@ zesRasClearStateExp( zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get supported RAS error categories +/// +/// @details +/// - This function retrieves the supported RAS error categories for the +/// given RAS handle. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get RAS error counters for different categories +/// +/// @details +/// - This function retrieves error counters for different RAS error +/// categories. +/// - The categories and states arrays have 1:1 correspondence - pState[i] +/// contains the error counter for pCategories[i]. +/// - The caller must initialize stype and pNext fields in each element of +/// the pState array. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCategories` +/// + `nullptr == pState` +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + Invalid category value in pCategories array. +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + One or more categories in pCategories array not supported by this RAS handle. +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories, ///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get RAS error thresholds that control when RAS events are generated +/// +/// @details +/// - This function retrieves the RAS error thresholds for the specified RAS +/// error categories. +/// - When a particular RAS error counter for a given category exceeds the +/// configured threshold, the corresponding RAS event will be triggered. +/// - For correctable errors: ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS +/// - For uncorrectable errors: +/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set RAS error thresholds that control when RAS events are generated +/// +/// @details +/// - This function sets the RAS error thresholds for the specified RAS +/// error categories. +/// - When a particular RAS error counter for a given category exceeds the +/// specified threshold, the corresponding RAS event will be generated. +/// - Setting a threshold of 0 disables event generation for that category. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + Don't have permissions to set thresholds. +ZE_APIEXPORT ze_result_t ZE_APICALL +zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ); + #if !defined(__GNUC__) #pragma endregion #endif diff --git a/include/zes_ddi.h b/include/zes_ddi.h index eaa453d5..e39829b4 100644 --- a/include/zes_ddi.h +++ b/include/zes_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zes_ddi.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZES_DDI_H @@ -905,6 +905,28 @@ typedef ze_result_t (ZE_APICALL *zes_pfnPowerSetLimitsExt_t)( zes_power_limit_ext_desc_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesPowerGetUsage +typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetUsage_t)( + zes_pwr_handle_t, + uint32_t*, + uint32_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesPowerGetLimitsExt2 +typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetLimitsExt2_t)( + zes_pwr_handle_t, + uint32_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesPowerSetLimitsExt2 +typedef ze_result_t (ZE_APICALL *zes_pfnPowerSetLimitsExt2_t)( + zes_pwr_handle_t, + const uint32_t + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Power functions pointers typedef struct _zes_power_dditable_t @@ -917,6 +939,9 @@ typedef struct _zes_power_dditable_t zes_pfnPowerSetEnergyThreshold_t pfnSetEnergyThreshold; zes_pfnPowerGetLimitsExt_t pfnGetLimitsExt; zes_pfnPowerSetLimitsExt_t pfnSetLimitsExt; + zes_pfnPowerGetUsage_t pfnGetUsage; + zes_pfnPowerGetLimitsExt2_t pfnGetLimitsExt2; + zes_pfnPowerSetLimitsExt2_t pfnSetLimitsExt2; } zes_power_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -1780,12 +1805,49 @@ typedef ze_result_t (ZE_APICALL *zes_pfnRasClearStateExp_t)( zes_ras_error_category_exp_t ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesRasGetSupportedCategoriesExp +typedef ze_result_t (ZE_APICALL *zes_pfnRasGetSupportedCategoriesExp_t)( + zes_ras_handle_t, + uint32_t*, + zes_ras_error_category_exp_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesRasGetStateExp2 +typedef ze_result_t (ZE_APICALL *zes_pfnRasGetStateExp2_t)( + zes_ras_handle_t, + const uint32_t, + const zes_ras_error_category_exp_t*, + zes_ras_state_exp2_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesRasGetConfigExp +typedef ze_result_t (ZE_APICALL *zes_pfnRasGetConfigExp_t)( + zes_ras_handle_t, + const uint32_t, + zes_ras_config_exp_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zesRasSetConfigExp +typedef ze_result_t (ZE_APICALL *zes_pfnRasSetConfigExp_t)( + zes_ras_handle_t, + const uint32_t, + const zes_ras_config_exp_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of RasExp functions pointers typedef struct _zes_ras_exp_dditable_t { zes_pfnRasGetStateExp_t pfnGetStateExp; zes_pfnRasClearStateExp_t pfnClearStateExp; + zes_pfnRasGetSupportedCategoriesExp_t pfnGetSupportedCategoriesExp; + zes_pfnRasGetStateExp2_t pfnGetStateExp2; + zes_pfnRasGetConfigExp_t pfnGetConfigExp; + zes_pfnRasSetConfigExp_t pfnSetConfigExp; } zes_ras_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// diff --git a/include/zet.py b/include/zet.py index f4179e9f..baeba825 100644 --- a/include/zet.py +++ b/include/zet.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zet.py - @version v1.15-r1.15.31 + @version v1.16-r1.16.24 """ import platform @@ -670,6 +670,21 @@ class zet_metric_entry_exp_t(Structure): ("subdeviceId", c_ulong) ## [out] If onSubdevice is true, this gives the ID of the sub-device. ] +############################################################################### +## @brief Metric Export Memory Experimental Extension Name +ZET_METRIC_EXPORT_MEMORY_EXP_NAME = "ZET_experimental_metric_export_memory" + +############################################################################### +## @brief Metric Export Memory Experimental Extension Version(s) +class zet_metric_export_memory_exp_version_v(IntEnum): + _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 + CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version + +class zet_metric_export_memory_exp_version_t(c_int): + def __str__(self): + return str(zet_metric_export_memory_exp_version_v(self.value)) + + ############################################################################### ## @brief Metric group type class zet_metric_group_type_exp_flags_v(IntEnum): diff --git a/include/zet_api.h b/include/zet_api.h index 0362acf3..f46d0c64 100644 --- a/include/zet_api.h +++ b/include/zet_api.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zet_api.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZET_API_H @@ -1521,13 +1521,17 @@ zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ); @@ -2505,13 +2509,13 @@ zetMetricTracerDisableExp( ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ); @@ -2688,6 +2692,22 @@ zetMetricTracerDecodeExp( #if !defined(__GNUC__) #pragma region metricExportMemory #endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZET_METRIC_EXPORT_MEMORY_EXP_NAME +/// @brief Metric Export Memory Experimental Extension Name +#define ZET_METRIC_EXPORT_MEMORY_EXP_NAME "ZET_experimental_metric_export_memory" +#endif // ZET_METRIC_EXPORT_MEMORY_EXP_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Metric Export Memory Experimental Extension Version(s) +typedef enum _zet_metric_export_memory_exp_version_t +{ + ZET_METRIC_EXPORT_MEMORY_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZET_METRIC_EXPORT_MEMORY_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZET_METRIC_EXPORT_MEMORY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff ///< Value marking end of ZET_METRIC_EXPORT_MEMORY_EXP_VERSION_* ENUMs + +} zet_metric_export_memory_exp_version_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Metric group type typedef uint32_t zet_metric_group_type_exp_flags_t; diff --git a/include/zet_ddi.h b/include/zet_ddi.h index bb2371cb..79e50df1 100644 --- a/include/zet_ddi.h +++ b/include/zet_ddi.h @@ -5,7 +5,7 @@ * SPDX-License-Identifier: MIT * * @file zet_ddi.h - * @version v1.15-r1.15.31 + * @version v1.16-r1.16.24 * */ #ifndef _ZET_DDI_H diff --git a/source/drivers/null/ze_nullddi.cpp b/source/drivers/null/ze_nullddi.cpp index 65e25834..4bcca4e6 100644 --- a/source/drivers/null/ze_nullddi.cpp +++ b/source/drivers/null/ze_nullddi.cpp @@ -881,6 +881,93 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetRuntimeRequirements = context.zeDdiTable.Device.pfnGetRuntimeRequirements; + if( nullptr != pfnGetRuntimeRequirements ) + { + result = pfnGetRuntimeRequirements( hDevice, pObjDesc, pSize, pRequirements ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zeDeviceGetRuntimeRequirements", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirementsKey + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetRuntimeRequirementsKey = context.zeDdiTable.Device.pfnGetRuntimeRequirementsKey; + if( nullptr != pfnGetRuntimeRequirementsKey ) + { + result = pfnGetRuntimeRequirementsKey( hDevice, pKey ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zeDeviceGetRuntimeRequirementsKey", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceValidateRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnValidateRuntimeRequirements = context.zeDdiTable.Device.pfnValidateRuntimeRequirements; + if( nullptr != pfnValidateRuntimeRequirements ) + { + result = pfnValidateRuntimeRequirements( hDevice, pRequirements, pOut ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zeDeviceValidateRuntimeRequirements", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL @@ -1653,6 +1740,41 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryCopyWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendMemoryCopyWithParameters = context.zeDdiTable.CommandList.pfnAppendMemoryCopyWithParameters; + if( nullptr != pfnAppendMemoryCopyWithParameters ) + { + result = pfnAppendMemoryCopyWithParameters( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zeCommandListAppendMemoryCopyWithParameters", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL @@ -1688,6 +1810,42 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryFillWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendMemoryFillWithParameters = context.zeDdiTable.CommandList.pfnAppendMemoryFillWithParameters; + if( nullptr != pfnAppendMemoryFillWithParameters ) + { + result = pfnAppendMemoryFillWithParameters( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zeCommandListAppendMemoryFillWithParameters", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL @@ -6379,6 +6537,44 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListImmediateAppendCommandListsWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnImmediateAppendCommandListsWithParameters = context.zeDdiTable.CommandList.pfnImmediateAppendCommandListsWithParameters; + if( nullptr != pfnImmediateAppendCommandListsWithParameters ) + { + result = pfnImmediateAppendCommandListsWithParameters( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zeCommandListImmediateAppendCommandListsWithParameters", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL @@ -6958,6 +7154,18 @@ zeGetDeviceProcAddrTable( pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue = driver::zeDeviceGetAggregatedCopyOffloadIncrementValue; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetRuntimeRequirements = driver::zeDeviceGetRuntimeRequirements; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetRuntimeRequirementsKey = driver::zeDeviceGetRuntimeRequirementsKey; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnValidateRuntimeRequirements = driver::zeDeviceValidateRuntimeRequirements; + } + if (version >= ZE_API_VERSION_1_2) { pDdiTable->pfnReserveCacheExt = driver::zeDeviceReserveCacheExt; } @@ -7258,6 +7466,18 @@ zeGetCommandListProcAddrTable( pDdiTable->pfnAppendLaunchKernelWithArguments = driver::zeCommandListAppendLaunchKernelWithArguments; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnAppendMemoryCopyWithParameters = driver::zeCommandListAppendMemoryCopyWithParameters; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnAppendMemoryFillWithParameters = driver::zeCommandListAppendMemoryFillWithParameters; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnImmediateAppendCommandListsWithParameters = driver::zeCommandListImmediateAppendCommandListsWithParameters; + } + if (version >= ZE_API_VERSION_1_3) { pDdiTable->pfnAppendImageCopyToMemoryExt = driver::zeCommandListAppendImageCopyToMemoryExt; } diff --git a/source/drivers/null/zes_nullddi.cpp b/source/drivers/null/zes_nullddi.cpp index 394f18b0..19a9b038 100644 --- a/source/drivers/null/zes_nullddi.cpp +++ b/source/drivers/null/zes_nullddi.cpp @@ -3119,6 +3119,34 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetUsage + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetUsage = context.zesDdiTable.Power.pfnGetUsage; + if( nullptr != pfnGetUsage ) + { + result = pfnGetUsage( hPower, pInstantPower, pAveragePower ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesPowerGetUsage", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL @@ -3991,6 +4019,60 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetLimitsExt2 = context.zesDdiTable.Power.pfnGetLimitsExt2; + if( nullptr != pfnGetLimitsExt2 ) + { + result = pfnGetLimitsExt2( hPower, pLimit ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesPowerGetLimitsExt2", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerSetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnSetLimitsExt2 = context.zesDdiTable.Power.pfnSetLimitsExt2; + if( nullptr != pfnSetLimitsExt2 ) + { + result = pfnSetLimitsExt2( hPower, limit ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesPowerSetLimitsExt2", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL @@ -4093,6 +4175,128 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetSupportedCategoriesExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetSupportedCategoriesExp = context.zesDdiTable.RasExp.pfnGetSupportedCategoriesExp; + if( nullptr != pfnGetSupportedCategoriesExp ) + { + result = pfnGetSupportedCategoriesExp( hRas, pCount, pCategories ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesRasGetSupportedCategoriesExp", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetStateExp2 + __zedlllocal ze_result_t ZE_APICALL + zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetStateExp2 = context.zesDdiTable.RasExp.pfnGetStateExp2; + if( nullptr != pfnGetStateExp2 ) + { + result = pfnGetStateExp2( hRas, count, pCategories, pState ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesRasGetStateExp2", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnGetConfigExp = context.zesDdiTable.RasExp.pfnGetConfigExp; + if( nullptr != pfnGetConfigExp ) + { + result = pfnGetConfigExp( hRas, count, pConfig ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesRasGetConfigExp", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasSetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnSetConfigExp = context.zesDdiTable.RasExp.pfnSetConfigExp; + if( nullptr != pfnSetConfigExp ) + { + result = pfnSetConfigExp( hRas, count, pConfig ); + } + else + { + // generic implementation + } + + char *env_str = context.setenv_var_with_driver_id("zesRasSetConfigExp", ZEL_NULL_DRIVER_ID); + context.env_vars.push_back(env_str); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL @@ -5486,6 +5690,18 @@ zesGetPowerProcAddrTable( pDdiTable->pfnSetLimitsExt = driver::zesPowerSetLimitsExt; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetUsage = driver::zesPowerGetUsage; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetLimitsExt2 = driver::zesPowerGetLimitsExt2; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnSetLimitsExt2 = driver::zesPowerSetLimitsExt2; + } + return result; } @@ -5593,6 +5809,22 @@ zesGetRasExpProcAddrTable( pDdiTable->pfnClearStateExp = driver::zesRasClearStateExp; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetSupportedCategoriesExp = driver::zesRasGetSupportedCategoriesExp; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetStateExp2 = driver::zesRasGetStateExp2; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetConfigExp = driver::zesRasGetConfigExp; + } + + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnSetConfigExp = driver::zesRasSetConfigExp; + } + return result; } diff --git a/source/drivers/null/zet_nullddi.cpp b/source/drivers/null/zet_nullddi.cpp index 0525d4e3..210d9ef2 100644 --- a/source/drivers/null/zet_nullddi.cpp +++ b/source/drivers/null/zet_nullddi.cpp @@ -738,13 +738,17 @@ namespace driver zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -1358,13 +1362,13 @@ namespace driver __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/layers/tracing/ze_tracing_cb_structs.h b/source/layers/tracing/ze_tracing_cb_structs.h index 658d7ed2..f2ad8d91 100644 --- a/source/layers/tracing/ze_tracing_cb_structs.h +++ b/source/layers/tracing/ze_tracing_cb_structs.h @@ -95,6 +95,9 @@ typedef struct _zel_ze_device_callbacks_t ze_pfnDeviceGetVectorWidthPropertiesExtCb_t pfnGetVectorWidthPropertiesExtCb; ze_pfnDeviceSynchronizeCb_t pfnSynchronizeCb; ze_pfnDeviceGetAggregatedCopyOffloadIncrementValueCb_t pfnGetAggregatedCopyOffloadIncrementValueCb; + ze_pfnDeviceGetRuntimeRequirementsCb_t pfnGetRuntimeRequirementsCb; + ze_pfnDeviceGetRuntimeRequirementsKeyCb_t pfnGetRuntimeRequirementsKeyCb; + ze_pfnDeviceValidateRuntimeRequirementsCb_t pfnValidateRuntimeRequirementsCb; ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb; ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb; ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb; @@ -165,6 +168,9 @@ typedef struct _zel_ze_command_list_callbacks_t ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t pfnAppendWaitExternalSemaphoreExtCb; ze_pfnCommandListAppendLaunchKernelWithParametersCb_t pfnAppendLaunchKernelWithParametersCb; ze_pfnCommandListAppendLaunchKernelWithArgumentsCb_t pfnAppendLaunchKernelWithArgumentsCb; + ze_pfnCommandListAppendMemoryCopyWithParametersCb_t pfnAppendMemoryCopyWithParametersCb; + ze_pfnCommandListAppendMemoryFillWithParametersCb_t pfnAppendMemoryFillWithParametersCb; + ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t pfnImmediateAppendCommandListsWithParametersCb; ze_pfnCommandListAppendImageCopyToMemoryExtCb_t pfnAppendImageCopyToMemoryExtCb; ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t pfnAppendImageCopyFromMemoryExtCb; ze_pfnCommandListHostSynchronizeCb_t pfnHostSynchronizeCb; diff --git a/source/layers/tracing/ze_tracing_register_cb.cpp b/source/layers/tracing/ze_tracing_register_cb.cpp index 8de37ac2..b39cadfb 100644 --- a/source/layers/tracing/ze_tracing_register_cb.cpp +++ b/source/layers/tracing/ze_tracing_register_cb.cpp @@ -467,6 +467,54 @@ zelTracerDeviceGetAggregatedCopyOffloadIncrementValueRegisterCallback( } +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetRuntimeRequirementsRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsCb_t pfnGetRuntimeRequirementsCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getZeProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.Device.pfnGetRuntimeRequirementsCb = pfnGetRuntimeRequirementsCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetRuntimeRequirementsKeyRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsKeyCb_t pfnGetRuntimeRequirementsKeyCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getZeProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.Device.pfnGetRuntimeRequirementsKeyCb = pfnGetRuntimeRequirementsKeyCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerDeviceValidateRuntimeRequirementsRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceValidateRuntimeRequirementsCb_t pfnValidateRuntimeRequirementsCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getZeProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.Device.pfnValidateRuntimeRequirementsCb = pfnValidateRuntimeRequirementsCb; + + return result; +} + + ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextCreateRegisterCallback( zel_tracer_handle_t hTracer, @@ -883,6 +931,22 @@ zelTracerCommandListAppendMemoryCopyRegisterCallback( } +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerCommandListAppendMemoryCopyWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryCopyWithParametersCb_t pfnAppendMemoryCopyWithParametersCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getZeProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.CommandList.pfnAppendMemoryCopyWithParametersCb = pfnAppendMemoryCopyWithParametersCb; + + return result; +} + + ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryFillRegisterCallback( zel_tracer_handle_t hTracer, @@ -899,6 +963,22 @@ zelTracerCommandListAppendMemoryFillRegisterCallback( } +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerCommandListAppendMemoryFillWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryFillWithParametersCb_t pfnAppendMemoryFillWithParametersCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getZeProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.CommandList.pfnAppendMemoryFillWithParametersCb = pfnAppendMemoryFillWithParametersCb; + + return result; +} + + ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, @@ -3379,6 +3459,22 @@ zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback( } +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerCommandListImmediateAppendCommandListsWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t pfnImmediateAppendCommandListsWithParametersCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getZeProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.CommandList.pfnImmediateAppendCommandListsWithParametersCb = pfnImmediateAppendCommandListsWithParametersCb; + + return result; +} + + ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdExpRegisterCallback( zel_tracer_handle_t hTracer, diff --git a/source/layers/tracing/ze_trcddi.cpp b/source/layers/tracing/ze_trcddi.cpp index 7bf670f4..e0e60ae6 100644 --- a/source/layers/tracing/ze_trcddi.cpp +++ b/source/layers/tracing/ze_trcddi.cpp @@ -1079,6 +1079,123 @@ namespace tracing_layer *tracerParams.pincrementValue); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + auto pfnGetRuntimeRequirements = context.zeDdiTable.Device.pfnGetRuntimeRequirements; + + if( nullptr == pfnGetRuntimeRequirements) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetRuntimeRequirements, hDevice, pObjDesc, pSize, pRequirements); + + // capture parameters + ze_device_get_runtime_requirements_params_t tracerParams = { + &hDevice, + &pObjDesc, + &pSize, + &pRequirements + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetRuntimeRequirementsCb_t, Device, pfnGetRuntimeRequirementsCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetRuntimeRequirements, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDevice, + *tracerParams.ppObjDesc, + *tracerParams.ppSize, + *tracerParams.ppRequirements); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirementsKey + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + auto pfnGetRuntimeRequirementsKey = context.zeDdiTable.Device.pfnGetRuntimeRequirementsKey; + + if( nullptr == pfnGetRuntimeRequirementsKey) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetRuntimeRequirementsKey, hDevice, pKey); + + // capture parameters + ze_device_get_runtime_requirements_key_params_t tracerParams = { + &hDevice, + &pKey + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetRuntimeRequirementsKeyCb_t, Device, pfnGetRuntimeRequirementsKeyCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetRuntimeRequirementsKey, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDevice, + *tracerParams.ppKey); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceValidateRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + auto pfnValidateRuntimeRequirements = context.zeDdiTable.Device.pfnValidateRuntimeRequirements; + + if( nullptr == pfnValidateRuntimeRequirements) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnValidateRuntimeRequirements, hDevice, pRequirements, pOut); + + // capture parameters + ze_device_validate_runtime_requirements_params_t tracerParams = { + &hDevice, + &pRequirements, + &pOut + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceValidateRuntimeRequirementsCb_t, Device, pfnValidateRuntimeRequirementsCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnValidateRuntimeRequirements, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDevice, + *tracerParams.ppRequirements, + *tracerParams.ppOut); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL @@ -2084,6 +2201,61 @@ namespace tracing_layer *tracerParams.pphWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryCopyWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + auto pfnAppendMemoryCopyWithParameters = context.zeDdiTable.CommandList.pfnAppendMemoryCopyWithParameters; + + if( nullptr == pfnAppendMemoryCopyWithParameters) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryCopyWithParameters, hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + + // capture parameters + ze_command_list_append_memory_copy_with_parameters_params_t tracerParams = { + &hCommandList, + &dstptr, + &srcptr, + &size, + &pNext, + &hSignalEvent, + &numWaitEvents, + &phWaitEvents + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryCopyWithParametersCb_t, CommandList, pfnAppendMemoryCopyWithParametersCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryCopyWithParameters, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phCommandList, + *tracerParams.pdstptr, + *tracerParams.psrcptr, + *tracerParams.psize, + *tracerParams.ppNext, + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL @@ -2139,6 +2311,64 @@ namespace tracing_layer *tracerParams.pphWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryFillWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + auto pfnAppendMemoryFillWithParameters = context.zeDdiTable.CommandList.pfnAppendMemoryFillWithParameters; + + if( nullptr == pfnAppendMemoryFillWithParameters) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryFillWithParameters, hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + + // capture parameters + ze_command_list_append_memory_fill_with_parameters_params_t tracerParams = { + &hCommandList, + &ptr, + &pattern, + &pattern_size, + &size, + &pNext, + &hSignalEvent, + &numWaitEvents, + &phWaitEvents + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryFillWithParametersCb_t, CommandList, pfnAppendMemoryFillWithParametersCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryFillWithParameters, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phCommandList, + *tracerParams.pptr, + *tracerParams.ppattern, + *tracerParams.ppattern_size, + *tracerParams.psize, + *tracerParams.ppNext, + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL @@ -8454,6 +8684,62 @@ namespace tracing_layer *tracerParams.pphWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListImmediateAppendCommandListsWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + auto pfnImmediateAppendCommandListsWithParameters = context.zeDdiTable.CommandList.pfnImmediateAppendCommandListsWithParameters; + + if( nullptr == pfnImmediateAppendCommandListsWithParameters) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnImmediateAppendCommandListsWithParameters, hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + + // capture parameters + ze_command_list_immediate_append_command_lists_with_parameters_params_t tracerParams = { + &hCommandListImmediate, + &numCommandLists, + &phCommandLists, + &pNext, + &hSignalEvent, + &numWaitEvents, + &phWaitEvents + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t, CommandList, pfnImmediateAppendCommandListsWithParametersCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnImmediateAppendCommandListsWithParameters, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phCommandListImmediate, + *tracerParams.pnumCommandLists, + *tracerParams.pphCommandLists, + *tracerParams.ppNext, + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL @@ -9111,6 +9397,18 @@ zeGetDeviceProcAddrTable( dditable.pfnGetAggregatedCopyOffloadIncrementValue = pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue; pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue = tracing_layer::zeDeviceGetAggregatedCopyOffloadIncrementValue; } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetRuntimeRequirements = pDdiTable->pfnGetRuntimeRequirements; + pDdiTable->pfnGetRuntimeRequirements = tracing_layer::zeDeviceGetRuntimeRequirements; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetRuntimeRequirementsKey = pDdiTable->pfnGetRuntimeRequirementsKey; + pDdiTable->pfnGetRuntimeRequirementsKey = tracing_layer::zeDeviceGetRuntimeRequirementsKey; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnValidateRuntimeRequirements = pDdiTable->pfnValidateRuntimeRequirements; + pDdiTable->pfnValidateRuntimeRequirements = tracing_layer::zeDeviceValidateRuntimeRequirements; + } if (version >= ZE_API_VERSION_1_2) { dditable.pfnReserveCacheExt = pDdiTable->pfnReserveCacheExt; pDdiTable->pfnReserveCacheExt = tracing_layer::zeDeviceReserveCacheExt; @@ -9419,6 +9717,18 @@ zeGetCommandListProcAddrTable( dditable.pfnAppendLaunchKernelWithArguments = pDdiTable->pfnAppendLaunchKernelWithArguments; pDdiTable->pfnAppendLaunchKernelWithArguments = tracing_layer::zeCommandListAppendLaunchKernelWithArguments; } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnAppendMemoryCopyWithParameters = pDdiTable->pfnAppendMemoryCopyWithParameters; + pDdiTable->pfnAppendMemoryCopyWithParameters = tracing_layer::zeCommandListAppendMemoryCopyWithParameters; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnAppendMemoryFillWithParameters = pDdiTable->pfnAppendMemoryFillWithParameters; + pDdiTable->pfnAppendMemoryFillWithParameters = tracing_layer::zeCommandListAppendMemoryFillWithParameters; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnImmediateAppendCommandListsWithParameters = pDdiTable->pfnImmediateAppendCommandListsWithParameters; + pDdiTable->pfnImmediateAppendCommandListsWithParameters = tracing_layer::zeCommandListImmediateAppendCommandListsWithParameters; + } if (version >= ZE_API_VERSION_1_3) { dditable.pfnAppendImageCopyToMemoryExt = pDdiTable->pfnAppendImageCopyToMemoryExt; pDdiTable->pfnAppendImageCopyToMemoryExt = tracing_layer::zeCommandListAppendImageCopyToMemoryExt; diff --git a/source/layers/validation/checkers/certification/generated/ze_certification.h b/source/layers/validation/checkers/certification/generated/ze_certification.h index 3db3c99f..ba3a69ff 100644 --- a/source/layers/validation/checkers/certification/generated/ze_certification.h +++ b/source/layers/validation/checkers/certification/generated/ze_certification.h @@ -183,6 +183,24 @@ class ZEcertificationCheckerGenerated : public ZEValidationEntryPoints { } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zeDeviceGetRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const void* pObjDesc, size_t* pSize, char* pRequirements ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } + virtual ze_result_t zeDeviceGetRuntimeRequirementsKeyPrologue( ze_device_handle_t hDevice, const char** pKey ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } + virtual ze_result_t zeDeviceValidateRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const char* pRequirements, ze_validate_runtime_requirements_output_t* pOut ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_0) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; @@ -339,12 +357,24 @@ class ZEcertificationCheckerGenerated : public ZEValidationEntryPoints { } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zeCommandListAppendMemoryCopyWithParametersPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_0) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zeCommandListAppendMemoryFillWithParametersPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_0) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; @@ -1275,6 +1305,12 @@ class ZEcertificationCheckerGenerated : public ZEValidationEntryPoints { } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zeCommandListImmediateAppendCommandListsWithParametersPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_9) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; diff --git a/source/layers/validation/checkers/certification/generated/zes_certification.h b/source/layers/validation/checkers/certification/generated/zes_certification.h index e1564a95..b74199b7 100644 --- a/source/layers/validation/checkers/certification/generated/zes_certification.h +++ b/source/layers/validation/checkers/certification/generated/zes_certification.h @@ -633,6 +633,12 @@ class ZEScertificationCheckerGenerated : public ZESValidationEntryPoints { } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zesPowerGetUsagePrologue( zes_pwr_handle_t hPower, uint32_t* pInstantPower, uint32_t* pAveragePower ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_0) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; @@ -807,6 +813,18 @@ class ZEScertificationCheckerGenerated : public ZESValidationEntryPoints { } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zesPowerGetLimitsExt2Prologue( zes_pwr_handle_t hPower, uint32_t* pLimit ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } + virtual ze_result_t zesPowerSetLimitsExt2Prologue( zes_pwr_handle_t hPower, const uint32_t limit ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_7) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; @@ -825,6 +843,30 @@ class ZEScertificationCheckerGenerated : public ZESValidationEntryPoints { } return ZE_RESULT_SUCCESS; } + virtual ze_result_t zesRasGetSupportedCategoriesExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_error_category_exp_t* pCategories ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } + virtual ze_result_t zesRasGetStateExp2Prologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_error_category_exp_t* pCategories, zes_ras_state_exp2_t* pState ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } + virtual ze_result_t zesRasGetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, zes_ras_config_exp_t* pConfig ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } + virtual ze_result_t zesRasSetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_config_exp_t* pConfig ) override { + if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + return ZE_RESULT_SUCCESS; + } virtual ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) override { if (GlobalCertificationState::getInstance().certification_version < ZE_API_VERSION_1_9) { return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; diff --git a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp index 0da2a180..4642c90f 100644 --- a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp @@ -557,6 +557,66 @@ namespace validation_layer } + ze_result_t + ZEParameterValidation::zeDeviceGetRuntimeRequirementsPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pObjDesc ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pSize ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeDeviceGetRuntimeRequirementsKeyPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pKey ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeDeviceValidateRuntimeRequirementsPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pRequirements ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pOut ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZEParameterValidation::zeContextCreatePrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver object @@ -1074,6 +1134,36 @@ namespace validation_layer } + ze_result_t + ZEParameterValidation::zeCommandListAppendMemoryCopyWithParametersPrologue( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + if( nullptr == hCommandList ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == dstptr ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == srcptr ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) + return ZE_RESULT_ERROR_INVALID_SIZE; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZEParameterValidation::zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list @@ -1104,6 +1194,37 @@ namespace validation_layer } + ze_result_t + ZEParameterValidation::zeCommandListAppendMemoryFillWithParametersPrologue( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + if( nullptr == hCommandList ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == ptr ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pattern ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) + return ZE_RESULT_ERROR_INVALID_SIZE; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZEParameterValidation::zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list @@ -2001,7 +2122,7 @@ namespace validation_layer if( 0x7 < device_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; - if( 0xf < host_desc->flags ) + if( 0x1f < host_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) @@ -2076,7 +2197,7 @@ namespace validation_layer if( nullptr == pptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; - if( 0xf < host_desc->flags ) + if( 0x1f < host_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) @@ -4463,6 +4584,33 @@ namespace validation_layer } + ze_result_t + ZEParameterValidation::zeCommandListImmediateAppendCommandListsWithParametersPrologue( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + if( nullptr == hCommandListImmediate ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == phCommandLists ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZEParameterValidation::zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list diff --git a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h index 82545798..d1b04df8 100644 --- a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h +++ b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h @@ -48,6 +48,9 @@ namespace validation_layer ze_result_t zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, uint64_t* hostTimestamp, uint64_t* deviceTimestamp ) override; ze_result_t zeDeviceSynchronizePrologue( ze_device_handle_t hDevice ) override; ze_result_t zeDeviceGetAggregatedCopyOffloadIncrementValuePrologue( ze_device_handle_t hDevice, uint32_t* incrementValue ) override; + ze_result_t zeDeviceGetRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const void* pObjDesc, size_t* pSize, char* pRequirements ) override; + ze_result_t zeDeviceGetRuntimeRequirementsKeyPrologue( ze_device_handle_t hDevice, const char** pKey ) override; + ze_result_t zeDeviceValidateRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const char* pRequirements, ze_validate_runtime_requirements_output_t* pOut ) override; ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) override; ze_result_t zeContextCreateExPrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext ) override; ze_result_t zeContextDestroyPrologue( ze_context_handle_t hContext ) override; @@ -74,7 +77,9 @@ namespace validation_layer ze_result_t zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t* pRangeSizes, const void** pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice ) override; ze_result_t zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeCommandListAppendMemoryCopyWithParametersPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeCommandListAppendMemoryFillWithParametersPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; @@ -230,6 +235,7 @@ namespace validation_layer ze_result_t zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, uint64_t* pDeviceOffset ) override; ze_result_t zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList ) override; ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeCommandListImmediateAppendCommandListsWithParametersPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) override; ze_result_t zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId ) override; ze_result_t zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_commands_exp_desc_t* desc ) override; diff --git a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp index c939d285..dcb591cb 100644 --- a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.cpp @@ -1972,6 +1972,26 @@ namespace validation_layer } + ze_result_t + ZESParameterValidation::zesPowerGetUsagePrologue( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) + { + if( nullptr == hPower ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pInstantPower ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pAveragePower ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZESParameterValidation::zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. @@ -2516,6 +2536,35 @@ namespace validation_layer } + ze_result_t + ZESParameterValidation::zesPowerGetLimitsExt2Prologue( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) + { + if( nullptr == hPower ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pLimit ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesPowerSetLimitsExt2Prologue( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) + { + if( nullptr == hPower ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZESParameterValidation::zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. @@ -2578,13 +2627,94 @@ namespace validation_layer if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; - if( ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category ) + if( ZES_RAS_ERROR_CATEGORY_EXP_SOC_INTERNAL_ERRORS < category ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } + ze_result_t + ZESParameterValidation::zesRasGetSupportedCategoriesExpPrologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) + { + if( nullptr == hRas ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pCount ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesRasGetStateExp2Prologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) + { + if( nullptr == hRas ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pCategories ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pState ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesRasGetConfigExpPrologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) + { + if( nullptr == hRas ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pConfig ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZESParameterValidation::zesRasSetConfigExpPrologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) + { + if( nullptr == hRas ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pConfig ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZESParameterValidation::zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. diff --git a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h index 68db1e4f..506654fc 100644 --- a/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h +++ b/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h @@ -123,6 +123,7 @@ namespace validation_layer ze_result_t zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, const zes_power_sustained_limit_t* pSustained, const zes_power_burst_limit_t* pBurst, const zes_power_peak_limit_t* pPeak ) override; ze_result_t zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold ) override; ze_result_t zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, double threshold ) override; + ze_result_t zesPowerGetUsagePrologue( zes_pwr_handle_t hPower, uint32_t* pInstantPower, uint32_t* pAveragePower ) override; ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) override; ze_result_t zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties ) override; ze_result_t zesPsuGetStatePrologue( zes_psu_handle_t hPsu, zes_psu_state_t* pState ) override; @@ -152,9 +153,15 @@ namespace validation_layer ze_result_t zesDevicePciLinkSpeedUpdateExtPrologue( zes_device_handle_t hDevice, ze_bool_t shouldDowngrade, zes_device_action_t* pendingAction ) override; ze_result_t zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; ze_result_t zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; + ze_result_t zesPowerGetLimitsExt2Prologue( zes_pwr_handle_t hPower, uint32_t* pLimit ) override; + ze_result_t zesPowerSetLimitsExt2Prologue( zes_pwr_handle_t hPower, const uint32_t limit ) override; ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) override; ze_result_t zesRasGetStateExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState ) override; ze_result_t zesRasClearStateExpPrologue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category ) override; + ze_result_t zesRasGetSupportedCategoriesExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_error_category_exp_t* pCategories ) override; + ze_result_t zesRasGetStateExp2Prologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_error_category_exp_t* pCategories, zes_ras_state_exp2_t* pState ) override; + ze_result_t zesRasGetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, zes_ras_config_exp_t* pConfig ) override; + ze_result_t zesRasSetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_config_exp_t* pConfig ) override; ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) override; ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) override; ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) override; diff --git a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp index f8af284b..fba97c92 100644 --- a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp @@ -492,13 +492,17 @@ namespace validation_layer zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -870,13 +874,13 @@ namespace validation_layer ze_result_t ZETParameterValidation::zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/layers/validation/common/ze_entry_points.h b/source/layers/validation/common/ze_entry_points.h index 5c204e48..6f33350a 100644 --- a/source/layers/validation/common/ze_entry_points.h +++ b/source/layers/validation/common/ze_entry_points.h @@ -73,6 +73,12 @@ class ZEValidationEntryPoints { virtual ze_result_t zeDeviceSynchronizeEpilogue( ze_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetAggregatedCopyOffloadIncrementValuePrologue( ze_device_handle_t hDevice, uint32_t* incrementValue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetAggregatedCopyOffloadIncrementValueEpilogue( ze_device_handle_t hDevice, uint32_t* incrementValue , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceGetRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const void* pObjDesc, size_t* pSize, char* pRequirements ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceGetRuntimeRequirementsEpilogue( ze_device_handle_t hDevice, const void* pObjDesc, size_t* pSize, char* pRequirements , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceGetRuntimeRequirementsKeyPrologue( ze_device_handle_t hDevice, const char** pKey ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceGetRuntimeRequirementsKeyEpilogue( ze_device_handle_t hDevice, const char** pKey , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceValidateRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const char* pRequirements, ze_validate_runtime_requirements_output_t* pOut ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceValidateRuntimeRequirementsEpilogue( ze_device_handle_t hDevice, const char* pRequirements, ze_validate_runtime_requirements_output_t* pOut , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreateEpilogue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreateExPrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext ) {return ZE_RESULT_SUCCESS;} @@ -125,8 +131,12 @@ class ZEValidationEntryPoints { virtual ze_result_t zeContextSystemBarrierEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeCommandListAppendMemoryCopyWithParametersPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeCommandListAppendMemoryCopyWithParametersEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryFillEpilogue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeCommandListAppendMemoryFillWithParametersPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeCommandListAppendMemoryFillWithParametersEpilogue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyRegionEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} @@ -437,6 +447,8 @@ class ZEValidationEntryPoints { virtual ze_result_t zeCommandListCreateCloneExpEpilogue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListImmediateAppendCommandListsExpEpilogue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeCommandListImmediateAppendCommandListsWithParametersPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeCommandListImmediateAppendCommandListsWithParametersEpilogue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdExpEpilogue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId ) {return ZE_RESULT_SUCCESS;} diff --git a/source/layers/validation/common/zes_entry_points.h b/source/layers/validation/common/zes_entry_points.h index 7d69b822..dfc7d111 100644 --- a/source/layers/validation/common/zes_entry_points.h +++ b/source/layers/validation/common/zes_entry_points.h @@ -223,6 +223,8 @@ class ZESValidationEntryPoints { virtual ze_result_t zesPowerGetEnergyThresholdEpilogue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, double threshold ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetEnergyThresholdEpilogue( zes_pwr_handle_t hPower, double threshold , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesPowerGetUsagePrologue( zes_pwr_handle_t hPower, uint32_t* pInstantPower, uint32_t* pAveragePower ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesPowerGetUsageEpilogue( zes_pwr_handle_t hPower, uint32_t* pInstantPower, uint32_t* pAveragePower , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPsusEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} @@ -281,12 +283,24 @@ class ZESValidationEntryPoints { virtual ze_result_t zesPowerGetLimitsExtEpilogue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetLimitsExtEpilogue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesPowerGetLimitsExt2Prologue( zes_pwr_handle_t hPower, uint32_t* pLimit ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesPowerGetLimitsExt2Epilogue( zes_pwr_handle_t hPower, uint32_t* pLimit , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesPowerSetLimitsExt2Prologue( zes_pwr_handle_t hPower, const uint32_t limit ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesPowerSetLimitsExt2Epilogue( zes_pwr_handle_t hPower, const uint32_t limit , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetActivityExtEpilogue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetStateExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetStateExpEpilogue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasClearStateExpPrologue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasClearStateExpEpilogue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasGetSupportedCategoriesExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_error_category_exp_t* pCategories ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasGetSupportedCategoriesExpEpilogue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_error_category_exp_t* pCategories , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasGetStateExp2Prologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_error_category_exp_t* pCategories, zes_ras_state_exp2_t* pState ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasGetStateExp2Epilogue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_error_category_exp_t* pCategories, zes_ras_state_exp2_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasGetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, zes_ras_config_exp_t* pConfig ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasGetConfigExpEpilogue( zes_ras_handle_t hRas, const uint32_t count, zes_ras_config_exp_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasSetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_config_exp_t* pConfig ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zesRasSetConfigExpEpilogue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_config_exp_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetSecurityVersionExpEpilogue( zes_firmware_handle_t hFirmware, char* pVersion , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) {return ZE_RESULT_SUCCESS;} diff --git a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp index 1aa9c85b..38dc72d1 100644 --- a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp @@ -379,6 +379,48 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZEHandleLifetimeValidation::zeDeviceGetRuntimeRequirementsPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeDeviceGetRuntimeRequirementsKeyPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeDeviceValidateRuntimeRequirementsPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZEHandleLifetimeValidation::zeContextCreatePrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor @@ -838,6 +880,37 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZEHandleLifetimeValidation::zeCommandListAppendMemoryCopyWithParametersPrologue( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + + if ( !context.handleLifetime->isHandleValid( hCommandList )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + if (!context.handleLifetime->isOpen( hCommandList )){ + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ + if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize @@ -869,6 +942,38 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZEHandleLifetimeValidation::zeCommandListAppendMemoryFillWithParametersPrologue( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + + if ( !context.handleLifetime->isHandleValid( hCommandList )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + if (!context.handleLifetime->isOpen( hCommandList )){ + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ + if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to @@ -3617,6 +3722,42 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZEHandleLifetimeValidation::zeCommandListImmediateAppendCommandListsWithParametersPrologue( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + + if ( !context.handleLifetime->isHandleValid( hCommandListImmediate )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + for (size_t i = 0; ( nullptr != phCommandLists) && (i < numCommandLists); ++i){ + if (!context.handleLifetime->isHandleValid( phCommandLists[i] )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + } + if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ + if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZEHandleLifetimeValidation::zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor diff --git a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h index 6fcb5772..e1c3fecb 100644 --- a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h +++ b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h @@ -44,6 +44,9 @@ namespace validation_layer ze_result_t zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, uint64_t* hostTimestamp, uint64_t* deviceTimestamp ) override; ze_result_t zeDeviceSynchronizePrologue( ze_device_handle_t hDevice ) override; ze_result_t zeDeviceGetAggregatedCopyOffloadIncrementValuePrologue( ze_device_handle_t hDevice, uint32_t* incrementValue ) override; + ze_result_t zeDeviceGetRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const void* pObjDesc, size_t* pSize, char* pRequirements ) override; + ze_result_t zeDeviceGetRuntimeRequirementsKeyPrologue( ze_device_handle_t hDevice, const char** pKey ) override; + ze_result_t zeDeviceValidateRuntimeRequirementsPrologue( ze_device_handle_t hDevice, const char* pRequirements, ze_validate_runtime_requirements_output_t* pOut ) override; ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) override; ze_result_t zeContextCreateExPrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext ) override; ze_result_t zeContextDestroyPrologue( ze_context_handle_t hContext ) override; @@ -70,7 +73,9 @@ namespace validation_layer ze_result_t zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t* pRangeSizes, const void** pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice ) override; ze_result_t zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeCommandListAppendMemoryCopyWithParametersPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeCommandListAppendMemoryFillWithParametersPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; @@ -226,6 +231,7 @@ namespace validation_layer ze_result_t zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, uint64_t* pDeviceOffset ) override; ze_result_t zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList ) override; ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeCommandListImmediateAppendCommandListsWithParametersPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, const void* pNext, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) override; ze_result_t zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId ) override; ze_result_t zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_commands_exp_desc_t* desc ) override; diff --git a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp index ba7c1a18..7c9126e3 100644 --- a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp @@ -1515,6 +1515,19 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZESHandleLifetimeValidation::zesPowerGetUsagePrologue( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) + { + + if ( !context.handleLifetime->isHandleValid( hPower )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. @@ -1937,6 +1950,30 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZESHandleLifetimeValidation::zesPowerGetLimitsExt2Prologue( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) + { + + if ( !context.handleLifetime->isHandleValid( hPower )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesPowerSetLimitsExt2Prologue( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) + { + + if ( !context.handleLifetime->isHandleValid( hPower )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZESHandleLifetimeValidation::zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. @@ -1994,6 +2031,68 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZESHandleLifetimeValidation::zesRasGetSupportedCategoriesExpPrologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) + { + + if ( !context.handleLifetime->isHandleValid( hRas )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesRasGetStateExp2Prologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) + { + + if ( !context.handleLifetime->isHandleValid( hRas )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesRasGetConfigExpPrologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) + { + + if ( !context.handleLifetime->isHandleValid( hRas )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZESHandleLifetimeValidation::zesRasSetConfigExpPrologue( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) + { + + if ( !context.handleLifetime->isHandleValid( hRas )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZESHandleLifetimeValidation::zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be diff --git a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h index c28df26d..0f964941 100644 --- a/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h +++ b/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h @@ -120,6 +120,7 @@ namespace validation_layer ze_result_t zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, const zes_power_sustained_limit_t* pSustained, const zes_power_burst_limit_t* pBurst, const zes_power_peak_limit_t* pPeak ) override; ze_result_t zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold ) override; ze_result_t zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, double threshold ) override; + ze_result_t zesPowerGetUsagePrologue( zes_pwr_handle_t hPower, uint32_t* pInstantPower, uint32_t* pAveragePower ) override; ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) override; ze_result_t zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties ) override; ze_result_t zesPsuGetStatePrologue( zes_psu_handle_t hPsu, zes_psu_state_t* pState ) override; @@ -149,9 +150,15 @@ namespace validation_layer ze_result_t zesDevicePciLinkSpeedUpdateExtPrologue( zes_device_handle_t hDevice, ze_bool_t shouldDowngrade, zes_device_action_t* pendingAction ) override; ze_result_t zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; ze_result_t zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; + ze_result_t zesPowerGetLimitsExt2Prologue( zes_pwr_handle_t hPower, uint32_t* pLimit ) override; + ze_result_t zesPowerSetLimitsExt2Prologue( zes_pwr_handle_t hPower, const uint32_t limit ) override; ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) override; ze_result_t zesRasGetStateExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState ) override; ze_result_t zesRasClearStateExpPrologue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category ) override; + ze_result_t zesRasGetSupportedCategoriesExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_error_category_exp_t* pCategories ) override; + ze_result_t zesRasGetStateExp2Prologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_error_category_exp_t* pCategories, zes_ras_state_exp2_t* pState ) override; + ze_result_t zesRasGetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, zes_ras_config_exp_t* pConfig ) override; + ze_result_t zesRasSetConfigExpPrologue( zes_ras_handle_t hRas, const uint32_t count, const zes_ras_config_exp_t* pConfig ) override; ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) override; ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) override; ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) override; diff --git a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp index a193ab88..7943d057 100644 --- a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp @@ -404,13 +404,17 @@ namespace validation_layer zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -751,13 +755,13 @@ namespace validation_layer ze_result_t ZETHandleLifetimeValidation::zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/layers/validation/ze_valddi.cpp b/source/layers/validation/ze_valddi.cpp index 91b4f546..c078b9a5 100644 --- a/source/layers/validation/ze_valddi.cpp +++ b/source/layers/validation/ze_valddi.cpp @@ -836,6 +836,106 @@ namespace validation_layer oss << ")"; context.logger->log_trace(oss.str()); return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeDeviceGetRuntimeRequirements( + ze_result_t result, + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zeDeviceGetRuntimeRequirements("; + + + oss << "hDevice="; + oss << loader::to_string(hDevice); + + oss << ", "; + oss << "pObjDesc="; + oss << loader::to_string(pObjDesc); + + oss << ", "; + oss << "pSize="; + oss << loader::to_string(pSize); + + oss << ", "; + oss << "pRequirements="; + oss << loader::to_string(pRequirements); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeDeviceGetRuntimeRequirementsKey( + ze_result_t result, + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zeDeviceGetRuntimeRequirementsKey("; + + + oss << "hDevice="; + oss << loader::to_string(hDevice); + + oss << ", "; + oss << "pKey="; + // Dereference output parameter if not null and result is success + if (result == ZE_RESULT_SUCCESS && pKey != nullptr) { + oss << loader::to_string(*pKey); + } else { + oss << loader::to_string(pKey); + } + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeDeviceValidateRuntimeRequirements( + ze_result_t result, + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zeDeviceValidateRuntimeRequirements("; + + + oss << "hDevice="; + oss << loader::to_string(hDevice); + + oss << ", "; + oss << "pRequirements="; + oss << loader::to_string(pRequirements); + + oss << ", "; + oss << "pOut="; + // Dereference output parameter if not null and result is success + if (result == ZE_RESULT_SUCCESS && pOut != nullptr) { + oss << loader::to_string(*pOut); + } else { + oss << loader::to_string(pOut); + } + oss << ")"; + context.logger->log_trace(oss.str()); + return result; } VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeContextCreate( ze_result_t result, @@ -1651,6 +1751,62 @@ namespace validation_layer oss << "numWaitEvents="; oss << loader::to_string(numWaitEvents); + oss << ", "; + oss << "phWaitEvents="; + oss << loader::to_string(phWaitEvents); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeCommandListAppendMemoryCopyWithParameters( + ze_result_t result, + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zeCommandListAppendMemoryCopyWithParameters("; + + + oss << "hCommandList="; + oss << loader::to_string(hCommandList); + + oss << ", "; + oss << "dstptr="; + oss << loader::to_string(dstptr); + + oss << ", "; + oss << "srcptr="; + oss << loader::to_string(srcptr); + + oss << ", "; + oss << "size="; + oss << loader::to_string(size); + + oss << ", "; + oss << "pNext="; + oss << loader::to_string(pNext); + + oss << ", "; + oss << "hSignalEvent="; + oss << loader::to_string(hSignalEvent); + + oss << ", "; + oss << "numWaitEvents="; + oss << loader::to_string(numWaitEvents); + oss << ", "; oss << "phWaitEvents="; oss << loader::to_string(phWaitEvents); @@ -1707,6 +1863,67 @@ namespace validation_layer oss << "numWaitEvents="; oss << loader::to_string(numWaitEvents); + oss << ", "; + oss << "phWaitEvents="; + oss << loader::to_string(phWaitEvents); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeCommandListAppendMemoryFillWithParameters( + ze_result_t result, + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zeCommandListAppendMemoryFillWithParameters("; + + + oss << "hCommandList="; + oss << loader::to_string(hCommandList); + + oss << ", "; + oss << "ptr="; + oss << loader::to_string(ptr); + + oss << ", "; + oss << "pattern="; + oss << loader::to_string(pattern); + + oss << ", "; + oss << "pattern_size="; + oss << loader::to_string(pattern_size); + + oss << ", "; + oss << "size="; + oss << loader::to_string(size); + + oss << ", "; + oss << "pNext="; + oss << loader::to_string(pNext); + + oss << ", "; + oss << "hSignalEvent="; + oss << loader::to_string(hSignalEvent); + + oss << ", "; + oss << "numWaitEvents="; + oss << loader::to_string(numWaitEvents); + oss << ", "; oss << "phWaitEvents="; oss << loader::to_string(phWaitEvents); @@ -7083,6 +7300,61 @@ namespace validation_layer oss << "numWaitEvents="; oss << loader::to_string(numWaitEvents); + oss << ", "; + oss << "phWaitEvents="; + oss << loader::to_string(phWaitEvents); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zeCommandListImmediateAppendCommandListsWithParameters( + ze_result_t result, + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zeCommandListImmediateAppendCommandListsWithParameters("; + + + oss << "hCommandListImmediate="; + oss << loader::to_string(hCommandListImmediate); + + oss << ", "; + oss << "numCommandLists="; + oss << loader::to_string(numCommandLists); + + oss << ", "; + oss << "phCommandLists="; + oss << loader::to_string(phCommandLists); + + oss << ", "; + oss << "pNext="; + oss << loader::to_string(pNext); + + oss << ", "; + oss << "hSignalEvent="; + oss << loader::to_string(hSignalEvent); + + oss << ", "; + oss << "numWaitEvents="; + oss << loader::to_string(numWaitEvents); + oss << ", "; oss << "phWaitEvents="; oss << loader::to_string(phWaitEvents); @@ -8616,6 +8888,138 @@ namespace validation_layer return logAndPropagateResult_zeDeviceGetAggregatedCopyOffloadIncrementValue(driver_result, hDevice, incrementValue); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + context.logger->log_trace("zeDeviceGetRuntimeRequirements(hDevice, pObjDesc, pSize, pRequirements)"); + + auto pfnGetRuntimeRequirements = context.zeDdiTable.Device.pfnGetRuntimeRequirements; + + if( nullptr == pfnGetRuntimeRequirements ) + return logAndPropagateResult_zeDeviceGetRuntimeRequirements(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hDevice, pObjDesc, pSize, pRequirements); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetRuntimeRequirementsPrologue( hDevice, pObjDesc, pSize, pRequirements ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceGetRuntimeRequirements(result, hDevice, pObjDesc, pSize, pRequirements); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetRuntimeRequirementsPrologue( hDevice, pObjDesc, pSize, pRequirements ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceGetRuntimeRequirements(result, hDevice, pObjDesc, pSize, pRequirements); + } + + auto driver_result = pfnGetRuntimeRequirements( hDevice, pObjDesc, pSize, pRequirements ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetRuntimeRequirementsEpilogue( hDevice, pObjDesc, pSize, pRequirements ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceGetRuntimeRequirements(result, hDevice, pObjDesc, pSize, pRequirements); + } + + return logAndPropagateResult_zeDeviceGetRuntimeRequirements(driver_result, hDevice, pObjDesc, pSize, pRequirements); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirementsKey + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + context.logger->log_trace("zeDeviceGetRuntimeRequirementsKey(hDevice, pKey)"); + + auto pfnGetRuntimeRequirementsKey = context.zeDdiTable.Device.pfnGetRuntimeRequirementsKey; + + if( nullptr == pfnGetRuntimeRequirementsKey ) + return logAndPropagateResult_zeDeviceGetRuntimeRequirementsKey(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hDevice, pKey); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetRuntimeRequirementsKeyPrologue( hDevice, pKey ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceGetRuntimeRequirementsKey(result, hDevice, pKey); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetRuntimeRequirementsKeyPrologue( hDevice, pKey ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceGetRuntimeRequirementsKey(result, hDevice, pKey); + } + + auto driver_result = pfnGetRuntimeRequirementsKey( hDevice, pKey ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetRuntimeRequirementsKeyEpilogue( hDevice, pKey ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceGetRuntimeRequirementsKey(result, hDevice, pKey); + } + + return logAndPropagateResult_zeDeviceGetRuntimeRequirementsKey(driver_result, hDevice, pKey); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceValidateRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + context.logger->log_trace("zeDeviceValidateRuntimeRequirements(hDevice, pRequirements, pOut)"); + + auto pfnValidateRuntimeRequirements = context.zeDdiTable.Device.pfnValidateRuntimeRequirements; + + if( nullptr == pfnValidateRuntimeRequirements ) + return logAndPropagateResult_zeDeviceValidateRuntimeRequirements(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hDevice, pRequirements, pOut); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceValidateRuntimeRequirementsPrologue( hDevice, pRequirements, pOut ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceValidateRuntimeRequirements(result, hDevice, pRequirements, pOut); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeDeviceValidateRuntimeRequirementsPrologue( hDevice, pRequirements, pOut ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceValidateRuntimeRequirements(result, hDevice, pRequirements, pOut); + } + + auto driver_result = pfnValidateRuntimeRequirements( hDevice, pRequirements, pOut ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceValidateRuntimeRequirementsEpilogue( hDevice, pRequirements, pOut ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeDeviceValidateRuntimeRequirements(result, hDevice, pRequirements, pOut); + } + + return logAndPropagateResult_zeDeviceValidateRuntimeRequirements(driver_result, hDevice, pRequirements, pOut); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL @@ -9804,6 +10208,56 @@ namespace validation_layer return logAndPropagateResult_zeCommandListAppendMemoryCopy(driver_result, hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryCopyWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + context.logger->log_trace("zeCommandListAppendMemoryCopyWithParameters(hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); + + auto pfnAppendMemoryCopyWithParameters = context.zeDdiTable.CommandList.pfnAppendMemoryCopyWithParameters; + + if( nullptr == pfnAppendMemoryCopyWithParameters ) + return logAndPropagateResult_zeCommandListAppendMemoryCopyWithParameters(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyWithParametersPrologue( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListAppendMemoryCopyWithParameters(result, hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryCopyWithParametersPrologue( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListAppendMemoryCopyWithParameters(result, hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + auto driver_result = pfnAppendMemoryCopyWithParameters( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyWithParametersEpilogue( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListAppendMemoryCopyWithParameters(result, hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + return logAndPropagateResult_zeCommandListAppendMemoryCopyWithParameters(driver_result, hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL @@ -9854,6 +10308,57 @@ namespace validation_layer return logAndPropagateResult_zeCommandListAppendMemoryFill(driver_result, hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryFillWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + context.logger->log_trace("zeCommandListAppendMemoryFillWithParameters(hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); + + auto pfnAppendMemoryFillWithParameters = context.zeDdiTable.CommandList.pfnAppendMemoryFillWithParameters; + + if( nullptr == pfnAppendMemoryFillWithParameters ) + return logAndPropagateResult_zeCommandListAppendMemoryFillWithParameters(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryFillWithParametersPrologue( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListAppendMemoryFillWithParameters(result, hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryFillWithParametersPrologue( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListAppendMemoryFillWithParameters(result, hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + auto driver_result = pfnAppendMemoryFillWithParameters( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryFillWithParametersEpilogue( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListAppendMemoryFillWithParameters(result, hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + return logAndPropagateResult_zeCommandListAppendMemoryFillWithParameters(driver_result, hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL @@ -17055,6 +17560,59 @@ namespace validation_layer return logAndPropagateResult_zeCommandListImmediateAppendCommandListsExp(driver_result, hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListImmediateAppendCommandListsWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + context.logger->log_trace("zeCommandListImmediateAppendCommandListsWithParameters(hCommandListImmediate, numCommandLists, phCommandListsLocal, pNext, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); + + auto pfnImmediateAppendCommandListsWithParameters = context.zeDdiTable.CommandList.pfnImmediateAppendCommandListsWithParameters; + + if( nullptr == pfnImmediateAppendCommandListsWithParameters ) + return logAndPropagateResult_zeCommandListImmediateAppendCommandListsWithParameters(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeCommandListImmediateAppendCommandListsWithParametersPrologue( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListImmediateAppendCommandListsWithParameters(result, hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeCommandListImmediateAppendCommandListsWithParametersPrologue( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListImmediateAppendCommandListsWithParameters(result, hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + auto driver_result = pfnImmediateAppendCommandListsWithParameters( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeCommandListImmediateAppendCommandListsWithParametersEpilogue( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zeCommandListImmediateAppendCommandListsWithParameters(result, hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + + return logAndPropagateResult_zeCommandListImmediateAppendCommandListsWithParameters(driver_result, hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL @@ -17825,6 +18383,18 @@ zeGetDeviceProcAddrTable( dditable.pfnGetAggregatedCopyOffloadIncrementValue = pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue; pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue = validation_layer::zeDeviceGetAggregatedCopyOffloadIncrementValue; } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetRuntimeRequirements = pDdiTable->pfnGetRuntimeRequirements; + pDdiTable->pfnGetRuntimeRequirements = validation_layer::zeDeviceGetRuntimeRequirements; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetRuntimeRequirementsKey = pDdiTable->pfnGetRuntimeRequirementsKey; + pDdiTable->pfnGetRuntimeRequirementsKey = validation_layer::zeDeviceGetRuntimeRequirementsKey; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnValidateRuntimeRequirements = pDdiTable->pfnValidateRuntimeRequirements; + pDdiTable->pfnValidateRuntimeRequirements = validation_layer::zeDeviceValidateRuntimeRequirements; + } if (version >= ZE_API_VERSION_1_2) { dditable.pfnReserveCacheExt = pDdiTable->pfnReserveCacheExt; pDdiTable->pfnReserveCacheExt = validation_layer::zeDeviceReserveCacheExt; @@ -18133,6 +18703,18 @@ zeGetCommandListProcAddrTable( dditable.pfnAppendLaunchKernelWithArguments = pDdiTable->pfnAppendLaunchKernelWithArguments; pDdiTable->pfnAppendLaunchKernelWithArguments = validation_layer::zeCommandListAppendLaunchKernelWithArguments; } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnAppendMemoryCopyWithParameters = pDdiTable->pfnAppendMemoryCopyWithParameters; + pDdiTable->pfnAppendMemoryCopyWithParameters = validation_layer::zeCommandListAppendMemoryCopyWithParameters; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnAppendMemoryFillWithParameters = pDdiTable->pfnAppendMemoryFillWithParameters; + pDdiTable->pfnAppendMemoryFillWithParameters = validation_layer::zeCommandListAppendMemoryFillWithParameters; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnImmediateAppendCommandListsWithParameters = pDdiTable->pfnImmediateAppendCommandListsWithParameters; + pDdiTable->pfnImmediateAppendCommandListsWithParameters = validation_layer::zeCommandListImmediateAppendCommandListsWithParameters; + } if (version >= ZE_API_VERSION_1_3) { dditable.pfnAppendImageCopyToMemoryExt = pDdiTable->pfnAppendImageCopyToMemoryExt; pDdiTable->pfnAppendImageCopyToMemoryExt = validation_layer::zeCommandListAppendImageCopyToMemoryExt; diff --git a/source/layers/validation/zes_valddi.cpp b/source/layers/validation/zes_valddi.cpp index 42c38c3e..14d82762 100644 --- a/source/layers/validation/zes_valddi.cpp +++ b/source/layers/validation/zes_valddi.cpp @@ -3093,6 +3093,45 @@ namespace validation_layer oss << ")"; context.logger->log_trace(oss.str()); return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesPowerGetUsage( + ze_result_t result, + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesPowerGetUsage("; + + + oss << "hPower="; + oss << loader::to_string(hPower); + + oss << ", "; + oss << "pInstantPower="; + // Dereference output parameter if not null and result is success + if (result == ZE_RESULT_SUCCESS && pInstantPower != nullptr) { + oss << loader::to_string(*pInstantPower); + } else { + oss << loader::to_string(pInstantPower); + } + + oss << ", "; + oss << "pAveragePower="; + // Dereference output parameter if not null and result is success + if (result == ZE_RESULT_SUCCESS && pAveragePower != nullptr) { + oss << loader::to_string(*pAveragePower); + } else { + oss << loader::to_string(pAveragePower); + } + oss << ")"; + context.logger->log_trace(oss.str()); + return result; } VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesDeviceEnumPsus( ze_result_t result, @@ -3920,6 +3959,59 @@ namespace validation_layer oss << ")"; context.logger->log_trace(oss.str()); return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesPowerGetLimitsExt2( + ze_result_t result, + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesPowerGetLimitsExt2("; + + + oss << "hPower="; + oss << loader::to_string(hPower); + + oss << ", "; + oss << "pLimit="; + // Dereference output parameter if not null and result is success + if (result == ZE_RESULT_SUCCESS && pLimit != nullptr) { + oss << loader::to_string(*pLimit); + } else { + oss << loader::to_string(pLimit); + } + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesPowerSetLimitsExt2( + ze_result_t result, + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesPowerSetLimitsExt2("; + + + oss << "hPower="; + oss << loader::to_string(hPower); + + oss << ", "; + oss << "limit="; + oss << loader::to_string(limit); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; } VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesEngineGetActivityExt( ze_result_t result, @@ -4021,6 +4113,141 @@ namespace validation_layer oss << ")"; context.logger->log_trace(oss.str()); return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesRasGetSupportedCategoriesExp( + ze_result_t result, + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesRasGetSupportedCategoriesExp("; + + + oss << "hRas="; + oss << loader::to_string(hRas); + + oss << ", "; + oss << "pCount="; + oss << loader::to_string(pCount); + + oss << ", "; + oss << "pCategories="; + oss << loader::to_string(pCategories); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesRasGetStateExp2( + ze_result_t result, + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesRasGetStateExp2("; + + + oss << "hRas="; + oss << loader::to_string(hRas); + + oss << ", "; + oss << "count="; + oss << loader::to_string(count); + + oss << ", "; + oss << "pCategories="; + oss << loader::to_string(pCategories); + + oss << ", "; + oss << "pState="; + // Dereference output parameter if not null and result is success + if (result == ZE_RESULT_SUCCESS && pState != nullptr) { + oss << loader::to_string(*pState); + } else { + oss << loader::to_string(pState); + } + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesRasGetConfigExp( + ze_result_t result, + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesRasGetConfigExp("; + + + oss << "hRas="; + oss << loader::to_string(hRas); + + oss << ", "; + oss << "count="; + oss << loader::to_string(count); + + oss << ", "; + oss << "pConfig="; + oss << loader::to_string(pConfig); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; + } + VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesRasSetConfigExp( + ze_result_t result, + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. +) { + // Only log success results if verbose logging is enabled + if (result == ZE_RESULT_SUCCESS && !context.verboseLogging) { + return result; + } + std::string status = (result == ZE_RESULT_SUCCESS) ? "SUCCESS" : "ERROR"; + std::ostringstream oss; + oss << status << " (" << loader::to_string(result) << ") in zesRasSetConfigExp("; + + + oss << "hRas="; + oss << loader::to_string(hRas); + + oss << ", "; + oss << "count="; + oss << loader::to_string(count); + + oss << ", "; + oss << "pConfig="; + oss << loader::to_string(pConfig); + oss << ")"; + context.logger->log_trace(oss.str()); + return result; } VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zesFirmwareGetSecurityVersionExp( ze_result_t result, @@ -9148,6 +9375,49 @@ namespace validation_layer return logAndPropagateResult_zesPowerSetEnergyThreshold(driver_result, hPower, threshold); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetUsage + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) + { + context.logger->log_trace("zesPowerGetUsage(hPower, pInstantPower, pAveragePower)"); + + auto pfnGetUsage = context.zesDdiTable.Power.pfnGetUsage; + + if( nullptr == pfnGetUsage ) + return logAndPropagateResult_zesPowerGetUsage(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hPower, pInstantPower, pAveragePower); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesPowerGetUsagePrologue( hPower, pInstantPower, pAveragePower ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerGetUsage(result, hPower, pInstantPower, pAveragePower); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetUsagePrologue( hPower, pInstantPower, pAveragePower ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerGetUsage(result, hPower, pInstantPower, pAveragePower); + } + + auto driver_result = pfnGetUsage( hPower, pInstantPower, pAveragePower ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesPowerGetUsageEpilogue( hPower, pInstantPower, pAveragePower ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerGetUsage(result, hPower, pInstantPower, pAveragePower); + } + + return logAndPropagateResult_zesPowerGetUsage(driver_result, hPower, pInstantPower, pAveragePower); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL @@ -10440,6 +10710,90 @@ namespace validation_layer return logAndPropagateResult_zesPowerSetLimitsExt(driver_result, hPower, pCount, pSustained); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) + { + context.logger->log_trace("zesPowerGetLimitsExt2(hPower, pLimit)"); + + auto pfnGetLimitsExt2 = context.zesDdiTable.Power.pfnGetLimitsExt2; + + if( nullptr == pfnGetLimitsExt2 ) + return logAndPropagateResult_zesPowerGetLimitsExt2(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hPower, pLimit); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesPowerGetLimitsExt2Prologue( hPower, pLimit ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerGetLimitsExt2(result, hPower, pLimit); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetLimitsExt2Prologue( hPower, pLimit ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerGetLimitsExt2(result, hPower, pLimit); + } + + auto driver_result = pfnGetLimitsExt2( hPower, pLimit ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesPowerGetLimitsExt2Epilogue( hPower, pLimit ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerGetLimitsExt2(result, hPower, pLimit); + } + + return logAndPropagateResult_zesPowerGetLimitsExt2(driver_result, hPower, pLimit); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerSetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) + { + context.logger->log_trace("zesPowerSetLimitsExt2(hPower, limit)"); + + auto pfnSetLimitsExt2 = context.zesDdiTable.Power.pfnSetLimitsExt2; + + if( nullptr == pfnSetLimitsExt2 ) + return logAndPropagateResult_zesPowerSetLimitsExt2(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hPower, limit); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesPowerSetLimitsExt2Prologue( hPower, limit ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerSetLimitsExt2(result, hPower, limit); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesPowerSetLimitsExt2Prologue( hPower, limit ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerSetLimitsExt2(result, hPower, limit); + } + + auto driver_result = pfnSetLimitsExt2( hPower, limit ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesPowerSetLimitsExt2Epilogue( hPower, limit ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesPowerSetLimitsExt2(result, hPower, limit); + } + + return logAndPropagateResult_zesPowerSetLimitsExt2(driver_result, hPower, limit); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL @@ -10591,6 +10945,196 @@ namespace validation_layer return logAndPropagateResult_zesRasClearStateExp(driver_result, hRas, category); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetSupportedCategoriesExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) + { + context.logger->log_trace("zesRasGetSupportedCategoriesExp(hRas, pCount, pCategories)"); + + auto pfnGetSupportedCategoriesExp = context.zesDdiTable.RasExp.pfnGetSupportedCategoriesExp; + + if( nullptr == pfnGetSupportedCategoriesExp ) + return logAndPropagateResult_zesRasGetSupportedCategoriesExp(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hRas, pCount, pCategories); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasGetSupportedCategoriesExpPrologue( hRas, pCount, pCategories ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetSupportedCategoriesExp(result, hRas, pCount, pCategories); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesRasGetSupportedCategoriesExpPrologue( hRas, pCount, pCategories ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetSupportedCategoriesExp(result, hRas, pCount, pCategories); + } + + auto driver_result = pfnGetSupportedCategoriesExp( hRas, pCount, pCategories ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasGetSupportedCategoriesExpEpilogue( hRas, pCount, pCategories ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetSupportedCategoriesExp(result, hRas, pCount, pCategories); + } + + + if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + } + return logAndPropagateResult_zesRasGetSupportedCategoriesExp(driver_result, hRas, pCount, pCategories); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetStateExp2 + __zedlllocal ze_result_t ZE_APICALL + zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) + { + context.logger->log_trace("zesRasGetStateExp2(hRas, count, pCategories, pState)"); + + auto pfnGetStateExp2 = context.zesDdiTable.RasExp.pfnGetStateExp2; + + if( nullptr == pfnGetStateExp2 ) + return logAndPropagateResult_zesRasGetStateExp2(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hRas, count, pCategories, pState); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasGetStateExp2Prologue( hRas, count, pCategories, pState ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetStateExp2(result, hRas, count, pCategories, pState); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesRasGetStateExp2Prologue( hRas, count, pCategories, pState ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetStateExp2(result, hRas, count, pCategories, pState); + } + + auto driver_result = pfnGetStateExp2( hRas, count, pCategories, pState ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasGetStateExp2Epilogue( hRas, count, pCategories, pState ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetStateExp2(result, hRas, count, pCategories, pState); + } + + return logAndPropagateResult_zesRasGetStateExp2(driver_result, hRas, count, pCategories, pState); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) + { + context.logger->log_trace("zesRasGetConfigExp(hRas, count, pConfig)"); + + auto pfnGetConfigExp = context.zesDdiTable.RasExp.pfnGetConfigExp; + + if( nullptr == pfnGetConfigExp ) + return logAndPropagateResult_zesRasGetConfigExp(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hRas, count, pConfig); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasGetConfigExpPrologue( hRas, count, pConfig ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetConfigExp(result, hRas, count, pConfig); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesRasGetConfigExpPrologue( hRas, count, pConfig ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetConfigExp(result, hRas, count, pConfig); + } + + auto driver_result = pfnGetConfigExp( hRas, count, pConfig ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasGetConfigExpEpilogue( hRas, count, pConfig ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasGetConfigExp(result, hRas, count, pConfig); + } + + + if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + } + return logAndPropagateResult_zesRasGetConfigExp(driver_result, hRas, count, pConfig); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasSetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) + { + context.logger->log_trace("zesRasSetConfigExp(hRas, count, pConfig)"); + + auto pfnSetConfigExp = context.zesDdiTable.RasExp.pfnSetConfigExp; + + if( nullptr == pfnSetConfigExp ) + return logAndPropagateResult_zesRasSetConfigExp(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, hRas, count, pConfig); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasSetConfigExpPrologue( hRas, count, pConfig ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasSetConfigExp(result, hRas, count, pConfig); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zesHandleLifetime.zesRasSetConfigExpPrologue( hRas, count, pConfig ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasSetConfigExp(result, hRas, count, pConfig); + } + + auto driver_result = pfnSetConfigExp( hRas, count, pConfig ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zesValidation->zesRasSetConfigExpEpilogue( hRas, count, pConfig ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult_zesRasSetConfigExp(result, hRas, count, pConfig); + } + + return logAndPropagateResult_zesRasSetConfigExp(driver_result, hRas, count, pConfig); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL @@ -12268,6 +12812,18 @@ zesGetPowerProcAddrTable( dditable.pfnSetLimitsExt = pDdiTable->pfnSetLimitsExt; pDdiTable->pfnSetLimitsExt = validation_layer::zesPowerSetLimitsExt; } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetUsage = pDdiTable->pfnGetUsage; + pDdiTable->pfnGetUsage = validation_layer::zesPowerGetUsage; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetLimitsExt2 = pDdiTable->pfnGetLimitsExt2; + pDdiTable->pfnGetLimitsExt2 = validation_layer::zesPowerGetLimitsExt2; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnSetLimitsExt2 = pDdiTable->pfnSetLimitsExt2; + pDdiTable->pfnSetLimitsExt2 = validation_layer::zesPowerSetLimitsExt2; + } return result; } @@ -12381,6 +12937,22 @@ zesGetRasExpProcAddrTable( dditable.pfnClearStateExp = pDdiTable->pfnClearStateExp; pDdiTable->pfnClearStateExp = validation_layer::zesRasClearStateExp; } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetSupportedCategoriesExp = pDdiTable->pfnGetSupportedCategoriesExp; + pDdiTable->pfnGetSupportedCategoriesExp = validation_layer::zesRasGetSupportedCategoriesExp; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetStateExp2 = pDdiTable->pfnGetStateExp2; + pDdiTable->pfnGetStateExp2 = validation_layer::zesRasGetStateExp2; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnGetConfigExp = pDdiTable->pfnGetConfigExp; + pDdiTable->pfnGetConfigExp = validation_layer::zesRasGetConfigExp; + } + if (version >= ZE_API_VERSION_1_16) { + dditable.pfnSetConfigExp = pDdiTable->pfnSetConfigExp; + pDdiTable->pfnSetConfigExp = validation_layer::zesRasSetConfigExp; + } return result; } diff --git a/source/layers/validation/zet_valddi.cpp b/source/layers/validation/zet_valddi.cpp index e66d6b69..08e8f85b 100644 --- a/source/layers/validation/zet_valddi.cpp +++ b/source/layers/validation/zet_valddi.cpp @@ -807,13 +807,17 @@ namespace validation_layer zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { @@ -1435,13 +1439,13 @@ namespace validation_layer VALIDATION_MAYBE_UNUSED static ze_result_t logAndPropagateResult_zetMetricTracerReadDataExp( ze_result_t result, zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { @@ -3500,13 +3504,17 @@ namespace validation_layer zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -4464,13 +4472,13 @@ namespace validation_layer __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/lib/ze_libapi.cpp b/source/lib/ze_libapi.cpp index 24b79c82..e3d562ef 100644 --- a/source/lib/ze_libapi.cpp +++ b/source/lib/ze_libapi.cpp @@ -2039,6 +2039,228 @@ zeDeviceGetAggregatedCopyOffloadIncrementValue( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Gathers null-terminated plain text representation of runtime +/// requirements for provided object. +/// +/// @details +/// - To gather requirements for a given object (e.g. an L0 module or +/// graph), pObjDesc must point to a structure (e.g. +/// ::ze_runtime_requirements_module_desc_t or +/// ::ze_runtime_requirements_graph_desc_t) describing object for which +/// the requirements are being retrieved. +/// - Requirements are copied to user-provided memory pointed to by +/// pRequirements and pSize is set to represent the actual written length +/// of the requirements string in bytes. +/// - The caller can pass nullptr for pRequirements when querying only for +/// size. +/// - The application may call this function from simultaneous threads. +/// +/// @returns +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pObjDesc` +/// + `nullptr == pSize` +/// + (nullptr != pRequirements) && (nullptr == pSize). +/// + (nullptr != pRequirements) && (*pSize < requiredSize). +/// - ::ZE_RESULT_SUCCESS +/// + Successfully gathered requirements for provided source (e.g. module). +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + Provided hDevice handle is invalid +/// + pObjDesc doesn't point to a structure that describes a supported object for which the requirements can be gathered. +ze_result_t ZE_APICALL +zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnDeviceGetRuntimeRequirements_t pfnGetRuntimeRequirements = [&result] { + auto pfnGetRuntimeRequirements = ze_lib::context->zeDdiTable.load()->Device.pfnGetRuntimeRequirements; + if( nullptr == pfnGetRuntimeRequirements ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetRuntimeRequirements; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetRuntimeRequirements( hDevice, pObjDesc, pSize, pRequirements ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetRuntimeRequirements = ze_lib::context->zeDdiTable.load()->Device.pfnGetRuntimeRequirements; + if( nullptr == pfnGetRuntimeRequirements ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetRuntimeRequirements( hDevice, pObjDesc, pSize, pRequirements ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves requirements producer key. +/// +/// @details +/// - Retrieves null-terminated plain text that represents the producer of +/// requirements (Example string: 'INTEL.L0.GPU'). +/// - Useful for bookkeeping of the requirements on user side. +/// +/// @returns +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pKey` +/// + (nullptr == pKey). +/// - ::ZE_RESULT_SUCCESS +/// + Successfully retrieved the key. +ze_result_t ZE_APICALL +zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnDeviceGetRuntimeRequirementsKey_t pfnGetRuntimeRequirementsKey = [&result] { + auto pfnGetRuntimeRequirementsKey = ze_lib::context->zeDdiTable.load()->Device.pfnGetRuntimeRequirementsKey; + if( nullptr == pfnGetRuntimeRequirementsKey ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetRuntimeRequirementsKey; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetRuntimeRequirementsKey( hDevice, pKey ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetRuntimeRequirementsKey = ze_lib::context->zeDdiTable.load()->Device.pfnGetRuntimeRequirementsKey; + if( nullptr == pfnGetRuntimeRequirementsKey ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetRuntimeRequirementsKey( hDevice, pKey ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Validates runtime requirements. +/// +/// @details +/// - To validate existing requirements (e.g. cached from previous runs), +/// requirements string should be passed as pRequirements. +/// +/// @returns +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pRequirements` +/// + `nullptr == pOut` +/// + (nullptr == pRequirements). +/// + (nullptr == pOut). +/// - ::ZE_RESULT_SUCCESS +/// + Validation call succeeded and result of the validation is available in pOut. +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + Provided hDevice handle is invalid +ze_result_t ZE_APICALL +zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnDeviceValidateRuntimeRequirements_t pfnValidateRuntimeRequirements = [&result] { + auto pfnValidateRuntimeRequirements = ze_lib::context->zeDdiTable.load()->Device.pfnValidateRuntimeRequirements; + if( nullptr == pfnValidateRuntimeRequirements ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnValidateRuntimeRequirements; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnValidateRuntimeRequirements( hDevice, pRequirements, pOut ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnValidateRuntimeRequirements = ze_lib::context->zeDdiTable.load()->Device.pfnValidateRuntimeRequirements; + if( nullptr == pfnValidateRuntimeRequirements ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnValidateRuntimeRequirements( hDevice, pRequirements, pOut ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a context for the driver. /// @@ -3939,6 +4161,100 @@ zeCommandListAppendMemoryCopy( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Copies host, device, or shared memory with additional parameters. +/// +/// @details +/// - The application must ensure the memory pointed to by dstptr and srcptr +/// is accessible by the device on which the command list was created. +/// - The implementation must not access the memory pointed to by dstptr and +/// srcptr as they are free to be modified by either the Host or device up +/// until execution. +/// - The application must ensure the events are accessible by the device on +/// which the command list was created. +/// - The application must ensure the command list and events were created, +/// and the memory was allocated, on the same context. +/// - The application must **not** call this function from simultaneous +/// threads with the same command list handle. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueCopyBuffer** +/// - **clEnqueueReadBuffer** +/// - **clEnqueueWriteBuffer** +/// - **clEnqueueSVMMemcpy** +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hCommandList` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == dstptr` +/// + `nullptr == srcptr` +/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT +/// - ::ZE_RESULT_ERROR_INVALID_SIZE +/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + an extension passed via pNext is not supported +ze_result_t ZE_APICALL +zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnCommandListAppendMemoryCopyWithParameters_t pfnAppendMemoryCopyWithParameters = [&result] { + auto pfnAppendMemoryCopyWithParameters = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryCopyWithParameters; + if( nullptr == pfnAppendMemoryCopyWithParameters ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnAppendMemoryCopyWithParameters; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnAppendMemoryCopyWithParameters( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnAppendMemoryCopyWithParameters = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryCopyWithParameters; + if( nullptr == pfnAppendMemoryCopyWithParameters ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnAppendMemoryCopyWithParameters( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Initializes host, device, or shared memory. /// @@ -4037,6 +4353,106 @@ zeCommandListAppendMemoryFill( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Initializes host, device, or shared memory with additional parameters. +/// +/// @details +/// - The application must ensure the memory pointed to by ptr is accessible +/// by the device on which the command list was created. +/// - The implementation must not access the memory pointed to by ptr as it +/// is free to be modified by either the Host or device up until +/// execution. +/// - The ptr must be aligned to pattern_size. +/// - The value to initialize memory to is described by the pattern and the +/// pattern size. +/// - The pattern size must be a power-of-two and less than or equal to the +/// `maxMemoryFillPatternSize` member of +/// ::ze_command_queue_group_properties_t. +/// - The application must ensure the events are accessible by the device on +/// which the command list was created. +/// - The application must ensure the command list and events were created, +/// and the memory was allocated, on the same context. +/// - The application must **not** call this function from simultaneous +/// threads with the same command list handle. +/// - The implementation of this function should be lock-free. +/// +/// @remarks +/// _Analogues_ +/// - **clEnqueueFillBuffer** +/// - **clEnqueueSVMMemFill** +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hCommandList` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == ptr` +/// + `nullptr == pattern` +/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT +/// - ::ZE_RESULT_ERROR_INVALID_SIZE +/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + an extension passed via pNext is not supported +ze_result_t ZE_APICALL +zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnCommandListAppendMemoryFillWithParameters_t pfnAppendMemoryFillWithParameters = [&result] { + auto pfnAppendMemoryFillWithParameters = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryFillWithParameters; + if( nullptr == pfnAppendMemoryFillWithParameters ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnAppendMemoryFillWithParameters; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnAppendMemoryFillWithParameters( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnAppendMemoryFillWithParameters = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryFillWithParameters; + if( nullptr == pfnAppendMemoryFillWithParameters ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnAppendMemoryFillWithParameters( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Copies a region from a 2D or 3D array of host, device, or shared /// memory. @@ -7263,7 +7679,7 @@ zeImageDestroy( /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < device_desc->flags` -/// + `0xf < host_desc->flags` +/// + `0x1f < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` @@ -7435,7 +7851,7 @@ zeMemAllocDevice( /// + `nullptr == host_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0xf < host_desc->flags` +/// + `0x1f < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` @@ -8738,10 +9154,10 @@ zeModuleGetNativeBinary( /// @brief Retrieve global variable pointer from Module. /// /// @details -/// - The application may query global pointer from any module that either -/// exports or imports it. -/// - The application must dynamically link a module that imports a global -/// before the global pointer can be queried from it. +/// - For modules created from SPIR-V the interpretation of `pGlobalName` is +/// described in the SPIR-V programming guide. +/// - For native modules not created from SPIR-V the interpretation of +/// `pGlobalName` is implementation defined. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// @@ -15557,6 +15973,8 @@ zeCommandListCreateCloneExp( /// @brief Appends command lists to dispatch from an immediate command list. /// /// @details +/// - @deprecated since 1.16. Please use +/// ::zeCommandListImmediateAppendCommandListsWithParameters. /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - The command lists passed to this function in the `phCommandLists` @@ -15632,6 +16050,88 @@ zeCommandListImmediateAppendCommandListsExp( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Appends command lists to dispatch from an immediate command list with +/// additional parameters. +/// +/// @details +/// - The application must call this function only with command lists +/// created with ::zeCommandListCreateImmediate. +/// - The command lists passed to this function in the `phCommandLists` +/// argument must be regular command lists (i.e. not immediate command +/// lists). +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hCommandListImmediate` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phCommandLists` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + an extension passed via pNext is not supported +ze_result_t ZE_APICALL +zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnCommandListImmediateAppendCommandListsWithParameters_t pfnImmediateAppendCommandListsWithParameters = [&result] { + auto pfnImmediateAppendCommandListsWithParameters = ze_lib::context->zeDdiTable.load()->CommandList.pfnImmediateAppendCommandListsWithParameters; + if( nullptr == pfnImmediateAppendCommandListsWithParameters ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnImmediateAppendCommandListsWithParameters; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnImmediateAppendCommandListsWithParameters( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnImmediateAppendCommandListsWithParameters = ze_lib::context->zeDdiTable.load()->CommandList.pfnImmediateAppendCommandListsWithParameters; + if( nullptr == pfnImmediateAppendCommandListsWithParameters ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnImmediateAppendCommandListsWithParameters( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Returns a unique command identifier for the next command to be /// appended to a command list. diff --git a/source/lib/ze_libddi.cpp b/source/lib/ze_libddi.cpp index aa50bd91..82422236 100644 --- a/source/lib/ze_libddi.cpp +++ b/source/lib/ze_libddi.cpp @@ -178,6 +178,12 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zeDeviceSynchronize") ); initialzeDdiTable.Device.pfnGetAggregatedCopyOffloadIncrementValue = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeDeviceGetAggregatedCopyOffloadIncrementValue") ); + initialzeDdiTable.Device.pfnGetRuntimeRequirements = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeDeviceGetRuntimeRequirements") ); + initialzeDdiTable.Device.pfnGetRuntimeRequirementsKey = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeDeviceGetRuntimeRequirementsKey") ); + initialzeDdiTable.Device.pfnValidateRuntimeRequirements = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeDeviceValidateRuntimeRequirements") ); initialzeDdiTable.Device.pfnReserveCacheExt = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeDeviceReserveCacheExt") ); initialzeDdiTable.Device.pfnSetCacheAdviceExt = reinterpret_cast( @@ -307,6 +313,12 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zeCommandListAppendLaunchKernelWithParameters") ); initialzeDdiTable.CommandList.pfnAppendLaunchKernelWithArguments = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeCommandListAppendLaunchKernelWithArguments") ); + initialzeDdiTable.CommandList.pfnAppendMemoryCopyWithParameters = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeCommandListAppendMemoryCopyWithParameters") ); + initialzeDdiTable.CommandList.pfnAppendMemoryFillWithParameters = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeCommandListAppendMemoryFillWithParameters") ); + initialzeDdiTable.CommandList.pfnImmediateAppendCommandListsWithParameters = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeCommandListImmediateAppendCommandListsWithParameters") ); initialzeDdiTable.CommandList.pfnAppendImageCopyToMemoryExt = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeCommandListAppendImageCopyToMemoryExt") ); initialzeDdiTable.CommandList.pfnAppendImageCopyFromMemoryExt = reinterpret_cast( diff --git a/source/lib/ze_tracing_register_cb_libapi.cpp b/source/lib/ze_tracing_register_cb_libapi.cpp index 6401ea28..7dd2b793 100644 --- a/source/lib/ze_tracing_register_cb_libapi.cpp +++ b/source/lib/ze_tracing_register_cb_libapi.cpp @@ -718,6 +718,81 @@ zelTracerDeviceGetAggregatedCopyOffloadIncrementValueRegisterCallback( } +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetRuntimeRequirementsRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsCb_t pfnGetRuntimeRequirementsCb + ) { + + if(!ze_lib::context->tracing_lib) + return ZE_RESULT_ERROR_UNINITIALIZED; + typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsCb_t pfnGetRuntimeRequirementsCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetRuntimeRequirementsRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnGetRuntimeRequirementsCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetRuntimeRequirementsKeyRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsKeyCb_t pfnGetRuntimeRequirementsKeyCb + ) { + + if(!ze_lib::context->tracing_lib) + return ZE_RESULT_ERROR_UNINITIALIZED; + typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetRuntimeRequirementsKeyCb_t pfnGetRuntimeRequirementsKeyCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetRuntimeRequirementsKeyRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnGetRuntimeRequirementsKeyCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceValidateRuntimeRequirementsRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceValidateRuntimeRequirementsCb_t pfnValidateRuntimeRequirementsCb + ) { + + if(!ze_lib::context->tracing_lib) + return ZE_RESULT_ERROR_UNINITIALIZED; + typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceValidateRuntimeRequirementsCb_t pfnValidateRuntimeRequirementsCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceValidateRuntimeRequirementsRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnValidateRuntimeRequirementsCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextCreateRegisterCallback( zel_tracer_handle_t hTracer, @@ -1368,6 +1443,31 @@ zelTracerCommandListAppendMemoryCopyRegisterCallback( } +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerCommandListAppendMemoryCopyWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryCopyWithParametersCb_t pfnAppendMemoryCopyWithParametersCb + ) { + + if(!ze_lib::context->tracing_lib) + return ZE_RESULT_ERROR_UNINITIALIZED; + typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryCopyWithParametersCb_t pfnAppendMemoryCopyWithParametersCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryCopyWithParametersRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnAppendMemoryCopyWithParametersCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryFillRegisterCallback( zel_tracer_handle_t hTracer, @@ -1393,6 +1493,31 @@ zelTracerCommandListAppendMemoryFillRegisterCallback( } +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerCommandListAppendMemoryFillWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryFillWithParametersCb_t pfnAppendMemoryFillWithParametersCb + ) { + + if(!ze_lib::context->tracing_lib) + return ZE_RESULT_ERROR_UNINITIALIZED; + typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListAppendMemoryFillWithParametersCb_t pfnAppendMemoryFillWithParametersCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryFillWithParametersRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnAppendMemoryFillWithParametersCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, @@ -5268,6 +5393,31 @@ zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback( } +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerCommandListImmediateAppendCommandListsWithParametersRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t pfnImmediateAppendCommandListsWithParametersCb + ) { + + if(!ze_lib::context->tracing_lib) + return ZE_RESULT_ERROR_UNINITIALIZED; + typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnCommandListImmediateAppendCommandListsWithParametersCb_t pfnImmediateAppendCommandListsWithParametersCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListImmediateAppendCommandListsWithParametersRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnImmediateAppendCommandListsWithParametersCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdExpRegisterCallback( zel_tracer_handle_t hTracer, diff --git a/source/lib/zes_libapi.cpp b/source/lib/zes_libapi.cpp index 6393a632..05257272 100644 --- a/source/lib/zes_libapi.cpp +++ b/source/lib/zes_libapi.cpp @@ -17,9 +17,10 @@ extern "C" { /// @brief Initialize 'oneAPI' System Resource Management (sysman) /// /// @details -/// - The application must call this function or ::zeInit with the -/// `ZES_ENABLE_SYSMAN` environment variable set before calling any other -/// sysman function. +/// - The application must call zesInit() before calling any other sysman +/// function. +/// - The `ZES_ENABLE_SYSMAN` environment variable method of initialization +/// is deprecated. Applications should use zesInit() instead. /// - If this function is not called then all other sysman functions will /// return ::ZE_RESULT_ERROR_UNINITIALIZED. /// - This function will only initialize sysman. To initialize other @@ -7131,6 +7132,74 @@ zesPowerSetEnergyThreshold( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get power usage +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function returns the different power usage values associated with +/// the power domain. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pInstantPower` +/// + `nullptr == pAveragePower` +ze_result_t ZE_APICALL +zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnPowerGetUsage_t pfnGetUsage = [&result] { + auto pfnGetUsage = ze_lib::context->zesDdiTable.load()->Power.pfnGetUsage; + if( nullptr == pfnGetUsage ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetUsage; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetUsage( hPower, pInstantPower, pAveragePower ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetUsage = ze_lib::context->zesDdiTable.load()->Power.pfnGetUsage; + if( nullptr == pfnGetUsage ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetUsage( hPower, pInstantPower, pAveragePower ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of power supplies /// @@ -7487,6 +7556,8 @@ zesRasGetProperties( /// @brief Get RAS error thresholds that control when RAS events are generated /// /// @details +/// - @deprecated since 1.16: This function is deprecated. Please use +/// ::zesRasGetConfigExp() instead. /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. @@ -7561,6 +7632,8 @@ zesRasGetConfig( /// @brief Set RAS error thresholds that control when RAS events are generated /// /// @details +/// - @deprecated since 1.16: This function is deprecated. Please use +/// ::zesRasSetConfigExp() instead. /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. @@ -9176,6 +9249,137 @@ zesPowerSetLimitsExt( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function returns the power limit associated with the power domain +/// of the handle. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLimit` +ze_result_t ZE_APICALL +zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnPowerGetLimitsExt2_t pfnGetLimitsExt2 = [&result] { + auto pfnGetLimitsExt2 = ze_lib::context->zesDdiTable.load()->Power.pfnGetLimitsExt2; + if( nullptr == pfnGetLimitsExt2 ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetLimitsExt2; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetLimitsExt2( hPower, pLimit ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetLimitsExt2 = ze_lib::context->zesDdiTable.load()->Power.pfnGetLimitsExt2; + if( nullptr == pfnGetLimitsExt2 ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetLimitsExt2( hPower, pLimit ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// - This function sets the power limit associated with the power domain of +/// the handle. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +ze_result_t ZE_APICALL +zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnPowerSetLimitsExt2_t pfnSetLimitsExt2 = [&result] { + auto pfnSetLimitsExt2 = ze_lib::context->zesDdiTable.load()->Power.pfnSetLimitsExt2; + if( nullptr == pfnSetLimitsExt2 ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnSetLimitsExt2; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnSetLimitsExt2( hPower, limit ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnSetLimitsExt2 = ze_lib::context->zesDdiTable.load()->Power.pfnSetLimitsExt2; + if( nullptr == pfnSetLimitsExt2 ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnSetLimitsExt2( hPower, limit ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Get activity stats for Physical Function (PF) and each Virtual /// Function (VF) associated with engine group. @@ -9357,7 +9561,7 @@ zesRasGetStateExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category` +/// + `::ZES_RAS_ERROR_CATEGORY_EXP_SOC_INTERNAL_ERRORS < category` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to clear error counters. @@ -9400,6 +9604,300 @@ zesRasClearStateExp( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get supported RAS error categories +/// +/// @details +/// - This function retrieves the supported RAS error categories for the +/// given RAS handle. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ze_result_t ZE_APICALL +zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnRasGetSupportedCategoriesExp_t pfnGetSupportedCategoriesExp = [&result] { + auto pfnGetSupportedCategoriesExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetSupportedCategoriesExp; + if( nullptr == pfnGetSupportedCategoriesExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetSupportedCategoriesExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetSupportedCategoriesExp( hRas, pCount, pCategories ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetSupportedCategoriesExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetSupportedCategoriesExp; + if( nullptr == pfnGetSupportedCategoriesExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetSupportedCategoriesExp( hRas, pCount, pCategories ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get RAS error counters for different categories +/// +/// @details +/// - This function retrieves error counters for different RAS error +/// categories. +/// - The categories and states arrays have 1:1 correspondence - pState[i] +/// contains the error counter for pCategories[i]. +/// - The caller must initialize stype and pNext fields in each element of +/// the pState array. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCategories` +/// + `nullptr == pState` +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// + Invalid category value in pCategories array. +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + One or more categories in pCategories array not supported by this RAS handle. +ze_result_t ZE_APICALL +zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnRasGetStateExp2_t pfnGetStateExp2 = [&result] { + auto pfnGetStateExp2 = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetStateExp2; + if( nullptr == pfnGetStateExp2 ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetStateExp2; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetStateExp2( hRas, count, pCategories, pState ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetStateExp2 = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetStateExp2; + if( nullptr == pfnGetStateExp2 ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetStateExp2( hRas, count, pCategories, pState ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get RAS error thresholds that control when RAS events are generated +/// +/// @details +/// - This function retrieves the RAS error thresholds for the specified RAS +/// error categories. +/// - When a particular RAS error counter for a given category exceeds the +/// configured threshold, the corresponding RAS event will be triggered. +/// - For correctable errors: ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS +/// - For uncorrectable errors: +/// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +ze_result_t ZE_APICALL +zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnRasGetConfigExp_t pfnGetConfigExp = [&result] { + auto pfnGetConfigExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetConfigExp; + if( nullptr == pfnGetConfigExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetConfigExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetConfigExp( hRas, count, pConfig ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetConfigExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetConfigExp; + if( nullptr == pfnGetConfigExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetConfigExp( hRas, count, pConfig ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set RAS error thresholds that control when RAS events are generated +/// +/// @details +/// - This function sets the RAS error thresholds for the specified RAS +/// error categories. +/// - When a particular RAS error counter for a given category exceeds the +/// specified threshold, the corresponding RAS event will be generated. +/// - Setting a threshold of 0 disables event generation for that category. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_DEVICE_LOST +/// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY +/// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE +/// - ::ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE +/// - ::ZE_RESULT_ERROR_NOT_AVAILABLE +/// - ::ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET +/// - ::ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE +/// - ::ZE_RESULT_ERROR_UNKNOWN +/// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hRas` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +/// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + Don't have permissions to set thresholds. +ze_result_t ZE_APICALL +zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) +{ + #ifdef L0_STATIC_LOADER_BUILD + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zes_pfnRasSetConfigExp_t pfnSetConfigExp = [&result] { + auto pfnSetConfigExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnSetConfigExp; + if( nullptr == pfnSetConfigExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnSetConfigExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnSetConfigExp( hRas, count, pConfig ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnSetConfigExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnSetConfigExp; + if( nullptr == pfnSetConfigExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnSetConfigExp( hRas, count, pConfig ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Get the firmware security version number of the currently running /// firmware diff --git a/source/lib/zes_libddi.cpp b/source/lib/zes_libddi.cpp index c7217641..b6cf2135 100644 --- a/source/lib/zes_libddi.cpp +++ b/source/lib/zes_libddi.cpp @@ -379,6 +379,12 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zesPowerGetLimitsExt") ); initialzesDdiTable.Power.pfnSetLimitsExt = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesPowerSetLimitsExt") ); + initialzesDdiTable.Power.pfnGetUsage = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesPowerGetUsage") ); + initialzesDdiTable.Power.pfnGetLimitsExt2 = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesPowerGetLimitsExt2") ); + initialzesDdiTable.Power.pfnSetLimitsExt2 = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesPowerSetLimitsExt2") ); } if( ZE_RESULT_SUCCESS == result ) @@ -417,6 +423,14 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zesRasGetStateExp") ); initialzesDdiTable.RasExp.pfnClearStateExp = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesRasClearStateExp") ); + initialzesDdiTable.RasExp.pfnGetSupportedCategoriesExp = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesRasGetSupportedCategoriesExp") ); + initialzesDdiTable.RasExp.pfnGetStateExp2 = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesRasGetStateExp2") ); + initialzesDdiTable.RasExp.pfnGetConfigExp = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesRasGetConfigExp") ); + initialzesDdiTable.RasExp.pfnSetConfigExp = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zesRasSetConfigExp") ); } if( ZE_RESULT_SUCCESS == result ) diff --git a/source/lib/zet_libapi.cpp b/source/lib/zet_libapi.cpp index 48dd96c3..97c7698f 100644 --- a/source/lib/zet_libapi.cpp +++ b/source/lib/zet_libapi.cpp @@ -1605,13 +1605,17 @@ zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -3074,13 +3078,13 @@ zetMetricTracerDisableExp( ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/loader/ze_ldrddi.cpp b/source/loader/ze_ldrddi.cpp index 7188fb32..578a0118 100644 --- a/source/loader/ze_ldrddi.cpp +++ b/source/loader/ze_ldrddi.cpp @@ -1234,6 +1234,87 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnGetRuntimeRequirements = dditable->ze.Device.pfnGetRuntimeRequirements; + if( nullptr == pfnGetRuntimeRequirements ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnGetRuntimeRequirements( hDevice, pObjDesc, pSize, pRequirements ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirementsKey + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnGetRuntimeRequirementsKey = dditable->ze.Device.pfnGetRuntimeRequirementsKey; + if( nullptr == pfnGetRuntimeRequirementsKey ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnGetRuntimeRequirementsKey( hDevice, pKey ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceValidateRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnValidateRuntimeRequirements = dditable->ze.Device.pfnValidateRuntimeRequirements; + if( nullptr == pfnValidateRuntimeRequirements ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnValidateRuntimeRequirements( hDevice, pRequirements, pOut ); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL @@ -2116,6 +2197,48 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryCopyWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hCommandList )->dditable; + auto pfnAppendMemoryCopyWithParameters = dditable->ze.CommandList.pfnAppendMemoryCopyWithParameters; + if( nullptr == pfnAppendMemoryCopyWithParameters ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hCommandList = reinterpret_cast( hCommandList )->handle; + + // convert loader handle to driver handle + hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; + + // convert loader handles to driver handles + auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; + for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) + phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; + + // forward to device-driver + result = pfnAppendMemoryCopyWithParameters( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEventsLocal ); + delete []phWaitEventsLocal; + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL @@ -2158,6 +2281,49 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryFillWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hCommandList )->dditable; + auto pfnAppendMemoryFillWithParameters = dditable->ze.CommandList.pfnAppendMemoryFillWithParameters; + if( nullptr == pfnAppendMemoryFillWithParameters ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hCommandList = reinterpret_cast( hCommandList )->handle; + + // convert loader handle to driver handle + hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; + + // convert loader handles to driver handles + auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; + for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) + phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; + + // forward to device-driver + result = pfnAppendMemoryFillWithParameters( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEventsLocal ); + delete []phWaitEventsLocal; + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL @@ -7402,6 +7568,57 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListImmediateAppendCommandListsWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hCommandListImmediate )->dditable; + auto pfnImmediateAppendCommandListsWithParameters = dditable->ze.CommandList.pfnImmediateAppendCommandListsWithParameters; + if( nullptr == pfnImmediateAppendCommandListsWithParameters ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hCommandListImmediate = reinterpret_cast( hCommandListImmediate )->handle; + + // convert loader handles to driver handles + auto phCommandListsLocal = new ze_command_list_handle_t [numCommandLists]; + for( size_t i = 0; ( nullptr != phCommandLists ) && ( i < numCommandLists ); ++i ) + phCommandListsLocal[ i ] = reinterpret_cast( phCommandLists[ i ] )->handle; + + // convert loader handle to driver handle + hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; + + // convert loader handles to driver handles + auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; + for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) + phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; + + // forward to device-driver + result = pfnImmediateAppendCommandListsWithParameters( hCommandListImmediate, numCommandLists, phCommandListsLocal, pNext, hSignalEvent, numWaitEvents, phWaitEventsLocal ); + delete []phCommandListsLocal; + delete []phWaitEventsLocal; + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL @@ -7704,6 +7921,9 @@ zeGetDeviceProcAddrTableLegacy() loader::loaderDispatch->pCore->Device->pfnGetVectorWidthPropertiesExt = loader::zeDeviceGetVectorWidthPropertiesExt; loader::loaderDispatch->pCore->Device->pfnSynchronize = loader::zeDeviceSynchronize; loader::loaderDispatch->pCore->Device->pfnGetAggregatedCopyOffloadIncrementValue = loader::zeDeviceGetAggregatedCopyOffloadIncrementValue; + loader::loaderDispatch->pCore->Device->pfnGetRuntimeRequirements = loader::zeDeviceGetRuntimeRequirements; + loader::loaderDispatch->pCore->Device->pfnGetRuntimeRequirementsKey = loader::zeDeviceGetRuntimeRequirementsKey; + loader::loaderDispatch->pCore->Device->pfnValidateRuntimeRequirements = loader::zeDeviceValidateRuntimeRequirements; loader::loaderDispatch->pCore->Device->pfnReserveCacheExt = loader::zeDeviceReserveCacheExt; loader::loaderDispatch->pCore->Device->pfnSetCacheAdviceExt = loader::zeDeviceSetCacheAdviceExt; loader::loaderDispatch->pCore->Device->pfnPciGetPropertiesExt = loader::zeDevicePciGetPropertiesExt; @@ -7786,6 +8006,9 @@ zeGetCommandListProcAddrTableLegacy() loader::loaderDispatch->pCore->CommandList->pfnAppendWaitExternalSemaphoreExt = loader::zeCommandListAppendWaitExternalSemaphoreExt; loader::loaderDispatch->pCore->CommandList->pfnAppendLaunchKernelWithParameters = loader::zeCommandListAppendLaunchKernelWithParameters; loader::loaderDispatch->pCore->CommandList->pfnAppendLaunchKernelWithArguments = loader::zeCommandListAppendLaunchKernelWithArguments; + loader::loaderDispatch->pCore->CommandList->pfnAppendMemoryCopyWithParameters = loader::zeCommandListAppendMemoryCopyWithParameters; + loader::loaderDispatch->pCore->CommandList->pfnAppendMemoryFillWithParameters = loader::zeCommandListAppendMemoryFillWithParameters; + loader::loaderDispatch->pCore->CommandList->pfnImmediateAppendCommandListsWithParameters = loader::zeCommandListImmediateAppendCommandListsWithParameters; loader::loaderDispatch->pCore->CommandList->pfnAppendImageCopyToMemoryExt = loader::zeCommandListAppendImageCopyToMemoryExt; loader::loaderDispatch->pCore->CommandList->pfnAppendImageCopyFromMemoryExt = loader::zeCommandListAppendImageCopyFromMemoryExt; loader::loaderDispatch->pCore->CommandList->pfnHostSynchronize = loader::zeCommandListHostSynchronize; @@ -9786,6 +10009,27 @@ zeGetDeviceProcAddrTable( pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue = loader::zeDeviceGetAggregatedCopyOffloadIncrementValue; } } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetRuntimeRequirements = loader_driver_ddi::zeDeviceGetRuntimeRequirements; + } else { + pDdiTable->pfnGetRuntimeRequirements = loader::zeDeviceGetRuntimeRequirements; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetRuntimeRequirementsKey = loader_driver_ddi::zeDeviceGetRuntimeRequirementsKey; + } else { + pDdiTable->pfnGetRuntimeRequirementsKey = loader::zeDeviceGetRuntimeRequirementsKey; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnValidateRuntimeRequirements = loader_driver_ddi::zeDeviceValidateRuntimeRequirements; + } else { + pDdiTable->pfnValidateRuntimeRequirements = loader::zeDeviceValidateRuntimeRequirements; + } + } if (version >= ZE_API_VERSION_1_2) { if (loader::context->driverDDIPathDefault) { pDdiTable->pfnReserveCacheExt = loader_driver_ddi::zeDeviceReserveCacheExt; @@ -9879,6 +10123,15 @@ zeGetDeviceProcAddrTable( if (version >= ZE_API_VERSION_1_15) { pDdiTable->pfnGetAggregatedCopyOffloadIncrementValue = firstDriver->dditable.ze.Device.pfnGetAggregatedCopyOffloadIncrementValue; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetRuntimeRequirements = firstDriver->dditable.ze.Device.pfnGetRuntimeRequirements; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetRuntimeRequirementsKey = firstDriver->dditable.ze.Device.pfnGetRuntimeRequirementsKey; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnValidateRuntimeRequirements = firstDriver->dditable.ze.Device.pfnValidateRuntimeRequirements; + } if (version >= ZE_API_VERSION_1_2) { pDdiTable->pfnReserveCacheExt = firstDriver->dditable.ze.Device.pfnReserveCacheExt; } @@ -10568,6 +10821,27 @@ zeGetCommandListProcAddrTable( pDdiTable->pfnAppendLaunchKernelWithArguments = loader::zeCommandListAppendLaunchKernelWithArguments; } } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnAppendMemoryCopyWithParameters = loader_driver_ddi::zeCommandListAppendMemoryCopyWithParameters; + } else { + pDdiTable->pfnAppendMemoryCopyWithParameters = loader::zeCommandListAppendMemoryCopyWithParameters; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnAppendMemoryFillWithParameters = loader_driver_ddi::zeCommandListAppendMemoryFillWithParameters; + } else { + pDdiTable->pfnAppendMemoryFillWithParameters = loader::zeCommandListAppendMemoryFillWithParameters; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnImmediateAppendCommandListsWithParameters = loader_driver_ddi::zeCommandListImmediateAppendCommandListsWithParameters; + } else { + pDdiTable->pfnImmediateAppendCommandListsWithParameters = loader::zeCommandListImmediateAppendCommandListsWithParameters; + } + } if (version >= ZE_API_VERSION_1_3) { if (loader::context->driverDDIPathDefault) { pDdiTable->pfnAppendImageCopyToMemoryExt = loader_driver_ddi::zeCommandListAppendImageCopyToMemoryExt; @@ -10719,6 +10993,15 @@ zeGetCommandListProcAddrTable( if (version >= ZE_API_VERSION_1_14) { pDdiTable->pfnAppendLaunchKernelWithArguments = firstDriver->dditable.ze.CommandList.pfnAppendLaunchKernelWithArguments; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnAppendMemoryCopyWithParameters = firstDriver->dditable.ze.CommandList.pfnAppendMemoryCopyWithParameters; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnAppendMemoryFillWithParameters = firstDriver->dditable.ze.CommandList.pfnAppendMemoryFillWithParameters; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnImmediateAppendCommandListsWithParameters = firstDriver->dditable.ze.CommandList.pfnImmediateAppendCommandListsWithParameters; + } if (version >= ZE_API_VERSION_1_3) { pDdiTable->pfnAppendImageCopyToMemoryExt = firstDriver->dditable.ze.CommandList.pfnAppendImageCopyToMemoryExt; } diff --git a/source/loader/ze_ldrddi.h b/source/loader/ze_ldrddi.h index 9314fcb2..c51e59f0 100644 --- a/source/loader/ze_ldrddi.h +++ b/source/loader/ze_ldrddi.h @@ -46,6 +46,9 @@ namespace loader using ze_module_object_t = object_t < ze_module_handle_t >; using ze_module_factory_t = singleton_factory_t < ze_module_object_t, ze_module_handle_t >; + using ze_graph_object_t = object_t < ze_graph_handle_t >; + using ze_graph_factory_t = singleton_factory_t < ze_graph_object_t, ze_graph_handle_t >; + using ze_module_build_log_object_t = object_t < ze_module_build_log_handle_t >; using ze_module_build_log_factory_t = singleton_factory_t < ze_module_build_log_object_t, ze_module_build_log_handle_t >; @@ -271,6 +274,27 @@ namespace loader_driver_ddi uint32_t* incrementValue ///< [out] increment value that can be used for Event creation ); __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ); + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ); + __zedlllocal ze_result_t ZE_APICALL + zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ); + __zedlllocal ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor @@ -454,6 +478,19 @@ namespace loader_driver_ddi ///< on before launching ); __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ); + __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize @@ -467,6 +504,20 @@ namespace loader_driver_ddi ///< on before launching ); __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ); + __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to @@ -1666,6 +1717,22 @@ namespace loader_driver_ddi ///< of any appended command list(s) ); __zedlllocal ze_result_t ZE_APICALL + zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ); + __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor diff --git a/source/loader/ze_ldrddi_driver_ddi.cpp b/source/loader/ze_ldrddi_driver_ddi.cpp index 9ef2dadb..f4708e87 100644 --- a/source/loader/ze_ldrddi_driver_ddi.cpp +++ b/source/loader/ze_ldrddi_driver_ddi.cpp @@ -844,6 +844,105 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const void* pObjDesc, ///< [in] describes the object for which the requirements are to be + ///< gathered + size_t* pSize, ///< [in,out] size of requirements string in bytes. + char* pRequirements ///< [in,out][optional] holds results of the query. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hDevice )->pCore; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->Device == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetRuntimeRequirements = dditable->Device->pfnGetRuntimeRequirements; + if( nullptr == pfnGetRuntimeRequirements ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetRuntimeRequirements( hDevice, pObjDesc, pSize, pRequirements ); + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetRuntimeRequirementsKey + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetRuntimeRequirementsKey( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char** pKey ///< [out] returned key + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hDevice )->pCore; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->Device == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetRuntimeRequirementsKey = dditable->Device->pfnGetRuntimeRequirementsKey; + if( nullptr == pfnGetRuntimeRequirementsKey ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetRuntimeRequirementsKey( hDevice, pKey ); + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceValidateRuntimeRequirements + __zedlllocal ze_result_t ZE_APICALL + zeDeviceValidateRuntimeRequirements( + ze_device_handle_t hDevice, ///< [in] handle of the device + const char* pRequirements, ///< [in] requirements to be validated. Requirements should be + ///< null-terminated plain text representation of runtime requirements + ///< previously retrieved from the device. + ze_validate_runtime_requirements_output_t* pOut ///< [in][out] Output of the validation call. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hDevice )->pCore; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->Device == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnValidateRuntimeRequirements = dditable->Device->pfnValidateRuntimeRequirements; + if( nullptr == pfnValidateRuntimeRequirements ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnValidateRuntimeRequirements( hDevice, pRequirements, pOut ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL @@ -1703,6 +1802,45 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryCopyWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryCopyWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination memory to copy to + const void* srcptr, ///< [in] pointer to source memory to copy from + size_t size, ///< [in] size in bytes to copy + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hCommandList )->pCore; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->CommandList == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnAppendMemoryCopyWithParameters = dditable->CommandList->pfnAppendMemoryCopyWithParameters; + if( nullptr == pfnAppendMemoryCopyWithParameters ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnAppendMemoryCopyWithParameters( hCommandList, dstptr, srcptr, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL @@ -1742,6 +1880,46 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListAppendMemoryFillWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListAppendMemoryFillWithParameters( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* ptr, ///< [in] pointer to memory to initialize + const void* pattern, ///< [in] pointer to value to initialize memory to + size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to + size_t size, ///< [in] size in bytes to initialize + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 + ///< if `nullptr == phWaitEvents` + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before launching + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hCommandList )->pCore; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->CommandList == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnAppendMemoryFillWithParameters = dditable->CommandList->pfnAppendMemoryFillWithParameters; + if( nullptr == pfnAppendMemoryFillWithParameters ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnAppendMemoryFillWithParameters( hCommandList, ptr, pattern, pattern_size, size, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL @@ -6971,6 +7149,48 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeCommandListImmediateAppendCommandListsWithParameters + __zedlllocal ze_result_t ZE_APICALL + zeCommandListImmediateAppendCommandListsWithParameters( + ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list + uint32_t numCommandLists, ///< [in] number of command lists + ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists + const void* pNext, ///< [in][optional] additional extensions passed to the function + ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion + ///< - if not null, this event is signaled after the completion of all + ///< appended command lists + uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended + ///< command lists; must be 0 if nullptr == phWaitEvents + ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait + ///< on before executing appended command lists. + ///< - if not null, all wait events must be satisfied prior to the start + ///< of any appended command list(s) + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hCommandListImmediate )->pCore; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->CommandList == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnImmediateAppendCommandListsWithParameters = dditable->CommandList->pfnImmediateAppendCommandListsWithParameters; + if( nullptr == pfnImmediateAppendCommandListsWithParameters ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnImmediateAppendCommandListsWithParameters( hCommandListImmediate, numCommandLists, phCommandLists, pNext, hSignalEvent, numWaitEvents, phWaitEvents ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL diff --git a/source/loader/ze_loader_internal.h b/source/loader/ze_loader_internal.h index 11b658bd..3bd41c36 100644 --- a/source/loader/ze_loader_internal.h +++ b/source/loader/ze_loader_internal.h @@ -89,6 +89,7 @@ namespace loader ze_fabric_edge_factory_t ze_fabric_edge_factory; ze_fabric_vertex_factory_t ze_fabric_vertex_factory; ze_fence_factory_t ze_fence_factory; + ze_graph_factory_t ze_graph_factory; ze_image_factory_t ze_image_factory; ze_kernel_factory_t ze_kernel_factory; ze_module_build_log_factory_t ze_module_build_log_factory; diff --git a/source/loader/zes_ldrddi.cpp b/source/loader/zes_ldrddi.cpp index 61ce3983..5cd216c7 100644 --- a/source/loader/zes_ldrddi.cpp +++ b/source/loader/zes_ldrddi.cpp @@ -3260,6 +3260,32 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetUsage + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hPower )->dditable; + auto pfnGetUsage = dditable->zes.Power.pfnGetUsage; + if( nullptr == pfnGetUsage ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hPower = reinterpret_cast( hPower )->handle; + + // forward to device-driver + result = pfnGetUsage( hPower, pInstantPower, pAveragePower ); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL @@ -4134,6 +4160,56 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hPower )->dditable; + auto pfnGetLimitsExt2 = dditable->zes.Power.pfnGetLimitsExt2; + if( nullptr == pfnGetLimitsExt2 ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hPower = reinterpret_cast( hPower )->handle; + + // forward to device-driver + result = pfnGetLimitsExt2( hPower, pLimit ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerSetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hPower )->dditable; + auto pfnSetLimitsExt2 = dditable->zes.Power.pfnSetLimitsExt2; + if( nullptr == pfnSetLimitsExt2 ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hPower = reinterpret_cast( hPower )->handle; + + // forward to device-driver + result = pfnSetLimitsExt2( hPower, limit ); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL @@ -4230,6 +4306,120 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetSupportedCategoriesExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hRas )->dditable; + auto pfnGetSupportedCategoriesExp = dditable->zes.RasExp.pfnGetSupportedCategoriesExp; + if( nullptr == pfnGetSupportedCategoriesExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hRas = reinterpret_cast( hRas )->handle; + + // forward to device-driver + result = pfnGetSupportedCategoriesExp( hRas, pCount, pCategories ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetStateExp2 + __zedlllocal ze_result_t ZE_APICALL + zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hRas )->dditable; + auto pfnGetStateExp2 = dditable->zes.RasExp.pfnGetStateExp2; + if( nullptr == pfnGetStateExp2 ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hRas = reinterpret_cast( hRas )->handle; + + // forward to device-driver + result = pfnGetStateExp2( hRas, count, pCategories, pState ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hRas )->dditable; + auto pfnGetConfigExp = dditable->zes.RasExp.pfnGetConfigExp; + if( nullptr == pfnGetConfigExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hRas = reinterpret_cast( hRas )->handle; + + // forward to device-driver + result = pfnGetConfigExp( hRas, count, pConfig ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasSetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hRas )->dditable; + auto pfnSetConfigExp = dditable->zes.RasExp.pfnSetConfigExp; + if( nullptr == pfnSetConfigExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hRas = reinterpret_cast( hRas )->handle; + + // forward to device-driver + result = pfnSetConfigExp( hRas, count, pConfig ); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL @@ -4987,6 +5177,9 @@ zesGetPowerProcAddrTableLegacy() loader::loaderDispatch->pSysman->Power->pfnSetEnergyThreshold = loader::zesPowerSetEnergyThreshold; loader::loaderDispatch->pSysman->Power->pfnGetLimitsExt = loader::zesPowerGetLimitsExt; loader::loaderDispatch->pSysman->Power->pfnSetLimitsExt = loader::zesPowerSetLimitsExt; + loader::loaderDispatch->pSysman->Power->pfnGetUsage = loader::zesPowerGetUsage; + loader::loaderDispatch->pSysman->Power->pfnGetLimitsExt2 = loader::zesPowerGetLimitsExt2; + loader::loaderDispatch->pSysman->Power->pfnSetLimitsExt2 = loader::zesPowerSetLimitsExt2; } /////////////////////////////////////////////////////////////////////////////// @@ -5019,6 +5212,10 @@ zesGetRasExpProcAddrTableLegacy() // return pointers to the Loader's Functions. loader::loaderDispatch->pSysman->RasExp->pfnGetStateExp = loader::zesRasGetStateExp; loader::loaderDispatch->pSysman->RasExp->pfnClearStateExp = loader::zesRasClearStateExp; + loader::loaderDispatch->pSysman->RasExp->pfnGetSupportedCategoriesExp = loader::zesRasGetSupportedCategoriesExp; + loader::loaderDispatch->pSysman->RasExp->pfnGetStateExp2 = loader::zesRasGetStateExp2; + loader::loaderDispatch->pSysman->RasExp->pfnGetConfigExp = loader::zesRasGetConfigExp; + loader::loaderDispatch->pSysman->RasExp->pfnSetConfigExp = loader::zesRasSetConfigExp; } /////////////////////////////////////////////////////////////////////////////// @@ -7861,6 +8058,27 @@ zesGetPowerProcAddrTable( pDdiTable->pfnSetLimitsExt = loader::zesPowerSetLimitsExt; } } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetUsage = loader_driver_ddi::zesPowerGetUsage; + } else { + pDdiTable->pfnGetUsage = loader::zesPowerGetUsage; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetLimitsExt2 = loader_driver_ddi::zesPowerGetLimitsExt2; + } else { + pDdiTable->pfnGetLimitsExt2 = loader::zesPowerGetLimitsExt2; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnSetLimitsExt2 = loader_driver_ddi::zesPowerSetLimitsExt2; + } else { + pDdiTable->pfnSetLimitsExt2 = loader::zesPowerSetLimitsExt2; + } + } zesGetPowerProcAddrTableLegacy(); } else @@ -7890,6 +8108,15 @@ zesGetPowerProcAddrTable( if (version >= ZE_API_VERSION_1_0) { pDdiTable->pfnSetLimitsExt = firstDriver->dditable.zes.Power.pfnSetLimitsExt; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetUsage = firstDriver->dditable.zes.Power.pfnGetUsage; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetLimitsExt2 = firstDriver->dditable.zes.Power.pfnGetLimitsExt2; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnSetLimitsExt2 = firstDriver->dditable.zes.Power.pfnSetLimitsExt2; + } } } @@ -8145,6 +8372,34 @@ zesGetRasExpProcAddrTable( pDdiTable->pfnClearStateExp = loader::zesRasClearStateExp; } } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetSupportedCategoriesExp = loader_driver_ddi::zesRasGetSupportedCategoriesExp; + } else { + pDdiTable->pfnGetSupportedCategoriesExp = loader::zesRasGetSupportedCategoriesExp; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetStateExp2 = loader_driver_ddi::zesRasGetStateExp2; + } else { + pDdiTable->pfnGetStateExp2 = loader::zesRasGetStateExp2; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnGetConfigExp = loader_driver_ddi::zesRasGetConfigExp; + } else { + pDdiTable->pfnGetConfigExp = loader::zesRasGetConfigExp; + } + } + if (version >= ZE_API_VERSION_1_16) { + if (loader::context->driverDDIPathDefault) { + pDdiTable->pfnSetConfigExp = loader_driver_ddi::zesRasSetConfigExp; + } else { + pDdiTable->pfnSetConfigExp = loader::zesRasSetConfigExp; + } + } zesGetRasExpProcAddrTableLegacy(); } else @@ -8156,6 +8411,18 @@ zesGetRasExpProcAddrTable( if (version >= ZE_API_VERSION_1_0) { pDdiTable->pfnClearStateExp = firstDriver->dditable.zes.RasExp.pfnClearStateExp; } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetSupportedCategoriesExp = firstDriver->dditable.zes.RasExp.pfnGetSupportedCategoriesExp; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetStateExp2 = firstDriver->dditable.zes.RasExp.pfnGetStateExp2; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnGetConfigExp = firstDriver->dditable.zes.RasExp.pfnGetConfigExp; + } + if (version >= ZE_API_VERSION_1_16) { + pDdiTable->pfnSetConfigExp = firstDriver->dditable.zes.RasExp.pfnSetConfigExp; + } } } diff --git a/source/loader/zes_ldrddi.h b/source/loader/zes_ldrddi.h index 55e2d635..d60095c5 100644 --- a/source/loader/zes_ldrddi.h +++ b/source/loader/zes_ldrddi.h @@ -860,6 +860,12 @@ namespace loader_driver_ddi double threshold ///< [in] The energy threshold to be set in joules. ); __zedlllocal ze_result_t ZE_APICALL + zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ); + __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPsus( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. @@ -1079,6 +1085,16 @@ namespace loader_driver_ddi zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ); __zedlllocal ze_result_t ZE_APICALL + zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ); + __zedlllocal ze_result_t ZE_APICALL + zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ); + __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivityExt( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. @@ -1115,6 +1131,40 @@ namespace loader_driver_ddi zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ); __zedlllocal ze_result_t ZE_APICALL + zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ); + __zedlllocal ze_result_t ZE_APICALL + zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ); + __zedlllocal ze_result_t ZE_APICALL + zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ); + __zedlllocal ze_result_t ZE_APICALL + zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ); + __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetSecurityVersionExp( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be diff --git a/source/loader/zes_ldrddi_driver_ddi.cpp b/source/loader/zes_ldrddi_driver_ddi.cpp index b2b019d1..a72707a2 100644 --- a/source/loader/zes_ldrddi_driver_ddi.cpp +++ b/source/loader/zes_ldrddi_driver_ddi.cpp @@ -3415,6 +3415,38 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetUsage + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetUsage( + zes_pwr_handle_t hPower, ///< [in] Handle of the power domain. + uint32_t* pInstantPower, ///< [out] Returns the instant power usage in milliwatts. + uint32_t* pAveragePower ///< [out] Returns the average power usage in milliwatts. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hPower )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->Power == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetUsage = dditable->Power->pfnGetUsage; + if( nullptr == pfnGetUsage ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetUsage( hPower, pInstantPower, pAveragePower ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL @@ -4388,6 +4420,68 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerGetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerGetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + uint32_t* pLimit ///< [out] Returns limit value in milliwatts for given power domain. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hPower )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->Power == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetLimitsExt2 = dditable->Power->pfnGetLimitsExt2; + if( nullptr == pfnGetLimitsExt2 ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetLimitsExt2( hPower, pLimit ); + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesPowerSetLimitsExt2 + __zedlllocal ze_result_t ZE_APICALL + zesPowerSetLimitsExt2( + zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. + const uint32_t limit ///< [in] Limit value in milliwatts to be set for given power domain. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hPower )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->Power == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnSetLimitsExt2 = dditable->Power->pfnSetLimitsExt2; + if( nullptr == pfnSetLimitsExt2 ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnSetLimitsExt2( hPower, limit ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL @@ -4502,6 +4596,144 @@ namespace loader_driver_ddi return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetSupportedCategoriesExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetSupportedCategoriesExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + uint32_t* pCount, ///< [in,out] pointer to the number of categories. + ///< if count is zero, then the driver shall update the value with the + ///< total number of categories supported. + ///< if count is non-zero, then driver shall only retrieve that number of categories. + zes_ras_error_category_exp_t* pCategories ///< [in,out][optional][range(0, *pCount)] array of category types. + ///< if count is less than the number of categories supported, then driver + ///< shall only retrieve that number of categories. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hRas )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->RasExp == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetSupportedCategoriesExp = dditable->RasExp->pfnGetSupportedCategoriesExp; + if( nullptr == pfnGetSupportedCategoriesExp ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetSupportedCategoriesExp( hRas, pCount, pCategories ); + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetStateExp2 + __zedlllocal ze_result_t ZE_APICALL + zesRasGetStateExp2( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of elements in pCategories (same as in pState array). + const zes_ras_error_category_exp_t* pCategories,///< [in][range(0, count)] Array of RAS error categories to query. + zes_ras_state_exp2_t* pState ///< [out][range(0, count)] Array of RAS error states. Caller must + ///< initialize stype and pNext for each element. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hRas )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->RasExp == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetStateExp2 = dditable->RasExp->pfnGetStateExp2; + if( nullptr == pfnGetStateExp2 ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetStateExp2( hRas, count, pCategories, pState ); + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasGetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasGetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + zes_ras_config_exp_t* pConfig ///< [in,out][range(0, count)] array of RAS configuration structures. + ///< The caller should set the category field for each entry to specify + ///< which categories to query. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hRas )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->RasExp == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnGetConfigExp = dditable->RasExp->pfnGetConfigExp; + if( nullptr == pfnGetConfigExp ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnGetConfigExp( hRas, count, pConfig ); + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zesRasSetConfigExp + __zedlllocal ze_result_t ZE_APICALL + zesRasSetConfigExp( + zes_ras_handle_t hRas, ///< [in] Handle for the component. + const uint32_t count, ///< [in] Number of RAS configuration structures in pConfig array. + const zes_ras_config_exp_t* pConfig ///< [in][range(0, count)] array of RAS configuration structures specifying + ///< thresholds for different error categories. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract handle's function pointer table + auto dditable = reinterpret_cast( hRas )->pSysman; + if (dditable->isValidFlag == 0) + return ZE_RESULT_ERROR_UNINITIALIZED; + // Check that api version in the driver is supported by this version of the API + if (dditable->version < ZE_API_VERSION_1_16) { + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + } + // Check that the driver has the function pointer table init + if (dditable->RasExp == nullptr) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + auto pfnSetConfigExp = dditable->RasExp->pfnSetConfigExp; + if( nullptr == pfnSetConfigExp ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + // forward to device-driver + result = pfnSetConfigExp( hRas, count, pConfig ); + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL diff --git a/source/loader/zet_ldrddi.cpp b/source/loader/zet_ldrddi.cpp index dae7f99e..6552bc50 100644 --- a/source/loader/zet_ldrddi.cpp +++ b/source/loader/zet_ldrddi.cpp @@ -868,13 +868,17 @@ namespace loader zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -1542,13 +1546,13 @@ namespace loader __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/loader/zet_ldrddi.h b/source/loader/zet_ldrddi.h index 1916aeff..86db1443 100644 --- a/source/loader/zet_ldrddi.h +++ b/source/loader/zet_ldrddi.h @@ -278,13 +278,17 @@ namespace loader_driver_ddi zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ); @@ -425,13 +429,13 @@ namespace loader_driver_ddi __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ); diff --git a/source/loader/zet_ldrddi_driver_ddi.cpp b/source/loader/zet_ldrddi_driver_ddi.cpp index b18e6369..d52c0129 100644 --- a/source/loader/zet_ldrddi_driver_ddi.cpp +++ b/source/loader/zet_ldrddi_driver_ddi.cpp @@ -817,13 +817,17 @@ namespace loader_driver_ddi zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all reports available. - ///< if size is non-zero, then driver will only retrieve the number of - ///< reports that fit into the buffer. - ///< if size is larger than size needed for all reports, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. + ///< @deprecated: The behavior of passing in zero size and the function + ///< returning the required size is deprecated, + ///< for now it returns only the maximum buffer size regardless + ///< of how much data there is available to be read. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) @@ -1510,13 +1514,13 @@ namespace loader_driver_ddi __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer - size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. - ///< if size is zero, then the driver will update the value with the total - ///< size in bytes needed for all data available. - ///< if size is non-zero, then driver will only retrieve that amount of - ///< data. - ///< if size is larger than size needed for all data, then driver will - ///< update the value with the actual size needed. + size_t* pRawDataSize, ///< [in,out] pointer to the size in bytes of raw data requested to read. + ///< The driver will only retrieve the number of reports that fit into the buffer. + ///< pRawDataSize will be updated by the driver to reflect the actual + ///< number of bytes written into the buffer. + ///< If the size returns the full size requested, the application may need + ///< to issue additional reads to + ///< retrieve any remaining reports that did not fit into the buffer. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) diff --git a/source/utils/ze_to_string.h b/source/utils/ze_to_string.h index 73b14709..d9ca6fb5 100644 --- a/source/utils/ze_to_string.h +++ b/source/utils/ze_to_string.h @@ -76,6 +76,10 @@ inline std::string to_string(ze_module_handle_t handle) { return to_string(reinterpret_cast(handle)); } +inline std::string to_string(ze_graph_handle_t handle) { + return to_string(reinterpret_cast(handle)); +} + inline std::string to_string(ze_module_build_log_handle_t handle) { return to_string(reinterpret_cast(handle)); } @@ -428,6 +432,26 @@ inline std::string to_string(const ze_device_compute_properties_t& desc) { return to_string(&desc); } +inline std::string to_string(const ze_device_compute_dotproduct_ext_properties_t* desc) { + if (!desc) return "nullptr"; + std::ostringstream oss; + oss << "{"; + oss << "stype=" << to_string(&desc->stype); + oss << ", dp_caps=" << to_string(&desc->dp_caps); + oss << ", dpv4_input_types=" << to_string(&desc->dpv4_input_types); + oss << ", dpv4_output_types=" << to_string(&desc->dpv4_output_types); + oss << ", dpas_input_types=" << to_string(&desc->dpas_input_types); + oss << ", dpas_output_types=" << to_string(&desc->dpas_output_types); + oss << ", bdpas_input_types=" << to_string(&desc->bdpas_input_types); + oss << ", bdpas_output_types=" << to_string(&desc->bdpas_output_types); + oss << "}"; + return oss.str(); +} + +inline std::string to_string(const ze_device_compute_dotproduct_ext_properties_t& desc) { + return to_string(&desc); +} + inline std::string to_string(const ze_native_kernel_uuid_t* desc) { if (!desc) return "nullptr"; std::ostringstream oss; @@ -595,6 +619,48 @@ inline std::string to_string(const ze_device_event_properties_t& desc) { return to_string(&desc); } +inline std::string to_string(const ze_runtime_requirements_module_desc_t* desc) { + if (!desc) return "nullptr"; + std::ostringstream oss; + oss << "{"; + oss << "stype=" << to_string(&desc->stype); + oss << ", requirementsSrc=" << to_string(&desc->requirementsSrc); + oss << "}"; + return oss.str(); +} + +inline std::string to_string(const ze_runtime_requirements_module_desc_t& desc) { + return to_string(&desc); +} + +inline std::string to_string(const ze_runtime_requirements_graph_desc_t* desc) { + if (!desc) return "nullptr"; + std::ostringstream oss; + oss << "{"; + oss << "stype=" << to_string(&desc->stype); + oss << ", requirementsSrc=" << to_string(&desc->requirementsSrc); + oss << "}"; + return oss.str(); +} + +inline std::string to_string(const ze_runtime_requirements_graph_desc_t& desc) { + return to_string(&desc); +} + +inline std::string to_string(const ze_validate_runtime_requirements_output_t* desc) { + if (!desc) return "nullptr"; + std::ostringstream oss; + oss << "{"; + oss << "stype=" << to_string(&desc->stype); + oss << ", result=" << to_string(&desc->result); + oss << "}"; + return oss.str(); +} + +inline std::string to_string(const ze_validate_runtime_requirements_output_t& desc) { + return to_string(&desc); +} + inline std::string to_string(const ze_context_desc_t* desc) { if (!desc) return "nullptr"; std::ostringstream oss; diff --git a/source/utils/zes_to_string.h b/source/utils/zes_to_string.h index 1ffa8f00..432fae19 100644 --- a/source/utils/zes_to_string.h +++ b/source/utils/zes_to_string.h @@ -1300,6 +1300,35 @@ inline std::string to_string(const zes_ras_state_exp_t& desc) { return to_string(&desc); } +inline std::string to_string(const zes_ras_state_exp2_t* desc) { + if (!desc) return "nullptr"; + std::ostringstream oss; + oss << "{"; + oss << "stype=" << to_string(&desc->stype); + oss << ", errorCounter=" << to_string(desc->errorCounter); + oss << "}"; + return oss.str(); +} + +inline std::string to_string(const zes_ras_state_exp2_t& desc) { + return to_string(&desc); +} + +inline std::string to_string(const zes_ras_config_exp_t* desc) { + if (!desc) return "nullptr"; + std::ostringstream oss; + oss << "{"; + oss << "stype=" << to_string(&desc->stype); + oss << ", category=" << to_string(&desc->category); + oss << ", threshold=" << to_string(desc->threshold); + oss << "}"; + return oss.str(); +} + +inline std::string to_string(const zes_ras_config_exp_t& desc) { + return to_string(&desc); +} + inline std::string to_string(const zes_mem_page_offline_state_exp_t* desc) { if (!desc) return "nullptr"; std::ostringstream oss;