diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-05 21:39:10 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-05 23:41:46 -0500 |
commit | b981c089a9194f33b46272e3f4efa117241ea533 (patch) | |
tree | a6396dae5a16b999a0b1cbeef2211fef8b449d8f | |
parent | 7122ef19847b26529ed1d5bad40df869e91a8495 (diff) |
Separate the OpenCL kernel state flag to get it to function correctly.
It's better this way.
Change-Id: I293a51f0d180e21c35b0d310b9a6bda496ad7f45
-rw-r--r-- | sc/inc/formulacell.hxx | 4 | ||||
-rw-r--r-- | sc/inc/types.hxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 7 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/tool/clkernelthread.cxx | 4 |
5 files changed, 20 insertions, 12 deletions
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index f75895b4af4d..67b0fb68b3e7 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 fc0e0e85c07b..b6c4fa64bb78 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 3b20408568d6..9a328ed38f96 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 1ecee2150269..de4b6e6c7a9c 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 2a619c5cdbad..2715af6df245 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; |