diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-12 00:49:26 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-12 00:52:24 -0400 |
commit | 80842a50b1580b9a6da3a2c39a88a72b5b98d278 (patch) | |
tree | e8f8a53485ad38e37e40480698b12d029b3a09ad | |
parent | 372ca2ce06cc940b5da0b4653776cfebc2733d40 (diff) |
Don't delete the kernel when pre-compiled.
Because we'll be re-using that same kernel instance for subsequent runs.
Change-Id: I08b6df65550cecfa48f937b163fb1c5b20ed8ac9
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index d329f5daa8fb..00909bec14b7 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -3445,7 +3445,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) @@ -3462,6 +3463,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) @@ -3487,8 +3489,6 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, err = clEnqueueUnmapMemObject(kEnv.mpkCmdQueue, res, resbuf, 0, NULL, NULL); if (err != CL_SUCCESS) throw OpenCLError(err, __FILE__, __LINE__); - if (xGroup->meCalcState == sc::GroupCalcRunning) - delete pKernel; } catch (const UnhandledToken &ut) { std::cerr << "\nDynamic formual compiler: unhandled token: "; |