diff --git a/sycl/source/detail/allowlist.cpp b/sycl/source/detail/allowlist.cpp index c1600b3f68b49..c6d6150a7a9a3 100644 --- a/sycl/source/detail/allowlist.cpp +++ b/sycl/source/detail/allowlist.cpp @@ -399,22 +399,7 @@ void applyAllowList(std::vector &UrDevices, Device, UR_DEVICE_INFO_TYPE, sizeof(UrDevType), &UrDevType, nullptr); // TODO need mechanism to do these casts, there's a bunch of this sort of // thing - sycl::info::device_type DeviceType = info::device_type::all; - switch (UrDevType) { - default: - case UR_DEVICE_TYPE_ALL: - DeviceType = info::device_type::all; - break; - case UR_DEVICE_TYPE_GPU: - DeviceType = info::device_type::gpu; - break; - case UR_DEVICE_TYPE_CPU: - DeviceType = info::device_type::cpu; - break; - case UR_DEVICE_TYPE_FPGA: - DeviceType = info::device_type::accelerator; - break; - } + sycl::info::device_type DeviceType = detail::ConvertDeviceType(UrDevType); for (const auto &SyclDeviceType : getSyclDeviceTypeMap()) { if (SyclDeviceType.second == DeviceType) { diff --git a/sycl/source/detail/device_impl.hpp b/sycl/source/detail/device_impl.hpp index 58e66c2678563..e46633d9fab45 100644 --- a/sycl/source/detail/device_impl.hpp +++ b/sycl/source/detail/device_impl.hpp @@ -64,6 +64,29 @@ ConvertAffinityDomain(const ur_device_affinity_domain_flags_t Domain) { } } +inline info::device_type ConvertDeviceType(ur_device_type_t UrDevType) { + switch (UrDevType) { + case UR_DEVICE_TYPE_DEFAULT: + return info::device_type::automatic; + case UR_DEVICE_TYPE_ALL: + return info::device_type::all; + case UR_DEVICE_TYPE_GPU: + return info::device_type::gpu; + case UR_DEVICE_TYPE_CPU: + return info::device_type::cpu; + case UR_DEVICE_TYPE_FPGA: + return info::device_type::accelerator; + case UR_DEVICE_TYPE_MCA: + case UR_DEVICE_TYPE_VPU: + case UR_DEVICE_TYPE_CUSTOM: + return info::device_type::custom; + default: + assert(false); + // FIXME: what is that??? + return info::device_type::custom; + } +} + // Note that UR's enums have weird *_FORCE_UINT32 values, we ignore them in the // callers. But we also can't write a fully-covered switch without mentioning it // there, which wouldn't make any sense. As such, ensure that "real" values @@ -582,27 +605,7 @@ class device_impl : public std::enable_shared_from_this { // device_traits.def CASE(info::device::device_type) { - using device_type = info::device_type; - switch (get_info_impl()) { - case UR_DEVICE_TYPE_DEFAULT: - return device_type::automatic; - case UR_DEVICE_TYPE_ALL: - return device_type::all; - case UR_DEVICE_TYPE_GPU: - return device_type::gpu; - case UR_DEVICE_TYPE_CPU: - return device_type::cpu; - case UR_DEVICE_TYPE_FPGA: - return device_type::accelerator; - case UR_DEVICE_TYPE_MCA: - case UR_DEVICE_TYPE_VPU: - return device_type::custom; - default: { - assert(false); - // FIXME: what is that??? - return device_type::custom; - } - } + return detail::ConvertDeviceType(get_info_impl()); } CASE(info::device::max_work_item_sizes<3>) { diff --git a/sycl/source/detail/platform_impl.cpp b/sycl/source/detail/platform_impl.cpp index 4f393a5620f78..a60f20d5dd78e 100644 --- a/sycl/source/detail/platform_impl.cpp +++ b/sycl/source/detail/platform_impl.cpp @@ -248,24 +248,7 @@ platform_impl::filterDeviceFilter(std::vector &UrDevices, MAdapter->call(Device, UR_DEVICE_INFO_TYPE, sizeof(ur_device_type_t), &UrDevType, nullptr); - // Assumption here is that there is 1-to-1 mapping between UrDevType and - // Sycl device type for GPU, CPU, and ACC. - info::device_type DeviceType = info::device_type::all; - switch (UrDevType) { - default: - case UR_DEVICE_TYPE_ALL: - DeviceType = info::device_type::all; - break; - case UR_DEVICE_TYPE_GPU: - DeviceType = info::device_type::gpu; - break; - case UR_DEVICE_TYPE_CPU: - DeviceType = info::device_type::cpu; - break; - case UR_DEVICE_TYPE_FPGA: - DeviceType = info::device_type::accelerator; - break; - } + info::device_type DeviceType = detail::ConvertDeviceType(UrDevType); for (const FilterT &Filter : FilterList->get()) { backend FilterBackend = Filter.Backend.value_or(backend::all); @@ -469,34 +452,56 @@ static std::vector amendDeviceAndSubDevices( std::vector platform_impl::get_devices(info::device_type DeviceType) const { std::vector Res; - - ods_target_list *OdsTargetList = SYCLConfig::get(); + // Host is no longer supported, so it returns an empty vector. if (DeviceType == info::device_type::host) + return std::vector{}; + + // For custom devices, UR has additional type enums. + if (DeviceType == info::device_type::custom) { + getDevicesImplHelper(UR_DEVICE_TYPE_CUSTOM, Res); + getDevicesImplHelper(UR_DEVICE_TYPE_MCA, Res); + getDevicesImplHelper(UR_DEVICE_TYPE_VPU, Res); + // Some backends may return the MCA and VPU types as part of custom, so + // remove duplicates. + std::sort(Res.begin(), Res.end(), + [](const sycl::device &D1, const sycl::device &D2) { + std::hash Hasher; + return Hasher(D1) < Hasher(D2); + }); + auto NewEnd = std::unique(Res.begin(), Res.end()); + Res.erase(NewEnd, Res.end()); return Res; - - ur_device_type_t UrDeviceType = UR_DEVICE_TYPE_ALL; - - switch (DeviceType) { - default: - case info::device_type::all: - UrDeviceType = UR_DEVICE_TYPE_ALL; - break; - case info::device_type::gpu: - UrDeviceType = UR_DEVICE_TYPE_GPU; - break; - case info::device_type::cpu: - UrDeviceType = UR_DEVICE_TYPE_CPU; - break; - case info::device_type::accelerator: - UrDeviceType = UR_DEVICE_TYPE_FPGA; - break; } + ur_device_type_t UrDeviceType = [DeviceType]() { + switch (DeviceType) { + case info::device_type::all: + return UR_DEVICE_TYPE_ALL; + case info::device_type::gpu: + return UR_DEVICE_TYPE_GPU; + case info::device_type::cpu: + return UR_DEVICE_TYPE_CPU; + case info::device_type::accelerator: + return UR_DEVICE_TYPE_FPGA; + case info::device_type::automatic: + return UR_DEVICE_TYPE_DEFAULT; + default: + throw sycl::exception(sycl::make_error_code(sycl::errc::invalid), + "Unknown device type."); + } + }(); + getDevicesImplHelper(UrDeviceType, Res); + return Res; +} + +void platform_impl::getDevicesImplHelper(ur_device_type_t UrDeviceType, + std::vector &OutVec) const { + size_t InitialOutVecSize = OutVec.size(); + uint32_t NumDevices = 0; MAdapter->call(MPlatform, UrDeviceType, 0u, // CP info::device_type::all nullptr, &NumDevices); - const backend Backend = getBackend(); if (NumDevices == 0) { // If platform doesn't have devices (even without filter) @@ -514,7 +519,7 @@ platform_impl::get_devices(info::device_type DeviceType) const { std::lock_guard Guard(*Adapter->getAdapterMutex()); Adapter->adjustLastDeviceId(MPlatform); } - return Res; + return; } std::vector UrDevices(NumDevices); @@ -532,6 +537,8 @@ platform_impl::get_devices(info::device_type DeviceType) const { if (SYCLConfig::get()) applyAllowList(UrDevices, MPlatform, *MAdapter); + ods_target_list *OdsTargetList = SYCLConfig::get(); + // The first step is to filter out devices that are not compatible with // ONEAPI_DEVICE_SELECTOR. This is also the mechanism by which top level // device ids are assigned. @@ -544,7 +551,7 @@ platform_impl::get_devices(info::device_type DeviceType) const { // The next step is to inflate the filtered UrDevices into SYCL Device // objects. platform_impl &PlatformImpl = getOrMakePlatformImpl(MPlatform, *MAdapter); - std::transform(UrDevices.begin(), UrDevices.end(), std::back_inserter(Res), + std::transform(UrDevices.begin(), UrDevices.end(), std::back_inserter(OutVec), [&PlatformImpl](const ur_device_handle_t UrDevice) -> device { return detail::createSyclObjFromImpl( PlatformImpl.getOrMakeDeviceImpl(UrDevice)); @@ -556,15 +563,15 @@ platform_impl::get_devices(info::device_type DeviceType) const { MAdapter->call(UrDev); // If we aren't using ONEAPI_DEVICE_SELECTOR, then we are done. - // and if there are no devices so far, there won't be any need to replace them + // and if there are no new devices, there won't be any need to replace them // with subdevices. - if (!OdsTargetList || Res.size() == 0) - return Res; + if (!OdsTargetList || OutVec.size() == InitialOutVecSize) + return; // Otherwise, our last step is to revisit the devices, possibly replacing // them with subdevices (which have been ignored until now) - return amendDeviceAndSubDevices(Backend, Res, OdsTargetList, - PlatformDeviceIndices, PlatformImpl); + OutVec = amendDeviceAndSubDevices(getBackend(), OutVec, OdsTargetList, + PlatformDeviceIndices, PlatformImpl); } bool platform_impl::has_extension(const std::string &ExtensionName) const { diff --git a/sycl/source/detail/platform_impl.hpp b/sycl/source/detail/platform_impl.hpp index b6057b9d5252f..adc2cb6c04a9a 100644 --- a/sycl/source/detail/platform_impl.hpp +++ b/sycl/source/detail/platform_impl.hpp @@ -203,6 +203,9 @@ class platform_impl : public std::enable_shared_from_this { private: device_impl *getDeviceImplHelper(ur_device_handle_t UrDevice); + void getDevicesImplHelper(ur_device_type_t UrDeviceType, + std::vector &OutVec) const; + // Helper to get the vector of platforms supported by a given UR adapter static std::vector getAdapterPlatforms(adapter_impl &Adapter, bool Supported = true); diff --git a/sycl/test-e2e/Basic/platform_get_devices.cpp b/sycl/test-e2e/Basic/platform_get_devices.cpp new file mode 100644 index 0000000000000..6db2caf34b972 --- /dev/null +++ b/sycl/test-e2e/Basic/platform_get_devices.cpp @@ -0,0 +1,135 @@ +// RUN: %{build} -Wno-deprecated-declarations -o %t.out +// RUN: %{run} %t.out +// +// Tests platform::get_devices for each device type. + +#include +#include +#include + +std::string BackendToString(sycl::backend Backend) { + switch (Backend) { + case sycl::backend::host: + return "host"; + case sycl::backend::opencl: + return "opencl"; + case sycl::backend::ext_oneapi_level_zero: + return "ext_oneapi_level_zero"; + case sycl::backend::ext_oneapi_cuda: + return "ext_oneapi_cuda"; + case sycl::backend::all: + return "all"; + case sycl::backend::ext_oneapi_hip: + return "ext_oneapi_hip"; + case sycl::backend::ext_oneapi_native_cpu: + return "ext_oneapi_native_cpu"; + case sycl::backend::ext_oneapi_offload: + return "ext_oneapi_offload"; + default: + return "UNKNOWN"; + } +} + +std::string DeviceTypeToString(sycl::info::device_type DevType) { + switch (DevType) { + case sycl::info::device_type::all: + return "device_type::all"; + case sycl::info::device_type::cpu: + return "device_type::cpu"; + case sycl::info::device_type::gpu: + return "device_type::gpu"; + case sycl::info::device_type::accelerator: + return "device_type::accelerator"; + case sycl::info::device_type::custom: + return "device_type::custom"; + case sycl::info::device_type::automatic: + return "device_type::automatic"; + case sycl::info::device_type::host: + return "device_type::host"; + default: + return "UNKNOWN"; + } +} + +template +int Check(const T1 &LHS, const T2 &RHS, std::string TestName) { + if (LHS != RHS) { + std::cout << "Failed check " << LHS << " != " << RHS << ": " << TestName + << std::endl; + return 1; + } + return 0; +} + +int CheckDeviceType(const sycl::platform &P, sycl::info::device_type DevType, + std::unordered_set &AllDevices) { + assert(DevType != sycl::info::device_type::all); + int Failures = 0; + + std::vector Devices = P.get_devices(DevType); + + if (DevType == sycl::info::device_type::automatic) { + if (AllDevices.empty()) { + Failures += Check( + Devices.size(), 0, + "No devices reported for all query, but automatic returns a device."); + } else { + Failures += Check(Devices.size(), 1, + "Number of devices for device_type::automatic query."); + if (Devices.size()) + Failures += + Check(AllDevices.count(Devices[0]), 1, + "Device is in the set of all devices in the platform."); + } + return Failures; + } + + // Count devices with the type; + size_t DevCount = 0; + for (sycl::device Device : Devices) + DevCount += (Device.get_info() == DevType); + + std::unordered_set UniqueDevices{Devices.begin(), + Devices.end()}; + Check(Devices.size(), UniqueDevices.size(), + "Duplicate devices for " + DeviceTypeToString(DevType)); + + Failures += + Check(Devices.size(), DevCount, + "Unexpected number of devices for " + DeviceTypeToString(DevType)); + + Failures += Check( + std::all_of(UniqueDevices.begin(), UniqueDevices.end(), + [&](const auto &Dev) { return AllDevices.count(Dev) == 1; }), + true, + "Not all devices for " + DeviceTypeToString(DevType) + + " appear in the list of all devices"); + + return Failures; +} + +int main() { + int Failures = 0; + for (sycl::platform P : sycl::platform::get_platforms()) { + std::cout << "Checking platform with backend " + << BackendToString(P.get_backend()) << std::endl; + + std::vector Devices = P.get_devices(); + std::unordered_set UniqueDevices{Devices.begin(), + Devices.end()}; + + if (Check(Devices.size(), UniqueDevices.size(), + "Duplicate devices for device_type::all")) { + ++Failures; + // Don't trust this platform, so we continue. + continue; + } + + for (sycl::info::device_type DevType : + {sycl::info::device_type::cpu, sycl::info::device_type::gpu, + sycl::info::device_type::accelerator, sycl::info::device_type::custom, + sycl::info::device_type::automatic, sycl::info::device_type::host}) + Failures += CheckDeviceType(P, DevType, UniqueDevices); + } + return Failures; +} diff --git a/unified-runtime/include/ur_api.h b/unified-runtime/include/ur_api.h index e6f814e178e8b..f70e9dbbc7beb 100644 --- a/unified-runtime/include/ur_api.h +++ b/unified-runtime/include/ur_api.h @@ -1908,6 +1908,8 @@ typedef enum ur_device_type_t { UR_DEVICE_TYPE_MCA = 6, /// Vision Processing Unit UR_DEVICE_TYPE_VPU = 7, + /// Generic custom device type + UR_DEVICE_TYPE_CUSTOM = 8, /// @cond UR_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -1940,7 +1942,7 @@ typedef enum ur_device_type_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_CUSTOM < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER @@ -1987,7 +1989,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_CUSTOM < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_VALUE UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetSelected( /// [in] handle of the platform instance diff --git a/unified-runtime/include/ur_print.hpp b/unified-runtime/include/ur_print.hpp index 17a8a5267efd9..9faf3e37f173c 100644 --- a/unified-runtime/include/ur_print.hpp +++ b/unified-runtime/include/ur_print.hpp @@ -2609,6 +2609,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value) { case UR_DEVICE_TYPE_VPU: os << "UR_DEVICE_TYPE_VPU"; break; + case UR_DEVICE_TYPE_CUSTOM: + os << "UR_DEVICE_TYPE_CUSTOM"; + break; default: os << "unknown enumerator"; break; diff --git a/unified-runtime/scripts/core/device.yml b/unified-runtime/scripts/core/device.yml index 7bef8a45a5bc7..2ad5a2171f490 100644 --- a/unified-runtime/scripts/core/device.yml +++ b/unified-runtime/scripts/core/device.yml @@ -108,6 +108,8 @@ etors: desc: "Memory Copy Accelerator" - name: VPU desc: "Vision Processing Unit" + - name: CUSTOM + desc: "Generic custom device type" --- #-------------------------------------------------------------------------- type: function desc: "Retrieves devices within a platform" diff --git a/unified-runtime/scripts/core/manifests.yml b/unified-runtime/scripts/core/manifests.yml index 875d47ded9f03..b380469a9e536 100644 --- a/unified-runtime/scripts/core/manifests.yml +++ b/unified-runtime/scripts/core/manifests.yml @@ -23,6 +23,7 @@ device_types: - $X_DEVICE_TYPE_FPGA - $X_DEVICE_TYPE_MCA - $X_DEVICE_TYPE_VPU + - $X_DEVICE_TYPE_CUSTOM --- #-------------------------------------------------------------------------- type: manifest name: cuda diff --git a/unified-runtime/source/adapters/level_zero/device.cpp b/unified-runtime/source/adapters/level_zero/device.cpp index 5410125ede43c..0b0db4d6341a2 100644 --- a/unified-runtime/source/adapters/level_zero/device.cpp +++ b/unified-runtime/source/adapters/level_zero/device.cpp @@ -155,8 +155,13 @@ ur_result_t urDeviceGet( bool isComposite = isCombinedMode && (D->ZeDeviceProperties->flags & ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE) == 0; - if (!isComposite) + if (!isComposite) { MatchedDevices.push_back(D.get()); + // For UR_DEVICE_TYPE_DEFAULT only a single device should be returned, + // so exit the loop after first proper match. + if (DeviceType == UR_DEVICE_TYPE_DEFAULT) + break; + } } } diff --git a/unified-runtime/source/adapters/opencl/device.cpp b/unified-runtime/source/adapters/opencl/device.cpp index 9c9c82ea47bf4..4f697b05b5c88 100644 --- a/unified-runtime/source/adapters/opencl/device.cpp +++ b/unified-runtime/source/adapters/opencl/device.cpp @@ -36,6 +36,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, case UR_DEVICE_TYPE_VPU: Type = CL_DEVICE_TYPE_ACCELERATOR; break; + case UR_DEVICE_TYPE_CUSTOM: + Type = CL_DEVICE_TYPE_CUSTOM; + break; case UR_DEVICE_TYPE_DEFAULT: Type = CL_DEVICE_TYPE_DEFAULT; break; @@ -47,11 +50,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, uint32_t DeviceNumIter = 0; for (uint32_t i = 0; i < AllDevicesNum; i++) { cl_device_type DevTy = hPlatform->Devices[i]->Type; - if (DevTy == Type || Type == CL_DEVICE_TYPE_ALL) { + if (DevTy == Type || Type == CL_DEVICE_TYPE_ALL || + Type == CL_DEVICE_TYPE_DEFAULT) { if (phDevices) { phDevices[DeviceNumIter] = hPlatform->Devices[i].get(); } DeviceNumIter++; + // For default, the first device is the only returned device. + if (Type == CL_DEVICE_TYPE_DEFAULT) + break; } } if (pNumDevices) { @@ -141,6 +148,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, URDeviceType = UR_DEVICE_TYPE_GPU; } else if (CLType & CL_DEVICE_TYPE_ACCELERATOR) { URDeviceType = UR_DEVICE_TYPE_FPGA; + } else if (CLType & CL_DEVICE_TYPE_CUSTOM) { + URDeviceType = UR_DEVICE_TYPE_CUSTOM; } return ReturnValue(URDeviceType); diff --git a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp index 82e898fab80a7..32dec6f1b25df 100644 --- a/unified-runtime/source/loader/layers/validation/ur_valddi.cpp +++ b/unified-runtime/source/loader/layers/validation/ur_valddi.cpp @@ -513,7 +513,7 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( if (NULL == hPlatform) return UR_RESULT_ERROR_INVALID_NULL_HANDLE; - if (UR_DEVICE_TYPE_VPU < DeviceType) + if (UR_DEVICE_TYPE_CUSTOM < DeviceType) return UR_RESULT_ERROR_INVALID_ENUMERATION; if (NumEntries == 0 && phDevices != NULL) diff --git a/unified-runtime/source/loader/ur_lib.cpp b/unified-runtime/source/loader/ur_lib.cpp index e186f188f2a51..ce1c131245678 100644 --- a/unified-runtime/source/loader/ur_lib.cpp +++ b/unified-runtime/source/loader/ur_lib.cpp @@ -275,6 +275,7 @@ ur_result_t urDeviceGetSelected(ur_platform_handle_t hPlatform, case UR_DEVICE_TYPE_CPU: case UR_DEVICE_TYPE_FPGA: case UR_DEVICE_TYPE_MCA: + case UR_DEVICE_TYPE_CUSTOM: break; default: return UR_RESULT_ERROR_INVALID_ENUMERATION; diff --git a/unified-runtime/source/loader/ur_libapi.cpp b/unified-runtime/source/loader/ur_libapi.cpp index a7559029e2743..4ec2282647e80 100644 --- a/unified-runtime/source/loader/ur_libapi.cpp +++ b/unified-runtime/source/loader/ur_libapi.cpp @@ -826,7 +826,7 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_CUSTOM < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER @@ -881,7 +881,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_CUSTOM < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGetSelected( /// [in] handle of the platform instance diff --git a/unified-runtime/source/loader/ur_manifests.hpp b/unified-runtime/source/loader/ur_manifests.hpp index 3e672c0744c56..c376ab26a4a39 100644 --- a/unified-runtime/source/loader/ur_manifests.hpp +++ b/unified-runtime/source/loader/ur_manifests.hpp @@ -40,6 +40,7 @@ const std::vector ur_adapter_manifests = { UR_DEVICE_TYPE_FPGA, UR_DEVICE_TYPE_MCA, UR_DEVICE_TYPE_VPU, + UR_DEVICE_TYPE_CUSTOM, }}, {"cuda", MAKE_LIBRARY_NAME("ur_adapter_cuda", "0"), diff --git a/unified-runtime/source/ur_api.cpp b/unified-runtime/source/ur_api.cpp index 47094964055fb..8e3424b693e62 100644 --- a/unified-runtime/source/ur_api.cpp +++ b/unified-runtime/source/ur_api.cpp @@ -740,7 +740,7 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_CUSTOM < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER @@ -790,7 +790,7 @@ ur_result_t UR_APICALL urDeviceGet( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// + `::UR_DEVICE_TYPE_CUSTOM < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGetSelected( /// [in] handle of the platform instance diff --git a/unified-runtime/test/conformance/device/urDeviceGet.cpp b/unified-runtime/test/conformance/device/urDeviceGet.cpp index ad3c0d3c3d751..35ef449df7e25 100644 --- a/unified-runtime/test/conformance/device/urDeviceGet.cpp +++ b/unified-runtime/test/conformance/device/urDeviceGet.cpp @@ -87,7 +87,8 @@ UUR_PLATFORM_TEST_SUITE_WITH_PARAM( urDeviceGetTestWithDeviceTypeParam, ::testing::Values(UR_DEVICE_TYPE_DEFAULT, UR_DEVICE_TYPE_GPU, UR_DEVICE_TYPE_CPU, UR_DEVICE_TYPE_FPGA, - UR_DEVICE_TYPE_MCA, UR_DEVICE_TYPE_VPU), + UR_DEVICE_TYPE_MCA, UR_DEVICE_TYPE_VPU, + UR_DEVICE_TYPE_CUSTOM), uur::platformTestWithParamPrinter); TEST_P(urDeviceGetTestWithDeviceTypeParam, Success) {