[Libreoffice-commits] core.git: desktop/source include/opencl opencl/source sc/source

Michael Meeks michael.meeks at collabora.com
Tue Jul 12 20:01:49 UTC 2016


 desktop/source/app/opencl.cxx            |   12 ++++++++++++
 include/opencl/openclwrapper.hxx         |    1 +
 opencl/source/openclwrapper.cxx          |    1 +
 sc/source/core/opencl/formulagroupcl.cxx |    7 +++++++
 4 files changed, 21 insertions(+)

New commits:
commit e9a1afbd3e12c6935cbacbff84b1b70fea0add85
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Jul 12 19:30:53 2016 +0100

    tdf#100883 - opencl impls. that use SEH are still bad.
    
    Amazingly we fell-back to the old calculation path for
    crashes in older LibreOffices, might as well have this on master.
    
    Change-Id: Ifc1de41c93329207d7a1917c736e361d840c2821
    Reviewed-on: https://gerrit.libreoffice.org/27166
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/source/app/opencl.cxx b/desktop/source/app/opencl.cxx
index 09f2204..4c75ae7 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#100883 - defeat SEH exception handling fallbacks.
+        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 b173d89..afd34c6 100644
--- a/include/opencl/openclwrapper.hxx
+++ b/include/opencl/openclwrapper.hxx
@@ -53,6 +53,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 2aecdde..9156ec2 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 {
 
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index cc82df9..6747bc9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -4059,6 +4059,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
         // OpenCLError used to go to the catch-all below, and not delete pDynamicKernel. Was that
         // intentional, should we not do it here then either?
         delete pDynamicKernel;
+        ::opencl::kernelFailures++;
         return nullptr;
     }
     catch (const Unhandled& uh)
@@ -4068,6 +4069,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
         // Unhandled used to go to the catch-all below, and not delete pDynamicKernel. Was that
         // intentional, should we not do it here then either?
         delete pDynamicKernel;
+        ::opencl::kernelFailures++;
         return nullptr;
     }
     catch (...)
@@ -4075,6 +4077,7 @@ DynamicKernel* DynamicKernel::create( const ScCalcConfig& rConfig, ScTokenArray&
         // FIXME: Do we really want to catch random exceptions here?
         SAL_WARN("sc.opencl", "Dynamic formula compiler: unexpected exception");
         // FIXME: Not deleting pDynamicKernel here!?, is that intentional?
+        ::opencl::kernelFailures++;
         return nullptr;
     }
     return pDynamicKernel;
@@ -4185,21 +4188,25 @@ public:
         catch (const UnhandledToken& ut)
         {
             SAL_INFO("sc.opencl", "Dynamic formula compiler: UnhandledToken: " << ut.mMessage << " at " << ut.mFile << ":" << ut.mLineNumber);
+            ::opencl::kernelFailures++;
             return CLInterpreterResult();
         }
         catch (const OpenCLError& oce)
         {
             SAL_WARN("sc.opencl", "Dynamic formula compiler: OpenCLError from " << oce.mFunction << ": " << ::opencl::errorString(oce.mError) << " at " << oce.mFile << ":" << oce.mLineNumber);
+            ::opencl::kernelFailures++;
             return CLInterpreterResult();
         }
         catch (const Unhandled& uh)
         {
             SAL_INFO("sc.opencl", "Dynamic formula compiler: Unhandled at " << uh.mFile << ":" << uh.mLineNumber);
+            ::opencl::kernelFailures++;
             return CLInterpreterResult();
         }
         catch (...)
         {
             SAL_WARN("sc.opencl", "Dynamic formula compiler: unexpected exception");
+            ::opencl::kernelFailures++;
             return CLInterpreterResult();
         }
 


More information about the Libreoffice-commits mailing list