From 89aa72cc0109ec1ed930c78019b76af0166dadc0 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, {}}; } }