summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorfengzeng <fengzeng@multicorewareinc.com>2013-11-04 16:25:48 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-05 14:15:24 -0600
commit8d460457876bbe696d6a2101ee49f81dedddb382 (patch)
treee81d1db0e9c2d2a174715e6e556c61349054cf83 /sc
parent041d7146412750ded74bfe7e59c14e7ffd9d35ac (diff)
GPU Calc: implement fix for SIN
AMLOEXT-58 FIX Change-Id: I68d23a66fd46b239911f8ba686b0492ca7783267 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
-rw-r--r--sc/source/core/opencl/op_math.cxx30
-rw-r--r--sc/source/core/opencl/op_math.hxx8
3 files changed, 40 insertions, 2 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index c8c07e4d4395..a0a2d3a57bbb 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1032,6 +1032,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i], new OpPV));
break;
+ case ocSin:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i], new OpSin));
+ 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 b3afda2ac47c..3d7d4c94801c 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -109,7 +109,35 @@ void OpSinh::GenSlidingWindowFunction(std::stringstream &ss,
ss << " return tmp;\n";
ss << "}";
}
-
+void OpSin::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";
+ ss << "{\n";
+ ss << " int gid0=get_global_id(0);\n";
+ ss << " double arg0 = "<< vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n";
+#ifdef ISNAN
+ ss << " if(isNan(arg0)||(gid0>=";
+ ss << tmpCurDVR->GetArrayLength();
+ ss << "))\n";
+ ss << " arg0 = 0;\n";
+#endif
+ ss << " double tmp=sin(arg0);\n";
+ ss << " return tmp;\n";
+ ss << "}";
+}
void OpAbs::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 1e59c4187d8e..1dbfec9fa5d1 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -38,7 +38,13 @@ public:
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "Sinh"; }
};
-
+class OpSin: public Normal
+{
+public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "Sin"; }
+};
class OpAbs:public Normal{
public:
virtual void GenSlidingWindowFunction(std::stringstream &ss,