Skip to content

Commit 0657f06

Browse files
committed
Change sub-device discovery mechanism in pool_descriptor::create()
Currently, only the UR L0 adapter supports urDevicePartition function and it does not support partition type UR_DEVICE_PARTITION_EQUALLY. After this change, pool_descriptor::create() returns pool descriptors for main devices when sub-devices are unavailable instead of returning error. Also, the device partition type used for retrieving sub-devices was changed to UR_DEVICE_PARTITION_BY_CSLICE.
1 parent 8c56438 commit 0657f06

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

source/common/ur_pool_manager.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ urGetSubDevices(ur_device_handle_t hDevice) {
5252
}
5353

5454
ur_device_partition_property_t prop;
55-
prop.type = UR_DEVICE_PARTITION_EQUALLY;
56-
prop.value.equally = nComputeUnits;
55+
prop.type = UR_DEVICE_PARTITION_BY_CSLICE;
56+
prop.value.affinity_domain = 0;
5757

5858
ur_device_partition_properties_t properties{
5959
UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES,
@@ -117,6 +117,11 @@ urGetAllDevicesAndSubDevices(ur_context_handle_t hContext) {
117117
for (size_t i = 0; i < deviceCount; i++) {
118118
ret = addPoolsForDevicesRec(devices[i]);
119119
if (ret != UR_RESULT_SUCCESS) {
120+
if (ret == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
121+
// Return main devices when sub-devices are unsupported.
122+
return {ret, std::move(devices)};
123+
}
124+
120125
return {ret, {}};
121126
}
122127
}

0 commit comments

Comments
 (0)