diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-07-12 19:39:33 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-07-12 20:00:58 +0000 |
commit | 2b1f1030bf642d1b9c8af91aa78683a9fb95e6f4 (patch) | |
tree | 4c72e46d7b6cb752f0250fffe39948a9c6d844a8 | |
parent | bab5387447d2ea386b49367fe373b124a57c5ce6 (diff) |
tdf#100883 - opencl impls. that use SEH are still bad.
Amazingly we fell-back to the old calculation path for
crashes in older LibreOffices.
Change-Id: Ia182f7a25c5560b68494d5cdd68e02925bfd5845
Reviewed-on: https://gerrit.libreoffice.org/27164
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | desktop/source/app/opencl.cxx | 12 | ||||
-rw-r--r-- | include/opencl/openclwrapper.hxx | 1 | ||||
-rw-r--r-- | opencl/source/openclwrapper.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 5 |
4 files changed, 20 insertions, 1 deletions
diff --git a/desktop/source/app/opencl.cxx b/desktop/source/app/opencl.cxx index 09f2204e07ca..2b8d6d67e98e 100644 --- a/desktop/source/app/opencl.cxx +++ b/desktop/source/app/opencl.cxx @@ -46,6 +46,8 @@ bool testOpenCLCompute(const Reference< XDesktop2 > &xDesktop, const OUString &r bool bSuccess = false; css::uno::Reference< css::lang::XComponent > xComponent; + sal_uInt64 nKernelFailures = opencl::kernelFailures; + SAL_INFO("opencl", "Starting CL test spreadsheet"); try { @@ -95,11 +97,21 @@ bool testOpenCLCompute(const Reference< XDesktop2 > &xDesktop, const OUString &r SAL_WARN("opencl", "OpenCL testing failed - disabling: " << e.Message); } + if (nKernelFailures != opencl::kernelFailures) + { + // tdf# + SAL_WARN("opencl", "OpenCL kernels failed to compile, " + "or took SEH exceptions " + << nKernelFailures << " != " << opencl::kernelFailures); + bSuccess = false; + } + if (!bSuccess) OpenCLZone::hardDisable(); if (xComponent.is()) xComponent->dispose(); + return bSuccess; } diff --git a/include/opencl/openclwrapper.hxx b/include/opencl/openclwrapper.hxx index 2121f0e11c1e..05834004b12c 100644 --- a/include/opencl/openclwrapper.hxx +++ b/include/opencl/openclwrapper.hxx @@ -55,6 +55,7 @@ struct OPENCL_DLLPUBLIC GPUEnv }; extern OPENCL_DLLPUBLIC GPUEnv gpuEnv; +extern OPENCL_DLLPUBLIC sal_uInt64 kernelFailures; OPENCL_DLLPUBLIC bool generatBinFromKernelSource( cl_program program, const char * clFileName ); OPENCL_DLLPUBLIC bool buildProgramFromBinary(const char* buildOption, GPUEnv* gpuEnv, const char* filename, int idx); diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index 807a185ea5ff..2551b057b1db 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -58,6 +58,7 @@ using namespace std; namespace opencl { GPUEnv gpuEnv; +sal_uInt64 kernelFailures = 0; namespace { @@ -883,7 +884,7 @@ const char* errorString(cl_int nError) bool GPUEnv::isOpenCLEnabled() { - return gpuEnv.mpDevID; + return gpuEnv.mpDevID && gpuEnv.mpContext; } } diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 8055ecf0a713..c2835c180b3d 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -4057,6 +4057,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray& catch (...) { SAL_WARN("sc.opencl", "Dynamic formula compiler: unhandled compiler error"); + ::opencl::kernelFailures++; return nullptr; } return pDynamicKernel; @@ -4167,21 +4168,25 @@ public: catch (const UnhandledToken& ut) { SAL_WARN("sc.opencl", "Dynamic formula compiler: unhandled token: " << ut.mMessage << " at " << ut.mFile << ":" << ut.mLineNumber); + ::opencl::kernelFailures++; return CLInterpreterResult(); } catch (const OpenCLError& oce) { SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCL error from " << oce.mFunction << ": " << ::opencl::errorString(oce.mError) << " at " << oce.mFile << ":" << oce.mLineNumber); + ::opencl::kernelFailures++; return CLInterpreterResult(); } catch (const Unhandled& uh) { SAL_WARN("sc.opencl", "Dynamic formula compiler: unhandled case at " << uh.mFile << ":" << uh.mLineNumber); + ::opencl::kernelFailures++; return CLInterpreterResult(); } catch (...) { SAL_WARN("sc.opencl", "Dynamic formula compiler: unhandled compiler error"); + ::opencl::kernelFailures++; return CLInterpreterResult(); } |