[Libreoffice-commits] core.git: sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Wed Mar 5 20:43:15 PST 2014


 sc/inc/formulacell.hxx                   |    4 +++-
 sc/inc/types.hxx                         |   11 ++++++++---
 sc/source/core/data/formulacell.cxx      |    7 ++++---
 sc/source/core/opencl/formulagroupcl.cxx |    6 +++---
 sc/source/core/tool/clkernelthread.cxx   |    4 ++--
 5 files changed, 20 insertions(+), 12 deletions(-)

New commits:
commit b981c089a9194f33b46272e3f4efa117241ea533
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Wed Mar 5 21:39:10 2014 -0500

    Separate the OpenCL kernel state flag to get it to function correctly.
    
    It's better this way.
    
    Change-Id: I293a51f0d180e21c35b0d310b9a6bda496ad7f45

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index f75895b..67b0fb6 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -64,7 +64,9 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable
     short mnFormatType;
     bool mbInvariant:1;
     bool mbSubTotal:1;
-    sc::GroupCalcState meCalcState;
+
+    sal_uInt8 meCalcState;
+    sal_uInt8 meKernelState;
 
     ScFormulaCellGroup();
     ~ScFormulaCellGroup();
diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx
index fc0e0e8..b6c4fa6 100644
--- a/sc/inc/types.hxx
+++ b/sc/inc/types.hxx
@@ -58,11 +58,16 @@ const sal_uInt16 MatrixEdgeOpen    = 32;
 
 enum GroupCalcState
 {
+    GroupCalcDisabled = 0,
     GroupCalcEnabled,
-    GroupCalcOpenCLKernelCompilationScheduled,
-    GroupCalcOpenCLKernelBinaryCreated,
     GroupCalcRunning,
-    GroupCalcDisabled
+};
+
+enum OpenCLKernelState
+{
+    OpenCLKernelNone = 0,
+    OpenCLKernelCompilationScheduled,
+    OpenCLKernelBinaryCreated
 };
 
 struct RangeMatrix
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 3b20408..9a328ed 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -413,7 +413,8 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
     mnFormatType(NUMBERFORMAT_NUMBER),
     mbInvariant(false),
     mbSubTotal(false),
-    meCalcState(sc::GroupCalcEnabled)
+    meCalcState(sc::GroupCalcEnabled),
+    meKernelState(sc::OpenCLKernelNone)
 {
     if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled)
     {
@@ -446,7 +447,7 @@ ScFormulaCellGroup::~ScFormulaCellGroup()
 
 void ScFormulaCellGroup::scheduleCompilation()
 {
-    meCalcState = sc::GroupCalcOpenCLKernelCompilationScheduled;
+    meKernelState = sc::OpenCLKernelCompilationScheduled;
     sc::CLBuildKernelWorkItem aWorkItem;
     aWorkItem.meWhatToDo = sc::CLBuildKernelWorkItem::COMPILE;
     aWorkItem.mxGroup = this;
@@ -2071,7 +2072,7 @@ bool ScFormulaCell::IsMultilineResult()
 
 void ScFormulaCell::MaybeInterpret()
 {
-    if (mxGroup && mxGroup->meCalcState == sc::GroupCalcOpenCLKernelCompilationScheduled)
+    if (mxGroup && mxGroup->meKernelState == sc::OpenCLKernelCompilationScheduled)
         return;
 
     if (!IsDirtyOrInTableOpDirty())
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 1ecee21..de4b6e6 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3456,10 +3456,10 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
 {
     DynamicKernel *pKernel;
 
-    if (xGroup->meCalcState == sc::GroupCalcOpenCLKernelCompilationScheduled ||
-        xGroup->meCalcState == sc::GroupCalcOpenCLKernelBinaryCreated)
+    if (xGroup->meKernelState == sc::OpenCLKernelCompilationScheduled ||
+        xGroup->meKernelState == sc::OpenCLKernelBinaryCreated)
     {
-        if (xGroup->meCalcState == sc::GroupCalcOpenCLKernelCompilationScheduled)
+        if (xGroup->meKernelState == sc::OpenCLKernelCompilationScheduled)
         {
             ScFormulaCellGroup::sxCompilationThread->maCompilationDoneCondition.wait();
             ScFormulaCellGroup::sxCompilationThread->maCompilationDoneCondition.reset();
diff --git a/sc/source/core/tool/clkernelthread.cxx b/sc/source/core/tool/clkernelthread.cxx
index 2a619c5..2715af6 100644
--- a/sc/source/core/tool/clkernelthread.cxx
+++ b/sc/source/core/tool/clkernelthread.cxx
@@ -51,13 +51,13 @@ void CLBuildKernelThread::execute()
                 SAL_INFO("sc.opencl.thread", "told to compile group " << aWorkItem.mxGroup << " (state " << aWorkItem.mxGroup->meCalcState << ") to binary");
                 if (aWorkItem.mxGroup->meCalcState == sc::GroupCalcDisabled)
                     break;
-                assert(aWorkItem.mxGroup->meCalcState == sc::GroupCalcOpenCLKernelCompilationScheduled);
+                assert(aWorkItem.mxGroup->meKernelState == sc::OpenCLKernelCompilationScheduled);
                 aWorkItem.mxGroup->mpCompiledFormula =
                     sc::FormulaGroupInterpreter::getStatic()->createCompiledFormula(*aWorkItem.mxGroup->mpTopCell->GetDocument(),
                                                                                     aWorkItem.mxGroup->mpTopCell->aPos,
                                                                                     aWorkItem.mxGroup,
                                                                                     *aWorkItem.mxGroup->mpCode);
-                aWorkItem.mxGroup->meCalcState = sc::GroupCalcOpenCLKernelBinaryCreated;
+                aWorkItem.mxGroup->meKernelState = sc::OpenCLKernelBinaryCreated;
                 SAL_INFO("sc.opencl.thread", "group " << aWorkItem.mxGroup << " compilation done");
                 maCompilationDoneCondition.set();
                 break;


More information about the Libreoffice-commits mailing list