summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2016-07-08 22:16:27 +0900
committerMichael Meeks <michael.meeks@collabora.com>2016-07-12 19:14:05 +0000
commitf0da69b41b1d8aa963887c743ce2ff981691b8db (patch)
tree909d5732574e2289d1cadb41ae5faf6b144adba1 /sc
parent0a27e1aa4b710219935f298581ccc993963a6a12 (diff)
opencl: OpenCLZone, detect CL device change and disable CL on crash
Guard OpenCL calls with OpenCLZone, so if a OpenCL call crashes we detect this and disable OpenCL so next time the user doesn't encounter the crash at the same calculation because he has a broken OpenCL drivers. Similar has been implemented for OpenGL with good results. Additionaly we persistently remember a known good OpenCL device ID and driver version so we can match this and perform calculation tests when they change. This is to ensure that the selected OpenCL device performs as we expect. In this commit the calculation tests aren't included yet. Remove complex static initializer in opencl wrapper library. Change-Id: I1a8b81ee31298731efcf63dc6a476955afc035e9 Reviewed-on: https://gerrit.libreoffice.org/27064 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit f41eb66302208f384a475fb20c98b6d1b0676cb6) Reviewed-on: https://gerrit.libreoffice.org/27099 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/27144 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/formulagroup.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index e382e7a6ab60..49415042dd9c 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -32,7 +32,7 @@
#include <vector>
#if HAVE_FEATURE_OPENCL
-#include <opencl/openclwrapper.hxx>
+# include <opencl/openclwrapper.hxx>
#endif
namespace sc {
@@ -327,12 +327,25 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
return false;
}
- bool bSuccess = ::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
+ OUString aSelectedCLDeviceVersionID;
+ bool bSuccess = ::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation, aSelectedCLDeviceVersionID);
+
if (!bSuccess)
return false;
delete msInstance;
msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL();
+
+ if (aSelectedCLDeviceVersionID != officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::get())
+ {
+ // perform OpenCL calculation tests
+
+ // save the device
+ std::shared_ptr<comphelper::ConfigurationChanges> xBatch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Misc::SelectedOpenCLDeviceIdentifier::set(aSelectedCLDeviceVersionID, xBatch);
+ xBatch->commit();
+ }
+
return true;
}