summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhongyu zhong <hongyu@multicorewareinc.com>2013-11-06 12:20:45 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-11-13 14:39:18 -0600
commit66de10ae1fd74e0ebe53d535a0ee7412341fe5cd (patch)
tree96c9e9a5212f18bdf0913b1bf543a9584faccc17
parent16023a09f319cce4df8b8b1ca2b44c67ed4e9a08 (diff)
GPU Calc: implemented for PHI
AMLOEXT-105 FIX Change-Id: I41648a58937ca2cb77fe06f23543bcb9c9480332 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.cxx4
-rw-r--r--sc/source/core/opencl/op_statistical.cxx37
-rw-r--r--sc/source/core/opencl/op_statistical.hxx6
3 files changed, 47 insertions, 0 deletions
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 67a4896bb654..5feaecfd88a9 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1120,6 +1120,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(
mvSubArguments.push_back(SoPHelper(ts,
ft->Children[i],new OpVariationen2));
break;
+ case ocPhi:
+ mvSubArguments.push_back(SoPHelper(ts,
+ ft->Children[i],new OpPhi));
+ break;
case ocExternal:
if ( !(pChild->GetExternal().compareTo(OUString(
"com.sun.star.sheet.addin.Analysis.getEffect"))))
diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index 2b77d2afdf27..f27ab46caec1 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -1169,6 +1169,43 @@ void OpVariationen2::GenSlidingWindowFunction(
ss << " return tmp;\n";
ss << "}\n";
}
+void OpPhi::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";
+ ss << "{\n";
+ ss << " double x;\n";
+ ss << " int gid0=get_global_id(0);\n";
+#ifdef ISNAN
+ FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken();
+ const formula::SingleVectorRefToken*tmpCurDVR0= dynamic_cast<const
+ formula::SingleVectorRefToken *>(tmpCur0);
+ ss << " int buffer_x_len = ";
+ ss << tmpCurDVR0->GetArrayLength();
+ ss << ";\n";
+#endif
+#ifdef ISNAN
+ ss <<" if((gid0)>=buffer_x_len || isNan(";
+ ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss <<"))\n";
+ ss <<" x = 0;\n";
+ ss <<" else \n";
+#endif
+ ss << " x = "<<vSubArguments[0]->GenSlidingWindowDeclRef();
+ ss << ";\n";
+ ss << " double tmp = 0.39894228040143268 * exp(-(x * x) / 2.0);\n";
+ ss << " return tmp;\n";
+ ss << "}\n";
+}
void OpNorminv::GenSlidingWindowFunction(
std::stringstream &ss,const std::string sSymName,
SubArguments &vSubArguments)
diff --git a/sc/source/core/opencl/op_statistical.hxx b/sc/source/core/opencl/op_statistical.hxx
index dc47fc190116..c91e0f4d379e 100644
--- a/sc/source/core/opencl/op_statistical.hxx
+++ b/sc/source/core/opencl/op_statistical.hxx
@@ -147,6 +147,12 @@ class OpNormsinv:public Normal{
const std::string sSymName, SubArguments &vSubArguments);
virtual std::string BinFuncName(void) const { return "OpNormsinv"; }
};
+class OpPhi:public Normal{
+ public:
+ virtual void GenSlidingWindowFunction(std::stringstream &ss,
+ const std::string sSymName, SubArguments &vSubArguments);
+ virtual std::string BinFuncName(void) const { return "OpPhi"; }
+};
class OpKurt: public Normal
{
public: