From a7d66b036566bcc596ac58ea0c53759a860e0fac Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Wed, 20 Mar 2019 13:17:17 +0100 Subject: [PATCH] Improve clGetDeviceIDs Change-Id: If7df41e0c2bae5c615f6fea286baf5d7e740cfc7 Signed-off-by: Dunajski, Bartosz --- Jenkinsfile | 2 +- runtime/api/api.cpp | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8bfc1f2aa2..94efd19acf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ #!groovy dependenciesRevision='ec7183fc6b8fde18df4a38ab2aa6d6f364b507f1-1216' strategy='EQUAL' -allowedCD=275 +allowedCD=274 allowedF=4 diff --git a/runtime/api/api.cpp b/runtime/api/api.cpp index a82cc8a44f..1bb330fbf3 100644 --- a/runtime/api/api.cpp +++ b/runtime/api/api.cpp @@ -177,8 +177,8 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform, break; } - Device **allDevs = pPlatform->getDevices(); - DEBUG_BREAK_IF(allDevs == nullptr); + Device *device = pPlatform->getDevice(0); + DEBUG_BREAK_IF(device == nullptr); if (deviceType == CL_DEVICE_TYPE_ALL) { /* According to Spec, set it to all except TYPE_CUSTOM. */ @@ -190,18 +190,12 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform, } cl_uint retNum = 0; - for (cl_uint i = 0; i < numDev; i++) { - if (deviceType & allDevs[i]->getDeviceInfo().deviceType) { - if (devices) { - devices[retNum] = allDevs[i]; - } - retNum++; - if (numEntries > 0 && retNum >= numEntries) { - /* find enough, get out. */ - break; - } + if (deviceType & device->getDeviceInfo().deviceType) { + if (devices) { + devices[retNum] = device; } + retNum++; } if (DebugManager.flags.LimitAmountOfReturnedDevices.get()) {