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

Kohei Yoshida kohei.yoshida at collabora.com
Thu Mar 20 07:13:28 PDT 2014


 sc/inc/formulacell.hxx                   |    4 ++++
 sc/source/core/data/formulacell.cxx      |   10 ++++++++--
 sc/source/core/opencl/formulagroupcl.cxx |    5 +++++
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit e0d936ef7b7fd6b57cdd5ccadddcbd84bd4bb359
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Mar 20 10:13:15 2014 -0400

    More code that's specific to OpenCL kernel pre-compilation.
    
    Change-Id: I82474c48924aca36d9fde468081fb2457a153ac6

diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 81dd1fd..0c6cb12 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -34,6 +34,8 @@
 
 #include "formularesult.hxx"
 
+#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0
+
 namespace sc {
 
 class CLBuildKernelThread;
@@ -78,8 +80,10 @@ struct SC_DLLPUBLIC ScFormulaCellGroup : boost::noncopyable
         ScDocument& rDoc, const ScAddress& rPos, formula::FormulaGrammar::Grammar eGram );
     void compileOpenCLKernel();
 
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
     static int snCount;
     static rtl::Reference<sc::CLBuildKernelThread> sxCompilationThread;
+#endif
 };
 
 inline void intrusive_ptr_add_ref(const ScFormulaCellGroup *p)
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 2ea6f0b..b5ec659 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -59,8 +59,6 @@
 
 #include <boost/scoped_ptr.hpp>
 
-#define ENABLE_THREADED_OPENCL_KERNEL_COMPILATION 0
-
 using namespace formula;
 
 #ifdef USE_MEMPOOL
@@ -392,6 +390,7 @@ void adjustDBRange(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOldD
 
 }
 
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
 //  The mutex to synchronize access to the OpenCL compilation thread.
 static osl::Mutex& getOpenCLCompilationThreadMutex()
 {
@@ -411,6 +410,7 @@ static osl::Mutex& getOpenCLCompilationThreadMutex()
 
 int ScFormulaCellGroup::snCount = 0;
 rtl::Reference<sc::CLBuildKernelThread> ScFormulaCellGroup::sxCompilationThread;
+#endif
 
 ScFormulaCellGroup::ScFormulaCellGroup() :
     mnRefCount(0),
@@ -424,6 +424,7 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
     meCalcState(sc::GroupCalcEnabled),
     meKernelState(sc::OpenCLKernelNone)
 {
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
     if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled)
     {
         osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex());
@@ -434,10 +435,12 @@ ScFormulaCellGroup::ScFormulaCellGroup() :
             sxCompilationThread->launch();
         }
     }
+#endif
 }
 
 ScFormulaCellGroup::~ScFormulaCellGroup()
 {
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
     if (ScInterpreter::GetGlobalConfig().mbOpenCLEnabled)
     {
         osl::MutexGuard aGuard(getOpenCLCompilationThreadMutex());
@@ -450,17 +453,20 @@ ScFormulaCellGroup::~ScFormulaCellGroup()
                 sxCompilationThread.clear();
             }
     }
+#endif
     delete mpCode;
     delete mpCompiledFormula;
 }
 
 void ScFormulaCellGroup::scheduleCompilation()
 {
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
     meKernelState = sc::OpenCLKernelCompilationScheduled;
     sc::CLBuildKernelWorkItem aWorkItem;
     aWorkItem.meWhatToDo = sc::CLBuildKernelWorkItem::COMPILE;
     aWorkItem.mxGroup = this;
     sxCompilationThread->push(aWorkItem);
+#endif
 }
 
 void ScFormulaCellGroup::setCode( const ScTokenArray& rCode )
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 80f11ed..8b8a8e5 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3450,6 +3450,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
     DynamicKernel *pKernel = NULL;
     boost::scoped_ptr<DynamicKernel> pLocalKernel;
 
+#if ENABLE_THREADED_OPENCL_KERNEL_COMPILATION
     if (xGroup->meKernelState == sc::OpenCLKernelCompilationScheduled ||
         xGroup->meKernelState == sc::OpenCLKernelBinaryCreated)
     {
@@ -3467,6 +3468,10 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
         pKernel = static_cast<DynamicKernel*>(createCompiledFormula(rDoc, rTopPos, *xGroup, rCode));
         pLocalKernel.reset(pKernel); // to be deleted when done.
     }
+#else
+    pKernel = static_cast<DynamicKernel*>(createCompiledFormula(rDoc, rTopPos, *xGroup, rCode));
+    pLocalKernel.reset(pKernel); // to be deleted when done.
+#endif
 
     if (!pKernel)
         return false;


More information about the Libreoffice-commits mailing list