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

Don't delete the kernel when pre-compiled.

Because we'll be re-using that same kernel instance for subsequent runs.

Change-Id: I08b6df65550cecfa48f937b163fb1c5b20ed8ac9
üst 372ca2ce
...@@ -3445,7 +3445,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, ...@@ -3445,7 +3445,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup,
ScTokenArray& rCode ) ScTokenArray& rCode )
{ {
DynamicKernel *pKernel; DynamicKernel *pKernel = NULL;
boost::scoped_ptr<DynamicKernel> pLocalKernel;
if (xGroup->meKernelState == sc::OpenCLKernelCompilationScheduled || if (xGroup->meKernelState == sc::OpenCLKernelCompilationScheduled ||
xGroup->meKernelState == sc::OpenCLKernelBinaryCreated) xGroup->meKernelState == sc::OpenCLKernelBinaryCreated)
...@@ -3462,6 +3463,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, ...@@ -3462,6 +3463,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
{ {
assert(xGroup->meCalcState == sc::GroupCalcRunning); assert(xGroup->meCalcState == sc::GroupCalcRunning);
pKernel = static_cast<DynamicKernel*>(createCompiledFormula(rDoc, rTopPos, *xGroup, rCode)); pKernel = static_cast<DynamicKernel*>(createCompiledFormula(rDoc, rTopPos, *xGroup, rCode));
pLocalKernel.reset(pKernel); // to be deleted when done.
} }
if (!pKernel) if (!pKernel)
...@@ -3487,8 +3489,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, ...@@ -3487,8 +3489,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, res, resbuf, 0, NULL, NULL); err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, res, resbuf, 0, NULL, NULL);
if (err != CL_SUCCESS) if (err != CL_SUCCESS)
throw OpenCLError(err, __FILE__, __LINE__); throw OpenCLError(err, __FILE__, __LINE__);
if (xGroup->meCalcState == sc::GroupCalcRunning)
delete pKernel;
} }
catch (const UnhandledToken &ut) { catch (const UnhandledToken &ut) {
std::cerr << "\nDynamic formual compiler: unhandled token: "; std::cerr << "\nDynamic formual compiler: unhandled token: ";
......
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