diff --git a/source/adapters/cuda/usm.cpp b/source/adapters/cuda/usm.cpp index 4e6c6898d5..a7b3a60eac 100644 --- a/source/adapters/cuda/usm.cpp +++ b/source/adapters/cuda/usm.cpp @@ -258,16 +258,13 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem, CU_POINTER_ATTRIBUTE_DEVICE_ORDINAL, (CUdeviceptr)pMem)); - // currently each device is in its own platform, so find the platform at - // the same index - std::vector Platforms; - Platforms.resize(DeviceIndex + 1); + // cuda backend has only one platform containing all devices + ur_platform_handle_t platform; ur_adapter_handle_t AdapterHandle = &adapter; - Result = urPlatformGet(&AdapterHandle, 1, DeviceIndex + 1, - Platforms.data(), nullptr); + Result = urPlatformGet(&AdapterHandle, 1, 1, &platform, nullptr); // get the device from the platform - ur_device_handle_t Device = Platforms[DeviceIndex]->Devices[0].get(); + ur_device_handle_t Device = platform->Devices[DeviceIndex].get(); return ReturnValue(Device); } case UR_USM_ALLOC_INFO_POOL: { diff --git a/source/adapters/hip/usm.cpp b/source/adapters/hip/usm.cpp index e871f394f2..f5df79cd7f 100644 --- a/source/adapters/hip/usm.cpp +++ b/source/adapters/hip/usm.cpp @@ -207,16 +207,13 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem, int DeviceIdx = hipPointerAttributeType.device; - // currently each device is in its own platform, so find the platform at - // the same index - std::vector Platforms; - Platforms.resize(DeviceIdx + 1); + // hip backend has only one platform containing all devices + ur_platform_handle_t platform; ur_adapter_handle_t AdapterHandle = &adapter; - Result = urPlatformGet(&AdapterHandle, 1, DeviceIdx + 1, Platforms.data(), - nullptr); + Result = urPlatformGet(&AdapterHandle, 1, 1, &platform, nullptr); // get the device from the platform - ur_device_handle_t Device = Platforms[DeviceIdx]->Devices[0].get(); + ur_device_handle_t Device = platform->Devices[DeviceIdx].get(); return ReturnValue(Device); } case UR_USM_ALLOC_INFO_POOL: {