Kaydet (Commit) b981c089 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Separate the OpenCL kernel state flag to get it to function correctly.

It's better this way.

Change-Id: I293a51f0d180e21c35b0d310b9a6bda496ad7f45
üst 7122ef19
......@@ -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();
......
......@@ -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
......
......@@ -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())
......
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment