sc/source/core/opencl/op_statistical.cxx | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
New commits: commit 94efbf7b1eb854cae5087239a2cd1555b752edf9 Author: Luboš Luňák <[email protected]> AuthorDate: Tue Nov 27 15:53:45 2018 +0100 Commit: Luboš Luňák <[email protected]> CommitDate: Wed Dec 5 10:58:41 2018 +0100 make OpenCL SLOPE() handle problems more gracefully It's silly to just return NaN just because the function can't handle something. If nothing else, at least a proper error should be reported (or in this case, the fallback to the core function will take care of it). Change-Id: I9c971082f4c5c9836318cf63d15fa7c278274273 Reviewed-on: https://gerrit.libreoffice.org/64244 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> (cherry picked from commit c0c03aadb3ec25ca5c4c07f270164158b6667cc2) Reviewed-on: https://gerrit.libreoffice.org/64534 diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 5278ad2b31f7..d18b3ffceec1 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -2548,6 +2548,7 @@ void OpStDevP::GenSlidingWindowFunction(std::stringstream &ss, void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments) { + CHECK_PARAMETER_COUNT(2,2); ss << "\ndouble " << sSymName; ss << "_" << BinFuncName() << "("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -2567,12 +2568,6 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, ss << " double fCount = 0.0;\n"; ss << " double argX = 0.0;\n"; ss << " double argY = 0.0;\n"; - if(vSubArguments.size() != 2) - { - ss << " return NAN;\n"; - ss << "}\n"; - return ; - } FormulaToken *pCur = vSubArguments[1]->GetFormulaToken(); FormulaToken *pCur1 = vSubArguments[0]->GetFormulaToken(); assert(pCur); @@ -2591,11 +2586,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, pDVR1->GetArrayLength() ? pDVR->GetArrayLength(): pDVR1->GetArrayLength(); if(nCurWindowSize != nCurWindowSize1) - { - ss << " return NAN;\n"; - ss << "}\n"; - return ; - } + throw Unhandled(__FILE__, __LINE__); ss << " for (int i = "; if ((!pDVR->IsStartFixed() && pDVR->IsEndFixed()) &&(!pDVR1->IsStartFixed() && pDVR1->IsEndFixed())) @@ -2626,13 +2617,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, } else { - ss << "0; i < " << nCurWindowSize << "; i++)\n"; - ss << " {\n"; - ss << " break;\n"; - ss << " }"; - ss << " return NAN;\n"; - ss << "}\n"; - return ; + throw Unhandled(__FILE__, __LINE__); } ss << " argX = "; @@ -2701,8 +2686,7 @@ void OpSlope::GenSlidingWindowFunction(std::stringstream &ss, } else { - ss << " return NAN;\n"; - ss << "}\n"; + throw Unhandled(__FILE__, __LINE__); } } void OpSTEYX::GenSlidingWindowFunction(std::stringstream &ss, commit 4cf986afb3d7fb9f59b900f766c0273d4455b8e0 Author: Luboš Luňák <[email protected]> AuthorDate: Tue Nov 27 15:35:27 2018 +0100 Commit: Luboš Luňák <[email protected]> CommitDate: Wed Dec 5 10:58:26 2018 +0100 check that OpenCL NORMDIST() takes a proper number of arguments Change-Id: I885a1b70556311f5a0862fec24a3596dbeada5d6 Reviewed-on: https://gerrit.libreoffice.org/64243 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> (cherry picked from commit 93054cd09f521499ed48848cb4d3563e629593f7) Reviewed-on: https://gerrit.libreoffice.org/64533 diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 374b383dcc4c..5278ad2b31f7 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -4016,6 +4016,7 @@ void OpNormdist::GenSlidingWindowFunction( std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments) { + CHECK_PARAMETER_COUNT(3,4); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -4028,7 +4029,8 @@ void OpNormdist::GenSlidingWindowFunction( ss << "{\n"; ss << " double x,mue,sigma,c;\n"; ss << " int gid0=get_global_id(0);\n"; - ss << " double tmp0,tmp1,tmp2,tmp3;\n"; + ss << " double tmp0,tmp1,tmp2;\n"; + ss << " double tmp3 = 0;\n"; // optional argument ss <<"\n "; for (size_t i = 0; i < vSubArguments.size(); i++) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
