From f2f2ea65428c97123d3fd6de53a1121b44758890 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Wed, 27 Sep 2023 18:38:52 +0200 Subject: [PATCH] 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. --- source/common/ur_pool_manager.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/common/ur_pool_manager.hpp b/source/common/ur_pool_manager.hpp index 6e70c29e21..2215bd0575 100644 --- a/source/common/ur_pool_manager.hpp +++ b/source/common/ur_pool_manager.hpp @@ -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, @@ -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, {}}; } }