Skip to content

Commit

Permalink
Change sub-device discovery mechanism in pool_descriptor::create()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kswiecicki committed Nov 14, 2023
1 parent ef05bd7 commit f2f2ea6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/common/ur_pool_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ urGetSubDevices(ur_device_handle_t hDevice) {
}

ur_device_partition_property_t prop;
prop.type = UR_DEVICE_PARTITION_EQUALLY;
prop.value.equally = nComputeUnits;
prop.type = UR_DEVICE_PARTITION_BY_CSLICE;
prop.value.affinity_domain = 0;

ur_device_partition_properties_t properties{
UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES,
Expand Down Expand Up @@ -117,6 +117,11 @@ urGetAllDevicesAndSubDevices(ur_context_handle_t hContext) {
for (size_t i = 0; i < deviceCount; i++) {
ret = addPoolsForDevicesRec(devices[i]);
if (ret != UR_RESULT_SUCCESS) {
if (ret == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
// Return main devices when sub-devices are unsupported.
return {ret, std::move(devices)};
}

return {ret, {}};
}
}
Expand Down

0 comments on commit f2f2ea6

Please sign in to comment.