diff --git a/source/adapters/opencl/device.cpp b/source/adapters/opencl/device.cpp index 141ed3c9a7..39cba44d62 100644 --- a/source/adapters/opencl/device.cpp +++ b/source/adapters/opencl/device.cpp @@ -41,7 +41,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(ur_platform_handle_t hPlatform, default: return UR_RESULT_ERROR_INVALID_ENUMERATION; } - UR_RETURN_ON_FAILURE(hPlatform->InitDevices()); try { uint32_t AllDevicesNum = hPlatform->Devices.size(); uint32_t DeviceNumIter = 0; diff --git a/source/adapters/opencl/platform.cpp b/source/adapters/opencl/platform.cpp index 14a88e6633..b515baaa05 100644 --- a/source/adapters/opencl/platform.cpp +++ b/source/adapters/opencl/platform.cpp @@ -90,6 +90,7 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, for (uint32_t i = 0; i < NumPlatforms; i++) { auto URPlatform = std::make_unique(CLPlatforms[i]); + UR_RETURN_ON_FAILURE(URPlatform->InitDevices()); Adapter->URPlatforms.emplace_back(URPlatform.release()); } Adapter->NumPlatforms = NumPlatforms;