[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter-4' - sc/source

I-Jui Sung (Ray) ray at multicorewareinc.com
Tue Nov 19 18:07:45 PST 2013


 sc/source/core/opencl/formulagroupcl.cxx |   26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

New commits:
commit 06c8a7a20517441e3f001a993cbeaa4e3fa69a54
Author: I-Jui (Ray) Sung <ray at multicorewareinc.com>
Date:   Tue Nov 19 19:24:06 2013 -0600

    GPU Calc: parallel reduction version of COUNT
    
    Change-Id: Ia90b5aaf044379b5bfc55ec525f9be2f6fda6028

diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 87f4d89..d283174 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -687,19 +687,13 @@ public:
         ss << "    tmp = "<< mpCodeGen->GetBottom() << ";\n";
         ss << "    int loopOffset = l*512;\n";
         ss << "    if((loopOffset + lidx + offset + 256) < min( offset + windowSize, arrayLength))\n";
-        ss << "        tmp = ";
-        ss << mpCodeGen->Gen2(
-                std::string(
-                    "legalize(A[loopOffset + lidx + offset], ")+
-                mpCodeGen->GetBottom() +")",
-                std::string(
-                    "legalize(A[loopOffset + lidx + offset + 256], ")+
-                mpCodeGen->GetBottom() +")"
-                );
-        ss << ";\n";
+        ss << "        tmp = " << mpCodeGen->Gen2(
+                "A[loopOffset + lidx + offset]", "tmp") <<";\n";
+        ss << "        tmp = " << mpCodeGen->Gen2(
+                "A[loopOffset + lidx + offset + 256]", "tmp") << ";\n";
         ss << "    else if ((loopOffset + lidx + offset) < min(offset + windowSize, arrayLength))\n";
-        ss << "        tmp = legalize(A[loopOffset + lidx + offset],";
-        ss << mpCodeGen->GetBottom() << ");\n";
+        ss << "        tmp = " << mpCodeGen->Gen2(
+                "A[loopOffset + lidx + offset]", "tmp") <<";\n";
         ss << "    shm_buf[lidx] = tmp;\n";
         ss << "    barrier(CLK_LOCAL_MEM_FENCE);\n";
         ss << "    for (int i = 128; i >0; i/=2) {\n";
@@ -1226,11 +1220,7 @@ public:
     virtual std::string Gen2(const std::string &lhs, const std::string &rhs) const
     {
         std::stringstream ss;
-#ifdef  ISNAN
-        ss << "(0 =="<< lhs << ")? tmp : (" << rhs<<"+1.0)";
-#else
         ss << "(isNan(" << lhs << ")?"<<rhs<<":"<<rhs<<"+1.0)";
-#endif
         return ss.str();
     }
     virtual std::string BinFuncName(void) const { return "fcount"; }
@@ -1556,8 +1546,8 @@ DynamicKernelArgument *VectorRefFactory(const std::string &s,
     {
         return new DynamicKernelSlidingArgument<Base>(s, ft, pCodeGen, index);
     }
-    // COUNT is not supported yet
-    else if (dynamic_cast<OpCount*>(pCodeGen.get()))
+    // Sub is not a reduction per se
+    else if (dynamic_cast<OpSub*>(pCodeGen.get()))
     {
         return new DynamicKernelSlidingArgument<Base>(s, ft, pCodeGen, index);
     }


More information about the Libreoffice-commits mailing list