[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

haochen haochen at multicorewareinc.com
Mon Dec 9 16:55:00 PST 2013


 sc/source/core/opencl/formulagroupcl.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 7d68e43e8b35419dc481ce3a06716113b4045839
Author: haochen <haochen at multicorewareinc.com>
Date:   Mon Dec 9 13:07:32 2013 +0800

    Release cl_mem&kernel after sumifs reduction kernel
    
    Change-Id: Ibe2eccf92b5f8e7b12b5d885cb393238b16837b0
    Signed-off-by: Your Name <you at example.com>

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 36981a7..618fcc9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1457,7 +1457,7 @@ public:
             DynamicKernelArgument *Arg = mvSubArguments[0].get();
             DynamicKernelSlidingArgument<VectorRef> *slidingArgPtr =
                 dynamic_cast< DynamicKernelSlidingArgument<VectorRef> *> (Arg);
-            cl_mem mpClmem2;
+            mpClmem2 = NULL;
 
             if (OpSumCodeGen->NeedReductionKernel())
             {
@@ -1518,7 +1518,7 @@ public:
                 err = clFinish(kEnv.mpkCmdQueue);
                 if (CL_SUCCESS != err)
                     throw OpenCLError(err);
-
+                clReleaseKernel(redKernel);
                  // Pass mpClmem2 to the "real" kernel
                 err = clSetKernelArg(k, argno, sizeof(cl_mem), (void *)&mpClmem2);
                 if (CL_SUCCESS != err)
@@ -1615,7 +1615,16 @@ public:
         for (unsigned i = 0; i < mvSubArguments.size(); i++)
             mvSubArguments[i]->DumpInlineFun(decls,funs);
     }
+   ~DynamicKernelSoPArguments()
+    {
+        if (mpClmem2)
+        {
+            clReleaseMemObject(mpClmem2);
+            mpClmem2 = NULL;
+        }
+    }
 private:
+    cl_mem mpClmem2;
     SubArgumentsType mvSubArguments;
     boost::shared_ptr<SlidingFunctionBase> mpCodeGen;
 };
@@ -1675,7 +1684,7 @@ DynamicKernelArgument *VectorRefFactory(const std::string &s,
 
 DynamicKernelSoPArguments::DynamicKernelSoPArguments(
     const std::string &s, const FormulaTreeNodeRef& ft, SlidingFunctionBase* pCodeGen) :
-    DynamicKernelArgument(s, ft), mpCodeGen(pCodeGen)
+    DynamicKernelArgument(s, ft), mpCodeGen(pCodeGen),mpClmem2(NULL)
 {
     size_t nChildren = ft->Children.size();
 


More information about the Libreoffice-commits mailing list