summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-10-30 22:47:26 +0200
committerTor Lillqvist <tml@collabora.com>2014-10-30 23:11:08 +0200
commit03d90274bcb6fb617034161c6d4676050d7e9edb (patch)
tree12d2775d3d2f06234637a43bde72da8b44db4efe /sc
parent07accd020ba1e5dc8bba2909e9e6518140acb477 (diff)
Make sure the cached OpenCL profile file actually matches the devices present
Re-evaluate scores if the profile file did not match. It used to work so that if the OpenCL devices available had changed (if just the OpenCL driver version had changed), we did not re-evaluate scores but instead selected the dummy software device. Which hardly was as intended. Change-Id: Ifd79c0226504323f275d2e1d02876a0fecc449e0
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/opencl_device_selection.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sc/source/core/opencl/opencl_device_selection.h b/sc/source/core/opencl/opencl_device_selection.h
index 1d5086d62d16..fcfa41a55bb2 100644
--- a/sc/source/core/opencl/opencl_device_selection.h
+++ b/sc/source/core/opencl/opencl_device_selection.h
@@ -602,7 +602,17 @@ inline ds_status readProfileFromFile(ds_profile* profile, ds_score_deserializer
}
cleanup:
if (contentStart != NULL) free(contentStart);
- return status;
+ if (status != DS_SUCCESS)
+ return status;
+
+ // Check that all the devices present had valid cached scores. If
+ // not, return DS_INVALID_PROFILE and let the caller re-evaluate
+ // scores for present devices, and write a new profile file.
+ for (unsigned int i = 0; i < profile->numDevices; i++)
+ if (profile->devices[i].score == NULL)
+ return DS_INVALID_PROFILE;
+
+ return DS_SUCCESS;
}
inline ds_status getNumDeviceWithEmptyScore(ds_profile* profile, unsigned int* num)