[Libreoffice-commits] core.git: Branch 'private/tml/opencl-default-1' - 2 commits - sc/inc sc/qa sc/source

Tor Lillqvist tml at collabora.com
Mon Nov 3 04:23:02 PST 2014


 sc/inc/formulagroup.hxx              |    3 ++-
 sc/qa/unit/opencl-test.cxx           |    2 +-
 sc/source/core/tool/formulagroup.cxx |    4 +++-
 sc/source/core/tool/token.cxx        |   10 ++++++++++
 4 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit eddb22cdd0ec2b12288fbef6b2e76656e4a6feba
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 3 14:04:51 2014 +0200

    Check also unary and binary operation opcodes for presence in subset
    
    Change-Id: I316ebdb017d512e72d0ad15a847802bca0e15814

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 46fd5a4..93c3463 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1454,6 +1454,16 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
             default:
                 ;
         }
+        return;
+    }
+
+    if (eOp >= SC_OPCODE_START_BIN_OP &&
+        eOp <= SC_OPCODE_STOP_UN_OP &&
+        ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly &&
+        ScInterpreter::GetGlobalConfig().maOpenCLSubsetFunctions.find(eOp) == ScInterpreter::GetGlobalConfig().maOpenCLSubsetFunctions.end())
+    {
+        meVectorState = FormulaVectorDisabled;
+        return;
     }
 }
 
commit 8f4502c8e7a0795fafa42bbc781c3165812f4432
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 3 14:04:12 2014 +0200

    Add also parameters for the opcode subset to enableOpenCL()
    
    In CppunitTest_sc_opencl_test we want to explicitly disable subsetting and use
    OpenCL maximally, to match how it used to work.
    
    Change-Id: Ie900adb5fa58b7cd1111169e44efd70d8cac5256

diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 1ee0249..d507cd5 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -15,6 +15,7 @@
 #include "platforminfo.hxx"
 #include "stlalgorithm.hxx"
 
+#include <formula/opcode.hxx>
 #include <svl/sharedstringpool.hxx>
 
 #include <vector>
@@ -122,7 +123,7 @@ class SC_DLLPUBLIC FormulaGroupInterpreter
     static FormulaGroupInterpreter *getStatic();
     static void fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rPlatforms);
     static bool switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation = false);
-    static void enableOpenCL(bool bEnable);
+    static void enableOpenCL(bool bEnable, bool bEnableCompletely = false, const std::set<OpCodeEnum>& rSubsetToEnable = std::set<OpCodeEnum>());
     static void getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int32& rPlatformId);
 
     virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) = 0;
diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx
index 9b05518..f5f8324 100644
--- a/sc/qa/unit/opencl-test.cxx
+++ b/sc/qa/unit/opencl-test.cxx
@@ -553,7 +553,7 @@ bool ScOpenCLTest::detectOpenCLDevice()
 
 void ScOpenCLTest::enableOpenCL()
 {
-    sc::FormulaGroupInterpreter::enableOpenCL(true);
+    sc::FormulaGroupInterpreter::enableOpenCL(true, true);
 }
 
 void ScOpenCLTest::testCompilerHorizontal()
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index b4a8827..a5ad10b 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -606,10 +606,12 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
 #endif
 }
 
-void FormulaGroupInterpreter::enableOpenCL(bool bEnable)
+void FormulaGroupInterpreter::enableOpenCL(bool bEnable, bool bEnableCompletely, const std::set<OpCodeEnum>& rSubsetToEnable)
 {
     ScCalcConfig aConfig = ScInterpreter::GetGlobalConfig();
     aConfig.mbOpenCLEnabled = bEnable;
+    aConfig.mbOpenCLSubsetOnly = !bEnableCompletely;
+    aConfig.maOpenCLSubsetFunctions = rSubsetToEnable;
     ScInterpreter::SetGlobalConfig(aConfig);
 }
 


More information about the Libreoffice-commits mailing list