summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-03-12 00:49:26 -0400
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-03-12 05:12:32 -0500
commit667943572cafa1c869597db68dd4c3c28fdaff6d (patch)
treec38cb7950d89023a191a9bfbe5a41ba91681fe0e
parent69ecdad805281b2cb6ec2437da18daa19576deae (diff)
Don't delete the kernel when pre-compiled.
Because we'll be re-using that same kernel instance for subsequent runs. (cherry picked from commit 80842a50b1580b9a6da3a2c39a88a72b5b98d278) Conflicts: sc/source/core/opencl/formulagroupcl.cxx Change-Id: I08b6df65550cecfa48f937b163fb1c5b20ed8ac9 Reviewed-on: https://gerrit.libreoffice.org/8538 Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index a478b21ce8a5..0f6fb22bc310 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -3423,7 +3423,8 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup,
ScTokenArray& rCode )
{
- DynamicKernel *pKernel;
+ DynamicKernel *pKernel = NULL;
+ boost::scoped_ptr<DynamicKernel> pLocalKernel;
if (xGroup->meKernelState == sc::OpenCLKernelCompilationScheduled ||
xGroup->meKernelState == sc::OpenCLKernelBinaryCreated)
@@ -3440,6 +3441,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
{
assert(xGroup->meCalcState == sc::GroupCalcRunning);
pKernel = static_cast<DynamicKernel*>(createCompiledFormula(rDoc, rTopPos, *xGroup, rCode));
+ pLocalKernel.reset(pKernel); // to be deleted when done.
}
if (!pKernel)
@@ -3465,8 +3467,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, res, resbuf, 0, NULL, NULL);
if (err != CL_SUCCESS)
throw OpenCLError(err);
- if (xGroup->meCalcState == sc::GroupCalcRunning)
- delete pKernel;
}
catch (const UnhandledToken &ut) {
std::cerr << "\nDynamic formual compiler: unhandled token: ";