diff options
author | yiming ju <yiming@multicorewareinc.com> | 2013-11-07 15:08:02 +0800 |
---|---|---|
committer | I-Jui (Ray) Sung <ray@multicorewareinc.com> | 2013-11-13 17:44:14 -0600 |
commit | 2d30a56f77dc7e50fd6050f223b52c2a0c0ab311 (patch) | |
tree | d4c2e92ef3200afbd9bb917f2cf52c2e0639a092 /sc/source | |
parent | b07bfeea13e32a6fbf70d5932901a95c02ebf878 (diff) |
GPU Calc: implemented ROUND
AMLOEXT-156 FIX
Change-Id: I149b663736b1d126414ce034262e83fd05a558fb
Signed-off-by: haochen <haochen@multicorewareinc.com>
Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.cxx | 27 | ||||
-rw-r--r-- | sc/source/core/opencl/op_math.hxx | 7 |
3 files changed, 38 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 0fccd9d94062..96ba7329d8ff 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1196,6 +1196,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments( mvSubArguments.push_back(SoPHelper(ts, ft->Children[i],new OpLn)); break; + case ocRound: + mvSubArguments.push_back(SoPHelper(ts, + ft->Children[i],new OpRound)); + 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 569a7173c013..7e76952502cd 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -629,6 +629,33 @@ void OpLn::GenSlidingWindowFunction( ss << " return tmp;\n"; ss << "}"; } + +void OpRound::GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments) +{ + 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 << " int singleIndex = gid0;\n"; + GenTmpVariables(ss,vSubArguments); + CheckAllSubArgumentIsNan(ss,vSubArguments); + ss << " for(int i=0;i<tmp1;i++)\n"; + ss << " tmp0 = tmp0 * 10;\n"; + ss << " double tmp=round(tmp0);\n"; + ss << " for(int i=0;i<tmp1;i++)\n"; + ss << " tmp = tmp / 10;\n"; + ss << " return tmp;\n"; + ss << "}"; +} + + }} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 2167ce52760e..8a151a8f6cfa 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -160,6 +160,13 @@ public: const std::string sSymName, SubArguments &vSubArguments); virtual std::string BinFuncName(void) const { return "Ln"; } }; +class OpRound: public CheckVariables +{ +public: + virtual void GenSlidingWindowFunction(std::stringstream &ss, + const std::string sSymName, SubArguments &vSubArguments); + virtual std::string BinFuncName(void) const { return "Round"; } +}; }} #endif |