diff --git a/CHANGELOG.md b/CHANGELOG.md index aab11a01..1292ad51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Level zero loader changelog +## v1.22.0 +* Update to support v1.13.1 of the Level Zero Spec +* Add testing stdout from zeInitDrivers in CI +* Only Enable Teardown thread on windows and remove debug on success ## v1.21.9 * Fix init checks when sorting legacy drivers * Fix MSVC Link optimization flags diff --git a/CMakeLists.txt b/CMakeLists.txt index b2114c34..2b43d6a1 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.21.9) +project(level-zero VERSION 1.22.0) include(GNUInstallDirs) diff --git a/PRODUCT_GUID.txt b/PRODUCT_GUID.txt index 85c64204..3057573c 100644 --- a/PRODUCT_GUID.txt +++ b/PRODUCT_GUID.txt @@ -1,2 +1,2 @@ -1.21.9 -01037281-c9ef-43cf-bc65-f72fb3438788 \ No newline at end of file +1.22.0 +144d1a88-75bd-4f4a-8871-3660a84f7380 \ 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 a04d08ed..18b795d9 100644 --- a/include/layers/zel_tracing_register_cb.h +++ b/include/layers/zel_tracing_register_cb.h @@ -54,6 +54,150 @@ typedef void (ZE_APICALL *ze_pfnInitDriversCb_t)( void** ppTracerInstanceUserData ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASBuilderCreateExt +/// @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_rtas_builder_create_ext_params_t +{ + ze_driver_handle_t* phDriver; + const ze_rtas_builder_ext_desc_t** ppDescriptor; + ze_rtas_builder_ext_handle_t** pphBuilder; +} ze_rtas_builder_create_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASBuilderCreateExt +/// @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_pfnRTASBuilderCreateExtCb_t)( + ze_rtas_builder_create_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASBuilderGetBuildPropertiesExt +/// @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_rtas_builder_get_build_properties_ext_params_t +{ + ze_rtas_builder_ext_handle_t* phBuilder; + const ze_rtas_builder_build_op_ext_desc_t** ppBuildOpDescriptor; + ze_rtas_builder_ext_properties_t** ppProperties; +} ze_rtas_builder_get_build_properties_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASBuilderGetBuildPropertiesExt +/// @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_pfnRTASBuilderGetBuildPropertiesExtCb_t)( + ze_rtas_builder_get_build_properties_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASBuilderBuildExt +/// @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_rtas_builder_build_ext_params_t +{ + ze_rtas_builder_ext_handle_t* phBuilder; + const ze_rtas_builder_build_op_ext_desc_t** ppBuildOpDescriptor; + void** ppScratchBuffer; + size_t* pscratchBufferSizeBytes; + void** ppRtasBuffer; + size_t* prtasBufferSizeBytes; + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation; + void** ppBuildUserPtr; + ze_rtas_aabb_ext_t** ppBounds; + size_t** ppRtasBufferSizeBytes; +} ze_rtas_builder_build_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASBuilderBuildExt +/// @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_pfnRTASBuilderBuildExtCb_t)( + ze_rtas_builder_build_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASBuilderCommandListAppendCopyExt +/// @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_rtas_builder_command_list_append_copy_ext_params_t +{ + ze_command_list_handle_t* phCommandList; + void** pdstptr; + const void** psrcptr; + size_t* psize; + ze_event_handle_t* phSignalEvent; + uint32_t* pnumWaitEvents; + ze_event_handle_t** pphWaitEvents; +} ze_rtas_builder_command_list_append_copy_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASBuilderCommandListAppendCopyExt +/// @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_pfnRTASBuilderCommandListAppendCopyExtCb_t)( + ze_rtas_builder_command_list_append_copy_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASBuilderDestroyExt +/// @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_rtas_builder_destroy_ext_params_t +{ + ze_rtas_builder_ext_handle_t* phBuilder; +} ze_rtas_builder_destroy_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASBuilderDestroyExt +/// @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_pfnRTASBuilderDestroyExtCb_t)( + ze_rtas_builder_destroy_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASBuilderCreateExp /// @details Each entry is a pointer to the parameter passed to the function; @@ -167,6 +311,108 @@ typedef void (ZE_APICALL *ze_pfnRTASBuilderDestroyExpCb_t)( void** ppTracerInstanceUserData ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASParallelOperationCreateExt +/// @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_rtas_parallel_operation_create_ext_params_t +{ + ze_driver_handle_t* phDriver; + ze_rtas_parallel_operation_ext_handle_t** pphParallelOperation; +} ze_rtas_parallel_operation_create_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASParallelOperationCreateExt +/// @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_pfnRTASParallelOperationCreateExtCb_t)( + ze_rtas_parallel_operation_create_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASParallelOperationGetPropertiesExt +/// @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_rtas_parallel_operation_get_properties_ext_params_t +{ + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation; + ze_rtas_parallel_operation_ext_properties_t** ppProperties; +} ze_rtas_parallel_operation_get_properties_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASParallelOperationGetPropertiesExt +/// @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_pfnRTASParallelOperationGetPropertiesExtCb_t)( + ze_rtas_parallel_operation_get_properties_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASParallelOperationJoinExt +/// @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_rtas_parallel_operation_join_ext_params_t +{ + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation; +} ze_rtas_parallel_operation_join_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASParallelOperationJoinExt +/// @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_pfnRTASParallelOperationJoinExtCb_t)( + ze_rtas_parallel_operation_join_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeRTASParallelOperationDestroyExt +/// @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_rtas_parallel_operation_destroy_ext_params_t +{ + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation; +} ze_rtas_parallel_operation_destroy_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeRTASParallelOperationDestroyExt +/// @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_pfnRTASParallelOperationDestroyExtCb_t)( + ze_rtas_parallel_operation_destroy_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASParallelOperationCreateExp /// @details Each entry is a pointer to the parameter passed to the function; @@ -296,6 +542,33 @@ typedef void (ZE_APICALL *ze_pfnDriverGetExtensionFunctionAddressCb_t)( void** ppTracerInstanceUserData ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeDriverRTASFormatCompatibilityCheckExt +/// @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_driver_rtas_format_compatibility_check_ext_params_t +{ + ze_driver_handle_t* phDriver; + ze_rtas_format_ext_t* prtasFormatA; + ze_rtas_format_ext_t* prtasFormatB; +} ze_driver_rtas_format_compatibility_check_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeDriverRTASFormatCompatibilityCheckExt +/// @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_pfnDriverRTASFormatCompatibilityCheckExtCb_t)( + ze_driver_rtas_format_compatibility_check_ext_params_t* params, + ze_result_t result, + void* pTracerUserData, + void** ppTracerInstanceUserData + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetLastErrorDescription /// @details Each entry is a pointer to the parameter passed to the function; @@ -428,6 +701,33 @@ typedef void (ZE_APICALL *ze_pfnDeviceReleaseExternalSemaphoreExtCb_t)( void** ppTracerInstanceUserData ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function parameters for zeDeviceGetVectorWidthPropertiesExt +/// @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_vector_width_properties_ext_params_t +{ + ze_device_handle_t* phDevice; + uint32_t** ppCount; + ze_device_vector_width_properties_ext_t** ppVectorWidthProperties; +} ze_device_get_vector_width_properties_ext_params_t; + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function-pointer for zeDeviceGetVectorWidthPropertiesExt +/// @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_pfnDeviceGetVectorWidthPropertiesExtCb_t)( + ze_device_get_vector_width_properties_ext_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; @@ -3204,6 +3504,94 @@ zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback( ); +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderCreateExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderCreateExtCb_t pfnCreateExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderGetBuildPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderGetBuildPropertiesExtCb_t pfnGetBuildPropertiesExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDriverRTASFormatCompatibilityCheckExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDriverRTASFormatCompatibilityCheckExtCb_t pfnRTASFormatCompatibilityCheckExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderBuildExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderBuildExtCb_t pfnBuildExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderCommandListAppendCopyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderCommandListAppendCopyExtCb_t pfnCommandListAppendCopyExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderDestroyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderDestroyExtCb_t pfnDestroyExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationCreateExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationCreateExtCb_t pfnCreateExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationGetPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationGetPropertiesExtCb_t pfnGetPropertiesExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationJoinExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationJoinExtCb_t pfnJoinExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationDestroyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationDestroyExtCb_t pfnDestroyExtCb + ); + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetVectorWidthPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetVectorWidthPropertiesExtCb_t pfnGetVectorWidthPropertiesExtCb + ); + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceReserveCacheExtRegisterCallback( zel_tracer_handle_t hTracer, diff --git a/include/ze.py b/include/ze.py index 1fa698fc..28ff35c5 100644 --- a/include/ze.py +++ b/include/ze.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file ze.py - @version v1.12-r1.12.15 + @version v1.13-r1.13.1 """ import platform @@ -219,6 +219,13 @@ class ze_result_v(IntEnum): ## memory WARNING_ACTION_REQUIRED = 0x7800001b ## [Sysman] an action is required to complete the desired operation ERROR_INVALID_KERNEL_HANDLE = 0x7800001c ## [Core, Validation] kernel handle is invalid for the operation + EXT_RTAS_BUILD_RETRY = 0x7800001d ## [Core, Extension] ray tracing acceleration structure build operation + ## failed due to insufficient resources, retry with a larger acceleration + ## structure buffer allocation + EXT_RTAS_BUILD_DEFERRED = 0x7800001e ## [Core, Extension] ray tracing acceleration structure build operation + ## deferred to parallel operation join + EXT_ERROR_OPERANDS_INCOMPATIBLE = 0x7800001f ## [Core, Extension] operands of comparison are not compatible + ERROR_SURVIVABILITY_MODE_DETECTED = 0x78000020 ## [Sysman] device is in survivability mode, firmware update needed ERROR_UNKNOWN = 0x7ffffffe ## [Core] unknown or internal error class ze_result_t(c_int): @@ -322,6 +329,14 @@ class ze_structure_type_v(IntEnum): EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_EXT = 0x00020025 ## ::ze_external_semaphore_signal_params_ext_t EXTERNAL_SEMAPHORE_WAIT_PARAMS_EXT = 0x00020026 ## ::ze_external_semaphore_wait_params_ext_t DRIVER_DDI_HANDLES_EXT_PROPERTIES = 0x00020027 ## ::ze_driver_ddi_handles_ext_properties_t + DEVICE_CACHELINE_SIZE_EXT = 0x00020028 ## ::ze_device_cache_line_size_ext_t + DEVICE_VECTOR_WIDTH_PROPERTIES_EXT = 0x00020029 ## ::ze_device_vector_width_properties_ext_t + RTAS_BUILDER_EXT_DESC = 0x00020030 ## ::ze_rtas_builder_ext_desc_t + RTAS_BUILDER_BUILD_OP_EXT_DESC = 0x00020031 ## ::ze_rtas_builder_build_op_ext_desc_t + RTAS_BUILDER_EXT_PROPERTIES = 0x00020032 ## ::ze_rtas_builder_ext_properties_t + RTAS_PARALLEL_OPERATION_EXT_PROPERTIES = 0x00020033 ## ::ze_rtas_parallel_operation_ext_properties_t + RTAS_DEVICE_EXT_PROPERTIES = 0x00020034 ## ::ze_rtas_device_ext_properties_t + RTAS_GEOMETRY_AABBS_EXT_CB_PARAMS = 0x00020035 ## ::ze_rtas_geometry_aabbs_ext_cb_params_t class ze_structure_type_t(c_int): def __str__(self): @@ -492,7 +507,8 @@ class ze_api_version_v(IntEnum): _1_10 = ZE_MAKE_VERSION( 1, 10 ) ## version 1.10 _1_11 = ZE_MAKE_VERSION( 1, 11 ) ## version 1.11 _1_12 = ZE_MAKE_VERSION( 1, 12 ) ## version 1.12 - CURRENT = ZE_MAKE_VERSION( 1, 12 ) ## latest known version + _1_13 = ZE_MAKE_VERSION( 1, 13 ) ## version 1.13 + CURRENT = ZE_MAKE_VERSION( 1, 13 ) ## latest known version class ze_api_version_t(c_int): def __str__(self): @@ -501,7 +517,7 @@ def __str__(self): ############################################################################### ## @brief Current API version as a macro -ZE_API_VERSION_CURRENT_M = ZE_MAKE_VERSION( 1, 12 ) +ZE_API_VERSION_CURRENT_M = ZE_MAKE_VERSION( 1, 13 ) ############################################################################### ## @brief Maximum driver universal unique id (UUID) size in bytes @@ -961,6 +977,8 @@ class ze_command_queue_flags_v(IntEnum): ## work across multiple engines. ## this flag should be used when applications want full control over ## multi-engine submission and scheduling. + ## This flag is **DEPRECATED** as flag + ## ${X}_COMMAND_LIST_FLAG_EXPLICIT_ONLY is **DEPRECATED**. IN_ORDER = ZE_BIT(1) ## To be used only when creating immediate command lists. Commands ## appended to the immediate command ## list are executed in-order, with driver implementation enforcing @@ -1011,7 +1029,7 @@ class ze_command_queue_desc_t(Structure): ## structure (i.e. contains stype and pNext). ("ordinal", c_ulong), ## [in] command queue group ordinal ("index", c_ulong), ## [in] command queue index within the group; - ## must be zero if ::ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY is not set + ## must be zero. ("flags", ze_command_queue_flags_t), ## [in] usage flags. ## must be 0 (default) or a valid combination of ::ze_command_queue_flag_t; ## default behavior may use implicit driver-based heuristics to balance @@ -1037,6 +1055,8 @@ class ze_command_list_flags_v(IntEnum): ## work across multiple engines. ## this flag should be used when applications want full control over ## multi-engine submission and scheduling. + ## This flag is **DEPRECATED** and implementations are not expected to + ## support this feature. IN_ORDER = ZE_BIT(3) ## commands appended to this command list are executed in-order, with ## driver implementation ## enforcing dependencies between them. Application is not required to @@ -2270,6 +2290,641 @@ class ze_external_semaphore_wait_params_ext_t(Structure): ## such as ::ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE. ] +############################################################################### +## @brief CacheLine Size Extension Name +ZE_CACHELINE_SIZE_EXT_NAME = "ZE_extension_device_cache_line_size" + +############################################################################### +## @brief CacheLine Size Extension Version(s) +class ze_device_cache_line_size_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_cache_line_size_ext_version_t(c_int): + def __str__(self): + return str(ze_device_cache_line_size_ext_version_v(self.value)) + + +############################################################################### +## @brief CacheLine Size queried using ::zeDeviceGetCacheProperties +## +## @details +## - This structure may be returned from ::zeDeviceGetCacheProperties via +## the `pNext` member of ::ze_device_cache_properties_t. +## - Used for determining the cache line size supported on a device. +class ze_device_cache_line_size_ext_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). + ("cacheLineSize", c_size_t) ## [out] The cache line size in bytes. + ] + +############################################################################### +## @brief Ray Tracing Acceleration Structure Extension Name +ZE_RTAS_EXT_NAME = "ZE_extension_rtas" + +############################################################################### +## @brief Ray Tracing Acceleration Structure Builder Extension Version(s) +class ze_rtas_builder_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_rtas_builder_ext_version_t(c_int): + def __str__(self): + return str(ze_rtas_builder_ext_version_v(self.value)) + + +############################################################################### +## @brief Ray tracing acceleration structure device flags +class ze_rtas_device_ext_flags_v(IntEnum): + RESERVED = ZE_BIT(0) ## reserved for future use + +class ze_rtas_device_ext_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Ray tracing acceleration structure format +## +## @details +## - This is an opaque ray tracing acceleration structure format +## identifier. +class ze_rtas_format_ext_v(IntEnum): + INVALID = 0x0 ## Invalid acceleration structure format code + MAX = 0x7ffffffe ## Maximum acceleration structure format code + +class ze_rtas_format_ext_t(c_int): + def __str__(self): + return str(ze_rtas_format_ext_v(self.value)) + + +############################################################################### +## @brief Ray tracing acceleration structure builder flags +class ze_rtas_builder_ext_flags_v(IntEnum): + RESERVED = ZE_BIT(0) ## Reserved for future use + +class ze_rtas_builder_ext_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Ray tracing acceleration structure builder parallel operation flags +class ze_rtas_parallel_operation_ext_flags_v(IntEnum): + RESERVED = ZE_BIT(0) ## Reserved for future use + +class ze_rtas_parallel_operation_ext_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Ray tracing acceleration structure builder geometry flags +class ze_rtas_builder_geometry_ext_flags_v(IntEnum): + NON_OPAQUE = ZE_BIT(0) ## non-opaque geometries invoke an any-hit shader + +class ze_rtas_builder_geometry_ext_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Packed ray tracing acceleration structure builder geometry flags (see +## ::ze_rtas_builder_geometry_ext_flags_t) +class ze_rtas_builder_packed_geometry_ext_flags_t(c_ubyte): + pass + +############################################################################### +## @brief Ray tracing acceleration structure builder instance flags +class ze_rtas_builder_instance_ext_flags_v(IntEnum): + TRIANGLE_CULL_DISABLE = ZE_BIT(0) ## disables culling of front-facing and back-facing triangles + TRIANGLE_FRONT_COUNTERCLOCKWISE = ZE_BIT(1) ## reverses front and back face of triangles + TRIANGLE_FORCE_OPAQUE = ZE_BIT(2) ## forces instanced geometry to be opaque, unless ray flag forces it to + ## be non-opaque + TRIANGLE_FORCE_NON_OPAQUE = ZE_BIT(3) ## forces instanced geometry to be non-opaque, unless ray flag forces it + ## to be opaque + +class ze_rtas_builder_instance_ext_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Packed ray tracing acceleration structure builder instance flags (see +## ::ze_rtas_builder_instance_ext_flags_t) +class ze_rtas_builder_packed_instance_ext_flags_t(c_ubyte): + pass + +############################################################################### +## @brief Ray tracing acceleration structure builder build operation flags +## +## @details +## - These flags allow the application to tune the acceleration structure +## build operation. +## - The acceleration structure builder implementation might choose to use +## spatial splitting to split large or long primitives into smaller +## pieces. This may result in any-hit shaders being invoked multiple +## times for non-opaque primitives, unless +## ::ZE_RTAS_BUILDER_BUILD_OP_EXT_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION is specified. +## - Usage of any of these flags may reduce ray tracing performance. +class ze_rtas_builder_build_op_ext_flags_v(IntEnum): + COMPACT = ZE_BIT(0) ## build more compact acceleration structure + NO_DUPLICATE_ANYHIT_INVOCATION = ZE_BIT(1) ## guarantees single any-hit shader invocation per primitive + +class ze_rtas_builder_build_op_ext_flags_t(c_int): + def __str__(self): + return hex(self.value) + + +############################################################################### +## @brief Ray tracing acceleration structure builder build quality hint +## +## @details +## - Depending on use case different quality modes for acceleration +## structure build are supported. +## - A low-quality build builds an acceleration structure fast, but at the +## cost of some reduction in ray tracing performance. This mode is +## recommended for dynamic content, such as animated characters. +## - A medium-quality build uses a compromise between build quality and ray +## tracing performance. This mode should be used by default. +## - Higher ray tracing performance can be achieved by using a high-quality +## build, but acceleration structure build performance might be +## significantly reduced. +class ze_rtas_builder_build_quality_hint_ext_v(IntEnum): + LOW = 0 ## build low-quality acceleration structure (fast) + MEDIUM = 1 ## build medium-quality acceleration structure (slower) + HIGH = 2 ## build high-quality acceleration structure (slow) + +class ze_rtas_builder_build_quality_hint_ext_t(c_int): + def __str__(self): + return str(ze_rtas_builder_build_quality_hint_ext_v(self.value)) + + +############################################################################### +## @brief Ray tracing acceleration structure builder geometry type +class ze_rtas_builder_geometry_type_ext_v(IntEnum): + TRIANGLES = 0 ## triangle mesh geometry type + QUADS = 1 ## quad mesh geometry type + PROCEDURAL = 2 ## procedural geometry type + INSTANCE = 3 ## instance geometry type + +class ze_rtas_builder_geometry_type_ext_t(c_int): + def __str__(self): + return str(ze_rtas_builder_geometry_type_ext_v(self.value)) + + +############################################################################### +## @brief Packed ray tracing acceleration structure builder geometry type (see +## ::ze_rtas_builder_geometry_type_ext_t) +class ze_rtas_builder_packed_geometry_type_ext_t(c_ubyte): + pass + +############################################################################### +## @brief Ray tracing acceleration structure data buffer element format +## +## @details +## - Specifies the format of data buffer elements. +## - Data buffers may contain instancing transform matrices, triangle/quad +## vertex indices, etc... +class ze_rtas_builder_input_data_format_ext_v(IntEnum): + FLOAT3 = 0 ## 3-component float vector (see ::ze_rtas_float3_ext_t) + FLOAT3X4_COLUMN_MAJOR = 1 ## 3x4 affine transformation in column-major format (see + ## ::ze_rtas_transform_float3x4_column_major_ext_t) + FLOAT3X4_ALIGNED_COLUMN_MAJOR = 2 ## 3x4 affine transformation in column-major format (see + ## ::ze_rtas_transform_float3x4_aligned_column_major_ext_t) + FLOAT3X4_ROW_MAJOR = 3 ## 3x4 affine transformation in row-major format (see + ## ::ze_rtas_transform_float3x4_row_major_ext_t) + AABB = 4 ## 3-dimensional axis-aligned bounding-box (see ::ze_rtas_aabb_ext_t) + TRIANGLE_INDICES_UINT32 = 5 ## Unsigned 32-bit triangle indices (see + ## ::ze_rtas_triangle_indices_uint32_ext_t) + QUAD_INDICES_UINT32 = 6 ## Unsigned 32-bit quad indices (see ::ze_rtas_quad_indices_uint32_ext_t) + +class ze_rtas_builder_input_data_format_ext_t(c_int): + def __str__(self): + return str(ze_rtas_builder_input_data_format_ext_v(self.value)) + + +############################################################################### +## @brief Packed ray tracing acceleration structure data buffer element format +## (see ::ze_rtas_builder_input_data_format_ext_t) +class ze_rtas_builder_packed_input_data_format_ext_t(c_ubyte): + pass + +############################################################################### +## @brief Handle of ray tracing acceleration structure builder object +class ze_rtas_builder_ext_handle_t(c_void_p): + pass + +############################################################################### +## @brief Handle of ray tracing acceleration structure builder parallel +## operation object +class ze_rtas_parallel_operation_ext_handle_t(c_void_p): + pass + +############################################################################### +## @brief Ray tracing acceleration structure builder descriptor +class ze_rtas_builder_ext_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). + ("builderVersion", ze_rtas_builder_ext_version_t) ## [in] ray tracing acceleration structure builder version + ] + +############################################################################### +## @brief Ray tracing acceleration structure builder properties +class ze_rtas_builder_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). + ("flags", ze_rtas_builder_ext_flags_t), ## [out] ray tracing acceleration structure builder flags + ("rtasBufferSizeBytesExpected", c_size_t), ## [out] expected size (in bytes) required for acceleration structure buffer + ## - When using an acceleration structure buffer of this size, the + ## build is expected to succeed; however, it is possible that the build + ## may fail with ::ZE_RESULT_EXT_RTAS_BUILD_RETRY + ("rtasBufferSizeBytesMaxRequired", c_size_t), ## [out] worst-case size (in bytes) required for acceleration structure buffer + ## - When using an acceleration structure buffer of this size, the + ## build is guaranteed to not run out of memory. + ("scratchBufferSizeBytes", c_size_t) ## [out] scratch buffer size (in bytes) required for acceleration + ## structure build. + ] + +############################################################################### +## @brief Ray tracing acceleration structure builder parallel operation +## properties +class ze_rtas_parallel_operation_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). + ("flags", ze_rtas_parallel_operation_ext_flags_t), ## [out] ray tracing acceleration structure builder parallel operation + ## flags + ("maxConcurrency", c_ulong) ## [out] maximum number of threads that may join the parallel operation + ] + +############################################################################### +## @brief Ray tracing acceleration structure device properties +## +## @details +## - This structure may be passed to ::zeDeviceGetProperties, via `pNext` +## member of ::ze_device_properties_t. +## - The implementation shall populate `format` with a value other than +## ::ZE_RTAS_FORMAT_EXT_INVALID when the device supports ray tracing. +class ze_rtas_device_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). + ("flags", ze_rtas_device_ext_flags_t), ## [out] ray tracing acceleration structure device flags + ("rtasFormat", ze_rtas_format_ext_t), ## [out] ray tracing acceleration structure format + ("rtasBufferAlignment", c_ulong) ## [out] required alignment of acceleration structure buffer + ] + +############################################################################### +## @brief A 3-component vector type +class ze_rtas_float3_ext_t(Structure): + _fields_ = [ + ("x", c_float), ## [in] x-coordinate of float3 vector + ("y", c_float), ## [in] y-coordinate of float3 vector + ("z", c_float) ## [in] z-coordinate of float3 vector + ] + +############################################################################### +## @brief 3x4 affine transformation in column-major layout +## +## @details +## - A 3x4 affine transformation in column major layout, consisting of vectors +## - vx=(vx_x, vx_y, vx_z), +## - vy=(vy_x, vy_y, vy_z), +## - vz=(vz_x, vz_y, vz_z), and +## - p=(p_x, p_y, p_z) +## - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + +## z*vz + p`. +class ze_rtas_transform_float3x4_column_major_ext_t(Structure): + _fields_ = [ + ("vx_x", c_float), ## [in] element 0 of column 0 of 3x4 matrix + ("vx_y", c_float), ## [in] element 1 of column 0 of 3x4 matrix + ("vx_z", c_float), ## [in] element 2 of column 0 of 3x4 matrix + ("vy_x", c_float), ## [in] element 0 of column 1 of 3x4 matrix + ("vy_y", c_float), ## [in] element 1 of column 1 of 3x4 matrix + ("vy_z", c_float), ## [in] element 2 of column 1 of 3x4 matrix + ("vz_x", c_float), ## [in] element 0 of column 2 of 3x4 matrix + ("vz_y", c_float), ## [in] element 1 of column 2 of 3x4 matrix + ("vz_z", c_float), ## [in] element 2 of column 2 of 3x4 matrix + ("p_x", c_float), ## [in] element 0 of column 3 of 3x4 matrix + ("p_y", c_float), ## [in] element 1 of column 3 of 3x4 matrix + ("p_z", c_float) ## [in] element 2 of column 3 of 3x4 matrix + ] + +############################################################################### +## @brief 3x4 affine transformation in column-major layout with aligned column +## vectors +## +## @details +## - A 3x4 affine transformation in column major layout, consisting of vectors +## - vx=(vx_x, vx_y, vx_z), +## - vy=(vy_x, vy_y, vy_z), +## - vz=(vz_x, vz_y, vz_z), and +## - p=(p_x, p_y, p_z) +## - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + +## z*vz + p`. +## - The column vectors are aligned to 16-bytes and pad members are +## ignored. +class ze_rtas_transform_float3x4_aligned_column_major_ext_t(Structure): + _fields_ = [ + ("vx_x", c_float), ## [in] element 0 of column 0 of 3x4 matrix + ("vx_y", c_float), ## [in] element 1 of column 0 of 3x4 matrix + ("vx_z", c_float), ## [in] element 2 of column 0 of 3x4 matrix + ("pad0", c_float), ## [in] ignored padding + ("vy_x", c_float), ## [in] element 0 of column 1 of 3x4 matrix + ("vy_y", c_float), ## [in] element 1 of column 1 of 3x4 matrix + ("vy_z", c_float), ## [in] element 2 of column 1 of 3x4 matrix + ("pad1", c_float), ## [in] ignored padding + ("vz_x", c_float), ## [in] element 0 of column 2 of 3x4 matrix + ("vz_y", c_float), ## [in] element 1 of column 2 of 3x4 matrix + ("vz_z", c_float), ## [in] element 2 of column 2 of 3x4 matrix + ("pad2", c_float), ## [in] ignored padding + ("p_x", c_float), ## [in] element 0 of column 3 of 3x4 matrix + ("p_y", c_float), ## [in] element 1 of column 3 of 3x4 matrix + ("p_z", c_float), ## [in] element 2 of column 3 of 3x4 matrix + ("pad3", c_float) ## [in] ignored padding + ] + +############################################################################### +## @brief 3x4 affine transformation in row-major layout +## +## @details +## - A 3x4 affine transformation in row-major layout, consisting of vectors +## - vx=(vx_x, vx_y, vx_z), +## - vy=(vy_x, vy_y, vy_z), +## - vz=(vz_x, vz_y, vz_z), and +## - p=(p_x, p_y, p_z) +## - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + +## z*vz + p`. +class ze_rtas_transform_float3x4_row_major_ext_t(Structure): + _fields_ = [ + ("vx_x", c_float), ## [in] element 0 of row 0 of 3x4 matrix + ("vy_x", c_float), ## [in] element 1 of row 0 of 3x4 matrix + ("vz_x", c_float), ## [in] element 2 of row 0 of 3x4 matrix + ("p_x", c_float), ## [in] element 3 of row 0 of 3x4 matrix + ("vx_y", c_float), ## [in] element 0 of row 1 of 3x4 matrix + ("vy_y", c_float), ## [in] element 1 of row 1 of 3x4 matrix + ("vz_y", c_float), ## [in] element 2 of row 1 of 3x4 matrix + ("p_y", c_float), ## [in] element 3 of row 1 of 3x4 matrix + ("vx_z", c_float), ## [in] element 0 of row 2 of 3x4 matrix + ("vy_z", c_float), ## [in] element 1 of row 2 of 3x4 matrix + ("vz_z", c_float), ## [in] element 2 of row 2 of 3x4 matrix + ("p_z", c_float) ## [in] element 3 of row 2 of 3x4 matrix + ] + +############################################################################### +## @brief A 3-dimensional axis-aligned bounding-box with lower and upper bounds +## in each dimension +class ze_rtas_aabb_ext_t(Structure): + _fields_ = [ + ("lower", ze_rtas_c_float3_ext_t), ## [in] lower bounds of AABB + ("upper", ze_rtas_c_float3_ext_t) ## [in] upper bounds of AABB + ] + +############################################################################### +## @brief Triangle represented using 3 vertex indices +## +## @details +## - Represents a triangle using 3 vertex indices that index into a vertex +## array that needs to be provided together with the index array. +## - The linear barycentric u/v parametrization of the triangle is defined as: +## - (u=0, v=0) at v0, +## - (u=1, v=0) at v1, and +## - (u=0, v=1) at v2 +class ze_rtas_triangle_indices_uint32_ext_t(Structure): + _fields_ = [ + ("v0", c_ulong), ## [in] first index pointing to the first triangle vertex in vertex array + ("v1", c_ulong), ## [in] second index pointing to the second triangle vertex in vertex + ## array + ("v2", c_ulong) ## [in] third index pointing to the third triangle vertex in vertex array + ] + +############################################################################### +## @brief Quad represented using 4 vertex indices +## +## @details +## - Represents a quad composed of 4 indices that index into a vertex array +## that needs to be provided together with the index array. +## - A quad is a triangle pair represented using 4 vertex indices v0, v1, +## v2, v3. +## The first triangle is made out of indices v0, v1, v3 and the second triangle +## from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization +## of the quad is defined as: +## - (u=0, v=0) at v0, +## - (u=1, v=0) at v1, +## - (u=0, v=1) at v3, and +## - (u=1, v=1) at v2 +## This is achieved by correcting the u'/v' coordinates of the second +## triangle by +## *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. +class ze_rtas_quad_indices_uint32_ext_t(Structure): + _fields_ = [ + ("v0", c_ulong), ## [in] first index pointing to the first quad vertex in vertex array + ("v1", c_ulong), ## [in] second index pointing to the second quad vertex in vertex array + ("v2", c_ulong), ## [in] third index pointing to the third quad vertex in vertex array + ("v3", c_ulong) ## [in] fourth index pointing to the fourth quad vertex in vertex array + ] + +############################################################################### +## @brief Ray tracing acceleration structure builder geometry info +class ze_rtas_builder_geometry_info_ext_t(Structure): + _fields_ = [ + ("geometryType", ze_rtas_builder_packed_geometry_type_ext_t) ## [in] geometry type + ] + +############################################################################### +## @brief Ray tracing acceleration structure builder triangle mesh geometry info +## +## @details +## - The linear barycentric u/v parametrization of the triangle is defined as: +## - (u=0, v=0) at v0, +## - (u=1, v=0) at v1, and +## - (u=0, v=1) at v2 +class ze_rtas_builder_triangles_geometry_info_ext_t(Structure): + _fields_ = [ + ("geometryType", ze_rtas_builder_packed_geometry_type_ext_t), ## [in] geometry type, must be + ## ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_TRIANGLES + ("geometryFlags", ze_rtas_builder_packed_geometry_ext_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ## bits representing the geometry flags for all primitives of this + ## geometry + ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking + ("triangleFormat", ze_rtas_builder_packed_input_data_format_ext_t), ## [in] format of triangle buffer data, must be + ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_TRIANGLE_INDICES_UINT32 + ("vertexFormat", ze_rtas_builder_packed_input_data_format_ext_t), ## [in] format of vertex buffer data, must be + ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3 + ("triangleCount", c_ulong), ## [in] number of triangles in triangle buffer + ("vertexCount", c_ulong), ## [in] number of vertices in vertex buffer + ("triangleStride", c_ulong), ## [in] stride (in bytes) of triangles in triangle buffer + ("vertexStride", c_ulong), ## [in] stride (in bytes) of vertices in vertex buffer + ("pTriangleBuffer", c_void_p), ## [in] pointer to array of triangle indices in specified format + ("pVertexBuffer", c_void_p) ## [in] pointer to array of triangle vertices in specified format + ] + +############################################################################### +## @brief Ray tracing acceleration structure builder quad mesh geometry info +## +## @details +## - A quad is a triangle pair represented using 4 vertex indices v0, v1, +## v2, v3. +## The first triangle is made out of indices v0, v1, v3 and the second triangle +## from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization +## of the quad is defined as: +## - (u=0, v=0) at v0, +## - (u=1, v=0) at v1, +## - (u=0, v=1) at v3, and +## - (u=1, v=1) at v2 +## This is achieved by correcting the u'/v' coordinates of the second +## triangle by +## *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. +class ze_rtas_builder_quads_geometry_info_ext_t(Structure): + _fields_ = [ + ("geometryType", ze_rtas_builder_packed_geometry_type_ext_t), ## [in] geometry type, must be ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_QUADS + ("geometryFlags", ze_rtas_builder_packed_geometry_ext_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ## bits representing the geometry flags for all primitives of this + ## geometry + ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking + ("quadFormat", ze_rtas_builder_packed_input_data_format_ext_t), ## [in] format of quad buffer data, must be + ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_QUAD_INDICES_UINT32 + ("vertexFormat", ze_rtas_builder_packed_input_data_format_ext_t), ## [in] format of vertex buffer data, must be + ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3 + ("quadCount", c_ulong), ## [in] number of quads in quad buffer + ("vertexCount", c_ulong), ## [in] number of vertices in vertex buffer + ("quadStride", c_ulong), ## [in] stride (in bytes) of quads in quad buffer + ("vertexStride", c_ulong), ## [in] stride (in bytes) of vertices in vertex buffer + ("pQuadBuffer", c_void_p), ## [in] pointer to array of quad indices in specified format + ("pVertexBuffer", c_void_p) ## [in] pointer to array of quad vertices in specified format + ] + +############################################################################### +## @brief AABB callback function parameters +class ze_rtas_geometry_aabbs_ext_cb_params_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). + ("primID", c_ulong), ## [in] first primitive to return bounds for + ("primIDCount", c_ulong), ## [in] number of primitives to return bounds for + ("pGeomUserPtr", c_void_p), ## [in] pointer provided through geometry descriptor + ("pBuildUserPtr", c_void_p), ## [in] pointer provided through ::zeRTASBuilderBuildExt function + ("pBoundsOut", POINTER(ze_rtas_aabb_ext_t)) ## [out] destination buffer to write AABB bounds to + ] + +############################################################################### +## @brief Callback function pointer type to return AABBs for a range of +## procedural primitives + +############################################################################### +## @brief Ray tracing acceleration structure builder procedural primitives +## geometry info +## +## @details +## - A host-side bounds callback function is invoked by the acceleration +## structure builder to query the bounds of procedural primitives on +## demand. The callback is passed some `pGeomUserPtr` that can point to +## an application-side representation of the procedural primitives. +## Further, a second `pBuildUserPtr`, which is set by a parameter to +## ::zeRTASBuilderBuildExt, is passed to the callback. This allows the +## build to change the bounds of the procedural geometry, for example, to +## build a BVH only over a short time range to implement multi-segment +## motion blur. +class ze_rtas_builder_procedural_geometry_info_ext_t(Structure): + _fields_ = [ + ("geometryType", ze_rtas_builder_packed_geometry_type_ext_t), ## [in] geometry type, must be + ## ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_PROCEDURAL + ("geometryFlags", ze_rtas_builder_packed_geometry_ext_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ## bits representing the geometry flags for all primitives of this + ## geometry + ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking + ("reserved", c_ubyte), ## [in] reserved for future use + ("primCount", c_ulong), ## [in] number of primitives in geometry + ("pfnGetBoundsCb", ze_rtas_geometry_aabbs_cb_ext_t), ## [in] pointer to callback function to get the axis-aligned bounding-box + ## for a range of primitives + ("pGeomUserPtr", c_void_p) ## [in] user data pointer passed to callback + ] + +############################################################################### +## @brief Ray tracing acceleration structure builder instance geometry info +class ze_rtas_builder_instance_geometry_info_ext_t(Structure): + _fields_ = [ + ("geometryType", ze_rtas_builder_packed_geometry_type_ext_t), ## [in] geometry type, must be + ## ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_INSTANCE + ("instanceFlags", ze_rtas_builder_packed_instance_ext_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ## bits representing the geometry flags for all primitives of this + ## geometry + ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking + ("transformFormat", ze_rtas_builder_packed_input_data_format_ext_t),## [in] format of the specified transformation + ("instanceUserID", c_ulong), ## [in] user-specified identifier for the instance + ("pTransform", c_void_p), ## [in] object-to-world instance transformation in specified format + ("pBounds", POINTER(ze_rtas_aabb_ext_t)), ## [in] object-space axis-aligned bounding-box of the instanced + ## acceleration structure + ("pAccelerationStructure", c_void_p) ## [in] device pointer to acceleration structure to instantiate + ] + +############################################################################### +## @brief +class ze_rtas_builder_build_op_ext_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). + ("rtasFormat", ze_rtas_format_ext_t), ## [in] ray tracing acceleration structure format + ("buildQuality", ze_rtas_builder_build_quality_hint_ext_t), ## [in] acceleration structure build quality hint + ("buildFlags", ze_rtas_builder_build_op_ext_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_build_op_ext_flag_t + ## flags + ("ppGeometries", POINTER(ze_rtas_builder_geometry_info_ext_t*)),## [in][optional][range(0, `numGeometries`)] NULL or a valid array of + ## pointers to geometry infos + ("numGeometries", c_ulong) ## [in] number of geometries in geometry infos array, can be zero when + ## `ppGeometries` is NULL + ] + +############################################################################### +## @brief Device Vector Sizes Query Extension Name +ZE_DEVICE_VECTOR_SIZES_EXT_NAME = "ZE_extension_device_vector_sizes" + +############################################################################### +## @brief Device Vector Sizes Query Extension Version(s) +class ze_device_vector_sizes_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_vector_sizes_ext_version_t(c_int): + def __str__(self): + return str(ze_device_vector_sizes_ext_version_v(self.value)) + + +############################################################################### +## @brief Device Vector Width Properties queried using +## $DeviceGetVectorWidthPropertiesExt +class ze_device_vector_width_properties_ext_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). + ("vector_width_size", c_ulong), ## [out] The associated vector width size supported by the device. + ("preferred_vector_width_char", c_ulong), ## [out] The preferred vector width size for char type supported by the device. + ("preferred_vector_width_short", c_ulong), ## [out] The preferred vector width size for short type supported by the device. + ("preferred_vector_width_int", c_ulong), ## [out] The preferred vector width size for int type supported by the device. + ("preferred_vector_width_long", c_ulong), ## [out] The preferred vector width size for long type supported by the device. + ("preferred_vector_width_float", c_ulong), ## [out] The preferred vector width size for float type supported by the device. + ("preferred_vector_width_double", c_ulong), ## [out] The preferred vector width size for double type supported by the device. + ("preferred_vector_width_half", c_ulong), ## [out] The preferred vector width size for half type supported by the device. + ("native_vector_width_char", c_ulong), ## [out] The native vector width size for char type supported by the device. + ("native_vector_width_short", c_ulong), ## [out] The native vector width size for short type supported by the device. + ("native_vector_width_int", c_ulong), ## [out] The native vector width size for int type supported by the device. + ("native_vector_width_long", c_ulong), ## [out] The native vector width size for long type supported by the device. + ("native_vector_width_float", c_ulong), ## [out] The native vector width size for float type supported by the device. + ("native_vector_width_double", c_ulong), ## [out] The native vector width size for double type supported by the device. + ("native_vector_width_half", c_ulong) ## [out] The native vector width size for half type supported by the device. + ] + ############################################################################### ## @brief Cache_Reservation Extension Name ZE_CACHE_RESERVATION_EXT_NAME = "ZE_extension_cache_reservation" @@ -2438,7 +3093,8 @@ class ze_image_view_planar_exp_desc_t(Structure): ("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). - ("planeIndex", c_ulong) ## [in] the 0-based plane index (e.g. NV12 is 0 = Y plane, 1 UV plane) + ("planeIndex", c_ulong) ## [DEPRECATED] no longer supported, use + ## ::ze_image_view_planar_ext_desc_t instead ] ############################################################################### @@ -2828,8 +3484,15 @@ def __str__(self): ############################################################################### ## @brief Supported memory free policy capability flags class ze_driver_memory_free_policy_ext_flags_v(IntEnum): - BLOCKING_FREE = ZE_BIT(0) ## blocks until all commands using the memory are complete before freeing - DEFER_FREE = ZE_BIT(1) ## schedules the memory to be freed but does not free immediately + BLOCKING_FREE = ZE_BIT(0) ## Blocks until all commands using the memory are complete before + ## scheduling memory to be freed. Does not guarantee memory is freed upon + ## return, only that it is safe and is scheduled to be freed. Actual + ## freeing of memory is specific to user mode driver and kernel mode + ## driver implementation and may be done asynchronously. + DEFER_FREE = ZE_BIT(1) ## Immediately schedules the memory to be freed and returns without + ## blocking. Memory may be freed after all commands using the memory are + ## complete. Actual freeing of memory is specific to user mode driver and + ## kernel mode driver implementation and may be done asynchronously. class ze_driver_memory_free_policy_ext_flags_t(c_int): def __str__(self): @@ -3341,6 +4004,7 @@ def __str__(self): ## identifier. class ze_rtas_format_exp_v(IntEnum): INVALID = 0 ## Invalid acceleration structure format + MAX = 0x7ffffffe ## Maximum acceleration structure format code class ze_rtas_format_exp_t(c_int): def __str__(self): @@ -4172,6 +4836,53 @@ class ze_mutable_graph_argument_exp_desc_t(Structure): ############################################################################### __use_win_types = "Windows" == platform.uname()[0] +############################################################################### +## @brief Function-pointer for zeRTASBuilderCreateExt +if __use_win_types: + _zeRTASBuilderCreateExt_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_builder_ext_desc_t), POINTER(ze_rtas_builder_ext_handle_t) ) +else: + _zeRTASBuilderCreateExt_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_builder_ext_desc_t), POINTER(ze_rtas_builder_ext_handle_t) ) + +############################################################################### +## @brief Function-pointer for zeRTASBuilderGetBuildPropertiesExt +if __use_win_types: + _zeRTASBuilderGetBuildPropertiesExt_t = WINFUNCTYPE( ze_result_t, ze_rtas_builder_ext_handle_t, POINTER(ze_rtas_builder_build_op_ext_desc_t), POINTER(ze_rtas_builder_ext_properties_t) ) +else: + _zeRTASBuilderGetBuildPropertiesExt_t = CFUNCTYPE( ze_result_t, ze_rtas_builder_ext_handle_t, POINTER(ze_rtas_builder_build_op_ext_desc_t), POINTER(ze_rtas_builder_ext_properties_t) ) + +############################################################################### +## @brief Function-pointer for zeRTASBuilderBuildExt +if __use_win_types: + _zeRTASBuilderBuildExt_t = WINFUNCTYPE( ze_result_t, ze_rtas_builder_ext_handle_t, POINTER(ze_rtas_builder_build_op_ext_desc_t), c_void_p, c_size_t, c_void_p, c_size_t, ze_rtas_parallel_operation_ext_handle_t, c_void_p, POINTER(ze_rtas_aabb_ext_t), POINTER(c_size_t) ) +else: + _zeRTASBuilderBuildExt_t = CFUNCTYPE( ze_result_t, ze_rtas_builder_ext_handle_t, POINTER(ze_rtas_builder_build_op_ext_desc_t), c_void_p, c_size_t, c_void_p, c_size_t, ze_rtas_parallel_operation_ext_handle_t, c_void_p, POINTER(ze_rtas_aabb_ext_t), POINTER(c_size_t) ) + +############################################################################### +## @brief Function-pointer for zeRTASBuilderCommandListAppendCopyExt +if __use_win_types: + _zeRTASBuilderCommandListAppendCopyExt_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) +else: + _zeRTASBuilderCommandListAppendCopyExt_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) + +############################################################################### +## @brief Function-pointer for zeRTASBuilderDestroyExt +if __use_win_types: + _zeRTASBuilderDestroyExt_t = WINFUNCTYPE( ze_result_t, ze_rtas_builder_ext_handle_t ) +else: + _zeRTASBuilderDestroyExt_t = CFUNCTYPE( ze_result_t, ze_rtas_builder_ext_handle_t ) + + +############################################################################### +## @brief Table of RTASBuilder functions pointers +class _ze_rtas_builder_dditable_t(Structure): + _fields_ = [ + ("pfnCreateExt", c_void_p), ## _zeRTASBuilderCreateExt_t + ("pfnGetBuildPropertiesExt", c_void_p), ## _zeRTASBuilderGetBuildPropertiesExt_t + ("pfnBuildExt", c_void_p), ## _zeRTASBuilderBuildExt_t + ("pfnCommandListAppendCopyExt", c_void_p), ## _zeRTASBuilderCommandListAppendCopyExt_t + ("pfnDestroyExt", c_void_p) ## _zeRTASBuilderDestroyExt_t + ] + ############################################################################### ## @brief Function-pointer for zeRTASBuilderCreateExp if __use_win_types: @@ -4211,6 +4922,45 @@ class _ze_rtas_builder_exp_dditable_t(Structure): ("pfnDestroyExp", c_void_p) ## _zeRTASBuilderDestroyExp_t ] +############################################################################### +## @brief Function-pointer for zeRTASParallelOperationCreateExt +if __use_win_types: + _zeRTASParallelOperationCreateExt_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_parallel_operation_ext_handle_t) ) +else: + _zeRTASParallelOperationCreateExt_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_parallel_operation_ext_handle_t) ) + +############################################################################### +## @brief Function-pointer for zeRTASParallelOperationGetPropertiesExt +if __use_win_types: + _zeRTASParallelOperationGetPropertiesExt_t = WINFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_ext_handle_t, POINTER(ze_rtas_parallel_operation_ext_properties_t) ) +else: + _zeRTASParallelOperationGetPropertiesExt_t = CFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_ext_handle_t, POINTER(ze_rtas_parallel_operation_ext_properties_t) ) + +############################################################################### +## @brief Function-pointer for zeRTASParallelOperationJoinExt +if __use_win_types: + _zeRTASParallelOperationJoinExt_t = WINFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_ext_handle_t ) +else: + _zeRTASParallelOperationJoinExt_t = CFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_ext_handle_t ) + +############################################################################### +## @brief Function-pointer for zeRTASParallelOperationDestroyExt +if __use_win_types: + _zeRTASParallelOperationDestroyExt_t = WINFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_ext_handle_t ) +else: + _zeRTASParallelOperationDestroyExt_t = CFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_ext_handle_t ) + + +############################################################################### +## @brief Table of RTASParallelOperation functions pointers +class _ze_rtas_parallel_operation_dditable_t(Structure): + _fields_ = [ + ("pfnCreateExt", c_void_p), ## _zeRTASParallelOperationCreateExt_t + ("pfnGetPropertiesExt", c_void_p), ## _zeRTASParallelOperationGetPropertiesExt_t + ("pfnJoinExt", c_void_p), ## _zeRTASParallelOperationJoinExt_t + ("pfnDestroyExt", c_void_p) ## _zeRTASParallelOperationDestroyExt_t + ] + ############################################################################### ## @brief Function-pointer for zeRTASParallelOperationCreateExp if __use_win_types: @@ -4322,6 +5072,13 @@ class _ze_global_dditable_t(Structure): else: _zeDriverGetLastErrorDescription_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_char_p) ) +############################################################################### +## @brief Function-pointer for zeDriverRTASFormatCompatibilityCheckExt +if __use_win_types: + _zeDriverRTASFormatCompatibilityCheckExt_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, ze_rtas_format_ext_t, ze_rtas_format_ext_t ) +else: + _zeDriverRTASFormatCompatibilityCheckExt_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, ze_rtas_format_ext_t, ze_rtas_format_ext_t ) + ############################################################################### ## @brief Table of Driver functions pointers @@ -4333,7 +5090,8 @@ class _ze_driver_dditable_t(Structure): ("pfnGetIpcProperties", c_void_p), ## _zeDriverGetIpcProperties_t ("pfnGetExtensionProperties", c_void_p), ## _zeDriverGetExtensionProperties_t ("pfnGetExtensionFunctionAddress", c_void_p), ## _zeDriverGetExtensionFunctionAddress_t - ("pfnGetLastErrorDescription", c_void_p) ## _zeDriverGetLastErrorDescription_t + ("pfnGetLastErrorDescription", c_void_p), ## _zeDriverGetLastErrorDescription_t + ("pfnRTASFormatCompatibilityCheckExt", c_void_p) ## _zeDriverRTASFormatCompatibilityCheckExt_t ] ############################################################################### @@ -4498,6 +5256,13 @@ class _ze_driver_exp_dditable_t(Structure): else: _zeDeviceReleaseExternalSemaphoreExt_t = CFUNCTYPE( ze_result_t, ze_external_semaphore_ext_handle_t ) +############################################################################### +## @brief Function-pointer for zeDeviceGetVectorWidthPropertiesExt +if __use_win_types: + _zeDeviceGetVectorWidthPropertiesExt_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_vector_width_properties_ext_t) ) +else: + _zeDeviceGetVectorWidthPropertiesExt_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_vector_width_properties_ext_t) ) + ############################################################################### ## @brief Table of Device functions pointers @@ -4523,7 +5288,8 @@ class _ze_device_dditable_t(Structure): ("pfnPciGetPropertiesExt", c_void_p), ## _zeDevicePciGetPropertiesExt_t ("pfnGetRootDevice", c_void_p), ## _zeDeviceGetRootDevice_t ("pfnImportExternalSemaphoreExt", c_void_p), ## _zeDeviceImportExternalSemaphoreExt_t - ("pfnReleaseExternalSemaphoreExt", c_void_p) ## _zeDeviceReleaseExternalSemaphoreExt_t + ("pfnReleaseExternalSemaphoreExt", c_void_p), ## _zeDeviceReleaseExternalSemaphoreExt_t + ("pfnGetVectorWidthPropertiesExt", c_void_p) ## _zeDeviceGetVectorWidthPropertiesExt_t ] ############################################################################### @@ -5907,7 +6673,9 @@ class _ze_fabric_edge_exp_dditable_t(Structure): ############################################################################### class _ze_dditable_t(Structure): _fields_ = [ + ("RTASBuilder", _ze_rtas_builder_dditable_t), ("RTASBuilderExp", _ze_rtas_builder_exp_dditable_t), + ("RTASParallelOperation", _ze_rtas_parallel_operation_dditable_t), ("RTASParallelOperationExp", _ze_rtas_parallel_operation_exp_dditable_t), ("Global", _ze_global_dditable_t), ("Driver", _ze_driver_dditable_t), @@ -5950,6 +6718,20 @@ def __init__(self, version : ze_api_version_t): # fill the ddi tables self.__dditable = _ze_dditable_t() + # call driver to get function pointers + _RTASBuilder = _ze_rtas_builder_dditable_t() + r = ze_result_v(self.__dll.zeGetRTASBuilderProcAddrTable(version, byref(_RTASBuilder))) + if r != ze_result_v.SUCCESS: + raise Exception(r) + self.__dditable.RTASBuilder = _RTASBuilder + + # attach function interface to function address + self.zeRTASBuilderCreateExt = _zeRTASBuilderCreateExt_t(self.__dditable.RTASBuilder.pfnCreateExt) + self.zeRTASBuilderGetBuildPropertiesExt = _zeRTASBuilderGetBuildPropertiesExt_t(self.__dditable.RTASBuilder.pfnGetBuildPropertiesExt) + self.zeRTASBuilderBuildExt = _zeRTASBuilderBuildExt_t(self.__dditable.RTASBuilder.pfnBuildExt) + self.zeRTASBuilderCommandListAppendCopyExt = _zeRTASBuilderCommandListAppendCopyExt_t(self.__dditable.RTASBuilder.pfnCommandListAppendCopyExt) + self.zeRTASBuilderDestroyExt = _zeRTASBuilderDestroyExt_t(self.__dditable.RTASBuilder.pfnDestroyExt) + # call driver to get function pointers _RTASBuilderExp = _ze_rtas_builder_exp_dditable_t() r = ze_result_v(self.__dll.zeGetRTASBuilderExpProcAddrTable(version, byref(_RTASBuilderExp))) @@ -5963,6 +6745,19 @@ def __init__(self, version : ze_api_version_t): self.zeRTASBuilderBuildExp = _zeRTASBuilderBuildExp_t(self.__dditable.RTASBuilderExp.pfnBuildExp) self.zeRTASBuilderDestroyExp = _zeRTASBuilderDestroyExp_t(self.__dditable.RTASBuilderExp.pfnDestroyExp) + # call driver to get function pointers + _RTASParallelOperation = _ze_rtas_parallel_operation_dditable_t() + r = ze_result_v(self.__dll.zeGetRTASParallelOperationProcAddrTable(version, byref(_RTASParallelOperation))) + if r != ze_result_v.SUCCESS: + raise Exception(r) + self.__dditable.RTASParallelOperation = _RTASParallelOperation + + # attach function interface to function address + self.zeRTASParallelOperationCreateExt = _zeRTASParallelOperationCreateExt_t(self.__dditable.RTASParallelOperation.pfnCreateExt) + self.zeRTASParallelOperationGetPropertiesExt = _zeRTASParallelOperationGetPropertiesExt_t(self.__dditable.RTASParallelOperation.pfnGetPropertiesExt) + self.zeRTASParallelOperationJoinExt = _zeRTASParallelOperationJoinExt_t(self.__dditable.RTASParallelOperation.pfnJoinExt) + self.zeRTASParallelOperationDestroyExt = _zeRTASParallelOperationDestroyExt_t(self.__dditable.RTASParallelOperation.pfnDestroyExt) + # call driver to get function pointers _RTASParallelOperationExp = _ze_rtas_parallel_operation_exp_dditable_t() r = ze_result_v(self.__dll.zeGetRTASParallelOperationExpProcAddrTable(version, byref(_RTASParallelOperationExp))) @@ -6002,6 +6797,7 @@ def __init__(self, version : ze_api_version_t): self.zeDriverGetExtensionProperties = _zeDriverGetExtensionProperties_t(self.__dditable.Driver.pfnGetExtensionProperties) self.zeDriverGetExtensionFunctionAddress = _zeDriverGetExtensionFunctionAddress_t(self.__dditable.Driver.pfnGetExtensionFunctionAddress) self.zeDriverGetLastErrorDescription = _zeDriverGetLastErrorDescription_t(self.__dditable.Driver.pfnGetLastErrorDescription) + self.zeDriverRTASFormatCompatibilityCheckExt = _zeDriverRTASFormatCompatibilityCheckExt_t(self.__dditable.Driver.pfnRTASFormatCompatibilityCheckExt) # call driver to get function pointers _DriverExp = _ze_driver_exp_dditable_t() @@ -6042,6 +6838,7 @@ def __init__(self, version : ze_api_version_t): self.zeDeviceGetRootDevice = _zeDeviceGetRootDevice_t(self.__dditable.Device.pfnGetRootDevice) self.zeDeviceImportExternalSemaphoreExt = _zeDeviceImportExternalSemaphoreExt_t(self.__dditable.Device.pfnImportExternalSemaphoreExt) self.zeDeviceReleaseExternalSemaphoreExt = _zeDeviceReleaseExternalSemaphoreExt_t(self.__dditable.Device.pfnReleaseExternalSemaphoreExt) + self.zeDeviceGetVectorWidthPropertiesExt = _zeDeviceGetVectorWidthPropertiesExt_t(self.__dditable.Device.pfnGetVectorWidthPropertiesExt) # call driver to get function pointers _DeviceExp = _ze_device_exp_dditable_t() diff --git a/include/ze_api.h b/include/ze_api.h index dfb30a25..03d12d03 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZE_API_H @@ -249,8 +249,15 @@ typedef enum _ze_result_t ///< memory ZE_RESULT_WARNING_ACTION_REQUIRED = 0x7800001b, ///< [Sysman] an action is required to complete the desired operation ZE_RESULT_ERROR_INVALID_KERNEL_HANDLE = 0x7800001c, ///< [Core, Validation] kernel handle is invalid for the operation + ZE_RESULT_EXT_RTAS_BUILD_RETRY = 0x7800001d, ///< [Core, Extension] ray tracing acceleration structure build operation + ///< failed due to insufficient resources, retry with a larger acceleration + ///< structure buffer allocation + ZE_RESULT_EXT_RTAS_BUILD_DEFERRED = 0x7800001e, ///< [Core, Extension] ray tracing acceleration structure build operation + ///< deferred to parallel operation join + ZE_RESULT_EXT_ERROR_OPERANDS_INCOMPATIBLE = 0x7800001f, ///< [Core, Extension] operands of comparison are not compatible + ZE_RESULT_ERROR_SURVIVABILITY_MODE_DETECTED = 0x78000020, ///< [Sysman] device is in survivability mode, firmware update needed ZE_RESULT_ERROR_UNKNOWN = 0x7ffffffe, ///< [Core] unknown or internal error - ZE_RESULT_FORCE_UINT32 = 0x7fffffff + ZE_RESULT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RESULT_* ENUMs } ze_result_t; @@ -351,7 +358,15 @@ typedef enum _ze_structure_type_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_EXT = 0x00020025, ///< ::ze_external_semaphore_signal_params_ext_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WAIT_PARAMS_EXT = 0x00020026, ///< ::ze_external_semaphore_wait_params_ext_t ZE_STRUCTURE_TYPE_DRIVER_DDI_HANDLES_EXT_PROPERTIES = 0x00020027, ///< ::ze_driver_ddi_handles_ext_properties_t - ZE_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_STRUCTURE_TYPE_DEVICE_CACHELINE_SIZE_EXT = 0x00020028, ///< ::ze_device_cache_line_size_ext_t + ZE_STRUCTURE_TYPE_DEVICE_VECTOR_WIDTH_PROPERTIES_EXT = 0x00020029, ///< ::ze_device_vector_width_properties_ext_t + ZE_STRUCTURE_TYPE_RTAS_BUILDER_EXT_DESC = 0x00020030, ///< ::ze_rtas_builder_ext_desc_t + ZE_STRUCTURE_TYPE_RTAS_BUILDER_BUILD_OP_EXT_DESC = 0x00020031, ///< ::ze_rtas_builder_build_op_ext_desc_t + ZE_STRUCTURE_TYPE_RTAS_BUILDER_EXT_PROPERTIES = 0x00020032, ///< ::ze_rtas_builder_ext_properties_t + ZE_STRUCTURE_TYPE_RTAS_PARALLEL_OPERATION_EXT_PROPERTIES = 0x00020033, ///< ::ze_rtas_parallel_operation_ext_properties_t + ZE_STRUCTURE_TYPE_RTAS_DEVICE_EXT_PROPERTIES = 0x00020034, ///< ::ze_rtas_device_ext_properties_t + ZE_STRUCTURE_TYPE_RTAS_GEOMETRY_AABBS_EXT_CB_PARAMS = 0x00020035, ///< ::ze_rtas_geometry_aabbs_ext_cb_params_t + ZE_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_STRUCTURE_TYPE_* ENUMs } ze_structure_type_t; @@ -369,7 +384,7 @@ typedef enum _ze_external_memory_type_flag_t ///< resource ZE_EXTERNAL_MEMORY_TYPE_FLAG_D3D12_HEAP = ZE_BIT(6), ///< an NT handle referring to a Direct3D 12 heap resource ZE_EXTERNAL_MEMORY_TYPE_FLAG_D3D12_RESOURCE = ZE_BIT(7), ///< an NT handle referring to a Direct3D 12 committed resource - ZE_EXTERNAL_MEMORY_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_EXTERNAL_MEMORY_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EXTERNAL_MEMORY_TYPE_FLAG_* ENUMs } ze_external_memory_type_flag_t; @@ -380,7 +395,7 @@ typedef enum _ze_bandwidth_unit_t ZE_BANDWIDTH_UNIT_UNKNOWN = 0, ///< The unit used for bandwidth is unknown ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC = 1, ///< Bandwidth is provided in bytes/nanosec ZE_BANDWIDTH_UNIT_BYTES_PER_CLOCK = 2, ///< Bandwidth is provided in bytes/clock - ZE_BANDWIDTH_UNIT_FORCE_UINT32 = 0x7fffffff + ZE_BANDWIDTH_UNIT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_BANDWIDTH_UNIT_* ENUMs } ze_bandwidth_unit_t; @@ -393,7 +408,7 @@ typedef enum _ze_latency_unit_t ZE_LATENCY_UNIT_CLOCK = 2, ///< Latency is provided in clocks ZE_LATENCY_UNIT_HOP = 3, ///< Latency is provided in hops (normalized so that the lowest latency ///< link has a latency of 1 hop) - ZE_LATENCY_UNIT_FORCE_UINT32 = 0x7fffffff + ZE_LATENCY_UNIT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_LATENCY_UNIT_* ENUMs } ze_latency_unit_t; @@ -719,6 +734,86 @@ typedef struct _ze_external_semaphore_signal_params_ext_t ze_external_semaphore_ /// @brief Forward-declare ze_external_semaphore_wait_params_ext_t typedef struct _ze_external_semaphore_wait_params_ext_t ze_external_semaphore_wait_params_ext_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_device_cache_line_size_ext_t +typedef struct _ze_device_cache_line_size_ext_t ze_device_cache_line_size_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_ext_desc_t +typedef struct _ze_rtas_builder_ext_desc_t ze_rtas_builder_ext_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_ext_properties_t +typedef struct _ze_rtas_builder_ext_properties_t ze_rtas_builder_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_parallel_operation_ext_properties_t +typedef struct _ze_rtas_parallel_operation_ext_properties_t ze_rtas_parallel_operation_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_device_ext_properties_t +typedef struct _ze_rtas_device_ext_properties_t ze_rtas_device_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_float3_ext_t +typedef struct _ze_rtas_float3_ext_t ze_rtas_float3_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_transform_float3x4_column_major_ext_t +typedef struct _ze_rtas_transform_float3x4_column_major_ext_t ze_rtas_transform_float3x4_column_major_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_transform_float3x4_aligned_column_major_ext_t +typedef struct _ze_rtas_transform_float3x4_aligned_column_major_ext_t ze_rtas_transform_float3x4_aligned_column_major_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_transform_float3x4_row_major_ext_t +typedef struct _ze_rtas_transform_float3x4_row_major_ext_t ze_rtas_transform_float3x4_row_major_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_aabb_ext_t +typedef struct _ze_rtas_aabb_ext_t ze_rtas_aabb_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_triangle_indices_uint32_ext_t +typedef struct _ze_rtas_triangle_indices_uint32_ext_t ze_rtas_triangle_indices_uint32_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_quad_indices_uint32_ext_t +typedef struct _ze_rtas_quad_indices_uint32_ext_t ze_rtas_quad_indices_uint32_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_geometry_info_ext_t +typedef struct _ze_rtas_builder_geometry_info_ext_t ze_rtas_builder_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_triangles_geometry_info_ext_t +typedef struct _ze_rtas_builder_triangles_geometry_info_ext_t ze_rtas_builder_triangles_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_quads_geometry_info_ext_t +typedef struct _ze_rtas_builder_quads_geometry_info_ext_t ze_rtas_builder_quads_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_geometry_aabbs_ext_cb_params_t +typedef struct _ze_rtas_geometry_aabbs_ext_cb_params_t ze_rtas_geometry_aabbs_ext_cb_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_procedural_geometry_info_ext_t +typedef struct _ze_rtas_builder_procedural_geometry_info_ext_t ze_rtas_builder_procedural_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_instance_geometry_info_ext_t +typedef struct _ze_rtas_builder_instance_geometry_info_ext_t ze_rtas_builder_instance_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_rtas_builder_build_op_ext_desc_t +typedef struct _ze_rtas_builder_build_op_ext_desc_t ze_rtas_builder_build_op_ext_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ze_device_vector_width_properties_ext_t +typedef struct _ze_device_vector_width_properties_ext_t ze_device_vector_width_properties_ext_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_cache_reservation_ext_desc_t typedef struct _ze_cache_reservation_ext_desc_t ze_cache_reservation_ext_desc_t; @@ -990,7 +1085,7 @@ typedef enum _ze_init_flag_t { ZE_INIT_FLAG_GPU_ONLY = ZE_BIT(0), ///< only initialize GPU drivers ZE_INIT_FLAG_VPU_ONLY = ZE_BIT(1), ///< only initialize VPU drivers - ZE_INIT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_INIT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_INIT_FLAG_* ENUMs } ze_init_flag_t; @@ -1087,7 +1182,7 @@ typedef enum _ze_init_driver_type_flag_t { ZE_INIT_DRIVER_TYPE_FLAG_GPU = ZE_BIT(0), ///< initialize and retrieve GPU drivers ZE_INIT_DRIVER_TYPE_FLAG_NPU = ZE_BIT(1), ///< initialize and retrieve NPU drivers - ZE_INIT_DRIVER_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_INIT_DRIVER_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_INIT_DRIVER_TYPE_FLAG_* ENUMs } ze_init_driver_type_flag_t; @@ -1113,11 +1208,11 @@ typedef struct _ze_init_driver_type_desc_t /// other function. (zeInit is [Deprecated] and is replaced by /// zeInitDrivers) /// - Calls to zeInit[Deprecated] or InitDrivers will not alter the drivers -/// retrieved thru either api. -/// - Drivers init thru zeInit[Deprecated] or InitDrivers will not be +/// retrieved through either api. +/// - Drivers init through zeInit[Deprecated] or InitDrivers will not be /// reInitialized once init in an application. The Loader will determine -/// if the already init driver needs to be delivered to the user thru the -/// init type flags. +/// if the already init driver needs to be delivered to the user through +/// the init type flags. /// - Already init Drivers will not be uninitialized if the call to /// InitDrivers does not include that driver's type. Those init drivers /// which don't match the init flags will not have their driver handles @@ -1186,15 +1281,16 @@ typedef enum _ze_api_version_t ZE_API_VERSION_1_10 = ZE_MAKE_VERSION( 1, 10 ), ///< version 1.10 ZE_API_VERSION_1_11 = ZE_MAKE_VERSION( 1, 11 ), ///< version 1.11 ZE_API_VERSION_1_12 = ZE_MAKE_VERSION( 1, 12 ), ///< version 1.12 - ZE_API_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 12 ), ///< latest known version - ZE_API_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_API_VERSION_1_13 = ZE_MAKE_VERSION( 1, 13 ), ///< version 1.13 + ZE_API_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 13 ), ///< latest known version + ZE_API_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_API_VERSION_* ENUMs } 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, 12 ) +#define ZE_API_VERSION_CURRENT_M ZE_MAKE_VERSION( 1, 13 ) #endif // ZE_API_VERSION_CURRENT_M /////////////////////////////////////////////////////////////////////////////// @@ -1284,7 +1380,7 @@ 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_FORCE_UINT32 = 0x7fffffff + ZE_IPC_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IPC_PROPERTY_FLAG_* ENUMs } ze_ipc_property_flag_t; @@ -1551,7 +1647,7 @@ typedef enum _ze_device_type_t ZE_DEVICE_TYPE_FPGA = 3, ///< Field Programmable Gate Array ZE_DEVICE_TYPE_MCA = 4, ///< Memory Copy Accelerator ZE_DEVICE_TYPE_VPU = 5, ///< Vision Processing Unit - ZE_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_TYPE_* ENUMs } ze_device_type_t; @@ -1584,7 +1680,7 @@ typedef enum _ze_device_property_flag_t ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE = ZE_BIT(1), ///< Device handle used for query represents a sub-device. ZE_DEVICE_PROPERTY_FLAG_ECC = ZE_BIT(2), ///< Device supports error correction memory access. ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING = ZE_BIT(3), ///< Device supports on-demand page-faulting. - ZE_DEVICE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_PROPERTY_FLAG_* ENUMs } ze_device_property_flag_t; @@ -1748,7 +1844,7 @@ typedef enum _ze_device_module_flag_t ZE_DEVICE_MODULE_FLAG_FP64 = ZE_BIT(1), ///< Device supports 64-bit floating-point operations ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS = ZE_BIT(2), ///< Device supports 64-bit atomic operations ZE_DEVICE_MODULE_FLAG_DP4A = ZE_BIT(3), ///< Device supports four component dot product and accumulate operations - ZE_DEVICE_MODULE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_MODULE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_MODULE_FLAG_* ENUMs } ze_device_module_flag_t; @@ -1766,7 +1862,7 @@ typedef enum _ze_device_fp_flag_t ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT = ZE_BIT(6), ///< Supports rounding as defined by IEEE754 for divide and sqrt ///< operations. ZE_DEVICE_FP_FLAG_SOFT_FLOAT = ZE_BIT(7), ///< Uses software implementation for basic floating-point operations. - ZE_DEVICE_FP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_FP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_FP_FLAG_* ENUMs } ze_device_fp_flag_t; @@ -1834,7 +1930,7 @@ typedef enum _ze_command_queue_group_property_flag_t ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS = ZE_BIT(2), ///< Command queue group supports cooperative kernels. ///< See ::zeCommandListAppendLaunchCooperativeKernel for more details. ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS = ZE_BIT(3), ///< Command queue groups supports metric queries. - ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_* ENUMs } ze_command_queue_group_property_flag_t; @@ -1903,7 +1999,7 @@ typedef uint32_t ze_device_memory_property_flags_t; typedef enum _ze_device_memory_property_flag_t { ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD = ZE_BIT(0), ///< reserved for future use - ZE_DEVICE_MEMORY_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_MEMORY_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_MEMORY_PROPERTY_FLAG_* ENUMs } ze_device_memory_property_flag_t; @@ -1979,7 +2075,7 @@ typedef enum _ze_memory_access_cap_flag_t ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC = ZE_BIT(1), ///< Supports atomic access ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT = ZE_BIT(2), ///< Supports concurrent access ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC = ZE_BIT(3), ///< Supports concurrent atomic access - ZE_MEMORY_ACCESS_CAP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_ACCESS_CAP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_ACCESS_CAP_FLAG_* ENUMs } ze_memory_access_cap_flag_t; @@ -2037,7 +2133,7 @@ typedef uint32_t ze_device_cache_property_flags_t; typedef enum _ze_device_cache_property_flag_t { ZE_DEVICE_CACHE_PROPERTY_FLAG_USER_CONTROL = ZE_BIT(0), ///< Device support User Cache Control (i.e. SLM section vs Generic Cache) - ZE_DEVICE_CACHE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_CACHE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_CACHE_PROPERTY_FLAG_* ENUMs } ze_device_cache_property_flag_t; @@ -2185,7 +2281,7 @@ typedef enum _ze_device_p2p_property_flag_t { ZE_DEVICE_P2P_PROPERTY_FLAG_ACCESS = ZE_BIT(0), ///< Device supports access between peer devices. ZE_DEVICE_P2P_PROPERTY_FLAG_ATOMICS = ZE_BIT(1), ///< Device supports atomics between peer devices. - ZE_DEVICE_P2P_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_P2P_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_P2P_PROPERTY_FLAG_* ENUMs } ze_device_p2p_property_flag_t; @@ -2337,7 +2433,7 @@ typedef uint32_t ze_context_flags_t; typedef enum _ze_context_flag_t { ZE_CONTEXT_FLAG_TBD = ZE_BIT(0), ///< reserved for future use - ZE_CONTEXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_CONTEXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_CONTEXT_FLAG_* ENUMs } ze_context_flag_t; @@ -2492,6 +2588,8 @@ typedef enum _ze_command_queue_flag_t ///< work across multiple engines. ///< this flag should be used when applications want full control over ///< multi-engine submission and scheduling. + ///< This flag is **DEPRECATED** as flag + ///< ${X}_COMMAND_LIST_FLAG_EXPLICIT_ONLY is **DEPRECATED**. ZE_COMMAND_QUEUE_FLAG_IN_ORDER = ZE_BIT(1), ///< To be used only when creating immediate command lists. Commands ///< appended to the immediate command ///< list are executed in-order, with driver implementation enforcing @@ -2501,7 +2599,7 @@ typedef enum _ze_command_queue_flag_t ///< the next to define an in-order list, and application is allowed to ///< pass signal and wait events ///< to each appended command to implement more complex dependency graphs. - ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_COMMAND_QUEUE_FLAG_* ENUMs } ze_command_queue_flag_t; @@ -2514,7 +2612,7 @@ typedef enum _ze_command_queue_mode_t ///< Host thread is blocked using wait on implicit synchronization object ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS = 2, ///< Device execution is scheduled and will complete in future; ///< explicit synchronization object must be used to determine completeness - ZE_COMMAND_QUEUE_MODE_FORCE_UINT32 = 0x7fffffff + ZE_COMMAND_QUEUE_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_COMMAND_QUEUE_MODE_* ENUMs } ze_command_queue_mode_t; @@ -2525,7 +2623,7 @@ typedef enum _ze_command_queue_priority_t ZE_COMMAND_QUEUE_PRIORITY_NORMAL = 0, ///< [default] normal priority ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW = 1, ///< lower priority than normal ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH = 2, ///< higher priority than normal - ZE_COMMAND_QUEUE_PRIORITY_FORCE_UINT32 = 0x7fffffff + ZE_COMMAND_QUEUE_PRIORITY_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_COMMAND_QUEUE_PRIORITY_* ENUMs } ze_command_queue_priority_t; @@ -2538,7 +2636,7 @@ typedef struct _ze_command_queue_desc_t ///< structure (i.e. contains stype and pNext). uint32_t ordinal; ///< [in] command queue group ordinal uint32_t index; ///< [in] command queue index within the group; - ///< must be zero if ::ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY is not set + ///< must be zero. ze_command_queue_flags_t flags; ///< [in] usage flags. ///< must be 0 (default) or a valid combination of ::ze_command_queue_flag_t; ///< default behavior may use implicit driver-based heuristics to balance @@ -2769,6 +2867,8 @@ typedef enum _ze_command_list_flag_t ///< work across multiple engines. ///< this flag should be used when applications want full control over ///< multi-engine submission and scheduling. + ///< This flag is **DEPRECATED** and implementations are not expected to + ///< support this feature. ZE_COMMAND_LIST_FLAG_IN_ORDER = ZE_BIT(3), ///< commands appended to this command list are executed in-order, with ///< driver implementation ///< enforcing dependencies between them. Application is not required to @@ -2780,7 +2880,7 @@ typedef enum _ze_command_list_flag_t ///< more complex dependency graphs. Cannot be combined with ::ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING. ZE_COMMAND_LIST_FLAG_EXP_CLONEABLE = ZE_BIT(4), ///< this command list may be cloned using ::zeCommandListCreateCloneExp ///< after ::zeCommandListClose. - ZE_COMMAND_LIST_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_COMMAND_LIST_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_COMMAND_LIST_FLAG_* ENUMs } ze_command_list_flag_t; @@ -3770,7 +3870,7 @@ typedef enum _ze_memory_advice_t ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION = 8, ///< hint that the preferred memory location is host memory ZE_MEMORY_ADVICE_CLEAR_SYSTEM_MEMORY_PREFERRED_LOCATION = 9, ///< removes the effect of ///< ::ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION - ZE_MEMORY_ADVICE_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_ADVICE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_ADVICE_* ENUMs } ze_memory_advice_t; @@ -3838,7 +3938,7 @@ typedef enum _ze_event_pool_flag_t ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP = ZE_BIT(3), ///< Indicates all events in pool will contain kernel timestamps ///< synchronized to host time domain; cannot be combined with ///< ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP - ZE_EVENT_POOL_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_EVENT_POOL_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_POOL_FLAG_* ENUMs } ze_event_pool_flag_t; @@ -3934,7 +4034,7 @@ typedef enum _ze_event_scope_flag_t ///< device access and peer device access ZE_EVENT_SCOPE_FLAG_HOST = ZE_BIT(2), ///< cache hierarchies are flushed or invalidated sufficient for device and ///< host access - ZE_EVENT_SCOPE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_EVENT_SCOPE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_SCOPE_FLAG_* ENUMs } ze_event_scope_flag_t; @@ -4608,7 +4708,7 @@ typedef uint32_t ze_fence_flags_t; typedef enum _ze_fence_flag_t { ZE_FENCE_FLAG_SIGNALED = ZE_BIT(0), ///< fence is created in the signaled state, otherwise not signaled. - ZE_FENCE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_FENCE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_FENCE_FLAG_* ENUMs } ze_fence_flag_t; @@ -4788,7 +4888,7 @@ typedef enum _ze_image_flag_t { ZE_IMAGE_FLAG_KERNEL_WRITE = ZE_BIT(0), ///< kernels will write contents ZE_IMAGE_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< device should not cache contents - ZE_IMAGE_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_FLAG_* ENUMs } ze_image_flag_t; @@ -4802,7 +4902,7 @@ typedef enum _ze_image_type_t ZE_IMAGE_TYPE_2DARRAY = 3, ///< 2D array ZE_IMAGE_TYPE_3D = 4, ///< 3D ZE_IMAGE_TYPE_BUFFER = 5, ///< Buffer - ZE_IMAGE_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_TYPE_* ENUMs } ze_image_type_t; @@ -4856,7 +4956,7 @@ typedef enum _ze_image_format_layout_t ZE_IMAGE_FORMAT_LAYOUT_8_8_8 = 43, ///< 3-component 8-bit layout ZE_IMAGE_FORMAT_LAYOUT_16_16_16 = 44, ///< 3-component 16-bit layout ZE_IMAGE_FORMAT_LAYOUT_32_32_32 = 45, ///< 3-component 32-bit layout - ZE_IMAGE_FORMAT_LAYOUT_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_FORMAT_LAYOUT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_FORMAT_LAYOUT_* ENUMs } ze_image_format_layout_t; @@ -4869,7 +4969,7 @@ typedef enum _ze_image_format_type_t ZE_IMAGE_FORMAT_TYPE_UNORM = 2, ///< Unsigned normalized integer ZE_IMAGE_FORMAT_TYPE_SNORM = 3, ///< Signed normalized integer ZE_IMAGE_FORMAT_TYPE_FLOAT = 4, ///< Float - ZE_IMAGE_FORMAT_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_FORMAT_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_FORMAT_TYPE_* ENUMs } ze_image_format_type_t; @@ -4884,7 +4984,7 @@ typedef enum _ze_image_format_swizzle_t ZE_IMAGE_FORMAT_SWIZZLE_0 = 4, ///< Zero ZE_IMAGE_FORMAT_SWIZZLE_1 = 5, ///< One ZE_IMAGE_FORMAT_SWIZZLE_X = 6, ///< Don't care - ZE_IMAGE_FORMAT_SWIZZLE_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_FORMAT_SWIZZLE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_FORMAT_SWIZZLE_* ENUMs } ze_image_format_swizzle_t; @@ -4949,7 +5049,7 @@ typedef enum _ze_image_sampler_filter_flag_t { ZE_IMAGE_SAMPLER_FILTER_FLAG_POINT = ZE_BIT(0), ///< device supports point filtering ZE_IMAGE_SAMPLER_FILTER_FLAG_LINEAR = ZE_BIT(1), ///< device supports linear filtering - ZE_IMAGE_SAMPLER_FILTER_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_SAMPLER_FILTER_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_SAMPLER_FILTER_FLAG_* ENUMs } ze_image_sampler_filter_flag_t; @@ -5071,7 +5171,7 @@ typedef enum _ze_device_mem_alloc_flag_t ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_CACHED = ZE_BIT(0), ///< device should cache allocation ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< device should not cache allocation (UC) ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_INITIAL_PLACEMENT = ZE_BIT(2), ///< optimize shared allocation for first access on the device - ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_MEM_ALLOC_FLAG_* ENUMs } ze_device_mem_alloc_flag_t; @@ -5099,7 +5199,7 @@ 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_FORCE_UINT32 = 0x7fffffff + ZE_HOST_MEM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_HOST_MEM_ALLOC_FLAG_* ENUMs } ze_host_mem_alloc_flag_t; @@ -5264,8 +5364,11 @@ zeMemAllocHost( /// @details /// - The application must ensure the device is not currently referencing /// the memory before it is freed -/// - The implementation of this function may immediately free all Host and -/// Device allocations associated with this memory +/// - The implementation will use the default and immediate policy to +/// schedule all Host and Device allocations associated with this memory +/// to be freed, without any safety checking. Actual freeing of memory is +/// specific to user mode driver and kernel mode driver implementation and +/// may be done asynchronously. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. @@ -5294,7 +5397,7 @@ typedef enum _ze_memory_type_t ZE_MEMORY_TYPE_HOST = 1, ///< the memory pointed to is a host allocation ZE_MEMORY_TYPE_DEVICE = 2, ///< the memory pointed to is a device allocation ZE_MEMORY_TYPE_SHARED = 3, ///< the memory pointed to is a shared ownership allocation - ZE_MEMORY_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_TYPE_* ENUMs } ze_memory_type_t; @@ -5486,7 +5589,7 @@ typedef enum _ze_ipc_memory_flag_t { ZE_IPC_MEMORY_FLAG_BIAS_CACHED = ZE_BIT(0), ///< device should cache allocation ZE_IPC_MEMORY_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< device should not cache allocation (UC) - ZE_IPC_MEMORY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_IPC_MEMORY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IPC_MEMORY_FLAG_* ENUMs } ze_ipc_memory_flag_t; @@ -5687,7 +5790,7 @@ typedef enum _ze_memory_atomic_attr_exp_flag_t ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_SYSTEM_ATOMICS = ZE_BIT(6), ///< Concurrent atomics on the pointer from both host and device are ///< allowed. Requires ::ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC ///< returned by ::zeDeviceGetMemoryAccessProperties. - ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_* ENUMs } ze_memory_atomic_attr_exp_flag_t; @@ -5701,7 +5804,7 @@ typedef enum _ze_memory_atomic_attr_exp_flag_t /// passed in hDevice, then the atomic attributes are set in all devices /// associated with the allocation. /// - If the atomic access attribute select is not supported by the driver, -/// ::ZE_RESULT_INVALID_ARGUMENT is returned. +/// ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. /// - The atomic access attribute may be only supported at a device-specific /// granularity, such as at a page boundary. In this case, the memory range /// may be expanded such that the start and end of the range satisfy granularity @@ -5780,7 +5883,7 @@ typedef enum _ze_module_format_t { ZE_MODULE_FORMAT_IL_SPIRV = 0, ///< Format is SPIRV IL format ZE_MODULE_FORMAT_NATIVE = 1, ///< Format is device native format - ZE_MODULE_FORMAT_FORCE_UINT32 = 0x7fffffff + ZE_MODULE_FORMAT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MODULE_FORMAT_* ENUMs } ze_module_format_t; @@ -6105,7 +6208,7 @@ typedef enum _ze_module_property_flag_t { ZE_MODULE_PROPERTY_FLAG_IMPORTS = ZE_BIT(0), ///< Module has imports (i.e. imported global variables and/or kernels). ///< See ::zeModuleDynamicLink. - ZE_MODULE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_MODULE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MODULE_PROPERTY_FLAG_* ENUMs } ze_module_property_flag_t; @@ -6151,7 +6254,7 @@ typedef enum _ze_kernel_flag_t ZE_KERNEL_FLAG_FORCE_RESIDENCY = ZE_BIT(0), ///< force all device allocations to be resident during execution ZE_KERNEL_FLAG_EXPLICIT_RESIDENCY = ZE_BIT(1), ///< application is responsible for all residency of device allocations. ///< driver may disable implicit residency management. - ZE_KERNEL_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_KERNEL_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_KERNEL_FLAG_* ENUMs } ze_kernel_flag_t; @@ -6379,7 +6482,7 @@ typedef enum _ze_kernel_indirect_access_flag_t ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST = ZE_BIT(0), ///< Indicates that the kernel accesses host allocations indirectly. ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE = ZE_BIT(1), ///< Indicates that the kernel accesses device allocations indirectly. ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED = ZE_BIT(2), ///< Indicates that the kernel accesses shared allocations indirectly. - ZE_KERNEL_INDIRECT_ACCESS_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_KERNEL_INDIRECT_ACCESS_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_KERNEL_INDIRECT_ACCESS_FLAG_* ENUMs } ze_kernel_indirect_access_flag_t; @@ -6461,10 +6564,14 @@ zeKernelGetSourceAttributes( char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ); /////////////////////////////////////////////////////////////////////////////// @@ -6474,7 +6581,7 @@ typedef enum _ze_cache_config_flag_t { ZE_CACHE_CONFIG_FLAG_LARGE_SLM = ZE_BIT(0), ///< Large SLM size ZE_CACHE_CONFIG_FLAG_LARGE_DATA = ZE_BIT(1), ///< Large General Data size - ZE_CACHE_CONFIG_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_CACHE_CONFIG_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_CACHE_CONFIG_FLAG_* ENUMs } ze_cache_config_flag_t; @@ -6833,7 +6940,7 @@ typedef enum _ze_module_program_exp_version_t { ZE_MODULE_PROGRAM_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MODULE_PROGRAM_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_MODULE_PROGRAM_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_MODULE_PROGRAM_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MODULE_PROGRAM_EXP_VERSION_* ENUMs } ze_module_program_exp_version_t; @@ -6886,7 +6993,7 @@ typedef enum _ze_raytracing_ext_version_t { ZE_RAYTRACING_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_RAYTRACING_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_RAYTRACING_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_RAYTRACING_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RAYTRACING_EXT_VERSION_* ENUMs } ze_raytracing_ext_version_t; @@ -6896,7 +7003,7 @@ typedef uint32_t ze_device_raytracing_ext_flags_t; typedef enum _ze_device_raytracing_ext_flag_t { ZE_DEVICE_RAYTRACING_EXT_FLAG_RAYQUERY = ZE_BIT(0), ///< Supports rayquery - ZE_DEVICE_RAYTRACING_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_RAYTRACING_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_RAYTRACING_EXT_FLAG_* ENUMs } ze_device_raytracing_ext_flag_t; @@ -6922,7 +7029,7 @@ typedef uint32_t ze_raytracing_mem_alloc_ext_flags_t; typedef enum _ze_raytracing_mem_alloc_ext_flag_t { ZE_RAYTRACING_MEM_ALLOC_EXT_FLAG_TBD = ZE_BIT(0), ///< reserved for future use - ZE_RAYTRACING_MEM_ALLOC_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RAYTRACING_MEM_ALLOC_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RAYTRACING_MEM_ALLOC_EXT_FLAG_* ENUMs } ze_raytracing_mem_alloc_ext_flag_t; @@ -7084,7 +7191,7 @@ typedef enum _ze_sampler_address_mode_t ///< 0.0f, 0.0f, 0.0f) if image format swizzle contains alpha, otherwise ///< (0.0f, 0.0f, 0.0f, 1.0f). ZE_SAMPLER_ADDRESS_MODE_MIRROR = 4, ///< Out-of-bounds coordinates are mirrored starting from edge. - ZE_SAMPLER_ADDRESS_MODE_FORCE_UINT32 = 0x7fffffff + ZE_SAMPLER_ADDRESS_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SAMPLER_ADDRESS_MODE_* ENUMs } ze_sampler_address_mode_t; @@ -7094,7 +7201,7 @@ typedef enum _ze_sampler_filter_mode_t { ZE_SAMPLER_FILTER_MODE_NEAREST = 0, ///< No coordinate modifications for out of bounds image access. ZE_SAMPLER_FILTER_MODE_LINEAR = 1, ///< Out-of-bounds coordinates are wrapped back around. - ZE_SAMPLER_FILTER_MODE_FORCE_UINT32 = 0x7fffffff + ZE_SAMPLER_FILTER_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SAMPLER_FILTER_MODE_* ENUMs } ze_sampler_filter_mode_t; @@ -7184,7 +7291,7 @@ typedef enum _ze_memory_access_attribute_t ZE_MEMORY_ACCESS_ATTRIBUTE_NONE = 0, ///< Indicates the memory page is inaccessible. ZE_MEMORY_ACCESS_ATTRIBUTE_READWRITE = 1, ///< Indicates the memory page supports read write access. ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY = 2, ///< Indicates the memory page supports read-only access. - ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_ACCESS_ATTRIBUTE_* ENUMs } ze_memory_access_attribute_t; @@ -7292,7 +7399,7 @@ typedef enum _ze_physical_mem_flag_t { ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_DEVICE = ZE_BIT(0), ///< [default] allocate physical device memory. ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_HOST = ZE_BIT(1), ///< Allocate physical host memory instead. - ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_PHYSICAL_MEM_FLAG_* ENUMs } ze_physical_mem_flag_t; @@ -7541,7 +7648,7 @@ typedef enum _ze_float_atomics_ext_version_t { ZE_FLOAT_ATOMICS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_FLOAT_ATOMICS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_FLOAT_ATOMICS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_FLOAT_ATOMICS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_FLOAT_ATOMICS_EXT_VERSION_* ENUMs } ze_float_atomics_ext_version_t; @@ -7556,7 +7663,7 @@ typedef enum _ze_device_fp_atomic_ext_flag_t ZE_DEVICE_FP_ATOMIC_EXT_FLAG_LOCAL_LOAD_STORE = ZE_BIT(16), ///< Supports atomic load, store, and exchange ZE_DEVICE_FP_ATOMIC_EXT_FLAG_LOCAL_ADD = ZE_BIT(17), ///< Supports atomic add and subtract ZE_DEVICE_FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX = ZE_BIT(18), ///< Supports atomic min and max - ZE_DEVICE_FP_ATOMIC_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_FP_ATOMIC_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_FP_ATOMIC_EXT_FLAG_* ENUMs } ze_device_fp_atomic_ext_flag_t; @@ -7599,7 +7706,7 @@ typedef enum _ze_global_offset_exp_version_t { ZE_GLOBAL_OFFSET_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_GLOBAL_OFFSET_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_GLOBAL_OFFSET_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_GLOBAL_OFFSET_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_GLOBAL_OFFSET_EXP_VERSION_* ENUMs } ze_global_offset_exp_version_t; @@ -7648,7 +7755,7 @@ typedef enum _ze_relaxed_allocation_limits_exp_version_t { ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_* ENUMs } ze_relaxed_allocation_limits_exp_version_t; @@ -7659,7 +7766,7 @@ typedef enum _ze_relaxed_allocation_limits_exp_flag_t { ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE = ZE_BIT(0), ///< Allocation size may exceed the `maxMemAllocSize` member of ///< ::ze_device_properties_t. - ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_* ENUMs } ze_relaxed_allocation_limits_exp_flag_t; @@ -7701,7 +7808,7 @@ typedef enum _ze_kernel_get_binary_exp_version_t { ZE_KERNEL_GET_BINARY_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_KERNEL_GET_BINARY_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_KERNEL_GET_BINARY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_KERNEL_GET_BINARY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_KERNEL_GET_BINARY_EXP_VERSION_* ENUMs } ze_kernel_get_binary_exp_version_t; @@ -7752,7 +7859,7 @@ typedef enum _ze_driver_ddi_handles_ext_version_t { ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DRIVER_DDI_HANDLES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_DRIVER_DDI_HANDLES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_DRIVER_DDI_HANDLES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DRIVER_DDI_HANDLES_EXT_VERSION_* ENUMs } ze_driver_ddi_handles_ext_version_t; @@ -7762,7 +7869,7 @@ typedef uint32_t ze_driver_ddi_handle_ext_flags_t; typedef enum _ze_driver_ddi_handle_ext_flag_t { ZE_DRIVER_DDI_HANDLE_EXT_FLAG_DDI_HANDLE_EXT_SUPPORTED = ZE_BIT(0), ///< Driver Supports DDI Handles Extension - ZE_DRIVER_DDI_HANDLE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DRIVER_DDI_HANDLE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DRIVER_DDI_HANDLE_EXT_FLAG_* ENUMs } ze_driver_ddi_handle_ext_flag_t; @@ -7800,7 +7907,7 @@ typedef enum _ze_external_semaphore_ext_version_t { ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_* ENUMs } ze_external_semaphore_ext_version_t; @@ -7822,7 +7929,7 @@ typedef enum _ze_external_semaphore_ext_flag_t ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_KEYED_MUTEX_KMT = ZE_BIT(6), ///< Semaphore is a keyed mutex for Win32 KMT ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_FD = ZE_BIT(7), ///< Semaphore is a Vulkan Timeline semaphore for Linux ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_WIN32 = ZE_BIT(8), ///< Semaphore is a Vulkan Timeline semaphore for Win32 - ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_* ENUMs } ze_external_semaphore_ext_flag_t; @@ -8032,229 +8139,1289 @@ zeCommandListAppendWaitExternalSemaphoreExt( #if !defined(__GNUC__) #pragma endregion #endif -// Intel 'oneAPI' Level-Zero Extension APIs for Cache Reservation +// Intel 'oneAPI' Level-Zero Extension APIs for CacheLine Size #if !defined(__GNUC__) -#pragma region cacheReservation +#pragma region CacheLineSize #endif /////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_CACHE_RESERVATION_EXT_NAME -/// @brief Cache_Reservation Extension Name -#define ZE_CACHE_RESERVATION_EXT_NAME "ZE_extension_cache_reservation" -#endif // ZE_CACHE_RESERVATION_EXT_NAME - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Cache_Reservation Extension Version(s) -typedef enum _ze_cache_reservation_ext_version_t -{ - ZE_CACHE_RESERVATION_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 - ZE_CACHE_RESERVATION_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_CACHE_RESERVATION_EXT_VERSION_FORCE_UINT32 = 0x7fffffff - -} ze_cache_reservation_ext_version_t; +#ifndef ZE_CACHELINE_SIZE_EXT_NAME +/// @brief CacheLine Size Extension Name +#define ZE_CACHELINE_SIZE_EXT_NAME "ZE_extension_device_cache_line_size" +#endif // ZE_CACHELINE_SIZE_EXT_NAME /////////////////////////////////////////////////////////////////////////////// -/// @brief Cache Reservation Region -typedef enum _ze_cache_ext_region_t +/// @brief CacheLine Size Extension Version(s) +typedef enum _ze_device_cache_line_size_ext_version_t { - ZE_CACHE_EXT_REGION_ZE_CACHE_REGION_DEFAULT = 0, ///< [DEPRECATED] utilize driver default scheme. Use - ///< ::ZE_CACHE_EXT_REGION_DEFAULT. - ZE_CACHE_EXT_REGION_ZE_CACHE_RESERVE_REGION = 1, ///< [DEPRECATED] utilize reserved region. Use - ///< ::ZE_CACHE_EXT_REGION_RESERVED. - ZE_CACHE_EXT_REGION_ZE_CACHE_NON_RESERVED_REGION = 2, ///< [DEPRECATED] utilize non-reserverd region. Use - ///< ::ZE_CACHE_EXT_REGION_NON_RESERVED. - ZE_CACHE_EXT_REGION_DEFAULT = 0, ///< utilize driver default scheme - ZE_CACHE_EXT_REGION_RESERVED = 1, ///< utilize reserved region - ZE_CACHE_EXT_REGION_NON_RESERVED = 2, ///< utilize non-reserverd region - ZE_CACHE_EXT_REGION_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_CACHE_LINE_SIZE_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_DEVICE_CACHE_LINE_SIZE_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version + ZE_DEVICE_CACHE_LINE_SIZE_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_CACHE_LINE_SIZE_EXT_VERSION_* ENUMs -} ze_cache_ext_region_t; +} ze_device_cache_line_size_ext_version_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief CacheReservation structure +/// @brief CacheLine Size queried using ::zeDeviceGetCacheProperties /// /// @details -/// - This structure must be passed to ::zeDeviceGetCacheProperties via the -/// `pNext` member of ::ze_device_cache_properties_t -/// - Used for determining the max cache reservation allowed on device. Size -/// of zero means no reservation available. -typedef struct _ze_cache_reservation_ext_desc_t +/// - This structure may be returned from ::zeDeviceGetCacheProperties via +/// the `pNext` member of ::ze_device_cache_properties_t. +/// - Used for determining the cache line size supported on a device. +typedef struct _ze_device_cache_line_size_ext_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). - size_t maxCacheReservationSize; ///< [out] max cache reservation size - -} ze_cache_reservation_ext_desc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reserve Cache on Device -/// -/// @details -/// - The application may call this function but may not be successful as -/// some other application may have reserve prior -/// -/// @remarks -/// _Analogues_ -/// - None -/// -/// @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_NULL_HANDLE -/// + `nullptr == hDevice` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceReserveCacheExt( - ze_device_handle_t hDevice, ///< [in] handle of the device object - size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the - ///< driver shall default to last level of cache and attempt to reserve in - ///< that cache. - size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver - ///< shall remove prior reservation - ); + size_t cacheLineSize; ///< [out] The cache line size in bytes. -/////////////////////////////////////////////////////////////////////////////// -/// @brief Assign VA section to use reserved section -/// -/// @details -/// - The application may call this function to assign VA to particular -/// reservartion region -/// -/// @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_NULL_HANDLE -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeDeviceSetCacheAdviceExt( - ze_device_handle_t hDevice, ///< [in] handle of the device object - void* ptr, ///< [in] memory pointer to query - size_t regionSize, ///< [in] region size, in pages - ze_cache_ext_region_t cacheRegion ///< [in] reservation region - ); +} ze_device_cache_line_size_ext_t; #if !defined(__GNUC__) #pragma endregion #endif -// Intel 'oneAPI' Level-Zero Extension for supporting event query timestamps. +// Intel 'oneAPI' Level-Zero Extension for supporting ray tracing acceleration structure. #if !defined(__GNUC__) -#pragma region eventquerytimestamps +#pragma region RTAS #endif /////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME -/// @brief Event Query Timestamps Extension Name -#define ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME "ZE_experimental_event_query_timestamps" -#endif // ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME +#ifndef ZE_RTAS_EXT_NAME +/// @brief Ray Tracing Acceleration Structure Extension Name +#define ZE_RTAS_EXT_NAME "ZE_extension_rtas" +#endif // ZE_RTAS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// -/// @brief Event Query Timestamps Extension Version(s) -typedef enum _ze_event_query_timestamps_exp_version_t +/// @brief Ray Tracing Acceleration Structure Builder Extension Version(s) +typedef enum _ze_rtas_builder_ext_version_t { - ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 - ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version - ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_RTAS_BUILDER_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZE_RTAS_BUILDER_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_EXT_VERSION_* ENUMs -} ze_event_query_timestamps_exp_version_t; +} ze_rtas_builder_ext_version_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Query event timestamps for a device or sub-device. +/// @brief Ray tracing acceleration structure device flags +typedef uint32_t ze_rtas_device_ext_flags_t; +typedef enum _ze_rtas_device_ext_flag_t +{ + ZE_RTAS_DEVICE_EXT_FLAG_RESERVED = ZE_BIT(0), ///< reserved for future use + ZE_RTAS_DEVICE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_DEVICE_EXT_FLAG_* ENUMs + +} ze_rtas_device_ext_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure format /// /// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// - The implementation must support -/// ::ZE_experimental_event_query_timestamps. -/// - The implementation must return all timestamps for the specified event -/// and device pair. -/// - The implementation must return all timestamps for all sub-devices when -/// device handle is parent device. -/// - The implementation may return all timestamps for sub-devices when -/// device handle is sub-device or may return 0 for count. -/// -/// @remarks -/// _Analogues_ -/// - None -/// -/// @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_NULL_HANDLE -/// + `nullptr == hEvent` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -ZE_APIEXPORT ze_result_t ZE_APICALL -zeEventQueryTimestampsExp( - ze_event_handle_t hEvent, ///< [in] handle of the event - ze_device_handle_t hDevice, ///< [in] handle of the device to query - uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. - ///< if count is zero, then the driver shall update the value with the - ///< total number of timestamps available. - ///< if count is greater than the number of timestamps available, then the - ///< driver shall update the value with the correct number of timestamps available. - ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. - ///< if count is less than the number of timestamps available, then driver - ///< shall only retrieve that number of timestamps. - ); +/// - This is an opaque ray tracing acceleration structure format +/// identifier. +typedef enum _ze_rtas_format_ext_t +{ + ZE_RTAS_FORMAT_EXT_INVALID = 0x0, ///< Invalid acceleration structure format code + ZE_RTAS_FORMAT_EXT_MAX = 0x7ffffffe, ///< Maximum acceleration structure format code + ZE_RTAS_FORMAT_EXT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_FORMAT_EXT_* ENUMs + +} ze_rtas_format_ext_t; -#if !defined(__GNUC__) -#pragma endregion -#endif -// Intel 'oneAPI' Level-Zero Extension for supporting image memory properties. -#if !defined(__GNUC__) -#pragma region imagememoryproperties -#endif /////////////////////////////////////////////////////////////////////////////// -#ifndef ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME -/// @brief Image Memory Properties Extension Name -#define ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME "ZE_experimental_image_memory_properties" -#endif // ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME +/// @brief Ray tracing acceleration structure builder flags +typedef uint32_t ze_rtas_builder_ext_flags_t; +typedef enum _ze_rtas_builder_ext_flag_t +{ + ZE_RTAS_BUILDER_EXT_FLAG_RESERVED = ZE_BIT(0), ///< Reserved for future use + ZE_RTAS_BUILDER_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_EXT_FLAG_* ENUMs + +} ze_rtas_builder_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Image Memory Properties Extension Version(s) -typedef enum _ze_image_memory_properties_exp_version_t +/// @brief Ray tracing acceleration structure builder parallel operation flags +typedef uint32_t ze_rtas_parallel_operation_ext_flags_t; +typedef enum _ze_rtas_parallel_operation_ext_flag_t { - ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 - ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_PARALLEL_OPERATION_EXT_FLAG_RESERVED = ZE_BIT(0), ///< Reserved for future use + ZE_RTAS_PARALLEL_OPERATION_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_PARALLEL_OPERATION_EXT_FLAG_* ENUMs -} ze_image_memory_properties_exp_version_t; +} ze_rtas_parallel_operation_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Image memory properties -typedef struct _ze_image_memory_properties_exp_t +/// @brief Ray tracing acceleration structure builder geometry flags +typedef uint32_t ze_rtas_builder_geometry_ext_flags_t; +typedef enum _ze_rtas_builder_geometry_ext_flag_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). - uint64_t size; ///< [out] size of image allocation in bytes. - uint64_t rowPitch; ///< [out] size of image row in bytes. - uint64_t slicePitch; ///< [out] size of image slice in bytes. + ZE_RTAS_BUILDER_GEOMETRY_EXT_FLAG_NON_OPAQUE = ZE_BIT(0), ///< non-opaque geometries invoke an any-hit shader + ZE_RTAS_BUILDER_GEOMETRY_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_GEOMETRY_EXT_FLAG_* ENUMs -} ze_image_memory_properties_exp_t; +} ze_rtas_builder_geometry_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Query image memory properties. +/// @brief Packed ray tracing acceleration structure builder geometry flags (see +/// ::ze_rtas_builder_geometry_ext_flags_t) +typedef uint8_t ze_rtas_builder_packed_geometry_ext_flags_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder instance flags +typedef uint32_t ze_rtas_builder_instance_ext_flags_t; +typedef enum _ze_rtas_builder_instance_ext_flag_t +{ + ZE_RTAS_BUILDER_INSTANCE_EXT_FLAG_TRIANGLE_CULL_DISABLE = ZE_BIT(0), ///< disables culling of front-facing and back-facing triangles + ZE_RTAS_BUILDER_INSTANCE_EXT_FLAG_TRIANGLE_FRONT_COUNTERCLOCKWISE = ZE_BIT(1), ///< reverses front and back face of triangles + ZE_RTAS_BUILDER_INSTANCE_EXT_FLAG_TRIANGLE_FORCE_OPAQUE = ZE_BIT(2), ///< forces instanced geometry to be opaque, unless ray flag forces it to + ///< be non-opaque + ZE_RTAS_BUILDER_INSTANCE_EXT_FLAG_TRIANGLE_FORCE_NON_OPAQUE = ZE_BIT(3),///< forces instanced geometry to be non-opaque, unless ray flag forces it + ///< to be opaque + ZE_RTAS_BUILDER_INSTANCE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_INSTANCE_EXT_FLAG_* ENUMs + +} ze_rtas_builder_instance_ext_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Packed ray tracing acceleration structure builder instance flags (see +/// ::ze_rtas_builder_instance_ext_flags_t) +typedef uint8_t ze_rtas_builder_packed_instance_ext_flags_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder build operation flags /// /// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// - The implementation must support -/// ::ZE_experimental_image_memory_properties extension. +/// - These flags allow the application to tune the acceleration structure +/// build operation. +/// - The acceleration structure builder implementation might choose to use +/// spatial splitting to split large or long primitives into smaller +/// pieces. This may result in any-hit shaders being invoked multiple +/// times for non-opaque primitives, unless +/// ::ZE_RTAS_BUILDER_BUILD_OP_EXT_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION is specified. +/// - Usage of any of these flags may reduce ray tracing performance. +typedef uint32_t ze_rtas_builder_build_op_ext_flags_t; +typedef enum _ze_rtas_builder_build_op_ext_flag_t +{ + ZE_RTAS_BUILDER_BUILD_OP_EXT_FLAG_COMPACT = ZE_BIT(0), ///< build more compact acceleration structure + ZE_RTAS_BUILDER_BUILD_OP_EXT_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION = ZE_BIT(1), ///< guarantees single any-hit shader invocation per primitive + ZE_RTAS_BUILDER_BUILD_OP_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_BUILD_OP_EXT_FLAG_* ENUMs + +} ze_rtas_builder_build_op_ext_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder build quality hint /// -/// @remarks +/// @details +/// - Depending on use case different quality modes for acceleration +/// structure build are supported. +/// - A low-quality build builds an acceleration structure fast, but at the +/// cost of some reduction in ray tracing performance. This mode is +/// recommended for dynamic content, such as animated characters. +/// - A medium-quality build uses a compromise between build quality and ray +/// tracing performance. This mode should be used by default. +/// - Higher ray tracing performance can be achieved by using a high-quality +/// build, but acceleration structure build performance might be +/// significantly reduced. +typedef enum _ze_rtas_builder_build_quality_hint_ext_t +{ + ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_LOW = 0, ///< build low-quality acceleration structure (fast) + ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_MEDIUM = 1, ///< build medium-quality acceleration structure (slower) + ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH = 2, ///< build high-quality acceleration structure (slow) + ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_* ENUMs + +} ze_rtas_builder_build_quality_hint_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder geometry type +typedef enum _ze_rtas_builder_geometry_type_ext_t +{ + ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_TRIANGLES = 0, ///< triangle mesh geometry type + ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_QUADS = 1, ///< quad mesh geometry type + ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_PROCEDURAL = 2, ///< procedural geometry type + ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_INSTANCE = 3, ///< instance geometry type + ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_* ENUMs + +} ze_rtas_builder_geometry_type_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Packed ray tracing acceleration structure builder geometry type (see +/// ::ze_rtas_builder_geometry_type_ext_t) +typedef uint8_t ze_rtas_builder_packed_geometry_type_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure data buffer element format +/// +/// @details +/// - Specifies the format of data buffer elements. +/// - Data buffers may contain instancing transform matrices, triangle/quad +/// vertex indices, etc... +typedef enum _ze_rtas_builder_input_data_format_ext_t +{ + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3 = 0, ///< 3-component float vector (see ::ze_rtas_float3_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3X4_COLUMN_MAJOR = 1, ///< 3x4 affine transformation in column-major format (see + ///< ::ze_rtas_transform_float3x4_column_major_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3X4_ALIGNED_COLUMN_MAJOR = 2,///< 3x4 affine transformation in column-major format (see + ///< ::ze_rtas_transform_float3x4_aligned_column_major_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3X4_ROW_MAJOR = 3, ///< 3x4 affine transformation in row-major format (see + ///< ::ze_rtas_transform_float3x4_row_major_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_AABB = 4, ///< 3-dimensional axis-aligned bounding-box (see ::ze_rtas_aabb_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_TRIANGLE_INDICES_UINT32 = 5, ///< Unsigned 32-bit triangle indices (see + ///< ::ze_rtas_triangle_indices_uint32_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_QUAD_INDICES_UINT32 = 6, ///< Unsigned 32-bit quad indices (see ::ze_rtas_quad_indices_uint32_ext_t) + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_* ENUMs + +} ze_rtas_builder_input_data_format_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Packed ray tracing acceleration structure data buffer element format +/// (see ::ze_rtas_builder_input_data_format_ext_t) +typedef uint8_t ze_rtas_builder_packed_input_data_format_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of ray tracing acceleration structure builder object +typedef struct _ze_rtas_builder_ext_handle_t *ze_rtas_builder_ext_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of ray tracing acceleration structure builder parallel +/// operation object +typedef struct _ze_rtas_parallel_operation_ext_handle_t *ze_rtas_parallel_operation_ext_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder descriptor +typedef struct _ze_rtas_builder_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). + ze_rtas_builder_ext_version_t builderVersion; ///< [in] ray tracing acceleration structure builder version + +} ze_rtas_builder_ext_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder properties +typedef struct _ze_rtas_builder_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_rtas_builder_ext_flags_t flags; ///< [out] ray tracing acceleration structure builder flags + size_t rtasBufferSizeBytesExpected; ///< [out] expected size (in bytes) required for acceleration structure buffer + ///< - When using an acceleration structure buffer of this size, the + ///< build is expected to succeed; however, it is possible that the build + ///< may fail with ::ZE_RESULT_EXT_RTAS_BUILD_RETRY + size_t rtasBufferSizeBytesMaxRequired; ///< [out] worst-case size (in bytes) required for acceleration structure buffer + ///< - When using an acceleration structure buffer of this size, the + ///< build is guaranteed to not run out of memory. + size_t scratchBufferSizeBytes; ///< [out] scratch buffer size (in bytes) required for acceleration + ///< structure build. + +} ze_rtas_builder_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder parallel operation +/// properties +typedef struct _ze_rtas_parallel_operation_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_rtas_parallel_operation_ext_flags_t flags; ///< [out] ray tracing acceleration structure builder parallel operation + ///< flags + uint32_t maxConcurrency; ///< [out] maximum number of threads that may join the parallel operation + +} ze_rtas_parallel_operation_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure device properties +/// +/// @details +/// - This structure may be passed to ::zeDeviceGetProperties, via `pNext` +/// member of ::ze_device_properties_t. +/// - The implementation shall populate `format` with a value other than +/// ::ZE_RTAS_FORMAT_EXT_INVALID when the device supports ray tracing. +typedef struct _ze_rtas_device_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_rtas_device_ext_flags_t flags; ///< [out] ray tracing acceleration structure device flags + ze_rtas_format_ext_t rtasFormat; ///< [out] ray tracing acceleration structure format + uint32_t rtasBufferAlignment; ///< [out] required alignment of acceleration structure buffer + +} ze_rtas_device_ext_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief A 3-component vector type +typedef struct _ze_rtas_float3_ext_t +{ + float x; ///< [in] x-coordinate of float3 vector + float y; ///< [in] y-coordinate of float3 vector + float z; ///< [in] z-coordinate of float3 vector + +} ze_rtas_float3_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3x4 affine transformation in column-major layout +/// +/// @details +/// - A 3x4 affine transformation in column major layout, consisting of vectors +/// - vx=(vx_x, vx_y, vx_z), +/// - vy=(vy_x, vy_y, vy_z), +/// - vz=(vz_x, vz_y, vz_z), and +/// - p=(p_x, p_y, p_z) +/// - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + +/// z*vz + p`. +typedef struct _ze_rtas_transform_float3x4_column_major_ext_t +{ + float vx_x; ///< [in] element 0 of column 0 of 3x4 matrix + float vx_y; ///< [in] element 1 of column 0 of 3x4 matrix + float vx_z; ///< [in] element 2 of column 0 of 3x4 matrix + float vy_x; ///< [in] element 0 of column 1 of 3x4 matrix + float vy_y; ///< [in] element 1 of column 1 of 3x4 matrix + float vy_z; ///< [in] element 2 of column 1 of 3x4 matrix + float vz_x; ///< [in] element 0 of column 2 of 3x4 matrix + float vz_y; ///< [in] element 1 of column 2 of 3x4 matrix + float vz_z; ///< [in] element 2 of column 2 of 3x4 matrix + float p_x; ///< [in] element 0 of column 3 of 3x4 matrix + float p_y; ///< [in] element 1 of column 3 of 3x4 matrix + float p_z; ///< [in] element 2 of column 3 of 3x4 matrix + +} ze_rtas_transform_float3x4_column_major_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3x4 affine transformation in column-major layout with aligned column +/// vectors +/// +/// @details +/// - A 3x4 affine transformation in column major layout, consisting of vectors +/// - vx=(vx_x, vx_y, vx_z), +/// - vy=(vy_x, vy_y, vy_z), +/// - vz=(vz_x, vz_y, vz_z), and +/// - p=(p_x, p_y, p_z) +/// - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + +/// z*vz + p`. +/// - The column vectors are aligned to 16-bytes and pad members are +/// ignored. +typedef struct _ze_rtas_transform_float3x4_aligned_column_major_ext_t +{ + float vx_x; ///< [in] element 0 of column 0 of 3x4 matrix + float vx_y; ///< [in] element 1 of column 0 of 3x4 matrix + float vx_z; ///< [in] element 2 of column 0 of 3x4 matrix + float pad0; ///< [in] ignored padding + float vy_x; ///< [in] element 0 of column 1 of 3x4 matrix + float vy_y; ///< [in] element 1 of column 1 of 3x4 matrix + float vy_z; ///< [in] element 2 of column 1 of 3x4 matrix + float pad1; ///< [in] ignored padding + float vz_x; ///< [in] element 0 of column 2 of 3x4 matrix + float vz_y; ///< [in] element 1 of column 2 of 3x4 matrix + float vz_z; ///< [in] element 2 of column 2 of 3x4 matrix + float pad2; ///< [in] ignored padding + float p_x; ///< [in] element 0 of column 3 of 3x4 matrix + float p_y; ///< [in] element 1 of column 3 of 3x4 matrix + float p_z; ///< [in] element 2 of column 3 of 3x4 matrix + float pad3; ///< [in] ignored padding + +} ze_rtas_transform_float3x4_aligned_column_major_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3x4 affine transformation in row-major layout +/// +/// @details +/// - A 3x4 affine transformation in row-major layout, consisting of vectors +/// - vx=(vx_x, vx_y, vx_z), +/// - vy=(vy_x, vy_y, vy_z), +/// - vz=(vz_x, vz_y, vz_z), and +/// - p=(p_x, p_y, p_z) +/// - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + +/// z*vz + p`. +typedef struct _ze_rtas_transform_float3x4_row_major_ext_t +{ + float vx_x; ///< [in] element 0 of row 0 of 3x4 matrix + float vy_x; ///< [in] element 1 of row 0 of 3x4 matrix + float vz_x; ///< [in] element 2 of row 0 of 3x4 matrix + float p_x; ///< [in] element 3 of row 0 of 3x4 matrix + float vx_y; ///< [in] element 0 of row 1 of 3x4 matrix + float vy_y; ///< [in] element 1 of row 1 of 3x4 matrix + float vz_y; ///< [in] element 2 of row 1 of 3x4 matrix + float p_y; ///< [in] element 3 of row 1 of 3x4 matrix + float vx_z; ///< [in] element 0 of row 2 of 3x4 matrix + float vy_z; ///< [in] element 1 of row 2 of 3x4 matrix + float vz_z; ///< [in] element 2 of row 2 of 3x4 matrix + float p_z; ///< [in] element 3 of row 2 of 3x4 matrix + +} ze_rtas_transform_float3x4_row_major_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief A 3-dimensional axis-aligned bounding-box with lower and upper bounds +/// in each dimension +typedef struct _ze_rtas_aabb_ext_t +{ + ze_rtas_float3_ext_t lower; ///< [in] lower bounds of AABB + ze_rtas_float3_ext_t upper; ///< [in] upper bounds of AABB + +} ze_rtas_aabb_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Triangle represented using 3 vertex indices +/// +/// @details +/// - Represents a triangle using 3 vertex indices that index into a vertex +/// array that needs to be provided together with the index array. +/// - The linear barycentric u/v parametrization of the triangle is defined as: +/// - (u=0, v=0) at v0, +/// - (u=1, v=0) at v1, and +/// - (u=0, v=1) at v2 +typedef struct _ze_rtas_triangle_indices_uint32_ext_t +{ + uint32_t v0; ///< [in] first index pointing to the first triangle vertex in vertex array + uint32_t v1; ///< [in] second index pointing to the second triangle vertex in vertex + ///< array + uint32_t v2; ///< [in] third index pointing to the third triangle vertex in vertex array + +} ze_rtas_triangle_indices_uint32_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Quad represented using 4 vertex indices +/// +/// @details +/// - Represents a quad composed of 4 indices that index into a vertex array +/// that needs to be provided together with the index array. +/// - A quad is a triangle pair represented using 4 vertex indices v0, v1, +/// v2, v3. +/// The first triangle is made out of indices v0, v1, v3 and the second triangle +/// from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization +/// of the quad is defined as: +/// - (u=0, v=0) at v0, +/// - (u=1, v=0) at v1, +/// - (u=0, v=1) at v3, and +/// - (u=1, v=1) at v2 +/// This is achieved by correcting the u'/v' coordinates of the second +/// triangle by +/// *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. +typedef struct _ze_rtas_quad_indices_uint32_ext_t +{ + uint32_t v0; ///< [in] first index pointing to the first quad vertex in vertex array + uint32_t v1; ///< [in] second index pointing to the second quad vertex in vertex array + uint32_t v2; ///< [in] third index pointing to the third quad vertex in vertex array + uint32_t v3; ///< [in] fourth index pointing to the fourth quad vertex in vertex array + +} ze_rtas_quad_indices_uint32_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder geometry info +typedef struct _ze_rtas_builder_geometry_info_ext_t +{ + ze_rtas_builder_packed_geometry_type_ext_t geometryType; ///< [in] geometry type + +} ze_rtas_builder_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder triangle mesh geometry info +/// +/// @details +/// - The linear barycentric u/v parametrization of the triangle is defined as: +/// - (u=0, v=0) at v0, +/// - (u=1, v=0) at v1, and +/// - (u=0, v=1) at v2 +typedef struct _ze_rtas_builder_triangles_geometry_info_ext_t +{ + ze_rtas_builder_packed_geometry_type_ext_t geometryType; ///< [in] geometry type, must be + ///< ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_TRIANGLES + ze_rtas_builder_packed_geometry_ext_flags_t geometryFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ///< bits representing the geometry flags for all primitives of this + ///< geometry + uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking + ze_rtas_builder_packed_input_data_format_ext_t triangleFormat; ///< [in] format of triangle buffer data, must be + ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_TRIANGLE_INDICES_UINT32 + ze_rtas_builder_packed_input_data_format_ext_t vertexFormat; ///< [in] format of vertex buffer data, must be + ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3 + uint32_t triangleCount; ///< [in] number of triangles in triangle buffer + uint32_t vertexCount; ///< [in] number of vertices in vertex buffer + uint32_t triangleStride; ///< [in] stride (in bytes) of triangles in triangle buffer + uint32_t vertexStride; ///< [in] stride (in bytes) of vertices in vertex buffer + void* pTriangleBuffer; ///< [in] pointer to array of triangle indices in specified format + void* pVertexBuffer; ///< [in] pointer to array of triangle vertices in specified format + +} ze_rtas_builder_triangles_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder quad mesh geometry info +/// +/// @details +/// - A quad is a triangle pair represented using 4 vertex indices v0, v1, +/// v2, v3. +/// The first triangle is made out of indices v0, v1, v3 and the second triangle +/// from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization +/// of the quad is defined as: +/// - (u=0, v=0) at v0, +/// - (u=1, v=0) at v1, +/// - (u=0, v=1) at v3, and +/// - (u=1, v=1) at v2 +/// This is achieved by correcting the u'/v' coordinates of the second +/// triangle by +/// *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. +typedef struct _ze_rtas_builder_quads_geometry_info_ext_t +{ + ze_rtas_builder_packed_geometry_type_ext_t geometryType; ///< [in] geometry type, must be ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_QUADS + ze_rtas_builder_packed_geometry_ext_flags_t geometryFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ///< bits representing the geometry flags for all primitives of this + ///< geometry + uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking + ze_rtas_builder_packed_input_data_format_ext_t quadFormat; ///< [in] format of quad buffer data, must be + ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_QUAD_INDICES_UINT32 + ze_rtas_builder_packed_input_data_format_ext_t vertexFormat; ///< [in] format of vertex buffer data, must be + ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXT_FLOAT3 + uint32_t quadCount; ///< [in] number of quads in quad buffer + uint32_t vertexCount; ///< [in] number of vertices in vertex buffer + uint32_t quadStride; ///< [in] stride (in bytes) of quads in quad buffer + uint32_t vertexStride; ///< [in] stride (in bytes) of vertices in vertex buffer + void* pQuadBuffer; ///< [in] pointer to array of quad indices in specified format + void* pVertexBuffer; ///< [in] pointer to array of quad vertices in specified format + +} ze_rtas_builder_quads_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief AABB callback function parameters +typedef struct _ze_rtas_geometry_aabbs_ext_cb_params_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). + uint32_t primID; ///< [in] first primitive to return bounds for + uint32_t primIDCount; ///< [in] number of primitives to return bounds for + void* pGeomUserPtr; ///< [in] pointer provided through geometry descriptor + void* pBuildUserPtr; ///< [in] pointer provided through ::zeRTASBuilderBuildExt function + ze_rtas_aabb_ext_t* pBoundsOut; ///< [out] destination buffer to write AABB bounds to + +} ze_rtas_geometry_aabbs_ext_cb_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Callback function pointer type to return AABBs for a range of +/// procedural primitives +typedef void (*ze_rtas_geometry_aabbs_cb_ext_t)( + ze_rtas_geometry_aabbs_ext_cb_params_t* params ///< [in] callback function parameters structure + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder procedural primitives +/// geometry info +/// +/// @details +/// - A host-side bounds callback function is invoked by the acceleration +/// structure builder to query the bounds of procedural primitives on +/// demand. The callback is passed some `pGeomUserPtr` that can point to +/// an application-side representation of the procedural primitives. +/// Further, a second `pBuildUserPtr`, which is set by a parameter to +/// ::zeRTASBuilderBuildExt, is passed to the callback. This allows the +/// build to change the bounds of the procedural geometry, for example, to +/// build a BVH only over a short time range to implement multi-segment +/// motion blur. +typedef struct _ze_rtas_builder_procedural_geometry_info_ext_t +{ + ze_rtas_builder_packed_geometry_type_ext_t geometryType; ///< [in] geometry type, must be + ///< ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_PROCEDURAL + ze_rtas_builder_packed_geometry_ext_flags_t geometryFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ///< bits representing the geometry flags for all primitives of this + ///< geometry + uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking + uint8_t reserved; ///< [in] reserved for future use + uint32_t primCount; ///< [in] number of primitives in geometry + ze_rtas_geometry_aabbs_cb_ext_t pfnGetBoundsCb; ///< [in] pointer to callback function to get the axis-aligned bounding-box + ///< for a range of primitives + void* pGeomUserPtr; ///< [in] user data pointer passed to callback + +} ze_rtas_builder_procedural_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ray tracing acceleration structure builder instance geometry info +typedef struct _ze_rtas_builder_instance_geometry_info_ext_t +{ + ze_rtas_builder_packed_geometry_type_ext_t geometryType; ///< [in] geometry type, must be + ///< ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXT_INSTANCE + ze_rtas_builder_packed_instance_ext_flags_t instanceFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_ext_flag_t + ///< bits representing the geometry flags for all primitives of this + ///< geometry + uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking + ze_rtas_builder_packed_input_data_format_ext_t transformFormat; ///< [in] format of the specified transformation + uint32_t instanceUserID; ///< [in] user-specified identifier for the instance + void* pTransform; ///< [in] object-to-world instance transformation in specified format + ze_rtas_aabb_ext_t* pBounds; ///< [in] object-space axis-aligned bounding-box of the instanced + ///< acceleration structure + void* pAccelerationStructure; ///< [in] device pointer to acceleration structure to instantiate + +} ze_rtas_builder_instance_geometry_info_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief +typedef struct _ze_rtas_builder_build_op_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). + ze_rtas_format_ext_t rtasFormat; ///< [in] ray tracing acceleration structure format + ze_rtas_builder_build_quality_hint_ext_t buildQuality; ///< [in] acceleration structure build quality hint + ze_rtas_builder_build_op_ext_flags_t buildFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_build_op_ext_flag_t + ///< flags + const ze_rtas_builder_geometry_info_ext_t** ppGeometries; ///< [in][optional][range(0, `numGeometries`)] NULL or a valid array of + ///< pointers to geometry infos + uint32_t numGeometries; ///< [in] number of geometries in geometry infos array, can be zero when + ///< `ppGeometries` is NULL + +} ze_rtas_builder_build_op_ext_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Creates a ray tracing acceleration structure builder object +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support ::ZE_extension_rtas extension. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pDescriptor` +/// + `nullptr == phBuilder` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_BUILDER_EXT_VERSION_CURRENT < pDescriptor->builderVersion` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASBuilderCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves ray tracing acceleration structure builder properties +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hBuilder` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pBuildOpDescriptor` +/// + `nullptr == pProperties` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_FORMAT_EXT_MAX < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH < pBuildOpDescriptor->buildQuality` +/// + `0x3 < pBuildOpDescriptor->buildFlags` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASBuilderGetBuildPropertiesExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Checks ray tracing acceleration structure format compatibility +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_FORMAT_EXT_MAX < rtasFormatA` +/// + `::ZE_RTAS_FORMAT_EXT_MAX < rtasFormatB` +/// - ::ZE_RESULT_SUCCESS +/// + An acceleration structure built with `rtasFormatA` is compatible with devices that report `rtasFormatB`. +/// - ::ZE_RESULT_EXT_ERROR_OPERANDS_INCOMPATIBLE +/// + An acceleration structure built with `rtasFormatA` is **not** compatible with devices that report `rtasFormatB`. +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDriverRTASFormatCompatibilityCheckExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Build ray tracing acceleration structure +/// +/// @details +/// - This function builds an acceleration structure of the scene consisting +/// of the specified geometry information and writes the acceleration +/// structure to the provided destination buffer. All types of geometries +/// can get freely mixed inside a scene. +/// - Before an acceleration structure can be built, the user must allocate +/// the memory for the acceleration structure buffer and scratch buffer +/// using sizes queried with the ::zeRTASBuilderGetBuildPropertiesExt function. +/// - When using the "worst-case" size for the acceleration structure +/// buffer, the acceleration structure construction will never fail with ::ZE_RESULT_EXT_RTAS_BUILD_RETRY. +/// - When using the "expected" size for the acceleration structure buffer, +/// the acceleration structure construction may fail with +/// ::ZE_RESULT_EXT_RTAS_BUILD_RETRY. If this happens, the user may resize +/// their acceleration structure buffer using the returned +/// `*pRtasBufferSizeBytes` value, which will be updated with an improved +/// size estimate that will likely result in a successful build. +/// - The acceleration structure construction is run on the host and is +/// synchronous, thus after the function returns with a successful result, +/// the acceleration structure may be used. +/// - All provided data buffers must be host-accessible. The referenced +/// scene data (index- and vertex- buffers) have to be accessible from the +/// host, and will **not** be referenced by the build acceleration structure. +/// - The acceleration structure buffer is typicall a host allocation that +/// is later manually copied to a device allocation. Alternatively one can +/// also use a shared USM allocation as acceration structure buffer and +/// skip the copy. +/// - A successfully constructed acceleration structure is entirely +/// self-contained. There is no requirement for input data to persist +/// beyond build completion. +/// - A successfully constructed acceleration structure is non-copyable. +/// - Acceleration structure construction may be parallelized by passing a +/// valid handle to a parallel operation object and joining that parallel +/// operation using ::zeRTASParallelOperationJoinExt with user-provided +/// worker threads. +/// - A successfully constructed acceleration structure is generally +/// non-copyable. It can only get copied from host to device using the +/// special ::zeRTASBuilderCommandListAppendCopyExt function. +/// - **Additional Notes** +/// - "The geometry infos array, geometry infos, and scratch buffer must +/// all be standard host memory allocations." +/// - "A pointer to a geometry info can be a null pointer, in which case +/// the geometry is treated as empty." +/// - "If no parallel operation handle is provided, the build is run +/// sequentially on the current thread." +/// - "A parallel operation object may only be associated with a single +/// acceleration structure build at a time." +/// +/// @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_NULL_HANDLE +/// + `nullptr == hBuilder` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pBuildOpDescriptor` +/// + `nullptr == pScratchBuffer` +/// + `nullptr == pRtasBuffer` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_FORMAT_EXT_MAX < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH < pBuildOpDescriptor->buildQuality` +/// + `0x3 < pBuildOpDescriptor->buildFlags` +/// - ::ZE_RESULT_EXT_RTAS_BUILD_DEFERRED +/// + Acceleration structure build completion is deferred to parallel operation join. +/// - ::ZE_RESULT_EXT_RTAS_BUILD_RETRY +/// + Acceleration structure build failed due to insufficient resources, retry the build operation with a larger acceleration structure buffer allocation. +/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE +/// + Acceleration structure build failed due to parallel operation object participation in another build operation. +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASBuilderBuildExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Copies a ray tracing acceleration structure (RTAS) from host to device +/// memory. +/// +/// @details +/// - The memory pointed to by srcptr must be host memory containing a valid +/// ray tracing acceleration structure. +/// - The number of bytes to copy must be larger or equal to the size of the +/// ray tracing acceleration structure. +/// - 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. +/// +/// @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_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_APIEXPORT ze_result_t ZE_APICALL +zeRTASBuilderCommandListAppendCopyExt( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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 Destroys a ray tracing acceleration structure builder object +/// +/// @details +/// - The implementation of this function may immediately release any +/// internal Host and Device resources associated with this builder. +/// - The application must **not** call this function from simultaneous +/// threads with the same builder handle. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hBuilder` +/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASBuilderDestroyExt( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Creates a ray tracing acceleration structure builder parallel +/// operation object +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support ::ZE_extension_rtas extension. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phParallelOperation` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASParallelOperationCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation ///< [out] handle of parallel operation object + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves ray tracing acceleration structure builder parallel +/// operation properties +/// +/// @details +/// - The application must first bind the parallel operation object to a +/// build operation before it may query the parallel operation properties. +/// In other words, the application must first call +/// ::zeRTASBuilderBuildExt with **hParallelOperation** before calling +/// this function. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hParallelOperation` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASParallelOperationGetPropertiesExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties ///< [in,out] query result for parallel operation properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Joins a parallel build operation +/// +/// @details +/// - All worker threads return the same error code for the parallel build +/// operation upon build completion +/// +/// @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_NULL_HANDLE +/// + `nullptr == hParallelOperation` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASParallelOperationJoinExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroys a ray tracing acceleration structure builder parallel +/// operation object +/// +/// @details +/// - The implementation of this function may immediately release any +/// internal Host and Device resources associated with this parallel +/// operation. +/// - The application must **not** call this function from simultaneous +/// threads with the same parallel operation handle. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hParallelOperation` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeRTASParallelOperationDestroyExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Extension for Device Vector Sizes Query +#if !defined(__GNUC__) +#pragma region deviceVectorSizes +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZE_DEVICE_VECTOR_SIZES_EXT_NAME +/// @brief Device Vector Sizes Query Extension Name +#define ZE_DEVICE_VECTOR_SIZES_EXT_NAME "ZE_extension_device_vector_sizes" +#endif // ZE_DEVICE_VECTOR_SIZES_EXT_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device Vector Sizes Query Extension Version(s) +typedef enum _ze_device_vector_sizes_ext_version_t +{ + ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_VECTOR_SIZES_EXT_VERSION_* ENUMs + +} ze_device_vector_sizes_ext_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device Vector Width Properties queried using +/// $DeviceGetVectorWidthPropertiesExt +typedef struct _ze_device_vector_width_properties_ext_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). + uint32_t vector_width_size; ///< [out] The associated vector width size supported by the device. + uint32_t preferred_vector_width_char; ///< [out] The preferred vector width size for char type supported by the device. + uint32_t preferred_vector_width_short; ///< [out] The preferred vector width size for short type supported by the device. + uint32_t preferred_vector_width_int; ///< [out] The preferred vector width size for int type supported by the device. + uint32_t preferred_vector_width_long; ///< [out] The preferred vector width size for long type supported by the device. + uint32_t preferred_vector_width_float; ///< [out] The preferred vector width size for float type supported by the device. + uint32_t preferred_vector_width_double; ///< [out] The preferred vector width size for double type supported by the device. + uint32_t preferred_vector_width_half; ///< [out] The preferred vector width size for half type supported by the device. + uint32_t native_vector_width_char; ///< [out] The native vector width size for char type supported by the device. + uint32_t native_vector_width_short; ///< [out] The native vector width size for short type supported by the device. + uint32_t native_vector_width_int; ///< [out] The native vector width size for int type supported by the device. + uint32_t native_vector_width_long; ///< [out] The native vector width size for long type supported by the device. + uint32_t native_vector_width_float; ///< [out] The native vector width size for float type supported by the device. + uint32_t native_vector_width_double; ///< [out] The native vector width size for double type supported by the device. + uint32_t native_vector_width_half; ///< [out] The native vector width size for half type supported by the device. + +} ze_device_vector_width_properties_ext_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves the vector width properties of the device. +/// +/// @details +/// - Properties are reported for each vector width supported by the device. +/// - Multiple calls to this function will return properties in the same +/// order. +/// - The number of vector width properties is reported thru the pCount +/// parameter which is updated by the driver given pCount == 0. +/// - The application may provide a buffer that is larger than the number of +/// properties, but the application must set pCount to the number of +/// properties to retrieve. +/// - 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_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDeviceGetVectorWidthPropertiesExt( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Extension APIs for Cache Reservation +#if !defined(__GNUC__) +#pragma region cacheReservation +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZE_CACHE_RESERVATION_EXT_NAME +/// @brief Cache_Reservation Extension Name +#define ZE_CACHE_RESERVATION_EXT_NAME "ZE_extension_cache_reservation" +#endif // ZE_CACHE_RESERVATION_EXT_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Cache_Reservation Extension Version(s) +typedef enum _ze_cache_reservation_ext_version_t +{ + ZE_CACHE_RESERVATION_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_CACHE_RESERVATION_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZE_CACHE_RESERVATION_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_CACHE_RESERVATION_EXT_VERSION_* ENUMs + +} ze_cache_reservation_ext_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Cache Reservation Region +typedef enum _ze_cache_ext_region_t +{ + ZE_CACHE_EXT_REGION_ZE_CACHE_REGION_DEFAULT = 0, ///< [DEPRECATED] utilize driver default scheme. Use + ///< ::ZE_CACHE_EXT_REGION_DEFAULT. + ZE_CACHE_EXT_REGION_ZE_CACHE_RESERVE_REGION = 1, ///< [DEPRECATED] utilize reserved region. Use + ///< ::ZE_CACHE_EXT_REGION_RESERVED. + ZE_CACHE_EXT_REGION_ZE_CACHE_NON_RESERVED_REGION = 2, ///< [DEPRECATED] utilize non-reserverd region. Use + ///< ::ZE_CACHE_EXT_REGION_NON_RESERVED. + ZE_CACHE_EXT_REGION_DEFAULT = 0, ///< utilize driver default scheme + ZE_CACHE_EXT_REGION_RESERVED = 1, ///< utilize reserved region + ZE_CACHE_EXT_REGION_NON_RESERVED = 2, ///< utilize non-reserverd region + ZE_CACHE_EXT_REGION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_CACHE_EXT_REGION_* ENUMs + +} ze_cache_ext_region_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief CacheReservation structure +/// +/// @details +/// - This structure must be passed to ::zeDeviceGetCacheProperties via the +/// `pNext` member of ::ze_device_cache_properties_t +/// - Used for determining the max cache reservation allowed on device. Size +/// of zero means no reservation available. +typedef struct _ze_cache_reservation_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). + size_t maxCacheReservationSize; ///< [out] max cache reservation size + +} ze_cache_reservation_ext_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserve Cache on Device +/// +/// @details +/// - The application may call this function but may not be successful as +/// some other application may have reserve prior +/// +/// @remarks +/// _Analogues_ +/// - None +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDeviceReserveCacheExt( + ze_device_handle_t hDevice, ///< [in] handle of the device object + size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the + ///< driver shall default to last level of cache and attempt to reserve in + ///< that cache. + size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver + ///< shall remove prior reservation + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Assign VA section to use reserved section +/// +/// @details +/// - The application may call this function to assign VA to particular +/// reservartion region +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == ptr` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeDeviceSetCacheAdviceExt( + ze_device_handle_t hDevice, ///< [in] handle of the device object + void* ptr, ///< [in] memory pointer to query + size_t regionSize, ///< [in] region size, in pages + ze_cache_ext_region_t cacheRegion ///< [in] reservation region + ); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Extension for supporting event query timestamps. +#if !defined(__GNUC__) +#pragma region eventquerytimestamps +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME +/// @brief Event Query Timestamps Extension Name +#define ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME "ZE_experimental_event_query_timestamps" +#endif // ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Event Query Timestamps Extension Version(s) +typedef enum _ze_event_query_timestamps_exp_version_t +{ + ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version + ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_* ENUMs + +} ze_event_query_timestamps_exp_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query event timestamps for a device or sub-device. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support +/// ::ZE_experimental_event_query_timestamps. +/// - The implementation must return all timestamps for the specified event +/// and device pair. +/// - The implementation must return all timestamps for all sub-devices when +/// device handle is parent device. +/// - The implementation may return all timestamps for sub-devices when +/// device handle is sub-device or may return 0 for count. +/// +/// @remarks +/// _Analogues_ +/// - None +/// +/// @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_NULL_HANDLE +/// + `nullptr == hEvent` +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ZE_APIEXPORT ze_result_t ZE_APICALL +zeEventQueryTimestampsExp( + ze_event_handle_t hEvent, ///< [in] handle of the event + ze_device_handle_t hDevice, ///< [in] handle of the device to query + uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. + ///< if count is zero, then the driver shall update the value with the + ///< total number of timestamps available. + ///< if count is greater than the number of timestamps available, then the + ///< driver shall update the value with the correct number of timestamps available. + ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. + ///< if count is less than the number of timestamps available, then driver + ///< shall only retrieve that number of timestamps. + ); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Extension for supporting image memory properties. +#if !defined(__GNUC__) +#pragma region imagememoryproperties +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME +/// @brief Image Memory Properties Extension Name +#define ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME "ZE_experimental_image_memory_properties" +#endif // ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image Memory Properties Extension Version(s) +typedef enum _ze_image_memory_properties_exp_version_t +{ + ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_* ENUMs + +} ze_image_memory_properties_exp_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Image memory properties +typedef struct _ze_image_memory_properties_exp_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). + uint64_t size; ///< [out] size of image allocation in bytes. + uint64_t rowPitch; ///< [out] size of image row in bytes. + uint64_t slicePitch; ///< [out] size of image slice in bytes. + +} ze_image_memory_properties_exp_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query image memory properties. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support +/// ::ZE_experimental_image_memory_properties extension. +/// +/// @remarks /// _Analogues_ /// - None /// @@ -8293,7 +9460,7 @@ typedef enum _ze_image_view_ext_version_t { ZE_IMAGE_VIEW_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_VIEW_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_VIEW_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_VIEW_EXT_VERSION_* ENUMs } ze_image_view_ext_version_t; @@ -8355,7 +9522,7 @@ typedef enum _ze_image_view_exp_version_t { ZE_IMAGE_VIEW_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_VIEW_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_VIEW_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_VIEW_EXP_VERSION_* ENUMs } ze_image_view_exp_version_t; @@ -8427,7 +9594,7 @@ typedef enum _ze_image_view_planar_ext_version_t { ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_* ENUMs } ze_image_view_planar_ext_version_t; @@ -8454,7 +9621,7 @@ typedef enum _ze_image_view_planar_exp_version_t { ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_* ENUMs } ze_image_view_planar_exp_version_t; @@ -8465,7 +9632,8 @@ typedef struct _ze_image_view_planar_exp_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). - uint32_t planeIndex; ///< [in] the 0-based plane index (e.g. NV12 is 0 = Y plane, 1 UV plane) + uint32_t planeIndex; ///< [DEPRECATED] no longer supported, use + ///< ::ze_image_view_planar_ext_desc_t instead } ze_image_view_planar_exp_desc_t; @@ -8488,7 +9656,7 @@ typedef enum _ze_scheduling_hints_exp_version_t { ZE_SCHEDULING_HINTS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SCHEDULING_HINTS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_SCHEDULING_HINTS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_SCHEDULING_HINTS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SCHEDULING_HINTS_EXP_VERSION_* ENUMs } ze_scheduling_hints_exp_version_t; @@ -8500,7 +9668,7 @@ typedef enum _ze_scheduling_hint_exp_flag_t ZE_SCHEDULING_HINT_EXP_FLAG_OLDEST_FIRST = ZE_BIT(0), ///< Hint that the kernel prefers oldest-first scheduling ZE_SCHEDULING_HINT_EXP_FLAG_ROUND_ROBIN = ZE_BIT(1), ///< Hint that the kernel prefers round-robin scheduling ZE_SCHEDULING_HINT_EXP_FLAG_STALL_BASED_ROUND_ROBIN = ZE_BIT(2), ///< Hint that the kernel prefers stall-based round-robin scheduling - ZE_SCHEDULING_HINT_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_SCHEDULING_HINT_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SCHEDULING_HINT_EXP_FLAG_* ENUMs } ze_scheduling_hint_exp_flag_t; @@ -8587,7 +9755,7 @@ typedef enum _ze_linkonce_odr_ext_version_t { ZE_LINKONCE_ODR_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_LINKONCE_ODR_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_LINKONCE_ODR_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_LINKONCE_ODR_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_LINKONCE_ODR_EXT_VERSION_* ENUMs } ze_linkonce_odr_ext_version_t; @@ -8610,7 +9778,7 @@ typedef enum _ze_power_saving_hint_exp_version_t { ZE_POWER_SAVING_HINT_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_POWER_SAVING_HINT_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_POWER_SAVING_HINT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_POWER_SAVING_HINT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_POWER_SAVING_HINT_EXP_VERSION_* ENUMs } ze_power_saving_hint_exp_version_t; @@ -8622,7 +9790,7 @@ typedef enum _ze_power_saving_hint_type_t ///< while executing work submitted to this context. ZE_POWER_SAVING_HINT_TYPE_MAX = 100, ///< Maximum power savings. The device will do everything to bring power to ///< a minimum while executing work submitted to this context. - ZE_POWER_SAVING_HINT_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_POWER_SAVING_HINT_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_POWER_SAVING_HINT_TYPE_* ENUMs } ze_power_saving_hint_type_t; @@ -8657,7 +9825,7 @@ typedef enum _ze_subgroup_ext_version_t { ZE_SUBGROUP_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SUBGROUP_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_SUBGROUP_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_SUBGROUP_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SUBGROUP_EXT_VERSION_* ENUMs } ze_subgroup_ext_version_t; @@ -8680,7 +9848,7 @@ typedef enum _ze_eu_count_ext_version_t { ZE_EU_COUNT_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EU_COUNT_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_EU_COUNT_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_EU_COUNT_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EU_COUNT_EXT_VERSION_* ENUMs } ze_eu_count_ext_version_t; @@ -8719,7 +9887,7 @@ typedef enum _ze_pci_properties_ext_version_t { ZE_PCI_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_PCI_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_PCI_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_PCI_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_PCI_PROPERTIES_EXT_VERSION_* ENUMs } ze_pci_properties_ext_version_t; @@ -8812,7 +9980,7 @@ typedef enum _ze_srgb_ext_version_t { ZE_SRGB_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SRGB_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_SRGB_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_SRGB_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SRGB_EXT_VERSION_* ENUMs } ze_srgb_ext_version_t; @@ -8851,7 +10019,7 @@ typedef enum _ze_image_copy_ext_version_t { ZE_IMAGE_COPY_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_COPY_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_COPY_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_COPY_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_COPY_EXT_VERSION_* ENUMs } ze_image_copy_ext_version_t; @@ -9002,7 +10170,7 @@ typedef enum _ze_image_query_alloc_properties_ext_version_t { ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_* ENUMs } ze_image_query_alloc_properties_ext_version_t; @@ -9061,7 +10229,7 @@ typedef enum _ze_linkage_inspection_ext_version_t { ZE_LINKAGE_INSPECTION_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_LINKAGE_INSPECTION_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_LINKAGE_INSPECTION_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_LINKAGE_INSPECTION_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_LINKAGE_INSPECTION_EXT_VERSION_* ENUMs } ze_linkage_inspection_ext_version_t; @@ -9073,7 +10241,7 @@ typedef enum _ze_linkage_inspection_ext_flag_t ZE_LINKAGE_INSPECTION_EXT_FLAG_IMPORTS = ZE_BIT(0), ///< List all imports of modules ZE_LINKAGE_INSPECTION_EXT_FLAG_UNRESOLVABLE_IMPORTS = ZE_BIT(1), ///< List all imports of modules that do not have a corresponding export ZE_LINKAGE_INSPECTION_EXT_FLAG_EXPORTS = ZE_BIT(2), ///< List all exports of modules - ZE_LINKAGE_INSPECTION_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_LINKAGE_INSPECTION_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_LINKAGE_INSPECTION_EXT_FLAG_* ENUMs } ze_linkage_inspection_ext_flag_t; @@ -9144,7 +10312,7 @@ typedef enum _ze_memory_compression_hints_ext_version_t { ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_* ENUMs } ze_memory_compression_hints_ext_version_t; @@ -9155,7 +10323,7 @@ typedef enum _ze_memory_compression_hints_ext_flag_t { ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_COMPRESSED = ZE_BIT(0), ///< Hint Driver implementation to make allocation compressible ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_UNCOMPRESSED = ZE_BIT(1), ///< Hint Driver implementation to make allocation not compressible - ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_* ENUMs } ze_memory_compression_hints_ext_flag_t; @@ -9199,7 +10367,7 @@ typedef enum _ze_memory_free_policies_ext_version_t { ZE_MEMORY_FREE_POLICIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MEMORY_FREE_POLICIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_MEMORY_FREE_POLICIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_MEMORY_FREE_POLICIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MEMORY_FREE_POLICIES_EXT_VERSION_* ENUMs } ze_memory_free_policies_ext_version_t; @@ -9208,9 +10376,16 @@ typedef enum _ze_memory_free_policies_ext_version_t typedef uint32_t ze_driver_memory_free_policy_ext_flags_t; typedef enum _ze_driver_memory_free_policy_ext_flag_t { - ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE = ZE_BIT(0), ///< blocks until all commands using the memory are complete before freeing - ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_DEFER_FREE = ZE_BIT(1), ///< schedules the memory to be freed but does not free immediately - ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE = ZE_BIT(0), ///< Blocks until all commands using the memory are complete before + ///< scheduling memory to be freed. Does not guarantee memory is freed upon + ///< return, only that it is safe and is scheduled to be freed. Actual + ///< freeing of memory is specific to user mode driver and kernel mode + ///< driver implementation and may be done asynchronously. + ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_DEFER_FREE = ZE_BIT(1), ///< Immediately schedules the memory to be freed and returns without + ///< blocking. Memory may be freed after all commands using the memory are + ///< complete. Actual freeing of memory is specific to user mode driver and + ///< kernel mode driver implementation and may be done asynchronously. + ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_* ENUMs } ze_driver_memory_free_policy_ext_flag_t; @@ -9246,11 +10421,13 @@ typedef struct _ze_memory_free_ext_desc_t } ze_memory_free_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Frees allocated host memory, device memory, or shared memory using the -/// specified free policy. +/// @brief Frees allocated host memory, device memory, or shared memory on the +/// context using the specified free policy. /// /// @details -/// - The memory free policy is specified by the memory free descriptor. +/// - Similar to zeMemFree, with added parameter to choose the 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. /// - The implementation of this function must be thread-safe. @@ -9349,7 +10526,7 @@ typedef enum _ze_device_luid_ext_version_t { ZE_DEVICE_LUID_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DEVICE_LUID_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_DEVICE_LUID_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_LUID_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_LUID_EXT_VERSION_* ENUMs } ze_device_luid_ext_version_t; @@ -9421,7 +10598,7 @@ typedef enum _ze_fabric_vertex_exp_type_t ZE_FABRIC_VERTEX_EXP_TYPE_DEVICE = 1, ///< Fabric vertex represents a device ZE_FABRIC_VERTEX_EXP_TYPE_SUBDEVICE = 2, ///< Fabric vertex represents a subdevice ZE_FABRIC_VERTEX_EXP_TYPE_SWITCH = 3, ///< Fabric vertex represents a switch - ZE_FABRIC_VERTEX_EXP_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_FABRIC_VERTEX_EXP_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_FABRIC_VERTEX_EXP_TYPE_* ENUMs } ze_fabric_vertex_exp_type_t; @@ -9434,7 +10611,7 @@ typedef enum _ze_fabric_edge_exp_duplexity_t ///< one direction at time ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX = 2, ///< Fabric edge is full duplex, i.e. stated bandwidth is supported in both ///< directions simultaneously - ZE_FABRIC_EDGE_EXP_DUPLEXITY_FORCE_UINT32 = 0x7fffffff + ZE_FABRIC_EDGE_EXP_DUPLEXITY_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_FABRIC_EDGE_EXP_DUPLEXITY_* ENUMs } ze_fabric_edge_exp_duplexity_t; @@ -9736,7 +10913,7 @@ typedef enum _ze_device_memory_properties_ext_version_t { ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_* ENUMs } ze_device_memory_properties_ext_version_t; @@ -9766,7 +10943,7 @@ typedef enum _ze_device_memory_ext_type_t ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6 = 19, ///< GDDR6 memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6X = 20, ///< GDDR6X memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR7 = 21, ///< GDDR7 memory - ZE_DEVICE_MEMORY_EXT_TYPE_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_MEMORY_EXT_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_MEMORY_EXT_TYPE_* ENUMs } ze_device_memory_ext_type_t; @@ -9810,7 +10987,7 @@ typedef enum _ze_bfloat16_conversions_ext_version_t { ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_* ENUMs } ze_bfloat16_conversions_ext_version_t; @@ -9833,7 +11010,7 @@ typedef enum _ze_device_ip_version_version_t { ZE_DEVICE_IP_VERSION_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DEVICE_IP_VERSION_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_DEVICE_IP_VERSION_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_DEVICE_IP_VERSION_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_DEVICE_IP_VERSION_VERSION_* ENUMs } ze_device_ip_version_version_t; @@ -9873,7 +11050,7 @@ typedef enum _ze_kernel_max_group_size_properties_ext_version_t { ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_* ENUMs } ze_kernel_max_group_size_properties_ext_version_t; @@ -9918,7 +11095,7 @@ typedef enum _ze_sub_allocations_exp_version_t { ZE_SUB_ALLOCATIONS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SUB_ALLOCATIONS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_SUB_ALLOCATIONS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_SUB_ALLOCATIONS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_SUB_ALLOCATIONS_EXP_VERSION_* ENUMs } ze_sub_allocations_exp_version_t; @@ -9972,7 +11149,7 @@ typedef enum _ze_event_query_kernel_timestamps_ext_version_t { ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_* ENUMs } ze_event_query_kernel_timestamps_ext_version_t; @@ -9983,7 +11160,7 @@ typedef enum _ze_event_query_kernel_timestamps_ext_flag_t { ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_KERNEL = ZE_BIT(0), ///< Kernel timestamp results ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_SYNCHRONIZED = ZE_BIT(1), ///< Device event timestamps synchronized to the host time domain - ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_* ENUMs } ze_event_query_kernel_timestamps_ext_flag_t; @@ -10112,7 +11289,7 @@ typedef enum _ze_rtas_builder_exp_version_t { ZE_RTAS_BUILDER_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_RTAS_BUILDER_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_RTAS_BUILDER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_EXP_VERSION_* ENUMs } ze_rtas_builder_exp_version_t; @@ -10122,7 +11299,7 @@ typedef uint32_t ze_rtas_device_exp_flags_t; typedef enum _ze_rtas_device_exp_flag_t { ZE_RTAS_DEVICE_EXP_FLAG_RESERVED = ZE_BIT(0), ///< reserved for future use - ZE_RTAS_DEVICE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_DEVICE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_DEVICE_EXP_FLAG_* ENUMs } ze_rtas_device_exp_flag_t; @@ -10135,7 +11312,8 @@ typedef enum _ze_rtas_device_exp_flag_t typedef enum _ze_rtas_format_exp_t { ZE_RTAS_FORMAT_EXP_INVALID = 0, ///< Invalid acceleration structure format - ZE_RTAS_FORMAT_EXP_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_FORMAT_EXP_MAX = 0x7ffffffe, ///< Maximum acceleration structure format code + ZE_RTAS_FORMAT_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_FORMAT_EXP_* ENUMs } ze_rtas_format_exp_t; @@ -10145,7 +11323,7 @@ typedef uint32_t ze_rtas_builder_exp_flags_t; typedef enum _ze_rtas_builder_exp_flag_t { ZE_RTAS_BUILDER_EXP_FLAG_RESERVED = ZE_BIT(0), ///< Reserved for future use - ZE_RTAS_BUILDER_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_EXP_FLAG_* ENUMs } ze_rtas_builder_exp_flag_t; @@ -10155,7 +11333,7 @@ typedef uint32_t ze_rtas_parallel_operation_exp_flags_t; typedef enum _ze_rtas_parallel_operation_exp_flag_t { ZE_RTAS_PARALLEL_OPERATION_EXP_FLAG_RESERVED = ZE_BIT(0), ///< Reserved for future use - ZE_RTAS_PARALLEL_OPERATION_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_PARALLEL_OPERATION_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_PARALLEL_OPERATION_EXP_FLAG_* ENUMs } ze_rtas_parallel_operation_exp_flag_t; @@ -10165,7 +11343,7 @@ typedef uint32_t ze_rtas_builder_geometry_exp_flags_t; typedef enum _ze_rtas_builder_geometry_exp_flag_t { ZE_RTAS_BUILDER_GEOMETRY_EXP_FLAG_NON_OPAQUE = ZE_BIT(0), ///< non-opaque geometries invoke an any-hit shader - ZE_RTAS_BUILDER_GEOMETRY_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_GEOMETRY_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_GEOMETRY_EXP_FLAG_* ENUMs } ze_rtas_builder_geometry_exp_flag_t; @@ -10185,7 +11363,7 @@ typedef enum _ze_rtas_builder_instance_exp_flag_t ///< be non-opaque ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_TRIANGLE_FORCE_NON_OPAQUE = ZE_BIT(3),///< forces instanced geometry to be non-opaque, unless ray flag forces it ///< to be opaque - ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_* ENUMs } ze_rtas_builder_instance_exp_flag_t; @@ -10211,7 +11389,7 @@ typedef enum _ze_rtas_builder_build_op_exp_flag_t { ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_COMPACT = ZE_BIT(0), ///< build more compact acceleration structure ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION = ZE_BIT(1), ///< guarantees single any-hit shader invocation per primitive - ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_* ENUMs } ze_rtas_builder_build_op_exp_flag_t; @@ -10234,7 +11412,7 @@ typedef enum _ze_rtas_builder_build_quality_hint_exp_t ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_LOW = 0, ///< build low-quality acceleration structure (fast) ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_MEDIUM = 1, ///< build medium-quality acceleration structure (slower) ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH = 2, ///< build high-quality acceleration structure (slow) - ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_* ENUMs } ze_rtas_builder_build_quality_hint_exp_t; @@ -10246,7 +11424,7 @@ typedef enum _ze_rtas_builder_geometry_type_exp_t ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_QUADS = 1, ///< quad mesh geometry type ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_PROCEDURAL = 2, ///< procedural geometry type ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_INSTANCE = 3, ///< instance geometry type - ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_* ENUMs } ze_rtas_builder_geometry_type_exp_t; @@ -10275,7 +11453,7 @@ typedef enum _ze_rtas_builder_input_data_format_exp_t ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_TRIANGLE_INDICES_UINT32 = 5, ///< Unsigned 32-bit triangle indices (see ///< ::ze_rtas_triangle_indices_uint32_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_QUAD_INDICES_UINT32 = 6, ///< Unsigned 32-bit quad indices (see ::ze_rtas_quad_indices_uint32_exp_t) - ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FORCE_UINT32 = 0x7fffffff + ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_* ENUMs } ze_rtas_builder_input_data_format_exp_t; @@ -10724,7 +11902,7 @@ zeRTASBuilderCreateExp( /// + `nullptr == pBuildOpDescriptor` /// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` ZE_APIEXPORT ze_result_t ZE_APICALL @@ -10750,8 +11928,8 @@ zeRTASBuilderGetBuildPropertiesExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatA` -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatB` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < rtasFormatA` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < rtasFormatB` /// - ::ZE_RESULT_SUCCESS /// + An acceleration structure built with `rtasFormatA` is compatible with devices that report `rtasFormatB`. /// - ::ZE_RESULT_EXP_ERROR_OPERANDS_INCOMPATIBLE @@ -10826,7 +12004,7 @@ zeDriverRTASFormatCompatibilityCheckExp( /// + `nullptr == pScratchBuffer` /// + `nullptr == pRtasBuffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` /// - ::ZE_RESULT_EXP_RTAS_BUILD_DEFERRED @@ -10995,7 +12173,7 @@ typedef enum _ze_event_pool_counter_based_exp_version_t { ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_* ENUMs } ze_event_pool_counter_based_exp_version_t; @@ -11006,7 +12184,7 @@ typedef enum _ze_event_pool_counter_based_exp_flag_t { ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE = ZE_BIT(0), ///< Counter-based event pool is used for immediate command lists (default) ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_NON_IMMEDIATE = ZE_BIT(1), ///< Counter-based event pool is for non-immediate command lists - ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_* ENUMs } ze_event_pool_counter_based_exp_flag_t; @@ -11045,7 +12223,7 @@ typedef enum _ze_bindless_image_exp_version_t { ZE_BINDLESS_IMAGE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_BINDLESS_IMAGE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_BINDLESS_IMAGE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_BINDLESS_IMAGE_EXP_VERSION_* ENUMs } ze_bindless_image_exp_version_t; @@ -11059,7 +12237,7 @@ typedef enum _ze_image_bindless_exp_flag_t ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE = ZE_BIT(1), ///< Bindless sampled images are created with ::zeImageCreate by combining ///< BINDLESS and SAMPLED_IMAGE. ///< Create sampled image view from bindless unsampled image using SAMPLED_IMAGE. - ZE_IMAGE_BINDLESS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_IMAGE_BINDLESS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMAGE_BINDLESS_EXP_FLAG_* ENUMs } ze_image_bindless_exp_flag_t; @@ -11188,7 +12366,7 @@ typedef enum _ze_command_list_clone_exp_version_t { ZE_COMMAND_LIST_CLONE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_COMMAND_LIST_CLONE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_COMMAND_LIST_CLONE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_COMMAND_LIST_CLONE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_COMMAND_LIST_CLONE_EXP_VERSION_* ENUMs } ze_command_list_clone_exp_version_t; @@ -11245,7 +12423,7 @@ typedef enum _ze_immediate_command_list_append_exp_version_t { ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_* ENUMs } ze_immediate_command_list_append_exp_version_t; @@ -11307,7 +12485,7 @@ typedef enum _ze_mutable_command_list_exp_version_t ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 1 ), ///< latest known version - ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_* ENUMs } ze_mutable_command_list_exp_version_t; @@ -11324,7 +12502,7 @@ typedef enum _ze_mutable_command_exp_flag_t ZE_MUTABLE_COMMAND_EXP_FLAG_WAIT_EVENTS = ZE_BIT(5), ///< command wait events ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_INSTRUCTION = ZE_BIT(6), ///< command kernel ZE_MUTABLE_COMMAND_EXP_FLAG_GRAPH_ARGUMENTS = ZE_BIT(7), ///< graph arguments - ZE_MUTABLE_COMMAND_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_MUTABLE_COMMAND_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MUTABLE_COMMAND_EXP_FLAG_* ENUMs } ze_mutable_command_exp_flag_t; @@ -11349,7 +12527,7 @@ typedef uint32_t ze_mutable_command_list_exp_flags_t; typedef enum _ze_mutable_command_list_exp_flag_t { ZE_MUTABLE_COMMAND_LIST_EXP_FLAG_RESERVED = ZE_BIT(0), ///< reserved - ZE_MUTABLE_COMMAND_LIST_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZE_MUTABLE_COMMAND_LIST_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_MUTABLE_COMMAND_LIST_EXP_FLAG_* ENUMs } ze_mutable_command_list_exp_flag_t; diff --git a/include/ze_ddi.h b/include/ze_ddi.h index 9f99592b..86f43368 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZE_DDI_H @@ -19,6 +19,88 @@ extern "C" { #endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASBuilderCreateExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderCreateExt_t)( + ze_driver_handle_t, + const ze_rtas_builder_ext_desc_t*, + ze_rtas_builder_ext_handle_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASBuilderGetBuildPropertiesExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderGetBuildPropertiesExt_t)( + ze_rtas_builder_ext_handle_t, + const ze_rtas_builder_build_op_ext_desc_t*, + ze_rtas_builder_ext_properties_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASBuilderBuildExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderBuildExt_t)( + ze_rtas_builder_ext_handle_t, + const ze_rtas_builder_build_op_ext_desc_t*, + void*, + size_t, + void*, + size_t, + ze_rtas_parallel_operation_ext_handle_t, + void*, + ze_rtas_aabb_ext_t*, + size_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASBuilderCommandListAppendCopyExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderCommandListAppendCopyExt_t)( + ze_command_list_handle_t, + void*, + const void*, + size_t, + ze_event_handle_t, + uint32_t, + ze_event_handle_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASBuilderDestroyExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderDestroyExt_t)( + ze_rtas_builder_ext_handle_t + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of RTASBuilder functions pointers +typedef struct _ze_rtas_builder_dditable_t +{ + ze_pfnRTASBuilderCreateExt_t pfnCreateExt; + ze_pfnRTASBuilderGetBuildPropertiesExt_t pfnGetBuildPropertiesExt; + ze_pfnRTASBuilderBuildExt_t pfnBuildExt; + ze_pfnRTASBuilderCommandListAppendCopyExt_t pfnCommandListAppendCopyExt; + ze_pfnRTASBuilderDestroyExt_t pfnDestroyExt; +} ze_rtas_builder_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASBuilder table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASBuilderProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_builder_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeGetRTASBuilderProcAddrTable +typedef ze_result_t (ZE_APICALL *ze_pfnGetRTASBuilderProcAddrTable_t)( + ze_api_version_t, + ze_rtas_builder_dditable_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASBuilderCreateExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderCreateExp_t)( @@ -88,6 +170,64 @@ typedef ze_result_t (ZE_APICALL *ze_pfnGetRTASBuilderExpProcAddrTable_t)( ze_rtas_builder_exp_dditable_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASParallelOperationCreateExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationCreateExt_t)( + ze_driver_handle_t, + ze_rtas_parallel_operation_ext_handle_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASParallelOperationGetPropertiesExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationGetPropertiesExt_t)( + ze_rtas_parallel_operation_ext_handle_t, + ze_rtas_parallel_operation_ext_properties_t* + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASParallelOperationJoinExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationJoinExt_t)( + ze_rtas_parallel_operation_ext_handle_t + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeRTASParallelOperationDestroyExt +typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationDestroyExt_t)( + ze_rtas_parallel_operation_ext_handle_t + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of RTASParallelOperation functions pointers +typedef struct _ze_rtas_parallel_operation_dditable_t +{ + ze_pfnRTASParallelOperationCreateExt_t pfnCreateExt; + ze_pfnRTASParallelOperationGetPropertiesExt_t pfnGetPropertiesExt; + ze_pfnRTASParallelOperationJoinExt_t pfnJoinExt; + ze_pfnRTASParallelOperationDestroyExt_t pfnDestroyExt; +} ze_rtas_parallel_operation_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASParallelOperation table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASParallelOperationProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_parallel_operation_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeGetRTASParallelOperationProcAddrTable +typedef ze_result_t (ZE_APICALL *ze_pfnGetRTASParallelOperationProcAddrTable_t)( + ze_api_version_t, + ze_rtas_parallel_operation_dditable_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASParallelOperationCreateExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationCreateExp_t)( @@ -241,6 +381,14 @@ typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetLastErrorDescription_t)( const char** ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeDriverRTASFormatCompatibilityCheckExt +typedef ze_result_t (ZE_APICALL *ze_pfnDriverRTASFormatCompatibilityCheckExt_t)( + ze_driver_handle_t, + ze_rtas_format_ext_t, + ze_rtas_format_ext_t + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Driver functions pointers typedef struct _ze_driver_dditable_t @@ -252,6 +400,7 @@ typedef struct _ze_driver_dditable_t ze_pfnDriverGetExtensionProperties_t pfnGetExtensionProperties; ze_pfnDriverGetExtensionFunctionAddress_t pfnGetExtensionFunctionAddress; ze_pfnDriverGetLastErrorDescription_t pfnGetLastErrorDescription; + ze_pfnDriverRTASFormatCompatibilityCheckExt_t pfnRTASFormatCompatibilityCheckExt; } ze_driver_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -470,6 +619,14 @@ typedef ze_result_t (ZE_APICALL *ze_pfnDeviceReleaseExternalSemaphoreExt_t)( ze_external_semaphore_ext_handle_t ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zeDeviceGetVectorWidthPropertiesExt +typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetVectorWidthPropertiesExt_t)( + ze_device_handle_t, + uint32_t*, + ze_device_vector_width_properties_ext_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device functions pointers typedef struct _ze_device_dditable_t @@ -495,6 +652,7 @@ typedef struct _ze_device_dditable_t ze_pfnDeviceGetRootDevice_t pfnGetRootDevice; ze_pfnDeviceImportExternalSemaphoreExt_t pfnImportExternalSemaphoreExt; ze_pfnDeviceReleaseExternalSemaphoreExt_t pfnReleaseExternalSemaphoreExt; + ze_pfnDeviceGetVectorWidthPropertiesExt_t pfnGetVectorWidthPropertiesExt; } ze_device_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -2588,7 +2746,9 @@ typedef ze_result_t (ZE_APICALL *ze_pfnGetFabricEdgeExpProcAddrTable_t)( /// @brief Container for all DDI tables typedef struct _ze_dditable_t { + ze_rtas_builder_dditable_t RTASBuilder; ze_rtas_builder_exp_dditable_t RTASBuilderExp; + ze_rtas_parallel_operation_dditable_t RTASParallelOperation; ze_rtas_parallel_operation_exp_dditable_t RTASParallelOperationExp; ze_global_dditable_t Global; ze_driver_dditable_t Driver; @@ -2622,7 +2782,9 @@ typedef struct _ze_dditable_driver_t { ze_api_version_t version; uint8_t isValidFlag; + ze_rtas_builder_dditable_t * RTASBuilder; ze_rtas_builder_exp_dditable_t * RTASBuilderExp; + ze_rtas_parallel_operation_dditable_t * RTASParallelOperation; ze_rtas_parallel_operation_exp_dditable_t * RTASParallelOperationExp; ze_global_dditable_t * Global; ze_driver_dditable_t * Driver; diff --git a/include/ze_ddi_common.h b/include/ze_ddi_common.h index 7831c57f..ca6eb50a 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZE_DDI_COMMON_H diff --git a/include/zes.py b/include/zes.py index 2b005b07..b9a9ca21 100644 --- a/include/zes.py +++ b/include/zes.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zes.py - @version v1.12-r1.12.15 + @version v1.13-r1.13.1 """ import platform @@ -169,6 +169,7 @@ class zes_structure_type_v(IntEnum): VF_UTIL_MEM_EXP2 = 0x00020009 ## ::zes_vf_util_mem_exp2_t VF_UTIL_ENGINE_EXP2 = 0x00020010 ## ::zes_vf_util_engine_exp2_t VF_EXP2_CAPABILITIES = 0x00020011 ## ::zes_vf_exp2_capabilities_t + DEVICE_ECC_DEFAULT_PROPERTIES_EXT = 0x00020012 ## ::zes_device_ecc_default_properties_ext_t class zes_structure_type_t(c_int): def __str__(self): @@ -2147,6 +2148,32 @@ class zes_temp_config_t(Structure): ## driver. ] +############################################################################### +## @brief Device ECC default properties Extension Name +ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_NAME = "ZES_extension_device_ecc_default_properties" + +############################################################################### +## @brief Device ECC default properties Extension Version(s) +class zes_device_ecc_default_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 zes_device_ecc_default_properties_ext_version_t(c_int): + def __str__(self): + return str(zes_device_ecc_default_properties_ext_version_v(self.value)) + + +############################################################################### +## @brief This structure may be passed to ::zesDeviceGetEccState as pNext member +## of ::zes_device_ecc_properties_t. +class zes_device_ecc_default_properties_ext_t(Structure): + _fields_ = [ + ("stype", zes_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). + ("defaultState", zes_device_ecc_state_t) ## [out] Default ECC state + ] + ############################################################################### ## @brief Power Limits Extension Name ZES_POWER_LIMITS_EXT_NAME = "ZES_extension_power_limits" diff --git a/include/zes_api.h b/include/zes_api.h index 62705642..82f706e0 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZES_API_H @@ -162,7 +162,8 @@ typedef enum _zes_structure_type_t ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP2 = 0x00020009, ///< ::zes_vf_util_mem_exp2_t ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP2 = 0x00020010, ///< ::zes_vf_util_engine_exp2_t ZES_STRUCTURE_TYPE_VF_EXP2_CAPABILITIES = 0x00020011, ///< ::zes_vf_exp2_capabilities_t - ZES_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_STRUCTURE_TYPE_DEVICE_ECC_DEFAULT_PROPERTIES_EXT = 0x00020012, ///< ::zes_device_ecc_default_properties_ext_t + ZES_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_STRUCTURE_TYPE_* ENUMs } zes_structure_type_t; @@ -508,6 +509,10 @@ typedef struct _zes_temp_threshold_t zes_temp_threshold_t; /// @brief Forward-declare zes_temp_config_t typedef struct _zes_temp_config_t zes_temp_config_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zes_device_ecc_default_properties_ext_t +typedef struct _zes_device_ecc_default_properties_ext_t zes_device_ecc_default_properties_ext_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_limit_ext_desc_t typedef struct _zes_power_limit_ext_desc_t zes_power_limit_ext_desc_t; @@ -582,7 +587,7 @@ typedef uint32_t zes_init_flags_t; typedef enum _zes_init_flag_t { ZES_INIT_FLAG_PLACEHOLDER = ZE_BIT(0), ///< placeholder for future use - ZES_INIT_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_INIT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_INIT_FLAG_* ENUMs } zes_init_flag_t; @@ -793,7 +798,7 @@ typedef enum _zes_engine_type_flag_t ZES_ENGINE_TYPE_FLAG_MEDIA = ZE_BIT(3), ///< Engines that process media workloads. ZES_ENGINE_TYPE_FLAG_DMA = ZE_BIT(4), ///< Engines that copy blocks of data. ZES_ENGINE_TYPE_FLAG_RENDER = ZE_BIT(5), ///< Engines that can process both 3D content and compute kernels. - ZES_ENGINE_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_ENGINE_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_ENGINE_TYPE_FLAG_* ENUMs } zes_engine_type_flag_t; @@ -804,7 +809,7 @@ typedef enum _zes_repair_status_t ZES_REPAIR_STATUS_UNSUPPORTED = 0, ///< The device does not support in-field repairs. ZES_REPAIR_STATUS_NOT_PERFORMED = 1, ///< The device has never been repaired. ZES_REPAIR_STATUS_PERFORMED = 2, ///< The device has been repaired. - ZES_REPAIR_STATUS_FORCE_UINT32 = 0x7fffffff + ZES_REPAIR_STATUS_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_REPAIR_STATUS_* ENUMs } zes_repair_status_t; @@ -816,7 +821,7 @@ typedef enum _zes_reset_reason_flag_t ZES_RESET_REASON_FLAG_WEDGED = ZE_BIT(0), ///< The device needs to be reset because one or more parts of the hardware ///< is wedged ZES_RESET_REASON_FLAG_REPAIR = ZE_BIT(1), ///< The device needs to be reset in order to complete in-field repairs - ZES_RESET_REASON_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_RESET_REASON_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_RESET_REASON_FLAG_* ENUMs } zes_reset_reason_flag_t; @@ -827,7 +832,7 @@ typedef enum _zes_reset_type_t ZES_RESET_TYPE_WARM = 0, ///< Apply warm reset ZES_RESET_TYPE_COLD = 1, ///< Apply cold reset ZES_RESET_TYPE_FLR = 2, ///< Apply FLR reset - ZES_RESET_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_RESET_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_RESET_TYPE_* ENUMs } zes_reset_type_t; @@ -874,7 +879,7 @@ typedef enum _zes_device_type_t ZES_DEVICE_TYPE_FPGA = 3, ///< Field Programmable Gate Array ZES_DEVICE_TYPE_MCA = 4, ///< Memory Copy Accelerator ZES_DEVICE_TYPE_VPU = 5, ///< Vision Processing Unit - ZES_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_DEVICE_TYPE_* ENUMs } zes_device_type_t; @@ -887,7 +892,7 @@ typedef enum _zes_device_property_flag_t ZES_DEVICE_PROPERTY_FLAG_SUBDEVICE = ZE_BIT(1), ///< Device handle used for query represents a sub-device. ZES_DEVICE_PROPERTY_FLAG_ECC = ZE_BIT(2), ///< Device supports error correction memory access. ZES_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING = ZE_BIT(3), ///< Device supports on-demand page-faulting. - ZES_DEVICE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_DEVICE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_DEVICE_PROPERTY_FLAG_* ENUMs } zes_device_property_flag_t; @@ -1171,7 +1176,7 @@ typedef enum _zes_pci_link_status_t ZES_PCI_LINK_STATUS_QUALITY_ISSUES = 2, ///< The link is up but has quality and/or bandwidth degradation ZES_PCI_LINK_STATUS_STABILITY_ISSUES = 3, ///< The link has stability issues and preventing workloads making forward ///< progress - ZES_PCI_LINK_STATUS_FORCE_UINT32 = 0x7fffffff + ZES_PCI_LINK_STATUS_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_PCI_LINK_STATUS_* ENUMs } zes_pci_link_status_t; @@ -1182,7 +1187,7 @@ typedef enum _zes_pci_link_qual_issue_flag_t { ZES_PCI_LINK_QUAL_ISSUE_FLAG_REPLAYS = ZE_BIT(0), ///< A significant number of replays are occurring ZES_PCI_LINK_QUAL_ISSUE_FLAG_SPEED = ZE_BIT(1), ///< There is a degradation in the maximum bandwidth of the link - ZES_PCI_LINK_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_PCI_LINK_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_PCI_LINK_QUAL_ISSUE_FLAG_* ENUMs } zes_pci_link_qual_issue_flag_t; @@ -1192,7 +1197,7 @@ typedef uint32_t zes_pci_link_stab_issue_flags_t; typedef enum _zes_pci_link_stab_issue_flag_t { ZES_PCI_LINK_STAB_ISSUE_FLAG_RETRAINING = ZE_BIT(0), ///< Link retraining has occurred to deal with quality issues - ZES_PCI_LINK_STAB_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_PCI_LINK_STAB_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_PCI_LINK_STAB_ISSUE_FLAG_* ENUMs } zes_pci_link_stab_issue_flag_t; @@ -1225,7 +1230,7 @@ typedef enum _zes_pci_bar_type_t ZES_PCI_BAR_TYPE_MMIO = 0, ///< MMIO registers ZES_PCI_BAR_TYPE_ROM = 1, ///< ROM aperture ZES_PCI_BAR_TYPE_MEM = 2, ///< Device memory - ZES_PCI_BAR_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_PCI_BAR_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_PCI_BAR_TYPE_* ENUMs } zes_pci_bar_type_t; @@ -1418,7 +1423,7 @@ typedef enum _zes_overclock_domain_t ZES_OVERCLOCK_DOMAIN_GPU_MEDIA = 64, ///< Overclocking a GPU with media assets on its own PLL/VR. ZES_OVERCLOCK_DOMAIN_VRAM = 128, ///< Overclocking device local memory. ZES_OVERCLOCK_DOMAIN_ADM = 256, ///< Overclocking LLC/L4 cache. - ZES_OVERCLOCK_DOMAIN_FORCE_UINT32 = 0x7fffffff + ZES_OVERCLOCK_DOMAIN_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_OVERCLOCK_DOMAIN_* ENUMs } zes_overclock_domain_t; @@ -1441,7 +1446,7 @@ typedef enum _zes_overclock_control_t ZES_OVERCLOCK_CONTROL_TEMP_LIMIT = 512, ///< This control changes the value of TjMax. ZES_OVERCLOCK_CONTROL_ITD_DISABLE = 1024, ///< This control permits disabling the adaptive voltage feature ITD ZES_OVERCLOCK_CONTROL_ACM_DISABLE = 2048, ///< This control permits disabling the adaptive voltage feature ACM. - ZES_OVERCLOCK_CONTROL_FORCE_UINT32 = 0x7fffffff + ZES_OVERCLOCK_CONTROL_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_OVERCLOCK_CONTROL_* ENUMs } zes_overclock_control_t; @@ -1455,7 +1460,7 @@ typedef enum _zes_overclock_mode_t ZES_OVERCLOCK_MODE_MODE_UNAVAILABLE = 4, ///< Overclocking is unavailable at this time since the system is running ///< on battery. ZES_OVERCLOCK_MODE_MODE_DISABLED = 5, ///< Overclock mode is disabled. - ZES_OVERCLOCK_MODE_FORCE_UINT32 = 0x7fffffff + ZES_OVERCLOCK_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_OVERCLOCK_MODE_* ENUMs } zes_overclock_mode_t; @@ -1468,7 +1473,7 @@ typedef enum _zes_control_state_t ZES_CONTROL_STATE_STATE_ACTIVE = 2, ///< The overclock control has been set and it is active. ZES_CONTROL_STATE_STATE_DISABLED = 3, ///< The overclock control value has been disabled due to the current power ///< configuration (typically when running on DC). - ZES_CONTROL_STATE_FORCE_UINT32 = 0x7fffffff + ZES_CONTROL_STATE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_CONTROL_STATE_* ENUMs } zes_control_state_t; @@ -1481,7 +1486,7 @@ typedef enum _zes_pending_action_t ZES_PENDING_ACTION_PENDING_COLD_RESET = 2, ///< The requested change requires a device cold reset (hotplug, system ///< boot). ZES_PENDING_ACTION_PENDING_WARM_RESET = 3, ///< The requested change requires a device warm reset (PCIe FLR). - ZES_PENDING_ACTION_FORCE_UINT32 = 0x7fffffff + ZES_PENDING_ACTION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_PENDING_ACTION_* ENUMs } zes_pending_action_t; @@ -1496,7 +1501,7 @@ typedef enum _zes_vf_program_type_t ///< the frequency of those points cannot be changed ZES_VF_PROGRAM_TYPE_VF_VOLT_FIXED = 2, ///< Can only program the frequency for the V-F points that is reads back - ///< the voltage of each point cannot be changed. - ZES_VF_PROGRAM_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_VF_PROGRAM_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_VF_PROGRAM_TYPE_* ENUMs } zes_vf_program_type_t; @@ -1506,7 +1511,7 @@ typedef enum _zes_vf_type_t { ZES_VF_TYPE_VOLT = 0, ///< VF Voltage point ZES_VF_TYPE_FREQ = 1, ///< VF Frequency point - ZES_VF_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_VF_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_VF_TYPE_* ENUMs } zes_vf_type_t; @@ -1517,7 +1522,7 @@ typedef enum _zes_vf_array_type_t ZES_VF_ARRAY_TYPE_USER_VF_ARRAY = 0, ///< User V-F array ZES_VF_ARRAY_TYPE_DEFAULT_VF_ARRAY = 1, ///< Default V-F array ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY = 2, ///< Live V-F array - ZES_VF_ARRAY_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_VF_ARRAY_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_VF_ARRAY_TYPE_* ENUMs } zes_vf_array_type_t; @@ -2031,7 +2036,7 @@ typedef enum _zes_diag_result_t ZES_DIAG_RESULT_FAIL_CANT_REPAIR = 2, ///< Diagnostic had problems setting up repairs ZES_DIAG_RESULT_REBOOT_FOR_REPAIR = 3, ///< Diagnostics found errors, setup for repair and reboot is required to ///< complete the process - ZES_DIAG_RESULT_FORCE_UINT32 = 0x7fffffff + ZES_DIAG_RESULT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_DIAG_RESULT_* ENUMs } zes_diag_result_t; @@ -2217,7 +2222,7 @@ typedef enum _zes_device_ecc_state_t ZES_DEVICE_ECC_STATE_UNAVAILABLE = 0, ///< None ZES_DEVICE_ECC_STATE_ENABLED = 1, ///< ECC enabled. ZES_DEVICE_ECC_STATE_DISABLED = 2, ///< ECC disabled. - ZES_DEVICE_ECC_STATE_FORCE_UINT32 = 0x7fffffff + ZES_DEVICE_ECC_STATE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_DEVICE_ECC_STATE_* ENUMs } zes_device_ecc_state_t; @@ -2229,7 +2234,7 @@ typedef enum _zes_device_action_t ZES_DEVICE_ACTION_WARM_CARD_RESET = 1, ///< Warm reset of the card. ZES_DEVICE_ACTION_COLD_CARD_RESET = 2, ///< Cold reset of the card. ZES_DEVICE_ACTION_COLD_SYSTEM_REBOOT = 3, ///< Cold reboot of the system. - ZES_DEVICE_ACTION_FORCE_UINT32 = 0x7fffffff + ZES_DEVICE_ACTION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_DEVICE_ACTION_* ENUMs } zes_device_action_t; @@ -2406,7 +2411,7 @@ typedef enum _zes_engine_group_t ///< engines so activity of such an engine may not be indicative of the ///< underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL for ///< that. - ZES_ENGINE_GROUP_FORCE_UINT32 = 0x7fffffff + ZES_ENGINE_GROUP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_ENGINE_GROUP_* ENUMs } zes_engine_group_t; @@ -2574,7 +2579,7 @@ typedef enum _zes_event_type_flag_t ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED = ZE_BIT(14), ///< Event is triggered when the device needs to be reset (use ///< ::zesDeviceGetState() to determine the reasons for the reset). ZES_EVENT_TYPE_FLAG_SURVIVABILITY_MODE_DETECTED = ZE_BIT(15), ///< Event is triggered when graphics driver encounter an error condition. - ZES_EVENT_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_EVENT_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_EVENT_TYPE_FLAG_* ENUMs } zes_event_type_flag_t; @@ -2721,7 +2726,7 @@ typedef enum _zes_fabric_port_status_t ZES_FABRIC_PORT_STATUS_FAILED = 3, ///< Port connection instabilities are preventing workloads making forward ///< progress ZES_FABRIC_PORT_STATUS_DISABLED = 4, ///< The port is configured down - ZES_FABRIC_PORT_STATUS_FORCE_UINT32 = 0x7fffffff + ZES_FABRIC_PORT_STATUS_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FABRIC_PORT_STATUS_* ENUMs } zes_fabric_port_status_t; @@ -2732,7 +2737,7 @@ typedef enum _zes_fabric_port_qual_issue_flag_t { ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS = ZE_BIT(0), ///< Excessive link errors are occurring ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED = ZE_BIT(1), ///< There is a degradation in the bitrate and/or width of the link - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_* ENUMs } zes_fabric_port_qual_issue_flag_t; @@ -2752,7 +2757,7 @@ typedef enum _zes_fabric_port_failure_flag_t ///< period of time. Driver will allow port to continue to train, but will ///< not enable the port for use until the port has been disabled and ///< subsequently re-enabled using ::zesFabricPortSetConfig(). - ZES_FABRIC_PORT_FAILURE_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_FABRIC_PORT_FAILURE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FABRIC_PORT_FAILURE_FLAG_* ENUMs } zes_fabric_port_failure_flag_t; @@ -3137,7 +3142,7 @@ typedef enum _zes_fan_speed_mode_t ZES_FAN_SPEED_MODE_FIXED = 1, ///< The fan speed is currently set to a fixed value ZES_FAN_SPEED_MODE_TABLE = 2, ///< The fan speed is currently controlled dynamically by hardware based on ///< a temp/speed table - ZES_FAN_SPEED_MODE_FORCE_UINT32 = 0x7fffffff + ZES_FAN_SPEED_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FAN_SPEED_MODE_* ENUMs } zes_fan_speed_mode_t; @@ -3147,7 +3152,7 @@ typedef enum _zes_fan_speed_units_t { ZES_FAN_SPEED_UNITS_RPM = 0, ///< The fan speed is in units of revolutions per minute (rpm) ZES_FAN_SPEED_UNITS_PERCENT = 1, ///< The fan speed is a percentage of the maximum speed of the fan - ZES_FAN_SPEED_UNITS_FORCE_UINT32 = 0x7fffffff + ZES_FAN_SPEED_UNITS_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FAN_SPEED_UNITS_* ENUMs } zes_fan_speed_units_t; @@ -3594,7 +3599,7 @@ typedef enum _zes_freq_domain_t ZES_FREQ_DOMAIN_GPU = 0, ///< GPU Core Domain. ZES_FREQ_DOMAIN_MEMORY = 1, ///< Local Memory Domain. ZES_FREQ_DOMAIN_MEDIA = 2, ///< GPU Media Domain. - ZES_FREQ_DOMAIN_FORCE_UINT32 = 0x7fffffff + ZES_FREQ_DOMAIN_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FREQ_DOMAIN_* ENUMs } zes_freq_domain_t; @@ -3668,7 +3673,7 @@ typedef enum _zes_freq_throttle_reason_flag_t ZES_FREQ_THROTTLE_REASON_FLAG_SW_RANGE = ZE_BIT(5), ///< frequency throttled due to software supplied frequency range ZES_FREQ_THROTTLE_REASON_FLAG_HW_RANGE = ZE_BIT(6), ///< frequency throttled due to a sub block that has a lower frequency ///< range when it receives clocks - ZES_FREQ_THROTTLE_REASON_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_FREQ_THROTTLE_REASON_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FREQ_THROTTLE_REASON_FLAG_* ENUMs } zes_freq_throttle_reason_flag_t; @@ -3740,7 +3745,7 @@ typedef enum _zes_oc_mode_t ///< specified overclock values. This mode disables OVERRIDE and ///< INTERPOLATIVE modes. This mode can damage the part, most of the ///< protections are disabled on this mode. - ZES_OC_MODE_FORCE_UINT32 = 0x7fffffff + ZES_OC_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_OC_MODE_* ENUMs } zes_oc_mode_t; @@ -4532,7 +4537,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_FORCE_UINT32 = 0x7fffffff + ZES_MEM_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_MEM_TYPE_* ENUMs } zes_mem_type_t; @@ -4542,7 +4547,7 @@ typedef enum _zes_mem_loc_t { ZES_MEM_LOC_SYSTEM = 0, ///< System memory ZES_MEM_LOC_DEVICE = 1, ///< On board local device memory - ZES_MEM_LOC_FORCE_UINT32 = 0x7fffffff + ZES_MEM_LOC_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_MEM_LOC_* ENUMs } zes_mem_loc_t; @@ -4557,7 +4562,7 @@ typedef enum _zes_mem_health_t ZES_MEM_HEALTH_CRITICAL = 3, ///< Operating with reduced memory to cover banks with too many ///< uncorrectable errors. ZES_MEM_HEALTH_REPLACE = 4, ///< Device should be replaced due to excessive uncorrectable errors. - ZES_MEM_HEALTH_FORCE_UINT32 = 0x7fffffff + ZES_MEM_HEALTH_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_MEM_HEALTH_* ENUMs } zes_mem_health_t; @@ -4895,7 +4900,7 @@ typedef enum _zes_power_domain_t ZES_POWER_DOMAIN_STACK = 3, ///< The PUnit power domain is a stack-level power domain. ZES_POWER_DOMAIN_MEMORY = 4, ///< The PUnit power domain is a memory-level power domain. ZES_POWER_DOMAIN_GPU = 5, ///< The PUnit power domain is a GPU-level power domain. - ZES_POWER_DOMAIN_FORCE_UINT32 = 0x7fffffff + ZES_POWER_DOMAIN_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_POWER_DOMAIN_* ENUMs } zes_power_domain_t; @@ -4915,7 +4920,7 @@ typedef enum _zes_power_level_t ZES_POWER_LEVEL_INSTANTANEOUS = 4, ///< The PUnit predicts effective power draw using the current device ///< configuration (frequency, voltage, etc...) & throttles proactively to ///< stay within the specified limit. - ZES_POWER_LEVEL_FORCE_UINT32 = 0x7fffffff + ZES_POWER_LEVEL_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_POWER_LEVEL_* ENUMs } zes_power_level_t; @@ -4927,7 +4932,7 @@ typedef enum _zes_power_source_t ///< battery powered. ZES_POWER_SOURCE_MAINS = 1, ///< Limit active only when the device is mains powered. ZES_POWER_SOURCE_BATTERY = 2, ///< Limit active only when the device is battery powered. - ZES_POWER_SOURCE_FORCE_UINT32 = 0x7fffffff + ZES_POWER_SOURCE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_POWER_SOURCE_* ENUMs } zes_power_source_t; @@ -4938,7 +4943,7 @@ typedef enum _zes_limit_unit_t ZES_LIMIT_UNIT_UNKNOWN = 0, ///< The PUnit power monitoring unit cannot be determined. ZES_LIMIT_UNIT_CURRENT = 1, ///< The limit is specified in milliamperes of current drawn. ZES_LIMIT_UNIT_POWER = 2, ///< The limit is specified in milliwatts of power generated. - ZES_LIMIT_UNIT_FORCE_UINT32 = 0x7fffffff + ZES_LIMIT_UNIT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_LIMIT_UNIT_* ENUMs } zes_limit_unit_t; @@ -5305,7 +5310,7 @@ typedef enum _zes_psu_voltage_status_t ZES_PSU_VOLTAGE_STATUS_NORMAL = 1, ///< No unusual voltages have been detected ZES_PSU_VOLTAGE_STATUS_OVER = 2, ///< Over-voltage has occurred ZES_PSU_VOLTAGE_STATUS_UNDER = 3, ///< Under-voltage has occurred - ZES_PSU_VOLTAGE_STATUS_FORCE_UINT32 = 0x7fffffff + ZES_PSU_VOLTAGE_STATUS_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_PSU_VOLTAGE_STATUS_* ENUMs } zes_psu_voltage_status_t; @@ -5434,7 +5439,7 @@ typedef enum _zes_ras_error_type_t { ZES_RAS_ERROR_TYPE_CORRECTABLE = 0, ///< Errors were corrected by hardware ZES_RAS_ERROR_TYPE_UNCORRECTABLE = 1, ///< Error were not corrected - ZES_RAS_ERROR_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_RAS_ERROR_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_RAS_ERROR_TYPE_* ENUMs } zes_ras_error_type_t; @@ -5453,7 +5458,7 @@ typedef enum _zes_ras_error_cat_t ZES_RAS_ERROR_CAT_CACHE_ERRORS = 5, ///< The number of errors that have occurred in caches (L1/L3/register ///< file/shared local memory/sampler) ZES_RAS_ERROR_CAT_DISPLAY_ERRORS = 6, ///< The number of errors that have occurred in the display - ZES_RAS_ERROR_CAT_FORCE_UINT32 = 0x7fffffff + ZES_RAS_ERROR_CAT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_RAS_ERROR_CAT_* ENUMs } zes_ras_error_cat_t; @@ -5708,7 +5713,7 @@ typedef enum _zes_sched_mode_t ///< contexts must wait until the running context completes with no further ///< submitted work. ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG = 3, ///< [DEPRECATED] No longer supported. - ZES_SCHED_MODE_FORCE_UINT32 = 0x7fffffff + ZES_SCHED_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_SCHED_MODE_* ENUMs } zes_sched_mode_t; @@ -6060,7 +6065,7 @@ zesSchedulerSetComputeUnitDebugMode( typedef enum _zes_standby_type_t { ZES_STANDBY_TYPE_GLOBAL = 0, ///< Control the overall standby policy of the device/sub-device - ZES_STANDBY_TYPE_FORCE_UINT32 = 0x7fffffff + ZES_STANDBY_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_STANDBY_TYPE_* ENUMs } zes_standby_type_t; @@ -6085,7 +6090,7 @@ typedef enum _zes_standby_promo_mode_t ZES_STANDBY_PROMO_MODE_DEFAULT = 0, ///< Best compromise between performance and energy savings. ZES_STANDBY_PROMO_MODE_NEVER = 1, ///< The device/component will never shutdown. This can improve performance ///< but uses more energy. - ZES_STANDBY_PROMO_MODE_FORCE_UINT32 = 0x7fffffff + ZES_STANDBY_PROMO_MODE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_STANDBY_PROMO_MODE_* ENUMs } zes_standby_promo_mode_t; @@ -6213,7 +6218,7 @@ typedef enum _zes_temp_sensors_t ZES_TEMP_SENSORS_GPU_BOARD = 6, ///< The maximum temperature across all sensors in the GPU Board ZES_TEMP_SENSORS_GPU_BOARD_MIN = 7, ///< The minimum temperature across all sensors in the GPU Board ZES_TEMP_SENSORS_VOLTAGE_REGULATOR = 8, ///< The maximum temperature across all sensors in the Voltage Regulator - ZES_TEMP_SENSORS_FORCE_UINT32 = 0x7fffffff + ZES_TEMP_SENSORS_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_TEMP_SENSORS_* ENUMs } zes_temp_sensors_t; @@ -6425,6 +6430,41 @@ zesTemperatureGetState( ///< in degrees Celsius. ); +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Sysman Extension APIs Device-ECC default properties +#if !defined(__GNUC__) +#pragma region eccState +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_NAME +/// @brief Device ECC default properties Extension Name +#define ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_NAME "ZES_extension_device_ecc_default_properties" +#endif // ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device ECC default properties Extension Version(s) +typedef enum _zes_device_ecc_default_properties_ext_version_t +{ + ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ),///< version 1.0 + ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version + ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_DEVICE_ECC_DEFAULT_PROPERTIES_EXT_VERSION_* ENUMs + +} zes_device_ecc_default_properties_ext_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief This structure may be passed to ::zesDeviceGetEccState as pNext member +/// of ::zes_device_ecc_properties_t. +typedef struct _zes_device_ecc_default_properties_ext_t +{ + zes_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). + zes_device_ecc_state_t defaultState; ///< [out] Default ECC state + +} zes_device_ecc_default_properties_ext_t; + #if !defined(__GNUC__) #pragma endregion #endif @@ -6444,7 +6484,7 @@ typedef enum _zes_power_limits_ext_version_t { ZES_POWER_LIMITS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_POWER_LIMITS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZES_POWER_LIMITS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_POWER_LIMITS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_POWER_LIMITS_EXT_VERSION_* ENUMs } zes_power_limits_ext_version_t; @@ -6584,7 +6624,7 @@ typedef enum _zes_engine_activity_ext_version_t { ZES_ENGINE_ACTIVITY_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_ENGINE_ACTIVITY_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZES_ENGINE_ACTIVITY_EXT_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_ENGINE_ACTIVITY_EXT_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_ENGINE_ACTIVITY_EXT_VERSION_* ENUMs } zes_engine_activity_ext_version_t; @@ -6668,7 +6708,7 @@ 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_FORCE_UINT32 = 0x7fffffff + ZES_RAS_STATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_RAS_STATE_EXP_VERSION_* ENUMs } zes_ras_state_exp_version_t; @@ -6690,7 +6730,7 @@ typedef enum _zes_ras_error_category_exp_t 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 - ZES_RAS_ERROR_CATEGORY_EXP_FORCE_UINT32 = 0x7fffffff + ZES_RAS_ERROR_CATEGORY_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_RAS_ERROR_CATEGORY_EXP_* ENUMs } zes_ras_error_category_exp_t; @@ -6786,7 +6826,7 @@ typedef enum _zes_mem_page_offline_state_exp_version_t { ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_* ENUMs } zes_mem_page_offline_state_exp_version_t; @@ -6826,7 +6866,7 @@ typedef enum _zes_mem_bandwidth_counter_bits_exp_version_t { ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_* ENUMs } zes_mem_bandwidth_counter_bits_exp_version_t; @@ -6868,7 +6908,7 @@ typedef enum _zes_power_domain_properties_exp_version_t { ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_* ENUMs } zes_power_domain_properties_exp_version_t; @@ -6908,7 +6948,7 @@ typedef enum _zes_firmware_security_exp_version_t { ZES_FIRMWARE_SECURITY_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_FIRMWARE_SECURITY_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZES_FIRMWARE_SECURITY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_FIRMWARE_SECURITY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_FIRMWARE_SECURITY_EXP_VERSION_* ENUMs } zes_firmware_security_exp_version_t; @@ -6979,7 +7019,7 @@ typedef enum _zes_sysman_device_mapping_exp_version_t { ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version - ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_* ENUMs } zes_sysman_device_mapping_exp_version_t; @@ -7077,7 +7117,7 @@ typedef enum _zes_vf_management_exp_version_t ZES_VF_MANAGEMENT_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 (deprecated) ZES_VF_MANAGEMENT_EXP_VERSION_1_2 = ZE_MAKE_VERSION( 1, 2 ), ///< version 1.2 ZES_VF_MANAGEMENT_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 2 ), ///< latest known version - ZES_VF_MANAGEMENT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZES_VF_MANAGEMENT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_VF_MANAGEMENT_EXP_VERSION_* ENUMs } zes_vf_management_exp_version_t; @@ -7088,7 +7128,7 @@ typedef enum _zes_vf_info_mem_type_exp_flag_t { ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_SYSTEM = ZE_BIT(0), ///< System memory ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_DEVICE = ZE_BIT(1), ///< Device local memory - ZES_VF_INFO_MEM_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_VF_INFO_MEM_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_VF_INFO_MEM_TYPE_EXP_FLAG_* ENUMs } zes_vf_info_mem_type_exp_flag_t; @@ -7101,7 +7141,7 @@ typedef enum _zes_vf_info_util_exp_flag_t ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_CPU = ZE_BIT(1), ///< System memory utilization associated with virtual function ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_GPU = ZE_BIT(2), ///< Device memory utilization associated with virtual function ZES_VF_INFO_UTIL_EXP_FLAG_INFO_ENGINE = ZE_BIT(3), ///< Engine utilization associated with virtual function - ZES_VF_INFO_UTIL_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZES_VF_INFO_UTIL_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZES_VF_INFO_UTIL_EXP_FLAG_* ENUMs } zes_vf_info_util_exp_flag_t; diff --git a/include/zes_ddi.h b/include/zes_ddi.h index 3e2965ad..24b53356 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZES_DDI_H diff --git a/include/zet.py b/include/zet.py index 90d891b0..a6201bc1 100644 --- a/include/zet.py +++ b/include/zet.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: MIT @file zet.py - @version v1.12-r1.12.15 + @version v1.13-r1.13.1 """ import platform @@ -676,6 +676,7 @@ class zet_metric_group_type_exp_flags_v(IntEnum): ## dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t. USER_CREATED = ZE_BIT(1) ## Metric group created using ::zetDeviceCreateMetricGroupsFromMetricsExp OTHER = ZE_BIT(2) ## Metric group which has a collection of metrics + MARKER = ZE_BIT(3) ## Metric group is capable of generating Marker metric class zet_metric_group_type_exp_flags_t(c_int): def __str__(self): @@ -707,6 +708,47 @@ class zet_export_dma_buf_exp_properties_t(Structure): ("size", c_size_t) ## [out] size in bytes of the dma_buf ] +############################################################################### +## @brief Marker Support Using MetricGroup Experimental Extension Name +ZET_METRIC_GROUP_MARKER_EXP_NAME = "ZET_experimental_metric_group_marker" + +############################################################################### +## @brief Marker Support Using MetricGroup Experimental Extension Version(s) +class zet_metric_group_marker_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_group_marker_exp_version_t(c_int): + def __str__(self): + return str(zet_metric_group_marker_exp_version_v(self.value)) + + +############################################################################### +## @brief Query the metric source unique identifier using `pNext` of +## ::zet_metric_group_properties_t +class zet_metric_source_id_exp_t(Structure): + _fields_ = [ + ("stype", zet_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). + ("sourceId", c_ulong) ## [out] unique number representing the Metric Source. + ] + +############################################################################### +## @brief Runtime Enabling and Disabling Metrics Extension Name +ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME = "ZET_experimental_metrics_runtime_enable_disable" + +############################################################################### +## @brief Runtime Enabling and Disabling Metrics Extension Version(s) +class zet_metrics_runtime_enable_disable_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_metrics_runtime_enable_disable_exp_version_t(c_int): + def __str__(self): + return str(zet_metrics_runtime_enable_disable_exp_version_v(self.value)) + + ############################################################################### ## @brief Calculating Multiple Metrics Experimental Extension Name ZET_MULTI_METRICS_EXP_NAME = "ZET_experimental_calculate_multiple_metrics" @@ -1118,13 +1160,29 @@ class _zet_device_dditable_t(Structure): else: _zetDeviceCreateMetricGroupsFromMetricsExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, c_ulong, *, *, *, *, POINTER(zet_metric_group_handle_t) ) +############################################################################### +## @brief Function-pointer for zetDeviceEnableMetricsExp +if __use_win_types: + _zetDeviceEnableMetricsExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t ) +else: + _zetDeviceEnableMetricsExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t ) + +############################################################################### +## @brief Function-pointer for zetDeviceDisableMetricsExp +if __use_win_types: + _zetDeviceDisableMetricsExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t ) +else: + _zetDeviceDisableMetricsExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t ) + ############################################################################### ## @brief Table of DeviceExp functions pointers class _zet_device_exp_dditable_t(Structure): _fields_ = [ ("pfnGetConcurrentMetricGroupsExp", c_void_p), ## _zetDeviceGetConcurrentMetricGroupsExp_t - ("pfnCreateMetricGroupsFromMetricsExp", c_void_p) ## _zetDeviceCreateMetricGroupsFromMetricsExp_t + ("pfnCreateMetricGroupsFromMetricsExp", c_void_p), ## _zetDeviceCreateMetricGroupsFromMetricsExp_t + ("pfnEnableMetricsExp", c_void_p), ## _zetDeviceEnableMetricsExp_t + ("pfnDisableMetricsExp", c_void_p) ## _zetDeviceDisableMetricsExp_t ] ############################################################################### @@ -1181,6 +1239,21 @@ class _zet_command_list_dditable_t(Structure): ("pfnAppendMetricMemoryBarrier", c_void_p) ## _zetCommandListAppendMetricMemoryBarrier_t ] +############################################################################### +## @brief Function-pointer for zetCommandListAppendMarkerExp +if __use_win_types: + _zetCommandListAppendMarkerExp_t = WINFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_group_handle_t, c_ulong ) +else: + _zetCommandListAppendMarkerExp_t = CFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_group_handle_t, c_ulong ) + + +############################################################################### +## @brief Table of CommandListExp functions pointers +class _zet_command_list_exp_dditable_t(Structure): + _fields_ = [ + ("pfnAppendMarkerExp", c_void_p) ## _zetCommandListAppendMarkerExp_t + ] + ############################################################################### ## @brief Function-pointer for zetModuleGetDebugInfo if __use_win_types: @@ -1628,6 +1701,7 @@ class _zet_dditable_t(Structure): ("DeviceExp", _zet_device_exp_dditable_t), ("Context", _zet_context_dditable_t), ("CommandList", _zet_command_list_dditable_t), + ("CommandListExp", _zet_command_list_exp_dditable_t), ("Module", _zet_module_dditable_t), ("Kernel", _zet_kernel_dditable_t), ("Metric", _zet_metric_dditable_t), @@ -1714,6 +1788,8 @@ def __init__(self, version : ze_api_version_t): # attach function interface to function address self.zetDeviceGetConcurrentMetricGroupsExp = _zetDeviceGetConcurrentMetricGroupsExp_t(self.__dditable.DeviceExp.pfnGetConcurrentMetricGroupsExp) self.zetDeviceCreateMetricGroupsFromMetricsExp = _zetDeviceCreateMetricGroupsFromMetricsExp_t(self.__dditable.DeviceExp.pfnCreateMetricGroupsFromMetricsExp) + self.zetDeviceEnableMetricsExp = _zetDeviceEnableMetricsExp_t(self.__dditable.DeviceExp.pfnEnableMetricsExp) + self.zetDeviceDisableMetricsExp = _zetDeviceDisableMetricsExp_t(self.__dditable.DeviceExp.pfnDisableMetricsExp) # call driver to get function pointers _Context = _zet_context_dditable_t() @@ -1738,6 +1814,16 @@ def __init__(self, version : ze_api_version_t): self.zetCommandListAppendMetricQueryEnd = _zetCommandListAppendMetricQueryEnd_t(self.__dditable.CommandList.pfnAppendMetricQueryEnd) self.zetCommandListAppendMetricMemoryBarrier = _zetCommandListAppendMetricMemoryBarrier_t(self.__dditable.CommandList.pfnAppendMetricMemoryBarrier) + # call driver to get function pointers + _CommandListExp = _zet_command_list_exp_dditable_t() + r = ze_result_v(self.__dll.zetGetCommandListExpProcAddrTable(version, byref(_CommandListExp))) + if r != ze_result_v.SUCCESS: + raise Exception(r) + self.__dditable.CommandListExp = _CommandListExp + + # attach function interface to function address + self.zetCommandListAppendMarkerExp = _zetCommandListAppendMarkerExp_t(self.__dditable.CommandListExp.pfnAppendMarkerExp) + # call driver to get function pointers _Module = _zet_module_dditable_t() r = ze_result_v(self.__dll.zetGetModuleProcAddrTable(version, byref(_Module))) diff --git a/include/zet_api.h b/include/zet_api.h index c8906ad7..13b8ea01 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZET_API_H @@ -102,7 +102,7 @@ typedef enum _zet_structure_type_t ZET_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP = 0x00010006, ///< ::zet_metric_group_type_exp_t ZET_STRUCTURE_TYPE_EXPORT_DMA_EXP_PROPERTIES = 0x00010007, ///< ::zet_export_dma_buf_exp_properties_t ZET_STRUCTURE_TYPE_METRIC_TRACER_EXP_DESC = 0x00010008, ///< ::zet_metric_tracer_exp_desc_t - ZET_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_STRUCTURE_TYPE_* ENUMs } zet_structure_type_t; @@ -138,7 +138,7 @@ typedef enum _zet_value_type_t ZET_VALUE_TYPE_STRING = 5, ///< C string ZET_VALUE_TYPE_UINT8 = 6, ///< 8-bit unsigned-integer ZET_VALUE_TYPE_UINT16 = 7, ///< 16-bit unsigned-integer - ZET_VALUE_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_VALUE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_VALUE_TYPE_* ENUMs } zet_value_type_t; @@ -269,6 +269,10 @@ typedef struct _zet_metric_group_type_exp_t zet_metric_group_type_exp_t; /// @brief Forward-declare zet_export_dma_buf_exp_properties_t typedef struct _zet_export_dma_buf_exp_properties_t zet_export_dma_buf_exp_properties_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare zet_metric_source_id_exp_t +typedef struct _zet_metric_source_id_exp_t zet_metric_source_id_exp_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_global_timestamps_resolution_exp_t typedef struct _zet_metric_global_timestamps_resolution_exp_t zet_metric_global_timestamps_resolution_exp_t; @@ -335,7 +339,7 @@ typedef struct _zet_metric_programmable_param_value_exp_t zet_metric_programmabl typedef enum _zet_module_debug_info_format_t { ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF = 0, ///< Format is ELF/DWARF - ZET_MODULE_DEBUG_INFO_FORMAT_FORCE_UINT32 = 0x7fffffff + ZET_MODULE_DEBUG_INFO_FORMAT_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_MODULE_DEBUG_INFO_FORMAT_* ENUMs } zet_module_debug_info_format_t; @@ -383,7 +387,7 @@ typedef uint32_t zet_device_debug_property_flags_t; typedef enum _zet_device_debug_property_flag_t { ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH = ZE_BIT(0), ///< the device supports attaching for debug - ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff + ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEVICE_DEBUG_PROPERTY_FLAG_* ENUMs } zet_device_debug_property_flag_t; @@ -480,7 +484,7 @@ typedef enum _zet_debug_event_flag_t { ZET_DEBUG_EVENT_FLAG_NEED_ACK = ZE_BIT(0), ///< The event needs to be acknowledged by calling ///< ::zetDebugAcknowledgeEvent. - ZET_DEBUG_EVENT_FLAG_FORCE_UINT32 = 0x7fffffff + ZET_DEBUG_EVENT_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEBUG_EVENT_FLAG_* ENUMs } zet_debug_event_flag_t; @@ -497,7 +501,7 @@ typedef enum _zet_debug_event_type_t ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED = 6, ///< The thread stopped due to a device exception ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE = 7, ///< The thread is not available to be stopped ZET_DEBUG_EVENT_TYPE_PAGE_FAULT = 8, ///< A page request could not be completed on the device - ZET_DEBUG_EVENT_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_DEBUG_EVENT_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEBUG_EVENT_TYPE_* ENUMs } zet_debug_event_type_t; @@ -507,7 +511,7 @@ typedef enum _zet_debug_detach_reason_t { ZET_DEBUG_DETACH_REASON_INVALID = 0, ///< The detach reason is not valid ZET_DEBUG_DETACH_REASON_HOST_EXIT = 1, ///< The host process exited - ZET_DEBUG_DETACH_REASON_FORCE_UINT32 = 0x7fffffff + ZET_DEBUG_DETACH_REASON_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEBUG_DETACH_REASON_* ENUMs } zet_debug_detach_reason_t; @@ -547,7 +551,7 @@ typedef enum _zet_debug_page_fault_reason_t ZET_DEBUG_PAGE_FAULT_REASON_INVALID = 0, ///< The page fault reason is not valid ZET_DEBUG_PAGE_FAULT_REASON_MAPPING_ERROR = 1, ///< The address is not mapped ZET_DEBUG_PAGE_FAULT_REASON_PERMISSION_ERROR = 2, ///< Invalid access permissions - ZET_DEBUG_PAGE_FAULT_REASON_FORCE_UINT32 = 0x7fffffff + ZET_DEBUG_PAGE_FAULT_REASON_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEBUG_PAGE_FAULT_REASON_* ENUMs } zet_debug_page_fault_reason_t; @@ -676,7 +680,7 @@ typedef enum _zet_debug_memory_space_type_t ZET_DEBUG_MEMORY_SPACE_TYPE_DEFAULT = 0, ///< default memory space (attribute may be omitted) ZET_DEBUG_MEMORY_SPACE_TYPE_SLM = 1, ///< shared local memory space (GPU-only) ZET_DEBUG_MEMORY_SPACE_TYPE_ELF = 2, ///< ELF file memory space - ZET_DEBUG_MEMORY_SPACE_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_DEBUG_MEMORY_SPACE_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEBUG_MEMORY_SPACE_TYPE_* ENUMs } zet_debug_memory_space_type_t; @@ -763,7 +767,7 @@ typedef enum _zet_debug_regset_flag_t { ZET_DEBUG_REGSET_FLAG_READABLE = ZE_BIT(0), ///< register set is readable ZET_DEBUG_REGSET_FLAG_WRITEABLE = ZE_BIT(1), ///< register set is writeable - ZET_DEBUG_REGSET_FLAG_FORCE_UINT32 = 0x7fffffff + ZET_DEBUG_REGSET_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_DEBUG_REGSET_FLAG_* ENUMs } zet_debug_regset_flag_t; @@ -868,8 +872,8 @@ zetDebugReadRegisters( ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ); @@ -895,8 +899,8 @@ zetDebugWriteRegisters( ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ); @@ -957,7 +961,7 @@ typedef enum _zet_metric_group_sampling_type_flag_t ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED = ZE_BIT(0), ///< Event based sampling ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED = ZE_BIT(1), ///< Time based sampling ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EXP_TRACER_BASED = ZE_BIT(2), ///< Experimental Tracer based sampling - ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_* ENUMs } zet_metric_group_sampling_type_flag_t; @@ -1022,7 +1026,7 @@ typedef enum _zet_metric_type_t ZET_METRIC_TYPE_IP_EXP = 0x7ffffffe, ///< Metric type: instruction pointer. Deprecated, use ///< ::ZET_METRIC_TYPE_IP. ZET_METRIC_TYPE_IP = 0x7ffffffe, ///< Metric type: instruction pointer - ZET_METRIC_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_TYPE_* ENUMs } zet_metric_type_t; @@ -1032,7 +1036,7 @@ typedef enum _zet_metric_group_calculation_type_t { ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES = 0, ///< Calculated metric values from raw data. ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES = 1, ///< Maximum metric values. - ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_GROUP_CALCULATION_TYPE_* ENUMs } zet_metric_group_calculation_type_t; @@ -1348,7 +1352,7 @@ typedef enum _zet_metric_query_pool_type_t { ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE = 0, ///< Performance metric query pool. ZET_METRIC_QUERY_POOL_TYPE_EXECUTION = 1, ///< Skips workload execution between begin/end calls. - ZET_METRIC_QUERY_POOL_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_QUERY_POOL_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_QUERY_POOL_TYPE_* ENUMs } zet_metric_query_pool_type_t; @@ -1626,7 +1630,7 @@ typedef enum _zet_profile_flag_t ZET_PROFILE_FLAG_REGISTER_REALLOCATION = ZE_BIT(0), ///< request the compiler attempt to minimize register usage as much as ///< possible to allow for instrumentation ZET_PROFILE_FLAG_FREE_REGISTER_INFO = ZE_BIT(1), ///< request the compiler generate free register info - ZET_PROFILE_FLAG_FORCE_UINT32 = 0x7fffffff + ZET_PROFILE_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_PROFILE_FLAG_* ENUMs } zet_profile_flag_t; @@ -1648,7 +1652,7 @@ typedef struct _zet_profile_properties_t typedef enum _zet_profile_token_type_t { ZET_PROFILE_TOKEN_TYPE_FREE_REGISTER = 0, ///< GRF info - ZET_PROFILE_TOKEN_TYPE_FORCE_UINT32 = 0x7fffffff + ZET_PROFILE_TOKEN_TYPE_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_PROFILE_TOKEN_TYPE_* ENUMs } zet_profile_token_type_t; @@ -1721,7 +1725,7 @@ typedef enum _zet_api_tracing_exp_version_t { ZET_API_TRACING_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_API_TRACING_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZET_API_TRACING_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZET_API_TRACING_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_API_TRACING_EXP_VERSION_* ENUMs } zet_api_tracing_exp_version_t; @@ -1890,7 +1894,7 @@ typedef enum _zet_concurrent_metric_groups_exp_version_t { ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_* ENUMs } zet_concurrent_metric_groups_exp_version_t; @@ -1942,7 +1946,7 @@ typedef enum _zet_metric_tracer_exp_version_t { ZET_METRIC_TRACER_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_METRIC_TRACER_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZET_METRIC_TRACER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_TRACER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_TRACER_EXP_VERSION_* ENUMs } zet_metric_tracer_exp_version_t; @@ -2293,7 +2297,8 @@ typedef enum _zet_metric_group_type_exp_flag_t ///< dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t. ZET_METRIC_GROUP_TYPE_EXP_FLAG_USER_CREATED = ZE_BIT(1), ///< Metric group created using ::zetDeviceCreateMetricGroupsFromMetricsExp ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER = ZE_BIT(2), ///< Metric group which has a collection of metrics - ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_GROUP_TYPE_EXP_FLAG_MARKER = ZE_BIT(3), ///< Metric group is capable of generating Marker metric + ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_GROUP_TYPE_EXP_FLAG_* ENUMs } zet_metric_group_type_exp_flag_t; @@ -2324,6 +2329,145 @@ typedef struct _zet_export_dma_buf_exp_properties_t } zet_export_dma_buf_exp_properties_t; +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Tool Experimental Extension to support Markers using MetricGroup +#if !defined(__GNUC__) +#pragma region metricGroupMarker +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZET_METRIC_GROUP_MARKER_EXP_NAME +/// @brief Marker Support Using MetricGroup Experimental Extension Name +#define ZET_METRIC_GROUP_MARKER_EXP_NAME "ZET_experimental_metric_group_marker" +#endif // ZET_METRIC_GROUP_MARKER_EXP_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Marker Support Using MetricGroup Experimental Extension Version(s) +typedef enum _zet_metric_group_marker_exp_version_t +{ + ZET_METRIC_GROUP_MARKER_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZET_METRIC_GROUP_MARKER_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZET_METRIC_GROUP_MARKER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_GROUP_MARKER_EXP_VERSION_* ENUMs + +} zet_metric_group_marker_exp_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query the metric source unique identifier using `pNext` of +/// ::zet_metric_group_properties_t +typedef struct _zet_metric_source_id_exp_t +{ + zet_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). + uint32_t sourceId; ///< [out] unique number representing the Metric Source. + +} zet_metric_source_id_exp_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a Marker based on the Metric source of the Metric Group, to a +/// Command List. +/// +/// @details +/// - This function appends a Marker based on the Metric source of the +/// Metric Group, to Command List. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hCommandList` +/// + `nullptr == hMetricGroup` +ZE_APIEXPORT ze_result_t ZE_APICALL +zetCommandListAppendMarkerExp( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ); + +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Level-Zero Tool Experimental Extension for Runtime Enabling and Disabling metrics +#if !defined(__GNUC__) +#pragma region metricRuntimeEnableDisable +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME +/// @brief Runtime Enabling and Disabling Metrics Extension Name +#define ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME "ZET_experimental_metrics_runtime_enable_disable" +#endif // ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Runtime Enabling and Disabling Metrics Extension Version(s) +typedef enum _zet_metrics_runtime_enable_disable_exp_version_t +{ + ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 + ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version + ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_* ENUMs + +} zet_metrics_runtime_enable_disable_exp_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enable Metrics collection during runtime. +/// +/// @details +/// - This API enables metric collection for a device/sub-device if not +/// already enabled. +/// - if ZET_ENABLE_METRICS=1 was already set, then calling this api would +/// be a NOP. +/// - This api should be called after calling zeInit(). +/// - If device is a root-device handle, then its sub-devices are also +/// enabled. +/// - ::zetDeviceDisableMetricsExp need not be called if if this api returns +/// error. +/// - This API can be used as runtime alternative to setting +/// ZET_ENABLE_METRICS=1. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +ZE_APIEXPORT ze_result_t ZE_APICALL +zetDeviceEnableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Disable Metrics collection during runtime, if it was already enabled. +/// +/// @details +/// - This API disables metrics collection for a device/sub-device, if it +/// was previously enabled. +/// - If device is a root-device handle, then its sub-devices are also +/// disabled. +/// - The application has to ensure that all metric operations are complete +/// and all metric resources are released before this API is called. +/// - If there are metric operations in progress or metric resources are not +/// released, then ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE is returned. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +ZE_APIEXPORT ze_result_t ZE_APICALL +zetDeviceDisableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ); + #if !defined(__GNUC__) #pragma endregion #endif @@ -2343,7 +2487,7 @@ typedef enum _ze_calculate_multiple_metrics_exp_version_t { ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ),///< version 1.0 ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version - ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_* ENUMs } ze_calculate_multiple_metrics_exp_version_t; @@ -2421,7 +2565,7 @@ typedef enum _ze_metric_global_timestamps_exp_version_t { ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_* ENUMs } ze_metric_global_timestamps_exp_version_t; @@ -2490,7 +2634,7 @@ typedef enum _zet_export_metric_data_exp_version_t { ZET_EXPORT_METRIC_DATA_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_EXPORT_METRIC_DATA_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version - ZET_EXPORT_METRIC_DATA_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZET_EXPORT_METRIC_DATA_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_EXPORT_METRIC_DATA_EXP_VERSION_* ENUMs } zet_export_metric_data_exp_version_t; @@ -2628,7 +2772,7 @@ typedef enum _zet_metric_programmable_exp_version_t { ZET_METRIC_PROGRAMMABLE_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 ZET_METRIC_PROGRAMMABLE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 1 ), ///< latest known version - ZET_METRIC_PROGRAMMABLE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_PROGRAMMABLE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_PROGRAMMABLE_EXP_VERSION_* ENUMs } zet_metric_programmable_exp_version_t; @@ -2723,7 +2867,7 @@ typedef enum _zet_metric_programmable_param_type_exp_t ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_RATE = 4, ///< Produces normalization average using raw_metric / timestamp. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_BYTES = 5, ///< Produces normalization average using raw_metric * n bytes. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_GENERIC = 6, ///< Generic Parameter type. Please refer the parameter's description. - ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_FORCE_UINT32 = 0x7fffffff + ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_* ENUMs } zet_metric_programmable_param_type_exp_t; @@ -2740,7 +2884,7 @@ typedef enum _zet_value_info_type_exp_t ZET_VALUE_INFO_TYPE_EXP_UINT16 = 6, ///< 16-bit unsigned-integer ZET_VALUE_INFO_TYPE_EXP_UINT64_RANGE = 7, ///< 64-bit unsigned-integer range (minimum and maximum) ZET_VALUE_INFO_TYPE_EXP_FLOAT64_RANGE = 8, ///< 64-bit floating point range (minimum and maximum) - ZET_VALUE_INFO_TYPE_EXP_FORCE_UINT32 = 0x7fffffff + ZET_VALUE_INFO_TYPE_EXP_FORCE_UINT32 = 0x7fffffff, ///< Value marking end of ZET_VALUE_INFO_TYPE_EXP_* ENUMs } zet_value_info_type_exp_t; @@ -3216,6 +3360,8 @@ zetMetricGroupCloseExp( /// - It is necessary to call ::zetMetricDestroyExp for each of the metric /// handles (created from ::zetMetricCreateFromProgrammableExp2) to /// destroy them. +/// - It is not necessary to remove the metrics in the metricGroup before +/// destroying it. /// /// @returns /// - ::ZE_RESULT_SUCCESS diff --git a/include/zet_ddi.h b/include/zet_ddi.h index 504106d4..bf7f56c0 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.12-r1.12.15 + * @version v1.13-r1.13.1 * */ #ifndef _ZET_DDI_H @@ -281,12 +281,26 @@ typedef ze_result_t (ZE_APICALL *zet_pfnDeviceCreateMetricGroupsFromMetricsExp_t zet_metric_group_handle_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zetDeviceEnableMetricsExp +typedef ze_result_t (ZE_APICALL *zet_pfnDeviceEnableMetricsExp_t)( + zet_device_handle_t + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zetDeviceDisableMetricsExp +typedef ze_result_t (ZE_APICALL *zet_pfnDeviceDisableMetricsExp_t)( + zet_device_handle_t + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of DeviceExp functions pointers typedef struct _zet_device_exp_dditable_t { zet_pfnDeviceGetConcurrentMetricGroupsExp_t pfnGetConcurrentMetricGroupsExp; zet_pfnDeviceCreateMetricGroupsFromMetricsExp_t pfnCreateMetricGroupsFromMetricsExp; + zet_pfnDeviceEnableMetricsExp_t pfnEnableMetricsExp; + zet_pfnDeviceDisableMetricsExp_t pfnDisableMetricsExp; } zet_device_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// @@ -412,6 +426,43 @@ typedef ze_result_t (ZE_APICALL *zet_pfnGetCommandListProcAddrTable_t)( zet_command_list_dditable_t* ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zetCommandListAppendMarkerExp +typedef ze_result_t (ZE_APICALL *zet_pfnCommandListAppendMarkerExp_t)( + zet_command_list_handle_t, + zet_metric_group_handle_t, + uint32_t + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of CommandListExp functions pointers +typedef struct _zet_command_list_exp_dditable_t +{ + zet_pfnCommandListAppendMarkerExp_t pfnAppendMarkerExp; +} zet_command_list_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's CommandListExp table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetCommandListExpProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zet_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for zetGetCommandListExpProcAddrTable +typedef ze_result_t (ZE_APICALL *zet_pfnGetCommandListExpProcAddrTable_t)( + ze_api_version_t, + zet_command_list_exp_dditable_t* + ); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetModuleGetDebugInfo typedef ze_result_t (ZE_APICALL *zet_pfnModuleGetDebugInfo_t)( @@ -1154,6 +1205,7 @@ typedef struct _zet_dditable_t zet_device_exp_dditable_t DeviceExp; zet_context_dditable_t Context; zet_command_list_dditable_t CommandList; + zet_command_list_exp_dditable_t CommandListExp; zet_module_dditable_t Module; zet_kernel_dditable_t Kernel; zet_metric_dditable_t Metric; @@ -1178,6 +1230,7 @@ typedef struct _zet_dditable_driver_t zet_device_exp_dditable_t * DeviceExp; zet_context_dditable_t * Context; zet_command_list_dditable_t * CommandList; + zet_command_list_exp_dditable_t * CommandListExp; zet_module_dditable_t * Module; zet_kernel_dditable_t * Kernel; zet_metric_dditable_t * Metric; diff --git a/source/drivers/null/ze_nullddi.cpp b/source/drivers/null/ze_nullddi.cpp index b3740a94..e23aa7d1 100644 --- a/source/drivers/null/ze_nullddi.cpp +++ b/source/drivers/null/ze_nullddi.cpp @@ -3322,10 +3322,14 @@ namespace driver char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { ze_result_t result = ZE_RESULT_SUCCESS; @@ -4108,6 +4112,304 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ) + { + 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 pfnCreateExt = context.zeDdiTable.RTASBuilder.pfnCreateExt; + if( nullptr != pfnCreateExt ) + { + result = pfnCreateExt( hDriver, pDescriptor, phBuilder ); + } + else + { + // generic implementation + *phBuilder = reinterpret_cast( context.get() ); + + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderGetBuildPropertiesExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ) + { + 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 pfnGetBuildPropertiesExt = context.zeDdiTable.RTASBuilder.pfnGetBuildPropertiesExt; + if( nullptr != pfnGetBuildPropertiesExt ) + { + result = pfnGetBuildPropertiesExt( hBuilder, pBuildOpDescriptor, pProperties ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExt + __zedlllocal ze_result_t ZE_APICALL + zeDriverRTASFormatCompatibilityCheckExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ) + { + 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 pfnRTASFormatCompatibilityCheckExt = context.zeDdiTable.Driver.pfnRTASFormatCompatibilityCheckExt; + if( nullptr != pfnRTASFormatCompatibilityCheckExt ) + { + result = pfnRTASFormatCompatibilityCheckExt( hDriver, rtasFormatA, rtasFormatB ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderBuildExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderBuildExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ) + { + 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 pfnBuildExt = context.zeDdiTable.RTASBuilder.pfnBuildExt; + if( nullptr != pfnBuildExt ) + { + result = pfnBuildExt( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCommandListAppendCopyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCommandListAppendCopyExt( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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 pfnCommandListAppendCopyExt = context.zeDdiTable.RTASBuilder.pfnCommandListAppendCopyExt; + if( nullptr != pfnCommandListAppendCopyExt ) + { + result = pfnCommandListAppendCopyExt( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderDestroyExt( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) + { + 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 pfnDestroyExt = context.zeDdiTable.RTASBuilder.pfnDestroyExt; + if( nullptr != pfnDestroyExt ) + { + result = pfnDestroyExt( hBuilder ); + } + else + { + // generic implementation + + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) + { + 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 pfnCreateExt = context.zeDdiTable.RTASParallelOperation.pfnCreateExt; + if( nullptr != pfnCreateExt ) + { + result = pfnCreateExt( hDriver, phParallelOperation ); + } + else + { + // generic implementation + *phParallelOperation = reinterpret_cast( context.get() ); + + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationGetPropertiesExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) + { + 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 pfnGetPropertiesExt = context.zeDdiTable.RTASParallelOperation.pfnGetPropertiesExt; + if( nullptr != pfnGetPropertiesExt ) + { + result = pfnGetPropertiesExt( hParallelOperation, pProperties ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationJoinExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationJoinExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) + { + 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 pfnJoinExt = context.zeDdiTable.RTASParallelOperation.pfnJoinExt; + if( nullptr != pfnJoinExt ) + { + result = pfnJoinExt( hParallelOperation ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationDestroyExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) + { + 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 pfnDestroyExt = context.zeDdiTable.RTASParallelOperation.pfnDestroyExt; + if( nullptr != pfnDestroyExt ) + { + result = pfnDestroyExt( hParallelOperation ); + } + else + { + // generic implementation + + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetVectorWidthPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetVectorWidthPropertiesExt( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) + { + 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 pfnGetVectorWidthPropertiesExt = context.zeDdiTable.Device.pfnGetVectorWidthPropertiesExt; + if( nullptr != pfnGetVectorWidthPropertiesExt ) + { + result = pfnGetVectorWidthPropertiesExt( hDevice, pCount, pVectorWidthProperties ); + } + else + { + // generic implementation + } + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL @@ -5294,6 +5596,41 @@ zeGetGlobalProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASBuilder table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASBuilderProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_builder_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( driver::context.version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnCreateExt = driver::zeRTASBuilderCreateExt; + + pDdiTable->pfnGetBuildPropertiesExt = driver::zeRTASBuilderGetBuildPropertiesExt; + + pDdiTable->pfnBuildExt = driver::zeRTASBuilderBuildExt; + + pDdiTable->pfnCommandListAppendCopyExt = driver::zeRTASBuilderCommandListAppendCopyExt; + + pDdiTable->pfnDestroyExt = driver::zeRTASBuilderDestroyExt; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses @@ -5327,6 +5664,39 @@ zeGetRTASBuilderExpProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASParallelOperation table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASParallelOperationProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_parallel_operation_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers + ) +{ + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( driver::context.version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnCreateExt = driver::zeRTASParallelOperationCreateExt; + + pDdiTable->pfnGetPropertiesExt = driver::zeRTASParallelOperationGetPropertiesExt; + + pDdiTable->pfnJoinExt = driver::zeRTASParallelOperationJoinExt; + + pDdiTable->pfnDestroyExt = driver::zeRTASParallelOperationDestroyExt; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses @@ -5394,6 +5764,8 @@ zeGetDriverProcAddrTable( pDdiTable->pfnGetExtensionFunctionAddress = driver::zeDriverGetExtensionFunctionAddress; + pDdiTable->pfnRTASFormatCompatibilityCheckExt = driver::zeDriverRTASFormatCompatibilityCheckExt; + pDdiTable->pfnGetLastErrorDescription = driver::zeDriverGetLastErrorDescription; return result; @@ -5482,6 +5854,8 @@ zeGetDeviceProcAddrTable( pDdiTable->pfnReleaseExternalSemaphoreExt = driver::zeDeviceReleaseExternalSemaphoreExt; + pDdiTable->pfnGetVectorWidthPropertiesExt = driver::zeDeviceGetVectorWidthPropertiesExt; + pDdiTable->pfnReserveCacheExt = driver::zeDeviceReserveCacheExt; pDdiTable->pfnSetCacheAdviceExt = driver::zeDeviceSetCacheAdviceExt; diff --git a/source/drivers/null/zet_nullddi.cpp b/source/drivers/null/zet_nullddi.cpp index fd01dbf9..2b79a154 100644 --- a/source/drivers/null/zet_nullddi.cpp +++ b/source/drivers/null/zet_nullddi.cpp @@ -348,8 +348,8 @@ namespace driver ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -380,8 +380,8 @@ namespace driver ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -1401,6 +1401,79 @@ namespace driver return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetCommandListAppendMarkerExp + __zedlllocal ze_result_t ZE_APICALL + zetCommandListAppendMarkerExp( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ) + { + 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 pfnAppendMarkerExp = context.zetDdiTable.CommandListExp.pfnAppendMarkerExp; + if( nullptr != pfnAppendMarkerExp ) + { + result = pfnAppendMarkerExp( hCommandList, hMetricGroup, value ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetDeviceEnableMetricsExp + __zedlllocal ze_result_t ZE_APICALL + zetDeviceEnableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ) + { + 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 pfnEnableMetricsExp = context.zetDdiTable.DeviceExp.pfnEnableMetricsExp; + if( nullptr != pfnEnableMetricsExp ) + { + result = pfnEnableMetricsExp( hDevice ); + } + else + { + // generic implementation + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetDeviceDisableMetricsExp + __zedlllocal ze_result_t ZE_APICALL + zetDeviceDisableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ) + { + 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 pfnDisableMetricsExp = context.zetDdiTable.DeviceExp.pfnDisableMetricsExp; + if( nullptr != pfnDisableMetricsExp ) + { + result = pfnDisableMetricsExp( hDevice ); + } + else + { + // generic implementation + } + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMultipleMetricValuesExp __zedlllocal ze_result_t ZE_APICALL @@ -2116,6 +2189,10 @@ zetGetDeviceExpProcAddrTable( pDdiTable->pfnCreateMetricGroupsFromMetricsExp = driver::zetDeviceCreateMetricGroupsFromMetricsExp; + pDdiTable->pfnEnableMetricsExp = driver::zetDeviceEnableMetricsExp; + + pDdiTable->pfnDisableMetricsExp = driver::zetDeviceDisableMetricsExp; + return result; } @@ -2179,6 +2256,33 @@ zetGetCommandListProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's CommandListExp table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetCommandListExpProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zet_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( driver::context.version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + pDdiTable->pfnAppendMarkerExp = driver::zetCommandListAppendMarkerExp; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses diff --git a/source/layers/tracing/ze_tracing_cb_structs.h b/source/layers/tracing/ze_tracing_cb_structs.h index 5e6f6e74..c1c53b2d 100644 --- a/source/layers/tracing/ze_tracing_cb_structs.h +++ b/source/layers/tracing/ze_tracing_cb_structs.h @@ -30,6 +30,11 @@ typedef struct _zel_global_callbacks_t /// @brief Table of RTASBuilder callback functions pointers typedef struct _zel_rtas_builder_callbacks_t { + ze_pfnRTASBuilderCreateExtCb_t pfnCreateExtCb; + ze_pfnRTASBuilderGetBuildPropertiesExtCb_t pfnGetBuildPropertiesExtCb; + ze_pfnRTASBuilderBuildExtCb_t pfnBuildExtCb; + ze_pfnRTASBuilderCommandListAppendCopyExtCb_t pfnCommandListAppendCopyExtCb; + ze_pfnRTASBuilderDestroyExtCb_t pfnDestroyExtCb; ze_pfnRTASBuilderCreateExpCb_t pfnCreateExpCb; ze_pfnRTASBuilderGetBuildPropertiesExpCb_t pfnGetBuildPropertiesExpCb; ze_pfnRTASBuilderBuildExpCb_t pfnBuildExpCb; @@ -40,6 +45,10 @@ typedef struct _zel_rtas_builder_callbacks_t /// @brief Table of RTASParallelOperation callback functions pointers typedef struct _zel_rtas_parallel_operation_callbacks_t { + ze_pfnRTASParallelOperationCreateExtCb_t pfnCreateExtCb; + ze_pfnRTASParallelOperationGetPropertiesExtCb_t pfnGetPropertiesExtCb; + ze_pfnRTASParallelOperationJoinExtCb_t pfnJoinExtCb; + ze_pfnRTASParallelOperationDestroyExtCb_t pfnDestroyExtCb; ze_pfnRTASParallelOperationCreateExpCb_t pfnCreateExpCb; ze_pfnRTASParallelOperationGetPropertiesExpCb_t pfnGetPropertiesExpCb; ze_pfnRTASParallelOperationJoinExpCb_t pfnJoinExpCb; @@ -56,6 +65,7 @@ typedef struct _zel_driver_callbacks_t ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb; ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb; ze_pfnDriverGetExtensionFunctionAddressCb_t pfnGetExtensionFunctionAddressCb; + ze_pfnDriverRTASFormatCompatibilityCheckExtCb_t pfnRTASFormatCompatibilityCheckExtCb; ze_pfnDriverGetLastErrorDescriptionCb_t pfnGetLastErrorDescriptionCb; ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t pfnRTASFormatCompatibilityCheckExpCb; } zel_driver_callbacks_t; @@ -81,6 +91,7 @@ typedef struct _zel_device_callbacks_t ze_pfnDeviceGetGlobalTimestampsCb_t pfnGetGlobalTimestampsCb; ze_pfnDeviceImportExternalSemaphoreExtCb_t pfnImportExternalSemaphoreExtCb; ze_pfnDeviceReleaseExternalSemaphoreExtCb_t pfnReleaseExternalSemaphoreExtCb; + ze_pfnDeviceGetVectorWidthPropertiesExtCb_t pfnGetVectorWidthPropertiesExtCb; ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb; ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb; ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb; diff --git a/source/layers/tracing/ze_tracing_register_cb.cpp b/source/layers/tracing/ze_tracing_register_cb.cpp index bf2379a0..79d8a7e6 100644 --- a/source/layers/tracing/ze_tracing_register_cb.cpp +++ b/source/layers/tracing/ze_tracing_register_cb.cpp @@ -2435,6 +2435,182 @@ zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback( } +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderCreateExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderCreateExtCb_t pfnCreateExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASBuilder.pfnCreateExtCb = pfnCreateExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderGetBuildPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderGetBuildPropertiesExtCb_t pfnGetBuildPropertiesExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASBuilder.pfnGetBuildPropertiesExtCb = pfnGetBuildPropertiesExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerDriverRTASFormatCompatibilityCheckExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDriverRTASFormatCompatibilityCheckExtCb_t pfnRTASFormatCompatibilityCheckExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.Driver.pfnRTASFormatCompatibilityCheckExtCb = pfnRTASFormatCompatibilityCheckExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderBuildExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderBuildExtCb_t pfnBuildExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASBuilder.pfnBuildExtCb = pfnBuildExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderCommandListAppendCopyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderCommandListAppendCopyExtCb_t pfnCommandListAppendCopyExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASBuilder.pfnCommandListAppendCopyExtCb = pfnCommandListAppendCopyExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderDestroyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderDestroyExtCb_t pfnDestroyExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASBuilder.pfnDestroyExtCb = pfnDestroyExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationCreateExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationCreateExtCb_t pfnCreateExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASParallelOperation.pfnCreateExtCb = pfnCreateExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationGetPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationGetPropertiesExtCb_t pfnGetPropertiesExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASParallelOperation.pfnGetPropertiesExtCb = pfnGetPropertiesExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationJoinExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationJoinExtCb_t pfnJoinExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASParallelOperation.pfnJoinExtCb = pfnJoinExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationDestroyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationDestroyExtCb_t pfnDestroyExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.RTASParallelOperation.pfnDestroyExtCb = pfnDestroyExtCb; + + return result; +} + + +ZE_DLLEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetVectorWidthPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetVectorWidthPropertiesExtCb_t pfnGetVectorWidthPropertiesExtCb + ) { + + ze_result_t result; + auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); + if (result == ZE_RESULT_SUCCESS) + cbs.Device.pfnGetVectorWidthPropertiesExtCb = pfnGetVectorWidthPropertiesExtCb; + + return result; +} + + ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceReserveCacheExtRegisterCallback( zel_tracer_handle_t hTracer, diff --git a/source/layers/tracing/ze_trcddi.cpp b/source/layers/tracing/ze_trcddi.cpp index 9df2671d..f52237e3 100644 --- a/source/layers/tracing/ze_trcddi.cpp +++ b/source/layers/tracing/ze_trcddi.cpp @@ -4830,10 +4830,14 @@ namespace tracing_layer char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { auto pfnGetSourceAttributes = context.zeDdiTable.Kernel.pfnGetSourceAttributes; @@ -6041,6 +6045,447 @@ namespace tracing_layer *tracerParams.pphWaitEvents); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ) + { + auto pfnCreateExt = context.zeDdiTable.RTASBuilder.pfnCreateExt; + + if( nullptr == pfnCreateExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilder.pfnCreateExt, hDriver, pDescriptor, phBuilder); + + // capture parameters + ze_rtas_builder_create_ext_params_t tracerParams = { + &hDriver, + &pDescriptor, + &phBuilder + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderCreateExtCb_t, RTASBuilder, pfnCreateExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilder.pfnCreateExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDriver, + *tracerParams.ppDescriptor, + *tracerParams.pphBuilder); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderGetBuildPropertiesExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ) + { + auto pfnGetBuildPropertiesExt = context.zeDdiTable.RTASBuilder.pfnGetBuildPropertiesExt; + + if( nullptr == pfnGetBuildPropertiesExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilder.pfnGetBuildPropertiesExt, hBuilder, pBuildOpDescriptor, pProperties); + + // capture parameters + ze_rtas_builder_get_build_properties_ext_params_t tracerParams = { + &hBuilder, + &pBuildOpDescriptor, + &pProperties + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderGetBuildPropertiesExtCb_t, RTASBuilder, pfnGetBuildPropertiesExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilder.pfnGetBuildPropertiesExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phBuilder, + *tracerParams.ppBuildOpDescriptor, + *tracerParams.ppProperties); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExt + __zedlllocal ze_result_t ZE_APICALL + zeDriverRTASFormatCompatibilityCheckExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ) + { + auto pfnRTASFormatCompatibilityCheckExt = context.zeDdiTable.Driver.pfnRTASFormatCompatibilityCheckExt; + + if( nullptr == pfnRTASFormatCompatibilityCheckExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnRTASFormatCompatibilityCheckExt, hDriver, rtasFormatA, rtasFormatB); + + // capture parameters + ze_driver_rtas_format_compatibility_check_ext_params_t tracerParams = { + &hDriver, + &rtasFormatA, + &rtasFormatB + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverRTASFormatCompatibilityCheckExtCb_t, Driver, pfnRTASFormatCompatibilityCheckExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnRTASFormatCompatibilityCheckExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDriver, + *tracerParams.prtasFormatA, + *tracerParams.prtasFormatB); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderBuildExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderBuildExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ) + { + auto pfnBuildExt = context.zeDdiTable.RTASBuilder.pfnBuildExt; + + if( nullptr == pfnBuildExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilder.pfnBuildExt, hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes); + + // capture parameters + ze_rtas_builder_build_ext_params_t tracerParams = { + &hBuilder, + &pBuildOpDescriptor, + &pScratchBuffer, + &scratchBufferSizeBytes, + &pRtasBuffer, + &rtasBufferSizeBytes, + &hParallelOperation, + &pBuildUserPtr, + &pBounds, + &pRtasBufferSizeBytes + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderBuildExtCb_t, RTASBuilder, pfnBuildExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilder.pfnBuildExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phBuilder, + *tracerParams.ppBuildOpDescriptor, + *tracerParams.ppScratchBuffer, + *tracerParams.pscratchBufferSizeBytes, + *tracerParams.ppRtasBuffer, + *tracerParams.prtasBufferSizeBytes, + *tracerParams.phParallelOperation, + *tracerParams.ppBuildUserPtr, + *tracerParams.ppBounds, + *tracerParams.ppRtasBufferSizeBytes); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCommandListAppendCopyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCommandListAppendCopyExt( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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 pfnCommandListAppendCopyExt = context.zeDdiTable.RTASBuilder.pfnCommandListAppendCopyExt; + + if( nullptr == pfnCommandListAppendCopyExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilder.pfnCommandListAppendCopyExt, hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents); + + // capture parameters + ze_rtas_builder_command_list_append_copy_ext_params_t tracerParams = { + &hCommandList, + &dstptr, + &srcptr, + &size, + &hSignalEvent, + &numWaitEvents, + &phWaitEvents + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderCommandListAppendCopyExtCb_t, RTASBuilder, pfnCommandListAppendCopyExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilder.pfnCommandListAppendCopyExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phCommandList, + *tracerParams.pdstptr, + *tracerParams.psrcptr, + *tracerParams.psize, + *tracerParams.phSignalEvent, + *tracerParams.pnumWaitEvents, + *tracerParams.pphWaitEvents); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderDestroyExt( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) + { + auto pfnDestroyExt = context.zeDdiTable.RTASBuilder.pfnDestroyExt; + + if( nullptr == pfnDestroyExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilder.pfnDestroyExt, hBuilder); + + // capture parameters + ze_rtas_builder_destroy_ext_params_t tracerParams = { + &hBuilder + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderDestroyExtCb_t, RTASBuilder, pfnDestroyExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilder.pfnDestroyExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phBuilder); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) + { + auto pfnCreateExt = context.zeDdiTable.RTASParallelOperation.pfnCreateExt; + + if( nullptr == pfnCreateExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperation.pfnCreateExt, hDriver, phParallelOperation); + + // capture parameters + ze_rtas_parallel_operation_create_ext_params_t tracerParams = { + &hDriver, + &phParallelOperation + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationCreateExtCb_t, RTASParallelOperation, pfnCreateExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperation.pfnCreateExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDriver, + *tracerParams.pphParallelOperation); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationGetPropertiesExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) + { + auto pfnGetPropertiesExt = context.zeDdiTable.RTASParallelOperation.pfnGetPropertiesExt; + + if( nullptr == pfnGetPropertiesExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperation.pfnGetPropertiesExt, hParallelOperation, pProperties); + + // capture parameters + ze_rtas_parallel_operation_get_properties_ext_params_t tracerParams = { + &hParallelOperation, + &pProperties + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationGetPropertiesExtCb_t, RTASParallelOperation, pfnGetPropertiesExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperation.pfnGetPropertiesExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phParallelOperation, + *tracerParams.ppProperties); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationJoinExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationJoinExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) + { + auto pfnJoinExt = context.zeDdiTable.RTASParallelOperation.pfnJoinExt; + + if( nullptr == pfnJoinExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperation.pfnJoinExt, hParallelOperation); + + // capture parameters + ze_rtas_parallel_operation_join_ext_params_t tracerParams = { + &hParallelOperation + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationJoinExtCb_t, RTASParallelOperation, pfnJoinExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperation.pfnJoinExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phParallelOperation); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationDestroyExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) + { + auto pfnDestroyExt = context.zeDdiTable.RTASParallelOperation.pfnDestroyExt; + + if( nullptr == pfnDestroyExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperation.pfnDestroyExt, hParallelOperation); + + // capture parameters + ze_rtas_parallel_operation_destroy_ext_params_t tracerParams = { + &hParallelOperation + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationDestroyExtCb_t, RTASParallelOperation, pfnDestroyExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperation.pfnDestroyExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phParallelOperation); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetVectorWidthPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetVectorWidthPropertiesExt( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) + { + auto pfnGetVectorWidthPropertiesExt = context.zeDdiTable.Device.pfnGetVectorWidthPropertiesExt; + + if( nullptr == pfnGetVectorWidthPropertiesExt) + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + + ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetVectorWidthPropertiesExt, hDevice, pCount, pVectorWidthProperties); + + // capture parameters + ze_device_get_vector_width_properties_ext_params_t tracerParams = { + &hDevice, + &pCount, + &pVectorWidthProperties + }; + + tracing_layer::APITracerCallbackDataImp apiCallbackData; + + ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetVectorWidthPropertiesExtCb_t, Device, pfnGetVectorWidthPropertiesExtCb); + + + return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetVectorWidthPropertiesExt, + &tracerParams, + apiCallbackData.apiOrdinal, + apiCallbackData.prologCallbacks, + apiCallbackData.epilogCallbacks, + *tracerParams.phDevice, + *tracerParams.ppCount, + *tracerParams.ppVectorWidthProperties); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL @@ -7766,6 +8211,49 @@ zeGetGlobalProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASBuilder table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASBuilderProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_builder_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + auto& dditable = tracing_layer::context.zeDdiTable.RTASBuilder; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || + ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + dditable.pfnCreateExt = pDdiTable->pfnCreateExt; + pDdiTable->pfnCreateExt = tracing_layer::zeRTASBuilderCreateExt; + + dditable.pfnGetBuildPropertiesExt = pDdiTable->pfnGetBuildPropertiesExt; + pDdiTable->pfnGetBuildPropertiesExt = tracing_layer::zeRTASBuilderGetBuildPropertiesExt; + + dditable.pfnBuildExt = pDdiTable->pfnBuildExt; + pDdiTable->pfnBuildExt = tracing_layer::zeRTASBuilderBuildExt; + + dditable.pfnCommandListAppendCopyExt = pDdiTable->pfnCommandListAppendCopyExt; + pDdiTable->pfnCommandListAppendCopyExt = tracing_layer::zeRTASBuilderCommandListAppendCopyExt; + + dditable.pfnDestroyExt = pDdiTable->pfnDestroyExt; + pDdiTable->pfnDestroyExt = tracing_layer::zeRTASBuilderDestroyExt; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses @@ -7806,6 +8294,46 @@ zeGetRTASBuilderExpProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASParallelOperation table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASParallelOperationProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_parallel_operation_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers + ) +{ + auto& dditable = tracing_layer::context.zeDdiTable.RTASParallelOperation; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || + ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + dditable.pfnCreateExt = pDdiTable->pfnCreateExt; + pDdiTable->pfnCreateExt = tracing_layer::zeRTASParallelOperationCreateExt; + + dditable.pfnGetPropertiesExt = pDdiTable->pfnGetPropertiesExt; + pDdiTable->pfnGetPropertiesExt = tracing_layer::zeRTASParallelOperationGetPropertiesExt; + + dditable.pfnJoinExt = pDdiTable->pfnJoinExt; + pDdiTable->pfnJoinExt = tracing_layer::zeRTASParallelOperationJoinExt; + + dditable.pfnDestroyExt = pDdiTable->pfnDestroyExt; + pDdiTable->pfnDestroyExt = tracing_layer::zeRTASParallelOperationDestroyExt; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses @@ -7889,6 +8417,9 @@ zeGetDriverProcAddrTable( dditable.pfnGetExtensionFunctionAddress = pDdiTable->pfnGetExtensionFunctionAddress; pDdiTable->pfnGetExtensionFunctionAddress = tracing_layer::zeDriverGetExtensionFunctionAddress; + dditable.pfnRTASFormatCompatibilityCheckExt = pDdiTable->pfnRTASFormatCompatibilityCheckExt; + pDdiTable->pfnRTASFormatCompatibilityCheckExt = tracing_layer::zeDriverRTASFormatCompatibilityCheckExt; + dditable.pfnGetLastErrorDescription = pDdiTable->pfnGetLastErrorDescription; pDdiTable->pfnGetLastErrorDescription = tracing_layer::zeDriverGetLastErrorDescription; @@ -8002,6 +8533,9 @@ zeGetDeviceProcAddrTable( dditable.pfnReleaseExternalSemaphoreExt = pDdiTable->pfnReleaseExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = tracing_layer::zeDeviceReleaseExternalSemaphoreExt; + dditable.pfnGetVectorWidthPropertiesExt = pDdiTable->pfnGetVectorWidthPropertiesExt; + pDdiTable->pfnGetVectorWidthPropertiesExt = tracing_layer::zeDeviceGetVectorWidthPropertiesExt; + dditable.pfnReserveCacheExt = pDdiTable->pfnReserveCacheExt; pDdiTable->pfnReserveCacheExt = tracing_layer::zeDeviceReserveCacheExt; diff --git a/source/layers/validation/checkers/parameter_validation/extension_validation.inl b/source/layers/validation/checkers/parameter_validation/extension_validation.inl index c7de1238..951617a8 100644 --- a/source/layers/validation/checkers/parameter_validation/extension_validation.inl +++ b/source/layers/validation/checkers/parameter_validation/extension_validation.inl @@ -146,7 +146,7 @@ inline ze_result_t ParameterValidation::validateExtensions(const ze_device_cache } std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES}; - std::vector types = {ZE_STRUCTURE_TYPE_CACHE_RESERVATION_EXT_DESC}; + std::vector types = {ZE_STRUCTURE_TYPE_CACHE_RESERVATION_EXT_DESC,ZE_STRUCTURE_TYPE_DEVICE_CACHELINE_SIZE_EXT}; return validateStructureTypes(descriptor, baseTypes, types); } 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 d51c6b3f..44687fd9 100644 --- a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp @@ -2497,10 +2497,14 @@ namespace validation_layer char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { if( nullptr == hKernel ) @@ -3171,6 +3175,248 @@ namespace validation_layer } + ze_result_t + ZEParameterValidation::zeRTASBuilderCreateExtPrologue( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ) + { + if( nullptr == hDriver ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pDescriptor ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == phBuilder ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( ZE_RTAS_BUILDER_EXT_VERSION_CURRENT < pDescriptor->builderVersion ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + return ParameterValidation::validateExtensions(pDescriptor); + } + + + ze_result_t + ZEParameterValidation::zeRTASBuilderGetBuildPropertiesExtPrologue( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ) + { + if( nullptr == hBuilder ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pBuildOpDescriptor ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pProperties ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( ZE_RTAS_FORMAT_EXT_MAX < pBuildOpDescriptor->rtasFormat ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + if( ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH < pBuildOpDescriptor->buildQuality ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + if( 0x3 < pBuildOpDescriptor->buildFlags ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + auto retVal = ZE_RESULT_SUCCESS; + retVal = ParameterValidation::validateExtensions(pBuildOpDescriptor); + if(retVal) + return retVal; + retVal = ParameterValidation::validateExtensions(pProperties); + return retVal; + } + + + ze_result_t + ZEParameterValidation::zeDriverRTASFormatCompatibilityCheckExtPrologue( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ) + { + if( nullptr == hDriver ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( ZE_RTAS_FORMAT_EXT_MAX < rtasFormatA ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + if( ZE_RTAS_FORMAT_EXT_MAX < rtasFormatB ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeRTASBuilderBuildExtPrologue( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ) + { + if( nullptr == hBuilder ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pBuildOpDescriptor ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pScratchBuffer ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( nullptr == pRtasBuffer ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( ZE_RTAS_FORMAT_EXT_MAX < pBuildOpDescriptor->rtasFormat ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + if( ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH < pBuildOpDescriptor->buildQuality ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + if( 0x3 < pBuildOpDescriptor->buildFlags ) + return ZE_RESULT_ERROR_INVALID_ENUMERATION; + + return ParameterValidation::validateExtensions(pBuildOpDescriptor); + } + + + ze_result_t + ZEParameterValidation::zeRTASBuilderCommandListAppendCopyExtPrologue( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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::zeRTASBuilderDestroyExtPrologue( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) + { + if( nullptr == hBuilder ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeRTASParallelOperationCreateExtPrologue( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) + { + if( nullptr == hDriver ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == phParallelOperation ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeRTASParallelOperationGetPropertiesExtPrologue( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) + { + if( nullptr == hParallelOperation ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pProperties ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ParameterValidation::validateExtensions(pProperties); + } + + + ze_result_t + ZEParameterValidation::zeRTASParallelOperationJoinExtPrologue( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) + { + if( nullptr == hParallelOperation ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeRTASParallelOperationDestroyExtPrologue( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) + { + if( nullptr == hParallelOperation ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZEParameterValidation::zeDeviceGetVectorWidthPropertiesExtPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == pCount ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZEParameterValidation::zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object @@ -3723,7 +3969,7 @@ namespace validation_layer if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; - if( ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat ) + if( ZE_RTAS_FORMAT_EXP_MAX < pBuildOpDescriptor->rtasFormat ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality ) @@ -3751,10 +3997,10 @@ namespace validation_layer if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; - if( ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatA ) + if( ZE_RTAS_FORMAT_EXP_MAX < rtasFormatA ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; - if( ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatB ) + if( ZE_RTAS_FORMAT_EXP_MAX < rtasFormatB ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; @@ -3790,7 +4036,7 @@ namespace validation_layer if( nullptr == pRtasBuffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; - if( ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat ) + if( ZE_RTAS_FORMAT_EXP_MAX < pBuildOpDescriptor->rtasFormat ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality ) 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 a22a25ff..eb6a4069 100644 --- a/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h +++ b/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h @@ -171,6 +171,17 @@ namespace validation_layer ze_result_t zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ) override; ze_result_t zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeRTASBuilderCreateExtPrologue( ze_driver_handle_t hDriver, const ze_rtas_builder_ext_desc_t* pDescriptor, ze_rtas_builder_ext_handle_t* phBuilder ) override; + ze_result_t zeRTASBuilderGetBuildPropertiesExtPrologue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ze_rtas_builder_ext_properties_t* pProperties ) override; + ze_result_t zeDriverRTASFormatCompatibilityCheckExtPrologue( ze_driver_handle_t hDriver, ze_rtas_format_ext_t rtasFormatA, ze_rtas_format_ext_t rtasFormatB ) override; + ze_result_t zeRTASBuilderBuildExtPrologue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_ext_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_ext_t* pBounds, size_t* pRtasBufferSizeBytes ) override; + ze_result_t zeRTASBuilderCommandListAppendCopyExtPrologue( 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 zeRTASBuilderDestroyExtPrologue( ze_rtas_builder_ext_handle_t hBuilder ) override; + ze_result_t zeRTASParallelOperationCreateExtPrologue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_ext_handle_t* phParallelOperation ) override; + ze_result_t zeRTASParallelOperationGetPropertiesExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ze_rtas_parallel_operation_ext_properties_t* pProperties ) override; + ze_result_t zeRTASParallelOperationJoinExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation ) override; + ze_result_t zeRTASParallelOperationDestroyExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation ) override; + ze_result_t zeDeviceGetVectorWidthPropertiesExtPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_vector_width_properties_ext_t* pVectorWidthProperties ) override; ze_result_t zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize ) override; ze_result_t zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion ) override; ze_result_t zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_kernel_timestamp_result_t* pTimestamps ) 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 2f5468d1..c8a3bda3 100644 --- a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp +++ b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.cpp @@ -259,8 +259,8 @@ namespace validation_layer ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -280,8 +280,8 @@ namespace validation_layer ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -1014,6 +1014,49 @@ namespace validation_layer } + ze_result_t + ZETParameterValidation::zetCommandListAppendMarkerExpPrologue( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ) + { + if( nullptr == hCommandList ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + if( nullptr == hMetricGroup ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZETParameterValidation::zetDeviceEnableMetricsExpPrologue( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + + ze_result_t + ZETParameterValidation::zetDeviceDisableMetricsExpPrologue( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ) + { + if( nullptr == hDevice ) + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + + return ZE_RESULT_SUCCESS; + } + + ze_result_t ZETParameterValidation::zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group diff --git a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h index 4a2d24bc..eb141301 100644 --- a/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h +++ b/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h @@ -69,6 +69,9 @@ namespace validation_layer ze_result_t zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ) override; ze_result_t zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics ) override; ze_result_t zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries ) override; + ze_result_t zetCommandListAppendMarkerExpPrologue( zet_command_list_handle_t hCommandList, zet_metric_group_handle_t hMetricGroup, uint32_t value ) override; + ze_result_t zetDeviceEnableMetricsExpPrologue( zet_device_handle_t hDevice ) override; + ze_result_t zetDeviceDisableMetricsExpPrologue( zet_device_handle_t hDevice ) override; ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) override; ze_result_t zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData ) override; diff --git a/source/layers/validation/common/ze_entry_points.h b/source/layers/validation/common/ze_entry_points.h index c96c1ec5..971500c9 100644 --- a/source/layers/validation/common/ze_entry_points.h +++ b/source/layers/validation/common/ze_entry_points.h @@ -319,6 +319,28 @@ class ZEValidationEntryPoints { virtual ze_result_t zeCommandListAppendSignalExternalSemaphoreExtEpilogue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, 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 zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWaitExternalSemaphoreExtEpilogue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, 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 zeRTASBuilderCreateExtPrologue( ze_driver_handle_t hDriver, const ze_rtas_builder_ext_desc_t* pDescriptor, ze_rtas_builder_ext_handle_t* phBuilder ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderCreateExtEpilogue( ze_driver_handle_t hDriver, const ze_rtas_builder_ext_desc_t* pDescriptor, ze_rtas_builder_ext_handle_t* phBuilder , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderGetBuildPropertiesExtPrologue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ze_rtas_builder_ext_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderGetBuildPropertiesExtEpilogue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ze_rtas_builder_ext_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDriverRTASFormatCompatibilityCheckExtPrologue( ze_driver_handle_t hDriver, ze_rtas_format_ext_t rtasFormatA, ze_rtas_format_ext_t rtasFormatB ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDriverRTASFormatCompatibilityCheckExtEpilogue( ze_driver_handle_t hDriver, ze_rtas_format_ext_t rtasFormatA, ze_rtas_format_ext_t rtasFormatB , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderBuildExtPrologue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_ext_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_ext_t* pBounds, size_t* pRtasBufferSizeBytes ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderBuildExtEpilogue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_ext_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_ext_t* pBounds, size_t* pRtasBufferSizeBytes , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderCommandListAppendCopyExtPrologue( 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 zeRTASBuilderCommandListAppendCopyExtEpilogue( 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 zeRTASBuilderDestroyExtPrologue( ze_rtas_builder_ext_handle_t hBuilder ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASBuilderDestroyExtEpilogue( ze_rtas_builder_ext_handle_t hBuilder , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationCreateExtPrologue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_ext_handle_t* phParallelOperation ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationCreateExtEpilogue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_ext_handle_t* phParallelOperation , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationGetPropertiesExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ze_rtas_parallel_operation_ext_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationGetPropertiesExtEpilogue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ze_rtas_parallel_operation_ext_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationJoinExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationJoinExtEpilogue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationDestroyExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeRTASParallelOperationDestroyExtEpilogue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceGetVectorWidthPropertiesExtPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_vector_width_properties_ext_t* pVectorWidthProperties ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zeDeviceGetVectorWidthPropertiesExtEpilogue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_vector_width_properties_ext_t* pVectorWidthProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceReserveCacheExtEpilogue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion ) {return ZE_RESULT_SUCCESS;} diff --git a/source/layers/validation/common/zet_entry_points.h b/source/layers/validation/common/zet_entry_points.h index e5c541af..d52be228 100644 --- a/source/layers/validation/common/zet_entry_points.h +++ b/source/layers/validation/common/zet_entry_points.h @@ -115,6 +115,12 @@ class ZETValidationEntryPoints { virtual ze_result_t zetMetricDecoderGetDecodableMetricsExpEpilogue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDecodeExpEpilogue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetCommandListAppendMarkerExpPrologue( zet_command_list_handle_t hCommandList, zet_metric_group_handle_t hMetricGroup, uint32_t value ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetCommandListAppendMarkerExpEpilogue( zet_command_list_handle_t hCommandList, zet_metric_group_handle_t hMetricGroup, uint32_t value , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetDeviceEnableMetricsExpPrologue( zet_device_handle_t hDevice ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetDeviceEnableMetricsExpEpilogue( zet_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetDeviceDisableMetricsExpPrologue( zet_device_handle_t hDevice ) {return ZE_RESULT_SUCCESS;} + virtual ze_result_t zetDeviceDisableMetricsExpEpilogue( zet_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) {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 b892b6c0..fe36fcb3 100644 --- a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp @@ -2032,10 +2032,14 @@ namespace validation_layer char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { @@ -2606,6 +2610,180 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZEHandleLifetimeValidation::zeRTASBuilderCreateExtPrologue( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ) + { + + if ( !context.handleLifetime->isHandleValid( hDriver )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASBuilderGetBuildPropertiesExtPrologue( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ) + { + + if ( !context.handleLifetime->isHandleValid( hBuilder )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeDriverRTASFormatCompatibilityCheckExtPrologue( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ) + { + + if ( !context.handleLifetime->isHandleValid( hDriver )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASBuilderBuildExtPrologue( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ) + { + + if ( !context.handleLifetime->isHandleValid( hBuilder )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + if (hParallelOperation && !context.handleLifetime->isHandleValid( hParallelOperation )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASBuilderCommandListAppendCopyExtPrologue( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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::zeRTASBuilderDestroyExtPrologue( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) + { + + if ( !context.handleLifetime->isHandleValid( hBuilder )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASParallelOperationCreateExtPrologue( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) + { + + if ( !context.handleLifetime->isHandleValid( hDriver )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASParallelOperationGetPropertiesExtPrologue( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) + { + + if ( !context.handleLifetime->isHandleValid( hParallelOperation )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASParallelOperationJoinExtPrologue( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) + { + + if ( !context.handleLifetime->isHandleValid( hParallelOperation )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeRTASParallelOperationDestroyExtPrologue( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) + { + + if ( !context.handleLifetime->isHandleValid( hParallelOperation )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZEHandleLifetimeValidation::zeDeviceGetVectorWidthPropertiesExtPrologue( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZEHandleLifetimeValidation::zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the 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 5b598b0d..66bf76cc 100644 --- a/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h +++ b/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h @@ -167,6 +167,17 @@ namespace validation_layer ze_result_t zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ) override; ze_result_t zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; + ze_result_t zeRTASBuilderCreateExtPrologue( ze_driver_handle_t hDriver, const ze_rtas_builder_ext_desc_t* pDescriptor, ze_rtas_builder_ext_handle_t* phBuilder ) override; + ze_result_t zeRTASBuilderGetBuildPropertiesExtPrologue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ze_rtas_builder_ext_properties_t* pProperties ) override; + ze_result_t zeDriverRTASFormatCompatibilityCheckExtPrologue( ze_driver_handle_t hDriver, ze_rtas_format_ext_t rtasFormatA, ze_rtas_format_ext_t rtasFormatB ) override; + ze_result_t zeRTASBuilderBuildExtPrologue( ze_rtas_builder_ext_handle_t hBuilder, const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_ext_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_ext_t* pBounds, size_t* pRtasBufferSizeBytes ) override; + ze_result_t zeRTASBuilderCommandListAppendCopyExtPrologue( 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 zeRTASBuilderDestroyExtPrologue( ze_rtas_builder_ext_handle_t hBuilder ) override; + ze_result_t zeRTASParallelOperationCreateExtPrologue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_ext_handle_t* phParallelOperation ) override; + ze_result_t zeRTASParallelOperationGetPropertiesExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ze_rtas_parallel_operation_ext_properties_t* pProperties ) override; + ze_result_t zeRTASParallelOperationJoinExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation ) override; + ze_result_t zeRTASParallelOperationDestroyExtPrologue( ze_rtas_parallel_operation_ext_handle_t hParallelOperation ) override; + ze_result_t zeDeviceGetVectorWidthPropertiesExtPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_vector_width_properties_ext_t* pVectorWidthProperties ) override; ze_result_t zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize ) override; ze_result_t zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion ) override; ze_result_t zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_kernel_timestamp_result_t* pTimestamps ) 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 bf4b9837..d9c92c00 100644 --- a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp +++ b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp @@ -201,8 +201,8 @@ namespace validation_layer ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -221,8 +221,8 @@ namespace validation_layer ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -869,6 +869,49 @@ namespace validation_layer return ZE_RESULT_SUCCESS; } ze_result_t + ZETHandleLifetimeValidation::zetCommandListAppendMarkerExpPrologue( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ) + { + + if ( !context.handleLifetime->isHandleValid( hCommandList )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + if (!context.handleLifetime->isOpen( hCommandList )){ + return ZE_RESULT_ERROR_INVALID_ARGUMENT; + } + if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZETHandleLifetimeValidation::zetDeviceEnableMetricsExpPrologue( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t + ZETHandleLifetimeValidation::zetDeviceDisableMetricsExpPrologue( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ) + { + + if ( !context.handleLifetime->isHandleValid( hDevice )){ + return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; + } + return ZE_RESULT_SUCCESS; + } + ze_result_t ZETHandleLifetimeValidation::zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data diff --git a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h index bb3b6ea3..8729e8dc 100644 --- a/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h +++ b/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h @@ -68,6 +68,9 @@ namespace validation_layer ze_result_t zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ) override; ze_result_t zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics ) override; ze_result_t zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries ) override; + ze_result_t zetCommandListAppendMarkerExpPrologue( zet_command_list_handle_t hCommandList, zet_metric_group_handle_t hMetricGroup, uint32_t value ) override; + ze_result_t zetDeviceEnableMetricsExpPrologue( zet_device_handle_t hDevice ) override; + ze_result_t zetDeviceDisableMetricsExpPrologue( zet_device_handle_t hDevice ) override; ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) override; ze_result_t zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData ) override; diff --git a/source/layers/validation/ze_valddi.cpp b/source/layers/validation/ze_valddi.cpp index 2a618cb8..e779acf6 100644 --- a/source/layers/validation/ze_valddi.cpp +++ b/source/layers/validation/ze_valddi.cpp @@ -5589,10 +5589,14 @@ namespace validation_layer char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { context.logger->log_trace("zeKernelGetSourceAttributes(hKernel, pSize, pString)"); @@ -6911,6 +6915,514 @@ namespace validation_layer return logAndPropagateResult("zeCommandListAppendWaitExternalSemaphoreExt", driver_result); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ) + { + context.logger->log_trace("zeRTASBuilderCreateExt(hDriver, pDescriptor, phBuilder)"); + + auto pfnCreateExt = context.zeDdiTable.RTASBuilder.pfnCreateExt; + + if( nullptr == pfnCreateExt ) + return logAndPropagateResult("zeRTASBuilderCreateExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderCreateExtPrologue( hDriver, pDescriptor, phBuilder ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCreateExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderCreateExtPrologue( hDriver, pDescriptor, phBuilder ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCreateExt", result); + } + + auto driver_result = pfnCreateExt( hDriver, pDescriptor, phBuilder ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderCreateExtEpilogue( hDriver, pDescriptor, phBuilder ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCreateExt", result); + } + + + if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + if (phBuilder){ + context.handleLifetime->addHandle( *phBuilder ); + context.handleLifetime->addDependent( hDriver, *phBuilder ); + + } + } + return logAndPropagateResult("zeRTASBuilderCreateExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderGetBuildPropertiesExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ) + { + context.logger->log_trace("zeRTASBuilderGetBuildPropertiesExt(hBuilder, pBuildOpDescriptor, pProperties)"); + + auto pfnGetBuildPropertiesExt = context.zeDdiTable.RTASBuilder.pfnGetBuildPropertiesExt; + + if( nullptr == pfnGetBuildPropertiesExt ) + return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderGetBuildPropertiesExtPrologue( hBuilder, pBuildOpDescriptor, pProperties ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderGetBuildPropertiesExtPrologue( hBuilder, pBuildOpDescriptor, pProperties ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExt", result); + } + + auto driver_result = pfnGetBuildPropertiesExt( hBuilder, pBuildOpDescriptor, pProperties ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderGetBuildPropertiesExtEpilogue( hBuilder, pBuildOpDescriptor, pProperties ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExt", result); + } + + return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExt + __zedlllocal ze_result_t ZE_APICALL + zeDriverRTASFormatCompatibilityCheckExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ) + { + context.logger->log_trace("zeDriverRTASFormatCompatibilityCheckExt(hDriver, rtasFormatA, rtasFormatB)"); + + auto pfnRTASFormatCompatibilityCheckExt = context.zeDdiTable.Driver.pfnRTASFormatCompatibilityCheckExt; + + if( nullptr == pfnRTASFormatCompatibilityCheckExt ) + return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDriverRTASFormatCompatibilityCheckExtPrologue( hDriver, rtasFormatA, rtasFormatB ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeDriverRTASFormatCompatibilityCheckExtPrologue( hDriver, rtasFormatA, rtasFormatB ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExt", result); + } + + auto driver_result = pfnRTASFormatCompatibilityCheckExt( hDriver, rtasFormatA, rtasFormatB ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDriverRTASFormatCompatibilityCheckExtEpilogue( hDriver, rtasFormatA, rtasFormatB ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExt", result); + } + + return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderBuildExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderBuildExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ) + { + context.logger->log_trace("zeRTASBuilderBuildExt(hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes)"); + + auto pfnBuildExt = context.zeDdiTable.RTASBuilder.pfnBuildExt; + + if( nullptr == pfnBuildExt ) + return logAndPropagateResult("zeRTASBuilderBuildExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderBuildExtPrologue( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderBuildExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderBuildExtPrologue( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderBuildExt", result); + } + + auto driver_result = pfnBuildExt( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderBuildExtEpilogue( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderBuildExt", result); + } + + return logAndPropagateResult("zeRTASBuilderBuildExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCommandListAppendCopyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCommandListAppendCopyExt( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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("zeRTASBuilderCommandListAppendCopyExt(hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); + + auto pfnCommandListAppendCopyExt = context.zeDdiTable.RTASBuilder.pfnCommandListAppendCopyExt; + + if( nullptr == pfnCommandListAppendCopyExt ) + return logAndPropagateResult("zeRTASBuilderCommandListAppendCopyExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderCommandListAppendCopyExtPrologue( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCommandListAppendCopyExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderCommandListAppendCopyExtPrologue( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCommandListAppendCopyExt", result); + } + + auto driver_result = pfnCommandListAppendCopyExt( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderCommandListAppendCopyExtEpilogue( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCommandListAppendCopyExt", result); + } + + return logAndPropagateResult("zeRTASBuilderCommandListAppendCopyExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderDestroyExt( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) + { + context.logger->log_trace("zeRTASBuilderDestroyExt(hBuilder)"); + + auto pfnDestroyExt = context.zeDdiTable.RTASBuilder.pfnDestroyExt; + + if( nullptr == pfnDestroyExt ) + return logAndPropagateResult("zeRTASBuilderDestroyExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderDestroyExtPrologue( hBuilder ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderDestroyExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderDestroyExtPrologue( hBuilder ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderDestroyExt", result); + } + + auto driver_result = pfnDestroyExt( hBuilder ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderDestroyExtEpilogue( hBuilder ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderDestroyExt", result); + } + + return logAndPropagateResult("zeRTASBuilderDestroyExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) + { + context.logger->log_trace("zeRTASParallelOperationCreateExt(hDriver, phParallelOperation)"); + + auto pfnCreateExt = context.zeDdiTable.RTASParallelOperation.pfnCreateExt; + + if( nullptr == pfnCreateExt ) + return logAndPropagateResult("zeRTASParallelOperationCreateExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationCreateExtPrologue( hDriver, phParallelOperation ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationCreateExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationCreateExtPrologue( hDriver, phParallelOperation ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationCreateExt", result); + } + + auto driver_result = pfnCreateExt( hDriver, phParallelOperation ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationCreateExtEpilogue( hDriver, phParallelOperation ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationCreateExt", result); + } + + + if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ + + if (phParallelOperation){ + context.handleLifetime->addHandle( *phParallelOperation ); + context.handleLifetime->addDependent( hDriver, *phParallelOperation ); + + } + } + return logAndPropagateResult("zeRTASParallelOperationCreateExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationGetPropertiesExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) + { + context.logger->log_trace("zeRTASParallelOperationGetPropertiesExt(hParallelOperation, pProperties)"); + + auto pfnGetPropertiesExt = context.zeDdiTable.RTASParallelOperation.pfnGetPropertiesExt; + + if( nullptr == pfnGetPropertiesExt ) + return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationGetPropertiesExtPrologue( hParallelOperation, pProperties ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationGetPropertiesExtPrologue( hParallelOperation, pProperties ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExt", result); + } + + auto driver_result = pfnGetPropertiesExt( hParallelOperation, pProperties ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationGetPropertiesExtEpilogue( hParallelOperation, pProperties ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExt", result); + } + + return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationJoinExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationJoinExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) + { + context.logger->log_trace("zeRTASParallelOperationJoinExt(hParallelOperation)"); + + auto pfnJoinExt = context.zeDdiTable.RTASParallelOperation.pfnJoinExt; + + if( nullptr == pfnJoinExt ) + return logAndPropagateResult("zeRTASParallelOperationJoinExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationJoinExtPrologue( hParallelOperation ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationJoinExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationJoinExtPrologue( hParallelOperation ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationJoinExt", result); + } + + auto driver_result = pfnJoinExt( hParallelOperation ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationJoinExtEpilogue( hParallelOperation ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationJoinExt", result); + } + + return logAndPropagateResult("zeRTASParallelOperationJoinExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationDestroyExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) + { + context.logger->log_trace("zeRTASParallelOperationDestroyExt(hParallelOperation)"); + + auto pfnDestroyExt = context.zeDdiTable.RTASParallelOperation.pfnDestroyExt; + + if( nullptr == pfnDestroyExt ) + return logAndPropagateResult("zeRTASParallelOperationDestroyExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationDestroyExtPrologue( hParallelOperation ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationDestroyExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationDestroyExtPrologue( hParallelOperation ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationDestroyExt", result); + } + + auto driver_result = pfnDestroyExt( hParallelOperation ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationDestroyExtEpilogue( hParallelOperation ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationDestroyExt", result); + } + + return logAndPropagateResult("zeRTASParallelOperationDestroyExt", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetVectorWidthPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetVectorWidthPropertiesExt( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) + { + context.logger->log_trace("zeDeviceGetVectorWidthPropertiesExt(hDevice, pCount, pVectorWidthProperties)"); + + auto pfnGetVectorWidthPropertiesExt = context.zeDdiTable.Device.pfnGetVectorWidthPropertiesExt; + + if( nullptr == pfnGetVectorWidthPropertiesExt ) + return logAndPropagateResult("zeDeviceGetVectorWidthPropertiesExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetVectorWidthPropertiesExtPrologue( hDevice, pCount, pVectorWidthProperties ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetVectorWidthPropertiesExt", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetVectorWidthPropertiesExtPrologue( hDevice, pCount, pVectorWidthProperties ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetVectorWidthPropertiesExt", result); + } + + auto driver_result = pfnGetVectorWidthPropertiesExt( hDevice, pCount, pVectorWidthProperties ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetVectorWidthPropertiesExtEpilogue( hDevice, pCount, pVectorWidthProperties ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetVectorWidthPropertiesExt", result); + } + + return logAndPropagateResult("zeDeviceGetVectorWidthPropertiesExt", driver_result); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL @@ -8940,6 +9452,49 @@ zeGetGlobalProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASBuilder table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASBuilderProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_builder_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + auto& dditable = validation_layer::context.zeDdiTable.RTASBuilder; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || + ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + dditable.pfnCreateExt = pDdiTable->pfnCreateExt; + pDdiTable->pfnCreateExt = validation_layer::zeRTASBuilderCreateExt; + + dditable.pfnGetBuildPropertiesExt = pDdiTable->pfnGetBuildPropertiesExt; + pDdiTable->pfnGetBuildPropertiesExt = validation_layer::zeRTASBuilderGetBuildPropertiesExt; + + dditable.pfnBuildExt = pDdiTable->pfnBuildExt; + pDdiTable->pfnBuildExt = validation_layer::zeRTASBuilderBuildExt; + + dditable.pfnCommandListAppendCopyExt = pDdiTable->pfnCommandListAppendCopyExt; + pDdiTable->pfnCommandListAppendCopyExt = validation_layer::zeRTASBuilderCommandListAppendCopyExt; + + dditable.pfnDestroyExt = pDdiTable->pfnDestroyExt; + pDdiTable->pfnDestroyExt = validation_layer::zeRTASBuilderDestroyExt; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses @@ -8980,6 +9535,46 @@ zeGetRTASBuilderExpProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASParallelOperation table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASParallelOperationProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_parallel_operation_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers + ) +{ + auto& dditable = validation_layer::context.zeDdiTable.RTASParallelOperation; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || + ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + dditable.pfnCreateExt = pDdiTable->pfnCreateExt; + pDdiTable->pfnCreateExt = validation_layer::zeRTASParallelOperationCreateExt; + + dditable.pfnGetPropertiesExt = pDdiTable->pfnGetPropertiesExt; + pDdiTable->pfnGetPropertiesExt = validation_layer::zeRTASParallelOperationGetPropertiesExt; + + dditable.pfnJoinExt = pDdiTable->pfnJoinExt; + pDdiTable->pfnJoinExt = validation_layer::zeRTASParallelOperationJoinExt; + + dditable.pfnDestroyExt = pDdiTable->pfnDestroyExt; + pDdiTable->pfnDestroyExt = validation_layer::zeRTASParallelOperationDestroyExt; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses @@ -9063,6 +9658,9 @@ zeGetDriverProcAddrTable( dditable.pfnGetExtensionFunctionAddress = pDdiTable->pfnGetExtensionFunctionAddress; pDdiTable->pfnGetExtensionFunctionAddress = validation_layer::zeDriverGetExtensionFunctionAddress; + dditable.pfnRTASFormatCompatibilityCheckExt = pDdiTable->pfnRTASFormatCompatibilityCheckExt; + pDdiTable->pfnRTASFormatCompatibilityCheckExt = validation_layer::zeDriverRTASFormatCompatibilityCheckExt; + dditable.pfnGetLastErrorDescription = pDdiTable->pfnGetLastErrorDescription; pDdiTable->pfnGetLastErrorDescription = validation_layer::zeDriverGetLastErrorDescription; @@ -9176,6 +9774,9 @@ zeGetDeviceProcAddrTable( dditable.pfnReleaseExternalSemaphoreExt = pDdiTable->pfnReleaseExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = validation_layer::zeDeviceReleaseExternalSemaphoreExt; + dditable.pfnGetVectorWidthPropertiesExt = pDdiTable->pfnGetVectorWidthPropertiesExt; + pDdiTable->pfnGetVectorWidthPropertiesExt = validation_layer::zeDeviceGetVectorWidthPropertiesExt; + dditable.pfnReserveCacheExt = pDdiTable->pfnReserveCacheExt; pDdiTable->pfnReserveCacheExt = validation_layer::zeDeviceReserveCacheExt; diff --git a/source/layers/validation/zet_valddi.cpp b/source/layers/validation/zet_valddi.cpp index 0791d400..661037ae 100644 --- a/source/layers/validation/zet_valddi.cpp +++ b/source/layers/validation/zet_valddi.cpp @@ -569,8 +569,8 @@ namespace validation_layer ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -619,8 +619,8 @@ namespace validation_layer ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -2342,6 +2342,133 @@ namespace validation_layer return logAndPropagateResult("zetMetricTracerDecodeExp", driver_result); } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetCommandListAppendMarkerExp + __zedlllocal ze_result_t ZE_APICALL + zetCommandListAppendMarkerExp( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ) + { + context.logger->log_trace("zetCommandListAppendMarkerExp(hCommandList, hMetricGroup, value)"); + + auto pfnAppendMarkerExp = context.zetDdiTable.CommandListExp.pfnAppendMarkerExp; + + if( nullptr == pfnAppendMarkerExp ) + return logAndPropagateResult("zetCommandListAppendMarkerExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMarkerExpPrologue( hCommandList, hMetricGroup, value ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMarkerExp", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zetHandleLifetime.zetCommandListAppendMarkerExpPrologue( hCommandList, hMetricGroup, value ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMarkerExp", result); + } + + auto driver_result = pfnAppendMarkerExp( hCommandList, hMetricGroup, value ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMarkerExpEpilogue( hCommandList, hMetricGroup, value ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMarkerExp", result); + } + + return logAndPropagateResult("zetCommandListAppendMarkerExp", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetDeviceEnableMetricsExp + __zedlllocal ze_result_t ZE_APICALL + zetDeviceEnableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ) + { + context.logger->log_trace("zetDeviceEnableMetricsExp(hDevice)"); + + auto pfnEnableMetricsExp = context.zetDdiTable.DeviceExp.pfnEnableMetricsExp; + + if( nullptr == pfnEnableMetricsExp ) + return logAndPropagateResult("zetDeviceEnableMetricsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetDeviceEnableMetricsExpPrologue( hDevice ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceEnableMetricsExp", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zetHandleLifetime.zetDeviceEnableMetricsExpPrologue( hDevice ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceEnableMetricsExp", result); + } + + auto driver_result = pfnEnableMetricsExp( hDevice ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetDeviceEnableMetricsExpEpilogue( hDevice ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceEnableMetricsExp", result); + } + + return logAndPropagateResult("zetDeviceEnableMetricsExp", driver_result); + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetDeviceDisableMetricsExp + __zedlllocal ze_result_t ZE_APICALL + zetDeviceDisableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ) + { + context.logger->log_trace("zetDeviceDisableMetricsExp(hDevice)"); + + auto pfnDisableMetricsExp = context.zetDdiTable.DeviceExp.pfnDisableMetricsExp; + + if( nullptr == pfnDisableMetricsExp ) + return logAndPropagateResult("zetDeviceDisableMetricsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + + auto numValHandlers = context.validationHandlers.size(); + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetDeviceDisableMetricsExpPrologue( hDevice ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceDisableMetricsExp", result); + } + + + if( context.enableThreadingValidation ){ + //Unimplemented + } + + + if(context.enableHandleLifetime ){ + auto result = context.handleLifetime->zetHandleLifetime.zetDeviceDisableMetricsExpPrologue( hDevice ); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceDisableMetricsExp", result); + } + + auto driver_result = pfnDisableMetricsExp( hDevice ); + + for (size_t i = 0; i < numValHandlers; i++) { + auto result = context.validationHandlers[i]->zetValidation->zetDeviceDisableMetricsExpEpilogue( hDevice ,driver_result); + if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceDisableMetricsExp", result); + } + + return logAndPropagateResult("zetDeviceDisableMetricsExp", driver_result); + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMultipleMetricValuesExp __zedlllocal ze_result_t ZE_APICALL @@ -3449,6 +3576,12 @@ zetGetDeviceExpProcAddrTable( dditable.pfnCreateMetricGroupsFromMetricsExp = pDdiTable->pfnCreateMetricGroupsFromMetricsExp; pDdiTable->pfnCreateMetricGroupsFromMetricsExp = validation_layer::zetDeviceCreateMetricGroupsFromMetricsExp; + dditable.pfnEnableMetricsExp = pDdiTable->pfnEnableMetricsExp; + pDdiTable->pfnEnableMetricsExp = validation_layer::zetDeviceEnableMetricsExp; + + dditable.pfnDisableMetricsExp = pDdiTable->pfnDisableMetricsExp; + pDdiTable->pfnDisableMetricsExp = validation_layer::zetDeviceDisableMetricsExp; + return result; } @@ -3523,6 +3656,37 @@ zetGetCommandListProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's CommandListExp table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetCommandListExpProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zet_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + auto& dditable = validation_layer::context.zetDdiTable.CommandListExp; + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || + ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + dditable.pfnAppendMarkerExp = pDdiTable->pfnAppendMarkerExp; + pDdiTable->pfnAppendMarkerExp = validation_layer::zetCommandListAppendMarkerExp; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses diff --git a/source/lib/ze_libapi.cpp b/source/lib/ze_libapi.cpp index c2aaf622..d6a2f55f 100644 --- a/source/lib/ze_libapi.cpp +++ b/source/lib/ze_libapi.cpp @@ -6234,8 +6234,11 @@ zeMemAllocHost( /// @details /// - The application must ensure the device is not currently referencing /// the memory before it is freed -/// - The implementation of this function may immediately free all Host and -/// Device allocations associated with this memory +/// - The implementation will use the default and immediate policy to +/// schedule all Host and Device allocations associated with this memory +/// to be freed, without any safety checking. Actual freeing of memory is +/// specific to user mode driver and kernel mode driver implementation and +/// may be done asynchronously. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. @@ -6794,7 +6797,7 @@ zeMemCloseIpcHandle( /// passed in hDevice, then the atomic attributes are set in all devices /// associated with the allocation. /// - If the atomic access attribute select is not supported by the driver, -/// ::ZE_RESULT_INVALID_ARGUMENT is returned. +/// ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. /// - The atomic access attribute may be only supported at a device-specific /// granularity, such as at a page boundary. In this case, the memory range /// may be expanded such that the start and end of the range satisfy granularity @@ -8089,10 +8092,14 @@ zeKernelGetSourceAttributes( char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { #ifdef DYNAMIC_LOAD_LOADER @@ -9987,15 +9994,12 @@ zeCommandListAppendWaitExternalSemaphoreExt( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Reserve Cache on Device +/// @brief Creates a ray tracing acceleration structure builder object /// /// @details -/// - The application may call this function but may not be successful as -/// some other application may have reserve prior -/// -/// @remarks -/// _Analogues_ -/// - None +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support ::ZE_extension_rtas extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -10004,15 +10008,17 @@ zeCommandListAppendWaitExternalSemaphoreExt( /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` +/// + `nullptr == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pDescriptor` +/// + `nullptr == phBuilder` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_BUILDER_EXT_VERSION_CURRENT < pDescriptor->builderVersion` ze_result_t ZE_APICALL -zeDeviceReserveCacheExt( - ze_device_handle_t hDevice, ///< [in] handle of the device object - size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the - ///< driver shall default to last level of cache and attempt to reserve in - ///< that cache. - size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver - ///< shall remove prior reservation +zeRTASBuilderCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object ) { #ifdef DYNAMIC_LOAD_LOADER @@ -10020,40 +10026,40 @@ zeDeviceReserveCacheExt( if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - static const ze_pfnDeviceReserveCacheExt_t pfnReserveCacheExt = [&result] { - auto pfnReserveCacheExt = ze_lib::context->zeDdiTable.load()->Device.pfnReserveCacheExt; - if( nullptr == pfnReserveCacheExt ) { + static const ze_pfnRTASBuilderCreateExt_t pfnCreateExt = [&result] { + auto pfnCreateExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnCreateExt; + if( nullptr == pfnCreateExt ) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnReserveCacheExt; + return pfnCreateExt; }(); if (result != ZE_RESULT_SUCCESS) { return result; } - return pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); + return pfnCreateExt( hDriver, pDescriptor, phBuilder ); #else if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnReserveCacheExt = ze_lib::context->zeDdiTable.load()->Device.pfnReserveCacheExt; - if( nullptr == pfnReserveCacheExt ) { + auto pfnCreateExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnCreateExt; + if( nullptr == pfnCreateExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); + return pfnCreateExt( hDriver, pDescriptor, phBuilder ); #endif } /////////////////////////////////////////////////////////////////////////////// -/// @brief Assign VA section to use reserved section +/// @brief Retrieves ray tracing acceleration structure builder properties /// /// @details -/// - The application may call this function to assign VA to particular -/// reservartion region +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -10062,17 +10068,19 @@ zeDeviceReserveCacheExt( /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDevice` +/// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == ptr` +/// + `nullptr == pBuildOpDescriptor` +/// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion` +/// + `::ZE_RTAS_FORMAT_EXT_MAX < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH < pBuildOpDescriptor->buildQuality` +/// + `0x3 < pBuildOpDescriptor->buildFlags` ze_result_t ZE_APICALL -zeDeviceSetCacheAdviceExt( - ze_device_handle_t hDevice, ///< [in] handle of the device object - void* ptr, ///< [in] memory pointer to query - size_t regionSize, ///< [in] region size, in pages - ze_cache_ext_region_t cacheRegion ///< [in] reservation region +zeRTASBuilderGetBuildPropertiesExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties ) { #ifdef DYNAMIC_LOAD_LOADER @@ -10080,52 +10088,40 @@ zeDeviceSetCacheAdviceExt( if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - static const ze_pfnDeviceSetCacheAdviceExt_t pfnSetCacheAdviceExt = [&result] { - auto pfnSetCacheAdviceExt = ze_lib::context->zeDdiTable.load()->Device.pfnSetCacheAdviceExt; - if( nullptr == pfnSetCacheAdviceExt ) { + static const ze_pfnRTASBuilderGetBuildPropertiesExt_t pfnGetBuildPropertiesExt = [&result] { + auto pfnGetBuildPropertiesExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnGetBuildPropertiesExt; + if( nullptr == pfnGetBuildPropertiesExt ) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnSetCacheAdviceExt; + return pfnGetBuildPropertiesExt; }(); if (result != ZE_RESULT_SUCCESS) { return result; } - return pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); + return pfnGetBuildPropertiesExt( hBuilder, pBuildOpDescriptor, pProperties ); #else if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnSetCacheAdviceExt = ze_lib::context->zeDdiTable.load()->Device.pfnSetCacheAdviceExt; - if( nullptr == pfnSetCacheAdviceExt ) { + auto pfnGetBuildPropertiesExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnGetBuildPropertiesExt; + if( nullptr == pfnGetBuildPropertiesExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); + return pfnGetBuildPropertiesExt( hBuilder, pBuildOpDescriptor, pProperties ); #endif } /////////////////////////////////////////////////////////////////////////////// -/// @brief Query event timestamps for a device or sub-device. +/// @brief Checks ray tracing acceleration structure format compatibility /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. -/// - The implementation must support -/// ::ZE_experimental_event_query_timestamps. -/// - The implementation must return all timestamps for the specified event -/// and device pair. -/// - The implementation must return all timestamps for all sub-devices when -/// device handle is parent device. -/// - The implementation may return all timestamps for sub-devices when -/// device handle is sub-device or may return 0 for count. -/// -/// @remarks -/// _Analogues_ -/// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -10134,22 +10130,19 @@ zeDeviceSetCacheAdviceExt( /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hEvent` -/// + `nullptr == hDevice` -/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` +/// + `nullptr == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_FORMAT_EXT_MAX < rtasFormatA` +/// + `::ZE_RTAS_FORMAT_EXT_MAX < rtasFormatB` +/// - ::ZE_RESULT_SUCCESS +/// + An acceleration structure built with `rtasFormatA` is compatible with devices that report `rtasFormatB`. +/// - ::ZE_RESULT_EXT_ERROR_OPERANDS_INCOMPATIBLE +/// + An acceleration structure built with `rtasFormatA` is **not** compatible with devices that report `rtasFormatB`. ze_result_t ZE_APICALL -zeEventQueryTimestampsExp( - ze_event_handle_t hEvent, ///< [in] handle of the event - ze_device_handle_t hDevice, ///< [in] handle of the device to query - uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. - ///< if count is zero, then the driver shall update the value with the - ///< total number of timestamps available. - ///< if count is greater than the number of timestamps available, then the - ///< driver shall update the value with the correct number of timestamps available. - ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. - ///< if count is less than the number of timestamps available, then driver - ///< shall only retrieve that number of timestamps. +zeDriverRTASFormatCompatibilityCheckExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B ) { #ifdef DYNAMIC_LOAD_LOADER @@ -10157,46 +10150,83 @@ zeEventQueryTimestampsExp( if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - static const ze_pfnEventQueryTimestampsExp_t pfnQueryTimestampsExp = [&result] { - auto pfnQueryTimestampsExp = ze_lib::context->zeDdiTable.load()->EventExp.pfnQueryTimestampsExp; - if( nullptr == pfnQueryTimestampsExp ) { + static const ze_pfnDriverRTASFormatCompatibilityCheckExt_t pfnRTASFormatCompatibilityCheckExt = [&result] { + auto pfnRTASFormatCompatibilityCheckExt = ze_lib::context->zeDdiTable.load()->Driver.pfnRTASFormatCompatibilityCheckExt; + if( nullptr == pfnRTASFormatCompatibilityCheckExt ) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnQueryTimestampsExp; + return pfnRTASFormatCompatibilityCheckExt; }(); if (result != ZE_RESULT_SUCCESS) { return result; } - return pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); + return pfnRTASFormatCompatibilityCheckExt( hDriver, rtasFormatA, rtasFormatB ); #else if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnQueryTimestampsExp = ze_lib::context->zeDdiTable.load()->EventExp.pfnQueryTimestampsExp; - if( nullptr == pfnQueryTimestampsExp ) { + auto pfnRTASFormatCompatibilityCheckExt = ze_lib::context->zeDdiTable.load()->Driver.pfnRTASFormatCompatibilityCheckExt; + if( nullptr == pfnRTASFormatCompatibilityCheckExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); + return pfnRTASFormatCompatibilityCheckExt( hDriver, rtasFormatA, rtasFormatB ); #endif } /////////////////////////////////////////////////////////////////////////////// -/// @brief Query image memory properties. +/// @brief Build ray tracing acceleration structure /// /// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// - The implementation must support -/// ::ZE_experimental_image_memory_properties extension. -/// -/// @remarks -/// _Analogues_ -/// - None +/// - This function builds an acceleration structure of the scene consisting +/// of the specified geometry information and writes the acceleration +/// structure to the provided destination buffer. All types of geometries +/// can get freely mixed inside a scene. +/// - Before an acceleration structure can be built, the user must allocate +/// the memory for the acceleration structure buffer and scratch buffer +/// using sizes queried with the ::zeRTASBuilderGetBuildPropertiesExt function. +/// - When using the "worst-case" size for the acceleration structure +/// buffer, the acceleration structure construction will never fail with ::ZE_RESULT_EXT_RTAS_BUILD_RETRY. +/// - When using the "expected" size for the acceleration structure buffer, +/// the acceleration structure construction may fail with +/// ::ZE_RESULT_EXT_RTAS_BUILD_RETRY. If this happens, the user may resize +/// their acceleration structure buffer using the returned +/// `*pRtasBufferSizeBytes` value, which will be updated with an improved +/// size estimate that will likely result in a successful build. +/// - The acceleration structure construction is run on the host and is +/// synchronous, thus after the function returns with a successful result, +/// the acceleration structure may be used. +/// - All provided data buffers must be host-accessible. The referenced +/// scene data (index- and vertex- buffers) have to be accessible from the +/// host, and will **not** be referenced by the build acceleration structure. +/// - The acceleration structure buffer is typicall a host allocation that +/// is later manually copied to a device allocation. Alternatively one can +/// also use a shared USM allocation as acceration structure buffer and +/// skip the copy. +/// - A successfully constructed acceleration structure is entirely +/// self-contained. There is no requirement for input data to persist +/// beyond build completion. +/// - A successfully constructed acceleration structure is non-copyable. +/// - Acceleration structure construction may be parallelized by passing a +/// valid handle to a parallel operation object and joining that parallel +/// operation using ::zeRTASParallelOperationJoinExt with user-provided +/// worker threads. +/// - A successfully constructed acceleration structure is generally +/// non-copyable. It can only get copied from host to device using the +/// special ::zeRTASBuilderCommandListAppendCopyExt function. +/// - **Additional Notes** +/// - "The geometry infos array, geometry infos, and scratch buffer must +/// all be standard host memory allocations." +/// - "A pointer to a geometry info can be a null pointer, in which case +/// the geometry is treated as empty." +/// - "If no parallel operation handle is provided, the build is run +/// sequentially on the current thread." +/// - "A parallel operation object may only be associated with a single +/// acceleration structure build at a time." /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -10205,13 +10235,36 @@ zeEventQueryTimestampsExp( /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hImage` +/// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pMemoryProperties` +/// + `nullptr == pBuildOpDescriptor` +/// + `nullptr == pScratchBuffer` +/// + `nullptr == pRtasBuffer` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_RTAS_FORMAT_EXT_MAX < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXT_HIGH < pBuildOpDescriptor->buildQuality` +/// + `0x3 < pBuildOpDescriptor->buildFlags` +/// - ::ZE_RESULT_EXT_RTAS_BUILD_DEFERRED +/// + Acceleration structure build completion is deferred to parallel operation join. +/// - ::ZE_RESULT_EXT_RTAS_BUILD_RETRY +/// + Acceleration structure build failed due to insufficient resources, retry the build operation with a larger acceleration structure buffer allocation. +/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE +/// + Acceleration structure build failed due to parallel operation object participation in another build operation. ze_result_t ZE_APICALL -zeImageGetMemoryPropertiesExp( - ze_image_handle_t hImage, ///< [in] handle of image object - ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. +zeRTASBuilderBuildExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes ) { #ifdef DYNAMIC_LOAD_LOADER @@ -10219,53 +10272,55 @@ zeImageGetMemoryPropertiesExp( if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - static const ze_pfnImageGetMemoryPropertiesExp_t pfnGetMemoryPropertiesExp = [&result] { - auto pfnGetMemoryPropertiesExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnGetMemoryPropertiesExp; - if( nullptr == pfnGetMemoryPropertiesExp ) { + static const ze_pfnRTASBuilderBuildExt_t pfnBuildExt = [&result] { + auto pfnBuildExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnBuildExt; + if( nullptr == pfnBuildExt ) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnGetMemoryPropertiesExp; + return pfnBuildExt; }(); if (result != ZE_RESULT_SUCCESS) { return result; } - return pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); + return pfnBuildExt( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); #else if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnGetMemoryPropertiesExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnGetMemoryPropertiesExp; - if( nullptr == pfnGetMemoryPropertiesExp ) { + auto pfnBuildExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnBuildExt; + if( nullptr == pfnBuildExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); + return pfnBuildExt( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); #endif } /////////////////////////////////////////////////////////////////////////////// -/// @brief Create image view on the context. +/// @brief Copies a ray tracing acceleration structure (RTAS) from host to device +/// memory. /// /// @details -/// - The application must only use the image view for the device, or its -/// sub-devices, which was provided during creation. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function must be thread-safe. -/// - The implementation must support ::ZE_extension_image_view extension. -/// - Image views are treated as images from the API. -/// - Image views provide a mechanism to redescribe how an image is -/// interpreted (e.g. different format). -/// - Image views become disabled when their corresponding image resource is -/// destroyed. -/// - Use ::zeImageDestroy to destroy image view objects. -/// -/// @remarks -/// _Analogues_ -/// - None +/// - The memory pointed to by srcptr must be host memory containing a valid +/// ray tracing acceleration structure. +/// - The number of bytes to copy must be larger or equal to the size of the +/// ray tracing acceleration structure. +/// - 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. /// /// @returns /// - ::ZE_RESULT_SUCCESS @@ -10274,23 +10329,26 @@ zeImageGetMemoryPropertiesExp( /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hContext` -/// + `nullptr == hDevice` -/// + `nullptr == hImage` +/// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == desc` -/// + `nullptr == phImageView` -/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `0x3 < desc->flags` -/// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` -/// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT +/// + `nullptr == dstptr` +/// + `nullptr == srcptr` +/// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT +/// - ::ZE_RESULT_ERROR_INVALID_SIZE +/// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL -zeImageViewCreateExt( - ze_context_handle_t hContext, ///< [in] handle of the context object - ze_device_handle_t hDevice, ///< [in] handle of the device - const ze_image_desc_t* desc, ///< [in] pointer to image descriptor - ze_image_handle_t hImage, ///< [in] handle of image object to create view from - ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view +zeRTASBuilderCommandListAppendCopyExt( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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 DYNAMIC_LOAD_LOADER @@ -10298,49 +10356,749 @@ zeImageViewCreateExt( if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - static const ze_pfnImageViewCreateExt_t pfnViewCreateExt = [&result] { - auto pfnViewCreateExt = ze_lib::context->zeDdiTable.load()->Image.pfnViewCreateExt; - if( nullptr == pfnViewCreateExt ) { + static const ze_pfnRTASBuilderCommandListAppendCopyExt_t pfnCommandListAppendCopyExt = [&result] { + auto pfnCommandListAppendCopyExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnCommandListAppendCopyExt; + if( nullptr == pfnCommandListAppendCopyExt ) { result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnViewCreateExt; + return pfnCommandListAppendCopyExt; }(); if (result != ZE_RESULT_SUCCESS) { return result; } - return pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); + return pfnCommandListAppendCopyExt( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); #else if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } - auto pfnViewCreateExt = ze_lib::context->zeDdiTable.load()->Image.pfnViewCreateExt; - if( nullptr == pfnViewCreateExt ) { + auto pfnCommandListAppendCopyExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnCommandListAppendCopyExt; + if( nullptr == pfnCommandListAppendCopyExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } - return pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); + return pfnCommandListAppendCopyExt( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); #endif } /////////////////////////////////////////////////////////////////////////////// -/// @brief Create image view on the context. +/// @brief Destroys a ray tracing acceleration structure builder object /// /// @details -/// - The application must only use the image view for the device, or its -/// sub-devices, which was provided during creation. -/// - The application may call this function from simultaneous threads. +/// - The implementation of this function may immediately release any +/// internal Host and Device resources associated with this builder. +/// - The application must **not** call this function from simultaneous +/// threads with the same builder handle. /// - The implementation of this function must be thread-safe. -/// - The implementation must support ::ZE_experimental_image_view -/// extension. -/// - Image views are treated as images from the API. -/// - Image views provide a mechanism to redescribe how an image is -/// interpreted (e.g. different format). -/// - Image views become disabled when their corresponding image resource is -/// destroyed. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hBuilder` +/// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE +ze_result_t ZE_APICALL +zeRTASBuilderDestroyExt( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnRTASBuilderDestroyExt_t pfnDestroyExt = [&result] { + auto pfnDestroyExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnDestroyExt; + if( nullptr == pfnDestroyExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnDestroyExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnDestroyExt( hBuilder ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnDestroyExt = ze_lib::context->zeDdiTable.load()->RTASBuilder.pfnDestroyExt; + if( nullptr == pfnDestroyExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnDestroyExt( hBuilder ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Creates a ray tracing acceleration structure builder parallel +/// operation object +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support ::ZE_extension_rtas extension. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDriver` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == phParallelOperation` +ze_result_t ZE_APICALL +zeRTASParallelOperationCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnRTASParallelOperationCreateExt_t pfnCreateExt = [&result] { + auto pfnCreateExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnCreateExt; + if( nullptr == pfnCreateExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnCreateExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnCreateExt( hDriver, phParallelOperation ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnCreateExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnCreateExt; + if( nullptr == pfnCreateExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnCreateExt( hDriver, phParallelOperation ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves ray tracing acceleration structure builder parallel +/// operation properties +/// +/// @details +/// - The application must first bind the parallel operation object to a +/// build operation before it may query the parallel operation properties. +/// In other words, the application must first call +/// ::zeRTASBuilderBuildExt with **hParallelOperation** before calling +/// this function. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hParallelOperation` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +ze_result_t ZE_APICALL +zeRTASParallelOperationGetPropertiesExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnRTASParallelOperationGetPropertiesExt_t pfnGetPropertiesExt = [&result] { + auto pfnGetPropertiesExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnGetPropertiesExt; + if( nullptr == pfnGetPropertiesExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetPropertiesExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetPropertiesExt( hParallelOperation, pProperties ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetPropertiesExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnGetPropertiesExt; + if( nullptr == pfnGetPropertiesExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetPropertiesExt( hParallelOperation, pProperties ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Joins a parallel build operation +/// +/// @details +/// - All worker threads return the same error code for the parallel build +/// operation upon build completion +/// +/// @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_NULL_HANDLE +/// + `nullptr == hParallelOperation` +ze_result_t ZE_APICALL +zeRTASParallelOperationJoinExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnRTASParallelOperationJoinExt_t pfnJoinExt = [&result] { + auto pfnJoinExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnJoinExt; + if( nullptr == pfnJoinExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnJoinExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnJoinExt( hParallelOperation ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnJoinExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnJoinExt; + if( nullptr == pfnJoinExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnJoinExt( hParallelOperation ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Destroys a ray tracing acceleration structure builder parallel +/// operation object +/// +/// @details +/// - The implementation of this function may immediately release any +/// internal Host and Device resources associated with this parallel +/// operation. +/// - The application must **not** call this function from simultaneous +/// threads with the same parallel operation handle. +/// - The implementation of this function must be thread-safe. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hParallelOperation` +ze_result_t ZE_APICALL +zeRTASParallelOperationDestroyExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnRTASParallelOperationDestroyExt_t pfnDestroyExt = [&result] { + auto pfnDestroyExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnDestroyExt; + if( nullptr == pfnDestroyExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnDestroyExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnDestroyExt( hParallelOperation ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnDestroyExt = ze_lib::context->zeDdiTable.load()->RTASParallelOperation.pfnDestroyExt; + if( nullptr == pfnDestroyExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnDestroyExt( hParallelOperation ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retrieves the vector width properties of the device. +/// +/// @details +/// - Properties are reported for each vector width supported by the device. +/// - Multiple calls to this function will return properties in the same +/// order. +/// - The number of vector width properties is reported thru the pCount +/// parameter which is updated by the driver given pCount == 0. +/// - The application may provide a buffer that is larger than the number of +/// properties, but the application must set pCount to the number of +/// properties to retrieve. +/// - 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_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ze_result_t ZE_APICALL +zeDeviceGetVectorWidthPropertiesExt( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnDeviceGetVectorWidthPropertiesExt_t pfnGetVectorWidthPropertiesExt = [&result] { + auto pfnGetVectorWidthPropertiesExt = ze_lib::context->zeDdiTable.load()->Device.pfnGetVectorWidthPropertiesExt; + if( nullptr == pfnGetVectorWidthPropertiesExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetVectorWidthPropertiesExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetVectorWidthPropertiesExt( hDevice, pCount, pVectorWidthProperties ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetVectorWidthPropertiesExt = ze_lib::context->zeDdiTable.load()->Device.pfnGetVectorWidthPropertiesExt; + if( nullptr == pfnGetVectorWidthPropertiesExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetVectorWidthPropertiesExt( hDevice, pCount, pVectorWidthProperties ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserve Cache on Device +/// +/// @details +/// - The application may call this function but may not be successful as +/// some other application may have reserve prior +/// +/// @remarks +/// _Analogues_ +/// - None +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +ze_result_t ZE_APICALL +zeDeviceReserveCacheExt( + ze_device_handle_t hDevice, ///< [in] handle of the device object + size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the + ///< driver shall default to last level of cache and attempt to reserve in + ///< that cache. + size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver + ///< shall remove prior reservation + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnDeviceReserveCacheExt_t pfnReserveCacheExt = [&result] { + auto pfnReserveCacheExt = ze_lib::context->zeDdiTable.load()->Device.pfnReserveCacheExt; + if( nullptr == pfnReserveCacheExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnReserveCacheExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnReserveCacheExt = ze_lib::context->zeDdiTable.load()->Device.pfnReserveCacheExt; + if( nullptr == pfnReserveCacheExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Assign VA section to use reserved section +/// +/// @details +/// - The application may call this function to assign VA to particular +/// reservartion region +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == ptr` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `::ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion` +ze_result_t ZE_APICALL +zeDeviceSetCacheAdviceExt( + ze_device_handle_t hDevice, ///< [in] handle of the device object + void* ptr, ///< [in] memory pointer to query + size_t regionSize, ///< [in] region size, in pages + ze_cache_ext_region_t cacheRegion ///< [in] reservation region + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnDeviceSetCacheAdviceExt_t pfnSetCacheAdviceExt = [&result] { + auto pfnSetCacheAdviceExt = ze_lib::context->zeDdiTable.load()->Device.pfnSetCacheAdviceExt; + if( nullptr == pfnSetCacheAdviceExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnSetCacheAdviceExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnSetCacheAdviceExt = ze_lib::context->zeDdiTable.load()->Device.pfnSetCacheAdviceExt; + if( nullptr == pfnSetCacheAdviceExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query event timestamps for a device or sub-device. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support +/// ::ZE_experimental_event_query_timestamps. +/// - The implementation must return all timestamps for the specified event +/// and device pair. +/// - The implementation must return all timestamps for all sub-devices when +/// device handle is parent device. +/// - The implementation may return all timestamps for sub-devices when +/// device handle is sub-device or may return 0 for count. +/// +/// @remarks +/// _Analogues_ +/// - None +/// +/// @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_NULL_HANDLE +/// + `nullptr == hEvent` +/// + `nullptr == hDevice` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +ze_result_t ZE_APICALL +zeEventQueryTimestampsExp( + ze_event_handle_t hEvent, ///< [in] handle of the event + ze_device_handle_t hDevice, ///< [in] handle of the device to query + uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. + ///< if count is zero, then the driver shall update the value with the + ///< total number of timestamps available. + ///< if count is greater than the number of timestamps available, then the + ///< driver shall update the value with the correct number of timestamps available. + ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. + ///< if count is less than the number of timestamps available, then driver + ///< shall only retrieve that number of timestamps. + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnEventQueryTimestampsExp_t pfnQueryTimestampsExp = [&result] { + auto pfnQueryTimestampsExp = ze_lib::context->zeDdiTable.load()->EventExp.pfnQueryTimestampsExp; + if( nullptr == pfnQueryTimestampsExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnQueryTimestampsExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnQueryTimestampsExp = ze_lib::context->zeDdiTable.load()->EventExp.pfnQueryTimestampsExp; + if( nullptr == pfnQueryTimestampsExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query image memory properties. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support +/// ::ZE_experimental_image_memory_properties extension. +/// +/// @remarks +/// _Analogues_ +/// - None +/// +/// @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_NULL_HANDLE +/// + `nullptr == hImage` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pMemoryProperties` +ze_result_t ZE_APICALL +zeImageGetMemoryPropertiesExp( + ze_image_handle_t hImage, ///< [in] handle of image object + ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnImageGetMemoryPropertiesExp_t pfnGetMemoryPropertiesExp = [&result] { + auto pfnGetMemoryPropertiesExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnGetMemoryPropertiesExp; + if( nullptr == pfnGetMemoryPropertiesExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnGetMemoryPropertiesExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnGetMemoryPropertiesExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnGetMemoryPropertiesExp; + if( nullptr == pfnGetMemoryPropertiesExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create image view on the context. +/// +/// @details +/// - The application must only use the image view for the device, or its +/// sub-devices, which was provided during creation. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support ::ZE_extension_image_view extension. +/// - Image views are treated as images from the API. +/// - Image views provide a mechanism to redescribe how an image is +/// interpreted (e.g. different format). +/// - Image views become disabled when their corresponding image resource is +/// destroyed. +/// - Use ::zeImageDestroy to destroy image view objects. +/// +/// @remarks +/// _Analogues_ +/// - None +/// +/// @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_NULL_HANDLE +/// + `nullptr == hContext` +/// + `nullptr == hDevice` +/// + `nullptr == hImage` +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == desc` +/// + `nullptr == phImageView` +/// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION +/// + `0x3 < desc->flags` +/// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT +ze_result_t ZE_APICALL +zeImageViewCreateExt( + ze_context_handle_t hContext, ///< [in] handle of the context object + ze_device_handle_t hDevice, ///< [in] handle of the device + const ze_image_desc_t* desc, ///< [in] pointer to image descriptor + ze_image_handle_t hImage, ///< [in] handle of image object to create view from + ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const ze_pfnImageViewCreateExt_t pfnViewCreateExt = [&result] { + auto pfnViewCreateExt = ze_lib::context->zeDdiTable.load()->Image.pfnViewCreateExt; + if( nullptr == pfnViewCreateExt ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnViewCreateExt; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnViewCreateExt = ze_lib::context->zeDdiTable.load()->Image.pfnViewCreateExt; + if( nullptr == pfnViewCreateExt ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Create image view on the context. +/// +/// @details +/// - The application must only use the image view for the device, or its +/// sub-devices, which was provided during creation. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function must be thread-safe. +/// - The implementation must support ::ZE_experimental_image_view +/// extension. +/// - Image views are treated as images from the API. +/// - Image views provide a mechanism to redescribe how an image is +/// interpreted (e.g. different format). +/// - Image views become disabled when their corresponding image resource is +/// destroyed. /// - Use ::zeImageDestroy to destroy image view objects. /// - Note: This function is deprecated and replaced by /// ::zeImageViewCreateExt. @@ -10851,11 +11609,13 @@ zeModuleInspectLinkageExt( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Frees allocated host memory, device memory, or shared memory using the -/// specified free policy. +/// @brief Frees allocated host memory, device memory, or shared memory on the +/// context using the specified free policy. /// /// @details -/// - The memory free policy is specified by the memory free descriptor. +/// - Similar to zeMemFree, with added parameter to choose the 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. /// - The implementation of this function must be thread-safe. @@ -11576,7 +12336,7 @@ zeRTASBuilderCreateExp( /// + `nullptr == pBuildOpDescriptor` /// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` ze_result_t ZE_APICALL @@ -11635,8 +12395,8 @@ zeRTASBuilderGetBuildPropertiesExp( /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatA` -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatB` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < rtasFormatA` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < rtasFormatB` /// - ::ZE_RESULT_SUCCESS /// + An acceleration structure built with `rtasFormatA` is compatible with devices that report `rtasFormatB`. /// - ::ZE_RESULT_EXP_ERROR_OPERANDS_INCOMPATIBLE @@ -11744,7 +12504,7 @@ zeDriverRTASFormatCompatibilityCheckExp( /// + `nullptr == pScratchBuffer` /// + `nullptr == pRtasBuffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION -/// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` +/// + `::ZE_RTAS_FORMAT_EXP_MAX < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` /// - ::ZE_RESULT_EXP_RTAS_BUILD_DEFERRED diff --git a/source/lib/ze_libddi.cpp b/source/lib/ze_libddi.cpp index ee61632e..2549ad93 100644 --- a/source/lib/ze_libddi.cpp +++ b/source/lib/ze_libddi.cpp @@ -32,6 +32,24 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zeInitDrivers") ); } + if( ZE_RESULT_SUCCESS == result ) + { + // Optional + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeGetRTASBuilderProcAddrTable") ); + getTableWithCheck(getTable, version, &initialzeDdiTable.RTASBuilder ); + initialzeDdiTable.RTASBuilder.pfnCreateExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASBuilderCreateExt") ); + initialzeDdiTable.RTASBuilder.pfnGetBuildPropertiesExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASBuilderGetBuildPropertiesExt") ); + initialzeDdiTable.RTASBuilder.pfnBuildExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASBuilderBuildExt") ); + initialzeDdiTable.RTASBuilder.pfnCommandListAppendCopyExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASBuilderCommandListAppendCopyExt") ); + initialzeDdiTable.RTASBuilder.pfnDestroyExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASBuilderDestroyExt") ); + } + if( ZE_RESULT_SUCCESS == result ) { // Optional @@ -48,6 +66,22 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zeRTASBuilderDestroyExp") ); } + if( ZE_RESULT_SUCCESS == result ) + { + // Optional + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeGetRTASParallelOperationProcAddrTable") ); + getTableWithCheck(getTable, version, &initialzeDdiTable.RTASParallelOperation ); + initialzeDdiTable.RTASParallelOperation.pfnCreateExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASParallelOperationCreateExt") ); + initialzeDdiTable.RTASParallelOperation.pfnGetPropertiesExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASParallelOperationGetPropertiesExt") ); + initialzeDdiTable.RTASParallelOperation.pfnJoinExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASParallelOperationJoinExt") ); + initialzeDdiTable.RTASParallelOperation.pfnDestroyExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeRTASParallelOperationDestroyExt") ); + } + if( ZE_RESULT_SUCCESS == result ) { // Optional @@ -81,6 +115,8 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zeDriverGetExtensionProperties") ); initialzeDdiTable.Driver.pfnGetExtensionFunctionAddress = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeDriverGetExtensionFunctionAddress") ); + initialzeDdiTable.Driver.pfnRTASFormatCompatibilityCheckExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeDriverRTASFormatCompatibilityCheckExt") ); initialzeDdiTable.Driver.pfnGetLastErrorDescription = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeDriverGetLastErrorDescription") ); } @@ -134,6 +170,8 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zeDeviceImportExternalSemaphoreExt") ); initialzeDdiTable.Device.pfnReleaseExternalSemaphoreExt = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeDeviceReleaseExternalSemaphoreExt") ); + initialzeDdiTable.Device.pfnGetVectorWidthPropertiesExt = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zeDeviceGetVectorWidthPropertiesExt") ); initialzeDdiTable.Device.pfnReserveCacheExt = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeDeviceReserveCacheExt") ); initialzeDdiTable.Device.pfnSetCacheAdviceExt = reinterpret_cast( @@ -624,12 +662,24 @@ namespace ze_lib result = zeGetGlobalProcAddrTable( version, &initialzeDdiTable.Global ); } + if( ZE_RESULT_SUCCESS == result ) + { + // Optional + zeGetRTASBuilderProcAddrTable( version, &initialzeDdiTable.RTASBuilder ); + } + if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetRTASBuilderExpProcAddrTable( version, &initialzeDdiTable.RTASBuilderExp ); } + if( ZE_RESULT_SUCCESS == result ) + { + // Optional + zeGetRTASParallelOperationProcAddrTable( version, &initialzeDdiTable.RTASParallelOperation ); + } + if( ZE_RESULT_SUCCESS == result ) { // Optional diff --git a/source/lib/ze_tracing_register_cb_libapi.cpp b/source/lib/ze_tracing_register_cb_libapi.cpp index df0192d8..a42b7412 100644 --- a/source/lib/ze_tracing_register_cb_libapi.cpp +++ b/source/lib/ze_tracing_register_cb_libapi.cpp @@ -3793,6 +3793,281 @@ zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback( } +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderCreateExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderCreateExtCb_t pfnCreateExtCb + ) { + + 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_pfnRTASBuilderCreateExtCb_t pfnCreateExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderCreateExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnCreateExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderGetBuildPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderGetBuildPropertiesExtCb_t pfnGetBuildPropertiesExtCb + ) { + + 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_pfnRTASBuilderGetBuildPropertiesExtCb_t pfnGetBuildPropertiesExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderGetBuildPropertiesExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnGetBuildPropertiesExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDriverRTASFormatCompatibilityCheckExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDriverRTASFormatCompatibilityCheckExtCb_t pfnRTASFormatCompatibilityCheckExtCb + ) { + + 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_pfnDriverRTASFormatCompatibilityCheckExtCb_t pfnRTASFormatCompatibilityCheckExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverRTASFormatCompatibilityCheckExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnRTASFormatCompatibilityCheckExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderBuildExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderBuildExtCb_t pfnBuildExtCb + ) { + + 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_pfnRTASBuilderBuildExtCb_t pfnBuildExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderBuildExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnBuildExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderCommandListAppendCopyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderCommandListAppendCopyExtCb_t pfnCommandListAppendCopyExtCb + ) { + + 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_pfnRTASBuilderCommandListAppendCopyExtCb_t pfnCommandListAppendCopyExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderCommandListAppendCopyExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnCommandListAppendCopyExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASBuilderDestroyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASBuilderDestroyExtCb_t pfnDestroyExtCb + ) { + + 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_pfnRTASBuilderDestroyExtCb_t pfnDestroyExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderDestroyExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnDestroyExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationCreateExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationCreateExtCb_t pfnCreateExtCb + ) { + + 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_pfnRTASParallelOperationCreateExtCb_t pfnCreateExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationCreateExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnCreateExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationGetPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationGetPropertiesExtCb_t pfnGetPropertiesExtCb + ) { + + 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_pfnRTASParallelOperationGetPropertiesExtCb_t pfnGetPropertiesExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationGetPropertiesExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnGetPropertiesExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationJoinExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationJoinExtCb_t pfnJoinExtCb + ) { + + 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_pfnRTASParallelOperationJoinExtCb_t pfnJoinExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationJoinExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnJoinExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerRTASParallelOperationDestroyExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnRTASParallelOperationDestroyExtCb_t pfnDestroyExtCb + ) { + + 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_pfnRTASParallelOperationDestroyExtCb_t pfnDestroyExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationDestroyExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnDestroyExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + +ZE_APIEXPORT ze_result_t ZE_APICALL +zelTracerDeviceGetVectorWidthPropertiesExtRegisterCallback( + zel_tracer_handle_t hTracer, + zel_tracer_reg_t callback_type, + ze_pfnDeviceGetVectorWidthPropertiesExtCb_t pfnGetVectorWidthPropertiesExtCb + ) { + + 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_pfnDeviceGetVectorWidthPropertiesExtCb_t pfnGetVectorWidthPropertiesExtCb + ); + + auto func = reinterpret_cast( + GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetVectorWidthPropertiesExtRegisterCallback") ); + + if(func) + return func(hTracer, callback_type, pfnGetVectorWidthPropertiesExtCb); + + return ZE_RESULT_ERROR_UNINITIALIZED; +} + + ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceReserveCacheExtRegisterCallback( zel_tracer_handle_t hTracer, diff --git a/source/lib/zet_libapi.cpp b/source/lib/zet_libapi.cpp index 719f8c25..fb8377b2 100644 --- a/source/lib/zet_libapi.cpp +++ b/source/lib/zet_libapi.cpp @@ -738,8 +738,8 @@ zetDebugReadRegisters( ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -798,8 +798,8 @@ zetDebugWriteRegisters( ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -3016,6 +3016,186 @@ zetMetricTracerDecodeExp( #endif } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a Marker based on the Metric source of the Metric Group, to a +/// Command List. +/// +/// @details +/// - This function appends a Marker based on the Metric source of the +/// Metric Group, to Command List. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hCommandList` +/// + `nullptr == hMetricGroup` +ze_result_t ZE_APICALL +zetCommandListAppendMarkerExp( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zet_pfnCommandListAppendMarkerExp_t pfnAppendMarkerExp = [&result] { + auto pfnAppendMarkerExp = ze_lib::context->zetDdiTable.load()->CommandListExp.pfnAppendMarkerExp; + if( nullptr == pfnAppendMarkerExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnAppendMarkerExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnAppendMarkerExp( hCommandList, hMetricGroup, value ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnAppendMarkerExp = ze_lib::context->zetDdiTable.load()->CommandListExp.pfnAppendMarkerExp; + if( nullptr == pfnAppendMarkerExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnAppendMarkerExp( hCommandList, hMetricGroup, value ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enable Metrics collection during runtime. +/// +/// @details +/// - This API enables metric collection for a device/sub-device if not +/// already enabled. +/// - if ZET_ENABLE_METRICS=1 was already set, then calling this api would +/// be a NOP. +/// - This api should be called after calling zeInit(). +/// - If device is a root-device handle, then its sub-devices are also +/// enabled. +/// - ::zetDeviceDisableMetricsExp need not be called if if this api returns +/// error. +/// - This API can be used as runtime alternative to setting +/// ZET_ENABLE_METRICS=1. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +ze_result_t ZE_APICALL +zetDeviceEnableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zet_pfnDeviceEnableMetricsExp_t pfnEnableMetricsExp = [&result] { + auto pfnEnableMetricsExp = ze_lib::context->zetDdiTable.load()->DeviceExp.pfnEnableMetricsExp; + if( nullptr == pfnEnableMetricsExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnEnableMetricsExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnEnableMetricsExp( hDevice ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnEnableMetricsExp = ze_lib::context->zetDdiTable.load()->DeviceExp.pfnEnableMetricsExp; + if( nullptr == pfnEnableMetricsExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnEnableMetricsExp( hDevice ); + #endif +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Disable Metrics collection during runtime, if it was already enabled. +/// +/// @details +/// - This API disables metrics collection for a device/sub-device, if it +/// was previously enabled. +/// - If device is a root-device handle, then its sub-devices are also +/// disabled. +/// - The application has to ensure that all metric operations are complete +/// and all metric resources are released before this API is called. +/// - If there are metric operations in progress or metric resources are not +/// released, then ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE is returned. +/// +/// @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_NULL_HANDLE +/// + `nullptr == hDevice` +ze_result_t ZE_APICALL +zetDeviceDisableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ) +{ + #ifdef DYNAMIC_LOAD_LOADER + ze_result_t result = ZE_RESULT_SUCCESS; + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + static const zet_pfnDeviceDisableMetricsExp_t pfnDisableMetricsExp = [&result] { + auto pfnDisableMetricsExp = ze_lib::context->zetDdiTable.load()->DeviceExp.pfnDisableMetricsExp; + if( nullptr == pfnDisableMetricsExp ) { + result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + return pfnDisableMetricsExp; + }(); + if (result != ZE_RESULT_SUCCESS) { + return result; + } + return pfnDisableMetricsExp( hDevice ); + #else + if(ze_lib::destruction) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + auto pfnDisableMetricsExp = ze_lib::context->zetDdiTable.load()->DeviceExp.pfnDisableMetricsExp; + if( nullptr == pfnDisableMetricsExp ) { + if(!ze_lib::context->isInitialized) + return ZE_RESULT_ERROR_UNINITIALIZED; + else + return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + return pfnDisableMetricsExp( hDevice ); + #endif +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Calculate one or more sets of metric values from raw data. /// diff --git a/source/lib/zet_libddi.cpp b/source/lib/zet_libddi.cpp index 91ec9e6c..af6143c5 100644 --- a/source/lib/zet_libddi.cpp +++ b/source/lib/zet_libddi.cpp @@ -90,6 +90,10 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zetDeviceGetConcurrentMetricGroupsExp") ); initialzetDdiTable.DeviceExp.pfnCreateMetricGroupsFromMetricsExp = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetDeviceCreateMetricGroupsFromMetricsExp") ); + initialzetDdiTable.DeviceExp.pfnEnableMetricsExp = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zetDeviceEnableMetricsExp") ); + initialzetDdiTable.DeviceExp.pfnDisableMetricsExp = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zetDeviceDisableMetricsExp") ); } if( ZE_RESULT_SUCCESS == result ) @@ -116,6 +120,16 @@ namespace ze_lib GET_FUNCTION_PTR(loader, "zetCommandListAppendMetricMemoryBarrier") ); } + if( ZE_RESULT_SUCCESS == result ) + { + // Optional + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zetGetCommandListExpProcAddrTable") ); + getTableWithCheck(getTable, version, &initialzetDdiTable.CommandListExp ); + initialzetDdiTable.CommandListExp.pfnAppendMarkerExp = reinterpret_cast( + GET_FUNCTION_PTR(loader, "zetCommandListAppendMarkerExp") ); + } + if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( @@ -331,6 +345,12 @@ namespace ze_lib result = zetGetCommandListProcAddrTable( version, &initialzetDdiTable.CommandList ); } + if( ZE_RESULT_SUCCESS == result ) + { + // Optional + zetGetCommandListExpProcAddrTable( version, &initialzetDdiTable.CommandListExp ); + } + if( ZE_RESULT_SUCCESS == result ) { result = zetGetKernelProcAddrTable( version, &initialzetDdiTable.Kernel ); diff --git a/source/loader/ze_ldrddi.cpp b/source/loader/ze_ldrddi.cpp index 8d080a5c..b4bc7c79 100644 --- a/source/loader/ze_ldrddi.cpp +++ b/source/loader/ze_ldrddi.cpp @@ -4074,10 +4074,14 @@ namespace loader char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including - ///< a null-terminating character, is returned in pSize. - ///< Otherwise, pString must point to valid application memory that is - ///< greater than or equal to *pSize bytes in length, and on return the - ///< pointed-to string will contain a space-separated list of kernel source attributes. + ///< a null-terminating character, is returned in pSize. Otherwise, pString + ///< must point to valid application memory that is greater than or equal + ///< to *pSize bytes in length, and on return the pointed-to string will + ///< contain a space-separated list of kernel source attributes. Note: This + ///< API was originally intended to ship with a char *pString, however this + ///< typo was introduced. Thus the API has to stay this way for backwards + ///< compatible reasons. It can be corrected in v2.0. Suggestion is to + ///< create your own char *pString and then pass to this API with &pString. ) { ze_result_t result = ZE_RESULT_SUCCESS; @@ -5060,6 +5064,361 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + const ze_rtas_builder_ext_desc_t* pDescriptor, ///< [in] pointer to builder descriptor + ze_rtas_builder_ext_handle_t* phBuilder ///< [out] handle of builder object + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDriver )->dditable; + auto pfnCreateExt = dditable->ze.RTASBuilder.pfnCreateExt; + if( nullptr == pfnCreateExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDriver = reinterpret_cast( hDriver )->handle; + + // forward to device-driver + result = pfnCreateExt( hDriver, pDescriptor, phBuilder ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + try + { + // convert driver handle to loader handle + *phBuilder = reinterpret_cast( + context->ze_rtas_builder_ext_factory.getInstance( *phBuilder, dditable ) ); + } + catch( std::bad_alloc& ) + { + result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderGetBuildPropertiesExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + ze_rtas_builder_ext_properties_t* pProperties ///< [in,out] query result for builder properties + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hBuilder )->dditable; + auto pfnGetBuildPropertiesExt = dditable->ze.RTASBuilder.pfnGetBuildPropertiesExt; + if( nullptr == pfnGetBuildPropertiesExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hBuilder = reinterpret_cast( hBuilder )->handle; + + // forward to device-driver + result = pfnGetBuildPropertiesExt( hBuilder, pBuildOpDescriptor, pProperties ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExt + __zedlllocal ze_result_t ZE_APICALL + zeDriverRTASFormatCompatibilityCheckExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_format_ext_t rtasFormatA, ///< [in] operand A + ze_rtas_format_ext_t rtasFormatB ///< [in] operand B + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDriver )->dditable; + auto pfnRTASFormatCompatibilityCheckExt = dditable->ze.Driver.pfnRTASFormatCompatibilityCheckExt; + if( nullptr == pfnRTASFormatCompatibilityCheckExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDriver = reinterpret_cast( hDriver )->handle; + + // forward to device-driver + result = pfnRTASFormatCompatibilityCheckExt( hDriver, rtasFormatA, rtasFormatB ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderBuildExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderBuildExt( + ze_rtas_builder_ext_handle_t hBuilder, ///< [in] handle of builder object + const ze_rtas_builder_build_op_ext_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor + void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used + ///< during acceleration structure construction + size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes + void* pRtasBuffer, ///< [in] pointer to destination buffer + size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object + void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks + ze_rtas_aabb_ext_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration + ///< structure bounds + size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in + ///< bytes + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hBuilder )->dditable; + auto pfnBuildExt = dditable->ze.RTASBuilder.pfnBuildExt; + if( nullptr == pfnBuildExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hBuilder = reinterpret_cast( hBuilder )->handle; + + // convert loader handle to driver handle + hParallelOperation = ( hParallelOperation ) ? reinterpret_cast( hParallelOperation )->handle : nullptr; + + // forward to device-driver + result = pfnBuildExt( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderCommandListAppendCopyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderCommandListAppendCopyExt( + ze_command_list_handle_t hCommandList, ///< [in] handle of command list + void* dstptr, ///< [in] pointer to destination in device memory to copy the ray tracing + ///< acceleration structure to + const void* srcptr, ///< [in] pointer to a valid source ray tracing acceleration structure in + ///< host memory to copy from + size_t size, ///< [in] size in bytes to copy + 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 pfnCommandListAppendCopyExt = dditable->ze.RTASBuilder.pfnCommandListAppendCopyExt; + if( nullptr == pfnCommandListAppendCopyExt ) + 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 = pfnCommandListAppendCopyExt( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEventsLocal ); + delete []phWaitEventsLocal; + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASBuilderDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASBuilderDestroyExt( + ze_rtas_builder_ext_handle_t hBuilder ///< [in][release] handle of builder object to destroy + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hBuilder )->dditable; + auto pfnDestroyExt = dditable->ze.RTASBuilder.pfnDestroyExt; + if( nullptr == pfnDestroyExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hBuilder = reinterpret_cast( hBuilder )->handle; + + // forward to device-driver + result = pfnDestroyExt( hBuilder ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + // release loader handle + context->ze_rtas_builder_ext_factory.release( hBuilder ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationCreateExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationCreateExt( + ze_driver_handle_t hDriver, ///< [in] handle of driver object + ze_rtas_parallel_operation_ext_handle_t* phParallelOperation///< [out] handle of parallel operation object + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDriver )->dditable; + auto pfnCreateExt = dditable->ze.RTASParallelOperation.pfnCreateExt; + if( nullptr == pfnCreateExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDriver = reinterpret_cast( hDriver )->handle; + + // forward to device-driver + result = pfnCreateExt( hDriver, phParallelOperation ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + try + { + // convert driver handle to loader handle + *phParallelOperation = reinterpret_cast( + context->ze_rtas_parallel_operation_ext_factory.getInstance( *phParallelOperation, dditable ) ); + } + catch( std::bad_alloc& ) + { + result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationGetPropertiesExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation, ///< [in] handle of parallel operation object + ze_rtas_parallel_operation_ext_properties_t* pProperties///< [in,out] query result for parallel operation properties + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hParallelOperation )->dditable; + auto pfnGetPropertiesExt = dditable->ze.RTASParallelOperation.pfnGetPropertiesExt; + if( nullptr == pfnGetPropertiesExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hParallelOperation = reinterpret_cast( hParallelOperation )->handle; + + // forward to device-driver + result = pfnGetPropertiesExt( hParallelOperation, pProperties ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationJoinExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationJoinExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in] handle of parallel operation object + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hParallelOperation )->dditable; + auto pfnJoinExt = dditable->ze.RTASParallelOperation.pfnJoinExt; + if( nullptr == pfnJoinExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hParallelOperation = reinterpret_cast( hParallelOperation )->handle; + + // forward to device-driver + result = pfnJoinExt( hParallelOperation ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeRTASParallelOperationDestroyExt + __zedlllocal ze_result_t ZE_APICALL + zeRTASParallelOperationDestroyExt( + ze_rtas_parallel_operation_ext_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hParallelOperation )->dditable; + auto pfnDestroyExt = dditable->ze.RTASParallelOperation.pfnDestroyExt; + if( nullptr == pfnDestroyExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hParallelOperation = reinterpret_cast( hParallelOperation )->handle; + + // forward to device-driver + result = pfnDestroyExt( hParallelOperation ); + + if( ZE_RESULT_SUCCESS != result ) + return result; + + // release loader handle + context->ze_rtas_parallel_operation_ext_factory.release( hParallelOperation ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zeDeviceGetVectorWidthPropertiesExt + __zedlllocal ze_result_t ZE_APICALL + zeDeviceGetVectorWidthPropertiesExt( + ze_device_handle_t hDevice, ///< [in] handle of the device + uint32_t* pCount, ///< [in,out] pointer to the number of vector width properties. + ///< if count is zero, then the driver shall update the value with the + ///< total number of vector width properties available. + ///< if count is greater than the number of vector width properties + ///< available, then the driver shall update the value with the correct + ///< number of vector width properties available. + ze_device_vector_width_properties_ext_t* pVectorWidthProperties ///< [in,out][optional][range(0, *pCount)] array of vector width properties. + ///< if count is less than the number of properties available, then the + ///< driver will return only the number requested. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnGetVectorWidthPropertiesExt = dditable->ze.Device.pfnGetVectorWidthPropertiesExt; + if( nullptr == pfnGetVectorWidthPropertiesExt ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnGetVectorWidthPropertiesExt( hDevice, pCount, pVectorWidthProperties ); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL @@ -6608,6 +6967,102 @@ zeGetGlobalProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASBuilder table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASBuilderProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_builder_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + if( loader::context->zeDrivers.size() < 1 ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( loader::context->version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + bool atLeastOneDriverValid = false; + // Load the device-driver DDI tables + for( auto& drv : loader::context->zeDrivers ) + { + if(drv.initStatus != ZE_RESULT_SUCCESS) + continue; + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR( drv.handle, "zeGetRTASBuilderProcAddrTable") ); + if(!getTable) + continue; + auto getTableResult = getTable( version, &drv.dditable.ze.RTASBuilder); + if(getTableResult == ZE_RESULT_SUCCESS) + atLeastOneDriverValid = true; + else + drv.initStatus = getTableResult; + } + + if(!atLeastOneDriverValid) + result = ZE_RESULT_ERROR_UNINITIALIZED; + else + result = ZE_RESULT_SUCCESS; + + if( ZE_RESULT_SUCCESS == result ) + { + if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) + { + // return pointers to loader's DDIs + pDdiTable->pfnCreateExt = loader::zeRTASBuilderCreateExt; + pDdiTable->pfnGetBuildPropertiesExt = loader::zeRTASBuilderGetBuildPropertiesExt; + pDdiTable->pfnBuildExt = loader::zeRTASBuilderBuildExt; + pDdiTable->pfnCommandListAppendCopyExt = loader::zeRTASBuilderCommandListAppendCopyExt; + pDdiTable->pfnDestroyExt = loader::zeRTASBuilderDestroyExt; + } + else + { + // return pointers directly to driver's DDIs + *pDdiTable = loader::context->zeDrivers.front().dditable.ze.RTASBuilder; + } + } + + // If the validation layer is enabled, then intercept the loader's DDIs + if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetRTASBuilderProcAddrTable") ); + if(!getTable) + return ZE_RESULT_ERROR_UNINITIALIZED; + result = getTable( version, pDdiTable ); + } + + // If the API tracing layer is enabled, then intercept the loader's DDIs + if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetRTASBuilderProcAddrTable") ); + if(!getTable) + return ZE_RESULT_ERROR_UNINITIALIZED; + ze_rtas_builder_dditable_t dditable; + memcpy(&dditable, pDdiTable, sizeof(ze_rtas_builder_dditable_t)); + result = getTable( version, &dditable ); + loader::context->tracing_dditable.ze.RTASBuilder = dditable; + if ( loader::context->tracingLayerEnabled ) { + result = getTable( version, pDdiTable ); + } + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses @@ -6694,6 +7149,101 @@ zeGetRTASBuilderExpProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's RTASParallelOperation table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zeGetRTASParallelOperationProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + ze_rtas_parallel_operation_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers + ) +{ + if( loader::context->zeDrivers.size() < 1 ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( loader::context->version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + bool atLeastOneDriverValid = false; + // Load the device-driver DDI tables + for( auto& drv : loader::context->zeDrivers ) + { + if(drv.initStatus != ZE_RESULT_SUCCESS) + continue; + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR( drv.handle, "zeGetRTASParallelOperationProcAddrTable") ); + if(!getTable) + continue; + auto getTableResult = getTable( version, &drv.dditable.ze.RTASParallelOperation); + if(getTableResult == ZE_RESULT_SUCCESS) + atLeastOneDriverValid = true; + else + drv.initStatus = getTableResult; + } + + if(!atLeastOneDriverValid) + result = ZE_RESULT_ERROR_UNINITIALIZED; + else + result = ZE_RESULT_SUCCESS; + + if( ZE_RESULT_SUCCESS == result ) + { + if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) + { + // return pointers to loader's DDIs + pDdiTable->pfnCreateExt = loader::zeRTASParallelOperationCreateExt; + pDdiTable->pfnGetPropertiesExt = loader::zeRTASParallelOperationGetPropertiesExt; + pDdiTable->pfnJoinExt = loader::zeRTASParallelOperationJoinExt; + pDdiTable->pfnDestroyExt = loader::zeRTASParallelOperationDestroyExt; + } + else + { + // return pointers directly to driver's DDIs + *pDdiTable = loader::context->zeDrivers.front().dditable.ze.RTASParallelOperation; + } + } + + // If the validation layer is enabled, then intercept the loader's DDIs + if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetRTASParallelOperationProcAddrTable") ); + if(!getTable) + return ZE_RESULT_ERROR_UNINITIALIZED; + result = getTable( version, pDdiTable ); + } + + // If the API tracing layer is enabled, then intercept the loader's DDIs + if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetRTASParallelOperationProcAddrTable") ); + if(!getTable) + return ZE_RESULT_ERROR_UNINITIALIZED; + ze_rtas_parallel_operation_dditable_t dditable; + memcpy(&dditable, pDdiTable, sizeof(ze_rtas_parallel_operation_dditable_t)); + result = getTable( version, &dditable ); + loader::context->tracing_dditable.ze.RTASParallelOperation = dditable; + if ( loader::context->tracingLayerEnabled ) { + result = getTable( version, pDdiTable ); + } + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses @@ -6840,6 +7390,7 @@ zeGetDriverProcAddrTable( pDdiTable->pfnGetIpcProperties = loader::zeDriverGetIpcProperties; pDdiTable->pfnGetExtensionProperties = loader::zeDriverGetExtensionProperties; pDdiTable->pfnGetExtensionFunctionAddress = loader::zeDriverGetExtensionFunctionAddress; + pDdiTable->pfnRTASFormatCompatibilityCheckExt = loader::zeDriverRTASFormatCompatibilityCheckExt; pDdiTable->pfnGetLastErrorDescription = loader::zeDriverGetLastErrorDescription; } else @@ -7032,6 +7583,7 @@ zeGetDeviceProcAddrTable( pDdiTable->pfnGetGlobalTimestamps = loader::zeDeviceGetGlobalTimestamps; pDdiTable->pfnImportExternalSemaphoreExt = loader::zeDeviceImportExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = loader::zeDeviceReleaseExternalSemaphoreExt; + pDdiTable->pfnGetVectorWidthPropertiesExt = loader::zeDeviceGetVectorWidthPropertiesExt; pDdiTable->pfnReserveCacheExt = loader::zeDeviceReserveCacheExt; pDdiTable->pfnSetCacheAdviceExt = loader::zeDeviceSetCacheAdviceExt; pDdiTable->pfnPciGetPropertiesExt = loader::zeDevicePciGetPropertiesExt; diff --git a/source/loader/ze_ldrddi.h b/source/loader/ze_ldrddi.h index 2643d540..609bb853 100644 --- a/source/loader/ze_ldrddi.h +++ b/source/loader/ze_ldrddi.h @@ -63,6 +63,12 @@ namespace loader using ze_external_semaphore_ext_object_t = object_t < ze_external_semaphore_ext_handle_t >; using ze_external_semaphore_ext_factory_t = singleton_factory_t < ze_external_semaphore_ext_object_t, ze_external_semaphore_ext_handle_t >; + using ze_rtas_builder_ext_object_t = object_t < ze_rtas_builder_ext_handle_t >; + using ze_rtas_builder_ext_factory_t = singleton_factory_t < ze_rtas_builder_ext_object_t, ze_rtas_builder_ext_handle_t >; + + using ze_rtas_parallel_operation_ext_object_t = object_t < ze_rtas_parallel_operation_ext_handle_t >; + using ze_rtas_parallel_operation_ext_factory_t = singleton_factory_t < ze_rtas_parallel_operation_ext_object_t, ze_rtas_parallel_operation_ext_handle_t >; + using ze_rtas_builder_exp_object_t = object_t < ze_rtas_builder_exp_handle_t >; using ze_rtas_builder_exp_factory_t = singleton_factory_t < ze_rtas_builder_exp_object_t, ze_rtas_builder_exp_handle_t >; diff --git a/source/loader/ze_loader_internal.h b/source/loader/ze_loader_internal.h index 295a33a2..e391523b 100644 --- a/source/loader/ze_loader_internal.h +++ b/source/loader/ze_loader_internal.h @@ -84,7 +84,9 @@ namespace loader ze_module_factory_t ze_module_factory; ze_physical_mem_factory_t ze_physical_mem_factory; ze_rtas_builder_exp_factory_t ze_rtas_builder_exp_factory; + ze_rtas_builder_ext_factory_t ze_rtas_builder_ext_factory; ze_rtas_parallel_operation_exp_factory_t ze_rtas_parallel_operation_exp_factory; + ze_rtas_parallel_operation_ext_factory_t ze_rtas_parallel_operation_ext_factory; ze_sampler_factory_t ze_sampler_factory; zes_device_factory_t zes_device_factory; zes_diag_factory_t zes_diag_factory; diff --git a/source/loader/zet_ldrddi.cpp b/source/loader/zet_ldrddi.cpp index 68c211ee..8629d2bf 100644 --- a/source/loader/zet_ldrddi.cpp +++ b/source/loader/zet_ldrddi.cpp @@ -376,8 +376,8 @@ namespace loader ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or - ///< equal to the `count` member of ::zet_debug_register_group_properties_t - ///< for the type + ///< equal to the `count` member of ::zet_debug_regset_properties_t for the + ///< type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -409,8 +409,8 @@ namespace loader ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than - ///< or equal to the `count` member of - ///< ::zet_debug_register_group_properties_t for the type + ///< or equal to the `count` member of ::zet_debug_regset_properties_t for + ///< the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { @@ -1654,6 +1654,85 @@ namespace loader return result; } + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetCommandListAppendMarkerExp + __zedlllocal ze_result_t ZE_APICALL + zetCommandListAppendMarkerExp( + zet_command_list_handle_t hCommandList, ///< [in] handle to the command list + zet_metric_group_handle_t hMetricGroup, ///< [in] handle to the marker metric group. + ///< ::zet_metric_group_type_exp_flags_t could be used to check whether + ///< marker is supoported by the metric group. + uint32_t value ///< [in] marker value + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hCommandList )->dditable; + auto pfnAppendMarkerExp = dditable->zet.CommandListExp.pfnAppendMarkerExp; + if( nullptr == pfnAppendMarkerExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hCommandList = reinterpret_cast( hCommandList )->handle; + + // convert loader handle to driver handle + hMetricGroup = reinterpret_cast( hMetricGroup )->handle; + + // forward to device-driver + result = pfnAppendMarkerExp( hCommandList, hMetricGroup, value ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetDeviceEnableMetricsExp + __zedlllocal ze_result_t ZE_APICALL + zetDeviceEnableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be enabled. + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnEnableMetricsExp = dditable->zet.DeviceExp.pfnEnableMetricsExp; + if( nullptr == pfnEnableMetricsExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnEnableMetricsExp( hDevice ); + + return result; + } + + /////////////////////////////////////////////////////////////////////////////// + /// @brief Intercept function for zetDeviceDisableMetricsExp + __zedlllocal ze_result_t ZE_APICALL + zetDeviceDisableMetricsExp( + zet_device_handle_t hDevice ///< [in] handle of the device where metrics collection has to be disabled + ) + { + ze_result_t result = ZE_RESULT_SUCCESS; + + // extract driver's function pointer table + auto dditable = reinterpret_cast( hDevice )->dditable; + auto pfnDisableMetricsExp = dditable->zet.DeviceExp.pfnDisableMetricsExp; + if( nullptr == pfnDisableMetricsExp ) + return ZE_RESULT_ERROR_UNINITIALIZED; + + // convert loader handle to driver handle + hDevice = reinterpret_cast( hDevice )->handle; + + // forward to device-driver + result = pfnDisableMetricsExp( hDevice ); + + return result; + } + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMultipleMetricValuesExp __zedlllocal ze_result_t ZE_APICALL @@ -2632,6 +2711,8 @@ zetGetDeviceExpProcAddrTable( // return pointers to loader's DDIs pDdiTable->pfnGetConcurrentMetricGroupsExp = loader::zetDeviceGetConcurrentMetricGroupsExp; pDdiTable->pfnCreateMetricGroupsFromMetricsExp = loader::zetDeviceCreateMetricGroupsFromMetricsExp; + pDdiTable->pfnEnableMetricsExp = loader::zetDeviceEnableMetricsExp; + pDdiTable->pfnDisableMetricsExp = loader::zetDeviceDisableMetricsExp; } else { @@ -2808,6 +2889,73 @@ zetGetCommandListProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's CommandListExp table +/// with current process' addresses +/// +/// @returns +/// - ::ZE_RESULT_SUCCESS +/// - ::ZE_RESULT_ERROR_UNINITIALIZED +/// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION +ZE_DLLEXPORT ze_result_t ZE_APICALL +zetGetCommandListExpProcAddrTable( + ze_api_version_t version, ///< [in] API version requested + zet_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) +{ + if( loader::context->zeDrivers.size() < 1 ) { + return ZE_RESULT_ERROR_UNINITIALIZED; + } + + if( nullptr == pDdiTable ) + return ZE_RESULT_ERROR_INVALID_NULL_POINTER; + + if( loader::context->version < version ) + return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; + + ze_result_t result = ZE_RESULT_SUCCESS; + + // Load the device-driver DDI tables + for( auto& drv : loader::context->zeDrivers ) + { + if(drv.initStatus != ZE_RESULT_SUCCESS) + continue; + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR( drv.handle, "zetGetCommandListExpProcAddrTable") ); + if(!getTable) + continue; + result = getTable( version, &drv.dditable.zet.CommandListExp); + } + + + if( ZE_RESULT_SUCCESS == result ) + { + if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) + { + // return pointers to loader's DDIs + pDdiTable->pfnAppendMarkerExp = loader::zetCommandListAppendMarkerExp; + } + else + { + // return pointers directly to driver's DDIs + *pDdiTable = loader::context->zeDrivers.front().dditable.zet.CommandListExp; + } + } + + // If the validation layer is enabled, then intercept the loader's DDIs + if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) + { + auto getTable = reinterpret_cast( + GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetCommandListExpProcAddrTable") ); + if(!getTable) + return ZE_RESULT_ERROR_UNINITIALIZED; + result = getTable( version, pDdiTable ); + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses