Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
38 changes: 31 additions & 7 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
///
Expand Down Expand Up @@ -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
Expand All @@ -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
);

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion include/ur_ddi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*
);

Expand Down
5 changes: 5 additions & 0 deletions scripts/core/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
36 changes: 31 additions & 5 deletions scripts/core/queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 6 additions & 3 deletions source/drivers/null/ur_nullddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
{
Expand All @@ -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
{
Expand Down
9 changes: 6 additions & 3 deletions source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
{
Expand All @@ -2042,7 +2045,7 @@ namespace loader
hDevice = reinterpret_cast<ur_device_object_t*>( 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;
Expand Down
14 changes: 8 additions & 6 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -1904,16 +1903,19 @@ 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
)
{
auto pfnCreate = ur_lib::context->urDdiTable.Queue.pfnCreate;
if( nullptr == pfnCreate )
return UR_RESULT_ERROR_UNINITIALIZED;

return pfnCreate( hContext, hDevice, props, phQueue );
return pfnCreate( hContext, hDevice, pProps, phQueue );
}

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
{
Expand Down Expand Up @@ -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
Expand Down