sc/source/core/opencl/formulagroupcl.cxx | 4 -- sc/source/core/opencl/op_statistical.cxx | 59 ------------------------------- sc/source/core/opencl/op_statistical.hxx | 6 --- 3 files changed, 69 deletions(-)
New commits: commit 1af18947bfd0d6a9c318bfafd5c5d73c23266d45 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Thu Sep 22 09:55:36 2022 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu Sep 22 18:06:57 2022 +0200 drop opencl implementation of MEDIAN() Input data to this function is not required to be sorted, so implementing this would mean sorting it in opencl, which is not exactly trivial and not worth the effort. There also exist algorithms that find the median without sorting an array, but they work by guessing it and looping until their guess is right, so again, not worth the trouble. I'd say there's nothing to be gained here from using opencl. Change-Id: Ic6d6efdfc59b9058bdae50d07d8039db481dfb75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140397 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 967f52c4ce43..5920b50ca402 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2344,10 +2344,6 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared<OpWeibull>(), nResultSize)); break; - /*case ocMedian: - mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i],std::make_shared<OpMedian)); - break;*/ case ocDDB: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared<OpDDB>(), nResultSize)); diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index fd28dc2fcf94..4c79d162e62c 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -804,65 +804,6 @@ void OpNormsinv:: GenSlidingWindowFunction ss << "}\n"; } -void OpMedian::GenSlidingWindowFunction( - outputstream &ss, const std::string &sSymName, - SubArguments &vSubArguments) -{ - GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); - ss << "{\n"; - ss << " int gid0 = get_global_id(0);\n"; - ss << " double tmp = 0;\n"; - ss << " int i;\n"; - ss << " unsigned int startFlag = 0;\n"; - ss << " unsigned int endFlag = 0;\n"; - ss << " double dataIna;\n"; - for (const DynamicKernelArgumentRef & rArg : vSubArguments) - { - FormulaToken *pCur = rArg->GetFormulaToken(); - assert(pCur); - if (const formula::DoubleVectorRefToken* pCurDVR = - dynamic_cast<const formula::DoubleVectorRefToken *>(pCur)) - { - size_t nCurWindowSize = pCurDVR->GetRefRowSize(); - ss << "startFlag = "; - if (!pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed()) - { - ss << "gid0; endFlag = "<< nCurWindowSize <<"-gid0;\n"; - } - ss << "gid0; endFlag = gid0+"<< nCurWindowSize <<";\n"; - } - else - { - ss<<"startFlag=gid0;endFlag=gid0;\n"; - } - } - FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken(); - const formula::DoubleVectorRefToken*tmpCurDVR0= static_cast<const - formula::DoubleVectorRefToken *>(tmpCur0); - ss << "int buffer_fIna_len = "; - ss << tmpCurDVR0->GetArrayLength(); - ss << ";\n"; - ss<<"if((i+gid0)>=buffer_fIna_len || isnan("; - ss << vSubArguments[0]->GenSlidingWindowDeclRef(); - ss<<"))\n"; - ss<<" dataIna = 0;\n"; - ss << " int nSize =endFlag- startFlag ;\n"; - ss << " if (nSize & 1)\n"; - ss << " {\n"; - ss << " tmp = "<<vSubArguments[0]->GetName(); - ss << " [startFlag+nSize/2];\n"; - ss << " }\n"; - ss << " else\n"; - ss << " {\n"; - ss << " tmp =("<<vSubArguments[0]->GetName(); - ss << " [startFlag+nSize/2]+"; - ss << vSubArguments[0]->GetName(); - ss << " [startFlag+nSize/2-1])/2;\n"; - ss << " }\n"; - ss <<" return tmp;\n"; - ss << "}\n"; -} - void OpLogInv::BinInlineFun(std::set<std::string>& decls, std::set<std::string>& funs) { diff --git a/sc/source/core/opencl/op_statistical.hxx b/sc/source/core/opencl/op_statistical.hxx index 2741efe49656..827c6a0456af 100644 --- a/sc/source/core/opencl/op_statistical.hxx +++ b/sc/source/core/opencl/op_statistical.hxx @@ -149,12 +149,6 @@ class OpNormdist:public Normal{ const std::string &sSymName, SubArguments &vSubArguments) override; virtual std::string BinFuncName() const override { return "OpNormdist"; } }; -class OpMedian:public Normal{ - public: - virtual void GenSlidingWindowFunction(outputstream &ss, - const std::string &sSymName, SubArguments &vSubArguments) override; - virtual std::string BinFuncName() const override { return "OpMedian"; } -}; class OpNormsdist:public Normal{ public: virtual void GenSlidingWindowFunction(outputstream &ss,