diff options
author | dechuang <dechuang@multicorewareinc.com> | 2013-11-08 09:08:22 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-14 14:09:43 -0600 |
commit | a115ee4c3540bc7b16bb5ef2362c85e88e2d2e27 (patch) | |
tree | 1daaa7437513d2f7e01aaed10befdd27d31b0539 | |
parent | 288d7f275169cb603411265c610e1f3b37d9d9c3 (diff) |
GPU Calc: implemented POWER
AMLOEXT-117 FIX
Change-Id: I5351a3cb881860a96080d57df320538bdd11f9de
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.cxx | 35 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.hxx | 7 |
3 files changed, 46 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 7d7326789537..8305686d04ee 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1220,6 +1220,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],new OpChiDist)); break; + case ocPower: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i], new OpPower)); + break; case ocExternal: if ( !(pChild->GetExternal().compareTo(OUString( "com.sun.star.sheet.addin.Analysis.getEffect")))) diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 3dda88bf11d1..2ed358dee34b 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -435,6 +435,41 @@ void OpTanH::GenSlidingWindowFunction(std::stringstream &ss, ss << " return tmp;\n"; ss << "}"; } +void OpPower::GenSlidingWindowFunction( + std::stringstream &ss, const std::string sSymName, + SubArguments &vSubArguments) +{ + FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); + const formula::SingleVectorRefToken*tmpCurDVR= dynamic_cast<const + formula::SingleVectorRefToken *>(tmpCur); + ss << "\ndouble " << sSymName; + ss << "_"<< BinFuncName() <<"("; + for (unsigned i = 0; i < vSubArguments.size(); i++) + { + if (i) + ss << ","; + vSubArguments[i]->GenSlidingWindowDecl(ss); + } + ss << ")\n{\n"; + ss <<" int gid0=get_global_id(0);\n"; + ss << " double arg0 = " << vSubArguments[0]->GenSlidingWindowDeclRef(); + ss << ";\n"; + ss << " double arg1 = " << vSubArguments[1]->GenSlidingWindowDeclRef(); + ss << ";\n"; +#ifdef ISNAN + ss<< " if(isNan(arg0)||(gid0>="; + ss<<tmpCurDVR->GetArrayLength(); + ss<<"))\n"; + ss<<" arg0 = 0;\n"; + ss<< " if(isNan(arg1)||(gid0>="; + ss<<tmpCurDVR->GetArrayLength(); + ss<<"))\n"; + ss<<" arg1 = 0;\n"; +#endif + ss << " double tmp=pow(arg0,arg1);\n"; + ss << " return tmp;\n"; + ss << "}"; +} void OpSqrt::GenSlidingWindowFunction(std::stringstream &ss, const std::string sSymName, SubArguments &vSubArguments) { diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 1dbcc1babdc9..af4b98d8bc18 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -183,6 +183,13 @@ public: virtual std::string BinFuncName(void) const { return "Coth"; } }; +class OpPower: public Normal +{ +public: + virtual void GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments); + virtual std::string BinFuncName(void) const { return "Power"; } +}; }} #endif |