summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorhaochen <haochen@multicorewareinc.com>2013-10-25 12:44:43 +0800
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-10-29 17:00:26 -0400
commitef9a48f3325753c8d0a321e22684df2bc57e61b7 (patch)
treec61bf3d602df76a3ea6b5c7119d35bd11c928fd8 /sc
parentc204c1a9b14709dd439b2a483c81b043fb2eeaf5 (diff)
Implement fix for CSC in GPU Calc
Change-Id: I075f9951c07088a9b6346a7ffad6fb7e3284ea8a Signed-off-by: Wei Wei <weiwei@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/OP_math.cxx33
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
2 files changed, 37 insertions, 0 deletions
diff --git a/sc/source/core/opencl/OP_math.cxx b/sc/source/core/opencl/OP_math.cxx
index 2b97bd19074a..9b9466bfec9f 100644
--- a/sc/source/core/opencl/OP_math.cxx
+++ b/sc/source/core/opencl/OP_math.cxx
@@ -51,5 +51,38 @@ public:
virtual std::string BinFuncName(void) const { return "Cos"; }
};
+class OpCsc: public Normal
+{
+public:
+ virtual void 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\t";
+ ss <<"int gid0=get_global_id(0);\n\t";
+ ss << "double arg0 = " << vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n\t";
+#ifdef ISNAN
+ ss<< "if(isNan(arg0)||(gid0>=";
+ ss<<tmpCurDVR->GetArrayLength();
+ ss<<"))\n\t\t";
+ ss<<"arg0 = 0;\n\t";
+#endif
+ ss << "double tmp=1/sin(arg0);\n\t";
+ ss << "return tmp;\n";
+ ss << "}";
+ }
+ virtual std::string BinFuncName(void) const { return "Csc"; }
+};
}}
#endif \ No newline at end of file
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index b28ae295b1a7..9c616d61cdee 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -819,6 +819,10 @@ DynamicKernelSoPArguments<Op>::DynamicKernelSoPArguments(const std::string &s,
mvSubArguments.push_back(SoPHelper<OpRsq>(ts,
ft->Children[i]));
break;
+ case ocCosecant:
+ mvSubArguments.push_back(SoPHelper<OpCsc>(ts,
+ ft->Children[i]));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))