Create devices in DeviceFactory

Related-To: NEO-4208

Change-Id: I5e47f3dd75cf18d731a9353c8939ca3b6a99b4de
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-02-14 17:36:30 +01:00
parent 4420fe34ba
commit 428b123bdd
21 changed files with 154 additions and 202 deletions

View File

@@ -82,14 +82,13 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint numEntries,
std::unique_lock<std::mutex> lock(mutex);
if (platformsImpl.empty()) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
size_t numRootDevices = 0u;
bool status = getDevices(numRootDevices, *executionEnvironment);
if (!status) {
auto allDevices = DeviceFactory::createDevices(*executionEnvironment);
if (allDevices.empty()) {
retVal = CL_OUT_OF_HOST_MEMORY;
break;
}
auto pPlatform = Platform::createFunc(*executionEnvironment.release());
if (!pPlatform->initialize(numRootDevices, 0u)) {
if (!pPlatform || !pPlatform->initialize(std::move(allDevices))) {
retVal = CL_OUT_OF_HOST_MEMORY;
break;
}