summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhenyu yuan <zhenyuyuan@multicorewareinc.com>2013-12-03 14:12:13 +0800
committerI-Jui (Ray) Sung <ray@multicorewareinc.com>2013-12-18 20:34:53 -0600
commit6c29963fd762143605d74394eb5eb865602ce793 (patch)
tree143a13dabf807d6055bfdd3e8f24889cfc8e0f1c
parentfa42c60b2c6d1bd38f01c10851e173402a84e8f9 (diff)
GPU Calc: Optimized COSH
AMLOEXT-256 Change-Id: I1e94b145943b88ba3c5cfd650577d8151d806550 Signed-off-by: haochen <haochen@multicorewareinc.com> Signed-off-by: Wei Wei <weiwei@multicorewareinc.com> Signed-off-by: I-Jui (Ray) Sung <ray@multicorewareinc.com>
-rw-r--r--sc/source/core/opencl/op_math.cxx9
-rw-r--r--sc/source/core/opencl/op_math.hxx2
-rw-r--r--sc/source/core/opencl/opinlinefun_math.hxx9
3 files changed, 18 insertions, 2 deletions
diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx
index 70135b1c0b6b..60b02270fc03 100644
--- a/sc/source/core/opencl/op_math.cxx
+++ b/sc/source/core/opencl/op_math.cxx
@@ -52,6 +52,13 @@ void OpCos::GenSlidingWindowFunction(std::stringstream &ss,
ss << "}";
}
+void OpCosh::BinInlineFun(std::set<std::string>& decls,
+ std::set<std::string>& funs)
+{
+ decls.insert(local_coshDecl);
+ funs.insert(local_cosh);
+}
+
void OpCosh::GenSlidingWindowFunction(std::stringstream &ss,
const std::string sSymName, SubArguments &vSubArguments)
{
@@ -76,7 +83,7 @@ void OpCosh::GenSlidingWindowFunction(std::stringstream &ss,
ss<<"))\n";
ss<<" arg0 = 0;\n";
#endif
- ss << " double tmp=cosh(arg0);\n";
+ ss << " double tmp=local_cosh(arg0);\n";
ss << " return tmp;\n";
ss << "}";
}
diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx
index 0239acb609fc..c3b5e7a80396 100644
--- a/sc/source/core/opencl/op_math.hxx
+++ b/sc/source/core/opencl/op_math.hxx
@@ -46,7 +46,7 @@ class OpCosh: public Normal
public:
virtual void GenSlidingWindowFunction(std::stringstream &ss,
const std::string sSymName, SubArguments &vSubArguments);
-
+ virtual void BinInlineFun(std::set<std::string>& ,std::set<std::string>& );
virtual std::string BinFuncName(void) const { return "Cosh"; }
};
class OpSinh: public Normal
diff --git a/sc/source/core/opencl/opinlinefun_math.hxx b/sc/source/core/opencl/opinlinefun_math.hxx
index 0f943d973c62..44196b5ad1e6 100644
--- a/sc/source/core/opencl/opinlinefun_math.hxx
+++ b/sc/source/core/opencl/opinlinefun_math.hxx
@@ -47,6 +47,15 @@ std::string local_coth =
" return nVal;\n"
"}\n";
+std::string local_coshDecl = "double local_cosh(double n);\n";
+std::string local_cosh =
+"double local_cosh(double n)\n"
+"{\n"
+" double nVal = (exp(n) + exp(-n)) / 2;\n"
+" return nVal;\n"
+"}\n";
+
+
#endif //SC_OPENCL_OPINLINFUN_MATH
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */