diff options
author | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-19 19:24:06 -0600 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-19 20:07:20 -0600 |
commit | 726ccd5ae1ab6608497e4aac8c62a5206488a0fb (patch) | |
tree | fc2d5c84fd88c5ea3e40b87c273da0a0b8203e27 /sc/source | |
parent | 4757ed435519b660d6e7922006a630f23bfedd5d (diff) |
GPU Calc: parallel reduction version of COUNT
Change-Id: Ia90b5aaf044379b5bfc55ec525f9be2f6fda6028
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 388605cb520e..3e40716bb23b 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); } |