diff --git a/include/ur.py b/include/ur.py index 0cc752a142..207a902770 100644 --- a/include/ur.py +++ b/include/ur.py @@ -509,7 +509,7 @@ def __str__(self): ############################################################################### -## @brief Queue properties +## @brief Queue property flags class ur_queue_flags_v(IntEnum): OUT_OF_ORDER_EXEC_MODE_ENABLE = UR_BIT(0) ## Enable/disable out of order execution PROFILING_ENABLE = UR_BIT(1) ## Enable/disable profiling @@ -521,6 +521,25 @@ def __str__(self): return hex(self.value) +############################################################################### +## @brief Queue Properties +class ur_queue_properties_v(IntEnum): + FLAGS = -1 ## [::ur_queue_flags_t]: the bitfield of queue flags + COMPUTE_INDEX = -2 ## [uint32_t]: the queue index + +class ur_queue_properties_t(c_int): + def __str__(self): + return str(ur_queue_properties_v(self.value)) + + +############################################################################### +## @brief Queue property value +class ur_queue_property_value_t(Structure): + _fields_ = [ + ("propertyType", ur_queue_properties_t), ## [in] queue property + ("propertyValue", c_ulong) ## [in] queue property value + ] + ############################################################################### ## @brief Get sample object information class ur_sampler_info_v(IntEnum): @@ -711,6 +730,9 @@ class ur_device_info_v(IntEnum): ATOMIC_64 = 96 ## bool: support 64 bit atomics ATOMIC_MEMORY_ORDER_CAPABILITIES = 97 ## uint32_t: atomics memory order capabilities BFLOAT16 = 98 ## bool: support for bfloat16 + MAX_COMPUTE_QUEUE_INDICES = 99 ## uint32_t: Returns 1 if the device doesn't have a notion of a + ## queue index. Otherwise, returns the number of queue indices that are + ## available for this device. class ur_device_info_t(c_int): def __str__(self): @@ -1789,9 +1811,9 @@ class ur_global_dditable_t(Structure): ############################################################################### ## @brief Function-pointer for urQueueCreate if __use_win_types: - _urQueueCreate_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, ur_queue_flags_t, POINTER(ur_queue_handle_t) ) + _urQueueCreate_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, POINTER(ur_queue_property_value_t), POINTER(ur_queue_handle_t) ) else: - _urQueueCreate_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, ur_queue_flags_t, POINTER(ur_queue_handle_t) ) + _urQueueCreate_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, ur_device_handle_t, POINTER(ur_queue_property_value_t), POINTER(ur_queue_handle_t) ) ############################################################################### ## @brief Function-pointer for urQueueRetain diff --git a/include/ur_api.h b/include/ur_api.h index 47a768e659..9984012346 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -2085,7 +2085,7 @@ typedef enum ur_queue_info_t } ur_queue_info_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Queue properties +/// @brief Queue property flags typedef uint32_t ur_queue_flags_t; typedef enum ur_queue_flag_t { @@ -2097,6 +2097,25 @@ typedef enum ur_queue_flag_t } ur_queue_flag_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Queue Properties +typedef enum ur_queue_properties_t +{ + UR_QUEUE_PROPERTIES_FLAGS = -1, ///< [::ur_queue_flags_t]: the bitfield of queue flags + UR_QUEUE_PROPERTIES_COMPUTE_INDEX = -2, ///< [uint32_t]: the queue index + UR_QUEUE_PROPERTIES_FORCE_UINT32 = 0x7fffffff + +} ur_queue_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Queue property value +typedef struct ur_queue_property_value_t +{ + ur_queue_properties_t propertyType; ///< [in] queue property + uint32_t propertyValue; ///< [in] queue property value + +} ur_queue_property_value_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Query information about a command queue /// @@ -2142,9 +2161,8 @@ urQueueGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` -/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `0xf < props` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pProps` /// + `NULL == phQueue` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_DEVICE @@ -2156,8 +2174,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_queue_flags_t props, ///< [in] initialization properties. - ///< must be 0 (default) or a combination of ::ur_queue_flags_t. + ur_queue_property_value_t* pProps, ///< [in] specifies a list of queue properties and their corresponding values. + ///< Each property name is immediately followed by the corresponding + ///< desired value. + ///< The list is terminated with a 0. + ///< If a property value is not specified, then its default value will be used. ur_queue_handle_t* phQueue ///< [out] pointer to handle of queue object created ); @@ -2863,6 +2884,9 @@ typedef enum ur_device_info_t UR_DEVICE_INFO_ATOMIC_64 = 96, ///< bool: support 64 bit atomics UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES = 97, ///< uint32_t: atomics memory order capabilities UR_DEVICE_INFO_BFLOAT16 = 98, ///< bool: support for bfloat16 + UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES = 99, ///< uint32_t: Returns 1 if the device doesn't have a notion of a + ///< queue index. Otherwise, returns the number of queue indices that are + ///< available for this device. UR_DEVICE_INFO_FORCE_UINT32 = 0x7fffffff } ur_device_info_t; @@ -2885,7 +2909,7 @@ typedef enum ur_device_info_t /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_BFLOAT16 < infoType` +/// + `::UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES < infoType` UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( ur_device_handle_t hDevice, ///< [in] handle of the device instance @@ -6755,7 +6779,7 @@ typedef struct ur_queue_create_params_t { ur_context_handle_t* phContext; ur_device_handle_t* phDevice; - ur_queue_flags_t* pprops; + ur_queue_property_value_t** ppProps; ur_queue_handle_t** pphQueue; } ur_queue_create_params_t; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index dfc107cf4a..759303faab 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1275,7 +1275,7 @@ typedef ur_result_t (UR_APICALL *ur_pfnQueueGetInfo_t)( typedef ur_result_t (UR_APICALL *ur_pfnQueueCreate_t)( ur_context_handle_t, ur_device_handle_t, - ur_queue_flags_t, + ur_queue_property_value_t*, ur_queue_handle_t* ); diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 7444860182..c428806da7 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -275,6 +275,11 @@ etors: desc: "uint32_t: atomics memory order capabilities" - name: BFLOAT16 desc: "bool: support for bfloat16" + - name: MAX_COMPUTE_QUEUE_INDICES + desc: | + uint32_t: Returns 1 if the device doesn't have a notion of a + queue index. Otherwise, returns the number of queue indices that are + available for this device. --- #-------------------------------------------------------------------------- type: function desc: "Retrieves various information about device" diff --git a/scripts/core/queue.yml b/scripts/core/queue.yml index 11adf5007d..603571369a 100644 --- a/scripts/core/queue.yml +++ b/scripts/core/queue.yml @@ -29,7 +29,7 @@ etors: desc: "Queue size info" --- #-------------------------------------------------------------------------- type: enum -desc: "Queue properties" +desc: "Queue property flags" class: $xQueue name: $x_queue_flags_t etors: @@ -46,6 +46,30 @@ etors: value: "$X_BIT(3)" desc: "Is the default queue for a device" --- #-------------------------------------------------------------------------- +type: enum +desc: "Queue Properties" +class: $xQueue +name: $x_queue_properties_t +etors: + - name: FLAGS + value: "-1" + desc: "[$x_queue_flags_t]: the bitfield of queue flags" + - name: COMPUTE_INDEX + value: "-2" + desc: "[uint32_t]: the queue index" +--- #-------------------------------------------------------------------------- +type: struct +desc: "Queue property value" +class: $xQueue +name: $x_queue_property_value_t +members: + - type: $x_queue_properties_t + name: propertyType + desc: "[in] queue property" + - type: uint32_t + name: propertyValue + desc: "[in] queue property value" +--- #-------------------------------------------------------------------------- type: function desc: "Query information about a command queue" class: $xQueue @@ -90,11 +114,13 @@ params: - type: $x_device_handle_t name: hDevice desc: "[in] handle of the device object" - - type: $x_queue_flags_t - name: props + - type: $x_queue_property_value_t* + name: pProps desc: | - [in] initialization properties. - must be 0 (default) or a combination of $x_queue_flags_t. + [in] specifies a list of queue properties and their corresponding values. + Each property name is immediately followed by the corresponding desired value. + The list is terminated with a 0. + If a property value is not specified, then its default value will be used. - type: $x_queue_handle_t* name: phQueue desc: "[out] pointer to handle of queue object created" diff --git a/source/drivers/null/ur_nullddi.cpp b/source/drivers/null/ur_nullddi.cpp index 49ba7cf5f1..1aabb9ae89 100644 --- a/source/drivers/null/ur_nullddi.cpp +++ b/source/drivers/null/ur_nullddi.cpp @@ -1454,8 +1454,11 @@ namespace driver urQueueCreate( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_queue_flags_t props, ///< [in] initialization properties. - ///< must be 0 (default) or a combination of ::ur_queue_flags_t. + ur_queue_property_value_t* pProps, ///< [in] specifies a list of queue properties and their corresponding values. + ///< Each property name is immediately followed by the corresponding + ///< desired value. + ///< The list is terminated with a 0. + ///< If a property value is not specified, then its default value will be used. ur_queue_handle_t* phQueue ///< [out] pointer to handle of queue object created ) { @@ -1465,7 +1468,7 @@ namespace driver auto pfnCreate = d_context.urDdiTable.Queue.pfnCreate; if( nullptr != pfnCreate ) { - result = pfnCreate( hContext, hDevice, props, phQueue ); + result = pfnCreate( hContext, hDevice, pProps, phQueue ); } else { diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index ac248b8b83..a857c46cd5 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -2022,8 +2022,11 @@ namespace loader urQueueCreate( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_queue_flags_t props, ///< [in] initialization properties. - ///< must be 0 (default) or a combination of ::ur_queue_flags_t. + ur_queue_property_value_t* pProps, ///< [in] specifies a list of queue properties and their corresponding values. + ///< Each property name is immediately followed by the corresponding + ///< desired value. + ///< The list is terminated with a 0. + ///< If a property value is not specified, then its default value will be used. ur_queue_handle_t* phQueue ///< [out] pointer to handle of queue object created ) { @@ -2042,7 +2045,7 @@ namespace loader hDevice = reinterpret_cast( hDevice )->handle; // forward to device-platform - result = pfnCreate( hContext, hDevice, props, phQueue ); + result = pfnCreate( hContext, hDevice, pProps, phQueue ); if( UR_RESULT_SUCCESS != result ) return result; diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index f84c6abfea..18438a851a 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -1890,9 +1890,8 @@ urQueueGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` -/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `0xf < props` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pProps` /// + `NULL == phQueue` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_DEVICE @@ -1904,8 +1903,11 @@ ur_result_t UR_APICALL urQueueCreate( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_queue_flags_t props, ///< [in] initialization properties. - ///< must be 0 (default) or a combination of ::ur_queue_flags_t. + ur_queue_property_value_t* pProps, ///< [in] specifies a list of queue properties and their corresponding values. + ///< Each property name is immediately followed by the corresponding + ///< desired value. + ///< The list is terminated with a 0. + ///< If a property value is not specified, then its default value will be used. ur_queue_handle_t* phQueue ///< [out] pointer to handle of queue object created ) { @@ -1913,7 +1915,7 @@ urQueueCreate( if( nullptr == pfnCreate ) return UR_RESULT_ERROR_UNINITIALIZED; - return pfnCreate( hContext, hDevice, props, phQueue ); + return pfnCreate( hContext, hDevice, pProps, phQueue ); } /////////////////////////////////////////////////////////////////////////////// @@ -2553,7 +2555,7 @@ urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_BFLOAT16 < infoType` +/// + `::UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES < infoType` ur_result_t UR_APICALL urDeviceGetInfo( ur_device_handle_t hDevice, ///< [in] handle of the device instance diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 99710ae1db..4f47c18b00 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -1752,9 +1752,8 @@ urQueueGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` -/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `0xf < props` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pProps` /// + `NULL == phQueue` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_DEVICE @@ -1766,8 +1765,11 @@ ur_result_t UR_APICALL urQueueCreate( ur_context_handle_t hContext, ///< [in] handle of the context object ur_device_handle_t hDevice, ///< [in] handle of the device object - ur_queue_flags_t props, ///< [in] initialization properties. - ///< must be 0 (default) or a combination of ::ur_queue_flags_t. + ur_queue_property_value_t* pProps, ///< [in] specifies a list of queue properties and their corresponding values. + ///< Each property name is immediately followed by the corresponding + ///< desired value. + ///< The list is terminated with a 0. + ///< If a property value is not specified, then its default value will be used. ur_queue_handle_t* phQueue ///< [out] pointer to handle of queue object created ) { @@ -2358,7 +2360,7 @@ urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_INFO_BFLOAT16 < infoType` +/// + `::UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES < infoType` ur_result_t UR_APICALL urDeviceGetInfo( ur_device_handle_t hDevice, ///< [in] handle of the device instance