summaryrefslogtreecommitdiff
path: root/opencl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2016-07-11 15:12:38 +0100
committerMichael Meeks <michael.meeks@collabora.com>2016-07-12 14:14:06 +0000
commit3ee2c658508024b62864ce89c2e5a2bb706e6923 (patch)
tree64a66151dbe4ffc1226123212f3fbcc6539e7c4b /opencl
parent63628b10bf5402c3006e60db84571d5e6e51931c (diff)
desktop: validate OpenCL drivers before use.
OpenCL validation needs to happen before drivers are used in anger. This should isolate any crashes, and/or mis-behavior to We use app version, CL driver version and file time-stamp to trigger re-testing the device. If anything fails: hard disable OpenCL. We use an opencl validation sheet (cl-test.ods) and install it. It is a minimal CL set - it requires a very short formula group length, and combines several CL functions into few formulae to test more. The sheet structure, in particular the manual squaring / SQRT is necessary to stick within the default CL subset, and ensure that formulae are CL enabled from the root of the dependency tree up. Reviewed-on: https://gerrit.libreoffice.org/27131 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit c44726c48228d9c6a5960e302b1c0bd16b0099c4) + opencl: bail out early in missing OpenCL case. (cherry picked from commit 605a5dc088385ad21c33028d8107125c0316ddb1) + Remove bogus dependency from opencl to configmgr Since f41eb66302208f384a475fb20c98b6d1b0676cb6 "opencl: OpenCLZone, detect CL device change and disable CL on crash" vcl links against opencl (so indirectly linked against configmgr), which caused CppunitTest_configmgr_unit to include the configmgr object files both statically (through gb_CppunitTest_use_library_objects) and through the linked-in configmgr dynamic library, which in turn caused ASan builds to report an ODR violation for a doubly defined 'typeinfo name for configmgr::Access'. (cherry picked from commit 9c711f05fa10dc70e4257a1f48d43f539353541a) Change-Id: I18682dbdf9a8ba9c16d52bad4447e9acce97f0a3 Reviewed-on: https://gerrit.libreoffice.org/27141 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'opencl')
-rw-r--r--opencl/Library_opencl.mk1
-rw-r--r--opencl/inc/opencl_device.hxx3
-rw-r--r--opencl/source/OpenCLZone.cxx4
-rw-r--r--opencl/source/openclwrapper.cxx8
4 files changed, 13 insertions, 3 deletions
diff --git a/opencl/Library_opencl.mk b/opencl/Library_opencl.mk
index 039ec0125e53..5b3de52d6a3e 100644
--- a/opencl/Library_opencl.mk
+++ b/opencl/Library_opencl.mk
@@ -34,7 +34,6 @@ $(eval $(call gb_Library_use_custom_headers,opencl,\
$(eval $(call gb_Library_use_sdk_api,opencl))
$(eval $(call gb_Library_use_libraries,opencl,\
- configmgr \
comphelper \
cppu \
sal \
diff --git a/opencl/inc/opencl_device.hxx b/opencl/inc/opencl_device.hxx
index 0963304e8f99..216af72de849 100644
--- a/opencl/inc/opencl_device.hxx
+++ b/opencl/inc/opencl_device.hxx
@@ -16,6 +16,9 @@ namespace opencl {
ds_device getDeviceSelection(OUString const & pFileName, bool bForceSelection = false);
+struct GPUEnv;
+void releaseOpenCLEnv( GPUEnv *gpuInfo );
+
}
#endif
diff --git a/opencl/source/OpenCLZone.cxx b/opencl/source/OpenCLZone.cxx
index dc3a9522380b..03521a29c66f 100644
--- a/opencl/source/OpenCLZone.cxx
+++ b/opencl/source/OpenCLZone.cxx
@@ -7,7 +7,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include <opencl/openclwrapper.hxx>
#include <opencl/OpenCLZone.hxx>
+#include "opencl_device.hxx"
#include <memory>
@@ -40,6 +42,8 @@ void OpenCLZone::hardDisable()
auto xConfProvider = css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext());
css::uno::Reference<css::util::XFlushable> xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW);
xFlushable->flush();
+
+ releaseOpenCLEnv(&opencl::gpuEnv);
}
}
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 3d54af033e6b..a54e94d4ffbb 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -268,6 +268,8 @@ bool initOpenCLAttr( OpenCLEnv * env )
return false;
}
+}
+
void releaseOpenCLEnv( GPUEnv *gpuInfo )
{
OpenCLZone zone;
@@ -298,6 +300,8 @@ void releaseOpenCLEnv( GPUEnv *gpuInfo )
return;
}
+namespace {
+
bool buildProgram(const char* buildOption, GPUEnv* gpuInfo, int idx)
{
cl_int clStatus;
@@ -695,7 +699,7 @@ void findDeviceInfoFromDeviceId(cl_device_id aDeviceId, size_t& rDeviceId, size_
bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEvaluation, OUString& rOutSelectedDeviceVersionIDString)
{
- if(fillOpenCLInfo().empty())
+ if(fillOpenCLInfo().empty() || getenv("SAL_DISABLE_OPENCL"))
return false;
cl_device_id pDeviceId = nullptr;
@@ -878,7 +882,7 @@ const char* errorString(cl_int nError)
bool GPUEnv::isOpenCLEnabled()
{
- return gpuEnv.mpDevID;
+ return gpuEnv.mpDevID && gpuEnv.mpContext;
}
}