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
100 changes: 63 additions & 37 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class ur_structure_type_v(IntEnum):
PROGRAM_NATIVE_PROPERTIES = 23 ## ::ur_program_native_properties_t
SAMPLER_NATIVE_PROPERTIES = 24 ## ::ur_sampler_native_properties_t
QUEUE_NATIVE_DESC = 25 ## ::ur_queue_native_desc_t
DEVICE_PARTITION_PROPERTIES = 26 ## ::ur_device_partition_properties_t

class ur_structure_type_t(c_int):
def __str__(self):
Expand Down Expand Up @@ -502,8 +503,8 @@ class ur_device_info_v(IntEnum):
PREFERRED_INTEROP_USER_SYNC = 74 ## [::ur_bool_t] prefer user synchronization when sharing object with
## other API
PARENT_DEVICE = 75 ## [::ur_device_handle_t] return parent device handle
PARTITION_PROPERTIES = 76 ## [::ur_device_partition_property_t[]] Returns an array of partition
## types supported by the device
SUPPORTED_PARTITIONS = 76 ## [::ur_device_partition_t[]] Returns an array of partition types
## supported by the device
PARTITION_MAX_SUB_DEVICES = 77 ## [uint32_t] maximum number of sub-devices when the device is
## partitioned
PARTITION_AFFINITY_DOMAIN = 78 ## [::ur_device_affinity_domain_flags_t] Returns a bit-field of the
Expand Down Expand Up @@ -569,16 +570,39 @@ def __str__(self):


###############################################################################
## @brief Device partition property type
class ur_device_partition_property_t(c_intptr_t):
pass
## @brief Device affinity domain
class ur_device_affinity_domain_flags_v(IntEnum):
NUMA = UR_BIT(0) ## Split the device into sub devices comprised of compute units that
## share a NUMA node.
L4_CACHE = UR_BIT(1) ## Split the device into sub devices comprised of compute units that
## share a level 4 data cache.
L3_CACHE = UR_BIT(2) ## Split the device into sub devices comprised of compute units that
## share a level 3 data cache.
L2_CACHE = UR_BIT(3) ## Split the device into sub devices comprised of compute units that
## share a level 2 data cache.
L1_CACHE = UR_BIT(4) ## Split the device into sub devices comprised of compute units that
## share a level 1 data cache.
NEXT_PARTITIONABLE = UR_BIT(5) ## Split the device along the next partitionable affinity domain.
## The implementation shall find the first level along which the device
## or sub device may be further subdivided in the order:
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE,
## and partition the device into sub devices comprised of compute units
## that share memory subsystems at this level.

class ur_device_affinity_domain_flags_t(c_int):
def __str__(self):
return hex(self.value)


###############################################################################
## @brief Partition Properties
class ur_device_partition_v(IntEnum):
EQUALLY = 0x1086 ## Partition Equally
BY_COUNTS = 0x1087 ## Partition by counts
BY_COUNTS_LIST_END = 0x0 ## End of by counts list
BY_AFFINITY_DOMAIN = 0x1088 ## Partition by affinity domain
BY_CSLICE = 0x1089 ## Partition by c-slice

Expand All @@ -587,6 +611,37 @@ def __str__(self):
return str(ur_device_partition_v(self.value))


###############################################################################
## @brief Device partition value.
class ur_device_partition_value_t(Structure):
_fields_ = [
("equally", c_ulong), ## [in] Number of compute units per sub-device when partitioning with
## ::UR_DEVICE_PARTITION_EQUALLY.
("count", c_ulong), ## [in] Number of compute units in a sub-device when partitioning with
## ::UR_DEVICE_PARTITION_BY_COUNTS.
("affinity_domain", ur_device_affinity_domain_flags_t) ## [in] The affinity domain to partition for when partitioning with
## $UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN.
]

###############################################################################
## @brief Device partition property
class ur_device_partition_property_t(Structure):
_fields_ = [
("type", ur_device_partition_t), ## [in] The partitioning type to be used.
("value", ur_device_partition_value_t) ## [in] The paritioning value.
]

###############################################################################
## @brief Device Partition Properties
class ur_device_partition_properties_t(Structure):
_fields_ = [
("stype", ur_structure_type_t), ## [in] type of this structure, must be
## ::UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES
("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure
("pProperties", POINTER(ur_device_partition_property_t)), ## [in] Pointer to the beginning of the properties array.
("PropCount", c_size_t) ## [in] The length of properties pointed to by `pProperties`.
]

###############################################################################
## @brief FP capabilities
class ur_device_fp_capability_flags_v(IntEnum):
Expand Down Expand Up @@ -639,35 +694,6 @@ def __str__(self):
return hex(self.value)


###############################################################################
## @brief Device affinity domain
class ur_device_affinity_domain_flags_v(IntEnum):
NUMA = UR_BIT(0) ## Split the device into sub devices comprised of compute units that
## share a NUMA node.
L4_CACHE = UR_BIT(1) ## Split the device into sub devices comprised of compute units that
## share a level 4 data cache.
L3_CACHE = UR_BIT(2) ## Split the device into sub devices comprised of compute units that
## share a level 3 data cache.
L2_CACHE = UR_BIT(3) ## Split the device into sub devices comprised of compute units that
## share a level 2 data cache.
L1_CACHE = UR_BIT(4) ## Split the device into sub devices comprised of compute units that
## share a level 1 data cache.
NEXT_PARTITIONABLE = UR_BIT(5) ## Split the device along the next partitionable affinity domain.
## The implementation shall find the first level along which the device
## or sub device may be further subdivided in the order:
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE,
## ::UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE,
## and partition the device into sub devices comprised of compute units
## that share memory subsystems at this level.

class ur_device_affinity_domain_flags_t(c_int):
def __str__(self):
return hex(self.value)


###############################################################################
## @brief Native device creation properties
class ur_device_native_properties_t(Structure):
Expand Down Expand Up @@ -2805,9 +2831,9 @@ class ur_usm_dditable_t(Structure):
###############################################################################
## @brief Function-pointer for urDevicePartition
if __use_win_types:
_urDevicePartition_t = WINFUNCTYPE( ur_result_t, ur_device_handle_t, POINTER(ur_device_partition_property_t), c_ulong, POINTER(ur_device_handle_t), POINTER(c_ulong) )
_urDevicePartition_t = WINFUNCTYPE( ur_result_t, ur_device_handle_t, POINTER(ur_device_partition_properties_t), c_ulong, POINTER(ur_device_handle_t), POINTER(c_ulong) )
else:
_urDevicePartition_t = CFUNCTYPE( ur_result_t, ur_device_handle_t, POINTER(ur_device_partition_property_t), c_ulong, POINTER(ur_device_handle_t), POINTER(c_ulong) )
_urDevicePartition_t = CFUNCTYPE( ur_result_t, ur_device_handle_t, POINTER(ur_device_partition_properties_t), c_ulong, POINTER(ur_device_handle_t), POINTER(c_ulong) )

###############################################################################
## @brief Function-pointer for urDeviceSelectBinary
Expand Down
Loading